Pārlūkot izejas kodu

导出品牌信息

tangning 1 gadu atpakaļ
vecāks
revīzija
fcdcbb421f
2 mainītis faili ar 21 papildinājumiem un 0 dzēšanām
  1. 2 0
      src/request/config.js
  2. 19 0
      src/views/brand/index.vue

+ 2 - 0
src/request/config.js

@@ -75,6 +75,8 @@ export const addBorder = '/back/hotOutline/add'
 export const delBorderApi = '/back/hotOutline/del'
 //品牌列表
 export const getBrandList = '/back/brand/list'
+//品牌列表
+export const exporBrandList = '/back/brand/downBrandExcel'
 //更新品牌信息
 export const getBrandupdateBrandInfo = '/back/brand/updateBrandInfo'
 //下载导入模版

+ 19 - 0
src/views/brand/index.vue

@@ -8,6 +8,12 @@
         <el-button
           type="primary"
           icon="el-icon-plus"
+          @click="exportFile"
+          >导出品牌</el-button
+        >
+        <el-button
+          type="primary"
+          icon="el-icon-plus"
           @click="UpdateBrand"
           >更新品牌信息</el-button
         >
@@ -66,6 +72,7 @@ import getTableState from "@/state/tableRef";
 import auth from "@/state/viewAuth";
 import comDialog from "@/components/dialog";
 import comPagination from "@/components/pagination";
+import { dowmBlobfile } from "@/util/file";
 import axios from 'axios'
 import { dateFormat } from '@/util'
 import {
@@ -74,6 +81,7 @@ import {
   updateCategory,
   deleteCategory,
   getBrandupdateBrandInfo,
+  exporBrandList,
 } from '@/request/config'
 
 
@@ -128,6 +136,17 @@ export default {
     return { ...state, loading, headList, time, auth};
   },
   methods: {
+    async exportFile(){
+      await axios({
+            method: 'get',
+            url: exporBrandList,
+            params: { },
+            responseType: 'blob'
+        }).then(res => {
+          dowmBlobfile(res,'导出品牌信息')
+        })
+      
+    },
     async UpdateBrand(){
       await axios.get(getBrandupdateBrandInfo, {})
       this.$message({