From c2a6c53657baaf0830cd881e1a23a15af23ac6fa Mon Sep 17 00:00:00 2001
From: Surpriseplus <845948745@qq.com>
Date: 星期四, 21 九月 2023 18:35:14 +0800
Subject: [PATCH] 代码更新

---
 src/components/MapView/mapMenuPop.vue |  420 +++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 288 insertions(+), 132 deletions(-)

diff --git a/src/components/MapView/mapMenuPop.vue b/src/components/MapView/mapMenuPop.vue
index 48a7d58..0afb133 100644
--- a/src/components/MapView/mapMenuPop.vue
+++ b/src/components/MapView/mapMenuPop.vue
@@ -1,7 +1,8 @@
 <template>
   <div class="menuPop">
     <div class="leftBox">
-      <div class="leftDown" v-if="$store.state.download">
+      <!-- v-if="$store.state.download" -->
+      <div class="leftDown">
         <div @click="getDownloadDep">
           <el-link icon="el-icon-download"> </el-link>
         </div>
@@ -31,7 +32,11 @@
             label="搴忓彿"
             width="50"
           />
-          <el-table-column label="瀹氫綅" width="100" align="center">
+          <el-table-column
+            label="瀹氫綅"
+            width="100"
+            align="center"
+          >
             <template slot-scope="scope">
               <el-button
                 icon="el-icon-map-location"
@@ -50,7 +55,10 @@
           ></el-table-column>
         </el-table>
       </div>
-      <div class="pagination_box" style="margin-top: 10px">
+      <div
+        class="pagination_box"
+        style="margin-top: 10px"
+      >
         <el-pagination
           @size-change="handleSizeChange"
           @current-change="handleCurrentChange"
@@ -78,14 +86,20 @@
         label-width="100px"
         class="codeForm"
       >
-        <el-form-item :label="$t('common.passworld')" prop="password">
+        <el-form-item
+          :label="$t('common.passworld')"
+          prop="password"
+        >
           <el-input
             type="password"
             v-model="codeForm.password"
             show-password
           ></el-input>
         </el-form-item>
-        <el-form-item :label="$t('common.SPassword')" prop="repassword">
+        <el-form-item
+          :label="$t('common.SPassword')"
+          prop="repassword"
+        >
           <el-input
             type="password"
             v-model="codeForm.repassword"
@@ -97,70 +111,18 @@
             class="primary"
             size="small"
             @click="download('codeForm')"
