魏熙美 5 年前
父节点
当前提交
c64d771c67

+ 18
- 13
src/pages/customer/customerlist/components/attribution.jsx 查看文件

@@ -21,18 +21,19 @@ class ModalAttribution extends React.Component {
21 21
     super(props);
22 22
     this.state = {
23 23
        dataSource: { records: [] },
24
-       visibleData: { visible: false, customerId: '', realtyConsultant: '' },
24
+       visibleData: { visible: false, customerId: '', realtyConsultant: '', buildingId: '' },
25 25
     }
26 26
   }
27 27
 
28 28
   // 挂载之后
29 29
   componentDidMount() {
30
-    this.getList({ pageNumber: 1, pageSize: 5 })
30
+    // this.getList({ pageNumber: 1, pageSize: 5 })
31 31
   }
32 32
 
33 33
   componentDidUpdate(preProps, preState) {
34
+    console.log(this.props.visibleData)
34 35
     if (this.props.visibleData.visible !== preState.visibleData.visible) {
35
-      this.getList({ pageNumber: 1, pageSize: 5 })
36
+      this.getList({ pageNumber: 1, pageSize: 5, buildingId: this.props.visibleData.buildingId })
36 37
       this.setState({ visibleData: this.props.visibleData });
37 38
     }
38 39
   }
@@ -49,8 +50,12 @@ class ModalAttribution extends React.Component {
49 50
   }
50 51
 
51 52
   getList(params) {
53
+    console.log('params: ', params)
54
+    if (params.buildingId === '') {
55
+      return
56
+    }
52 57
     // 网路请求
53
-    request({ ...apis.customer.consultant, params: { ...params } }).then(res => {
58
+    request({ ...apis.customer.buildingConsultant, params: { ...params } }).then(res => {
54 59
       this.setState({ dataSource: res })
55 60
     }).catch(err => {
56 61
       // eslint-disable-next-line no-unused-expressions
@@ -68,13 +73,13 @@ class ModalAttribution extends React.Component {
68 73
 
69 74
    // 分页
70 75
   onChange(pageNum) {
71
-    this.getList({ pageNumber: pageNum, pageSize: 5 })
76
+    this.getList({ pageNumber: pageNum, pageSize: 5, buildingId: this.props.visibleData.buildingId })
72 77
   }
73 78
 
74 79
   // 提交
75 80
   submitGm(record) {
76 81
     // 网路请求
77
-    request({ ...apis.customer.recommendEdit, urlData: { id: this.state.visibleData.customerId }, data: { customerId: this.state.visibleData.customerId, realtyConsultant: record.personId } }).then(res => {
82
+    request({ ...apis.customer.recommendEdit, urlData: { id: this.state.visibleData.customerId }, data: { customerId: this.state.visibleData.customerId, realtyConsultant: record.userId } }).then(res => {
78 83
       // eslint-disable-next-line no-unused-expressions
79 84
       this.openNotificationWithIcon('success', '操作成功')
80 85
       this.handleCancel()
@@ -88,13 +93,13 @@ class ModalAttribution extends React.Component {
88 93
     const columns = [
89 94
       // {
90 95
       //   title: '编号',
91
-      //   dataIndex: 'personId',
92
-      //   key: 'personId',
96
+      //   dataIndex: 'userId',
97
+      //   key: 'userId',
93 98
       // },
94 99
       {
95 100
         title: '姓名',
96
-        dataIndex: 'name',
97
-        key: 'name',
101
+        dataIndex: 'userName',
102
+        key: 'userName',
98 103
       },
99 104
       {
100 105
         title: '电话',
@@ -108,15 +113,15 @@ class ModalAttribution extends React.Component {
108 113
       },
109 114
       {
110 115
         title: '岗位',
111
-        dataIndex: 'post',
112
-        key: 'post',
116
+        dataIndex: 'position',
117
+        key: 'position',
113 118
       },
114 119
       {
115 120
         title: '操作',
116 121
         dataIndex: 'personId',
117 122
         key: 'personId',
118 123
         // eslint-disable-next-line no-nested-ternary
119
-        render: (_, record) => <>{ this.props.visibleData.realtyConsultant !== record.personId && <Button type="danger" onClick={() => this.submitGm(record)}>确定</Button>}</>,
124
+        render: (_, record) => <>{ this.props.visibleData.realtyConsultant != record.userId && <Button type="danger" onClick={() => this.submitGm(record)}>确定</Button>}</>,
120 125
       },
121 126
     ]
122 127
     return (

+ 5
- 5
src/pages/customer/customerlist/index.jsx 查看文件

@@ -37,7 +37,7 @@ function body(props) {
37 37
 
38 38
   // 调整归属 ============  start
39 39
   // eslint-disable-next-line react-hooks/rules-of-hooks
40
-  const [gVisibleData, setGVisibleData] = useState({ visible: false, customerId: '', realtyConsultant: '' })
40
+  const [gVisibleData, setGVisibleData] = useState({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
41 41
   // 调整归属 ============= end
42 42
 
43 43
   // 积分记录 ============  start
@@ -123,20 +123,20 @@ function body(props) {
123 123
   // 所有这里临时解决方法是,弹出一个Modal对话框的时候,把其他的对话框给隐藏
124 124
 
125 125
   function showGM(record) {
126
-    setGVisibleData({ visible: true, customerId: record.customerId, realtyConsultant: record.realtyConsultant })
126
+    setGVisibleData({ visible: true, customerId: record.customerId, realtyConsultant: record.realtyConsultant, buildingId: record.buildingId })
127 127
     setRecordVisibleData({ visible: false, customerId: '' })
128 128
     setStatusVisibleData({ visible: false, customerId: '' })
129 129
   }
130 130
 
131 131
   function showRecord(record) {
132 132
     setRecordVisibleData({ visible: true, customerId: record.customerId })
133
-    setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
133
+    setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
134 134
     setStatusVisibleData({ visible: false, customerId: '' })
135 135
   }
136 136
 
137 137
   function showStatus(record) {
138 138
     setRecordVisibleData({ visible: false, customerId: '' })
139
-    setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
139
+    setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
140 140
     setStatusVisibleData({ visible: true, customerId: record.customerId, status: record.status })
141 141
   }
142 142
   function toCustomerDateil(record) {
@@ -173,7 +173,7 @@ function body(props) {
173 173
 
174 174
   // 关闭调整归属的窗口
175 175
   function closeAttribution() {
176
-    setGVisibleData({ visible: false, customerId: '', realtyConsultant: '' })
176
+    setGVisibleData({ visible: false, customerId: '', realtyConsultant: '', buildingId: '' })
177 177
     getList({ pageNum: 1, pageSize: 10, customerType, ...props.form.getFieldsValue() })
178 178
   }
179 179
 

+ 5
- 0
src/services/apis.js 查看文件

@@ -236,6 +236,11 @@ export default {
236 236
       url: `${prefix}/consultant`,
237 237
       action: 'admin.consultant.get',
238 238
     },
239
+    buildingConsultant: {
240
+      method: 'GET',
241
+      url: `${prefix}/building/consultant`,
242
+      action: 'admin.building.consultant.get',
243
+    },
239 244
     recommendEdit: {
240 245
       method: 'PUT',
241 246
       url: `${prefix}/customer/recommend/edit/:id`,