zhangwencui
7 天以前 7619c19a67c2ac824f803090bab753fc5ea14408
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<script lang="ts" setup>
import type { VxeTableGridOptions } from '#/adapter/vxe-table';
import type { MesPdDocumentAuditApi } from '#/api/mes/pd/document-audit';
 
import { useVbenModal } from '#/packages/effects/common-ui/src';
import { DICT_TYPE } from '#/packages/constants/src';
import { getDictOptions } from '#/packages/effects/hooks/src';
 
import { ACTION_ICON, TableAction, useVbenVxeGrid } from '#/adapter/vxe-table';
import { getPdDocumentAuditPage } from '#/api/mes/pd/document-audit';
 
import AuditForm from './document-audit-form.vue';
 
const props = defineProps<{
  projectId: number;
}>();
 
const emit = defineEmits(['success']);
 
const [AuditFormModal, auditFormModalApi] = useVbenModal({
  connectedComponent: AuditForm,
  destroyOnClose: true,
});
 
function handleRefresh() {
  gridApi.query();
  emit('success');
}
 
function handleAudit(row: MesPdDocumentAuditApi.DocumentAudit) {
  auditFormModalApi.setData(row).open();
}
 
const [Grid, gridApi] = useVbenVxeGrid({
  formOptions: {
    schema: [
      { fieldName: 'auditNo', label: '审核单号', component: 'Input', componentProps: { placeholder: '请输入审核单号' } },
      { fieldName: 'documentName', label: '资料名称', component: 'Input', componentProps: { placeholder: '请输入资料名称' } },
      {
        fieldName: 'auditStatus',
        label: '审核状态',
        component: 'Select',
        componentProps: { allowClear: true, options: getDictOptions(DICT_TYPE.MES_PD_DOCUMENT_AUDIT_STATUS, 'number'), placeholder: '请选择审核状态' },
      },
    ],
  },
  gridOptions: {
    columns: [
      { field: 'auditNo', title: '审核单号', minWidth: 140 },
      { field: 'documentName', title: '资料名称', minWidth: 160 },
      { field: 'documentVersion', title: '资料版本', minWidth: 90 },
      { field: 'reviewerNickname', title: '审核人', minWidth: 100 },
      { field: 'auditStatus', title: '审核状态', minWidth: 100, cellRender: { name: 'CellDict', props: { type: DICT_TYPE.MES_PD_DOCUMENT_AUDIT_STATUS } } },
      { field: 'auditTime', title: '审核时间', minWidth: 160, formatter: 'formatDateTime' },
      { field: 'createTime', title: '创建时间', minWidth: 160, formatter: 'formatDateTime' },
      { field: 'action', title: '操作', width: 100, fixed: 'right', slots: { default: 'actions' } },
    ],
    height: 400,
    keepSource: true,
    proxyConfig: {
      ajax: {
        query: async ({ page }, formValues) => {
          return await getPdDocumentAuditPage({
            pageNo: page.currentPage,
            pageSize: page.pageSize,
            ...formValues,
          });
        },
      },
    },
    rowConfig: { keyField: 'id', isHover: true },
    toolbarConfig: { refresh: true, search: true },
  } as VxeTableGridOptions<MesPdDocumentAuditApi.DocumentAudit>,
});
</script>
 
<template>
  <AuditFormModal @success="handleRefresh" />
  <Grid table-title="资料审核">
    <template #actions="{ row }">
      <TableAction
        :actions="[
          {
            label: '审核',
            type: 'link',
            icon: ACTION_ICON.EDIT,
            auth: ['mes:pd-document-audit:update'],
            onClick: handleAudit.bind(null, row),
          },
        ]"
      />
    </template>
  </Grid>
</template>