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