From 5f7ce1e46febb7d0b36ea1bc27a7cb3ba301b95a Mon Sep 17 00:00:00 2001 From: 王彪总 Date: Tue, 20 Oct 2026 17:02:23 +0800 Subject: [PATCH] 业务线 小程序不用写死,从后端接口获取 --- components/unified-task-actions/unified-task-actions.vue | 47 ++++++++++++++++++++++++++++++++++++++++------- pages-sub/problem/ai-manage/index.vue | 3 ++- pages-sub/problem/regional-order-manage/index.vue | 3 ++- pages-sub/problem/regional-order-manage/list-detail.vue | 3 ++- pages-sub/problem/regional-order-manage/order-detail.vue | 3 ++- pages-sub/problem/work-order-manage/index.vue | 3 ++- pages-sub/problem/work-order-manage/order-detail.vue | 3 ++- 7 files changed, 52 insertions(+), 13 deletions(-) diff --git a/components/unified-task-actions/unified-task-actions.vue b/components/unified-task-actions/unified-task-actions.vue index c93ab34..60e2194 100644 --- a/components/unified-task-actions/unified-task-actions.vue +++ b/components/unified-task-actions/unified-task-actions.vue @@ -69,7 +69,8 @@ - 返回 + + 返回 确定 @@ -105,15 +106,34 @@ const attachImgs = useUploadImgs({ uploadText: '选择附件' }) -const reasonRequired = computed(() => { - if (!current.value) return false +/** 该动作是否必须填写原因/备注 */ +const isReasonRequired = (action) => { + if (!action) return false return ( - current.value.requireReason === true || - ['REJECT', 'RETURN', 'RETURN_PREV', 'TRANSFER', 'DELEGATE'].includes(current.value.code) + action.requireReason === true || + ['REJECT', 'RETURN', 'RETURN_PREV', 'TRANSFER', 'DELEGATE'].includes(action.code) ) -}) +} + +const reasonRequired = computed(() => isReasonRequired(current.value)) + +/** 动作是否需要用户补充信息(处理人/必填原因/附件),都不需要时直接提交 */ +const needsInput = (action) => { + if (!action) return false + return action.requireAssignee === true + || action.requireAttachment === true + || isReasonRequired(action) +} -/** 打开动作弹窗 */ +/** + * 打开动作弹窗 + * + * 列表页的按钮文案就是动作名称,按钮自身已经限定了动作, + * 所以只有一个动作时不再展示「请选择操作」列表: + * - 动作无必填内容:直接提交(例如「分配」由后端按道路自动指派); + * - 动作需要处理人/原因/附件:直接进入动作表单。 + * 只有传入多个动作(需要用户区分)时才展示动作列表。 + */ const open = async (item, actionList) => { currentItem.value = item actions.value = actionList || [] @@ -121,6 +141,19 @@ const open = async (item, actionList) => { form.nextAssignee = '' form.reason = '' attachImgs.clearImgs() + + if (actions.value.length === 1) { + const action = actions.value[0] + if (needsInput(action)) { + visible.value = true + await selectAction(action) + } else { + current.value = action + await submit() + } + return + } + visible.value = true } diff --git a/pages-sub/problem/ai-manage/index.vue b/pages-sub/problem/ai-manage/index.vue index 739c394..9aede49 100644 --- a/pages-sub/problem/ai-manage/index.vue +++ b/pages-sub/problem/ai-manage/index.vue @@ -503,7 +503,8 @@ const handleUnifiedProcess = async (item) => { ? item.configuredActions : await queryUnifiedActions(item) if (actions) { - unifiedActionsRef.value?.open(item, actions) + // 主按钮文案就是第一个动作,直接执行该动作,不再弹「请选择操作」让用户二次选择 + unifiedActionsRef.value?.open(item, actions.slice(0, 1)) return } handleProcess(item) diff --git a/pages-sub/problem/regional-order-manage/index.vue b/pages-sub/problem/regional-order-manage/index.vue index d139b59..0167441 100644 --- a/pages-sub/problem/regional-order-manage/index.vue +++ b/pages-sub/problem/regional-order-manage/index.vue @@ -478,7 +478,8 @@ const handleUnifiedProcess = async (item) => { ? item.configuredActions : await queryUnifiedActions(item) if (actions) { - unifiedActionsRef.value?.open(item, actions) + // 主按钮文案就是第一个动作,直接执行该动作,不再弹「请选择操作」让用户二次选择 + unifiedActionsRef.value?.open(item, actions.slice(0, 1)) return } handleProcess(item) diff --git a/pages-sub/problem/regional-order-manage/list-detail.vue b/pages-sub/problem/regional-order-manage/list-detail.vue index d216aad..8920549 100644 --- a/pages-sub/problem/regional-order-manage/list-detail.vue +++ b/pages-sub/problem/regional-order-manage/list-detail.vue @@ -535,7 +535,8 @@ const handleUnifiedProcess = async (item: any) => { ? configuredActions.value : await queryUnifiedActions(item?.taskId) if (actions) { - unifiedActionsRef.value?.open(item, actions) + // 主按钮文案就是第一个动作,直接执行该动作,不再弹「请选择操作」让用户二次选择 + unifiedActionsRef.value?.open(item, actions.slice(0, 1)) return } handleProcess(item) diff --git a/pages-sub/problem/regional-order-manage/order-detail.vue b/pages-sub/problem/regional-order-manage/order-detail.vue index 245e44e..ef94b08 100644 --- a/pages-sub/problem/regional-order-manage/order-detail.vue +++ b/pages-sub/problem/regional-order-manage/order-detail.vue @@ -603,7 +603,8 @@ const handleUnifiedProcess = async (item: any) => { ? configuredActions.value : await queryUnifiedActions(item?.taskId) if (actions) { - unifiedActionsRef.value?.open(item, actions) + // 主按钮文案就是第一个动作,直接执行该动作,不再弹「请选择操作」让用户二次选择 + unifiedActionsRef.value?.open(item, actions.slice(0, 1)) return } handleProcess(item) diff --git a/pages-sub/problem/work-order-manage/index.vue b/pages-sub/problem/work-order-manage/index.vue index 25f5bb0..c563855 100644 --- a/pages-sub/problem/work-order-manage/index.vue +++ b/pages-sub/problem/work-order-manage/index.vue @@ -545,7 +545,8 @@ const handleUnifiedProcess = async (item) => { ? item.configuredActions : await queryUnifiedActions(item) if (actions) { - unifiedActionsRef.value?.open(item, actions) + // 主按钮文案就是第一个动作,直接执行该动作,不再弹「请选择操作」让用户二次选择 + unifiedActionsRef.value?.open(item, actions.slice(0, 1)) return } handleProcess(item) diff --git a/pages-sub/problem/work-order-manage/order-detail.vue b/pages-sub/problem/work-order-manage/order-detail.vue index c20f60a..a9b1b3d 100644 --- a/pages-sub/problem/work-order-manage/order-detail.vue +++ b/pages-sub/problem/work-order-manage/order-detail.vue @@ -751,7 +751,8 @@ const handleUnifiedProcess = async (item: any) => { ? configuredActions.value : await queryUnifiedActions(item) if (actions) { - unifiedActionsRef.value?.open(item, actions) + // 主按钮文案就是第一个动作,直接执行该动作,不再弹「请选择操作」让用户二次选择 + unifiedActionsRef.value?.open(item, actions.slice(0, 1)) return } handleProcess(item) -- libgit2 0.21.4