From c4208257699ff9f3919a1d6615f0812ba27c209f Mon Sep 17 00:00:00 2001 From: ChrisGray Date: Mon, 1 Jul 2024 20:38:21 +0800 Subject: [PATCH] - refactor(taskConfig) - refactor(store/task): rename from node - style(utils): jobLeafNode2G6Graph - style(utils): - style(utils): job2G6Tree --- src/G6/behaviorConfig.ts | 18 +++++---- .../{nodeConfig => taskConfig}/index.less | 0 .../{nodeConfig => taskConfig}/index.vue | 23 +++++------ src/pages/Home/components/RightBox.vue | 8 ++-- src/store/job.ts | 4 +- src/store/node.ts | 36 ----------------- src/store/task.ts | 35 +++++++++++++++++ src/utils/graphUtil.ts | 39 ++++++++----------- 8 files changed, 81 insertions(+), 82 deletions(-) rename src/components/{nodeConfig => taskConfig}/index.less (100%) rename src/components/{nodeConfig => taskConfig}/index.vue (72%) delete mode 100644 src/store/node.ts create mode 100644 src/store/task.ts diff --git a/src/G6/behaviorConfig.ts b/src/G6/behaviorConfig.ts index 0cffc74..c32a524 100644 --- a/src/G6/behaviorConfig.ts +++ b/src/G6/behaviorConfig.ts @@ -1,9 +1,9 @@ -import { IG6GraphEvent } from "@antv/g6-core/lib/types"; -import { BehaviorOption, INode, NodeConfig } from "@antv/g6"; -import { useNodeStore } from "@/store/node.ts"; +import {IG6GraphEvent} from "@antv/g6-core/lib/types"; +import {BehaviorOption} from "@antv/g6"; +import {useNodeStore} from "@/store/task.ts"; import pinia from "@/store"; +import {Task} from "@/type.ts"; -const nodeStore = useNodeStore(pinia); export const activateNodeBehavior: BehaviorOption = { getEvents() { @@ -12,8 +12,12 @@ export const activateNodeBehavior: BehaviorOption = { }; }, async onNodeClick(evt: IG6GraphEvent) { - const node = evt.item as INode; - console.log(node.getModel().id); - await nodeStore.updateData(node.getModel() as NodeConfig); + const node = evt.item!; + const task: Task = node.getModel().task as Task; + // Update the task config + const nodeStore = useNodeStore(pinia); + await nodeStore.updateData(task); + // Show the task config + nodeStore.show(); }, }; diff --git a/src/components/nodeConfig/index.less b/src/components/taskConfig/index.less similarity index 100% rename from src/components/nodeConfig/index.less rename to src/components/taskConfig/index.less diff --git a/src/components/nodeConfig/index.vue b/src/components/taskConfig/index.vue similarity index 72% rename from src/components/nodeConfig/index.vue rename to src/components/taskConfig/index.vue index aab2460..78ead38 100644 --- a/src/components/nodeConfig/index.vue +++ b/src/components/taskConfig/index.vue @@ -1,23 +1,23 @@ diff --git a/src/pages/Home/components/RightBox.vue b/src/pages/Home/components/RightBox.vue index a142189..8195da8 100644 --- a/src/pages/Home/components/RightBox.vue +++ b/src/pages/Home/components/RightBox.vue @@ -1,8 +1,8 @@