From ddbf09a2eafae92300fa79d86bbb720ef7f64b0e Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Wed, 12 Nov 2025 11:06:05 +0800
Subject: [PATCH] feat:算法仓库图片地址调整
---
src/views/layerManagement/components/leftList.vue | 113 ++++++++++++++++++++++++++++++++------------------------
1 files changed, 65 insertions(+), 48 deletions(-)
diff --git a/src/views/layerManagement/components/leftList.vue b/src/views/layerManagement/components/leftList.vue
index 9480e72..e82fb2b 100644
--- a/src/views/layerManagement/components/leftList.vue
+++ b/src/views/layerManagement/components/leftList.vue
@@ -2,7 +2,7 @@
<div class="table-overlay">
<div class="searchBox">
<el-input
- class="ztzf-input inputName"
+ class="ztzf-layer-input inputName"
v-model="formData.dkbh"
placeholder="输入名称模糊搜索"
></el-input>
@@ -13,7 +13,7 @@
</div>
<div class="btnGroups">
<el-button v-if="activeName !== '国土空间规划'" class="ztzf-button" @click="addFence">{{
- props.activeName === '电子围栏' ? '新增围栏' : '新增禁飞区'
+ props.activeName === '自定义识别区' ? '新增识别区' : '新增禁飞区'
}}</el-button>
<el-button v-if="activeName !== '国土空间规划'" class="ztzf-button" @click="addFolder"
>新增文件夹</el-button
@@ -28,17 +28,25 @@
<el-button class="ztzf-button"> 上传 </el-button>
</el-upload>
- <template v-if="activeName === '自定义禁飞区'">
+ <!-- <template v-if="activeName === '自定义禁飞区'">
<template v-if="failuresInfo.length">
<el-button class="ztzf-button" @click="synchronize"> 继续同步 </el-button>
<el-button class="ztzf-button" @click="failuresDel"> 取消同步 </el-button>
</template>
<el-button v-else class="ztzf-button" @click="synchronize"> 同步 </el-button>
- </template>
+ </template> -->
- <el-button class="ztzf-button" @click="selectAll">全选</el-button>
+ <!-- <el-button class="ztzf-button" @click="selectAll">全选</el-button> -->
+ <el-button class="ztzf-button" @click="selectAll">
+ {{ checkedKeys.length === getAllFenceKeys().length ? '取消全选' : '全选' }}
+</el-button>
</div>
- <div class="tableListBox">
+ <div
+ class="tableListBox"
+ v-loading="loading"
+ element-loading-background="rgba(0, 0, 0, 0.5)"
+ element-loading-text="加载中..."
+ >
<el-tree
class="ztzf-el-tree"
:class="{ isTheTerritory: activeName === '国土空间规划' }"
@@ -65,11 +73,11 @@
<div class="tree-node-actions">
<el-button
link
- icon="el-icon-location"
+
@click.stop="handleLocation(node)"
- ></el-button>
- <el-button icon="el-icon-edit" link @click.stop="handleEdit(node)"></el-button>
- <el-button icon="el-icon-delete" link @click.stop="handleDelete(node)"></el-button>
+ >定位</el-button>
+ <el-button link @click.stop="handleEdit(node)">编辑</el-button>
+ <el-button link @click.stop="handleDelete(node)">删除</el-button>
</div>
</div>
</template>
@@ -106,17 +114,21 @@
dkbh: '',
patchesName: '',
});
+const loading = ref(false);
const treeData = ref([]);
const treeAllData = ref([]);
// 获取数据
const gettreeDataApi = async () => {
try {
+ loading.value = true;
const res = await treeDataApi();
treeAllData.value = res.data.data;
- console.log('接口数据', treeAllData.value);
+
setupWatch();
} catch (error) {
console.error('获取数据失败:', error);
+ } finally {
+ loading.value = false;
}
};
@@ -145,25 +157,28 @@
emit('update:coverData', coverData.value);
};
// 全选方法
+const getAllFenceKeys = () => {
+ return treeData.value.flatMap(
+ folder => folder.children.map(fence => fence.id)
+ );
+};
const selectAll = () => {
if (treeRef.value) {
- const allFenceKeys = treeData.value.flatMap(
- folder => folder.children.map(fence => fence.id) // folder 是 level 2,children 是 level 3
- );
-
+ const allFenceKeys = getAllFenceKeys();
const allFenceNodes = treeData.value.flatMap(folder => folder.children);
+
if (checkedKeys.value.length === allFenceKeys.length) {
- // 取消全选:清空 keys 和数据
+ // 取消全选
treeRef.value.setCheckedKeys([]);
checkedKeys.value = [];
checkedNodes.value = [];
coverData.value = [];
} else {
- // 全选:仅设置 level 3 节点的 id
+ // 全选
treeRef.value.setCheckedKeys(allFenceKeys);
- checkedKeys.value = allFenceKeys; // 同步更新 checkedKeys
- checkedNodes.value = allFenceNodes; // 存储 level 3 数据
- coverData.value = allFenceNodes; // 同步 coverData
+ checkedKeys.value = allFenceKeys;
+ checkedNodes.value = allFenceNodes;
+ coverData.value = allFenceNodes;
}
emit('update:coverData', coverData.value);
}
@@ -175,24 +190,28 @@
coverData.value = [];
if (node.data.level === 2) {
const folderChildren = node.data.children || [];
- const childrenIds = folderChildren.map(child => child.id);
- treeRef.value.setCheckedKeys(childrenIds);
- checkedKeys.value = childrenIds;
- checkedNodes.value = folderChildren;
+ // const childrenIds = folderChildren.map(child => child.id);
+ // treeRef.value.setCheckedKeys(childrenIds);
+ // checkedKeys.value = childrenIds;
+ // checkedNodes.value = folderChildren;
coverData.value = folderChildren;
-
emit('update:coverData', coverData.value);
} else {
- console.log('node', node.data);
- emit('update:coverData', [node.data]);
+ // const currentNodeId = node.data.id;
+ // treeRef.value.setCheckedKeys([currentNodeId]);
+ // checkedKeys.value = [currentNodeId];
+ // checkedNodes.value = [node.data];
+ coverData.value = [node.data];
+ emit('update:coverData', coverData.value);
}
};
+
// 编辑按钮事件
const handleEdit = node => {
if (node.data.level == 2) {
layerParams.value.editFolder = true;
layerParams.value.addAnEditingFolder = 2;
- if (props.activeName === '电子围栏') {
+ if (props.activeName === '自定义识别区') {
layerParams.value.fileType = 1;
} else if (props.activeName === '自定义禁飞区') {
layerParams.value.fileType = 2;
@@ -204,10 +223,10 @@
coverData.value = [];
layerParams.value.editNest = true;
layerParams.value.decideWhetherToAddOrEdit = 2;
- if (props.activeName === '电子围栏') {
+ if (props.activeName === '自定义识别区') {
layerParams.value.fenceType = 1; // 电子围栏类型标识
} else if (props.activeName === '自定义禁飞区') {
- layerParams.value.fenceType = 2; // 自定义禁飞区类型标识
+ layerParams.value.fenceType = 2; // 自定义禁飞区类型标识
}
emit('update:deitData', node.data);
}
@@ -248,7 +267,7 @@
const addFence = () => {
layerParams.value.addNest = true;
layerParams.value.decideWhetherToAddOrEdit = 1;
- if (props.activeName === '电子围栏') {
+ if (props.activeName === '自定义识别区') {
layerParams.value.fenceType = 1; // 电子围栏类型标识
} else if (props.activeName === '自定义禁飞区') {
layerParams.value.fenceType = 2; // 自定义禁飞区类型标识
@@ -259,7 +278,7 @@
const addFolder = () => {
layerParams.value.addFolder = true;
layerParams.value.addAnEditingFolder = 1;
- if (props.activeName === '电子围栏') {
+ if (props.activeName === '自定义识别区') {
layerParams.value.fileType = 1;
} else if (props.activeName === '自定义禁飞区') {
layerParams.value.fileType = 2;
@@ -349,13 +368,13 @@
position: absolute;
top: 0;
left: 0;
- height: 95%;
+height: calc(100% - 32px);
z-index: 99;
- width: 392px;
+ width: 382px;
overflow: hidden;
background: rgba(0, 0, 0, 0.8);
border-radius: 8px 8px 8px 8px;
- padding: 16px 12px;
+ padding: 16px 0 16px 12px;
display: flex;
flex-direction: column;
}
@@ -363,6 +382,7 @@
.searchBox {
display: flex;
margin-top: 10px;
+padding-right: 12px;
.inputName {
width: 184px;
height: 32px;
@@ -407,25 +427,21 @@
margin: 12px 0 14px 0;
display: flex;
gap: 0 10px;
-
+padding-right: 12px;
.el-button {
margin: 0 !important;
}
}
.tableListBox {
- //:deep(.el-tree-node__content) {
- // // 奇数行背景色
- // &:nth-child(odd) {
- // background-color: rgba(13, 43, 56, 0.5) !important;
- // }
- // // 偶数行背景色
- // &:nth-child(even) {
- // background-color: rgba(30, 45, 81, 0.5) !important;
- // }
- //}
overflow-y: scroll;
height: 0;
flex-grow: 1;
+ padding-right: 12px;
+ :deep(.el-tree-node__content) {
+ height: 38px !important;
+ line-height: 38px !important;
+ }
+
.isTheTerritory {
:deep() {
.el-tree-node__expand-icon {
@@ -448,10 +464,11 @@
.tree-node-actions {
display: flex;
- gap: 8px; // 按钮之间的间距
+ // gap: 8px; // 按钮之间的间距
button {
padding: 0; // 清除默认内边距
- color: #fff; // 按钮图标颜色
+ // color: #fff; // 按钮图标颜色
+ color: #409eff;
&:hover {
color: #409eff; // hover 时的颜色
}
--
Gitblit v1.9.3