<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: 'fileUrl', title: '文件', minWidth: 140, slots: { default: 'file' } },
|
{ 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,
|
projectId: props.projectId,
|
...formValues,
|
});
|
},
|
},
|
},
|
rowConfig: { keyField: 'id', isHover: true },
|
toolbarConfig: { refresh: true, search: true },
|
} as VxeTableGridOptions<MesPdDocumentAuditApi.DocumentAudit>,
|
});
|
</script>
|
|
<template>
|
<AuditFormModal @success="handleRefresh" />
|
<Grid table-title="资料审核">
|
<template #file="{ row }">
|
<a v-if="row.fileUrl" :href="row.fileUrl" target="_blank" class="text-primary">
|
{{ row.fileName || '查看文件' }}
|
</a>
|
<span v-else class="text-gray-400">-</span>
|
</template>
|
<template #actions="{ row }">
|
<TableAction
|
:actions="[
|
{
|
label: '审核',
|
type: 'link',
|
icon: ACTION_ICON.EDIT,
|
ifShow: row.auditStatus === 0,
|
onClick: handleAudit.bind(null, row),
|
},
|
]"
|
/>
|
</template>
|
</Grid>
|
</template>
|