|
@@ -34,8 +34,7 @@ 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 [columns, setColumns] = useState(privateColumns)
|
38
|
|
-
|
|
37
|
+ const [dataPub, setDataPub] = useState({ records: [] })
|
39
|
38
|
// 默认私客
|
40
|
39
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
41
|
40
|
const [customerType, setCustomerType] = useState('private')
|
|
@@ -58,22 +57,18 @@ function body(props) {
|
58
|
57
|
// 推荐客户
|
59
|
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
|
62
|
const [loadingStatus, setLoadingStatus] = useState(false)
|
64
|
63
|
|
65
|
64
|
// 选中的公客信息
|
66
|
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
|
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
|
73
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
79
|
74
|
useEffect(() => {
|
|
@@ -93,15 +88,16 @@ function body(props) {
|
93
|
88
|
localStorage.setItem("priPageParams", JSON.stringify({ pageNumber: 1, pageSize: 10, customerType }))
|
94
|
89
|
getList({ pageNumber: 1, pageSize: 10, customerType })
|
95
|
90
|
}
|
96
|
|
- }, [])
|
|
91
|
+ }, [])
|
97
|
92
|
|
98
|
93
|
function getList(params) {
|
99
|
94
|
// 网路请求
|
100
|
|
- // setDataSource([])
|
101
|
|
- // setRadio(true)
|
102
|
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
|
101
|
}).catch(err => {
|
106
|
102
|
// eslint-disable-next-line no-unused-expressions
|
107
|
103
|
<Alert
|
|
@@ -179,9 +175,9 @@ function body(props) {
|
179
|
175
|
|
180
|
176
|
// 私客/公客切换
|
181
|
177
|
function radioButtonHandleSizeChange(e) {
|
182
|
|
-
|
|
178
|
+
|
183
|
179
|
displayNone()
|
184
|
|
-
|
|
180
|
+
|
185
|
181
|
props.form.resetFields();
|
186
|
182
|
const { value } = e.target
|
187
|
183
|
setCustomerType(value)
|
|
@@ -203,8 +199,8 @@ function body(props) {
|
203
|
199
|
// const { getFieldDecorator } = JSON.parse(localStorage.getItem("pageParams"))
|
204
|
200
|
getList({ customerType, ...JSON.parse(localStorage.getItem("pubPageParams")) })
|
205
|
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,7 +211,7 @@ function body(props) {
|
215
|
211
|
function handleReset() {
|
216
|
212
|
props.form.resetFields();
|
217
|
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
|
215
|
getList(JSON.parse(localStorage.getItem("priPageParams")))
|
220
|
216
|
} else {
|
221
|
217
|
localStorage.setItem("pubPageParams", JSON.stringify({ pageNumber: 1, pageSize: 10, customerType: 'public' }))
|
|
@@ -233,7 +229,7 @@ function body(props) {
|
233
|
229
|
setRecordVisibleData({ visible: false, customerId: '' })
|
234
|
230
|
setStatusVisibleData({ visible: false, customerId: '' })
|
235
|
231
|
setRecommendVisibleData({ visible: false, customerId: '' })
|
236
|
|
- setBatchAssistVisibleData({ visible: false, customerId: '',buildingId:'' })
|
|
232
|
+ setBatchAssistVisibleData({ visible: false, customerId: '', buildingId: '' })
|
237
|
233
|
}
|
238
|
234
|
|
239
|
235
|
function showRecord(record) {
|
|
@@ -241,7 +237,7 @@ function body(props) {
|
241
|
237
|
setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
|
242
|
238
|
setStatusVisibleData({ visible: false, customerId: '' })
|
243
|
239
|
setRecommendVisibleData({ visible: false, customerId: '' })
|
244
|
|
- setBatchAssistVisibleData({ visible: false, customerId: '',buildingId:'' })
|
|
240
|
+ setBatchAssistVisibleData({ visible: false, customerId: '', buildingId: '' })
|
245
|
241
|
}
|
246
|
242
|
|
247
|
243
|
function showStatus(record) {
|
|
@@ -249,7 +245,7 @@ function body(props) {
|
249
|
245
|
setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
|
250
|
246
|
setRecommendVisibleData({ visible: false, customerId: '' })
|
251
|
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,13 +258,13 @@ function body(props) {
|
262
|
258
|
}
|
263
|
259
|
|
264
|
260
|
//分配置业顾问
|
265
|
|
- function assistConsultant(personId,buildingId) {
|
|
261
|
+ function assistConsultant(personId, buildingId) {
|
266
|
262
|
setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
|
267
|
263
|
setRecordVisibleData({ visible: false, customerId: '' })
|
268
|
264
|
setStatusVisibleData({ visible: false, customerId: '' })
|
269
|
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
|
270
|
function batchAssistConsultant() {
|
|
@@ -281,22 +277,22 @@ function body(props) {
|
281
|
277
|
const compareSet = new Set();
|
282
|
278
|
personInfo.filter(record => {
|
283
|
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
|
286
|
// const newSelectedRows = personInfo.filter()
|
291
|
|
-
|
|
287
|
+
|
292
|
288
|
// console.log(newSelectedRows,'newSelectedRows')
|
293
|
289
|
|
294
|
290
|
setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
|
295
|
291
|
setRecordVisibleData({ visible: false, customerId: '' })
|
296
|
292
|
setStatusVisibleData({ visible: false, customerId: '' })
|
297
|
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
|
298
|
function toCustomerDateil(record) {
|
|
@@ -325,7 +321,7 @@ function body(props) {
|
325
|
321
|
download(response)
|
326
|
322
|
setLoadingStatus(false)
|
327
|
323
|
}).catch(error => {
|
328
|
|
- message.err("连接超时");
|
|
324
|
+ message.err('连接超时');
|
329
|
325
|
setLoadingStatus(false)
|
330
|
326
|
})
|
331
|
327
|
}
|
|
@@ -347,13 +343,10 @@ function body(props) {
|
347
|
343
|
function closeAttribution() {
|
348
|
344
|
setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
|
349
|
345
|
if (customerType === 'private') {
|
350
|
|
-
|
351
|
|
- getList(JSON.parse(localStorage.getItem("priPageParams")))
|
|
346
|
+ getList(JSON.parse(localStorage.getItem('priPageParams')))
|
352
|
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
|
352
|
function closeAll() {
|
|
@@ -361,7 +354,7 @@ function body(props) {
|
361
|
354
|
setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
|
362
|
355
|
setStatusVisibleData({ visible: false, customerId: '', status: '' })
|
363
|
356
|
setRecommendVisibleData({ visible: false, customerId: '' })
|
364
|
|
- setAssistVisibleData({ visible: false, customerId: '',buildingId:'' })
|
|
357
|
+ setAssistVisibleData({ visible: false, customerId: '', buildingId: '' })
|
365
|
358
|
setBatchAssistVisibleData({ visible: false, customerId: '' })
|
366
|
359
|
if (customerType === 'private') {
|
367
|
360
|
|
|
@@ -379,10 +372,11 @@ function body(props) {
|
379
|
372
|
console.log('selectedRowKeys:', selectedRowKeys, 'selectedRows: ', selectedRows);
|
380
|
373
|
setSelectedRowKeys(selectedRowKeys)
|
381
|
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
|
378
|
// setSelectedRows(newSelectedRows)
|
|
379
|
+ console.log(newSelectedRows, "33333333333333333333")
|
386
|
380
|
setPersonInfo(newSelectedRows)
|
387
|
381
|
},
|
388
|
382
|
};
|
|
@@ -395,7 +389,7 @@ function body(props) {
|
395
|
389
|
align: 'center',
|
396
|
390
|
width: '15%',
|
397
|
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
|
395
|
title: '姓名',
|
|
@@ -461,7 +455,7 @@ function body(props) {
|
461
|
455
|
<Button className={customerType === 'private' ? Styles.displayS : Styles.text} type="link" onClick={() => showRecommend(record.personId)}>推荐客户</Button>
|
462
|
456
|
</AuthButton>
|
463
|
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
|
459
|
</AuthButton>
|
466
|
460
|
<AuthButton name="admin.mine.taPointsRecords.point.record" noRight={null}>
|
467
|
461
|
<Button className={Styles.text} type="link" onClick={() => showRecord(record)}>积分记录</Button>
|
|
@@ -585,7 +579,7 @@ function body(props) {
|
585
|
579
|
return (
|
586
|
580
|
<>
|
587
|
581
|
<Form layout="inline" onSubmit={e => handleSubmit(e, props)}>
|
588
|
|
- {customerType === 'public' && <Form.Item>
|
|
582
|
+ {customerType === 'public' && <Form.Item>
|
589
|
583
|
{getFieldDecorator('belongStatus')(
|
590
|
584
|
<Select style={{ width: '180px' }} placeholder="是否归属项目" onChange={handleSelectChange}>
|
591
|
585
|
<Option value={1}>是</Option>
|