gaozhan 5 жил өмнө
parent
commit
a6b5bbec08

+ 1 - 0
src/conf/config.js

@@ -6,6 +6,7 @@ let auth = '/back-autht/api'
 const hostDev = `${window.location.protocol}//${window.location.host}`
 const sTaskJobLog = 'http://ms-trace.weipaitang.com' // 定时任务日志跳转
 let thanos = '/thanos-admint/api'
+// let thanos = 'http://localhost:7070'
 
 if (document.domain === 'back-admin.weipaitang.com') {
   dc = '/back-api/api'

+ 1 - 0
src/pages/fengkong/model/components/editModel.js

@@ -59,6 +59,7 @@ export default class Index extends Component {
         onOk={onOk}
         onCancel={onCancel}
         okButtonProps={{ disabled: fetching }}
+        destroyOnClose
       >
         <FormItem formSetting={formSetting} params={params} onChange={onChange} />
       </Modal>

+ 44 - 4
src/pages/fengkong/namelist/blackdevicelist/index.js

@@ -3,8 +3,9 @@ import { FilterTable } from 'wptpc-design'
 import { connect } from 'dva'
 import { thanos } from '@/conf/config'
 import { Divider, message, Popconfirm, Button } from 'antd'
-import { delItem, addDeviceId } from './service.js'
+import { delItem, addDeviceId, batchAddNameList} from './service.js'
 import Edit from './components/Edit'
+import BatchEdit from '../commoncomponents/Edit'
 
 const apiUrl = `${thanos}/thanos-admin/api/v1/nameList/blackDeviceList`
 
@@ -19,12 +20,18 @@ class BlackDeviceList extends React.PureComponent {
       showModal: false,
       selectedItem: {},
       showEditModal: false,
-      params: {}
+      params: {},
+
+      showBatchModal: false,
+      selectedBatchItem: {},
+      showBatchEditModal: false,
+      batchParams: {},
+      batchRemark:"文件内包含名单字段 deviceId"
     }
   }
 
   filterSetting = {
-    rfBtnsJsx: <Button type="primary" onClick={() => this.addItem()}>添加DeviceId</Button>,
+    rfBtnsJsx: <div><Button type="primary" onClick={() => this.addBatchItem()}>批量导入</Button> <Button type="primary" onClick={() => this.addItem()}>添加DeviceId</Button></div>,
     isClearSearch: true,
     formFields: [
       {
@@ -103,12 +110,22 @@ class BlackDeviceList extends React.PureComponent {
     this.setState({ showEditModal: true, params: {} })
   }
 
+  addBatchItem = () => {
+    this.setState({ showBatchEditModal: true, batchParams: {} });
+  }
+
   onParamsChange = (key, value) => {
     const params = { ...this.state.params }
     params[key] = value
     this.setState({ params })
   }
 
+  onBatchParamsChange = (key, value) => {
+    const batchParams = { ...this.state.batchParams };
+    batchParams[key] = value;
+    this.setState({ batchParams });
+  }
+
   onEditOk = () => {
     const { params } = this.state
 
@@ -122,17 +139,40 @@ class BlackDeviceList extends React.PureComponent {
     })
   }
 
+  onBatchEditOk = () => {
+    const { csvFile, valid } = this.state.batchParams;
+    const params = new FormData()
+    params.append("csvFile", csvFile)
+    params.append("model", "BlackDevice")
+    params.append("valid", valid)
+    batchAddNameList(params).then(res => {
+      if (res.data.code === 0) {
+        message.success('批量导入成功')
+        this.refresh()// 刷新列表
+        this.onBatchEditCancel()//关闭弹窗
+      }else {
+        message.error('批量导入失败')
+      }
+    })
+
+  }
+
   onEditCancel = () => {
     this.setState({ showEditModal: false })
   }
 
+  onBatchEditCancel = () => {
+    this.setState({ showBatchEditModal: false })
+  }
+
   render () {
-    const { showModal, selectedItem, showEditModal, params } = this.state
+    const { showModal, selectedItem, showEditModal, params, showBatchEditModal, batchParams, batchRemark} = this.state
     return (
       <div>
         <FilterTable filterSetting={this.filterSetting} tableSetting={this.tableSetting} apiUrl={apiUrl}
         />
         <Edit showModal={showEditModal} params={params} onChange={this.onParamsChange} onOk={this.onEditOk} onCancel={this.onEditCancel} />
+        <BatchEdit showModal={showBatchEditModal} params={batchParams} onChange={this.onBatchParamsChange} onOk={this.onBatchEditOk} onCancel={this.onBatchEditCancel} batchRemark={batchRemark} />
       </div>
     )
   }

+ 5 - 0
src/pages/fengkong/namelist/blackdevicelist/service.js

@@ -10,4 +10,9 @@ export async function delItem (params) {
 export async function addDeviceId (params) {
   const url = `${thanos}/thanos-admin/api/v1/nameList/blackDeviceList/create`
   return fetchApi(url, params)
+}
+
+export async function batchAddNameList (body) {
+  const url = `${thanos}/thanos-admin/api/v1/nameList/batchNameList`
+  return fetchApi(url, { method: 'POST', contentType: 'jsonString', body })
 }

+ 43 - 9
src/pages/fengkong/namelist/blackiplist/index.js

@@ -3,8 +3,9 @@ import { FilterTable } from 'wptpc-design'
 import { connect } from 'dva'
 import { thanos } from '@/conf/config'
 import { message, Popconfirm, Button } from 'antd'
-import { delItem, addIP } from './service.js'
-import Edit from './components/Edit';
+import { delItem, addIP, batchAddNameList } from './service.js'
+import Edit from './components/Edit'
+import BatchEdit from '../commoncomponents/Edit'
 
 const apiUrl = `${thanos}/thanos-admin/api/v1/nameList/blackIpList`
 
@@ -19,12 +20,18 @@ class BlackIpList extends React.PureComponent {
       showModal: false,
       selectedItem: {},
       showEditModal: false,
-      params: {}
+      params: {},
+
+      showBatchModal: false,
+      selectedBatchItem: {},
+      showBatchEditModal: false,
+      batchParams: {},
+      batchRemark:"文件内包含名单字段 ip "
     }
   }
 
   filterSetting = {
-    rfBtnsJsx: <Button type="primary" onClick={() => this.addItem()}>添加IP</Button>,
+    rfBtnsJsx:<div> <Button type="primary" onClick={() =>this.addBatchItem()}>批量导入</Button> <Button type="primary" onClick={() => this.addItem()}>添加IP</Button></div>,
     isClearSearch: true,
     formFields: [
       {
@@ -34,10 +41,6 @@ class BlackIpList extends React.PureComponent {
         placeholder: 'IP查询'
       }
     ]
-    // 在接口请求前,可以修改给接口的入参
-    // beforeSearchFunc: params => {
-    //   params.pageNum = params.pageNum
-    // }
   }
 
   // filtertable的列表配置
@@ -103,11 +106,21 @@ class BlackIpList extends React.PureComponent {
   addItem = () => {
     this.setState({ showEditModal: true, params: {} });
   }
+
+  addBatchItem = () => {
+    this.setState({ showBatchEditModal: true, batchParams: {} });
+  }
+
   onParamsChange = (key, value) => {
     const params = { ...this.state.params };
     params[key] = value;
     this.setState({ params });
   }
+  onBatchParamsChange = (key, value) => {
+    const batchParams = { ...this.state.batchParams };
+    batchParams[key] = value;
+    this.setState({ batchParams });
+  }
   onEditOk = () => {
     const { params } = this.state;
 
@@ -120,16 +133,37 @@ class BlackIpList extends React.PureComponent {
       }
     })
   }
+  onBatchEditOk = () => {
+    const { csvFile, valid } = this.state.batchParams;
+    const params = new FormData()
+    params.append("csvFile", csvFile)
+    params.append("model", "BlackIp")
+    params.append("valid", valid)
+    batchAddNameList(params).then(res => {
+      if (res.data.code === 0) {
+        message.success('批量导入成功')
+        this.refresh()// 刷新列表
+        this.onBatchEditCancel()//关闭弹窗
+      }else {
+        message.error('批量导入失败')
+      }
+    })
+
+  }
   onEditCancel = () => {
     this.setState({ showEditModal: false })
   }
+  onBatchEditCancel = () => {
+    this.setState({ showBatchEditModal: false })
+  }
   render() {
-    const { showModal, selectedItem, showEditModal, params } = this.state;
+    const { showModal, selectedItem, showEditModal, params, showBatchEditModal, batchParams, batchRemark} = this.state;
     return (
       <div>
         <FilterTable filterSetting={this.filterSetting} tableSetting={this.tableSetting} apiUrl={apiUrl}
         />
         <Edit showModal={showEditModal} params={params} onChange={this.onParamsChange} onOk={this.onEditOk} onCancel={this.onEditCancel} />
+        <BatchEdit showModal={showBatchEditModal} params={batchParams} onChange={this.onBatchParamsChange} onOk={this.onBatchEditOk} onCancel={this.onBatchEditCancel} batchRemark={batchRemark} />
       </div>
     )
   }

+ 5 - 0
src/pages/fengkong/namelist/blackiplist/service.js

@@ -10,4 +10,9 @@ export async function delItem (params) {
 export async function addIP (params) {
   const url = `${thanos}/thanos-admin/api/v1/nameList/blackIpList/create`
   return fetchApi(url, params)
+}
+
+export async function batchAddNameList (body) {
+  const url = `${thanos}/thanos-admin/api/v1/nameList/batchNameList`
+  return fetchApi(url, { method: 'POST', contentType: 'jsonString', body })
 }

+ 45 - 5
src/pages/fengkong/namelist/blackuserlist/index.js

@@ -3,8 +3,9 @@ import { FilterTable } from 'wptpc-design'
 import { connect } from 'dva'
 import { thanos } from '@/conf/config'
 import { message, Popconfirm, Button } from 'antd'
-import { delItem, addUserId } from './service.js'
+import { delItem, addUserId, batchAddNameList } from './service.js'
 import Edit from './components/Edit';
+import BatchEdit from '../commoncomponents/Edit'
 
 const apiUrl = `${thanos}/thanos-admin/api/v1/nameList/blackUserList`
 
@@ -19,19 +20,25 @@ class BlackIpList extends React.PureComponent {
       showModal: false,
       selectedItem: {},
       showEditModal: false,
-      params: {}
+      params: {},
+
+      showBatchModal: false,
+      selectedBatchItem: {},
+      showBatchEditModal: false,
+      batchParams: {},
+      batchRemark:"文件内包含名单字段 userId "
     }
   }
 
   filterSetting = {
-    rfBtnsJsx: <Button type="primary" onClick={() => this.addItem()}>添加用户Id</Button>,
+    rfBtnsJsx: <div><Button type="primary" onClick={() => this.addBatchItem()}>批量导入</Button><Button type="primary" onClick={() => this.addItem()}>添加用户Id</Button></div>,
     isClearSearch: true,
     formFields: [
       {
         label: '',
         type: 'input',
         key: 'queryName',
-        placeholder: 'IP查询'
+        placeholder: '用户Id查询'
       }
     ]
     // 在接口请求前,可以修改给接口的入参
@@ -102,11 +109,23 @@ class BlackIpList extends React.PureComponent {
   addItem = () => {
     this.setState({ showEditModal: true, params: {} });
   }
+
+  addBatchItem = () => {
+    this.setState({ showBatchEditModal: true, batchParams: {} });
+  }
+
   onParamsChange = (key, value) => {
     const params = { ...this.state.params };
     params[key] = value;
     this.setState({ params });
   }
+
+  onBatchParamsChange = (key, value) => {
+    const batchParams = { ...this.state.batchParams };
+    batchParams[key] = value;
+    this.setState({ batchParams });
+  }
+
   onEditOk = () => {
     const { params } = this.state;
 
@@ -119,16 +138,37 @@ class BlackIpList extends React.PureComponent {
       }
     })
   }
+  onBatchEditOk = () => {
+    const { csvFile, valid } = this.state.batchParams;
+    const params = new FormData()
+    params.append("csvFile", csvFile)
+    params.append("model", "BlackUser")
+    params.append("valid", valid)
+    batchAddNameList(params).then(res => {
+      if (res.data.code === 0) {
+        message.success('批量导入成功')
+        this.refresh()// 刷新列表
+        this.onBatchEditCancel()//关闭弹窗
+      }else {
+        message.error('批量导入失败')
+      }
+    })
+
+  }
   onEditCancel = () => {
     this.setState({ showEditModal: false })
   }
+  onBatchEditCancel = () => {
+    this.setState({ showBatchEditModal: false })
+  }
   render() {
-    const { showModal, selectedItem, showEditModal, params } = this.state;
+    const { showModal, selectedItem, showEditModal, params, showBatchEditModal, batchParams, batchRemark} = this.state;
     return (
       <div>
         <FilterTable filterSetting={this.filterSetting} tableSetting={this.tableSetting} apiUrl={apiUrl}
         />
         <Edit showModal={showEditModal} params={params} onChange={this.onParamsChange} onOk={this.onEditOk} onCancel={this.onEditCancel} />
+        <BatchEdit showModal={showBatchEditModal} params={batchParams} onChange={this.onBatchParamsChange} onOk={this.onBatchEditOk} onCancel={this.onBatchEditCancel} batchRemark={batchRemark} />
       </div>
     )
   }

+ 5 - 0
src/pages/fengkong/namelist/blackuserlist/service.js

@@ -10,4 +10,9 @@ export async function delItem (params) {
 export async function addUserId (params) {
   const url = `${thanos}/thanos-admin/api/v1/nameList/blackUserList/create`
   return fetchApi(url, params)
+}
+
+export async function batchAddNameList (body) {
+  const url = `${thanos}/thanos-admin/api/v1/nameList/batchNameList`
+  return fetchApi(url, { method: 'POST', contentType: 'jsonString', body })
 }

+ 67 - 0
src/pages/fengkong/namelist/commoncomponents/Edit.js

@@ -0,0 +1,67 @@
+import React, { Component } from 'react'
+import { Modal, Upload, Button, message } from 'antd'
+import { FormItem } from 'wptpc-design'
+
+export default class Index extends Component {
+
+  uploadProps = {
+    name: 'csvFile',
+    headers: {
+      credentials: 'include'
+    },
+    beforeUpload: file => {
+      if (!file.name.endsWith('.csv')) {
+        message.warning('请上传 cxv 格式的文件')
+        return false
+      }
+      if (file == null) {
+        message.warn('请选择名单文件')
+        return false
+      }
+      this.props.onChange('csvFile', file)
+      return false
+    }
+  };
+
+  render() {
+    const { showModal, params, onChange, onOk, onCancel, batchRemark, fetching} = this.props;
+    const formSetting = [ {
+      label: '名单文件',
+      key: 'file',
+      render: () => {
+        return (
+          <div style={{ marginLeft: '120px' }}>
+            <Upload {...this.uploadProps}>
+              <Button type="primary">上传名单文件</Button>
+            </Upload>
+            <p>文件类型:.csv</p>
+            <p>{batchRemark}</p>
+          </div>
+        )
+      }
+    },
+    {
+      label: '是否启用',
+      type: 'select',
+      key: 'valid',
+      options: [
+        { value: "0", label: '禁用' },
+        { value: "1", label: '启用' },
+      ],
+      isRequired: true,
+      placeholder: '请选择'
+    }];
+    return (
+      <Modal
+        title={`批量导入`}
+        visible={showModal}
+        onOk={onOk}
+        onCancel={onCancel}
+        okButtonProps={{ disabled: fetching }}
+        destroyOnClose
+      >
+        <FormItem formSetting={formSetting} params={params} onChange={onChange} />
+      </Modal>
+    );
+  }
+}

+ 42 - 5
src/pages/fengkong/namelist/whiteuserlist/index.js

@@ -3,8 +3,9 @@ import { FilterTable } from 'wptpc-design'
 import { connect } from 'dva'
 import { thanos } from '@/conf/config'
 import { message, Popconfirm, Button } from 'antd'
-import { delItem, addUserId } from './service.js'
-import Edit from './components/Edit';
+import { delItem, addUserId, batchAddNameList } from './service.js'
+import Edit from './components/Edit'
+import BatchEdit from '../commoncomponents/Edit'
 
 const apiUrl = `${thanos}/thanos-admin/api/v1/nameList/whiteUserList`
 
@@ -19,12 +20,18 @@ class BlackIpList extends React.PureComponent {
       showModal: false,
       selectedItem: {},
       showEditModal: false,
-      params: {}
+      params: {},
+
+      showBatchModal: false,
+      selectedBatchItem: {},
+      showBatchEditModal: false,
+      batchParams: {},
+      batchRemark:"文件内包含名单字段 userId "
     }
   }
 
   filterSetting = {
-    rfBtnsJsx: <Button type="primary" onClick={() => this.addItem()}>添加用户Id</Button>,
+    rfBtnsJsx: <div><Button type="primary" onClick={() => this.addBatchItem()}>批量导入</Button><Button type="primary" onClick={() => this.addItem()}>添加用户Id</Button></div>,
     isClearSearch: true,
     formFields: [
       {
@@ -102,11 +109,19 @@ class BlackIpList extends React.PureComponent {
   addItem = () => {
     this.setState({ showEditModal: true, params: {} });
   }
+  addBatchItem = () => {
+    this.setState({ showBatchEditModal: true, batchParams: {} });
+  }
   onParamsChange = (key, value) => {
     const params = { ...this.state.params };
     params[key] = value;
     this.setState({ params });
   }
+  onBatchParamsChange = (key, value) => {
+    const batchParams = { ...this.state.batchParams };
+    batchParams[key] = value;
+    this.setState({ batchParams });
+  }
   onEditOk = () => {
     const { params } = this.state;
 
@@ -119,16 +134,38 @@ class BlackIpList extends React.PureComponent {
       }
     })
   }
+
+  onBatchEditOk = () => {
+    const { csvFile, valid } = this.state.batchParams;
+    const params = new FormData()
+    params.append("csvFile", csvFile)
+    params.append("model", "WhiteUser")
+    params.append("valid", valid)
+    batchAddNameList(params).then(res => {
+      if (res.data.code === 0) {
+        message.success('批量导入成功')
+        this.refresh()// 刷新列表
+        this.onBatchEditCancel()//关闭弹窗
+      }else {
+        message.error('批量导入失败')
+      }
+    })
+
+  }
   onEditCancel = () => {
     this.setState({ showEditModal: false })
   }
+  onBatchEditCancel = () => {
+    this.setState({ showBatchEditModal: false })
+  }
   render() {
-    const { showModal, selectedItem, showEditModal, params } = this.state;
+    const { showModal, selectedItem, showEditModal, params,showBatchEditModal, batchParams, batchRemark} = this.state;
     return (
       <div>
         <FilterTable filterSetting={this.filterSetting} tableSetting={this.tableSetting} apiUrl={apiUrl}
         />
         <Edit showModal={showEditModal} params={params} onChange={this.onParamsChange} onOk={this.onEditOk} onCancel={this.onEditCancel} />
+        <BatchEdit showModal={showBatchEditModal} params={batchParams} onChange={this.onBatchParamsChange} onOk={this.onBatchEditOk} onCancel={this.onBatchEditCancel} batchRemark={batchRemark} />
       </div>
     )
   }

+ 5 - 0
src/pages/fengkong/namelist/whiteuserlist/service.js

@@ -10,4 +10,9 @@ export async function delItem (params) {
 export async function addUserId (params) {
   const url = `${thanos}/thanos-admin/api/v1/nameList/whiteUserList/create`
   return fetchApi(url, params)
+}
+
+export async function batchAddNameList (body) {
+  const url = `${thanos}/thanos-admin/api/v1/nameList/batchNameList`
+  return fetchApi(url, { method: 'POST', contentType: 'jsonString', body })
 }

+ 58 - 0
src/pages/fengkong/strategies/batch/batchResult.js

@@ -0,0 +1,58 @@
+import React, { Component } from 'react'
+import { Modal, Table } from 'antd'
+import styles from './bs.css'
+
+export default class BatchResult extends Component {
+
+  render () {
+    const { showModal, params, onChange, onOk, onCancel, fetching } = this.props
+    const dataSource = params.jrows
+    const columns = [
+      {
+        title: 'id',
+        key: 'id',
+        dataIndex: 'id'
+      },
+      {
+        title: '名称',
+        key: 'name',
+        dataIndex: 'name'
+      },
+      {
+        title: '期望值',
+        key: 'expect',
+        dataIndex: 'expect'
+      },
+      {
+        title: '实际值',
+        key: 'actual',
+        dataIndex: 'actual'
+      },
+      {
+        title: '是否有差异',
+        key: 'hasDiff',
+        dataIndex: 'hasDiff',
+        render: (text) => text === true ? '是' : '否'
+      }
+    ]
+
+    return (
+      <Modal
+        title={'[差异比例:' + params.diff + ']'}
+        visible={showModal}
+        onOk={onOk}
+        onCancel={onCancel}
+        okButtonProps={{ disabled: fetching }}
+        width={1000}
+      >
+        <Table
+          dataSource={dataSource}
+          columns={columns}
+          onChange={onChange}
+          size="small"
+          rowClassName={record => (record.hasDiff === true ? styles.gray : styles.white)}
+        />
+      </Modal>
+    )
+  }
+}

+ 54 - 0
src/pages/fengkong/strategies/batch/batchTest.js

@@ -0,0 +1,54 @@
+import React, { Component } from 'react'
+import { Modal, Upload, Button, message } from 'antd'
+import { FormItem } from 'wptpc-design'
+
+export default class BatchTest extends Component {
+  uploadProps = {
+    name: 'file',
+    headers: {
+      credentials: 'include'
+    },
+    beforeUpload: file => {
+      if (!file.name.endsWith('.csv')) {
+        message.warning('请上传 csv 格式的文件')
+        return false
+      }
+      if (file == null) {
+        message.warn('请选择csv文件')
+        return false
+      }
+      this.props.onChange('file', file)
+      return false
+    }
+  };
+
+  render () {
+    const { showModal, params, onChange, onOk, onCancel, fetching } = this.props
+    const formSetting = [{
+      label: '数据文件',
+      key: 'file',
+      render: () => {
+        return (
+          <div style={{ marginLeft: '80px' }}>
+            <Upload {...this.uploadProps}>
+              <Button type="primary">选择文件</Button>
+            </Upload>
+            <p>csv文件,含id,name,features,expect字段</p>
+          </div>
+        )
+      }
+    }]
+    return (
+      <Modal
+        title={'批量验证'}
+        visible={showModal}
+        onOk={onOk}
+        onCancel={onCancel}
+        okButtonProps={{ disabled: fetching }}
+        destroyOnClose
+      >
+        <FormItem formSetting={formSetting} params={params} onChange={onChange} />
+      </Modal>
+    )
+  }
+}

+ 6 - 0
src/pages/fengkong/strategies/batch/bs.css

@@ -0,0 +1,6 @@
+.white {
+  background-color:white;
+}
+.gray{
+  background-color:gray;
+}

+ 5 - 0
src/pages/fengkong/strategies/service.js

@@ -41,3 +41,8 @@ export async function groupDetail (params) {
   const url = `${thanos}/thanos-admin/api/v1/group/query?_from=strategies`
   return fetchApi(url, params)
 }
+
+export async function batchTest (body) {
+  const url = `${thanos}/thanos-admin/api/v1/dsl/batch/test`
+  return fetchApi(url, { method: 'POST', contentType: 'jsonString', body })
+}

+ 51 - 3
src/pages/fengkong/strategies/strategies.js

@@ -3,7 +3,9 @@ import { FilterTable } from 'wptpc-design'
 import { Link } from 'dva/router'
 import { thanos } from '@/conf/config'
 import { Divider, message, Popconfirm, Button } from 'antd'
-import { delItem } from './service.js'
+import { delItem, batchTest } from './service.js'
+import Bt from './batch/batchTest'
+import Br from './batch/batchResult'
 
 const apiUrl = `${thanos}/thanos-admin/api/v1/dsl/list`
 
@@ -14,11 +16,11 @@ class GroupList extends React.PureComponent {
   }
 
   filterSetting = {
-    rfBtnsJsx: <Link
+    rfBtnsJsx: <div> <Link
       to={{
         pathname: './add'
       }}
-    ><Button>新增决策</Button></Link>,
+    ><Button>新增决策</Button></Link>&emsp;<Button onClick={() => this.batchTest()}>批量验证</Button></div>,
     isClearSearch: true,
     formFields: [
       {
@@ -34,6 +36,49 @@ class GroupList extends React.PureComponent {
     // }
   }
 
+  batchTest = () => {
+    this.setState({ showUpload: true, params: {} })
+  }
+
+  batchResult = (data) => {
+    console.log('结果数据:', JSON.stringify(data))
+    this.setState({ showResult: true, params: { jrows: data.jrows, diff: data.diff } })
+  }
+
+  onParamsChange = (key, value) => {
+    const params = { ...this.state.params }
+    params[key] = value
+    this.setState({ params })
+  }
+
+  onTestOk = () => {
+    const { file } = this.state.params
+    const params = new FormData()
+    params.append('file', file)
+    batchTest(params).then(res => {
+      if (res.data != null && res.data.code === 0) {
+        message.success('处理成功')
+        this.refresh()// 刷新列表
+        this.onTestCancel()// 关闭弹窗
+        this.batchResult(res.data.data)
+      } else {
+        message.error('处理失败: ' + res.data.msg)
+      }
+    })
+  }
+
+  onTestCancel = () => {
+    this.setState({ showUpload: false })
+  }
+
+  onResultCancel = () => {
+    this.setState({ showResult: false })
+  }
+
+  onResultOk = () => {
+    this.setState({ showResult: false })
+  }
+
   // filtertable的列表配置
   tableSetting = {
     rowKey: 'id',
@@ -145,10 +190,13 @@ class GroupList extends React.PureComponent {
   }
 
   render () {
+    const { showUpload, showResult, params } = this.state
     return (
       <div>
         <FilterTable filterSetting={this.filterSetting} tableSetting={this.tableSetting} apiUrl={apiUrl}
         />
+        <Bt showModal={showUpload} params={params} onChange={this.onParamsChange} onOk={this.onTestOk} onCancel={this.onTestCancel} />
+        <Br showModal={showResult} params={params} onChange={this.onParamsChange} onOk={this.onResultOk} onCancel={this.onResultCancel} />
       </div>
     )
   }