|
@@ -22,8 +22,9 @@ class ModalAttribution extends React.Component {
|
22
|
22
|
super(props);
|
23
|
23
|
console.log(props, 'props')
|
24
|
24
|
this.state = {
|
25
|
|
- dataSource: { records: [] },
|
26
|
|
- visibleData: { visible: false, customerId: [], buildingName: '' },
|
|
25
|
+ dataSource: { records: [] },
|
|
26
|
+ visibleData: { visible: false, customerId: [], buildingName: '' },
|
|
27
|
+ buildingId: ''
|
27
|
28
|
}
|
28
|
29
|
}
|
29
|
30
|
|
|
@@ -33,9 +34,11 @@ class ModalAttribution extends React.Component {
|
33
|
34
|
}
|
34
|
35
|
|
35
|
36
|
componentDidUpdate(preProps, preState) {
|
|
37
|
+ // this.setState({ buildingId: this.props.visibleData.buildingId })
|
36
|
38
|
console.log(this.props.visibleData)
|
37
|
39
|
if (this.props.visibleData.visible !== preState.visibleData.visible) {
|
38
|
|
- this.getList({ pageNumber: 1, pageSize: 5,buildingId: this.props.visibleData.buildingId})
|
|
40
|
+
|
|
41
|
+ this.getList({ pageNumber: 1, pageSize: 5, buildingId: this.props.visibleData.buildingId })
|
39
|
42
|
this.setState({ visibleData: this.props.visibleData });
|
40
|
43
|
}
|
41
|
44
|
}
|
|
@@ -51,12 +54,12 @@ class ModalAttribution extends React.Component {
|
51
|
54
|
this.props.onCancel()
|
52
|
55
|
}
|
53
|
56
|
|
54
|
|
- changBuilding(buildingId){
|
55
|
|
- this.getUserList({ pageNumber: 1, pageSize: 5, buildingId: buildingId })
|
|
57
|
+ changBuilding(buildingId) {
|
|
58
|
+ this.getUserList({ pageNumber: 1, pageSize: 5, buildingId: this.buildingId })
|
56
|
59
|
this.setState({ visibleData: { visible: this.props.visibleData.visible, customerId: this.props.visibleData.customerId, buildingName: buildingId } });
|
57
|
60
|
}
|
58
|
61
|
|
59
|
|
- getUserList(params){
|
|
62
|
+ getUserList(params) {
|
60
|
63
|
console.log('params: ', params)
|
61
|
64
|
if (params.buildingId === '' || params.buildingId === null || params.buildingId === undefined) {
|
62
|
65
|
return
|
|
@@ -65,17 +68,17 @@ class ModalAttribution extends React.Component {
|
65
|
68
|
request({ ...apis.customer.buildingConsultant, params: { ...params } }).then(res => {
|
66
|
69
|
this.setState({ dataSource: res })
|
67
|
70
|
}).catch(err => {
|
68
|
|
-
|
|
71
|
+
|
69
|
72
|
})
|
70
|
73
|
}
|
71
|
74
|
|
72
|
75
|
getList(params) {
|
73
|
76
|
// 网路请求
|
74
|
77
|
console.log('params: ', params)
|
75
|
|
- request({ ...apis.customer.buildingConsultant , params: { ...params }}).then(res => {
|
|
78
|
+ request({ ...apis.customer.buildingConsultant, params: { ...params } }).then(res => {
|
76
|
79
|
this.setState({ dataSource: res })
|
77
|
80
|
}).catch(err => {
|
78
|
|
-
|
|
81
|
+
|
79
|
82
|
})
|
80
|
83
|
}
|
81
|
84
|
|
|
@@ -87,10 +90,10 @@ class ModalAttribution extends React.Component {
|
87
|
90
|
});
|
88
|
91
|
};
|
89
|
92
|
|
90
|
|
- // 分页
|
|
93
|
+ // 分页
|
91
|
94
|
onChange(pageNum) {
|
92
|
95
|
|
93
|
|
- this.getUserList({ pageNumber: pageNum, pageSize: 5, buildingId: this.state.visibleData.buildingName })
|
|
96
|
+ this.getList({ pageNumber: pageNum, pageSize: 5, buildingId: this.state.visibleData.buildingId })
|
94
|
97
|
}
|
95
|
98
|
|
96
|
99
|
// 提交
|
|
@@ -138,22 +141,23 @@ class ModalAttribution extends React.Component {
|
138
|
141
|
dataIndex: 'personId',
|
139
|
142
|
key: 'personId',
|
140
|
143
|
// eslint-disable-next-line no-nested-ternary
|
141
|
|
- render: (_, record) => <>{ <Button type="danger" onClick={() => this.submitGm(record)}>确定</Button>}</>, },
|
|
144
|
+ render: (_, record) => <>{<Button type="danger" onClick={() => this.submitGm(record)}>确定</Button>}</>,
|
|
145
|
+ },
|
142
|
146
|
]
|
143
|
147
|
return (
|
144
|
148
|
<>
|
145
|
149
|
<Modal
|
146
|
|
- title="分配置业顾问"
|
147
|
|
- width={800}
|
148
|
|
- destroyOnClose="true"
|
149
|
|
- footer={null}
|
150
|
|
- visible={this.state.visibleData.visible}
|
151
|
|
- onCancel={(e) => this.handleCancel(e)}
|
152
|
|
- >
|
153
|
|
- <span>你正在为{this.props.visibleData.customerId.length}位公客分配置业顾问</span><br/><br/>
|
154
|
|
- {this.props.visibleData.buildingId == null && <BuildSelect onChange={this.changBuilding.bind(this)} value={this.state.visibleData.buildingName} />}
|
155
|
|
- <Table rowKey="BatchAssistConsultant" dataSource={this.state.dataSource.records} columns={columns} pagination={{pageSize: 5, total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
|
156
|
|
- </Modal>
|
|
150
|
+ title="分配置业顾问"
|
|
151
|
+ width={800}
|
|
152
|
+ destroyOnClose="true"
|
|
153
|
+ footer={null}
|
|
154
|
+ visible={this.state.visibleData.visible}
|
|
155
|
+ onCancel={(e) => this.handleCancel(e)}
|
|
156
|
+ >
|
|
157
|
+ <span>你正在为{this.props.visibleData.customerId.length}位公客分配置业顾问</span><br /><br />
|
|
158
|
+ {this.props.visibleData.buildingId == null && <BuildSelect onChange={this.changBuilding.bind(this)} value={this.state.visibleData.buildingName} />}
|
|
159
|
+ <Table rowKey="BatchAssistConsultant" dataSource={this.state.dataSource.records} columns={columns} pagination={{ pageSize: 5, total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
|
|
160
|
+ </Modal>
|
157
|
161
|
</>
|
158
|
162
|
);
|
159
|
163
|
}
|