Procházet zdrojové kódy

下载商品资料模版

kongwenhao před 8 měsíci
rodič
revize
d201cf1d38
1 změnil soubory, kde provedl 19 přidání a 1 odebrání
  1. 19 1
      frontend/src/views/Photography/detail.vue

+ 19 - 1
frontend/src/views/Photography/detail.vue

@@ -137,7 +137,9 @@
         <div class="flex-item left">
           <div class="section-title">
             <img src="@/assets/images/Photography/zhuangshi.png" style="width: 32px; height: 32px;" />
-            详情资料准备 (2选1)
+            详情资料准备 (2选1)  
+            
+            <el-button v-if="form.dataType == '1'" type="text" class="mar-left-10 fs-16"  @click="downloadExcel">下载商品基础资料模版</el-button>
           </div>
         </div>
 
@@ -236,6 +238,8 @@ const disabledButton = ref(true)
 let templates = ref([])
 let goods_art_nos = ref([])
 let partErrList = ref([])
+const excel_template_url = ref('')
+
 
 // 定义一个定时器变量
 const INTERVAL = ref<number | NodeJS.Timeout | null>(null);
@@ -286,10 +290,24 @@ const getCompanyTemplates = async () => {
   if (templates.value.length > 0) {
     form.selectTemplate = templates.value[0]
   }
+  excel_template_url.value = data.excel_template_url
   // 计算总页数
   totalPage.value = Math.ceil(templates.value.length / itemsPerPage);
 }
 
+const downloadExcel =  () => {
+  const a = document.createElement('a')
+  a.href = excel_template_url.value, 
+  a.download = '商品基础资料模版' 
+  document.body.appendChild(a)
+  a.click()
+  setTimeout(() => {
+    document.body.removeChild(a);
+  }, 1000);
+}
+
+
+
 
 const onCurrentChange = (page) => {
   queryParams.current = page;