zhoulisen 5 年 前
コミット
0969f00f6a
共有2 個のファイルを変更した43 個の追加49 個の削除を含む
  1. 6
    6
      src/pages/customer/customerlist/components/BatchAssistConsultant.jsx
  2. 37
    43
      src/pages/customer/customerlist/index.jsx

+ 6
- 6
src/pages/customer/customerlist/components/BatchAssistConsultant.jsx ファイルの表示

55
   }
55
   }
56
 
56
 
57
   changBuilding(buildingId) {
57
   changBuilding(buildingId) {
58
-    this.getUserList({ pageNumber: 1, pageSize: 5, buildingId: this.buildingId })
58
+    this.getUserList({ pageNumber: 1, pageSize: 5, buildingId: buildingId })
59
     this.setState({ visibleData: { visible: this.props.visibleData.visible, customerId: this.props.visibleData.customerId, buildingName: buildingId } });
59
     this.setState({ visibleData: { visible: this.props.visibleData.visible, customerId: this.props.visibleData.customerId, buildingName: buildingId } });
60
   }
60
   }
61
 
61
 
101
     // 网路请求
101
     // 网路请求
102
     request({ ...apis.customer.batchConsultantAssist, data: { userId: record.userId, customerIds: this.state.visibleData.customerId } }).then(res => {
102
     request({ ...apis.customer.batchConsultantAssist, data: { userId: record.userId, customerIds: this.state.visibleData.customerId } }).then(res => {
103
       // eslint-disable-next-line no-unused-expressions
103
       // eslint-disable-next-line no-unused-expressions
104
-      debugger
105
-      if(res!= null && res.failNum > 0 ){
106
-        this.openNotificationWithIcon('success', '共'+res.totalNum+'条数据,失败操作'+res.failNum+'条')
107
-      }else{
104
+
105
+      if (res != null && res.failNum > 0) {
106
+        this.openNotificationWithIcon('success', '共' + res.totalNum + '条数据,失败操作' + res.failNum + '条')
107
+      } else {
108
         this.openNotificationWithIcon('success', '操作成功')
108
         this.openNotificationWithIcon('success', '操作成功')
109
       }
109
       }
110
       this.handleCancel()
110
       this.handleCancel()
111
     }).catch(err => {
111
     }).catch(err => {
112
       // eslint-disable-next-line no-unused-expressions
112
       // eslint-disable-next-line no-unused-expressions
113
-  
113
+
114
     })
114
     })
115
   }
115
   }
116
 
116
 

+ 37
- 43
src/pages/customer/customerlist/index.jsx ファイルの表示

34
   // eslint-disable-next-line react-hooks/rules-of-hooks
34
   // eslint-disable-next-line react-hooks/rules-of-hooks
35
   const [dataSource, setDataSource] = useState({ records: [] })
35
   const [dataSource, setDataSource] = useState({ records: [] })
36
   // eslint-disable-next-line react-hooks/rules-of-hooks
36
   // eslint-disable-next-line react-hooks/rules-of-hooks
37
-  // const [columns, setColumns] = useState(privateColumns)
38
-
37
+  const [dataPub, setDataPub] = useState({ records: [] })
39
   // 默认私客
38
   // 默认私客
40
   // eslint-disable-next-line react-hooks/rules-of-hooks
39
   // eslint-disable-next-line react-hooks/rules-of-hooks
41
   const [customerType, setCustomerType] = useState('private')
40
   const [customerType, setCustomerType] = useState('private')
58
   // 推荐客户
57
   // 推荐客户
59
   const [recommendVisibleData, setRecommendVisibleData] = useState({ visible: false, customerId: '' })
58
   const [recommendVisibleData, setRecommendVisibleData] = useState({ visible: false, customerId: '' })
60
 
59
 
61
-  const [assistVisibleData, setAssistVisibleData] = useState({ visible: false, customerId: '',buildingId:'' })
60
+  const [assistVisibleData, setAssistVisibleData] = useState({ visible: false, customerId: '', buildingId: '' })
62
 
61
 
