From 82fe506bd7ab485bb590ff8b5ee5401cbcaa0759 Mon Sep 17 00:00:00 2001
From: Surpriseplus <845948745@qq.com>
Date: 星期一, 26 十二月 2022 21:44:10 +0800
Subject: [PATCH] 数据申请页面

---
 src/components/MapView/mapMenuPop.vue |  279 +++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 247 insertions(+), 32 deletions(-)

diff --git a/src/components/MapView/mapMenuPop.vue b/src/components/MapView/mapMenuPop.vue
index cf0ce23..bff728f 100644
--- a/src/components/MapView/mapMenuPop.vue
+++ b/src/components/MapView/mapMenuPop.vue
@@ -1,6 +1,17 @@
 <template>
   <div class="menuPop">
     <div class="leftBox">
+      <div
+        class="leftDown"
+        v-if="$store.state.download"
+      >
+        <div @click="getDownloadDep">
+          <el-link
+            style="color:white"
+            icon="el-icon-download"
+          > </el-link>
+        </div>
+      </div>
       <ul>
         <li
           v-for="(item, index) in option"
@@ -25,7 +36,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"
@@ -72,14 +87,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"
@@ -91,13 +112,82 @@
             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.depname">
+                  {{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"
@@ -115,7 +205,9 @@
   dataQuerySelectWktById,
   sign_getPublicKey,
   dataLib_selectDownloadFile,
-  decr,
+  dataQuery_selectDbOverflowDep,
+  apply_insertApply,
+  decr, encr,
 } from "../../api/api.js";
 import { getToken } from "@/utils/auth";
 import $ from "jquery";
@@ -141,7 +233,17 @@
       }
     };
     return {
+      ruleForm: {
+        depname: [],
+        tabs: [],
+        pwd: null,
+        repwd: null,
+        wkt: null,
+        descr: null,
+      },
       dialogVisible: false,
+      dialogInsertVisible: false,
+      insertFlag: null,
       codeForm: {
         password: "",
         repassword: "",
@@ -155,6 +257,15 @@
           { required: true, message: "璇疯緭鍏ョ‘璁ゅ瘑鐮�", trigger: "blur" },
           { validator: repasswordValidator, trigger: "blur" },
         ],
+      },
+      insertOption: {
+        ids: [],
+        pwd: null,
+        tabs: [],
+        entity: [],
+        wkt: null,
+        descr: null,
+
       },
       listPage: {
         pageSize: 10,
@@ -182,6 +293,64 @@
     };
   },
   methods: {
+    getInsertDown() {
+      this.dialogInsertVisible = false;
+      this.dialogVisible = true;
+    },
+    handleInsertClose() {
+      this.$confirm('纭鍏抽棴锛�')
+        .then(_ => {
+          this.closeInsertDown();
+        })
+        .catch(_ => { });
+    },
+    closeInsertDown() {
+      this.ruleForm = {
+        depname: [],
+        tabs: [],
+        pwd: null,
+        repwd: null,
+        wkt: null,
+        descr: null,
+      }
+      this.dialogInsertVisible = false
+    },
+    async getDownloadDep() {
+      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;
+        for (var i in data.result) {
+          std.push({
+            name: data.result[i]
+          })
+        }
+        this.ruleForm.depname = std;
+        this.ruleForm.wkt = decr(this.listdata.wkt)
+        this.ruleForm.tabs = this.option;
+        this.dialogInsertVisible = true;
+      }
+
+    },
     async signGetPublicKey() {
       const res = await sign_getPublicKey();
       if (res && res.code == 200) {
@@ -189,32 +358,62 @@
         encrypt.setPublicKey(res.result);
       }
     },
-    download() {
+    async download() {
       if (this.codeForm.password == "") return;
-      var obj = {
-        pwd: encrypt.encrypt(this.codeForm.password),
-        entities: [],
-        wkt: this.listdata.wkt,
-      };
-      for (var i in this.option) {
-        obj.entities.push(this.option[i].entity);
+      if (this.insertFlag == 1) {
+        var obj = {
+          pwd: encrypt.encrypt(this.codeForm.password),
+          entities: [],
+          wkt: this.listdata.wkt,
+        };
+        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 = {
+          ids: 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))
+        if (data1.code != 200) {
+          this.$message.error("鏁版嵁鐢宠澶辫触");
+          return
+        }
+        this.$message({
+          message: '鏁版嵁鐢宠鎴愬姛',
+          type: 'success'
+        });
+      
+        this.closeDown();
       }
-      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);
-        },
-      });
+
     },
     async selectDownloadFile(rsid, rspwd) {
       var downObj = {
@@ -243,12 +442,13 @@
         .then((_) => {
           this.closeDown();
         })
-        .catch((_) => {});
+        .catch((_) => { });
     },
     closeDown() {
       this.dialogVisible = false;
       this.codeForm.password = "";
       this.codeForm.repassword = "";
+      this.closeInsertDown();
     },
     startTableMssage() {
       this.listdata.pageIndex = 1;
@@ -564,6 +764,12 @@
       color: #409eff;
       background: rgba(128, 128, 128, 0.2);
     }
+    .leftDown {
+      width: 94%;
+      padding: 3%;
+      display: flex;
+      justify-content: flex-end;
+    }
   }
 
   .rightBox {
@@ -683,6 +889,15 @@
     }
   }
 }
+li {
+  color: white;
+  line-height: 20px;
+  border-bottom: 1px solid white;
+  padding: 5px;
+}
+/deep/.el-textarea .el-input__count {
+  background: transparent;
+}
 </style>
 <style lang="less"></style>
 <style scoped lang="less"></style>

--
Gitblit v1.9.3