|
@@ -24,7 +24,7 @@ const { Meta } = Card;
|
24
|
24
|
* @returns
|
25
|
25
|
*/
|
26
|
26
|
function body(props) {
|
27
|
|
- const { getFieldDecorator } = props.form
|
|
27
|
+ const { getFieldDecorator, getFieldsValue } = props.form
|
28
|
28
|
|
29
|
29
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
30
|
30
|
const [dataSource, setDataSource] = useState({ records: [] })
|
|
@@ -145,6 +145,29 @@ function body(props) {
|
145
|
145
|
});
|
146
|
146
|
}
|
147
|
147
|
|
|
148
|
+ function exportCustomer () {
|
|
149
|
+ const fieldsValue = getFieldsValue()
|
|
150
|
+ request({ ...apis.customer.customerRecommendExport, responseType: 'blob', params: { ...fieldsValue, customerType } })
|
|
151
|
+ .then(response => {
|
|
152
|
+ download(response)
|
|
153
|
+ }).catch(error => {
|
|
154
|
+
|
|
155
|
+ })
|
|
156
|
+ }
|
|
157
|
+
|
|
158
|
+ function download (data) {
|
|
159
|
+ if (!data) {
|
|
160
|
+ return
|
|
161
|
+ }
|
|
162
|
+ const url = window.URL.createObjectURL(new Blob([data]))
|
|
163
|
+ const link = document.createElement('a')
|
|
164
|
+ link.style.display = 'none'
|
|
165
|
+ link.href = url
|
|
166
|
+ link.setAttribute('download', '客户列表.xlsx')
|
|
167
|
+ document.body.append(link)
|
|
168
|
+ link.click()
|
|
169
|
+ }
|
|
170
|
+
|
148
|
171
|
const columns = [
|
149
|
172
|
{
|
150
|
173
|
title: '头像',
|
|
@@ -289,6 +312,9 @@ function body(props) {
|
289
|
312
|
</Button>
|
290
|
313
|
</Form.Item>
|
291
|
314
|
</Form>
|
|
315
|
+ <Button type="primary" onClick={() => exportCustomer()} style={{ float: 'right', margin: '20px 0', zIndex: 1 }}>
|
|
316
|
+ 导出
|
|
317
|
+ </Button>
|
292
|
318
|
|
293
|
319
|
<div style={{ margin: '20px 0'}}>
|
294
|
320
|
<AuthButton name="admin.customer.recommend.get" noRight={null}>
|