瀏覽代碼

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

张延森 5 年之前
父節點
當前提交
e511dc27f6
共有 3 個文件被更改,包括 47 次插入113 次删除
  1. 3
    3
      src/pages/house/edit/components/shareRecord.jsx
  2. 39
    110
      src/pages/house/list/index.jsx
  3. 5
    0
      src/services/apis.js

+ 3
- 3
src/pages/house/edit/components/shareRecord.jsx 查看文件

@@ -18,7 +18,7 @@ const header = (props) => {
18 18
   const {salesBatchId} = props.salesBatchId
19 19
 
20 20
   useEffect(() => {
21
-    getList({ pageNum: 1, pageSize: 10, salesBatchId : props.salesBatchId});
21
+    getList({ pageNum: 1, pageSize: 10, salesBatchId : salesBatchId});
22 22
   },[])
23 23
 
24 24
   // 查询列表
@@ -84,7 +84,7 @@ const header = (props) => {
84 84
   ];
85 85
   
86 86
   const changePageNum = (pageNumber) => {
87
-      getList({ pageNum: pageNumber, pageSize: 10, salesBatchId : props.salesBatchId, ...props.form.getFieldsValue() })
87
+      getList({ pageNum: pageNumber, pageSize: 10, salesBatchId : salesBatchId, ...props.form.getFieldsValue() })
88 88
   }
89 89
 
90 90
   // 提交事件
@@ -93,7 +93,7 @@ const handleSubmit = (e, props) => {
93 93
     props.form.validateFields((err, values) => {
94 94
       if (!err) {
95 95
         console.log('提交数据: ', values)
96
-        getList({ pageNum: 1, pageSize: 10, ...values, showType: 'banner' })
96
+        getList({ pageNum: 1, pageSize: 10, salesBatchId : salesBatchId,  ...values })
97 97
       }
98 98
     });
99 99
   }

+ 39
- 110
src/pages/house/list/index.jsx 查看文件

@@ -1,5 +1,5 @@
1 1
 import React, { useState, useEffect } from 'react';
2
-import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker } from 'antd';
2
+import { Form, Input, Button, Icon, Select, message, Table, Divider, Tag, Pagination, Modal, DatePicker, notification } from 'antd';
3 3
 import { FormattedMessage } from 'umi-plugin-react/locale';
4 4
 import router from 'umi/router';
5 5
 import moment from 'moment';
