فهرست منبع

新增BOM导出

695593266@qq.com 3 ماه پیش
والد
کامیت
135fa8c720
1فایلهای تغییر یافته به همراه27 افزوده شده و 0 حذف شده
  1. 27 0
      src/views/material/BOMmanage/detailsPop.vue

+ 27 - 0
src/views/material/BOMmanage/detailsPop.vue

@@ -80,6 +80,8 @@
               type="primary"
               size="mini"
               icon="el-icon-download"
+              @click="exportFn"
+              :loading="exportLoading"
               plain
               >导出</el-button
             >
@@ -445,6 +447,8 @@
   import workmanship from './components/workmanship.vue';
   import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
   import { mapGetters } from 'vuex';
+  import { download } from '@/utils/file';
+  import request from '@/utils/request';
 
   export default {
     name: 'bomDetailsPop',
@@ -470,6 +474,7 @@
           parentId: ''
         },
         processSubmitDialogFlag: false,
+        exportLoading: false,
         current: {},
         treeList: [],
         versList: [],
@@ -639,6 +644,28 @@
         }
       },
 
+      exportFn() {
+        this.exportLoading = true;
+        request
+          .post(
+            '/main/bomCategory/exportBOM',
+            { bomCategoryId: this.treeId },
+            {
+              responseType: 'blob'
+            }
+          )
+          .then((res) => {
+            debugger;
+            download(res.data, `${this.currentNodeData.name}_BOM数据.xlsx`);
+          })
+          .catch((e) => {
+            console.error(e);
+          })
+          .finally(() => {
+            this.exportLoading = false;
+          });
+      },
+
       async getTreeData() {
         try {
           this.treeLoading = true;