From 9ce29c536ba2a636416c618761985e2b9a711ee6 Mon Sep 17 00:00:00 2001
From: lxl <lixuliang_hd@126.com>
Date: 星期四, 27 十月 2022 14:17:45 +0800
Subject: [PATCH] user

---
 src/views/Synthesis/inquire.vue |   89 +++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 83 insertions(+), 6 deletions(-)

diff --git a/src/views/Synthesis/inquire.vue b/src/views/Synthesis/inquire.vue
index e609d6b..fbf04fb 100644
--- a/src/views/Synthesis/inquire.vue
+++ b/src/views/Synthesis/inquire.vue
@@ -22,12 +22,26 @@
         </div>
         <div class="div_li">{{ $t(item.name) }}</div>
       </li>
+      <li v-if="analyStatus.upload" style="margin-left: 20px">
+        <div class="divli">
+          <div class="backimge5"><i class="el-icon-upload2"></i></div>
+        </div>
+        <div class="div_li">涓婁紶</div>
+      </li>
+      <li v-if="analyStatus.download" style="margin-left: 20px">
+        <div class="divli">
+          <div class="backimge5"><i class="el-icon-download"></i></div>
+        </div>
+        <div class="div_li">涓嬭浇</div>
+      </li>
     </ul>
   </div>
 </template>
 
 <script>
 import $ from 'jquery';
+import { removeToken, getToken } from '@/utils/auth';
+import { comprehensive_uploadShp } from '../../api/api';
 export default {
   data() {
     return {
@@ -69,9 +83,35 @@
         },
       ],
       rel_name: null,
+      analyStatus: {
+        upload: false,
+        download: false,
+      },
     };
   },
+  created() {
+    var cover_Id = this.$store.state.syntiesis.menu;
+    var cover_perms = this.$store.state.permsEntity;
+
+    for (var i = 0; i < cover_perms.length; i++) {
+      if (cover_perms[i].pid == cover_Id) {
+        this.showViewMenu(cover_perms[i]);
+      }
+    }
+  },
   methods: {
+    showViewMenu(res) {
+      if (res.cnName != '鏌ヨ') return;
+      console.log('鏌ヨ', res.tag);
+      switch (res.tag) {
+        case '/upload':
+          this.analyStatus.upload = true;
+          break;
+        case '/download':
+          this.analyStatus.download = true;
+          break;
+      }
+    },
     changeIquery(res) {
       if (res.id == '7') {
         this.getQueryFile();
@@ -86,10 +126,38 @@
     getQueryFile() {
       $('#getF').click();
     },
-    setQueryFile() {
+    async setQueryFile() {
       var val = document.getElementById('getF').files;
       if (!val || !val.length) return;
-      console.log(val);
+      var formData = new FormData();
+      var exts = ['.shp', '.shx', '.dbf', '.prj'];
+      var count = 0;
+      for (var i = 0; i < val.length; i++) {
+        var name = val[i].name.toLocaleLowerCase();
+        var ext = name.substring(name.lastIndexOf('.'));
+        if (exts.indexOf(ext) > -1) {
+          count++;
+          formData.append(val[i].name, val[i]); // fs.files[i].name,file
+        }
+      }
+      if (count != 4) {
+        alert('ShapeFile鏂囦欢閫夋嫨涓嶅叏锛�');
+        return;
+      }
+      const data = await comprehensive_uploadShp(formData);
+      debugger;
+      // $.ajax(BASE_URL + '/comprehensive/uploadShp?token=' + getToken(), {
+      //   type: 'post',
+      //   data: formData,
+      //   async: true,
+      //   cache: false,
+      //   processData: false,
+      //   contentType: false,
+      //   success: function (rs) {},
+      //   error: function (e) {
+      //     console.error(e);
+      //   },
+      // });
     },
   },
 };
@@ -139,6 +207,12 @@
 .e7 {
   background: url('../../assets/img/synthesis/鍥惧眰 24.png') no-repeat center;
 }
+
+.divli {
+  width: 100%;
+  height: 50%;
+  position: relative;
+}
 .backimge5 {
   width: 30px;
   height: 30px;
@@ -147,9 +221,12 @@
   background-size: 100% 100%;
   margin: 0% 30%;
 }
-.divli {
-  width: 100%;
-  height: 50%;
-  position: relative;
+.backimgex {
+  width: 30px;
+  height: 30px;
+  margin-left: 25px;
+  position: absolute;
+  background-size: 100% 100%;
+  margin: 0% 30%;
 }
 </style>

--
Gitblit v1.9.3