From 4a080fd0160843583c49e05110b4d6e767502e86 Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Fri, 31 Oct 2025 11:46:01 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/图层管理' into 图层管理

---
 src/views/layerManagement/components/leftList.vue |   43 +++++++++++++++++++++++++++++++++++++++----
 1 files changed, 39 insertions(+), 4 deletions(-)

diff --git a/src/views/layerManagement/components/leftList.vue b/src/views/layerManagement/components/leftList.vue
index 7e32952..2cd93c2 100644
--- a/src/views/layerManagement/components/leftList.vue
+++ b/src/views/layerManagement/components/leftList.vue
@@ -12,10 +12,20 @@
       </div>
     </div>
     <div class="btnGroups">
-      <el-button class="ztzf-button" @click="addFence">{{
+      <el-button v-if="activeName !== '国土空间规划'" class="ztzf-button" @click="addFence">{{
         props.activeName === '电子围栏' ? '新增围栏' : '新增禁飞区'
       }}</el-button>
-      <el-button class="ztzf-button" @click="addFolder">新增文件夹</el-button>
+      <el-button v-if="activeName !== '国土空间规划'" class="ztzf-button" @click="addFolder">新增文件夹</el-button>
+      <el-upload
+        v-if="activeName === '国土空间规划'"
+        action="#"
+        :show-file-list="false"
+        :before-upload="e => uploadFlightFile(e, '1')"
+        accept=".zip"
+      >
+        <el-button class="ztzf-button"> 上传 </el-button>
+      </el-upload>
+
       <el-button class="ztzf-button" @click="selectAll">全选</el-button>
     </div>
     <div class="tableListBox">
@@ -58,7 +68,7 @@
 
 <script setup>
 import { ElMessage } from 'element-plus';
-import { treeDataApi, deleteFenceApi,deleteFolderApi } from '@/api/layer/index';
+import { treeDataApi, deleteFenceApi, deleteFolderApi, spatialPlanningApi } from '@/api/layer/index';
 import { inject, onMounted } from 'vue';
 const emit = defineEmits(['update:coverData', 'update:deitData', 'newFencesMethods']);
 import EventBus from '@/utils/eventBus';
@@ -195,6 +205,7 @@
         type: 'success',
       });
     }
+  gettreeDataApi();
   });
 
 }else if(node.data.level === 3){
@@ -205,9 +216,9 @@
         type: 'success',
       });
     }
+  gettreeDataApi();
   });
 }
-  gettreeDataApi();
 };
 // 新增围栏
 const addFence = () => {
@@ -230,6 +241,25 @@
     layerParams.value.fileType = 2;
   }
 };
+
+function uploadFlightFile(file, t) {
+  const fileSuffix = file.name.substring(file.name.lastIndexOf('.') + 1);
+  if (!['zip'].includes(fileSuffix)) {
+    return ElMessage.error('请上传zip格式的文件');
+  }
+  let data = new FormData();
+  const params = {
+    file: file,
+    fileName: file.name,
+  };
+  Object.keys(params).forEach(key => {
+    data.append(key, params[key]);
+  });
+  spatialPlanningApi(data).then(res =>{
+    ElMessage.success('上传成功');
+    gettreeDataApi();
+  })
+}
 
 onMounted(() => {
   gettreeDataApi();
@@ -300,6 +330,11 @@
 .btnGroups {
   margin: 12px 0 14px 0;
   display: flex;
+  gap: 0 10px;
+
+  .el-button{
+    margin: 0 !important;
+  }
 }
 .tableListBox {
   //:deep(.el-tree-node__content) {

--
Gitblit v1.9.3