魏熙美 5 vuotta sitten
vanhempi
commit
35581e1ab2
3 muutettua tiedostoa jossa 38 lisäystä ja 1 poistoa
  1. 1
    1
      config/config.js
  2. 32
    0
      src/pages/customer/recommendCustomer/index.jsx
  3. 5
    0
      src/services/apis.js

+ 1
- 1
config/config.js Näytä tiedosto

@@ -512,7 +512,7 @@ export default {
512 512
 
513 513
   proxy: {
514 514
     '/api/': {
515
-      target: 'http://192.168.0.11:8080/',
515
+      target: 'http://localhost:8080/',
516 516
       changeOrigin: true,
517 517
       // pathRewrite: { '^/server': '' },
518 518
     },

+ 32
- 0
src/pages/customer/recommendCustomer/index.jsx Näytä tiedosto

@@ -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
     </>

+ 5
- 0
src/services/apis.js Näytä tiedosto

@@ -186,6 +186,11 @@ export default {
186 186
       url: `${prefix}/customer/recommend/get/id`,
187 187
       action: 'admin.customer.recommend.get.id.get',
188 188
     },
189
+    customerRecommendRecommenderExport: { // 导出数据(推荐客户)
190
+      method: 'GET',
191
+      url: `${prefix}/customer/recommend/recommender/export`,
192
+      action: 'admin.customer.recommend.recommender.export.get',
193
+    },
189 194
   },
190 195
   indexEcharts: {
191 196
     userResource: {