weichaochao 5 年 前
コミット
00e7c67c96
共有3 個のファイルを変更した183 個の追加0 個の削除を含む
  1. 158
    0
      src/pages/customer/customerlist/components/assistConsultant.jsx
  2. 20
    0
      src/pages/customer/customerlist/index.jsx
  3. 5
    0
      src/services/apis.js

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

@@ -0,0 +1,158 @@
1
+import React, { useState, useEffect } from 'react';
2
+import { Form, Icon, Input, Button, DatePicker, Select, Card, Row, Col, Pagination, Alert, Table, Avatar, Radio, Modal, Descriptions, notification } from 'antd';
3
+import moment from 'moment';
4
+import request from '../../../../utils/request';
5
+import apis from '../../../../services/apis';
6
+import Styles from '../style.less';
7
+import BuildSelect from '../../../../components/SelectButton/BuildSelect'
8
+
9
+
10
+const { Option } = Select;
11
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
12
+const { Meta } = Card;
13
+
14
+/**
15
+ * 分配置业顾问
16
+ *
17
+ * @param {*} props
18
+ * @returns
19
+ */
20
+class ModalAttribution extends React.Component {
21
+  constructor(props) {
22
+    super(props);
23
+    this.state = {
24
+       dataSource: { records: [] },
25
+       visibleData: { visible: false, customerId: '', buildingName: '' },
26
+    }
27
+  }
28
+
29
+  // 挂载之后
30
+  componentDidMount() {
31
+    // this.getList({ pageNumber: 1, pageSize: 5 })
32
+  }
33
+
34
+  componentDidUpdate(preProps, preState) {
35
+    console.log(this.props.visibleData)
36
+    if (this.props.visibleData.visible !== preState.visibleData.visible) {
37
+      this.getList({ pageNumber: 1, pageSize: 5, customerId: this.props.visibleData.customerId })
38
+      this.setState({ visibleData: this.props.visibleData });
39
+    }
40
+  }
41
+
42
+  // 弹框确定按钮
43
+  // eslint-disable-next-line react/sort-comp
44
+  handleOk() {
45
+    this.props.onCancel()
46
+  }
47
+
48
+  // 弹框取消按钮
49
+  handleCancel() {
50
+    this.props.onCancel()
51
+  }
52
+
53
+  changBuilding(buildingId){
54
+    this.getUserList({ pageNumber: 1, pageSize: 5, buildingId: buildingId })
55
+    this.setState({ visibleData: { visible: this.props.visibleData.visible, customerId: this.props.visibleData.customerId, buildingName: buildingId } });
56
+  }
57
+
58
+  getUserList(params){
59
+    console.log('params: ', params)
60
+    if (params.buildingId === '' || params.buildingId === null || params.buildingId === undefined) {
61
+      return
62
+    }
63
+    // 网路请求
64
+    request({ ...apis.customer.buildingConsultant, params: { ...params } }).then(res => {
65
+      this.setState({ dataSource: res })
66
+    }).catch(err => {
67
+      
68
+    })
69
+  }
70
+
71
+  getList(params) {
72
+    // 网路请求
73
+    request({ ...apis.customer.buildingConsultant, params: { ...params } }).then(res => {
74
+      this.setState({ dataSource: res })
75
+    }).catch(err => {
76
+      
77
+    })
78
+  }
79
+
80
+  openNotificationWithIcon = (type, message) => {
81
+    notification[type]({
82
+      message,
83
+      description:
84
+        '',
85
+    });
86
+  };
87
+
88
+   // 分页
89
+  onChange(pageNum) {
90
+    this.getList({ pageNumber: pageNum, pageSize: 5, buildingId: this.props.visibleData.buildingId })
91
+  }
92
+
93
+  // 提交
94
+  submitGm(record) {
95
+    // 网路请求
96
+    request({ ...apis.customer.consultantAssist, urlData: { id: this.state.visibleData.customerId }, data: { userId: record.userId } }).then(res => {
97
+      // eslint-disable-next-line no-unused-expressions
98
+      this.openNotificationWithIcon('success', '操作成功')
99
+      this.handleCancel()
100
+    }).catch(err => {
101
+      // eslint-disable-next-line no-unused-expressions
102
+      this.openNotificationWithIcon('error', err)
103
+    })
104
+  }
105
+
106
+  render() {
107
+    const columns = [
108
+      // {
109
+      //   title: '编号',
110
+      //   dataIndex: 'userId',
111
+      //   key: 'userId',
112
+      // },
113
+      {
114
+        title: '姓名',
115
+        dataIndex: 'userName',
116
+        key: 'userName',
117
+      },
118
+      {
119
+        title: '电话',
120
+        dataIndex: 'phone',
121
+        key: 'phone',
122
+      },
123
+      {
124
+        title: '部门',
125
+        dataIndex: 'department',
126
+        key: 'department',
127
+      },
128
+      {
129
+        title: '岗位',
130
+        dataIndex: 'position',
131
+        key: 'position',
132
+      },
133
+      {
134
+        title: '操作',
135
+        dataIndex: 'personId',
136
+        key: 'personId',
137
+        // eslint-disable-next-line no-nested-ternary
138
+        render: (_, record) => <>{ <Button type="danger" onClick={() => this.submitGm(record)}>确定</Button>}</>, },
139
+    ]
140
+    return (
141
+      <>
142
+        <Modal
143
+            title="分配置业顾问"
144
+            width={800}
145
+            destroyOnClose="true"
146
+            footer={null}
147
+            visible={this.state.visibleData.visible}
148
+            onCancel={(e) => this.handleCancel(e)}
149
+          >
150
+            <BuildSelect onChange={this.changBuilding.bind(this)} value={this.state.visibleData.buildingName} />
151
+            <Table rowKey="assistConsultant" dataSource={this.state.dataSource.records} columns={columns} pagination={{ total: this.state.dataSource.total, onChange: e => this.onChange(e) }} />
152
+          </Modal>
153
+      </>
154
+    );
155
+  }
156
+}
157
+
158
+export default ModalAttribution

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

