|
@@ -6,6 +6,7 @@ import apis from '../../../services/apis';
|
6
|
6
|
import Styles from './style.less';
|
7
|
7
|
import { router } from 'umi';
|
8
|
8
|
import AuthButton from '@/components/AuthButton';
|
|
9
|
+import axios from 'umi-request';
|
9
|
10
|
|
10
|
11
|
|
11
|
12
|
const { Option } = Select;
|
|
@@ -77,6 +78,34 @@ function body(props) {
|
77
|
78
|
})
|
78
|
79
|
}
|
79
|
80
|
|
|
81
|
+ /**
|
|
82
|
+ *导出数据(推荐用户)
|
|
83
|
+ *
|
|
84
|
+ */
|
|
85
|
+ function exportRecommendCustomer() {
|
|
86
|
+ axios(apis.customer.customerRecommendRecommenderExport.url, {
|
|
87
|
+ ...apis.customer.customerRecommendRecommenderExport, responseType: 'blob',
|
|
88
|
+ }).then(response => {
|
|
89
|
+ // console.log('response: ', response)
|
|
90
|
+ download(response)
|
|
91
|
+ }).catch(error => {
|
|
92
|
+
|
|
93
|
+ })
|
|
94
|
+ }
|
|
95
|
+
|
|
96
|
+ function download(data) {
|
|
97
|
+ if (!data) {
|
|
98
|
+ return
|
|
99
|
+ }
|
|
100
|
+ const url = window.URL.createObjectURL(new Blob([data]))
|
|
101
|
+ const link = document.createElement('a')
|
|
102
|
+ link.style.display = 'none'
|
|
103
|
+ link.href = url
|
|
104
|
+ link.setAttribute('download', '推荐客户.xlsx')
|
|
105
|
+ document.body.append(link)
|
|
106
|
+ link.click()
|
|
107
|
+ }
|
|
108
|
+
|
80
|
109
|
const columns = [
|
81
|
110
|
{
|
82
|
111
|
title: '头像',
|
|
@@ -184,6 +213,9 @@ function body(props) {
|
184
|
213
|
</Button>
|
185
|
214
|
</Form.Item>
|
186
|
215
|
</Form>
|
|
216
|
+ <Button type="primary" onClick={() => exportRecommendCustomer()} className={Styles.SubmitButton} style={{ marginTop: '5px', marginBottom: '5px' }}>
|
|
217
|
+ 导出数据
|
|
218
|
+ </Button>
|
187
|
219
|
|
188
|
220
|
<Table dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />
|
189
|
221
|
</>
|