浏览代码

Merge branch 'dev' of http://git.ycjcjy.com/zhiyuxing/estateagents-admin-manager into dev

zhoulisen 5 年前
父节点
当前提交
06d77d001b

+ 32
- 31
src/pages/customer/customerlist/components/BatchAssistConsultant.jsx 查看文件

22
     super(props);
22
     super(props);
23
     console.log(props, 'props')
23
     console.log(props, 'props')
24
     this.state = {
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
   }
33
   }
35
 
34
 
36
   componentDidUpdate(preProps, preState) {
35
   componentDidUpdate(preProps, preState) {
37
-    // this.setState({ buildingId: this.props.visibleData.buildingId })
38
     console.log(this.props.visibleData)
36
     console.log(this.props.visibleData)
39
     if (this.props.visibleData.visible !== preState.visibleData.visible) {
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
       this.setState({ visibleData: this.props.visibleData });
39
       this.setState({ visibleData: this.props.visibleData });
43
     }
40
     }
44
   }
41
   }
54
     this.props.onCancel()
51
     this.props.onCancel()
55
   }
52
   }
56
 
53
 
57
-  changBuilding(buildingId) {
54
+  changBuilding(buildingId){
58
     this.getUserList({ pageNumber: 1, pageSize: 5, buildingId: buildingId })
55
     this.getUserList({ pageNumber: 1, pageSize: 5, buildingId: buildingId })
59
     this.setState({ visibleData: { visible: this.props.visibleData.visible, customerId: this.props.visibleData.customerId, buildingName: buildingId } });
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
     console.log('params: ', params)
60
     console.log('params: ', params)
64
     if (params.buildingId === '' || params.buildingId === null || params.buildingId === undefined) {
61
     if (params.buildingId === '' || params.buildingId === null || params.buildingId === undefined) {
65
       return
62
       return
75
   getList(params) {
72
   getList(params) {
76
     // 网路请求
73
     // 网路请求
77
     console.log('params: ', params)
74
     console.log('params: ', params)
78
-    request({ ...apis.customer.buildingConsultant, params: { ...params } }).then(res => {
75
+    request({ ...apis.customer.buildingConsultant , params: { ...params }}).then(res => {
79
       this.setState({ dataSource: res })
76
       this.setState({ dataSource: res })
80
     }).catch(err => {
77
     }).catch(err => {
81
-
78
+      
82
     })
79
     })
83
   }
80
   }
84
 
81
 
90
     });
87
     });
91
   };
88
   };
92
 
89
 
93
-  // 分页
90
+   // 分页
94
   onChange(pageNum) {
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
   submitGm(record) {
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
       // eslint-disable-next-line no-unused-expressions
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
         this.openNotificationWithIcon('success', '操作成功')
109
         this.openNotificationWithIcon('success', '操作成功')
108
       }
110
       }
109
       this.handleCancel()
111
       this.handleCancel()
110
     }).catch(err => {
112
     }).catch(err => {
111
       // eslint-disable-next-line no-unused-expressions
113
       // eslint-disable-next-line no-unused-expressions
112
-
114
+  
113
     })
115
     })
114
   }
116
   }
115
 
117
 
145
         dataIndex: 'personId',
147
         dataIndex: 'personId',
146
         key: 'personId',
148
         key: 'personId',
147
         // eslint-disable-next-line no-nested-ternary
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
     return (
152
     return (
152
       <>
153
       <>
153
         <Modal
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
   }

+ 24
- 25
src/pages/customer/customerlist/components/assistConsultant.jsx 查看文件

21
   constructor(props) {
21
   constructor(props) {
22
     super(props);
22
     super(props);
23
     this.state = {
23
     this.state = {
24
-      dataSource: { records: [] },
25
-      visibleData: { visible: false, customerId: '', buildingName: '' },
24
+       dataSource: { records: [] },
25
+       visibleData: { visible: false, customerId: '', buildingName: '' },
26
     }
26
     }
27
   }
27
   }
28
 
28
 
34
   componentDidUpdate(preProps, preState) {
34
   componentDidUpdate(preProps, preState) {
35
     console.log(this.props.visibleData)
35
     console.log(this.props.visibleData)
36
     if (this.props.visibleData.visible !== preState.visibleData.visible) {
36
     if (this.props.visibleData.visible !== preState.visibleData.visible) {
37
-      this.getList({ pageNumber: 1, pageSize: 5, customerId: this.props.visibleData.customerId, buildingId: this.props.visibleData.buildingId })
37
+      this.getList({ pageNumber: 1, pageSize: 5, customerId: this.props.visibleData.customerId,buildingId:this.props.visibleData.buildingId })
38
       this.setState({ visibleData: this.props.visibleData });
38
       this.setState({ visibleData: this.props.visibleData });
39
     }
39
     }
40
   }
40
   }
50
     this.props.onCancel()
50
     this.props.onCancel()
51
   }
51
   }
52
 
52
 
