src/views/mes/pro/feedback/index.vue
@@ -19,28 +19,18 @@
import { $t } from '#/locales';
import { ref } from 'vue';
import { useRouter } from 'vue-router';
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
import QuickFeedbackForm from '../workorder-center/modules/quick-feedback.vue';
import BatchFeedbackForm from './modules/batch-feedback.vue';
import ArchiveDetail from '#/views/mes/pd/archive/modules/detail.vue';
const userStore = useUserStore();
const currentUserId = userStore.userInfo?.id; // 当前登录用户 ID,用于审批人权限判断
const router = useRouter();
const [FormModal, formModalApi] = useVbenModal({
  connectedComponent: Form,
  destroyOnClose: true,
});
const [QuickFeedbackModal, quickFeedbackModalApi] = useVbenModal({
  connectedComponent: QuickFeedbackForm,
  destroyOnClose: true,
});
const [BatchFeedbackModal, batchFeedbackModalApi] = useVbenModal({
  connectedComponent: BatchFeedbackForm,
  destroyOnClose: true,
});
@@ -69,6 +59,15 @@
/** 审批生产报工 */
function handleApprove(row: MesProFeedbackApi.Feedback) {
  formModalApi.setData({ formType: 'approve', id: row.id }).open();
}
/** 查看审批详情 */
function handleViewProcess(row: MesProFeedbackApi.Feedback) {
  if (!row.processInstanceId) {
    message.warning('该报工尚未提交审批');
    return;
  }
  router.push({ path: '/bpm/process-instance/detail', query: { id: row.processInstanceId } });
}
/** 详情生产报工 */
@@ -108,16 +107,6 @@
  }
}
/** 快速报工 */
function handleQuickCreate() {
  quickFeedbackModalApi.setData({}).open();
}
/** 批量报工 */
function handleBatchCreate() {
  batchFeedbackModalApi.setData({}).open();
}
const [Grid, gridApi] = useVbenVxeGrid({
  formOptions: { schema: useGridFormSchema() },
  gridOptions: {
@@ -144,8 +133,6 @@
<template>
  <Page auto-content-height>
    <FormModal @success="handleRefresh" />
    <QuickFeedbackModal @success="handleRefresh" />
    <BatchFeedbackModal @success="handleRefresh" />
    <Grid table-title="生产报工列表">
      <template #toolbar-tools>
        <TableAction
@@ -156,19 +143,6 @@
              icon: ACTION_ICON.ADD,
              auth: ['mes:pro-feedback:create'],
              onClick: handleCreate,
            },
            {
              label: '快速报工',
              type: 'primary',
              icon: ACTION_ICON.ADD,
              auth: ['mes:pro-feedback:create'],
              onClick: handleQuickCreate,
            },
            {
              label: '批量报工',
              type: 'primary',
              auth: ['mes:pro-feedback:create'],
              onClick: handleBatchCreate,
            },
            {
              label: $t('ui.actionTitle.export'),
@@ -202,14 +176,21 @@
              ifShow: () => row.status === MesProFeedbackStatusEnum.PREPARE,
              onClick: handleSubmit.bind(null, row),
            },
            // {
            //   label: $t('common.approve'),
            //   type: 'link',
            //   auth: ['mes:pro-feedback:approve'],
            //   ifShow: () =>
            //     row.status === MesProFeedbackStatusEnum.APPROVING &&
            //     row.approveUserId === currentUserId,
            //   onClick: handleApprove.bind(null, row),
            // },
            {
              label: $t('common.approve'),
              label: '查看审批',
              type: 'link',
              auth: ['mes:pro-feedback:approve'],
              ifShow: () =>
                row.status === MesProFeedbackStatusEnum.APPROVING &&
                row.approveUserId === currentUserId,
              onClick: handleApprove.bind(null, row),
              icon: ACTION_ICON.VIEW,
              ifShow: () => row.status === MesProFeedbackStatusEnum.APPROVING,
              onClick: handleViewProcess.bind(null, row),
            },
            {
              label: $t('common.delete'),