From 98a2b24c89e81a5aacdcbd6b739fef422adf17dd Mon Sep 17 00:00:00 2001
From: surprise <15810472099@163.com>
Date: 星期五, 29 三月 2024 09:57:55 +0800
Subject: [PATCH] 代码更新

---
 src/views/userManage/templateManage.vue |  103 ++++++++++++++++++++++++++++++++-------------------
 1 files changed, 64 insertions(+), 39 deletions(-)

diff --git a/src/views/userManage/templateManage.vue b/src/views/userManage/templateManage.vue
index b9e2abd..a9971b7 100644
--- a/src/views/userManage/templateManage.vue
+++ b/src/views/userManage/templateManage.vue
@@ -31,12 +31,13 @@
                 size="small">{{ $t('common.append') }}</el-button>
             </el-form-item>
             <el-form-item>
-              <el-button v-if="btnStatus.delete" icon="el-icon-delete" @click="delTableData" type="danger" size="small">{{
-                $t('common.delete') }}</el-button>
+              <el-button v-if="btnStatus.delete" icon="el-icon-delete" @click="delTableData" type="danger"
+                size="small">{{
+      $t('common.delete') }}</el-button>
             </el-form-item>
             <el-form-item>
               <el-button icon="el-icon-refresh" @click="restRefreshTable" type="info" size="small">{{ $t('common.empty')
-              }}</el-button>
+                }}</el-button>
             </el-form-item>
           </div>
         </div>
@@ -72,6 +73,7 @@
         <el-table-column align="center" prop="createTime" :label="$t('dataManage.vmobj.createontime')"
           :formatter="formatData" />
         <el-table-column min-width="100" :label="$t('dataManage.dictionaryManageObj.operation')">
+
           <template slot-scope="scope">
             <el-button v-if="btnStatus.select" @click="showDetail(scope.$index, scope.row)" type="primary" plain
               size="small">{{ $t('dataManage.dictionaryManageObj.lookOver') }}</el-button>
@@ -91,8 +93,8 @@
     </div>
     <!-- 鏂板 -->
     <el-dialog :title="behavior == '鏂板'
-        ? `${$t('common.append')}`
-        : `${$t('common.update')}`
+      ? `${$t('common.append')}`
+      : `${$t('common.update')}`
       " :visible.sync="dialogVisible" :before-close="handleClose">
       <div style="height: 500px; overflow: auto">
         <el-form ref="form" :model="editForm" label-width="100px" label-position="top">
@@ -236,41 +238,14 @@
   report_deletes,
   report_update,
 } from "../../api/api.js";
+import dataStatistics from '../../components/js/dataStatistics.js'
 import { getToken } from "@/utils/auth";
 export default {
   name: "templateManage",
   components: { MyBread },
   data() {
     return {
-      options: [
-        {
-          value: "countSizes",
-          label: "鏁版嵁閲忕粺璁�",
-        },
-        {
-          value: "countServices",
-          label: "鏈嶅姟璋冪敤閲忕粺璁�",
-        },
-        {
-          value: "countOperates",
-          label: "鐢ㄦ埛娴侀噺缁熻",
-        },
-        {
-          value: "dataTable",
-          label: "涓婁紶鏁版嵁琛ㄦ牸妯℃澘",
-        },
-        {
-          value: "uploadDir",
-          label: "涓婁紶鐩綍缁撴瀯妯℃澘",
-        },
-        {
-          value: "dirFolder",
-          label: "鐩綍缁撴瀯鏂囦欢澶规ā鏉�",
-        }, {
-          value: "countExplorationPoints",
-          label: "閽诲瓟鏁版嵁缁熻",
-        },
-      ],
+      options: [],
       itemdetail: {},
       showinfoBox: false,
       behavior: "鏂板",
@@ -321,6 +296,12 @@
     window.removeEventListener("resize", this.onResize);
   },
   mounted() {
+
+    var obj = dataStatistics.statistics.filter(res => {
+      if (res.isMenu != false)
+        return res;
+    })
+    this.options = obj
     window.addEventListener("resize", this.onResize);
     this.calHeight();
   },
@@ -388,7 +369,10 @@
           return res
         }
       })
-      this.itemdetail.code = val[0].label;
+      if (val.length > 0 && val[0].label) {
+        this.itemdetail.code = val[0].label;
+      }
+
       // if (row.code.indexOf("countSizes") != -1) {
       //   this.itemdetail.code = "鏁版嵁閲忕粺璁�";
       // } else if (row.code.indexOf("countServices") != -1) {
@@ -452,7 +436,7 @@
           break;
         }
       }
-
+      console.log(name)
       if (name.indexOf('缁熻') > -1) {
         this.typeOption = [{
           label: "World妯℃澘",
@@ -484,12 +468,38 @@
     handleEdit(index, row) {
       this.behavior = "淇敼";
       this.editForm = row;
+
+      if (row.name.indexOf('缁熻') > -1) {
+        this.typeOption = [{
+          label: "World妯℃澘",
+          value: "1"
+        }, {
+          label: "Excel妯℃澘",
+          value: "2"
+        }]
+
+      } else {
+        this.typeOption = [{
+          label: "World妯℃澘",
+          value: "1"
+        }, {
+          label: "Excel妯℃澘",
+          value: "2"
+        }, {
+          label: "Zip妯℃澘",
+          value: "3"
+        }]
+      }
       if (parseInt(row.type) == 1) {
         this.selectFileType = ".docx";
       } else if (parseInt(row.type) == 2) {
         this.selectFileType = ".xlsx";
       }
       this.rowGuid = row.guid;
+
+
+
+
       this.dialogVisible = true;
     },
     //鍒犻櫎
@@ -552,6 +562,7 @@
     },
     //鏂板涓�鏉℃暟鎹�
     async addInsertData() {
+      this.editForm.guid = this.rowGuid;
       const data = await report_insert(this.editForm);
       if (data.code != 200) {
         return this.$message.error("鏂板澶辫触");
@@ -578,10 +589,24 @@
     },
     //鏂囦欢涓婁紶
     async geteditFile(res) {
+
+      if (parseInt(this.editForm.type) == 1) {
+        this.selectFileType = ".docx";
+      } else if (parseInt(this.editForm.type) == 2) {
+        this.selectFileType = ".xlsx";
+      }
+      this.$nextTick(() => {
+        this.setEditFile(res)
+      })
+
+    },
+    async setEditFile(res) {
       if (res == 0) {
         if (this.editForm.type == "") {
           return this.$message("璇烽�夋嫨涓婁紶鏂囦欢绫诲瀷");
         }
+
+
 
         $("#editFile").click();
       } else if (res == 1) {
@@ -597,7 +622,7 @@
         formData.append("file", fs.files[0]);
         var val_data = await report_upload(formData);
         if (val_data.code == 200) {
-          // this.editForm.guid = val_data.result;
+          this.editForm.guid = val_data.result;
           this.rowGuid = val_data.result;
           this.$message({
             message: "涓婁紶鎴愬姛锛�",
@@ -641,7 +666,7 @@
     },
 
     editFormStart() {
-      this.editForm.code = "countSizes";
+      this.editForm.code = "dataTable";
       var name;
       for (var i in this.options) {
         if (this.options[i].value == this.editForm.code) {
@@ -713,6 +738,7 @@
   },
 };
 </script>
+
 <style lang="less" scoped>
 //@import url(); 寮曞叆鍏叡css绫�
 .authorityManagement_box {
@@ -779,4 +805,3 @@
   }
 }
 </style>
-

--
Gitblit v1.9.3