Browse Source

Merge branch 'dev' of http://git.ycjcjy.com/zhiyuxing/estateagents-admin-manager into dev

xujing 5 years ago
parent
commit
7f2a00e393

+ 2
- 2
src/pages/customer/customerlist/components/BatchAssistConsultant.jsx View File

@@ -72,7 +72,7 @@ class ModalAttribution extends React.Component {
72 72
   getList(params) {
73 73
     // 网路请求
74 74
     console.log('params: ', params)
75
-    request({ ...apis.customer.buildingConsultant,params: { ...params } }).then(res => {
75
+    request({ ...apis.customer.buildingConsultant }).then(res => {
76 76
       this.setState({ dataSource: res })
77 77
     }).catch(err => {
78 78
       
@@ -90,7 +90,7 @@ class ModalAttribution extends React.Component {
90 90
    // 分页
91 91
   onChange(pageNum) {
92 92
 
93
-    this.getList({ pageNumber: pageNum, pageSize: 5, buildingId: this.state.visibleData.buildingName })
93
+    this.getUserList({ pageNumber: pageNum, pageSize: 5, buildingId: this.state.visibleData.buildingName })
94 94
   }
95 95
 
96 96
   // 提交

+ 18
- 8
src/pages/customer/customerlist/index.jsx View File

@@ -67,6 +67,8 @@ function body(props) {
67 67
 
68 68
   const [batchAssistVisibleData, setBatchAssistVisibleData] = useState({ visible: false, customerId: [] })
69 69
 
70
+  const [currentSelectedRows, setSelectedRows] = useState([])
71
+
70 72
   // const [page, setPage] = useState(1)
71 73
 
72 74
   // eslint-disable-next-line react-hooks/rules-of-hooks
@@ -178,9 +180,9 @@ function body(props) {
178 180
         props.form.setFieldsValue(JSON.parse(localStorage.getItem("priPageParams")));
179 181
 
180 182
         getList(JSON.parse(localStorage.getItem("priPageParams")))
181
-      }else{
183
+      } else {
182 184
         localStorage.setItem("priPageParams", JSON.stringify({ pageNumber: 1, pageSize: 10, customerType: value }))
183
-      getList({ pageNumber: 1, pageSize: 10, customerType: value })
185
+        getList({ pageNumber: 1, pageSize: 10, customerType: value })
184 186
       }
185 187
 
186 188
     } else {
@@ -259,6 +261,7 @@ function body(props) {
259 261
   }
260 262
 
261 263
   function batchAssistConsultant() {
264
+    console.log(personInfo, 'personInfo')
262 265
     if (personInfo.length <= 0) {
263 266
       return message.info("请至少选择一条数据");
264 267
     }
@@ -347,7 +350,14 @@ function body(props) {
347 350
   const rowSelection = {
348 351
     onChange: (selectedRowKeys, selectedRows) => {
349 352
       console.log('selectedRowKeys:', selectedRowKeys, 'selectedRows: ', selectedRows);
350
-      setPersonInfo(selectedRows)
353
+      // const array = selectedRows + personInfo
354
+
355
+      const newSelectedRows = personInfo.filter(x => !selectedRows.some(y => x.personId === y.personId))     // 去重
356
+                                .concat(selectedRows)                                                                 // 新增选择
357
+                                .filter(x => selectedRowKeys.some(y => y === x.personId))                             // 去掉未选的数据
358
+
359
+      // setSelectedRows(newSelectedRows)
360
+      setPersonInfo(newSelectedRows)
351 361
     },
352 362
   };
353 363
 
@@ -569,11 +579,11 @@ function body(props) {
569 579
         </Form.Item>}
570 580
         <Form.Item >
571 581
           {getFieldDecorator('startCreateDate')(
572
-            <DatePicker placeholder="注册开始时间" format="YYYY-MM-DD HH:mm:ss" showTime={{ format: 'HH:mm:ss' }}/>)}
582
+            <DatePicker placeholder="注册开始时间" format="YYYY-MM-DD HH:mm:ss" showTime={{ format: 'HH:mm:ss' }} />)}
573 583
         </Form.Item>
574 584
         <Form.Item >
575 585
           {getFieldDecorator('endCreateDate')(
576
-            <DatePicker placeholder="注册结束时间" format="YYYY-MM-DD HH:mm:ss" showTime={{ format: 'HH:mm:ss' }}/>)}
586
+            <DatePicker placeholder="注册结束时间" format="YYYY-MM-DD HH:mm:ss" showTime={{ format: 'HH:mm:ss' }} />)}
577 587
         </Form.Item>
578 588
         <Form.Item>
579 589
           {getFieldDecorator('sceneType')(
@@ -581,7 +591,7 @@ function body(props) {
581 591
           )}
582 592
         </Form.Item>
583 593
         <Form.Item>
584
-        {getFieldDecorator('sharePersonName')(
594
+          {getFieldDecorator('sharePersonName')(
585 595
             <Input placeholder="推广人" />,
586 596
           )}
587 597
         </Form.Item>
@@ -631,14 +641,14 @@ function body(props) {
631 641
           //     onClick: () => toCustomerDateil(record),
632 642
           //   };
633 643
           // }}
634
-          dataSource={dataSource.records} columns={privateColumns} pagination={{ current: dataSource.current, total: dataSource.total, pageSize: dataSource.size, onChange }} rowKey={r=>r.customerId} /> :
644
+          dataSource={dataSource.records} columns={privateColumns} pagination={{ current: dataSource.current, total: dataSource.total, pageSize: dataSource.size, onChange }} rowKey={r => r.customerId} /> :
635 645
         <Table rowSelection={rowSelection}
636 646
           // onRow={record => {
637 647
           //   return {
638 648
           //     onClick: () => publicCustomerDetail(record),
639 649
           //   };
640 650
           // }}
641
-          dataSource={dataSource.records} columns={publicColumns} pagination={{ current: dataSource.current, total: dataSource.total, pageSize: dataSource.size, onChange }} rowKey={r=>r.customerId} />
651
+          dataSource={dataSource.records} columns={publicColumns} pagination={{ current: dataSource.current, total: dataSource.total, pageSize: dataSource.size, onChange }} rowKey={r => r.personId} />
642 652
       }
643 653
 
644 654
       {/* 调整归属 */}