63
   const [loadingStatus, setLoadingStatus] = useState(false)
62
   const [loadingStatus, setLoadingStatus] = useState(false)
64
 
63
 
65
   // 选中的公客信息
64
   // 选中的公客信息
66
   const [personInfo, setPersonInfo] = useState([])
65
   const [personInfo, setPersonInfo] = useState([])
67
 
66
 
68
-  const [batchAssistVisibleData, setBatchAssistVisibleData] = useState({ visible: false, customerId: [] ,buildingId:''})
67
+  const [batchAssistVisibleData, setBatchAssistVisibleData] = useState({ visible: false, customerId: [], buildingId: '' })
69
 
68
 
70
   const [currentSelectedRows, setSelectedRows] = useState([])
69
   const [currentSelectedRows, setSelectedRows] = useState([])
71
 
70
 
72
-  const [selectedRowKeys,setSelectedRowKeys] = useState([])
73
-
74
-//  const [ radio, setRadio] = useState(true)
75
-
76
-  // const [page, setPage] = useState(1)
71
+  const [selectedRowKeys, setSelectedRowKeys] = useState([])
77
 
72
 
78
   // eslint-disable-next-line react-hooks/rules-of-hooks
73
   // eslint-disable-next-line react-hooks/rules-of-hooks
79
   useEffect(() => {
74
   useEffect(() => {
93
       localStorage.setItem("priPageParams", JSON.stringify({ pageNumber: 1, pageSize: 10, customerType }))
88
       localStorage.setItem("priPageParams", JSON.stringify({ pageNumber: 1, pageSize: 10, customerType }))
94
       getList({ pageNumber: 1, pageSize: 10, customerType })
89
       getList({ pageNumber: 1, pageSize: 10, customerType })
95
     }
90
     }
96
-  }, []) 
91
+  }, [])
97
 
92
 
