UPDATE: VERSION-20260327

This commit is contained in:
libertyspy
2026-03-27 10:03:16 +08:00
parent 27c8fc13c6
commit 499734efe8
4 changed files with 27 additions and 6 deletions

View File

@@ -309,9 +309,18 @@ export default defineComponent({
currentScenarioEditing.value = null !== currentScenario.value;
});
handleGraphEvent('node:dblclick', () => {
destroy()
window.location.href = '/app/decision/designer'
handleGraphEvent('node:dblclick', (args: any) => {
const node = args.node as Node<NodeProperties>;
const element = node.getData() as GraphTaskElement;
console.error('element',element)
if(element && element.platformId ){
window.location.href = `/app/decision/designer?platform=${element.platformId}`
} else {
window.location.href = '/app/decision/designer'
}
// destroy()
// window.location.href = '/app/decision/designer'
// router.push({
// path: '/app/decision/designer'
// })

View File

@@ -24,6 +24,10 @@ export const findTreesByQuery = (query: Partial<BehaviorTreeRequest> = {}): Prom
return req.get<BehaviorTreePageResponse>('/system/behaviortree/list', query);
};
export const findOneTreeByPlatformId = (platformId: number): Promise<BehaviorTreeDetailsResponse> => {
return req.get(`/system/behaviortree/platform/${platformId}`);
};
export const findOneTreeById = (id: number): Promise<BehaviorTreeDetailsResponse> => {
return req.get(`/system/behaviortree/${id}`);
};

View File

@@ -52,6 +52,7 @@
<script lang="ts">
import { defineComponent, nextTick, onBeforeUnmount, onMounted, ref } from 'vue';
import { useRoute } from 'vue-router';
import { message } from 'ant-design-vue';
import { getTeleport } from '@antv/x6-vue-shape';
import { Graph, Node, type NodeProperties } from '@antv/x6';
@@ -68,7 +69,7 @@ import { createGraphTaskElement, createLineOptions, type GraphContainer, type Gr
import { registerNodeElement } from './register';
import { findAllBasicPlatforms } from '../api';
import type { Platform } from '../types';
import { createTree, findOneTreeById, updateTree } from './api';
import { createTree, findOneTreeById, updateTree, findOneTreeByPlatformId } from './api';
import TressCard from './trees-card.vue';
import NodesCard from './nodes-card.vue';
@@ -90,6 +91,7 @@ export default defineComponent({
TeleportContainer,
},
setup() {
const currentRoute = useRoute();
const canvas = ref<HTMLDivElement | null>(null);
const graph = ref<Graph | null>(null);
const currentZoom = ref<number>(1);
@@ -350,6 +352,14 @@ export default defineComponent({
initGraph();
window.addEventListener('resize', handleResize);
console.log('节点挂载完成');
if(currentRoute.query.platform){
findOneTreeByPlatformId(currentRoute.query.platform as number).then(r=> {
if(r.data){
handleSelectTree(r.data);
}
})
}
});
};

View File

@@ -198,8 +198,6 @@ export default defineComponent({
const multiableParameters = ref<boolean>(false);
const groupedParametersActiveTab = ref<number>(0);
console.error(platforms.value)
const createEmptyParameters = (): ElementParameter[] => {
try {
return JSON.parse(JSON.stringify(currentElement.value?.parameters ?? [])) as ElementParameter[];