Bläddra i källkod

对接经销商资料导出

chenrui 4 år sedan
förälder
incheckning
6103775db1
2 ändrade filer med 41 tillägg och 3 borttagningar
  1. 9 1
      src/api/dealer.js
  2. 32 2
      src/views/dealerManagement/merchantInfoManagement/list.vue

+ 9 - 1
src/api/dealer.js

@@ -36,7 +36,15 @@ export const dealerSave = (params) => {
     method: 'post'
   })
 }
-
+//  经销商 导出
+export const dealerExport = (params) => {
+  return axios({
+    url: '/dealer/exportList',
+    data: params,
+    method: 'post',
+    responseType: 'blob'
+  })
+}
 // 审核经销商资料
 export const dealerAudit = (params) => {
   return axios({

+ 32 - 2
src/views/dealerManagement/merchantInfoManagement/list.vue

@@ -33,7 +33,15 @@
           </template>
           <a-col :md="6" :sm="24">
             <a-button style="margin-bottom: 18px;" type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="merchantInfoManagementList-refresh">查询</a-button>
-            <a-button style="margin: 0 0 18px 8px" @click="resetSearchForm" :disabled="disabled" id="merchantInfoManagementList-reset">重置</a-button>
+            <a-button style="margin: 0 0 18px 5px" @click="resetSearchForm" :disabled="disabled" id="merchantInfoManagementList-reset">重置</a-button>
+            <a-button
+              style="margin-left: 5px"
+              type="primary"
+              class="button-warning"
+              @click="handleExport"
+              :disabled="disabled"
+              :loading="exportLoading"
+              id="merchantInfoManagementList-export">导出</a-button>
             <a @click="advanced=!advanced" style="margin-left: 8px">
               {{ advanced ? '收起' : '展开' }}
               <a-icon :type="advanced ? 'up' : 'down'"/>
@@ -90,7 +98,8 @@
 </template>
 
 <script>
-import { dealerQueryList } from '@/api/dealer'
+import moment from 'moment'
+import { dealerQueryList, dealerExport } from '@/api/dealer'
 import { STable, VSelect } from '@/components'
 import subarea from '@/views/common/subarea.js'
 import merchantInfoManagementDetailModal from './detailModal.vue'
@@ -212,6 +221,27 @@ export default {
     closeModal () {
       this.itemId = ''
       this.openModal = false
+    },
+    //  导出
+    handleExport () {
+      const params = this.queryParam
+      this.exportLoading = true
+      dealerExport(params).then(res => {
+        this.exportLoading = false
+        this.download(res)
+      })
+    },
+    download (data) {
+      if (!data) { return }
+      const url = window.URL.createObjectURL(new Blob([data]))
+      const link = document.createElement('a')
+      link.style.display = 'none'
+      link.href = url
+      const a = moment().format('YYYYMMDDHHmmss')
+      const fname = '经销商资料' + a
+      link.setAttribute('download', fname + '.xlsx')
+      document.body.appendChild(link)
+      link.click()
     }
   },
   beforeRouteEnter (to, from, next) {