Browse Source

在途物料导出Excel

lxf 1 year ago
parent
commit
84e4e9fff8

+ 10 - 0
src/api/shengde/productionSystem/purchase/inTransit.js

@@ -17,3 +17,13 @@ export function passageListCount(data) {
     data: data,
   })
 }
+
+// 在途物料-导出
+export function passageExcelExport(data) {
+  return request({
+    url: '/saas-group/saas/group/bomcolor/passageExcelExport',
+    method: 'post',
+    data: data,
+    responseType: 'blob',
+  })
+}

+ 24 - 1
src/views/shengde/productionSystem/purchase/inTransit/index.vue

@@ -1,5 +1,5 @@
 <template>
-  <el-card class="box-card">
+  <el-card class="box-card" v-loading="loadingStatus" element-loading-text="生成Excel文件中,请稍后" element-loading-background="rgba(0, 0, 0, 0.2)">
     <el-form :model="queryParams" ref="queryForm" :inline="true" @submit.native.prevent>
       <el-form-item label="采购单号" prop="purchaseCode">
         <el-input v-model="queryParams.purchaseCode" placeholder="请输入采购单号" size="small" @keyup.enter.native="handleQuery" />
@@ -16,6 +16,12 @@
       </el-form-item>
     </el-form>
 
+    <el-row :gutter="10" style="margin-bottom: 10px">
+      <el-col :span="5">
+        <el-button type="primary" size="mini" @click="handleExcel" v-db-click>导出Excel</el-button>
+      </el-col>
+    </el-row>
+
     <el-table
       :data="tableList"
       :cell-style="{ padding: '0' }"
@@ -64,6 +70,7 @@ export default {
       loading: false,
       tableList: [],
       total: 0,
+      loadingStatus: false,
     }
   },
   created() {},
@@ -103,6 +110,22 @@ export default {
         return 'colorDim'
       }
     },
+    handleExcel() {
+      this.loadingStatus = true
+      let queryParams = JSON.parse(JSON.stringify(this.queryParams))
+      queryParams.pageNum = 1
+      queryParams.pageSize = 9999
+      API.passageExcelExport(queryParams).then(
+        (res) => {
+          this.loadingStatus = false
+          this.exportFile(res, '在途物料.xlsx')
+        },
+        (err) => {
+          console.log('passageExcelExport: ' + err)
+          this.loadingStatus = false
+        }
+      )
+    },
   },
 }
 </script>