From 3925a0a721c4ef83fec62f00b90dc7559eb0db4e Mon Sep 17 00:00:00 2001 From: "xiaozhe.ma" Date: Mon, 2 Sep 2024 14:02:20 +0900 Subject: [PATCH] =?UTF-8?q?=E3=81=99=E3=81=B9=E3=81=A6=E3=83=95=E3=83=AD?= =?UTF-8?q?=E3=83=BC=E3=81=AE=E4=B8=80=E6=8B=AC=E4=BF=9D=E5=AD=98=E6=A9=9F?= =?UTF-8?q?=E8=83=BD=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/FlowChart.vue | 64 +++++++++++++++++++++++++---- frontend/src/types/KintoneEvents.ts | 25 +++++++++++ 2 files changed, 82 insertions(+), 7 deletions(-) diff --git a/frontend/src/pages/FlowChart.vue b/frontend/src/pages/FlowChart.vue index 37b5484..d741232 100644 --- a/frontend/src/pages/FlowChart.vue +++ b/frontend/src/pages/FlowChart.vue @@ -16,7 +16,27 @@
- + + + + + + + + 選択中フローの保存 + + + + + + + + + 一括保存 + + + +
@@ -79,10 +99,7 @@ const showAddAction = ref(false); const drawerRight = ref(false); const filter=ref(""); const model = ref(""); -const addActionNode = (action: IActionNode) => { - // refFlow.value?.actionNodes.push(action); - store.currentFlow?.actionNodes.push(action); -} + const rootNode = computed(()=>{ return store.currentFlow?.getRoot(); }); @@ -205,7 +222,7 @@ const onSaveFlow = async () => { $q.notify({ type: 'negative', caption: 'エラー', - message: `編集中のフローがありません。` + message: `選択中のフローがありません。` }); return; } @@ -227,7 +244,40 @@ const onSaveFlow = async () => { message: `${targetFlow.getRoot()?.subTitle}のフローの設定の保存が失敗しました。` }) } - +} +/** + * すべてフローの設定を保存する + */ +const onSaveAllFlow= async ()=>{ + try{ + const targetFlows = store.eventTree.findAllFlows(); + if (!targetFlows || targetFlows.length === 0 ) { + $q.notify({ + type: 'negative', + caption: 'エラー', + message: `設定されたフローがありません。` + }); + return; + } + saveLoading.value = true; + for(const flow of targetFlows ){ + await store.saveFlow(flow); + $q.notify({ + type: 'positive', + caption: "通知", + message: `${flow.getRoot()?.subTitle}のフロー設定を保存しました。` + }); + } + saveLoading.value = false; + }catch (error) { + console.error(error); + saveLoading.value = false; + $q.notify({ + type: 'negative', + caption: "エラー", + message: `フローの設定の保存が失敗しました。` + }); + } } const fetchData = async () => { diff --git a/frontend/src/types/KintoneEvents.ts b/frontend/src/types/KintoneEvents.ts index 69c3d81..4e43bbb 100644 --- a/frontend/src/types/KintoneEvents.ts +++ b/frontend/src/types/KintoneEvents.ts @@ -138,6 +138,31 @@ export class KintoneEventManager { return null; } + public findAllFlows():IActionFlow[]{ + const flows:IActionFlow[]=[]; + for (const screen of this.screens) { + for (const event of screen.events) { + if (event.header === "EVENT") { + const eventNode = event as IKintoneEvent; + if(eventNode.flowData!==undefined){ + flows.push(eventNode.flowData); + } + }else if (event.header === 'EVENTGROUP' || event.header === 'CHANGE') { + const eventGroup = event as IKintoneEventGroup; + const targetEvent = eventGroup.events.find((ev) => { + if (ev.header === "EVENT") { + const eventNode = ev as IKintoneEvent; + if(eventNode.flowData!==undefined){ + flows.push(eventNode.flowData); + } + } + }); + } + } + } + return flows; + } + public findScreen(eventId: string): IKintoneEventGroup | undefined { return this.screens.find((screen) => screen.eventId == eventId); }