| | |
| | | </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 |
| | |
| | | <el-button v-else class="ztzf-button" @click="synchronize"> 同步 </el-button> |
| | | </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" |
| | |
| | | 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; |
| | | checkedNodes.value = allFenceNodes; |
| | |
| | | coverData.value = folderChildren; |
| | | emit('update:coverData', coverData.value); |
| | | } else { |
| | | 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) { |