|
@@ -1,9 +1,9 @@
|
1
|
|
-import React, { PureComponent, useMemo, useState } from 'react';
|
|
1
|
+import React, { PureComponent, useMemo, useRef, useState } from 'react';
|
2
|
2
|
import { Avatar, Button } from 'antd';
|
3
|
3
|
import moment from 'moment';
|
4
|
4
|
import request from '../../../utils/request';
|
5
|
5
|
import apis from '../../../services/apis';
|
6
|
|
-import QueryTable from '@/components/QueryTable'
|
|
6
|
+import QueryTable from '@/components/QueryTable';
|
7
|
7
|
import { router } from 'umi';
|
8
|
8
|
import AuthButton from '@/components/AuthButton';
|
9
|
9
|
|
|
@@ -14,62 +14,60 @@ import AuthButton from '@/components/AuthButton';
|
14
|
14
|
* @returns
|
15
|
15
|
*/
|
16
|
16
|
|
17
|
|
-
|
18
|
|
-
|
19
|
|
-
|
20
|
17
|
function Recommend() {
|
21
|
|
- const [exportLoding, setExportLoding] = useState(false)
|
|
18
|
+ const ref = useRef();
|
|
19
|
+ const [exportLoding, setExportLoding] = useState(false);
|
22
|
20
|
//详情页面弹窗配置
|
23
|
|
- function toAudit(row,type) {
|
|
21
|
+ function toAudit(row, type) {
|
24
|
22
|
router.push({
|
25
|
23
|
pathname: '/findRoom/rent/audit',
|
26
|
24
|
query: {
|
27
|
25
|
id: row.id,
|
28
|
|
- type:type
|
|
26
|
+ type: type,
|
29
|
27
|
},
|
30
|
|
- })
|
31
|
|
-
|
|
28
|
+ });
|
32
|
29
|
}
|
33
|
|
-// function toSee(cuurentId) {
|
34
|
|
-// router.push({
|
35
|
|
-// pathname: '/home/recommend/auditCopy',
|
36
|
|
-// query: {
|
37
|
|
-// id: cuurentId,
|
38
|
|
-// },
|
39
|
|
-// })
|
40
|
|
-
|
41
|
|
-// }
|
|
30
|
+ // function toSee(cuurentId) {
|
|
31
|
+ // router.push({
|
|
32
|
+ // pathname: '/home/recommend/auditCopy',
|
|
33
|
+ // query: {
|
|
34
|
+ // id: cuurentId,
|
|
35
|
+ // },
|
|
36
|
+ // })
|
42
|
37
|
|
|
38
|
+ // }
|
43
|
39
|
|
44
|
40
|
/**
|
45
|
41
|
*导出数据(推荐用户)
|
46
|
42
|
*
|
47
|
43
|
*/
|
48
|
44
|
function exportRecommendCustomer() {
|
49
|
|
- setExportLoding(true)
|
|
45
|
+ setExportLoding(true);
|
50
|
46
|
request({
|
51
|
|
- ...apis.customer.customerRecommendRecommenderExport,
|
|
47
|
+ ...apis.searchHouse.exportHouse,
|
52
|
48
|
responseType: 'blob',
|
53
|
|
- }).then(response => {
|
54
|
|
- console.log('exportRecommendCustomer: ', response)
|
55
|
|
- download(response)
|
56
|
|
- }).catch(error => {
|
57
|
|
-
|
|
49
|
+ params: {
|
|
50
|
+ ...ref.current.getSearchData,
|
|
51
|
+ },
|
58
|
52
|
})
|
|
53
|
+ .then(response => {
|
|
54
|
+ download(response);
|
|
55
|
+ })
|
|
56
|
+ .catch(error => {});
|
59
|
57
|
}
|
60
|
58
|
|
61
|
59
|
function download(data) {
|
62
|
60
|
if (!data) {
|
63
|
|
- return
|
|
61
|
+ return;
|
64
|
62
|
}
|
65
|
|
- const url = window.URL.createObjectURL(new Blob([data]))
|
66
|
|
- const link = document.createElement('a')
|
67
|
|
- link.style.display = 'none'
|
68
|
|
- link.href = url
|
69
|
|
- link.setAttribute('download', '找房需求.xlsx')
|
70
|
|
- document.body.append(link)
|
71
|
|
- link.click()
|
72
|
|
- setExportLoding(false)
|
|
63
|
+ const url = window.URL.createObjectURL(new Blob([data]));
|
|
64
|
+ const link = document.createElement('a');
|
|
65
|
+ link.style.display = 'none';
|
|
66
|
+ link.href = url;
|
|
67
|
+ link.setAttribute('download', '租房需求.xlsx');
|
|
68
|
+ document.body.append(link);
|
|
69
|
+ link.click();
|
|
70
|
+ setExportLoding(false);
|
73
|
71
|
}
|
74
|
72
|
const columns = [
|
75
|
73
|
{
|
|
@@ -98,15 +96,18 @@ function Recommend() {
|
98
|
96
|
key: 'gender',
|
99
|
97
|
align: 'center',
|
100
|
98
|
// eslint-disable-next-line no-nested-ternary
|
101
|
|
- render: (_, record) => <><span>{record.gender === '1' ? '男' : record.gender === '2' ? '女' : '未知'}</span></>,
|
|
99
|
+ render: (_, record) => (
|
|
100
|
+ <>
|
|
101
|
+ <span>{record.gender === '1' ? '男' : record.gender === '2' ? '女' : '未知'}</span>
|
|
102
|
+ </>
|
|
103
|
+ ),
|
102
|
104
|
},
|
103
|
105
|
{
|
104
|
106
|
title: '意向区域',
|
105
|
|
- dataIndex: 'name',//意向区域
|
|
107
|
+ dataIndex: 'name', //意向区域
|
106
|
108
|
key: 'name',
|
107
|
109
|
align: 'center',
|
108
|
110
|
// render: (_, record) => <><span>{record.area = '江苏省南京市秦淮区'}</span></>,
|
109
|
|
-
|
110
|
111
|
},
|
111
|
112
|
{
|
112
|
113
|
title: '租房预算(元/月)',
|
|
@@ -114,21 +115,38 @@ function Recommend() {
|
114
|
115
|
key: 'maxPrice',
|
115
|
116
|
align: 'center',
|
116
|
117
|
// render:(_,record)=><span>{record='香颂.蔚澜半岛'}</span>
|
117
|
|
-
|
118
|
118
|
},
|
119
|
119
|
{
|
120
|
120
|
title: '提交时间',
|
121
|
121
|
dataIndex: 'createdTime',
|
122
|
122
|
key: 'createdTime',
|
123
|
123
|
align: 'center',
|
124
|
|
- render: (_, record) => <><span>{record.createdTime && moment(record.createdTime).format('YYYY-MM-DD HH:mm:ss')}</span></>,
|
|
124
|
+ render: (_, record) => (
|
|
125
|
+ <>
|
|
126
|
+ <span>
|
|
127
|
+ {record.createdTime && moment(record.createdTime).format('YYYY-MM-DD HH:mm:ss')}
|
|
128
|
+ </span>
|
|
129
|
+ </>
|
|
130
|
+ ),
|
125
|
131
|
},
|
126
|
132
|
{
|
127
|
133
|
title: '状态',
|
128
|
134
|
dataIndex: 'status',
|
129
|
135
|
key: 'status',
|
130
|
136
|
align: 'center',
|
131
|
|
- render: (_, record) => <><span>{record.status == 0 ? '待回访' : record.status == 1 ? '已回访' : record.status == 2 ? '无效' : ''}</span></>,
|
|
137
|
+ render: (_, record) => (
|
|
138
|
+ <>
|
|
139
|
+ <span>
|
|
140
|
+ {record.status == 0
|
|
141
|
+ ? '待回访'
|
|
142
|
+ : record.status == 1
|
|
143
|
+ ? '已回访'
|
|
144
|
+ : record.status == 2
|
|
145
|
+ ? '无效'
|
|
146
|
+ : ''}
|
|
147
|
+ </span>
|
|
148
|
+ </>
|
|
149
|
+ ),
|
132
|
150
|
},
|
133
|
151
|
{
|
134
|
152
|
title: '操作',
|
|
@@ -138,24 +156,23 @@ function Recommend() {
|
138
|
156
|
|
139
|
157
|
render: (_, record) => (
|
140
|
158
|
<>
|
141
|
|
- {record.status == '0' ? (
|
142
|
|
- <AuthButton name="house.rent.reply" noRight={null}>
|
143
|
|
- <Button type="link" onClick={() => toAudit(record, 'edit')}>
|
144
|
|
- 审核
|
145
|
|
- </Button>
|
146
|
|
- </AuthButton>
|
147
|
|
- ) : (
|
148
|
|
- <AuthButton name="house.rent.detail" noRight={null}>
|
149
|
|
- <Button type="link" onClick={() => toAudit(record, 'detail')}>
|
150
|
|
- 查看详情
|
151
|
|
- </Button>
|
152
|
|
- </AuthButton>
|
153
|
|
- )}
|
154
|
|
- </>
|
|
159
|
+ {record.status == '0' ? (
|
|
160
|
+ <AuthButton name="house.rent.reply" noRight={null}>
|
|
161
|
+ <Button type="link" onClick={() => toAudit(record, 'edit')}>
|
|
162
|
+ 审核
|
|
163
|
+ </Button>
|
|
164
|
+ </AuthButton>
|
|
165
|
+ ) : (
|
|
166
|
+ <AuthButton name="house.rent.detail" noRight={null}>
|
|
167
|
+ <Button type="link" onClick={() => toAudit(record, 'detail')}>
|
|
168
|
+ 查看详情
|
|
169
|
+ </Button>
|
|
170
|
+ </AuthButton>
|
|
171
|
+ )}
|
|
172
|
+ </>
|
155
|
173
|
),
|
156
|
174
|
},
|
157
|
|
- ]
|
158
|
|
-
|
|
175
|
+ ];
|
159
|
176
|
|
160
|
177
|
const searchFields = [
|
161
|
178
|
{
|
|
@@ -185,18 +202,18 @@ function Recommend() {
|
185
|
202
|
label: '状态',
|
186
|
203
|
placeholder: '请选择状态',
|
187
|
204
|
type: 'select',
|
188
|
|
- placeholder: '全部',//错误
|
|
205
|
+ placeholder: '全部', //错误
|
189
|
206
|
options: [
|
190
|
207
|
{ label: '全部', value: '' },
|
191
|
208
|
{ label: '待回访', value: '0' },
|
192
|
209
|
{ label: '已回访', value: '1' },
|
193
|
|
- { label: '无效', value: '2' }
|
194
|
|
- ]
|
|
210
|
+ { label: '无效', value: '2' },
|
|
211
|
+ ],
|
195
|
212
|
},
|
196
|
|
- ]
|
|
213
|
+ ];
|
197
|
214
|
const actionRender = () => {
|
198
|
215
|
return (
|
199
|
|
- <Button type="danger" loading={exportLoding} onClick={() => exportRecommendCustomer()}>
|
|
216
|
+ <Button type="primary" loading={exportLoding} onClick={() => exportRecommendCustomer()}>
|
200
|
217
|
导出
|
201
|
218
|
</Button>
|
202
|
219
|
);
|
|
@@ -205,21 +222,19 @@ function Recommend() {
|
205
|
222
|
return (
|
206
|
223
|
<>
|
207
|
224
|
<QueryTable
|
208
|
|
- rowKey="recommendCustomer"
|
209
|
|
- // recommendCustomer
|
|
225
|
+ rowKey="id"
|
|
226
|
+ ref={ref}
|
210
|
227
|
api={apis.searchHouse.list}
|
211
|
228
|
searchFields={searchFields}
|
212
|
229
|
postData={data => {
|
213
|
|
-
|
214
|
|
- data.type='2'
|
|
230
|
+ data.type = '2';
|
215
|
231
|
return data;
|
216
|
232
|
}}
|
217
|
233
|
columns={columns}
|
218
|
234
|
// actionRender={actionRender}
|
219
|
235
|
/>
|
220
|
|
-
|
221
|
236
|
</>
|
222
|
237
|
);
|
223
|
238
|
}
|
224
|
239
|
|
225
|
|
-export default Recommend
|
|
240
|
+export default Recommend;
|