完善阵位分配命令的变量数据加载

This commit is contained in:
2026-04-15 17:22:22 +08:00
parent a08e061979
commit dbbc8a27c3
3 changed files with 25 additions and 31 deletions

View File

@@ -156,20 +156,14 @@ export default defineComponent({
}
// 加载下属平台
const loadSubPlatforms = (treeId: number) => {
console.log(treeId);
if (!treeId || treeId <= 0) {
const loadSubPlatforms = (platformId: number | null) => {
if (!platformId || platformId <= 0) {
subPlatforms.value = [];
return;
}
findSubPlatforms(treeId).then(r => {
if (r.data && Array.isArray(r.data)) {
subPlatforms.value = r.data as Platform[];
} else {
subPlatforms.value = [];
}
findSubPlatforms(platformId).then(r => {
subPlatforms.value = r.data ?? [];
}).catch(err => {
console.error('加载下属平台失败:', err);
subPlatforms.value = [];
@@ -292,7 +286,7 @@ export default defineComponent({
currentTreeEditing.value = true;
// 加载下属平台
loadSubPlatforms(r.data.id);
loadSubPlatforms(r.data.platformId);
nextTick(() => {
initGraph();
@@ -508,6 +502,7 @@ export default defineComponent({
loadDatasource();
});
// 清理
onBeforeUnmount(() => destroy());