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

View File

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