From ba3f4338070b930bc2b5b50bcd483aba1a37d7b9 Mon Sep 17 00:00:00 2001
From: Surpriseplus <845948745@qq.com>
Date: 星期一, 21 十一月 2022 20:37:07 +0800
Subject: [PATCH] 数据管理,界面修改,接口对接,功能开发

---
 src/views/datamanage/SpatialData.vue |  114 ++++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 97 insertions(+), 17 deletions(-)

diff --git a/src/views/datamanage/SpatialData.vue b/src/views/datamanage/SpatialData.vue
index 8511832..ff5d28f 100644
--- a/src/views/datamanage/SpatialData.vue
+++ b/src/views/datamanage/SpatialData.vue
@@ -75,7 +75,7 @@
                   >{{$t('common.details')}}</el-link
                 >
                 <el-link class="elLink"
-                  @click="dialogFormVisible = true"
+                  @click="getAttachTable"
                   style="margin-left: 20px;  "
                   >{{$t('common.enclosure')}}</el-link
                 >
@@ -142,18 +142,21 @@
         </el-form-item>
         <el-form-item>
           <el-row  >
-            <el-col :span="3"> <el-link  class="elLink" :underline="false" >{{$t('common.append')}}</i></el-link></el-col>
-            <el-col :span="3">   <el-link  class="elLink" :underline="false" >{{$t('common.delete')}}</i></el-link></el-col>
-            <el-col :span="3">  <el-link  class="elLink" :underline="false" >{{$t('common.reset')}}</i></el-link></el-col>
+            <el-col :span="3"> <el-link  class="elLink" :underline="false" @click="setAttachInsert" >{{$t('common.append')}}</i></el-link></el-col>
+            <el-col :span="3">   <el-link  class="elLink" :underline="false" @click="setAttachDel" >{{$t('common.delete')}}</i></el-link></el-col>
+            <!-- <el-col :span="3">  <el-link  class="elLink" :underline="false" >{{$t('common.reset')}}</i></el-link></el-col> -->
           </el-row>
         </el-form-item>
         <el-form-item>
  <el-table
+       :data="tableAttach"
             ref="filterTable"
             height="99%"
             border
             style="width: 100%"
+            @selection-change="handleAttatchChange"
           >
+                  <el-table-column type="selection" width="55" />
           <el-table-column width="60" type="index" :label="$t('common.index')" />
               <el-table-column  prop="date"
          :label="$t('common.fileNme')"
@@ -185,8 +188,11 @@
   dataQuery_selectDomains,
   dataQuery_selectFields,
   dataQuery_selectByPage,
+  dataQuery_uploadFiles,
+  dataQuery_selectFiles,
+  dataQuery_deletes,
 } from '../../api/api';
