From 09e6d1cfe124615cbea97140c17630c7b86a0796 Mon Sep 17 00:00:00 2001
From: hsy <1029150275@qq.com>
Date: 星期五, 28 八月 2026 16:57:49 +0800
Subject: [PATCH] feat(mes): 统一工作台报工记录与报工页面的提交批次号校验逻辑
---
src/views/mes/workbench/components/tabs/FeedbackHistoryTab.vue | 106 ++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 93 insertions(+), 13 deletions(-)
diff --git a/src/views/mes/workbench/components/tabs/FeedbackHistoryTab.vue b/src/views/mes/workbench/components/tabs/FeedbackHistoryTab.vue
index 4048770..2f7092e 100644
--- a/src/views/mes/workbench/components/tabs/FeedbackHistoryTab.vue
+++ b/src/views/mes/workbench/components/tabs/FeedbackHistoryTab.vue
@@ -3,12 +3,14 @@
import type { MesProFeedbackApi } from '#/api/mes/pro/feedback';
import { nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';
+import { useRouter } from 'vue-router';
import {
DICT_TYPE,
MesProFeedbackStatusEnum,
} from '@vben/constants';
import { useVbenModal } from '@vben/common-ui';
+import { useAccess } from '@vben/access';
import { Button, message, Popconfirm, Space } from 'ant-design-vue';
@@ -16,6 +18,7 @@
import {
approveFeedback,
deleteFeedback,
+ getBatchRequirements,
getFeedbackPage,
rejectFeedback,
submitFeedback,
@@ -23,11 +26,13 @@
import { $t } from '#/locales';
import FeedbackForm from '../../../pro/feedback/modules/form.vue';
+import BatchInputDialog from '../../../pro/feedback/modules/batch-input-dialog.vue';
defineOptions({ name: 'WorkbenchFeedbackHistoryTab' });
const props = defineProps<{
taskId?: number;
+ task?: Record<string, any>;
/** 澶栭儴瑙﹀彂鍒锋柊 */
refreshKey?: number;
}>();
@@ -38,6 +43,31 @@
connectedComponent: FeedbackForm,
destroyOnClose: true,
});
+
+const { hasAccessByCodes } = useAccess();
+const router = useRouter();
+
+const batchDialogRef = ref<InstanceType<typeof BatchInputDialog>>();
+const batchActionType = ref<'submit' | 'approve'>('approve');
+const actionRow = ref<MesProFeedbackApi.Feedback>();
+
+/** 鎵ц鎻愪氦锛堝惈鎵规灞炴�э級 */
+async function doSubmit(row: MesProFeedbackApi.Feedback, batchFields?: Record<string, unknown>) {
+ await submitFeedback({ id: row.id!, ...batchFields });
+ message.success('鎶ュ伐鍗曞凡鎻愪氦');
+ refreshGrid();
+ emit('reported');
+}
+
+/** 鎵ц瀹℃壒锛堝惈鎵规灞炴�э級 */
+async function doApprove(row: MesProFeedbackApi.Feedback, batchFields?: Record<string, unknown>) {
+ const finished = await approveFeedback({ id: row.id!, ...batchFields });
+ message.success(
+ finished ? '鎶ュ伐鍗曞凡瀹℃壒瀹屾垚' : '鎶ュ伐鎴愬姛锛岃绛夊緟璐ㄩ噺妫�楠屽畬鎴愶紒',
+ );
+ refreshGrid();
+ emit('reported');
+}
/** 鏌ョ湅璇︽儏 */
function handleDetail(row: MesProFeedbackApi.Feedback) {
@@ -59,20 +89,50 @@
/** 鎻愪氦锛堜粎鑽夌锛� */
async function handleSubmit(row: MesProFeedbackApi.Feedback) {
- await submitFeedback(row.id!);
- message.success('鎶ュ伐鍗曞凡鎻愪氦');
- refreshGrid();
- emit('reported');
+ if (props.task?.feedbackApprove) {
+ await doSubmit(row);
+ return;
+ }
+
+ try {
+ const checkResult = await getBatchRequirements(row.id!);
+ if (checkResult?.needBatchInput) {
+ batchActionType.value = 'submit';
+ actionRow.value = row;
+ batchDialogRef.value?.open({ checkResult });
+ } else {
+ await doSubmit(row);
+ }
+ } catch {
+ await doSubmit(row);
+ }
}
/** 瀹℃壒閫氳繃锛堜粎瀹℃壒涓級 */
async function handleApprove(row: MesProFeedbackApi.Feedback) {
- const finished = await approveFeedback(row.id!);
- message.success(
- finished ? '鎶ュ伐鍗曞凡瀹℃壒瀹屾垚' : '鎶ュ伐鎴愬姛锛岃绛夊緟璐ㄩ噺妫�楠屽畬鎴愶紒',
- );
- refreshGrid();
- emit('reported');
+ try {
+ const checkResult = await getBatchRequirements(row.id!);
+ if (checkResult?.needBatchInput) {
+ batchActionType.value = 'approve';
+ actionRow.value = row;
+ batchDialogRef.value?.open({ checkResult });
+ } else {
+ await doApprove(row);
+ }
+ } catch {
+ await doApprove(row);
+ }
+}
+
+/** 鎵规寮圭獥纭鍥炶皟 */
+function handleBatchConfirm(batchData: Record<string, unknown>) {
+ if (actionRow.value) {
+ if (batchActionType.value === 'approve') {
+ doApprove(actionRow.value, batchData);
+ } else if (batchActionType.value === 'submit') {
+ doSubmit(actionRow.value, batchData);
+ }
+ }
}
/** 椹冲洖锛堜粎瀹℃壒涓級 */
@@ -81,6 +141,15 @@
message.success('鎶ュ伐鍗曞凡椹冲洖');
refreshGrid();
emit('reported');
+}
+
+/** 鏌ョ湅瀹℃壒璇︽儏 */
+function handleViewProcess(row: MesProFeedbackApi.Feedback) {
+ if (!row.processInstanceId) {
+ message.warning('璇ユ姤宸ュ皻鏈彁浜ゅ鎵�');
+ return;
+ }
+ router.push({ path: '/bpm/process-instance/detail', query: { id: row.processInstanceId } });
}
/** 鐘舵�佸父閲忎緵妯℃澘浣跨敤 */
@@ -202,6 +271,7 @@
<template>
<div class="feedback-history-tab">
<FormModal @success="refreshGrid" />
+ <BatchInputDialog ref="batchDialogRef" @confirm="handleBatchConfirm" />
<div v-if="!taskId" class="feedback-history-tab__empty">
璇蜂粠宸︿晶宸ュ崟鍒楄〃閫夋嫨涓�鏉′换鍔℃煡鐪嬫姤宸ヨ褰�
@@ -246,9 +316,18 @@
鍒犻櫎
</Button>
</Popconfirm>
- <!-- 瀹℃壒涓細瀹℃壒閫氳繃銆侀┏鍥� -->
- <Popconfirm
+ <!-- 瀹℃壒涓細鏌ョ湅瀹℃壒 -->
+ <Button
v-if="row.status === STATUS_APPROVING"
+ type="link"
+ size="small"
+ @click="handleViewProcess(row)"
+ >
+ 鏌ョ湅瀹℃壒
+ </Button>
+ <!--
+ <Popconfirm
+ v-if="row.status === STATUS_APPROVING && hasAccessByCodes(['mes:pro-feedback:approve'])"
title="纭瀹℃壒閫氳繃璇ユ姤宸ュ崟锛�"
@confirm="handleApprove(row)"
>
@@ -257,7 +336,7 @@
</Button>
</Popconfirm>
<Popconfirm
- v-if="row.status === STATUS_APPROVING"
+ v-if="row.status === STATUS_APPROVING && hasAccessByCodes(['mes:pro-feedback:approve'])"
title="纭椹冲洖璇ユ姤宸ュ崟锛�"
@confirm="handleReject(row)"
>
@@ -265,6 +344,7 @@
椹冲洖
</Button>
</Popconfirm>
+ -->
</Space>
</template>
</Grid>
--
Gitblit v1.9.3