98
   function getList(params) {
93
   function getList(params) {
99
     // 网路请求
94
     // 网路请求
100
-    // setDataSource([])
101
-    // setRadio(true)
102
     request({ ...apis.customer.customerRecommend, params: { ...params } }).then(res => {
95
     request({ ...apis.customer.customerRecommend, params: { ...params } }).then(res => {
103
-      setDataSource(res)
104
-      setRadio(false)
96
+      if (params.customerType === 'private') {
97
+        setDataSource(res)
98
+      } else {
99
+        setDataPub(res)
100
+      }
105
     }).catch(err => {
101
     }).catch(err => {
106
       // eslint-disable-next-line no-unused-expressions
102
       // eslint-disable-next-line no-unused-expressions
107
       <Alert
103
       <Alert
179
 
175
 
180
   // 私客/公客切换
176
   // 私客/公客切换
181
   function radioButtonHandleSizeChange(e) {
177
   function radioButtonHandleSizeChange(e) {
182
-    
178
+
183
     displayNone()
179
     displayNone()
184
-    
180
+
185
     props.form.resetFields();
181
     props.form.resetFields();
186
     const { value } = e.target
182
     const { value } = e.target
187
     setCustomerType(value)
183
     setCustomerType(value)
203
         // const { getFieldDecorator } = JSON.parse(localStorage.getItem("pageParams"))
199
         // const { getFieldDecorator } = JSON.parse(localStorage.getItem("pageParams"))
204
         getList({ customerType, ...JSON.parse(localStorage.getItem("pubPageParams")) })
200
         getList({ customerType, ...JSON.parse(localStorage.getItem("pubPageParams")) })
205
       } else {
201
       } else {
206
-        localStorage.setItem("pubPageParams", JSON.stringify({ pageNumber: 1, pageSize: 10, customerType: value }))
207
-        getList({ pageNumber: 1, pageSize: 10, customerType: value })
202
+        localStorage.setItem("pubPageParams", JSON.stringify({ pageNumber: 1, pageSize: 10, customerType: 'public' }))
203
+        getList({ pageNumber: 1, pageSize: 10, customerType: 'public' })
208
       }
204
       }
209
     }
205
     }
210
 
206
 
215
   function handleReset() {
211
   function handleReset() {
216
     props.form.resetFields();
212
     props.form.resetFields();
217
     if (customerType === 'private') {
213
     if (customerType === 'private') {
218
-      localStorage.setItem("priPageParams", JSON.stringify({ pageNumber: 1, pageSize: 10, customerType: 'private', }));
214
+      localStorage.setItem("priPageParams", JSON.stringify({ pageNumber: 1, pageSize: 10, customerType: 'private' }));
219
       getList(JSON.parse(localStorage.getItem("priPageParams")))
215
       getList(JSON.parse(localStorage.getItem("priPageParams")))
220
     } else {
216
     } else {
221
       localStorage.setItem("pubPageParams", JSON.stringify({ pageNumber: 1, pageSize: 10, customerType: 'public' }))
217
       localStorage.setItem("pubPageParams", JSON.stringify({ pageNumber: 1, pageSize: 10, customerType: 'public' }))
233
     setRecordVisibleData({ visible: false, customerId: '' })
229
     setRecordVisibleData({ visible: false, customerId: '' })
234
     setStatusVisibleData({ visible: false, customerId: '' })
230
     setStatusVisibleData({ visible: false, customerId: '' })
235
     setRecommendVisibleData({ visible: false, customerId: '' })
231
     setRecommendVisibleData({ visible: false, customerId: '' })
236
-    setBatchAssistVisibleData({ visible: false, customerId: '',buildingId:'' })
232
+    setBatchAssistVisibleData({ visible: false, customerId: '', buildingId: '' })
237
   }
233
   }
238
 
234
 
239
   function showRecord(record) {
235
   function showRecord(record) {
241
     setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
237
     setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
242
     setStatusVisibleData({ visible: false, customerId: '' })
238
     setStatusVisibleData({ visible: false, customerId: '' })
243
     setRecommendVisibleData({ visible: false, customerId: '' })
239
     setRecommendVisibleData({ visible: false, customerId: '' })
244
-    setBatchAssistVisibleData({ visible: false, customerId: '',buildingId:'' })
240
+    setBatchAssistVisibleData({ visible: false, customerId: '', buildingId: '' })
245
   }
241
   }
246
 
242
 
247
   function showStatus(record) {
243
   function showStatus(record) {
249
     setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
245
     setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
250
     setRecommendVisibleData({ visible: false, customerId: '' })
246
     setRecommendVisibleData({ visible: false, customerId: '' })
251
     setStatusVisibleData({ visible: true, customerId: record.customerId, status: record.status })
247
     setStatusVisibleData({ visible: true, customerId: record.customerId, status: record.status })
252
-    setBatchAssistVisibleData({ visible: false, customerId: '' ,buildingId:''})
248
+    setBatchAssistVisibleData({ visible: false, customerId: '', buildingId: '' })
253
   }
249
   }
254
 
250
 
255
   // 推荐客户
251
   // 推荐客户
262
   }
258
   }
263
 
259
 
264
   //分配置业顾问
260
   //分配置业顾问
265
-  function assistConsultant(personId,buildingId) {
261
+  function assistConsultant(personId, buildingId) {
266
     setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
262
     setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
267
     setRecordVisibleData({ visible: false, customerId: '' })
263
     setRecordVisibleData({ visible: false, customerId: '' })
268
     setStatusVisibleData({ visible: false, customerId: '' })
264
     setStatusVisibleData({ visible: false, customerId: '' })
269
     setRecommendVisibleData({ visible: false, customerId: '' })
265
     setRecommendVisibleData({ visible: false, customerId: '' })
270
-    setAssistVisibleData({ visible: true, customerId: personId ,buildingId:buildingId})
271
-    setBatchAssistVisibleData({ visible: false, customerId: '' ,buildingId:''})
266
+    setAssistVisibleData({ visible: true, customerId: personId, buildingId: buildingId })
267
+    setBatchAssistVisibleData({ visible: false, customerId: '', buildingId: '' })
272
   }
268
   }
273
 
269
 
274
   function batchAssistConsultant() {
270
   function batchAssistConsultant() {
281
     const compareSet = new Set();
277
     const compareSet = new Set();
282
     personInfo.filter(record => {
278
     personInfo.filter(record => {
283
       compareSet.add(record.buildingName)
279
       compareSet.add(record.buildingName)
284
-    } )
280
+    })
285
 
281
 
286
-    if(compareSet.size != 1){
287
-      return message.info("选中的公客存在于不同项目中,请分开进行分配置业顾问操作");
282
+    if (compareSet.size != 1) {
283
+      return message.info("请选择项目");
288
     }
284
     }
289
 
285
 
290
     // const newSelectedRows = personInfo.filter()  
286
     // const newSelectedRows = personInfo.filter()  
291
-    
287
+
292
     // console.log(newSelectedRows,'newSelectedRows')
288
     // console.log(newSelectedRows,'newSelectedRows')
293
 
289
 
294
     setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
290
     setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
295
     setRecordVisibleData({ visible: false, customerId: '' })
291
     setRecordVisibleData({ visible: false, customerId: '' })
296
     setStatusVisibleData({ visible: false, customerId: '' })
292
     setStatusVisibleData({ visible: false, customerId: '' })
297
     setRecommendVisibleData({ visible: false, customerId: '' })
293
     setRecommendVisibleData({ visible: false, customerId: '' })
298
-    setAssistVisibleData({ visible: false, customerId: '',buildingId:'' })
299
-    setBatchAssistVisibleData({ visible: true, customerId: personInfo, buildingId: personInfo[0].buildingId})
294
+    setAssistVisibleData({ visible: false, customerId: '', buildingId: '' })
295
+    setBatchAssistVisibleData({ visible: true, customerId: personInfo, buildingId: personInfo[0].buildingId })
300
   }
296
   }
301
 
297
 
302
   function toCustomerDateil(record) {
298
   function toCustomerDateil(record) {
325
         download(response)
321
         download(response)
326
         setLoadingStatus(false)
322
         setLoadingStatus(false)
327
       }).catch(error => {
323
       }).catch(error => {
328
-        message.err("连接超时");
324
+        message.err('连接超时');
329
         setLoadingStatus(false)
325
         setLoadingStatus(false)
330
       })
326
       })
331
   }
327
   }
