Forráskód Böngészése

增加策略列表

刘涛 5 éve
szülő
commit
d0dbc9ad51

+ 2 - 12
src/pages/fengkong/features/feature.js

@@ -50,22 +50,12 @@ class FeaturesList extends React.PureComponent {
       {
         title: '是否输出',
         dataIndex: 'overt',
-        render: (text) => {
-          if(text === true) {
-            return '是'
-          } 
-          return '否'
-        }
+        render: (text) => text === true ? '是' : '否'
       },
       {
         title: '是否IO型特征',
         dataIndex: 'io',
-        render: (text) => {
-          if(text === true) {
-            return '是'
-          } 
-          return '否'
-        }
+        render: (text) => text === true ? '是' : '否'
       },
       {
         title: '数据类型',

+ 6 - 2
src/pages/fengkong/features/group.js

@@ -55,8 +55,12 @@ class GroupList extends React.PureComponent {
         dataIndex: 'postScript'
       },
       {
-        title: '创人',
+        title: '创人',
         dataIndex: 'createUser'
+      },
+      {
+        title: '修改人',
+        dataIndex: 'updateUser'
       }
     //   {
     //     title: '操作',
@@ -72,7 +76,7 @@ class GroupList extends React.PureComponent {
     ],
     getRefresh: refresh => {
       this.refresh = refresh
-    },   
+    },
   }
 
   render () {

+ 21 - 0
src/pages/fengkong/strategies/edit.js

@@ -0,0 +1,21 @@
+import React from 'react'
+
+class GroupList extends React.PureComponent {
+  state = {
+    showModal: false,
+    params: {}
+  }
+
+  render () {
+    const { location } = this.props
+    console.log(location, '----')
+    return (
+      <div>
+        hhhh
+        {location.state.name}
+      </div>
+    )
+  }
+}
+
+export default GroupList

+ 121 - 0
src/pages/fengkong/strategies/strategies.js

@@ -0,0 +1,121 @@
+import React from 'react'
+import { FilterTable } from 'wptpc-design'
+import { Link } from 'dva/router'
+import { thanos } from '@/conf/config'
+import { Divider, Popconfirm } from 'antd'
+
+const apiUrl = `${thanos}/thanos-admin/api/v1/dsl/list`
+
+class GroupList extends React.PureComponent {
+  state = {
+    showModal: false,
+    params: {}
+  }
+
+  filterSetting = {
+    isClearSearch: true,
+    formFields: [
+      {
+        label: '描述:',
+        type: 'input',
+        key: 'queryName',
+        placeholder: '分组名称'
+      }
+    ]
+    // 在接口请求前,可以修改给接口的入参
+    // beforeSearchFunc: params => {
+    //   params.pageNum = params.pageNum
+    // }
+  }
+
+  // filtertable的列表配置
+  tableSetting = {
+    // rowKey: 'alias',
+    // isFrontPagination: true,
+    pagination: {
+      pageSize: 10
+    },
+    columnConfig: [
+      {
+        title: 'ID',
+        dataIndex: 'id'
+      },
+      {
+        title: '分组名称',
+        dataIndex: 'name'
+      },
+      {
+        title: '描述',
+        dataIndex: 'description'
+      },
+      {
+        title: '策略是否启用',
+        dataIndex: 'enabled',
+        render: (text) => text === true ? '是' : '否'
+      },
+      {
+        title: '创建人',
+        dataIndex: 'createUser'
+      },
+      {
+        title: '修改人',
+        dataIndex: 'updateUser'
+      },
+      {
+        title: '操作',
+        dataIndex: 'actions',
+        // 所有需要弹窗操作的都可以用编辑的逻辑;所有不需要弹窗的操作,比如上架、发布等,都可以用”删除“的逻辑
+        render: (text, record) => (
+          <span>
+            <Link
+              to={{
+                pathname: './edit',
+                state: record
+              }}
+            >编辑</Link>
+            <Divider type="vertical"/>
+            <Popconfirm
+              title="确定删除"
+              onConfirm={() => this.delItem(record)}>
+              <a>删除</a>
+            </Popconfirm>
+          </span>)
+      }
+    ],
+    getRefresh: refresh => {
+      this.refresh = refresh
+    }
+  }
+
+  // 点击编辑按钮时的事件处理函数
+  editItem (record) {
+    console.log('11111111=')
+    // const fields = JSON.parse(record.fieldsJson)
+    // console.log('=====', fields)
+    const { fields } = record
+    const fieldsJson = Object.keys(fields).map(f => ({
+      key: f,
+      desc: fields[f].desc,
+      column: fields[f].column
+    }))
+    console.log(fieldsJson)
+    this.setState({
+      showModal: true,
+      params: {
+        ...record,
+        fieldsJson
+      }
+    })
+  }
+
+  render () {
+    return (
+      <div>
+        <FilterTable filterSetting={this.filterSetting} tableSetting={this.tableSetting} apiUrl={apiUrl}
+        />
+      </div>
+    )
+  }
+}
+
+export default GroupList