瀏覽代碼

合同工程清单下载导入模板修改

duy 1 年之前
父節點
當前提交
6496c60dd2
共有 2 個文件被更改,包括 25 次插入11 次删除
  1. 8 0
      src/api/modules/project/debit/contract/unit.js
  2. 17 11
      src/views/project/debit/contract/unit.vue

+ 8 - 0
src/api/modules/project/debit/contract/unit.js

@@ -129,4 +129,12 @@ export default {
             data: form,
         }, msg)
     },
+    //获取合同计量单元导入模板
+    async importTemplate(form, msg = true) {
+        return HcApi({
+                url: '/api/blade-meter/tree/contract/importTemplate',
+                method: 'get',
+                params: form,
+            }, msg)
+    },
 }

+ 17 - 11
src/views/project/debit/contract/unit.vue

@@ -662,21 +662,27 @@ const leadModalSave = async () => {
     //     ishowTree.value = true
     // }, 1000)
 }
+const getImportTemplate = async (type)=>{
+    const { error, code, msg, data } = await unitApi.importTemplate({
+        type,
+    })
+    if (!error && code === 200) {
+        if (data) {
+            window.open(data)
+        }
+
+    } else {
+        window.$message.error(msg)
+     }
+}
 //下载范例模板
 const downLoadExel = ()=>{
   if (typevalue.value) {
-    if (typevalue.value === '1') {
-            window.open('https://blade-oss-chongqing.oss-cn-shenzhen.aliyuncs.com//upload/20240307/1430b65643615f80156ec328a9a09ff8.xlsx', '_blank')
-     } else if (typevalue.value === '2') {
-            window.open('https://bladex-chongqing-info.oss-cn-hangzhou.aliyuncs.com//upload/20240109/98addbf48d620030504b2cb03b1c24f5.xls', '_blank')
-      } else if (typevalue.value === '3') {
-            window.open('https://blade-oss-chongqing.oss-cn-shenzhen.aliyuncs.com//upload/20240320/88fc4e47dd3f729b1b71cf79a6db44ae.xlsx', '_blank')
-
-        } else {
-            window.$message.warning('请先选择模板')
-        }
+    getImportTemplate(typevalue.value)
 
-    }
+  } else {
+    window.$message.error('请选择范例模板')
+  }
 }
 const typeoptions = ref([
 {