|
@@ -21,18 +21,18 @@ 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
|
34
|
if (this.props.visibleData.visible !== preState.visibleData.visible) {
|
35
|
|
- this.getList({ pageNumber: 1, pageSize: 5 })
|
|
35
|
+ this.getList({ pageNumber: 1, pageSize: 5, buildingId: this.props.visibleData.buildingId })
|
36
|
36
|
this.setState({ visibleData: this.props.visibleData });
|
37
|
37
|
}
|
38
|
38
|
}
|
|
@@ -49,8 +49,12 @@ class ModalAttribution extends React.Component {
|
49
|
49
|
}
|
50
|
50
|
|
51
|
51
|
getList(params) {
|
|
52
|
+ if (params.buildingId === '') {
|
|
53
|
+ return
|
|
54
|
+ }
|
|
55
|
+
|
52
|
56
|
// 网路请求
|
53
|
|
- request({ ...apis.customer.consultant, params: { ...params } }).then(res => {
|
|
57
|
+ request({ ...apis.customer.buildingConsultant, params: { ...params } }).then(res => {
|
54
|
58
|
this.setState({ dataSource: res })
|
55
|
59
|
}).catch(err => {
|
56
|
60
|
// eslint-disable-next-line no-unused-expressions
|
|
@@ -68,21 +72,27 @@ class ModalAttribution extends React.Component {
|
68
|
72
|
|
69
|
73
|
// 分页
|
70
|
74
|
onChange(pageNum) {
|
71
|
|
- this.getList({ pageNumber: pageNum, pageSize: 5 })
|
|
75
|
+ this.getList({ pageNumber: pageNum, pageSize: 5, buildingId: this.props.visibleData.buildingId })
|
72
|
76
|
}
|
73
|
77
|
|
74
|
78
|
// 提交
|
75
|
79
|
submitGm(record) {
|
76
|
|
- // 网路请求
|
77
|
|
- request({ ...apis.customer.recommendEdit, urlData: { id: this.state.visibleData.customerId }, data: { customerId: this.state.visibleData.customerId, realtyConsultant: record.personId } }).then(res => {
|
78
|
|
- // eslint-disable-next-line no-unused-expressions
|
79
|
|
- this.openNotificationWithIcon('success', '操作成功')
|
80
|
|
- this.handleCancel()
|
81
|
|
- this.props.onSuccess({ realtyConsultant: record.personId, name: record.name })
|
82
|
|
- }).catch(err => {
|
83
|
|
- // eslint-disable-next-line no-unused-expressions
|
84
|
|
- // this.openNotificationWithIcon('error', err)
|
85
|
|
- })
|
|
80
|
+
|
|
81
|
+ console.log('传递之前:', record)
|
|
82
|
+ this.handleCancel()
|
|
83
|
+ this.props.onSuccess({ realtyConsultant: record.userId, name: record.userName })
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+ // // 网路请求
|
|
87
|
+ // request({ ...apis.customer.recommendEdit, urlData: { id: this.state.visibleData.customerId }, data: { customerId: this.state.visibleData.customerId, realtyConsultant: record.personId } }).then(res => {
|
|
88
|
+ // // eslint-disable-next-line no-unused-expressions
|
|
89
|
+ // this.openNotificationWithIcon('success', '操作成功')
|
|
90
|
+ // this.handleCancel()
|
|
91
|
+ // this.props.onSuccess({ realtyConsultant: record.personId, name: record.name })
|
|
92
|
+ // }).catch(err => {
|
|
93
|
+ // // eslint-disable-next-line no-unused-expressions
|
|
94
|
+ // // this.openNotificationWithIcon('error', err)
|
|
95
|
+ // })
|
86
|
96
|
}
|
87
|
97
|
|
88
|
98
|
render() {
|
|
@@ -117,7 +127,7 @@ class ModalAttribution extends React.Component {
|
117
|
127
|
dataIndex: 'personId',
|
118
|
128
|
key: 'personId',
|
119
|
129
|
// eslint-disable-next-line no-nested-ternary
|
120
|
|
- render: (_, record) => <>{ this.props.visibleData.realtyConsultant !== record.personId && <Button type="danger" onClick={() => this.submitGm(record)}>确定</Button>}</>,
|
|
130
|
+ render: (_, record) => <>{ this.props.visibleData.realtyConsultant !== record.userId && <Button type="danger" onClick={() => this.submitGm(record)}>确定</Button>}</>,
|
121
|
131
|
},
|
122
|
132
|
]
|
123
|
133
|
return (
|