53
-  changBuilding(buildingId) {
54
-    console.log(buildingId,'buildingId')
53
+  changBuilding(buildingId){
55
     this.getUserList({ pageNumber: 1, pageSize: 5, buildingId: buildingId })
54
     this.getUserList({ pageNumber: 1, pageSize: 5, buildingId: buildingId })
56
     this.setState({ visibleData: { visible: this.props.visibleData.visible, customerId: this.props.visibleData.customerId, buildingName: buildingId } });
55
     this.setState({ visibleData: { visible: this.props.visibleData.visible, customerId: this.props.visibleData.customerId, buildingName: buildingId } });
57
   }
56
   }
58
 
57
 
59
-  getUserList(params) {
58
+  getUserList(params){
60
     console.log('params: ', params)
59
     console.log('params: ', params)
61
     if (params.buildingId === '' || params.buildingId === null || params.buildingId === undefined) {
60
     if (params.buildingId === '' || params.buildingId === null || params.buildingId === undefined) {
62
       return
61
       return
65
     request({ ...apis.customer.buildingConsultant, params: { ...params } }).then(res => {
64
     request({ ...apis.customer.buildingConsultant, params: { ...params } }).then(res => {
66
       this.setState({ dataSource: res })
65
       this.setState({ dataSource: res })
67
     }).catch(err => {
66
     }).catch(err => {
68
-      message.err(err)
67
+      
69
     })
68
     })
70
   }
69
   }
71
 
70
 
74
     request({ ...apis.customer.buildingConsultant, params: { ...params } }).then(res => {
73
     request({ ...apis.customer.buildingConsultant, params: { ...params } }).then(res => {
75
       this.setState({ dataSource: res })
74
       this.setState({ dataSource: res })
76
     }).catch(err => {
75
     }).catch(err => {
77
-      message.err(err)
76
+      
78
     })
77
     })
79
   }
78
   }
80
 
79
 
86
     });
85
     });
87
   };
86
   };
88
 
87
 
89
-  // 分页
88
+   // 分页
90
   onChange(pageNum) {
89
   onChange(pageNum) {
91
-    console.log(this.state.visibleData.buildingName,this.props.visibleData.buildingId)
92
-    this.getList({ pageNumber: pageNum, pageSize: 5, customerId: this.props.visibleData.customerId, buildingId: this.state.visibleData.buildingName ||this.props.visibleData.buildingId})
90
+    this.getList({ pageNumber: pageNum, pageSize: 5, buildingId: this.state.visibleData.buildingName })
93
   }
91
   }
94
 
92
 
95
   // 提交
93
   // 提交
96
   submitGm(record) {
94
   submitGm(record) {
95
+    debugger
97
     // 网路请求
96
     // 网路请求
98
-    request({ ...apis.customer.consultantAssist, urlData: { id: this.state.visibleData.customerId }, data: { userId: record.userId } }).then(res => {
97
+    request({ ...apis.customer.consultantAssist, urlData: { id: this.state.visibleData.customerId }, 
98
+      data: { userId: record.userId,buildingId:this.state.visibleData.buildingName  || this.props.visibleData.buildingId } }).then(res => {
99
       // eslint-disable-next-line no-unused-expressions
99
       // eslint-disable-next-line no-unused-expressions
100
+      
100
       this.openNotificationWithIcon('success', '操作成功')
101
       this.openNotificationWithIcon('success', '操作成功')
101
       this.handleCancel()
102
       this.handleCancel()
102
     }).catch(err => {
103
     }).catch(err => {
103
       // eslint-disable-next-line no-unused-expressions
104
       // eslint-disable-next-line no-unused-expressions
104
-
105
     })
105
     })
106
   }
106
   }
107
 
107
 
137
         dataIndex: 'personId',
137
         dataIndex: 'personId',
138
         key: 'personId',
138
         key: 'personId',
139
         // eslint-disable-next-line no-nested-ternary
139
         // eslint-disable-next-line no-nested-ternary
140
-        render: (_, record) => <>{<Button type="danger" onClick={() => this.submitGm(record)}>确定</Button>}</>,
141
-      },
140
+        render: (_, record) => <>{ <Button type="danger" onClick={() => this.submitGm(record)}>确定</Button>}</>, },
142
     ]
141
     ]
143
     return (
142
     return (
144
       <>
143
       <>
145
         <Modal
144
         <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
-          {this.props.visibleData.buildingId == null && <BuildSelect onChange={this.changBuilding.bind(this)} value={this.state.visibleData.buildingName} />}
154
-          <Table rowKey="assistConsultant" dataSource={this.state.dataSource.records} columns={columns} pagination={{ pageSize: 5, total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
155
-        </Modal>
145
+            title="分配置业顾问"
146
+            width={800}
147
+            destroyOnClose="true"
148
+            footer={null}
149
+            visible={this.state.visibleData.visible}
150
+            onCancel={(e) => this.handleCancel(e)}
151
+          >
152
+            {this.props.visibleData.buildingId == null && <BuildSelect  onChange={this.changBuilding.bind(this)} value={this.state.visibleData.buildingName} />}
153
+            <Table rowKey="assistConsultant" dataSource={this.state.dataSource.records} columns={columns} pagination={{pageSize: 5, total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
154
+          </Modal>
156
       </>
155
       </>
157
     );
156
     );
158
   }
157
   }