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); }