Ver código fonte

导出数据

魏熙美 5 anos atrás
pai
commit
e4a3bca324

+ 20
- 1
src/pages/customer/independentList/index.jsx Ver arquivo

332
     })
332
     })
333
   }
333
   }
334
 
334
 
335
+  function exportIndependen() {
336
+
337
+  }
338
+
339
+  function download(data) {
340
+    if (!data) {
341
+      return
342
+    }
343
+    const url = window.URL.createObjectURL(new Blob([data]))
344
+    const link = document.createElement('a')
345
+    link.style.display = 'none'
346
+    link.href = url
347
+    link.setAttribute('download', '经纪人.xlsx')
348
+    document.body.append(link)
349
+    link.click()
350
+  }
351
+
335
   const columns = [
352
   const columns = [
336
     {
353
     {
337
       title: '头像',
354
       title: '头像',
415
             </Button>
432
             </Button>
416
         </Form.Item>
433
         </Form.Item>
417
       </Form>
434
       </Form>
418
-
435
+      <Button type="primary" onClick={() => exportIndependen()} className={Styles.SubmitButton} style={{ marginTop: '5px', marginBottom: '5px', display: 'none' }}>
436
+        导出数据
437
+      </Button>
419
       <Table dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />
438
       <Table dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />
420
             {/* 调整归属 */}
439
             {/* 调整归属 */}
421
         <ModalTable visibleData={gVisibleData} />
440
         <ModalTable visibleData={gVisibleData} />

+ 4
- 5
src/pages/customer/recommendCustomer/index.jsx Ver arquivo

6
 import Styles from './style.less';
6
 import Styles from './style.less';
7
 import { router } from 'umi';
7
 import { router } from 'umi';
8
 import AuthButton from '@/components/AuthButton';
8
 import AuthButton from '@/components/AuthButton';
9
-import axios from 'umi-request';
10
 
9
 
11
 
10
 
12
 const { Option } = Select;
11
 const { Option } = Select;
83
    *
82
    *
84
    */
83
    */
85
   function exportRecommendCustomer() {
84
   function exportRecommendCustomer() {
86
-    axios(apis.customer.customerRecommendRecommenderExport.url, {
87
-      ...apis.customer.customerRecommendRecommenderExport, responseType: 'blob',
85
+    request({
86
+      ...apis.customer.customerRecommendRecommenderExport, 
87
+      responseType: 'blob',
88
     }).then(response => {
88
     }).then(response => {
89
       // console.log('response: ', response)
89
       // console.log('response: ', response)
90
       download(response)
90
       download(response)
213
             </Button>
213
             </Button>
214
         </Form.Item>
214
         </Form.Item>
215
       </Form>
215
       </Form>
216
-      <Button type="primary" onClick={() => exportRecommendCustomer()} className={Styles.SubmitButton} style={{ marginTop: '5px', marginBottom: '5px' }}>
216
+      <Button type="primary" onClick={() => exportRecommendCustomer()} className={Styles.SubmitButton} style={{ marginTop: '5px', marginBottom: '5px', display: 'none' }}>
217
         导出数据
217
         导出数据
218
       </Button>
218
       </Button>
219
-
220
       <Table dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />
219
       <Table dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />
221
     </>
220
     </>
222
   );
221
   );

+ 20
- 0
src/pages/customer/report/index.jsx Ver arquivo

70
       getList({ pageNumber: pageNum, pageSize: 9 })
70
       getList({ pageNumber: pageNum, pageSize: 9 })
71
   }
71
   }
72
 
72
 
73
+  function exportReport() {
74
+
75
+  }
76
+
77
+  function download(data) {
78
+    if (!data) {
79
+      return
80
+    }
81
+    const url = window.URL.createObjectURL(new Blob([data]))
82
+    const link = document.createElement('a')
83
+    link.style.display = 'none'
84
+    link.href = url
85
+    link.setAttribute('download', '报备客户.xlsx')
86
+    document.body.append(link)
87
+    link.click()
88
+  }
89
+
73
   const columns = [
90
   const columns = [
74
     {
91
     {
75
       title: '头像',
92
       title: '头像',
159
             </Button>
176
             </Button>
160
         </Form.Item>
177
         </Form.Item>
161
       </Form>
178
       </Form>
179
+      <Button type="primary" onClick={() => exportReport()} className={Styles.SubmitButton} style={{ marginTop: '5px', marginBottom: '5px', display: 'none' }}>
180
+        导出数据
181
+      </Button>
162
       <Table style={{marginTop:'40px'}} dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />
182
       <Table style={{marginTop:'40px'}} dataSource={dataSource.records} columns={columns} pagination={{ total: dataSource.total, onChange }} />
163
     </>
183
     </>
164
   );
184
   );

+ 2
- 0
src/utils/request.js Ver arquivo

75
       });
75
       });
76
       throw new Error(response.statusText);
76
       throw new Error(response.statusText);
77
     } else {
77
     } else {
78
+      console.log('response: ', response)
79
+      console.log('response.headers: ', response.headers)
78
       const { code, data, message } = await response.clone().json();
80
       const { code, data, message } = await response.clone().json();
79
       if (code != 1000) {
81
       if (code != 1000) {
80
         notification.error({
82
         notification.error({