|
@@ -21,18 +21,19 @@ class ModalAttribution extends React.Component {
|
21
|
21
|
super(props);
|
22
|
22
|
this.state = {
|
23
|
23
|
dataSource: { records: [] },
|
24
|
|
- visibleData: { visible: false, customerId: '', realtyConsultant: '' },
|
|
24
|
+ visibleData: { visible: false, customerId: '', realtyConsultant: '', buildingId: '' },
|
25
|
25
|
}
|
26
|
26
|
}
|
27
|
27
|
|
28
|
28
|
// 挂载之后
|
29
|
29
|
componentDidMount() {
|
30
|
|
- this.getList({ pageNumber: 1, pageSize: 5 })
|
|
30
|
+ // this.getList({ pageNumber: 1, pageSize: 5 })
|
31
|
31
|
}
|
32
|
32
|
|
33
|
33
|
componentDidUpdate(preProps, preState) {
|
|
34
|
+ console.log(this.props.visibleData)
|
34
|
35
|
if (this.props.visibleData.visible !== preState.visibleData.visible) {
|
35
|
|
- this.getList({ pageNumber: 1, pageSize: 5 })
|
|
36
|
+ this.getList({ pageNumber: 1, pageSize: 5, buildingId: this.props.visibleData.buildingId })
|
36
|
37
|
this.setState({ visibleData: this.props.visibleData });
|
37
|
38
|
}
|
38
|
39
|
}
|
|
@@ -49,8 +50,12 @@ class ModalAttribution extends React.Component {
|
49
|
50
|
}
|
50
|
51
|
|
51
|
52
|
getList(params) {
|
|
53
|
+ console.log('params: ', params)
|
|
54
|
+ if (params.buildingId === '') {
|
|
55
|
+ return
|
|
56
|
+ }
|
52
|
57
|
// 网路请求
|
53
|
|
- request({ ...apis.customer.consultant, params: { ...params } }).then(res => {
|
|
58
|
+ request({ ...apis.customer.buildingConsultant, params: { ...params } }).then(res => {
|
54
|
59
|
this.setState({ dataSource: res })
|
55
|
60
|
}).catch(err => {
|
56
|
61
|
// eslint-disable-next-line no-unused-expressions
|
|
@@ -68,13 +73,13 @@ class ModalAttribution extends React.Component {
|
68
|
73
|
|
69
|
74
|
// 分页
|
70
|
75
|
onChange(pageNum) {
|
71
|
|
- this.getList({ pageNumber: pageNum, pageSize: 5 })
|
|
76
|
+ this.getList({ pageNumber: pageNum, pageSize: 5, buildingId: this.props.visibleData.buildingId })
|
72
|
77
|
}
|
73
|
78
|
|
74
|
79
|
// 提交
|
75
|
80
|
submitGm(record) {
|
76
|
81
|
// 网路请求
|
77
|
|
- request({ ...apis.customer.recommendEdit, urlData: { id: this.state.visibleData.customerId }, data: { customerId: this.state.visibleData.customerId, realtyConsultant: record.personId } }).then(res => {
|
|
82
|
+ request({ ...apis.customer.recommendEdit, urlData: { id: this.state.visibleData.customerId }, data: { customerId: this.state.visibleData.customerId, realtyConsultant: record.userId } }).then(res => {
|
78
|
83
|
// eslint-disable-next-line no-unused-expressions
|
79
|
84
|
this.openNotificationWithIcon('success', '操作成功')
|
80
|
85
|
this.handleCancel()
|
|
@@ -88,13 +93,13 @@ class ModalAttribution extends React.Component {
|
88
|
93
|
const columns = [
|
89
|
94
|
// {
|
90
|
95
|
// title: '编号',
|
91
|
|
- // dataIndex: 'personId',
|
92
|
|
- // key: 'personId',
|
|
96
|
+ // dataIndex: 'userId',
|
|
97
|
+ // key: 'userId',
|
93
|
98
|
// },
|
94
|
99
|
{
|
95
|
100
|
title: '姓名',
|
96
|
|
- dataIndex: 'name',
|
97
|
|
- key: 'name',
|
|
101
|
+ dataIndex: 'userName',
|
|
102
|
+ key: 'userName',
|
98
|
103
|
},
|
99
|
104
|
{
|
100
|
105
|
title: '电话',
|
|
@@ -108,15 +113,15 @@ class ModalAttribution extends React.Component {
|
108
|
113
|
},
|
109
|
114
|
{
|
110
|
115
|
title: '岗位',
|
111
|
|
- dataIndex: 'post',
|
112
|
|
- key: 'post',
|
|
116
|
+ dataIndex: 'position',
|
|
117
|
+ key: 'position',
|
113
|
118
|
},
|
114
|
119
|
{
|
115
|
120
|
title: '操作',
|
116
|
121
|
dataIndex: 'personId',
|
117
|
122
|
key: 'personId',
|
118
|
123
|
// eslint-disable-next-line no-nested-ternary
|
119
|
|
- render: (_, record) => <>{ this.props.visibleData.realtyConsultant !== record.personId && <Button type="danger" onClick={() => this.submitGm(record)}>确定</Button>}</>,
|
|
124
|
+ render: (_, record) => <>{ this.props.visibleData.realtyConsultant != record.userId && <Button type="danger" onClick={() => this.submitGm(record)}>确定</Button>}</>,
|
120
|
125
|
},
|
121
|
126
|
]
|
122
|
127
|
return (
|