347
   function closeAttribution() {
343
   function closeAttribution() {
348
     setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
344
     setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
349
     if (customerType === 'private') {
345
     if (customerType === 'private') {
350
-
351
-      getList(JSON.parse(localStorage.getItem("priPageParams")))
346
+      getList(JSON.parse(localStorage.getItem('priPageParams')))
352
     } else {
347
     } else {
353
-
354
-      getList(JSON.parse(localStorage.getItem("pubPageParams")))
348
+      getList(JSON.parse(localStorage.getItem('pubPageParams')))
355
     }
349
     }
356
-
357
   }
350
   }
358
   // 回调关闭所有弹框
351
   // 回调关闭所有弹框
359
   function closeAll() {
352
   function closeAll() {
361
     setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
354
     setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
362
     setStatusVisibleData({ visible: false, customerId: '', status: '' })
355
     setStatusVisibleData({ visible: false, customerId: '', status: '' })
363
     setRecommendVisibleData({ visible: false, customerId: '' })
356
     setRecommendVisibleData({ visible: false, customerId: '' })
364
-    setAssistVisibleData({ visible: false, customerId: '',buildingId:'' })
357
+    setAssistVisibleData({ visible: false, customerId: '', buildingId: '' })
365
     setBatchAssistVisibleData({ visible: false, customerId: '' })
358
     setBatchAssistVisibleData({ visible: false, customerId: '' })
366
     if (customerType === 'private') {
359
     if (customerType === 'private') {
367
 
360
 
379
       console.log('selectedRowKeys:', selectedRowKeys, 'selectedRows: ', selectedRows);
372
       console.log('selectedRowKeys:', selectedRowKeys, 'selectedRows: ', selectedRows);
380
       setSelectedRowKeys(selectedRowKeys)
373
       setSelectedRowKeys(selectedRowKeys)
381
       const newSelectedRows = personInfo.filter(x => !selectedRows.some(y => x.customerId === y.customerId))     // 去重
374
       const newSelectedRows = personInfo.filter(x => !selectedRows.some(y => x.customerId === y.customerId))     // 去重
382
-                                .concat(selectedRows)                                                                 // 新增选择
383
-                                .filter(x => selectedRowKeys.some(y => y === x.customerId))                             // 去掉未选的数据
375
+        .concat(selectedRows)                                                                 // 新增选择
376
+        .filter(x => selectedRowKeys.some(y => y === x.customerId))                             // 去掉未选的数据
384
 
377
 
385
       // setSelectedRows(newSelectedRows)
378
       // setSelectedRows(newSelectedRows)
379
+      console.log(newSelectedRows, "33333333333333333333")
386
       setPersonInfo(newSelectedRows)
380
       setPersonInfo(newSelectedRows)
387
     },
381
     },
388
   };
382
   };