-
+import { getToken } from "../../utils/auth.js";
 import catalogueTree from '../../components/catalogueTree.vue';
 import MyBread from '../../components/MyBread.vue';
 export default {
@@ -195,24 +201,28 @@
   components: { MyBread, catalogueTree },
   data() {
     return {
+      attachtable: ['b_pac_geologic_hazard', 'b_hydrogeology', 'b_pac_meteorological', 'b_pac_marine_meteorological', 'b_pac_frozensoil', 's_borehole', 'm_marker', 'm_hydraulic_protection', 'm_equipment_nameplate'],
       formInline: {
         file: '',
       },
       tree: [
         {
           tabDesc: '鍩虹鏁版嵁',
+          tab: '鍩虹鏁版嵁',
           value: 'BD',
           children: [],
         },
         {
           tabDesc: '涓氬姟鏁版嵁',
+          tab: '涓氬姟鏁版嵁',
           value: 'BS',
           children: [],
         },
       ],
+      tableAttach: [],
       defaultProps: {
         children: 'children',
-        label: 'tabDesc',
+        label: 'tab',
       },
       btnStatus: {
         select: false,
@@ -260,6 +270,8 @@
         filter: null,
         wkt: null,
       },
+      getClickTable: null,
+      attacgSelection: [],
     };
   },
   created() {
@@ -269,6 +281,72 @@
     this.getTreeDataAll();
   },
   methods: {
+  async setAttachDel() {
+       var std = [];
+      for (var i in this.attacgSelection) {
+        std.push(this.attacgSelection[i].id);
+      }
+      const res = await dataQuery_deletes({ ids: std.toString() });
+      if(res.code != 200){
+        this.$message.error('鏂囦欢鍒犻櫎澶辫触');
+      }
+       this.getAttacthFlieList();
+    },
+    setAttachInsert() {
+      var token = getToken();
+      var fs = document.getElementById("insertFile");
+      if (fs.files.length == 0) {
+        alert("璇烽�夋嫨瑕佷笂浼犵殑鏂囦欢锛�");
+        return;
+      }
+      const formData = new FormData()
+      for (var i = 0, c = fs.files.length; i < c; i++) {
+
+        formData.append('file', fs.files[i]); // fs.files[i].name,file
+      }
+
+      $.ajax(BASE_URL + "/dataQuery/uploadFiles?token=" + token + "&tabName=lf.sys_style&eventid=fa25979a5ef8b43ba82a0be35b3fb0d4", {
+        type: "post",
+        data: formData,
+        async: true,
+        cache: false,
+        processData: false,
+        contentType: false,
+        success: (rs) => {
+          this.$message({
+            message: '闄勪欢娣诲姞鎴愬姛',
+            type: 'success'
+          });
+          document.getElementById("insertFile").value = "";
+          this.formInline = {
+            file: '',
+          }
+          this.getAttacthFlieList();
+        },
+        error: (e) => {
+          document.getElementById("insertFile").value = "";
+          this.$message.error('闄勪欢娣诲姞澶辫触');
+        }
+      });
+    },
+    async getAttacthFlieList() {
+      var obj = {
+        tabName: 'lf.sys_style',
+        eventid: 'fa25979a5ef8b43ba82a0be35b3fb0d4'
+      }
+      const res = await dataQuery_selectFiles(obj);
+      if (res.code != 200) {
+        this.$message.error('鍒楄〃璋冪敤澶辫触');
+        return
+      }
+      this.tableAttach = res.result;
+    },
+
+
+    getAttachTable() {
+      this.getAttacthFlieList();
+      this.dialogFormVisible = true;
+    },
     //闄勪欢=>鏂囦欢閫夋嫨
     getInsertFile() {
       $('#insertFile').click();
@@ -313,7 +391,7 @@
       //鍒ゆ柇鐐瑰嚮鏄惁涓哄瓙鑺傜偣
       if (data.children != null) return;
       this.listData.name = data.entity; //瑕佹煡璇㈣〃鏍肩被鍨嬶紱
-
+      this.getClickTable = data;
       this.filedsLayer = this.getCollapseDomFiled(); //鑾峰彇姣忎釜琛ㄥ瓧娈靛悕绉板強闃堝��
       //鑾峰彇table淇℃伅
       this.getCollapseTable(this.filedsLayer);
@@ -581,11 +659,14 @@
           //   this.getMetaCount("");
           // });
         })
-        .catch(() => {});
+        .catch(() => { });
     },
     // 鑾峰彇澶氶�夐�変腑鐨勫璞�
     handleSelectionChange(val) {
       this.multipleSelection = val;
+    },
+    handleAttatchChange(val) {
+      this.attacgSelection = val;
     },
     // 鍒犻櫎澶氭潯
     DelFormData() {
@@ -646,7 +727,7 @@
           //   });
           // });
         })
-        .catch(() => {});
+        .catch(() => { });
     },
   },
 };
@@ -758,7 +839,7 @@
       background-color: #216fe6;
     }
   }
-    .infoBox {
+  .infoBox {
     width: 500px;
 
     position: absolute;
@@ -769,17 +850,17 @@
     color: white;
     .el-card {
       background-color: transparent;
-         color: white;
+      color: white;
       span {
         font-size: 16px;
         font-weight: 600;
-           color: white;
+        color: white;
       }
     }
     .contentBox {
       margin: 0 aotu 10px;
       p {
-   color: white;
+        color: white;
         font-size: 14px;
       }
     }
@@ -822,17 +903,17 @@
     }
   }
 
- .elLink{
+  .elLink {
     color: white !important;
   }
-  .el-icon-folder-opened{
+  .el-icon-folder-opened {
     color: white;
   }
 
   /deep/ .el-select .el-input__inner {
     border-color: #fff !important;
   }
-    /deep/ .el-dialog {
+  /deep/ .el-dialog {
     background: #303030;
   }
   /deep/.el-range-editor.is-active,
@@ -843,6 +924,5 @@
   /deep/.el-dialog__title {
     color: white;
   }
-
 }
 </style>

--
Gitblit v1.9.3