From 253bdabb97592ac362df647f8dcd1204a7e1197e Mon Sep 17 00:00:00 2001 From: xue jiahao Date: Mon, 17 Feb 2025 21:18:24 +0800 Subject: [PATCH] fix app flow --- src/utils.js | 8 ++++---- src/保育計画月案/main.js | 17 +++++++++-------- src/保育計画週案/main.js | 17 +++++++++-------- src/学年別保育計画/main.js | 17 +++++++++-------- src/学期反省・評価/main.js | 19 +++++++++++-------- 5 files changed, 42 insertions(+), 36 deletions(-) diff --git a/src/utils.js b/src/utils.js index 81f8e7c..4cf7f2f 100644 --- a/src/utils.js +++ b/src/utils.js @@ -507,13 +507,13 @@ const statusFieldMap = { '園長確認中': '主幹', '完了': '園長' } -function getUpdateFieldByNextFlow(nextStatus) { - return statusFieldMap[nextStatus]; -} function addApproveFlowAction() { return kintone.events.on("app.record.detail.process.proceed", (event) => { - event.record[getUpdateFieldByNextFlow(event.nextStatus.value)].value = kintone.getLoginUser().name; + const field = statusFieldMap[event.nextStatus.value]; + if (field) { + event.record[field].value = kintone.getLoginUser().name; + } return event; }); } \ No newline at end of file diff --git a/src/保育計画月案/main.js b/src/保育計画月案/main.js index cb77ad4..41ae1e7 100644 --- a/src/保育計画月案/main.js +++ b/src/保育計画月案/main.js @@ -1,17 +1,18 @@ (function () { "use strict"; - kintone.events.on("app.record.detail.process.proceed", (event) => { - event.record[getUpdateFieldByNextFlow(event.nextStatus.value)].value = kintone.getLoginUser().name; - return event; - }); - const statusFieldMap = { '主幹確認中': '指導', '園長確認中': '主幹', '完了': '園長' } - function getUpdateFieldByNextFlow(nextStatus) { - return statusFieldMap[nextStatus]; - } + + kintone.events.on("app.record.detail.process.proceed", (event) => { + const field = statusFieldMap[event.nextStatus.value]; + if (field) { + event.record[field].value = kintone.getLoginUser().name; + } + return event; + }); + })(); \ No newline at end of file diff --git a/src/保育計画週案/main.js b/src/保育計画週案/main.js index 7ed2d16..c676e57 100644 --- a/src/保育計画週案/main.js +++ b/src/保育計画週案/main.js @@ -1,11 +1,6 @@ (function () { "use strict"; - kintone.events.on("app.record.detail.process.proceed", (event) => { - event.record[getUpdateFieldByNextFlow(event.nextStatus.value)].value = kintone.getLoginUser().name; - return event; - }); - const statusFieldMap = { '主幹確認中(4週目)': '指導', '園長確認中(4週目)': '主幹', @@ -15,7 +10,13 @@ '園長確認中(5週目)': '主幹', '完了(5週目)': '園長', } - function getUpdateFieldByNextFlow(nextStatus) { - return statusFieldMap[nextStatus]; - } + + kintone.events.on("app.record.detail.process.proceed", (event) => { + const field = statusFieldMap[event.nextStatus.value]; + if (field) { + event.record[field].value = kintone.getLoginUser().name; + } + return event; + }); + })(); \ No newline at end of file diff --git a/src/学年別保育計画/main.js b/src/学年別保育計画/main.js index 4c57b8b..1d36c1e 100644 --- a/src/学年別保育計画/main.js +++ b/src/学年別保育計画/main.js @@ -1,18 +1,19 @@ (function () { "use strict"; - kintone.events.on("app.record.detail.process.proceed", (event) => { - event.record[getUpdateFieldByNextFlow(event.nextStatus.value)].value = kintone.getLoginUser().name; - return event; - }); - const statusFieldMap = { '指導教諭確認中': '担任', '主幹確認中': '指導', '園長確認中': '主幹', '完了': '園長' } - function getUpdateFieldByNextFlow(nextStatus) { - return statusFieldMap[nextStatus]; - } + + kintone.events.on("app.record.detail.process.proceed", (event) => { + const field = statusFieldMap[event.nextStatus.value]; + if (field) { + event.record[field].value = kintone.getLoginUser().name; + } + return event; + }); + })(); \ No newline at end of file diff --git a/src/学期反省・評価/main.js b/src/学期反省・評価/main.js index 11c3af6..3109679 100644 --- a/src/学期反省・評価/main.js +++ b/src/学期反省・評価/main.js @@ -1,23 +1,26 @@ (function () { "use strict"; - kintone.events.on("app.record.detail.process.proceed", (event) => { - event.record[getUpdateFieldByNextFlow(event.nextStatus.value)].value = kintone.getLoginUser().name; - return event; - }); - const statusFieldMap = { '主幹確認中(1学期)': '指導1', '園長確認中(1学期)': '主幹1', '完了(1学期)': '園長1', + '担任作成中(2学期)': '園長1', '主幹確認中(2学期)': '指導2', '園長確認中(2学期)': '主幹2', '完了(2学期)': '園長2', + '担任作成中(3学期)': '園長2', '主幹確認中(3学期)': '指導3', '園長確認中(3学期)': '主幹3', '完了(3学期)': '園長3', } - function getUpdateFieldByNextFlow(nextStatus) { - return statusFieldMap[nextStatus]; - } + + kintone.events.on("app.record.detail.process.proceed", (event) => { + const field = statusFieldMap[event.nextStatus.value]; + if (field) { + event.record[field].value = kintone.getLoginUser().name; + } + return event; + }); + })(); \ No newline at end of file