@@ -17,9 +17,9 @@ const header = props => {
17 17
   // eslint-disable-next-line react-hooks/rules-of-hooks
18 18
   const [data, setData] = useState({ list: [], total: 0 })
19 19
   //   const [page, changePage] = useState({})
20
+  const [houseIdList, setHouseIdList] = useState([])
20 21
   const [time, setTime] = useState('')
21 22
 
22
-  //==========看这里-- 新功能都用house为中间单词,我已经创建好了,你只要修改list的指向链接就行,看完删除=========
23 23
   // 查询列表
24 24
   const getList = params => {
25 25
     request({ ...apis.house.taSalesBatch, params: { ...params } }).then(data => {
@@ -33,7 +33,7 @@ const header = props => {
33 33
     getList({ pageNum: 1, pageSize: 10 });
34 34
   }, [])
35 35
 
36
-  // 跳转到编辑商品
36
+  // 跳转到编辑
37 37
   const toAddHouse = rowData => () => {
38 38
     if(rowData) {
39 39
       router.push({
@@ -50,6 +50,30 @@ const header = props => {
50 50
     });
51 51
   }
52 52
 
53
+  function openNotificationWithIcon(type, message) {
54
+    notification[type]({
55
+      message,
56
+      description:
57
+        '',
58
+    });
59
+  }
60
+
61
+  
62
+  const toDelBatch = rowData => () =>{
63
+    console.log(houseIdList, 'houseIdListhouseIdList')
64
+    if(houseIdList.length < 1){
65
+      openNotificationWithIcon('error', '请先选择需要删除的批次')
66
+      return
67
+    }
68
+    console.log(houseIdList,'houseIdListhouseIdList');
69
+    request({ ...apis.house.deleteTaSalesBatch, data: houseIdList, }).then((data) => {
70
+      message.info("操作成功")
71
+      getList({ pageNum: 1, pageSize: 10 });
72
+    }).catch((err) => {
73
+      // message.info(err.msg)
74
+    })
75
+  }
76
+
53 77
   const newQrcode = row => {
54 78
     const x = new XMLHttpRequest();
55 79
     const resourceUrl = row.qrCode
@@ -66,23 +90,6 @@ const header = props => {
66 90
     x.send();
67 91
   }
68 92
 
69
-  const getActivityDetail = (dynamicId) => () => {
70
-    router.push({
71
-      pathname: '/activity/detailActivity',
72
-      query: {
73
-        dynamicId,
74
-      },
75
-    });
76
-  }
77
-
78
-  const getJoinPeople = (dynamicId) => () => {
79
-    router.push({
80
-      pathname: '/activity/SignList',
81
-      query: {
82
-        dynamicId,
83
-      },
84
-    });
85
-  }
86 93
   /**
87 94
    *
88 95
    *
@@ -140,98 +147,17 @@ const header = props => {
140 147
     });
141 148
   }
142 149
 
143
-  const finishDynamic = row => {
144
-    Modal.confirm({
145
-      title: '活动会被强制结束,小程序端无法再发起或参与此活动,如果不想让客户看到活动,请再点击取消发布按钮',
146
-      okText: '确定',
147
-      cancelText: '取消',
148
-      onOk () {
149
-        request({ ...apis.activity.finish, data: { dynamicId: row.dynamicId, top: '' } }).then(data => {
150
-          console.log(data)
151
-          message.info('操作成功!')
152
-          getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() })
153
-        }).catch(err => {
154
-          console.log(err)
155
-          message.info(err.msg || err.message)
156
-        })
157
-      },
158
-    });
159
-  }
160
-
161
-  //   置顶
162
-  const topDynamic = row => () => {
163
-    const weight = Math.abs(row.weight - 1)
164
-    request({ ...apis.activity.weight, params: { dynamicId: row.dynamicId, weight } }).then(data => {
165
-      console.log(data)
166
-      message.info('操作成功!')
167
-      getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() })
168
-    }).catch(err => {
169
-      console.log(err)
170
-      message.info(err.msg || err.message)
171
-    })
172
-  }
173
-
174
-  //   推首页
175
-  const homeDynamic = row => () => {
176
-    const home = Math.abs(row.home - 1)
177
-    request({ ...apis.activity.home, params: { dynamicId: row.dynamicId, home } }).then(data => {
178
-      console.log(data)
179
-      message.info('操作成功!')
180
-      getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() })
181
-    }).catch(err => {
182
-      console.log(err)
183
-      message.info(err.msg || err.message)
184
-    })
185
-  }
186
-
187
-  const sendOrPublicDynamic = row => {
188
-    if (row.status === 1) {
189
-      cancelDynamic(row)
190
-    } else {
191
-      sendDynamic(row)
192
-    }
193
-  }
194
-
195
-  // 取消活动
196
-  const cancelDynamic = row => {
197
-    Modal.confirm({
198
-      title: '活动会在小程序端隐藏,后台可以继续编辑重新发布',
199
-      okText: '确认',
200
-      cancelText: '取消',
201
-      onOk() {
202
-        request({ ...apis.activity.cancel, urlData: { id: row.dynamicId } }).then(data => {
203
-          message.info('操作成功!')
204
-          getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue()  })
205
-        }).catch(err => {
206
-          console.log(err)
207
-          message.info(err.msg || err.message)
208
-        })
209
-      }
210
-    });
211
-  }
212
-
213
-  // 发布活动
214
-  const sendDynamic = row => {
215
-    Modal.confirm({
216
-      title: '确定发布吗?',
217
-      okText: '确认',
218
-      cancelText: '取消',
219
-      onOk() {
220
-        request({ ...apis.activity.send, urlData: { id: row.dynamicId } }).then(data => {
221
-          message.info('操作成功!')
222
-          getList({ pageNum: 1, pageSize: 10, ...props.form.getFieldsValue() });
223
-        }).catch(err => {
224
-          console.log(err)
225
-          message.info(err.msg || err.message)
226
-        })
227
-      }
228
-    });
229
-  }
230
-
231 150
   const changePageNum = pageNumber => {
232 151
     getList({ pageNum: pageNumber, pageSize: 10, ...props.form.getFieldsValue() })
233 152
   }
234 153
 
154
+  const rowSelection = {
155
+    onChange: (selectedRowKeys, selectedRows) => {
156
+      console.log('selectedRowKeys:', selectedRowKeys, 'selectedRows: ', selectedRows);
157
+      setHouseIdList(selectedRows)
158
+    },
159
+  };
160
+
235 161
   // 提交事件
236 162
   const handleSubmit = e => {
237 163
     e.preventDefault();
@@ -302,10 +228,13 @@ const header = props => {
302 228
             </Button>
303 229
         </Form.Item>
304 230
       </Form>
305
-      <AuthButton name="admin.buildingDynamic.add.post" noRight={null}>
231
+      <AuthButton name="admin.salesBatch.add.post" noRight={null}>
306 232
         <Button type="danger" className={styles.addBtn} onClick={toAddHouse()}>新增</Button>
307 233
       </AuthButton>
308
-      <Table
234
+      <AuthButton name="admin.salesBatch.del" noRight={null}>
235
+        <Button type="primary" className={styles.addBtn} onClick={toDelBatch()} style={{marginLeft:'30px'}}>删除</Button>
236
+      </AuthButton>
237
+      <Table rowSelection={rowSelection}
309 238
        dataSource={data.records} columns={columns} pagination={false} rowKey="activityList" />
310 239
       <div style={{ display: 'flex', justifyContent: 'flex-end', marginTop: '30px' }}>
311 240
         <Pagination showQuickJumper defaultCurrent={1} total={data.total} onChange={e => changePageNum(e)} current={data.current}/>

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

@@ -1114,6 +1114,11 @@ export default {
1114 1114
     method: 'put',
1115 1115
     action: 'admin.taHouseShare.put',
1116 1116
   },
1117
+  deleteTaSalesBatch:{
1118
+    url: `${prefix}/taSalesBatch`,
1119
+    method: 'put',
1120
+    action: 'admin.taHouseShare.put',
1121
+  },
1117 1122
   taHousingResources: {
1118 1123
     method: 'GET',
1119 1124
     url: `${prefix}/taHousingResources`,