diff --git a/zdxt-web-client/zdxt-admin-plus-ui/src/views/efcode/virtualUnit/unitBuilder.vue b/zdxt-web-client/zdxt-admin-plus-ui/src/views/efcode/virtualUnit/unitBuilder.vue index 6155470a..67aa92cd 100644 --- a/zdxt-web-client/zdxt-admin-plus-ui/src/views/efcode/virtualUnit/unitBuilder.vue +++ b/zdxt-web-client/zdxt-admin-plus-ui/src/views/efcode/virtualUnit/unitBuilder.vue @@ -191,14 +191,28 @@ const settingForm = ref<{ virIncludeStatistics: string; virIncludeSearch: string; virShowAtBusiness: string; + virZone: number | null; virRemark: string; }>({ virIncludeStatistics: '是', virIncludeSearch: '是', virShowAtBusiness: '是', + virZone: null, virRemark: '' }); +const zoneOptions = [ + { value: 1, label: '市直' }, + { value: 2, label: '区' }, + { value: 3, label: '区直' }, + { value: 4, label: '街道' }, + { value: 5, label: '市公安' }, + { value: 6, label: '市消防' }, + { value: 15, label: '区公安' }, + { value: 16, label: '区消防' } +]; +const zoneMap = new Map(zoneOptions.map(o => [o.value, o.label])); + /** 点击 <-- 按钮打开设置窗口 */ const handleTransfer = () => { if (!selectedVirNode.value) { @@ -214,6 +228,7 @@ const handleTransfer = () => { virIncludeStatistics: '是', virIncludeSearch: '是', virShowAtBusiness: '是', + virZone: null, virRemark: '' }; settingDialogVisible.value = true; @@ -281,7 +296,17 @@ const handleConfirmAdd = async () => { await addVirtualUnit(form); ElMessage.success('添加成功'); settingDialogVisible.value = false; + // 记录当前父节点及其祖先,重新加载后保持展开 + const expandIds = parentNode.virAncestors + ? parentNode.virAncestors.split(',').concat(parentNode.virId) + : [parentNode.virId]; await loadVirtualUnitTree(); + // 确保父节点链路全部展开 + for (const id of expandIds) { + if (!defaultExpandedKeys.value.includes(id)) { + defaultExpandedKeys.value.push(id); + } + } } catch (e: any) { ElMessage.error(e.message || '添加失败'); } @@ -327,6 +352,7 @@ onMounted(() => { @@ -374,7 +400,7 @@ onMounted(() => { {{ row.virShowAtBusiness }} - +