-            >{{ $t("common.confirm") }}</el-button
-          >
-          <el-button type="info" size="small" @click="closeDown('codeForm')">{{
+          >{{ $t("common.confirm") }}</el-button>
+          <el-button
+            type="info"
+            size="small"
+            @click="closeDown('codeForm')"
+          >{{
             $t("common.cancel")
           }}</el-button>
         </el-form-item>
       </el-form>
     </el-dialog>
-    <el-dialog
-      title="鏁版嵁鐢宠"
-      :visible.sync="dialogInsertVisible"
-      width="30%"
-      top="35vh"
-      :modal="false"
-      :before-close="handleInsertClose"
-    >
-      <div style="width: 100%; max-height: 450px; overflow-y: auto">
-        <el-form ref="form" :model="ruleForm" label-width="100px">
-          <el-form-item label="瀹℃牳鍗曚綅">
-            <div>
-              <ul>
-                <li v-for="item in ruleForm.depid">
-                  {{ item.name }}
-                </li>
-              </ul>
-            </div>
-          </el-form-item>
-          <el-form-item label="琛ㄥ悕">
-            <div>
-              <ul>
-                <li v-for="item in ruleForm.tabs">
-                  {{ item.tabDesc }}
-                </li>
-              </ul>
-            </div>
-          </el-form-item>
-          <el-form-item label="鏉′欢">
-            <el-input
-              :title="ruleForm.wkt"
-              v-model="ruleForm.wkt"
-              disabled
-            ></el-input>
-          </el-form-item>
-          <el-form-item label="鎻忚堪">
-            <el-input
-              type="textarea"
-              placeholder="璇疯緭鍏ュ唴瀹�"
-              v-model="ruleForm.descr"
-              maxlength="50"
-              show-word-limit
-            >
-            </el-input>
-          </el-form-item>
-          <el-form-item>
-            <el-button class="primary" size="small" @click="getInsertDown">{{
-              $t("common.confirm")
-            }}</el-button>
-            <el-button type="info" size="small" @click="closeInsertDown">{{
-              $t("common.cancel")
-            }}</el-button>
-          </el-form-item>
-        </el-form>
-      </div>
-    </el-dialog>
+
     <iframe
       id="Iframe1"
       src=""
@@ -182,6 +144,7 @@
   decr,
   encr,
   dataLib_selectDepsByIds,
+  dataLib_selectDbOverflowDep
 } from "../../api/api.js"
 import { getToken } from "@/utils/auth"
 import $ from "jquery"
@@ -263,19 +226,28 @@
       optionx: [],
       imagePoint: null,
       Layerprimit: null,
+      insertOption: null,
+      isflag: true,
     }
   },
   methods: {
-    getInsertDown() {
-      this.dialogInsertVisible = false
-      this.dialogVisible = true
+    getInsertDown(res) {
+
+      // this.dialogInsertVisible = false
+      // this.dialogVisible = true
+      if (this.isflag) {
+        this.codeForm = res;
+        this.download1();
+        this.isflag = false
+      }
+
     },
     handleInsertClose() {
       this.$confirm("纭鍏抽棴锛�")
         .then(_ => {
           this.closeInsertDown()
         })
-        .catch(_ => {})
+        .catch(_ => { })
     },
     closeInsertDown() {
       this.ruleForm = {
@@ -289,28 +261,105 @@
       this.dialogInsertVisible = false
     },
     async getDownloadDep() {
-      var std = []
+      this.$bus.$emit("setDialogInsertVisible", true)
+
+      // var std = []
+      // for (var i in this.option) {
+      //   std.push(this.option[i].entity)
+      // }
+      // var obj = {
+      //   entities: std,
+      //   wkt: this.listdata.wkt,
+      // }
+      // const data = await dataQuery_selectDbOverflowDep(JSON.stringify(obj))
+      // if (data.code != 200) {
+      //   this.$message.error("鏁版嵁璇锋眰澶辫触")
+      //   return
+      // }
+
+      // if (data.result.length == 0 || data.result == null) {
+      //   this.insertFlag = 1
+      //   // this.dialogVisible = true
+      //   
+      // } else {
+      //   this.insertFlag = 2
+      //   var std = []
+      //   this.insertOption.ids = data.result
+      //   var val = ""
+      //   for (var i in data.result) {
+      //     if (val == "") {
+      //       val += "codes=" + data.result[i]
+      //     } else {
+      //       val += "&codes=" + data.result[i]
+      //     }
+
+      //     std.push({
+      //       name: data.result[i],
+      //     })
+      //   }
+      //   const data1 = await dataLib_selectDepsByIds(val)
+
+      //   this.ruleForm.depid = data1.result
+      //   this.ruleForm.depname = std
+      //   this.ruleForm.wkt = decr(this.listdata.wkt)
+      //   this.ruleForm.tabs = this.option
+      //   // this.dialogInsertVisible = true
+      //   this.$bus.$emit("setDialogInsertVisible", this.ruleForm)
+      // }
+    },
+    async signGetPublicKey() {
+      const res = await sign_getPublicKey()
+      if (res && res.code == 200) {
+        window.encrypt = new JSEncrypt()
+        encrypt.setPublicKey(res.result)
+      }
+    },
+    async download1() {
+      if (this.codeForm.password == "") return
+
+      var entities = [];
       for (var i in this.option) {
-        std.push(this.option[i].entity)
+        entities.push(this.option[i].entity)
       }
       var obj = {
-        entities: std,
+        pwd: encrypt.encrypt(this.codeForm.password),
+        entities: entities,
         wkt: this.listdata.wkt,
+        filter: null,
+        ids: null,
+        depcode: null,
+        dirs: null
       }
-      const data = await dataQuery_selectDbOverflowDep(JSON.stringify(obj))
+      const data = await dataLib_selectDbOverflowDep(obj)
       if (data.code != 200) {
-        this.$message.error("鏁版嵁璇锋眰澶辫触")
         return
       }
 
-      if (data.result.length == 0 || data.result == null) {
-        this.insertFlag = 1
-        this.dialogVisible = true
+      if (data.result.length == 0) {
+        var that = this;
+
+        $.ajax({
+          url: BASE_URL + "/dataLib/downloadDbData?token=" + getToken(),
+          type: "POST",
+          data: JSON.stringify(obj),
+          dataType: 'json', // html銆乯son銆乯sonp銆乻cript銆乼ext
+          contentType: "application/json", // "application/x-www-form-urlencoded"
+          success: (data) => {
+            if (data.code == 200) {
+
+              if (data.result) {
+                that.selectDownloadFile(data.result, obj.pwd)
+              }
+
+            }
+          },
+          error: function (e) {
+          }
+        });
       } else {
-        this.insertFlag = 2
-        var std = []
-        this.insertOption.ids = data.result
+
         var val = ""
+        var std = [];
         for (var i in data.result) {
           if (val == "") {
             val += "codes=" + data.result[i]
@@ -323,65 +372,86 @@
           })
         }
         const data1 = await dataLib_selectDepsByIds(val)
-
         this.ruleForm.depid = data1.result
         this.ruleForm.depname = std
         this.ruleForm.wkt = decr(this.listdata.wkt)
         this.ruleForm.tabs = this.option
-        this.dialogInsertVisible = true
+        this.$bus.$emit("setDialogInsertVisible", this.ruleForm)
       }
+
+      // if (this.insertFlag == 1) {
+
+      //   for (var i in this.option) {
+      //     obj.entities.push(this.option[i].entity)
+      //   }
+      //   var token = getToken()
+      //   var that = this
+      //   $.ajax(BASE_URL + "/dataLib/downloadDbReq?token=" + token, {
+      //     type: "post",
+      //     data: JSON.stringify(obj),
+      //     async: true,
+      //     cache: false,
+      //     processData: false,
+      //     contentType: false,
+      //     success: res => {
+      //       if (res.code != 200) {
+      //         return
+      //       }
+
+      //       this.selectDownloadFile(res.result, obj.pwd)
+      //     },
+      //   })
+      // } else if (this.insertFlag == 2) {
+      //   var std = []
+      //   var std1 = []
+      //   for (var i in this.option) {
+      //     std.push(this.option[i].tabDesc)
+      //     std1.push(this.option[i].entity)
+      //   }
+      //   var obj = {
+      //     depcodes: this.insertOption.ids,
+      //     pwd: encr(this.codeForm.password),
+      //     tabs: std,
+      //     entities: std1,
+      //     wkt: this.listdata.wkt,
+      //     descr: this.ruleForm.descr,
+      //   }
+      //   const data1 = await apply_insertApply(JSON.stringify(obj))
+
+      //   this.closeDown()
+      // }
     },
-    async signGetPublicKey() {
-      const res = await sign_getPublicKey()
-      if (res && res.code == 200) {
-        window.encrypt = new JSEncrypt()
-        encrypt.setPublicKey(res.result)
-      }
-    },
-    async download() {
-      if (this.codeForm.password == "") return
-      if (this.insertFlag == 1) {
-        var obj = {
-          pwd: encrypt.encrypt(this.codeForm.password),
-          entities: [],
-          wkt: this.listdata.wkt,
+    async getInsertApply(res) {
+
+      if (!this.isflag) {
+        var entities = [];
+        var tabs = [];
+        if (this.option.length != res.tabs.length) {
+          return
         }
+
         for (var i in this.option) {
-          obj.entities.push(this.option[i].entity)
+          entities.push(this.option[i].entity)
+          tabs.push(this.option[i].tabDesc)
         }
-        var token = getToken()
-        var that = this
-        $.ajax(BASE_URL + "/dataLib/downloadDbReq?token=" + token, {
-          type: "post",
-          data: JSON.stringify(obj),
-          async: true,
-          cache: false,
-          processData: false,
-          contentType: false,
-          success: res => {
-            if (res.code != 200) {
-              return
-            }
-            this.selectDownloadFile(res.result, obj.pwd)
-          },
-        })
-      } else if (this.insertFlag == 2) {
-        var std = []
-        var std1 = []
-        for (var i in this.option) {
-          std.push(this.option[i].tabDesc)
-          std1.push(this.option[i].entity)
+        var std = [];
+        for (var i in this.ruleForm.depname) {
+          std.push(this.ruleForm.depname[i].name)
         }
         var obj = {
-          depcodes: this.insertOption.ids,
           pwd: encr(this.codeForm.password),
-          tabs: std,
-          entities: std1,
+          entities: entities,
           wkt: this.listdata.wkt,
-          descr: this.ruleForm.descr,
+          filter: null,
+          ids: null,
+          depcode: null,
+          dirs: null,
+          depcodes: std,
+          descr: res.descr,
+          tabs: tabs
         }
-        const data1 = await apply_insertApply(JSON.stringify(obj))
-        if (data1.code != 200) {
+        const data = await apply_insertApply(JSON.stringify(obj))
+        if (data.code != 200) {
           this.$message.error("鏁版嵁鐢宠澶辫触")
           return
         }
@@ -389,20 +459,25 @@
           message: "鏁版嵁鐢宠鎴愬姛",
           type: "success",
         })
-
-        this.closeDown()
+        this.isflag = true;
       }
     },
+
+
+
+
     async selectDownloadFile(rsid, rspwd) {
       var downObj = {
         guid: rsid,
         pwd: encodeURIComponent(rspwd),
       }
       const data = await dataLib_selectDownloadFile(downObj)
+
       if (data.code != 200) {
         this.$message.error("涓嬭浇璇锋眰澶辫触")
         return
       }
+
       this.closeDown()
       var token = getToken()
       var url =
@@ -414,19 +489,20 @@
         "&pwd=" +
         encodeURIComponent(rspwd)
       $("#Iframe1").attr("src", url).click()
+      // this.isflag = true;
     },
     handleCloseDown() {
       this.$confirm("纭鍏抽棴锛�")
         .then(_ => {
           this.closeDown()
         })
-        .catch(_ => {})
+        .catch(_ => { })
     },
     closeDown() {
       this.dialogVisible = false
       this.codeForm.password = ""
       this.codeForm.repassword = ""
-      this.closeInsertDown()
+      // this.closeInsertDown()
     },
     startTableMssage() {
       this.listdata.pageIndex = 1
@@ -467,14 +543,21 @@
       this.getTableDateHidder()
     },
     async getTableDateHidder() {
+      this.$store.state.loading = true;
       const data = await inquiry_selectFields({ name: this.listdata.name })
       if (data.code != 200) {
         this.$message.error("鍒楄〃璋冪敤澶辫触")
+      }
+      if (data.result.length == 0) {
+        this.$message("鍒楄〃瀛楁鏌ユ棤鏁版嵁")
       }
       const data1 = await inquiry_selectDomains({ name: this.listdata.name })
       if (data1.code != 200) {
         this.$message.error("鍒楄〃璋冪敤澶辫触")
       }
+      // if (data.result.length == 0) {
+      //   this.$message("鍒楄〃闃堝�兼煡鏃犳暟鎹�")
+      // }
       this.optionx = []
       this.attributeData = []
       var valadata = data.result
@@ -507,7 +590,9 @@
       if (data.code != 200) {
         this.$message.error("鍒楄〃璋冪敤澶辫触")
       }
-
+      // if (data.result.length == 0) {
+      //   return this.$message.error("鍒楄〃鏌ユ棤鏁版嵁")
+      // }
       var val1 = decr(data.result)
       if (val1) {
         if (this.imagePoint != null) {
@@ -614,6 +699,7 @@
           this.$store.state.propertiesFlag = "1"
           let properties = pick.id.properties
           let propertyNames = pick.id.properties.propertyNames
+
           let obj = {}
           obj["eventid"] = properties["_eventid"]._value
           //
@@ -624,6 +710,7 @@
               }
             })
           })
+
           this.$store.state.propertiesInfo = obj
         }
       }, Cesium.ScreenSpaceEventType.LEFT_CLICK)
@@ -632,6 +719,7 @@
       this.listdata.pageIndex = 1
       this.listdata.pageSize = 10
       this.listdata.name = res.entity
+
       this.$store.state.propertiesName = res
       this.getTableDateHidder()
     },
