From 7d8e431ca2eda255dc8f6f3605cdfcfd3cc1dcf5 Mon Sep 17 00:00:00 2001
From: Surpriseplus <845948745@qq.com>
Date: 星期四, 09 三月 2023 15:59:58 +0800
Subject: [PATCH] 目录管理添加模板下载,工点信息页面修改

---
 src/views/datamanage/catalogueManage.vue |   84 ++++++++++++++++++++++++++++++++++-------
 1 files changed, 69 insertions(+), 15 deletions(-)

diff --git a/src/views/datamanage/catalogueManage.vue b/src/views/datamanage/catalogueManage.vue
index 74e1d83..f223bd7 100644
--- a/src/views/datamanage/catalogueManage.vue
+++ b/src/views/datamanage/catalogueManage.vue
@@ -46,6 +46,15 @@
                 class="demo-form-inline"
               >
                 <el-form-item>
+
+                  <el-button
+                    icon="el-icon-download"
+                    type="info"
+                    size="small"
+                    @click="setTemplateDownload"
+                  >{{ $t("shuJuGuanLi.butten.templateDownload") }}</el-button>
+                </el-form-item>
+                <el-form-item>
                   <el-upload
                     action
                     accept=".xlsx, .xls"
@@ -348,6 +357,11 @@
         >{{ $t("common.preservation") }}</el-button>
       </div>
     </el-dialog>
+    <iframe
+      id="Iframe1"
+      src=""
+      style="display: none; border: 0; padding: 0; height: 0; width: 0"
+    ></iframe>
   </div>
 </template>
 
@@ -364,6 +378,7 @@
 import * as XSLX from "xlsx";
 import MyBread from "../../components/MyBread.vue";
 import clone from "@turf/clone";
+import $ from 'jquery'
 export default {
   name: "catalogueManage",
   components: {
@@ -418,6 +433,15 @@
     };
   },
   methods: {
+    setTemplateDownload() {
+      var url = window.location.href;
+      var testurl = window.location.origin + "/";
+      if (url.indexOf("web") != -1) {
+        testurl = testurl + "/web/";
+      }
+      testurl += dirTemplateFile
+      $("#Iframe1").attr("src", testurl).click()
+    },
     handleChange(file, fileList) {
       this.file = file;
       if (fileList.length > 0) {
@@ -451,24 +475,54 @@
             { defval: null }
           ); // 榛樿绗竴琛屼笅涓虹┖涔熻兘瑙f瀽鍑虹涓�鍥涜
           var data = [...outdata];
-          const arr = [];
-          data.map((v) => {
-            const obj = {};
-            obj.name = v.name;
-            obj.pname = v.pname;
-            obj.descr = v.explain;
-            obj.checks = v.checks;
-            obj.bak = v.bak;
-            obj.exts = v.exts;
-            obj.orderNum = null;
-            obj.pid = null;
-            arr.push(obj);
-          });
-          that.tableData = arr;
-          that.setInsertData(that.tableData);
+          that.setLeToFc(data);
         };
       }
     },
+
+    setLeToFc(res) {
+      var arr = [];
+      for (var i in res) {
+        var value = this.getNameAndPname(res[i], res, i)
+        arr.push({
+          name: value[0],
+          pname: value[1],
+          descr: res[i].explain,
+          checks: res[i].checks,
+          bak: res[i].bak,
+          exts: res[i].exts,
+          orderNum: null,
+          pid: null,
+        })
+      }
+      this.tableData = arr;
+      this.setInsertData(this.tableData);
+
+
+    },
+    getNameAndPname(res, result, flag) {
+      var chLevel = null;
+      var faLevel = null;
+
+      for (var i = 1; i < 8; i++) {
+        var lel = 'L' + i;
+        if (res[lel] != null) {
+          chLevel = i
+        }
+      }
+      if (chLevel == 1) {
+        return [res['L' + chLevel], null]
+      } else {
+        faLevel = chLevel - 1;
+        for (var i = flag; i >= 0; i--) {
+          var val = result[i]
+          if (val['L' + faLevel]) {
+            return [res['L' + chLevel], val['L' + faLevel]]
+            break;
+          }
+        }
+      }
+    },
     setInsertData(res) {
       var list = this.excelData(res);
 

--
Gitblit v1.9.3