Initial commit

This commit is contained in:
libertyspy
2026-02-08 16:01:21 +08:00
parent 9ded6b757c
commit c9d5c38b52
11 changed files with 137 additions and 101 deletions

View File

@@ -46,10 +46,10 @@
</div>
<Properties
v-if="graph"
@update-element="handleUpdateElement"
:element="selectedNodeTaskElement"
:graph="graph as any"
:node="selectedModelNode as any"
@update-element="handleUpdateElement" />
:node="selectedModelNode as any" />
</div>
</a-layout>
</a-layout>
@@ -60,7 +60,7 @@
import { defineComponent, nextTick, onBeforeUnmount, onMounted, ref } from 'vue';
import { message } from 'ant-design-vue';
import { getTeleport } from '@antv/x6-vue-shape';
import { Graph, Node, type NodeProperties } from '@antv/x6';
import { Graph, Node,Edge, type NodeProperties } from '@antv/x6';
import { CheckCircleOutlined, CheckOutlined, RollbackOutlined, SaveOutlined } from '@ant-design/icons-vue';
import { Wrapper } from '@/components/wrapper';
import { safePreventDefault, safeStopPropagation } from '@/utils/event';
@@ -100,7 +100,7 @@ export default defineComponent({
const currentTreeModelGraph = ref<TreeModelGraph | null>(null);
const selectedModelNode = ref<Node<NodeProperties> | null>(null);
const selectedNodeTaskElement = ref<SettingTaskNodeElement | null>(null);
const changed = ref<boolean>(false);
const changed = ref<boolean>(false)
const {
handleGraphEvent,
@@ -201,32 +201,32 @@ export default defineComponent({
};
const createElements = () => {
if (graph.value && currentTreeModelGraph.value) {
if(graph.value && currentTreeModelGraph.value){
graph.value.clearCells();
setTimeout(() => {
nextTick(() => {
try {
if (currentTreeModelGraph.value && !currentTreeModelGraph.value?.graph) {
setTimeout(()=> {
nextTick(()=> {
try{
if (currentTreeModelGraph.value && !currentTreeModelGraph.value?.graph){
currentTreeModelGraph.value.graph = {
nodes: [],
edges: [],
};
}
}
const nodes = currentTreeModelGraph.value?.graph?.nodes ?? [];
const edges = currentTreeModelGraph.value?.graph?.edges ?? [];
const nodes = currentTreeModelGraph.value?.graph?.nodes ?? [];
const edges = currentTreeModelGraph.value?.graph?.edges ?? [];
nodes.forEach(n => {
nodes.forEach(n=> {
const node = createTaskNodeElement(n);
graph.value?.addNode(node as Node);
});
edges.forEach(g => {
graph.value?.addEdge(g as any);
});
} catch (e) {
console.warn('createElements', e);
})
edges.forEach(g=> {
graph.value?.addEdge( g as any);
})
} catch (e){
console.warn('createElements',e)
}
});
}, 200);
})
}, 200)
}
};
@@ -290,7 +290,7 @@ export default defineComponent({
console.info('handleUpdateElement', element);
// 更新本地引用
selectedNodeTaskElement.value = element;
changed.value = true;
changed.value = true
};
const handleSelectTree = (treeModel: TreeModel) => {