@@ -648,9 +736,15 @@
       this.tableData = []
 
       const data = await dataQuery_selectByPage(this.listdata)
+      this.$store.state.loading = false;
       if (data.code != 200) {
-        this.$message.error("鍒楄〃璋冪敤澶辫触")
+        return this.$message.error("鍒楄〃璋冪敤澶辫触")
       }
+      if (data.result.length == 0) {
+
+        return this.$message.error("鍒楄〃鏌ユ棤鏁版嵁")
+      }
+
 
       var val_Data = data.result
       for (var i in val_Data) {
@@ -665,9 +759,57 @@
         }
       }
       this.pageCount = data.count
-      this.tableData = data.result
+
+
+      var val = data.result;
+      val = val.filter((res) => {
+
+        if (res.dirName) {
+          res.dirid = res.dirName
+        }
+        if (res.depName) {
+          res.depid = res.depName
+        }
+        if (res.verName) {
+          res.verid = res.verName
+        }
+        if (res.updateName) {
+          res.updateuser = res.updateName
+        }
+        if (res.createName) {
+          res.createuser = res.createName
+        }
+
+        if (res.createtime) {
+          res.createtime = this.format(res.createtime)
+        }
+        if (res.updatetime) {
+          res.createtime = this.format(res.updatetime)
+        }
+        return res
+      })
+
+
+
+      this.tableData = val
       this.$refs.dialogPayChannel.doLayout()
       // this.showAllImage(data.result)
