UPDATE: VERSION-20260315
This commit is contained in:
@@ -19,27 +19,12 @@
|
||||
<div class="ks-model-builder-content">
|
||||
<div class="ks-model-builder-actions">
|
||||
<a-space>
|
||||
<!-- <a-tooltip v-if="graph && currentBehaviorTree" placement="top">-->
|
||||
<!-- <template #title>-->
|
||||
<!-- 保存-->
|
||||
<!-- </template>-->
|
||||
<!-- <a-popconfirm-->
|
||||
<!-- title="确定保存?"-->
|
||||
<!-- @confirm="handleSave"-->
|
||||
<!-- >-->
|
||||
<!-- <a-button class="ks-model-builder-save" size="small">-->
|
||||
<!-- <CheckOutlined />-->
|
||||
<!-- <span>保存</span>-->
|
||||
<!-- </a-button>-->
|
||||
<!-- </a-popconfirm>-->
|
||||
<!-- </a-tooltip>-->
|
||||
<a-button v-if="graph && currentBehaviorTree" class="ks-model-builder-save" size="small" @click="handleSave">
|
||||
<CheckOutlined />
|
||||
<span>保存</span>
|
||||
</a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
<!-- 画布容器,添加拖放事件 -->
|
||||
<div
|
||||
ref="canvas"
|
||||
class="ks-model-builder-canvas"
|
||||
@@ -74,14 +59,14 @@ import { Wrapper } from '@/components/wrapper';
|
||||
import { safePreventDefault, safeStopPropagation } from '@/utils/event';
|
||||
import Header from '../header.vue';
|
||||
import Properties from './properties.vue';
|
||||
import type { BehaviorTree, NodeDragTemplate, NodeTemplate } from '../types';
|
||||
import type { GraphTaskElement, NodeGraph } from '../builder/element';
|
||||
import { useGraphCanvas } from '../builder/hooks';
|
||||
import { registerNodeElement } from '../builder/register';
|
||||
import { createLineOptions } from '../builder/line';
|
||||
import type { NodeDragTemplate } from './template';
|
||||
import type { BehaviorTree } from './tree';
|
||||
import { createGraphTaskElementFromTemplate } from './utils';
|
||||
|
||||
import { createGraphTaskElement, createLineOptions, type GraphContainer, type GraphTaskElement, hasElements, hasRootElementNode, resolveGraph, useGraphCanvas } from '../graph';
|
||||
import { registerNodeElement } from './register';
|
||||
|
||||
import { createTree, findOneTreeById, updateTree } from './api';
|
||||
import { createGraphTaskElement, hasElements, hasRootElementNode, resolveNodeGraph } from '../builder/utils';
|
||||
import { createGraphTaskElementFromTemplate } from '../utils/node';
|
||||
import TressCard from './trees-card.vue';
|
||||
import NodesCard from './nodes-card.vue';
|
||||
|
||||
@@ -110,7 +95,7 @@ export default defineComponent({
|
||||
const isDraggingOver = ref(false);
|
||||
const currentTreeEditing = ref<boolean>(false);
|
||||
const currentBehaviorTree = ref<BehaviorTree | null>(null);
|
||||
const currentNodeGraph = ref<NodeGraph | null>(null);
|
||||
const currentGraph = ref<GraphContainer | null>(null);
|
||||
const selectedModelNode = ref<Node<NodeProperties> | null>(null);
|
||||
const selectedNodeTaskElement = ref<GraphTaskElement | null>(null);
|
||||
const changed = ref<boolean>(false);
|
||||
@@ -219,9 +204,9 @@ export default defineComponent({
|
||||
console.info('handleSelectTree', tree);
|
||||
findOneTreeById(tree.id).then(r => {
|
||||
if (r.data) {
|
||||
let nodeGraph: NodeGraph | null = null;
|
||||
let nodeGraph: GraphContainer | null = null;
|
||||
try {
|
||||
nodeGraph = JSON.parse(r.data?.xmlContent as unknown as string) as unknown as NodeGraph;
|
||||
nodeGraph = JSON.parse(r.data?.xmlContent as unknown as string) as unknown as GraphContainer;
|
||||
} catch (e: any) {
|
||||
console.error('parse error,cause:', e);
|
||||
}
|
||||
@@ -290,7 +275,7 @@ export default defineComponent({
|
||||
},
|
||||
updatedAt: null,
|
||||
};
|
||||
currentNodeGraph.value = {
|
||||
currentGraph.value = {
|
||||
edges: [],
|
||||
nodes: [],
|
||||
};
|
||||
@@ -370,7 +355,7 @@ export default defineComponent({
|
||||
};
|
||||
|
||||
const handleSave = () => {
|
||||
const graphData: NodeGraph = resolveNodeGraph(graph.value as Graph);
|
||||
const graphData: GraphContainer = resolveGraph(graph.value as Graph);
|
||||
console.info('handleSave', graphData);
|
||||
if (!currentBehaviorTree.value) {
|
||||
message.error('当前决策树不存在');
|
||||
@@ -429,7 +414,7 @@ export default defineComponent({
|
||||
handleCreateTree,
|
||||
currentTreeEditing,
|
||||
currentBehaviorTree,
|
||||
currentNodeGraph,
|
||||
currentGraph,
|
||||
selectedNodeTaskElement,
|
||||
selectedModelNode,
|
||||
graph,
|
||||
|
||||
Reference in New Issue
Block a user