|
@@ -22,9 +22,8 @@ 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: '' },
|
27
|
|
- buildingId: ''
|
|
25
|
+ dataSource: { records: [] },
|
|
26
|
+ visibleData: { visible: false, customerId: [], buildingName: '' },
|
28
|
27
|
}
|
29
|
28
|
}
|
30
|
29
|
|
|
@@ -34,11 +33,9 @@ class ModalAttribution extends React.Component {
|
34
|
33
|
}
|
35
|
34
|
|
36
|
35
|
componentDidUpdate(preProps, preState) {
|
37
|
|
- // this.setState({ buildingId: this.props.visibleData.buildingId })
|
38
|
36
|
console.log(this.props.visibleData)
|
39
|
37
|
if (this.props.visibleData.visible !== preState.visibleData.visible) {
|
40
|
|
-
|
41
|
|
- this.getList({ pageNumber: 1, pageSize: 5, buildingId: this.props.visibleData.buildingId })
|
|
38
|
+ this.getList({ pageNumber: 1, pageSize: 5,buildingId: this.props.visibleData.buildingId})
|
42
|
39
|
this.setState({ visibleData: this.props.visibleData });
|
43
|
40
|
}
|
44
|
41
|
}
|
|
@@ -54,12 +51,12 @@ class ModalAttribution extends React.Component {
|
54
|
51
|
this.props.onCancel()
|
55
|
52
|
}
|
56
|
53
|
|
57
|
|
- changBuilding(buildingId) {
|
|
54
|
+ changBuilding(buildingId){
|
58
|
55
|
this.getUserList({ pageNumber: 1, pageSize: 5, buildingId: buildingId })
|
59
|
56
|
this.setState({ visibleData: { visible: this.props.visibleData.visible, customerId: this.props.visibleData.customerId, buildingName: buildingId } });
|
60
|
57
|
}
|
61
|
58
|
|
62
|
|
- getUserList(params) {
|
|
59
|
+ getUserList(params){
|
63
|
60
|
console.log('params: ', params)
|
64
|
61
|
if (params.buildingId === '' || params.buildingId === null || params.buildingId === undefined) {
|
65
|
62
|
return
|
|
@@ -75,10 +72,10 @@ class ModalAttribution extends React.Component {
|
75
|
72
|
getList(params) {
|
76
|
73
|
// 网路请求
|
77
|
74
|
console.log('params: ', params)
|
78
|
|
- request({ ...apis.customer.buildingConsultant, params: { ...params } }).then(res => {
|
|
75
|
+ request({ ...apis.customer.buildingConsultant , params: { ...params }}).then(res => {
|
79
|
76
|
this.setState({ dataSource: res })
|
80
|
77
|
}).catch(err => {
|
81
|
|
-
|
|
78
|
+
|
82
|
79
|
})
|
83
|
80
|
}
|
84
|
81
|
|
|
@@ -90,26 +87,31 @@ class ModalAttribution extends React.Component {
|
90
|
87
|
});
|
91
|
88
|
};
|
92
|
89
|
|
93
|
|
- // 分页
|
|
90
|
+ // 分页
|
94
|
91
|
onChange(pageNum) {
|
95
|
|
- this.getList({ pageNumber: pageNum, pageSize: 5, buildingId: this.state.visibleData.buildingName ||this.props.visibleData.buildingId})
|
|
92
|
+ console.log(this.state.visibleData.buildingName,"222222222222222222222222")
|
|
93
|
+
|
|
94
|
+ this.getUserList({ pageNumber: pageNum, pageSize: 5, buildingId: this.state.visibleData.buildingName })
|
96
|
95
|
}
|
97
|
96
|
|
98
|
97
|
// 提交
|
99
|
98
|
submitGm(record) {
|
|
99
|
+ console.log(this.state.visibleData.buildingName,"3333333333333333333")
|
100
|
100
|
// 网路请求
|
101
|
|
- request({ ...apis.customer.batchConsultantAssist, data: { userId: record.userId, customerIds: this.state.visibleData.customerId } }).then(res => {
|
|
101
|
+ request({ ...apis.customer.batchConsultantAssist, data: { userId: record.userId
|
|
102
|
+ ,buildingId:this.state.visibleData.buildingName || this.props.visibleData.buildingId
|
|
103
|
+ , customerIds: this.state.visibleData.customerId } }).then(res => {
|
102
|
104
|
// eslint-disable-next-line no-unused-expressions
|
103
|
|
-
|
104
|
|
- if (res != null && res.failNum > 0) {
|
105
|
|
- this.openNotificationWithIcon('success', '共' + res.totalNum + '条数据,失败操作' + res.failNum + '条')
|
106
|
|
- } else {
|
|
105
|
+ debugger
|
|
106
|
+ if(res!= null && res.failNum > 0 ){
|
|
107
|
+ this.openNotificationWithIcon('success', '共'+res.totalNum+'条数据,失败操作'+res.failNum+'条')
|
|
108
|
+ }else{
|
107
|
109
|
this.openNotificationWithIcon('success', '操作成功')
|
108
|
110
|
}
|
109
|
111
|
this.handleCancel()
|
110
|
112
|
}).catch(err => {
|
111
|
113
|
// eslint-disable-next-line no-unused-expressions
|
112
|
|
-
|
|
114
|
+
|
113
|
115
|
})
|
114
|
116
|
}
|
115
|
117
|
|
|
@@ -145,23 +147,22 @@ class ModalAttribution extends React.Component {
|
145
|
147
|
dataIndex: 'personId',
|
146
|
148
|
key: 'personId',
|
147
|
149
|
// eslint-disable-next-line no-nested-ternary
|
148
|
|
- render: (_, record) => <>{<Button type="danger" onClick={() => this.submitGm(record)}>确定</Button>}</>,
|
149
|
|
- },
|
|
150
|
+ render: (_, record) => <>{ <Button type="danger" onClick={() => this.submitGm(record)}>确定</Button>}</>, },
|
150
|
151
|
]
|
151
|
152
|
return (
|
152
|
153
|
<>
|
153
|
154
|
<Modal
|
154
|
|
- title="分配置业顾问"
|
155
|
|
- width={800}
|
156
|
|
- destroyOnClose="true"
|
157
|
|
- footer={null}
|
158
|
|
- visible={this.state.visibleData.visible}
|
159
|
|
- onCancel={(e) => this.handleCancel(e)}
|
160
|
|
- >
|
161
|
|
- <span>你正在为{this.props.visibleData.customerId.length}位公客分配置业顾问</span><br /><br />
|
162
|
|
- {this.props.visibleData.buildingId == null && <BuildSelect onChange={this.changBuilding.bind(this)} value={this.state.visibleData.buildingName} />}
|
163
|
|
- <Table rowKey="BatchAssistConsultant" dataSource={this.state.dataSource.records} columns={columns} pagination={{ pageSize: 5, total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
|
164
|
|
- </Modal>
|
|
155
|
+ title="分配置业顾问"
|
|
156
|
+ width={800}
|
|
157
|
+ destroyOnClose="true"
|
|
158
|
+ footer={null}
|
|
159
|
+ visible={this.state.visibleData.visible}
|
|
160
|
+ onCancel={(e) => this.handleCancel(e)}
|
|
161
|
+ >
|
|
162
|
+ <span>你正在为{this.props.visibleData.customerId.length}位公客分配置业顾问</span><br/><br/>
|
|
163
|
+ {this.props.visibleData.buildingId == null && <BuildSelect onChange={this.changBuilding.bind(this)} value={this.state.visibleData.buildingName} />}
|
|
164
|
+ <Table rowKey="BatchAssistConsultant" dataSource={this.state.dataSource.records} columns={columns} pagination={{pageSize: 5, total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
|
|
165
|
+ </Modal>
|
165
|
166
|
</>
|
166
|
167
|
);
|
167
|
168
|
}
|