395
       align: 'center',
389
       align: 'center',
396
       width: '15%',
390
       width: '15%',
397
       // render: (_, record) => <Avatar shape="square" style={{ color: 'blue', cursor: 'pointer' }} onClick={() => publicCustomerDetail(record)} src={customerType === 'private' ? record.picture : record.avatarurl} size={64} icon="user" />,
391
       // render: (_, record) => <Avatar shape="square" style={{ color: 'blue', cursor: 'pointer' }} onClick={() => publicCustomerDetail(record)} src={customerType === 'private' ? record.picture : record.avatarurl} size={64} icon="user" />,
398
-      render: (_, record) => <Avatar shape="square" style={{ color: 'blue', cursor: 'pointer' }} onClick={() => publicCustomerDetail(record)} src={record.picture } size={64} icon="user" />,
392
+      render: (_, record) => <Avatar shape="square" style={{ color: 'blue', cursor: 'pointer' }} onClick={() => publicCustomerDetail(record)} src={record.picture} size={64} icon="user" />,
399
     },
393
     },
400
     {
394
     {
401
       title: '姓名',
395
       title: '姓名',
461
             <Button className={customerType === 'private' ? Styles.displayS : Styles.text} type="link" onClick={() => showRecommend(record.personId)}>推荐客户</Button>
455
             <Button className={customerType === 'private' ? Styles.displayS : Styles.text} type="link" onClick={() => showRecommend(record.personId)}>推荐客户</Button>
462
           </AuthButton>
456
           </AuthButton>
463
           <AuthButton name="admin.customer.assign" noRight={null}>
457
           <AuthButton name="admin.customer.assign" noRight={null}>
464
-            <Button className={customerType === 'private' ? Styles.displayS : Styles.text} type="link" onClick={() => assistConsultant(record.customerId,record.buildingId)}>分配置业顾问</Button>
458
+            <Button className={customerType === 'private' ? Styles.displayS : Styles.text} type="link" onClick={() => assistConsultant(record.customerId, record.buildingId)}>分配置业顾问</Button>
465
           </AuthButton>
459
           </AuthButton>
466
           <AuthButton name="admin.mine.taPointsRecords.point.record" noRight={null}>
460
           <AuthButton name="admin.mine.taPointsRecords.point.record" noRight={null}>
467
             <Button className={Styles.text} type="link" onClick={() => showRecord(record)}>积分记录</Button>
461
             <Button className={Styles.text} type="link" onClick={() => showRecord(record)}>积分记录</Button>
585
   return (
579
   return (
586
     <>
580
     <>
587
       <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
581
       <Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
588
-      {customerType === 'public' && <Form.Item>
582
+        {customerType === 'public' && <Form.Item>
589
           {getFieldDecorator('belongStatus')(
583
           {getFieldDecorator('belongStatus')(
590
             <Select style={{ width: '180px' }} placeholder="是否归属项目" onChange={handleSelectChange}>
584
             <Select style={{ width: '180px' }} placeholder="是否归属项目" onChange={handleSelectChange}>
591
               <Option value={1}>是</Option>
585
               <Option value={1}>是</Option>