+    },
+    //鏍煎紡鍖栨椂闂�
+    format(shijianchuo) {
+      //shijianchuo鏄暣鏁帮紝鍚﹀垯瑕乸arseInt杞崲
+      var time = new Date(shijianchuo);
+      var y = time.getFullYear();
+      var m = time.getMonth() + 1;
+      var d = time.getDate();
+      var h = time.getHours();
+      var mm = time.getMinutes();
+      var s = time.getSeconds();
+      return y + "-" + this.add0(m) + "-" + this.add0(d);
+    },
+    //鏍煎紡鍖栨椂闂�
+    add0(m) {
+      return m < 10 ? "0" + m : m;
     },
     async showAllImage(res) {
       for (var i in res) {
@@ -802,18 +944,32 @@
     },
   },
   created() {
+
     this.setTableAll()
+
   },
   mounted() {
+
     this.$bus.$on("changeMapMenuTop", res => {
       if (res == "true") {
         this.setTableAll()
       }
     })
+    this.$bus.$on("setInsertDown2", res => {
+      this.getInsertDown(res)
+    })
+    this.$bus.$on("setInsertDown1", res => {
+      this.isflag = true;
+      this.getInsertDown(res)
+    })
+    this.$bus.$on("setInsertApply1", res => {
+
+      this.getInsertApply(res)
+    })
   },
   destroyed() {
     this.$store.state.propertiesFlag = null
-    if (propertieshandler != null && Cesium.defined(propertieshandler)) {
+    if (window.propertieshandler != null && Cesium.defined(window.propertieshandler)) {
       window.propertieshandler.removeInputAction(
         Cesium.ScreenSpaceEventType.LEFT_CLICK
       )

--
Gitblit v1.9.3