ソースを参照

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

傅行帆 5 年 前
コミット
4e35e3c871

+ 32
- 23
src/pages/customer/customerlist/components/BatchAssistConsultant.jsx ファイルの表示

@@ -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
@@ -72,10 +75,10 @@ class ModalAttribution extends React.Component {
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
   // 提交
@@ -98,7 +101,12 @@ class ModalAttribution extends React.Component {
98 101
     // 网路请求
99 102
     request({ ...apis.customer.batchConsultantAssist, data: { userId: record.userId, customerIds: this.state.visibleData.customerId } }).then(res => {
100 103
       // eslint-disable-next-line no-unused-expressions
101
-      this.openNotificationWithIcon('success', '操作成功')
104
+      debugger
105
+      if(res!= null && res.failNum > 0 ){
106
+        this.openNotificationWithIcon('success', '共'+res.totalNum+'条数据,失败操作'+res.failNum+'条')
107
+      }else{
108
+        this.openNotificationWithIcon('success', '操作成功')
109
+      }
102 110
       this.handleCancel()
103 111
     }).catch(err => {
104 112
       // eslint-disable-next-line no-unused-expressions
@@ -138,22 +146,23 @@ class ModalAttribution extends React.Component {
138 146
         dataIndex: 'personId',
139 147
         key: 'personId',
140 148
         // eslint-disable-next-line no-nested-ternary
141
-        render: (_, record) => <>{ <Button type="danger" onClick={() => this.submitGm(record)}>确定</Button>}</>, },
149
+        render: (_, record) => <>{<Button type="danger" onClick={() => this.submitGm(record)}>确定</Button>}</>,
150
+      },
142 151
     ]
143 152
     return (
144 153
       <>
145 154
         <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>
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>
157 166
       </>
158 167
     );
159 168
   }

+ 19
- 19
src/pages/customer/customerlist/components/assistConsultant.jsx ファイルの表示

@@ -21,8 +21,8 @@ class ModalAttribution extends React.Component {
21 21
   constructor(props) {
22 22
     super(props);
23 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,7 +34,7 @@ class ModalAttribution extends React.Component {
34 34
   componentDidUpdate(preProps, preState) {
35 35
     console.log(this.props.visibleData)
36 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 38
       this.setState({ visibleData: this.props.visibleData });
39 39
     }
40 40
   }
@@ -50,12 +50,12 @@ class ModalAttribution extends React.Component {
50 50
     this.props.onCancel()
51 51
   }
52 52
 
53
-  changBuilding(buildingId){
53
+  changBuilding(buildingId) {
54 54
     this.getUserList({ pageNumber: 1, pageSize: 5, buildingId: buildingId })
55 55
     this.setState({ visibleData: { visible: this.props.visibleData.visible, customerId: this.props.visibleData.customerId, buildingName: buildingId } });
56 56
   }
57 57
 
58
-  getUserList(params){
58
+  getUserList(params) {
59 59
     console.log('params: ', params)
60 60
     if (params.buildingId === '' || params.buildingId === null || params.buildingId === undefined) {
61 61
       return
@@ -85,9 +85,9 @@ class ModalAttribution extends React.Component {
85 85
     });
86 86
   };
87 87
 
88
-   // 分页
88
+  // 分页
89 89
   onChange(pageNum) {
90
-    this.getList({ pageNumber: pageNum, pageSize: 5, buildingId: this.state.visibleData.buildingName })
90
+    this.getList({ pageNumber: pageNum, pageSize: 5, customerId: this.props.visibleData.customerId, buildingId: this.props.visibleData.buildingId })
91 91
   }
92 92
 
93 93
   // 提交
@@ -95,7 +95,6 @@ class ModalAttribution extends React.Component {
95 95
     // 网路请求
96 96
     request({ ...apis.customer.consultantAssist, urlData: { id: this.state.visibleData.customerId }, data: { userId: record.userId } }).then(res => {
97 97
       // eslint-disable-next-line no-unused-expressions
98
-      debugger
99 98
       this.openNotificationWithIcon('success', '操作成功')
100 99
       this.handleCancel()
101 100
     }).catch(err => {
@@ -136,21 +135,22 @@ class ModalAttribution extends React.Component {
136 135
         dataIndex: 'personId',
137 136
         key: 'personId',
138 137
         // eslint-disable-next-line no-nested-ternary
139
-        render: (_, record) => <>{ <Button type="danger" onClick={() => this.submitGm(record)}>确定</Button>}</>, },
138
+        render: (_, record) => <>{<Button type="danger" onClick={() => this.submitGm(record)}>确定</Button>}</>,
139
+      },
140 140
     ]
141 141
     return (
142 142
       <>
143 143
         <Modal
144
-            title="分配置业顾问"
145
-            width={800}
146
-            destroyOnClose="true"
147
-            footer={null}
148
-            visible={this.state.visibleData.visible}
149
-            onCancel={(e) => this.handleCancel(e)}
150
-          >
151
-            {this.props.visibleData.buildingId == null && <BuildSelect  onChange={this.changBuilding.bind(this)} value={this.state.visibleData.buildingName} />}
152
-            <Table rowKey="assistConsultant" dataSource={this.state.dataSource.records} columns={columns} pagination={{pageSize: 5, total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
153
-          </Modal>
144
+          title="分配置业顾问"
145
+          width={800}
146
+          destroyOnClose="true"
147
+          footer={null}
148
+          visible={this.state.visibleData.visible}
149
+          onCancel={(e) => this.handleCancel(e)}
150
+        >
151
+          {this.props.visibleData.buildingId == null && <BuildSelect onChange={this.changBuilding.bind(this)} value={this.state.visibleData.buildingName} />}
152
+          <Table rowKey="assistConsultant" dataSource={this.state.dataSource.records} columns={columns} pagination={{ pageSize: 5, total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
153
+        </Modal>
154 154
       </>
155 155
     );
156 156
   }

+ 1
- 1
src/pages/customer/customerlist/index.jsx ファイルの表示

@@ -705,7 +705,7 @@ function body(props) {
705 705
           //     onClick: () => publicCustomerDetail(record),
706 706
           //   };
707 707
           // }}
708
-          dataSource={dataSource.records} columns={publicColumns} pagination={{ current: dataSource.current, total: dataSource.total, pageSize: dataSource.size, onChange }} rowKey={r => r.customerId} />
708
+          dataSource={dataPub.records} columns={publicColumns} pagination={{ current: dataPub.current, total: dataPub.total, pageSize: dataPub.size, onChange }} rowKey={r => r.customerId} ></Table>
709 709
       }
710 710
 
711 711
       {/* 调整归属 */}