| | |
| | | <el-button v-if="activeName !== '国土空间规划'" class="ztzf-button" @click="addFence">{{ |
| | | props.activeName === '电子围栏' ? '新增围栏' : '新增禁飞区' |
| | | }}</el-button> |
| | | <el-button v-if="activeName !== '国土空间规划'" 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="#" |
| | |
| | | |
| | | <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> |
| | | <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> |
| | | <el-button v-else class="ztzf-button" @click="synchronize"> 同步 </el-button> |
| | | </template> |
| | | |
| | | |
| | | <el-button class="ztzf-button" @click="selectAll">全选</el-button> |
| | | </div> |
| | | <div class="tableListBox"> |
| | | <el-tree |
| | | class="ztzf-el-tree" |
| | | :class="{isTheTerritory:activeName === '国土空间规划'}" |
| | | :class="{ isTheTerritory: activeName === '国土空间规划' }" |
| | | ref="treeRef" |
| | | v-model="checkedKeys" |
| | | :data="treeData" |
| | |
| | | <span>{{ node.label }}</span> |
| | | <!-- 操作按钮组 --> |
| | | <div class="tree-node-actions"> |
| | | <el-button link |
| | | <el-button |
| | | link |
| | | icon="el-icon-location" |
| | | @click.stop="handleLocation(node)" |
| | | ></el-button> |
| | |
| | | deleteFolderApi, |
| | | spatialPlanningApi, |
| | | failuresListApi, |
| | | failuresDelApi, areasUpdateApi |
| | | failuresDelApi, |
| | | areasUpdateApi, |
| | | } from '@/api/layer/index'; |
| | | import { inject, nextTick, onMounted, watch } from 'vue'; |
| | | const emit = defineEmits(['update:coverData', 'update:deitData', 'newFencesMethods']); |
| | |
| | | newVal => { |
| | | const matchedCategory = treeAllData.value.find(item => item.name === newVal); |
| | | treeData.value = matchedCategory.children; |
| | | nextTick(search) |
| | | nextTick(search); |
| | | if (treeData.value && treeData.value.length > 0) { |
| | | const folderNode = treeData.value[0]; |
| | | // 赋值给 layerParams |
| | |
| | | } |
| | | }; |
| | | // 定位按钮事件 |
| | | const handleLocation = (node) => { |
| | | checkedKeys.value = []; |
| | | checkedNodes.value = []; |
| | | coverData.value = []; |
| | | const handleLocation = node => { |
| | | checkedKeys.value = []; |
| | | checkedNodes.value = []; |
| | | coverData.value = []; |
| | | if (node.data.level === 2) { |
| | | const folderChildren = node.data.children || []; |
| | | const childrenIds = folderChildren.map(child => child.id); |
| | |
| | | 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]); |
| | | } else { |
| | | console.log('node', node.data); |
| | | emit('update:coverData', [node.data]); |
| | | } |
| | | }; |
| | | // 编辑按钮事件 |
| | |
| | | // 删除按钮事件 |
| | | const handleDelete = node => { |
| | | let id = node.data.id; |
| | | // 弹出确认弹框 |
| | | ElMessageBox.confirm( |
| | | '确定要删除该内容吗?', |
| | | '提示', |
| | | { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | } |
| | | ).then(() => { |
| | | // 点击确定,执行删除逻辑 |
| | | if (node.data.level === 2) { |
| | | deleteFolderApi(id).then(res => { |
| | | ElMessage.success('删除成功'); |
| | | gettreeDataApi(); |
| | | }); |
| | | } else if (node.data.level === 3) { |
| | | deleteFenceApi(id).then(res => { |
| | | ElMessage.success('删除成功'); |
| | | gettreeDataApi(); |
| | | }); |
| | | } |
| | | }).catch(() => { |
| | | // 点击取消,不执行操作 |
| | | ElMessage.warning('已取消删除'); |
| | | }); |
| | | ElMessageBox.confirm('确定要删除该内容吗?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | .then(() => { |
| | | if (node.data.level === 2) { |
| | | // 删除文件夹 |
| | | deleteFolderApi(id).then(res => { |
| | | ElMessage.success('删除成功'); |
| | | gettreeDataApi(); |
| | | // 通知父组件删除该文件夹下所有围栏的地图实体 |
| | | EventBus.emit('deleteMapEntitiesByFolderId', id); |
| | | }); |
| | | } else if (node.data.level === 3) { |
| | | // 删除单个围栏/禁飞区 |
| | | deleteFenceApi(id).then(res => { |
| | | ElMessage.success('删除成功'); |
| | | gettreeDataApi(); |
| | | // 通知父组件删除对应的地图实体 |
| | | EventBus.emit('deleteMapEntityById', id); |
| | | }); |
| | | } |
| | | }) |
| | | .catch(() => { |
| | | ElMessage.warning('已取消删除'); |
| | | }); |
| | | }; |
| | | // 新增围栏 |
| | | const addFence = () => { |
| | |
| | | Object.keys(params).forEach(key => { |
| | | data.append(key, params[key]); |
| | | }); |
| | | spatialPlanningApi(data).then(res =>{ |
| | | spatialPlanningApi(data).then(res => { |
| | | ElMessage.success('上传成功'); |
| | | gettreeDataApi(); |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | |
| | | function search() { |
| | | treeRef.value?.filter(formData.value.dkbh) |
| | | treeRef.value?.filter(formData.value.dkbh); |
| | | } |
| | | function reset() { |
| | | formData.value.dkbh = '' |
| | | treeRef.value?.filter('') |
| | | formData.value.dkbh = ''; |
| | | treeRef.value?.filter(''); |
| | | } |
| | | function filterNode(value,data) { |
| | | if (props.activeName === '国土空间规划'){ |
| | | if (!value) return (data.level===2 || data.level===1) |
| | | return (data.level===2 || data.level===1) && data.name.includes(value) |
| | | function filterNode(value, data) { |
| | | if (props.activeName === '国土空间规划') { |
| | | if (!value) return data.level === 2 || data.level === 1; |
| | | return (data.level === 2 || data.level === 1) && data.name.includes(value); |
| | | } |
| | | if (!value) return true |
| | | return data.name.includes(value) |
| | | if (!value) return true; |
| | | return data.name.includes(value); |
| | | } |
| | | |
| | | // 同步信息 |
| | | const failuresInfo = ref([]) |
| | | const failuresInfo = ref([]); |
| | | function failuresList() { |
| | | failuresListApi().then(res => { |
| | | failuresInfo.value = res.data.data || [] |
| | | }) |
| | | failuresInfo.value = res.data.data || []; |
| | | }); |
| | | } |
| | | |
| | | // 同步 |
| | | function synchronize() { |
| | | const data = failuresInfo.value.map(item => item.device_sn) |
| | | const data = failuresInfo.value.map(item => item.device_sn); |
| | | areasUpdateApi(data).then(res => { |
| | | if (res.data.data.length){ |
| | | if (res.data.data.length) { |
| | | let stringVal = res.data.data.reduce((acc, cur) => { |
| | | return acc + cur.nickname + '(' + cur.reason + ')' + ',' |
| | | }, '') |
| | | stringVal = stringVal.slice(0, -1) |
| | | return acc + cur.nickname + '(' + cur.reason + ')' + ','; |
| | | }, ''); |
| | | stringVal = stringVal.slice(0, -1); |
| | | ElMessageBox.alert(stringVal, '同步失败', { |
| | | confirmButtonText: '确定', |
| | | }) |
| | | }else{ |
| | | }); |
| | | } else { |
| | | ElMessage.success('同步成功'); |
| | | } |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | // 取消同步 |
| | | function failuresDel() { |
| | | failuresDelApi().then(res => { |
| | | ElMessage.success('取消同步成功'); |
| | | }) |
| | | }); |
| | | } |
| | | |
| | | onMounted(() => { |
| | | failuresList() |
| | | failuresList(); |
| | | gettreeDataApi(); |
| | | EventBus.on('gettreeDataApi', gettreeDataApi); |
| | | }); |
| | |
| | | display: flex; |
| | | gap: 0 10px; |
| | | |
| | | .el-button{ |
| | | .el-button { |
| | | margin: 0 !important; |
| | | } |
| | | } |
| | |
| | | // background-color: rgba(30, 45, 81, 0.5) !important; |
| | | // } |
| | | //} |
| | | overflow-y: scroll; |
| | | height: 0; |
| | | flex-grow: 1; |
| | | .isTheTerritory{ |
| | | :deep(){ |
| | | .el-tree-node__expand-icon{ |
| | | overflow-y: scroll; |
| | | height: 0; |
| | | flex-grow: 1; |
| | | .isTheTerritory { |
| | | :deep() { |
| | | .el-tree-node__expand-icon { |
| | | visibility: hidden; |
| | | } |
| | | } |