Browse Source

Signed-off-by: Lgx <361400959>

Lgx 4 years ago
parent
commit
ed0c9149c3
1 changed files with 130 additions and 12 deletions
  1. 130 12
      UI/src/pages/externalWechat/externalUserList.js

+ 130 - 12
UI/src/pages/externalWechat/externalUserList.js

@@ -1,37 +1,116 @@
 import React from 'react';
 import { BirdGrid } from 'components/Grid';
 import { routerRedux } from 'dva/router'
+import { jrequest } from 'utils/request';
 import { config,request,util } from 'utils'
 import { connect } from 'dva';
-const { APIV4,APIV5 } = config
+const { APIV4,WECHATAPIV5 } = config
+import {Modal,
+  Row,
+  Col,
+  message,
+  Form,
+  Button,
+  Icon,
+  Upload
+} from 'antd';
 class tag_setting extends React.Component {
   constructor(props) {
     super(props)
-    console.log(props)
 
     this.state = {
       formConfirmLoading:false,
       formVisiable:false,
-      getdDisdatas:[]
+      formVisiable2:false,
+      getdDisdatas:[],
+      fileName:"",
+      fileName2:""
     }
   }
 
-  onClose(){
-
+  cancelClick(){
+    this.setState({
+      formVisiable:false
+    })
+  }
+  cancelClick2(){
+    this.setState({
+      formVisiable2:false
+    })
+  }
+  excelonChange(e){
+    if(e.file!=null && e.file.response!=null){
+        this.setState({
+          fileName:e.file.response
+        })
+    }
+  }
+  excelonChange2(e){
+    if(e.file!=null && e.file.response!=null){
+        this.setState({
+          fileName2:e.file.response
+        })
+    }
+  }
+  okClick1(){
+    var fileName=this.state.fileName;
+    if(fileName!=null&&fileName!=""){
+      window.location.href=WECHATAPIV5+"/api/excel/downloadTemplate?fileName="+fileName;
+    }
+  }
+  okClick2(){
+    var fileName=this.state.fileName2;
+    console.log(fileName)
+    if(fileName!=null&&fileName!=""){
+      window.location.href=WECHATAPIV5+"/api/excel/downloadTemplate?fileName="+fileName;
+    }
+  }
+  getExcelTemp(){
+    window.location.href=WECHATAPIV5+"/api/excel/exportExcel"
+  }
+  getExcelTemp2(){
+    window.location.href=WECHATAPIV5+"/api/excel/exportMobileExcel"
   }
-  //获取规则数据
-  componentDidMount(){ 
-    let self=this;
- }
   render() {
     let self = this;
-
+    let database = [
+      {
+        "label": "正常",
+        "value": "1",
+        "disabled": false
+      },
+      {
+        "label": "删除",
+        "value": "0",
+        "disabled": false
+      }
+    ];
     
     let gridOption = {
       title: "订单列表",
       url: {
-        read:APIV5+"/api/excel/getExternalUserList"
+        read:WECHATAPIV5+"/api/excel/getExternalUserList"
       },
+      actions: [
+      {
+        name: '数据导入(多谋/艾客)',          
+        color: 'bule',
+        onClick: (data) => {
+          self.setState({
+            formVisiable:true
+          })
+        }
+      },
+      {
+        name: '数据去重',          
+        color: 'red',
+        onClick: (data) => {
+          self.setState({
+            formVisiable2:true
+          })
+        }
+      }
+    ],
       columns: [
         { title: "ID", data: "id", type: "text", editor: {},query:true },
         { title: "姓名(昵称)", data: "name", type: "text",editor: {}, query: true},
@@ -41,11 +120,50 @@ class tag_setting extends React.Component {
         { title: "添加时间", data: "createtime", type: "text", editor: {},query:true},
         { title: "到达", data: "termain_type", type: "text",  editor: {},query:true},
         { title: "企业好友", data: "company_name", type: "text",  editor: {},query:true},
-        { title: "状态", data: "is_delete", type: "text",  editor: {},query:true}
+        { title: "状态", data: "is_delete", type: "dropdown", editor: {},source: { data:database },query:true}
       ]
     };
     return <div>
                 <BirdGrid gridOption={gridOption} ref="grid"></BirdGrid>
+                <Modal title="上传用户数据"
+                  okText="下载结果"
+                  width="50%"
+                  visible={self.state.formVisiable}
+                  onCancel={() => self.cancelClick()}
+                  onOk={self.okClick1.bind(self)}>                 
+                  <Row>
+                    <Col>
+                    {<Upload.Dragger name="files" action={WECHATAPIV5+"/api/excel/readExcel"} onChange={self.excelonChange.bind(self)}>
+                    <p className="ant-upload-drag-icon">
+                      <Icon type="inbox" />
+                    </p>
+                    <p className="ant-upload-text">请先按模板格式格式上传</p>
+                  </Upload.Dragger>}
+                  <Button onClick={self.getExcelTemp} style={{color:"#fff",margin:"20px 45%",fontWeight:"bold",background:"#1E90FF"}} className="ant-upload-text">下载导入模板</Button>
+                    </Col>
+                </Row>
+                </Modal>
+
+
+
+                <Modal title="数据验证重复"
+                  okText="下载结果"
+                  width="50%"
+                  visible={self.state.formVisiable2}
+                  onCancel={() => self.cancelClick2()}
+                  onOk={self.okClick2.bind(self)}>                 
+                  <Row>
+                    <Col>
+                    {<Upload.Dragger name="files" action={WECHATAPIV5+"/api/excel/readMobileExcel"} onChange={self.excelonChange2.bind(self)}>
+                    <p className="ant-upload-drag-icon">
+                      <Icon type="inbox" />
+                    </p>
+                    <p className="ant-upload-text">添加需要添加好友的手机号列表,参考下方excel模板</p>
+                  </Upload.Dragger>}
+                  <Button onClick={self.getExcelTemp2} style={{color:"#fff",margin:"20px 45%",fontWeight:"bold",background:"#1E90FF"}} className="ant-upload-text">下载导入模板</Button>
+                    </Col>
+                </Row>
+                </Modal>
            </div>
   }
 }