huangsn пре 5 година
родитељ
комит
89237aed9f

+ 25 - 8
src/pages/fengkong/features/list.js → src/pages/fengkong/features/feature.js

@@ -3,8 +3,9 @@ import { FilterTable } from 'wptpc-design'
 import { thanos } from '@/conf/config'
 
 const apiUrl = `${thanos}/thanos-admin/api/v1/feature/list`
+const apiQueryUrl = `${thanos}/thanos-admin/api/v1/feature/query`
 
-class SubJobList extends React.PureComponent {
+class FeaturesList extends React.PureComponent {
   state = {
     showModal: false,
     params: {}
@@ -16,7 +17,7 @@ class SubJobList extends React.PureComponent {
       {
         label: '描述:',
         type: 'input',
-        key: 'desc',
+        key: 'queryName',
         placeholder: '特征名称'
       }
     ]
@@ -28,12 +29,16 @@ class SubJobList extends React.PureComponent {
 
   // filtertable的列表配置
   tableSetting = {
-    rowKey: 'alias',
-    isFrontPagination: true,
+    // rowKey: 'alias',
+    // isFrontPagination: true,
     pagination: {
       pageSize: 10
     },
     columnConfig: [
+      {
+        title: 'ID',
+        dataIndex: 'id'
+      },
       {
         title: '名称',
         dataIndex: 'name'
@@ -44,11 +49,23 @@ class SubJobList extends React.PureComponent {
       },
       {
         title: '是否输出',
-        dataIndex: 'overt'
+        dataIndex: 'overt',
+        render: (text) => {
+          if(text === true) {
+            return '是'
+          } 
+          return '否'
+        }
       },
       {
         title: '是否IO型特征',
-        dataIndex: 'io'
+        dataIndex: 'io',
+        render: (text) => {
+          if(text === true) {
+            return '是'
+          } 
+          return '否'
+        }
       },
       {
         title: '数据类型',
@@ -68,10 +85,10 @@ class SubJobList extends React.PureComponent {
     return (
       <div>
         <FilterTable filterSetting={this.filterSetting} tableSetting={this.tableSetting} apiUrl={apiUrl}
-          isPage={false}/>
+          />
       </div>
     )
   }
 }
 
-export default SubJobList
+export default FeaturesList

+ 94 - 0
src/pages/fengkong/features/group.js

@@ -0,0 +1,94 @@
+import React from 'react'
+import { FilterTable } from 'wptpc-design'
+import { thanos } from '@/conf/config'
+
+const apiUrl = `${thanos}/thanos-admin/api/v1/group/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: 'overt'
+      },
+      {
+        title: '后置函数',
+        dataIndex: 'io',
+        render: (text) => {
+          if(text === true) {
+            return '是'
+          } 
+          return '否'
+        }
+      },
+      {
+        title: '创始人',
+        dataIndex: 'returnType'
+      }
+    //   {
+    //     title: '操作',
+    //     dataIndex: 'actions',
+    //     // 所有需要弹窗操作的都可以用编辑的逻辑;所有不需要弹窗的操作,比如上架、发布等,都可以用”删除“的逻辑
+    //     render: (text, record) => <span><a onClick={() => this.editItem(record)}>编辑</a><Divider
+    //       type="vertical"/><Popconfirm
+    //       title="确定删除"
+    //       onConfirm={() => this.delItem(record)}>
+    //       <a>删除</a>
+    //     </Popconfirm><Divider type="vertical"/></span>
+    //   }
+    ],
+    getRefresh: refresh => {
+      this.refresh = refresh
+    },   
+  }
+
+  render () {
+    return (
+      <div>
+        <FilterTable filterSetting={this.filterSetting} tableSetting={this.tableSetting} apiUrl={apiUrl}
+          />
+      </div>
+    )
+  }
+}
+
+export default GroupList

+ 29 - 0
src/pages/fengkong/features/model.js

@@ -0,0 +1,29 @@
+import {
+  addItem, delItem, editItem
+} from './service'
+
+export default {
+  namespace: 'template',
+  state: {},
+  effects: {
+    * _addItem ({ payload, callback }, { call }) {
+      const res = yield call(addItem, payload)
+      if (res) {
+        if (callback) callback(res)
+      }
+    },
+    * _editItem ({ payload, callback }, { call }) {
+      const res = yield call(addItem, payload)
+      if (res) {
+        if (callback) callback(res)
+      }
+    },
+    * _delItem ({ payload, callback }, { call }) {
+      const res = yield call(delItem, payload)
+      if (res) {
+        if (callback) callback(res)
+      }
+    }
+  },
+  reducers: {}
+}

+ 24 - 0
src/pages/fengkong/features/service.js

@@ -0,0 +1,24 @@
+import { fetchApi } from '@/apis/'
+import { thanos } from '@/conf/config'
+
+export async function addItem (params) {
+  console.log("addRule")
+  const url = `${thanos}/dc/web/edit-rule`
+  return fetchApi(url, params)
+}
+
+export async function delItem (params) {
+  const url = `${thanos}/dc/web/delete-rule`
+  return fetchApi(url, params)
+}
+
+export async function editItem (params) {
+  console.log("editRule")
+  const url = `${thanos}/dc/web/edit-rule`
+  return fetchApi(url, params)
+}
+
+export async function execItem (params) {
+  const url = `${thanos}/dc/web/command`
+  return fetchApi(url, params)
+}