From 7a5c5250b66cc6faffbcac9e192073473c50f79f Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 28 八月 2026 17:02:04 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_pro2.0' into dev_pro2.0
---
src/views/mes/workbench/components/tabs/FeedbackHistoryTab.vue | 132 ++++++++++++++++++++++++++++++++++++--------
1 files changed, 108 insertions(+), 24 deletions(-)
diff --git a/src/views/mes/workbench/components/tabs/FeedbackHistoryTab.vue b/src/views/mes/workbench/components/tabs/FeedbackHistoryTab.vue
index 578eaf9..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,18 +18,21 @@
import {
approveFeedback,
deleteFeedback,
- getFeedbackListByTask,
+ getBatchRequirements,
+ getFeedbackPage,
rejectFeedback,
submitFeedback,
} from '#/api/mes/pro/feedback';
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;
}>();
@@ -39,6 +44,31 @@
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) {
formModalApi.setData({ formType: 'detail', id: row.id }).open();
@@ -46,7 +76,7 @@
/** 缂栬緫锛堜粎鑽夌锛� */
function handleEdit(row: MesProFeedbackApi.Feedback) {
- formModalApi.setData({ formType: 'update', id: row.id }).open();
+ formModalApi.setData({ formType: 'update', id: row.id, showSubmitButton: false }).open();
}
/** 鍒犻櫎锛堜粎鑽夌锛� */
@@ -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 } });
}
/** 鐘舵�佸父閲忎緵妯℃澘浣跨敤 */
@@ -100,7 +169,7 @@
width: 160,
slots: { default: 'code' },
},
- { field: 'workOrderCode', title: '宸ュ崟缂栫爜', width: 140 },
+ { field: 'taskCode', title: '浠诲姟缂栫爜', width: 140 },
{ field: 'processName', title: '宸ュ簭', width: 100 },
{ field: 'itemName', title: '浜у搧', minWidth: 120 },
{ field: 'feedbackQuantity', title: '鎶ュ伐鏁伴噺', width: 100 },
@@ -134,11 +203,15 @@
keepSource: true,
proxyConfig: {
ajax: {
- query: async () => {
+ query: async ({ page }) => {
if (!props.taskId) {
- return [];
+ return { list: [], total: 0 };
}
- return await getFeedbackListByTask(props.taskId);
+ return await getFeedbackPage({
+ taskId: props.taskId,
+ pageNo: page.currentPage,
+ pageSize: page.pageSize,
+ });
},
},
},
@@ -198,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">
璇蜂粠宸︿晶宸ュ崟鍒楄〃閫夋嫨涓�鏉′换鍔℃煡鐪嬫姤宸ヨ褰�
@@ -213,7 +287,7 @@
<template #actions="{ row }">
<Space :size="4" wrap>
<Button type="link" size="small" @click="handleDetail(row)">
- {{ $t('common.view') }}
+ 鏌ョ湅
</Button>
<!-- 鑽夌锛氱紪杈戙�佸垹闄ゃ�佹彁浜� -->
<Button
@@ -222,7 +296,7 @@
size="small"
@click="handleEdit(row)"
>
- {{ $t('common.edit') }}
+ 缂栬緫
</Button>
<Popconfirm
v-if="row.status === STATUS_PREPARE"
@@ -230,7 +304,7 @@
@confirm="handleSubmit(row)"
>
<Button type="link" size="small">
- {{ $t('common.submit') }}
+ 鎻愪氦
</Button>
</Popconfirm>
<Popconfirm
@@ -239,21 +313,30 @@
@confirm="handleDelete(row)"
>
<Button type="link" size="small" danger>
- {{ $t('common.delete') }}
+ 鍒犻櫎
</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)"
>
<Button type="link" size="small">
- {{ $t('common.approve') }}
+ 瀹℃壒閫氳繃
</Button>
</Popconfirm>
<Popconfirm
- v-if="row.status === STATUS_APPROVING"
+ v-if="row.status === STATUS_APPROVING && hasAccessByCodes(['mes:pro-feedback:approve'])"
title="纭椹冲洖璇ユ姤宸ュ崟锛�"
@confirm="handleReject(row)"
>
@@ -261,6 +344,7 @@
椹冲洖
</Button>
</Popconfirm>
+ -->
</Space>
</template>
</Grid>
--
Gitblit v1.9.3