云
2 天以前 a241b66efcc41e973290a6722fb7a4d79b833ea1
src/views/mes/workbench/components/tabs/FeedbackHistoryTab.vue
@@ -1,4 +1,5 @@
<script lang="ts" setup>
import { automaticApproval } from '#/store/audit-policy';
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesProFeedbackApi } from '#/api/mes/pro/feedback';
@@ -32,6 +33,7 @@
const props = defineProps<{
  taskId?: number;
  task?: Record<string, any>;
  /** 外部触发刷新 */
  refreshKey?: number;
}>();
@@ -47,7 +49,16 @@
const router = useRouter();
const batchDialogRef = ref<InstanceType<typeof BatchInputDialog>>();
const approvingRow = ref<MesProFeedbackApi.Feedback>();
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>) {
@@ -79,10 +90,23 @@
/** 提交(仅草稿) */
async function handleSubmit(row: MesProFeedbackApi.Feedback) {
  await submitFeedback({ id: 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);
  }
}
/** 审批通过(仅审批中) */
@@ -90,7 +114,8 @@
  try {
    const checkResult = await getBatchRequirements(row.id!);
    if (checkResult?.needBatchInput) {
      approvingRow.value = row;
      batchActionType.value = 'approve';
      actionRow.value = row;
      batchDialogRef.value?.open({ checkResult });
    } else {
      await doApprove(row);
@@ -102,8 +127,12 @@
/** 批次弹窗确认回调 */
function handleBatchConfirm(batchData: Record<string, unknown>) {
  if (approvingRow.value) {
    doApprove(approvingRow.value, batchData);
  if (actionRow.value) {
    if (batchActionType.value === 'approve') {
      doApprove(actionRow.value, batchData);
    } else if (batchActionType.value === 'submit') {
      doSubmit(actionRow.value, batchData);
    }
  }
}
@@ -290,7 +319,7 @@
            </Popconfirm>
            <!-- 审批中:查看审批 -->
            <Button
              v-if="row.status === STATUS_APPROVING"
              v-if="!automaticApproval && row.status === STATUS_APPROVING"
              type="link"
              size="small"
              @click="handleViewProcess(row)"