2026-08-05 99c00652cf3895009eacdb05025e02967a670367
src/views/mes/workbench/components/tabs/FeedbackHistoryTab.vue
@@ -16,6 +16,7 @@
import {
  approveFeedback,
  deleteFeedback,
  getBatchRequirements,
  getFeedbackPage,
  rejectFeedback,
  submitFeedback,
@@ -23,6 +24,7 @@
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' });
@@ -38,6 +40,19 @@
  connectedComponent: FeedbackForm,
  destroyOnClose: true,
});
const batchDialogRef = ref<InstanceType<typeof BatchInputDialog>>();
const approvingRow = ref<MesProFeedbackApi.Feedback>();
/** 执行审批(含批次属性) */
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) {
@@ -67,12 +82,24 @@
/** 审批通过(仅审批中) */
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) {
      approvingRow.value = row;
      batchDialogRef.value?.open({ checkResult });
    } else {
      await doApprove(row);
    }
  } catch {
    await doApprove(row);
  }
}
/** 批次弹窗确认回调 */
function handleBatchConfirm(batchData: Record<string, unknown>) {
  if (approvingRow.value) {
    doApprove(approvingRow.value, batchData);
  }
}
/** 驳回(仅审批中) */
@@ -202,6 +229,7 @@
<template>
  <div class="feedback-history-tab">
    <FormModal @success="refreshGrid" />
    <BatchInputDialog ref="batchDialogRef" @confirm="handleBatchConfirm" />
    <div v-if="!taskId" class="feedback-history-tab__empty">
      请从左侧工单列表选择一条任务查看报工记录