@@ -7,6 +7,7 @@ import Styles from './style.less';
7 7
 import router from 'umi/router';
8 8
 
9 9
 import Attribution from './components/attribution'
10
+import AssistConsultant from './components/assistConsultant'
10 11
 import IntegralRecord from './components/integralRecord'
11 12
 import ModalRecommendRecord from './components/recommend'
12 13
 import ChangeStatus from './components/changeStatus'
@@ -55,6 +56,8 @@ function body(props) {
55 56
   // 推荐客户
56 57
   const [recommendVisibleData, setRecommendVisibleData] = useState({ visible: false, customerId: '' })
57 58
 
59
+  const [assistVisibleData, setAssistVisibleData] = useState({visible: false, customerId: ''})
60
+
58 61
   // eslint-disable-next-line react-hooks/rules-of-hooks
59 62
   useEffect(() => {
60 63
     getList({ pageNumber: 1, pageSize: 10, customerType })
@@ -160,6 +163,16 @@ function body(props) {
160 163
     setStatusVisibleData({ visible: false, customerId: '', status: '' })
161 164
     setRecommendVisibleData({ visible: true, customerId: personId })
162 165
   }
166
+
167
+  //分配置业顾问
168
+  function assistConsultant(personId) {
169
+    setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
170
+    setRecordVisibleData({ visible: false, customerId: '' })
171
+    setStatusVisibleData({ visible: false, customerId: '' })
172
+    setRecommendVisibleData({ visible: false, customerId: '' })
173
+    setAssistVisibleData({ visible: true, customerId: personId })
174
+  }
175
+
163 176
   function toCustomerDateil(record) {
164 177
     router.push({
165 178
       pathname: '/customer/customerlist/customerDetail',
@@ -212,6 +225,7 @@ function body(props) {
212 225
     setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
213 226
     setStatusVisibleData({ visible: false, customerId: '', status: '' })
214 227
     setRecommendVisibleData({ visible: false, customerId: '' })
228
+    setAssistVisibleData({ visible: false, customerId: ''})
215 229
     getList({ pageNum: 1, pageSize: 10, customerType, ...props.form.getFieldsValue() })
216 230
   }
217 231
 
@@ -272,6 +286,9 @@ function body(props) {
272 286
           <AuthButton name="admin.customer.recommend" noRight={null}>
273 287
             <Button className={customerType === 'private' ? Styles.displayS : Styles.text } type="link" onClick={() => showRecommend(record.personId)}>推荐客户</Button>
274 288
           </AuthButton>
289
+          <AuthButton name="admin.customer.assign" noRight={null}>
290
+            <Button className={customerType === 'private' ? Styles.displayS : Styles.text } type="link" onClick={() => assistConsultant(record.personId)}>分配置业顾问</Button>
291
+          </AuthButton>
275 292
         </>
276 293
       ),
277 294
     },
@@ -482,6 +499,9 @@ function body(props) {
482 499
 
483 500
       {/* 推荐客户 */}
484 501
       <ModalRecommendRecord visibleData={recommendVisibleData} onCancel={() => closeAll()}/>
502
+
503
+      {/* 分配置业顾问 */}
504
+      <AssistConsultant visibleData={assistVisibleData} onCancel={() => closeAll()}/>
485 505
     </>
486 506
   );
487 507
 }

+ 5
- 0
src/services/apis.js ファイルの表示

@@ -253,6 +253,11 @@ export default {
253 253
       url: `${prefix}/customer/recommend/edit/:id`,
254 254
       action: 'admin.customer.recommend.edit.id.put',
255 255
     },
256
+    consultantAssist: {
257
+      method: 'POST',
258
+      url: `${prefix}/customer/consultant/assist/:id`,
259
+      action: 'admin.customer.consultant.assist.id.put',
260
+    },
256 261
     taPointsRecords: {
257 262
       method: 'GET',
258 263
       url: `${prefix}/mine/taPointsRecords/:id`,