UPDATE: VERSION-20260316

This commit is contained in:
libertyspy
2026-03-16 15:48:33 +08:00
parent c17197d6e5
commit 8dc867acb6
12 changed files with 239 additions and 34 deletions

View File

@@ -63,6 +63,7 @@ import { createGraphScenarioElement, createGraphTaskElementFromScenario } from '
import PlatformCard from './platform-card.vue';
import NodesCard from './nodes-card.vue';
import { saveScenario } from './api';
import {resolveConnectionRelation} from './relation'
const TeleportContainer = defineComponent(getTeleport());
@@ -194,7 +195,6 @@ export default defineComponent({
};
const handleSelect = (scenario: Scenario) => {
console.info('handleSelect', scenario);
let nodeGraph: GraphContainer | null = null;
try {
nodeGraph = JSON.parse(scenario.communicationGraph as unknown as string) as unknown as GraphContainer;
@@ -210,10 +210,10 @@ export default defineComponent({
currentScenario.value = {
...scenario,
graph: nodeGraph,
relations: []
};
currentScenarioEditing.value = true;
createElements();
};
const createElements = () => {
@@ -228,7 +228,6 @@ export default defineComponent({
if (currentScenario.value?.graph.nodes) {
currentScenario.value?.graph.nodes.forEach(ele => {
const node = createGraphScenarioElement(ele as GraphTaskElement);
console.info('create node: ', ele);
// 将节点添加到画布
graph.value?.addNode(node as Node);
});
@@ -255,10 +254,11 @@ export default defineComponent({
name: null,
description: null,
communicationGraph: null,
relations: [],
graph: {
edges: [],
nodes: [],
}
},
};
currentGraph.value = {
edges: [],
@@ -341,6 +341,10 @@ export default defineComponent({
const handleSave = () => {
const graphData: GraphContainer = resolveGraph(graph.value as Graph);
const relations = resolveConnectionRelation(graph.value as Graph);
console.error('relations',relations)
console.info('handleSave', graphData);
if (!currentScenario.value) {
message.error('当前决策树不存在');
@@ -350,6 +354,7 @@ export default defineComponent({
...currentScenario.value,
graph: graphData,
communicationGraph: JSON.stringify(graphData),
relations: relations
};
if (!newScenario.name) {
message.error('场景名称不能为空.');