zlisen hace 3 años
padre
commit
c232b22098

+ 2
- 1
src/components/TableList/index.jsx Ver fichero

@@ -39,12 +39,13 @@ export default React.forwardRef((props, ref) => {
39 39
     const queryParams = {
40 40
       pageNum: pageConfig.current,
41 41
       pageSize: pageConfig.pageSize,
42
+      pageNumber: pageConfig.current,
42 43
       ...(postData(params) || params || {}),
43 44
     };
44 45
 
45 46
     request({ ...api, urlData: urlData || undefined, params: queryParams })
46 47
       .then(res => {
47
-        console.log(res, 'fetchData');
48
+ 
48 49
         if (res.records) {
49 50
           const { total, records = [] } = res;
50 51
           setLoading(false);

+ 47
- 20
src/pages/customer/Customer/PublicCustomer/index.jsx Ver fichero

@@ -1,5 +1,5 @@
1 1
 import React, { useState, useMemo, useRef } from 'react';
2
-import { Avatar, Button,message } from 'antd';
2
+import { Avatar, Button, message } from 'antd';
3 3
 import router from 'umi/router';
4 4
 import QueryTable from '@/components/QueryTable';
5 5
 import apis from '@/services/apis';
@@ -25,10 +25,10 @@ const PublicCustomer = () => {
25 25
     // changeStatus: { visible: true, data: {} },
26 26
   });
27 27
   const [exportLoding, setExportLoding] = useState(false);
28
-   // 选中的公客信息
29
-   const [personInfo, setPersonInfo] = useState([])
28
+  // 选中的公客信息
29
+  const [personInfo, setPersonInfo] = useState([]);
30 30
 
31
-   const [selectedRowKeys, setSelectedRowKeys] = useState([])
31
+  const [selectedRowKeys, setSelectedRowKeys] = useState([]);
32 32
 
33 33
   const handShowModel = (record, actionType) => {
34 34
     SetShowModel({
@@ -40,23 +40,27 @@ const PublicCustomer = () => {
40 40
   };
41 41
 
42 42
   function batchAssistConsultant() {
43
-    console.log(personInfo, 'personInfo')
44
-    console.log(personInfo.length)
43
+    console.log(personInfo, 'personInfo');
44
+    console.log(personInfo.length);
45 45
     if (personInfo.length <= 0) {
46 46
       return message.info('请至少选择一条数据');
47 47
     }
48 48
 
49 49
     const compareSet = new Set();
50 50
     personInfo.filter(record => {
51
-      compareSet.add(record.buildingName)
52
-    })
51
+      compareSet.add(record.buildingName);
52
+    });
53 53
 
54 54
     if (compareSet.size != 1) {
55 55
       return message.info('选中的公客存在于不同项目中,请分开进行分配置业顾问操作');
56 56
     }
57
-    handShowModel({
58
-      customerId: personInfo, buildingId: personInfo[0].buildingId
59
-    }, actionList.assistConsultant)
57
+    handShowModel(
58
+      {
59
+        customerId: personInfo,
60
+        buildingId: personInfo[0].buildingId,
61
+      },
62
+      actionList.assistConsultant,
63
+    );
60 64
     //   SetShowModel({
61 65
     //     [actionList[actionType]]: {
62 66
     //       visible: true,
@@ -141,6 +145,21 @@ const PublicCustomer = () => {
141 145
         align: 'center',
142 146
         width: '20%',
143 147
       },
148
+      {
149
+        title: '是否归属项目',
150
+        dataIndex: '',
151
+        key: '',
152
+        align: 'center',
153
+        width: '10%',
154
+        render: (_, record) => <><span>{record.buildingId != null ? '是' : '否'}</span></>,
155
+      },
156
+      {
157
+        title: '归属项目',
158
+        dataIndex: 'buildingName',
159
+        key: 'buildingName',
160
+        align: 'center',
161
+        width: '15%',
162
+      },
144 163
       {
145 164
         title: '性别',
146 165
         dataIndex: 'sex',
@@ -154,6 +173,7 @@ const PublicCustomer = () => {
154 173
           </>
155 174
         ),
156 175
       },
176
+
157 177
       {
158 178
         title: '推广人员',
159 179
         dataIndex: 'sharePersonName',
@@ -169,9 +189,9 @@ const PublicCustomer = () => {
169 189
 
170 190
         render: withActions((_, record) => [
171 191
           <AuthButton name="customer.detail">
172
-            <Button  type="link" onClick={() => publicCustomerDetail(record)}>
192
+            <Button type="link" onClick={() => publicCustomerDetail(record)}>
173 193
               查看详情
174
-          </Button>
194
+            </Button>
175 195
           </AuthButton>,
176 196
 
177 197
           <AuthButton name="customer.consultant.dispatch" noRight={null}>
@@ -195,7 +215,7 @@ const PublicCustomer = () => {
195 215
   const actionRender = () => {
196 216
     return (
197 217
       <>
198
-      <Button type="primary" loading={exportLoding} onClick={() => exportCustomer()}>
218
+        <Button type="primary" loading={exportLoding} onClick={() => exportCustomer()}>
199 219
           导出
200 220
         </Button>
201 221
         {/* <AuthButton name="admin.customer.import" noRight={null}>
@@ -207,7 +227,6 @@ const PublicCustomer = () => {
207 227
             批量分配置业顾问
208 228
           </Button>
209 229
         </AuthButton> */}
210
-        
211 230
       </>
212 231
     );
213 232
   };
@@ -216,11 +235,12 @@ const PublicCustomer = () => {
216 235
     selectedRowKeys,
217 236
     onChange: (selectedRowKeys, selectedRows) => {
218 237
       console.log('selectedRowKeys:', selectedRowKeys, 'selectedRows: ', selectedRows);
219
-      setSelectedRowKeys(selectedRowKeys)
220
-      const newSelectedRows = personInfo.filter(x => !selectedRows.some(y => x.customerId === y.customerId))     // 去重
221
-        .concat(selectedRows)                                                                 // 新增选择
222
-        .filter(x => selectedRowKeys.some(y => y === x.customerId))                             // 去掉未选的数据
223
-      setPersonInfo(newSelectedRows)
238
+      setSelectedRowKeys(selectedRowKeys);
239
+      const newSelectedRows = personInfo
240
+        .filter(x => !selectedRows.some(y => x.customerId === y.customerId)) // 去重
241
+        .concat(selectedRows) // 新增选择
242
+        .filter(x => selectedRowKeys.some(y => y === x.customerId)); // 去掉未选的数据
243
+      setPersonInfo(newSelectedRows);
224 244
     },
225 245
   };
226 246
 
@@ -235,6 +255,13 @@ const PublicCustomer = () => {
235 255
         params={{
236 256
           customerType: 'public',
237 257
         }}
258
+        leftProps={{
259
+          postData: params => {
260
+            console.log('23')
261
+            params.pageNumber = params.pageNum;
262
+            return params;
263
+          },
264
+        }}
238 265
         columns={columns}
239 266
         actionRender={actionRender}
240 267
       />