UPDATE: VERSION-20260401

This commit is contained in:
libertyspy
2026-04-01 11:32:53 +08:00
parent 11e25fd0de
commit b97f9aa32b
2 changed files with 24 additions and 9 deletions

View File

@@ -114,6 +114,7 @@ export default defineComponent({
const platforms = ref<Platform[]>([]);
const nodeCommands = ref<NodeCommand[]>([])
const currentScenarioId = ref<number | null>(null);
const currentPlatformId = ref<number | null>(null);
const {
handleGraphEvent,
@@ -243,6 +244,8 @@ export default defineComponent({
const handleSelectTree = (tree: BehaviorTree) => {
destroyGraph();
currentPlatformId.value = null;
currentScenarioId.value = null;
console.info('handleSelectTree', tree);
findOneTreeById(tree.id).then(r => {
@@ -302,6 +305,21 @@ export default defineComponent({
});
};
const resolveQuery = ()=> {
let scenarioId = Number(currentRoute.query.scenario);
if (!isNaN(scenarioId)) {
currentScenarioId.value = scenarioId;
} else {
currentScenarioId.value = null;
}
let platformId = Number(currentRoute.query.platform);
if (!isNaN(platformId)) {
currentPlatformId.value = platformId;
} else {
currentPlatformId.value = null;
}
}
const handleCreateTree = () => {
destroyGraph();
@@ -312,6 +330,7 @@ export default defineComponent({
englishName: null,
xmlContent: null,
createdAt: null,
platformId: currentPlatformId.value,
graph: {
edges: [],
nodes: [],
@@ -387,16 +406,10 @@ export default defineComponent({
window.addEventListener('resize', handleResize);
console.log('节点挂载完成');
let scenarioId = Number(currentRoute.query.scenario);
if (!isNaN(scenarioId)) {
currentScenarioId.value = scenarioId;
} else {
currentScenarioId.value = null;
}
resolveQuery();
let platformId = Number(currentRoute.query.platform);
if (!isNaN(platformId)) {
findOneTreeByPlatformId(platformId).then(r => {
if (currentPlatformId.value) {
findOneTreeByPlatformId(currentPlatformId.value).then(r => {
if (r.data) {
handleSelectTree(r.data);
} else {
@@ -404,6 +417,7 @@ export default defineComponent({
}
});
} else {
currentPlatformId.value = null;
handleCreateTree();
}
});

View File

@@ -19,6 +19,7 @@ export interface BehaviorTree {
englishName: NullableString,
xmlContent: NullableString,
graph: GraphContainer
platformId: null | number
}
export interface BehaviorTreeRequest extends BehaviorTree {