gaoluyang
9 天以前 d841a8ea6dc2f7fdedbf0ea2b1e539842f5f3e37
src/views/mes/qc/ipqc/index.vue
@@ -2,15 +2,20 @@
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesQcIpqcApi } from '#/api/mes/qc/ipqc';
import { ref } from 'vue';
import { Page, useVbenModal } from '@vben/common-ui';
import { MesQcStatusEnum } from '@vben/constants';
import { MesQcStatusEnum, MesQcTypeEnum } from '@vben/constants';
import { downloadFileFromBlobPart } from '@vben/utils';
import { Button, message } from 'ant-design-vue';
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { exportProductWord } from '#/api/mes/qc/indicatorresult';
import { deleteIpqc, exportIpqc, getIpqcPage } from '#/api/mes/qc/ipqc';
import { $t } from '#/locales';
import QcExportRangeModal from '#/views/mes/qc/components/export-range-modal.vue';
import QcReportPrint from '#/views/mes/qc/components/qc-report-print.vue';
import { useGridColumns, useGridFormSchema } from './data';
import Form from './modules/form.vue';
@@ -25,9 +30,25 @@
  destroyOnClose: true,
});
const printRef = ref<InstanceType<typeof QcReportPrint> | null>(null);
/** 刷新表格 */
function handleRefresh() {
  gridApi.query();
}
/** 打印检验报告 */
async function handlePrint(row: MesQcIpqcApi.Ipqc) {
  await printRef.value?.print(row.id!, MesQcTypeEnum.IPQC);
}
/** 导出产品检验单 Word(纸质检验单版式,判定结论带出检验结果) */
async function handleExportProductWord(row: MesQcIpqcApi.Ipqc) {
  const blob = await exportProductWord(row.id!, MesQcTypeEnum.IPQC);
  downloadFileFromBlobPart({
    fileName: `产品检验单-${row.code ?? row.id}.docx`,
    source: blob,
  });
}
/** 创建过程检验单 */
@@ -106,6 +127,7 @@
  <Page auto-content-height>
    <FormModal @success="handleRefresh" />
    <ExportRangeModal />
    <QcReportPrint ref="printRef" />
    <Grid table-title="过程检验单列表">
      <template #toolbar-tools>
        <TableAction
@@ -156,6 +178,20 @@
              },
            },
            {
              label: '打印报告',
              type: 'link',
              icon: 'ant-design:printer-outlined',
              auth: ['mes:qc-ipqc:query'],
              onClick: handlePrint.bind(null, row),
            },
            {
              label: '导出产品检验单',
              type: 'link',
              icon: 'ant-design:file-word-outlined',
              auth: ['mes:qc-ipqc:query'],
              onClick: handleExportProductWord.bind(null, row),
            },
            {
              label: $t('common.detail'),
              type: 'link',
              icon: ACTION_ICON.VIEW,