Browse Source

Merge branch 'feature/fengkong_thanos' of gitlab.weipaitang.com:admin-manager/dc into feature/fengkong_thanos

刘涛 5 năm trước cách đây
mục cha
commit
6094198431

+ 31 - 0
src/pages/fengkong/features/group/index.js

@@ -3,6 +3,8 @@ import { FilterTable } from 'wptpc-design'
 import { Link } from 'dva/router'
 import { thanos } from '@/conf/config'
 import { Button } from 'antd'
+import { Divider, message, Popconfirm } from 'antd'
+import { delItem } from './service.js'
 
 const apiUrl = `${thanos}/thanos-admin/api/v1/group/list`
 
@@ -66,12 +68,41 @@ class GroupList extends React.PureComponent {
       {
         title: '修改人',
         dataIndex: 'updateUser'
+      },
+      {
+        title: '操作',
+        dataIndex: 'actions',
+        // 所有需要弹窗操作的都可以用编辑的逻辑;所有不需要弹窗的操作,比如上架、发布等,都可以用”删除“的逻辑
+        render: (text, record) => (
+          <span>
+            <Link
+              to={{
+                pathname: './edit/' + record.name,
+                state: record
+              }}
+            >编辑</Link>
+            <Divider type="vertical"/>
+            <Popconfirm
+              title="确定删除"
+              onConfirm={() => this.delItem(record)}>
+              <a>删除</a>
+            </Popconfirm>
+          </span>)
       }
     ],
     getRefresh: refresh => {
       this.refresh = refresh
     }
   }
+    // 点击删除按钮时的事件处理函数
+    delItem = (record) => {
+      delItem({ id: record.id, name: record.name }).then(res => {
+        if (res.code === 0) {
+          message.success('删除成功')
+          this.refresh()
+        }
+      })
+    }
 
   render () {
     return (

+ 6 - 0
src/pages/fengkong/features/group/service.js

@@ -24,3 +24,9 @@ export async function update (params) {
   const url = `${thanos}/thanos-admin/api/v1/group/update`
   return fetchApi(url, params)
 }
+
+//删除
+export async function delItem (params) {
+  const url = `${thanos}/thanos-admin/api/v1/group/delete`
+  return fetchApi(url, params)
+}