Explorar o código

wdly待出库模板下载

cz hai 1 ano
pai
achega
ccd707d045

BIN=BIN
public/static/WaitOutBoundBatchImportTemplate.xlsx


+ 21 - 2
src/views/WDLY/outInBound/waitOutBound/index.vue

@@ -122,11 +122,14 @@
     <el-dialog title="Excel导入" v-model="openExcelDialog" width="500">
       <div v-loading="excelLoading">
         <div>
-          <div style="margin-bottom: 10px">上传附件</div>
+          <div style="margin: 15px 0">
+            <el-button @click="downloadTemplateOne" type="primary">Excel模板下载</el-button>
+          </div>
+          <!-- <div style="margin-bottom: 10px">上传附件</div> -->
           <el-upload :action="actionUrl + '/jdOrder/getBatchOutExcelInfo'" :headers="headers"
                      :before-upload="useImportExcelStore().updateRequestHeaders" :on-success="handleSuccessOne" :on-progress="handleProgressOne"
                      :show-file-list="false" :on-error="handleErrorOne" accept=".xls, .xlsx">
-            <el-button type="primary">选择</el-button>
+            <el-button type="primary" plain>点击导入</el-button>
           </el-upload>
         </div>
       </div>
@@ -1254,6 +1257,22 @@ const downloadTemplate = () => {
       link.click();
     });
 };
+
+const downloadTemplateOne = () => {
+  fetch("/static/WaitOutBoundBatchImportTemplate.xlsx")
+    .then((res) => res.blob())
+    .then((res) => {
+      const url = window.URL.createObjectURL(res);
+      let filename = "待出库导入模板.xlsx";
+      const link = document.createElement("a");
+      link.style.display = "none";
+      link.href = url;
+      link.setAttribute("download", filename);
+      document.body.appendChild(link);
+      link.click();
+    });
+};
+
 const handleProgress = () => {
   excelLoading.value = true;
 };