<!-- 委托方证书报告列表 --> <script name="CustomerInfoReport" lang="ts" setup> import type { TableColumn } from '@/components/NormalTable/table_interface' import type { IList, IListQueryCert } from '@/views/business/certManage/cert/cert-interface' import { getCertList } from '@/api/business/certManage/cert' import { SCHEDULE } from '@/utils/scheduleDict' const props = defineProps({ customerId: { type: String, default: '' }, }) const router = useRouter() const listQuery = ref<IListQueryCert>({ customerId: props.customerId, // 委托方名称 offset: 1, limit: 10, certificateReportNo: '', // 证书报告编号 certificateReportName: '', // 证书报告名称 customerName: '', // 委托方名称 createTimeStart: '', // 创建开始时间 createTimeEnd: '', // 创建结束时间 approvalStatus: '0', // 已审批完成的 printStatus: '', // 打印状态(未打印传1,其他状态不传) sampleName: '', // 受检智能模型名称 sampleNo: '', // 样品编号 formId: SCHEDULE.CERTIFICATE_PRINT_APPROVAL, }) const columns = ref<TableColumn[]>([ // 表头 { text: '证书编号', value: 'certificateNo', align: 'center', width: '160' }, { text: '证书名称', value: 'certificateName', align: 'center' }, { text: '任务单编号', value: 'orderNo', align: 'center' }, { text: '被检智能模型统一编号', value: 'sampleNo', align: 'center' }, { text: '被检智能模型名称', value: 'sampleName', align: 'center' }, { text: '创建时间', value: 'createTime', align: 'center', width: '180' }, { text: '打印状态', value: 'printStatusName', align: 'center', width: '100' }, ]) const list = ref<IList[]>([]) // 表格数据 const total = ref(0) // 数据总数 const loadingTable = ref(false) // 表格加载状态 // 数据查询 function fetchData(isNowPage = false) { loadingTable.value = true if (!isNowPage) { // 是否显示当前页,否则跳转第一页 listQuery.value.offset = 1 } getCertList(listQuery.value).then((response) => { list.value = response.data.rows total.value = parseInt(response.data.total) loadingTable.value = false }) } // 页数发生变化后的操作,可能是页码变化,可能是每页容量变化,此函数必写 const changePage = (val: { size?: number; page?: number }) => { if (val && val.size) { listQuery.value.limit = val.size } if (val && val.page) { listQuery.value.offset = val.page } fetchData(true) } const detailCert = (row: IList) => { console.log(row) router.push({ path: `/cert/detail/${row.id}`, query: { printFileName: row.certificateFile, printStatusName: row.printStatusName, approvalStatusName: row.approvalStatusName, processId: row.processId, taskId: row.taskId, }, }) } watch(() => props.customerId, (newVal: string) => { listQuery.value.customerId = newVal if (newVal !== '') { fetchData() } }, { immediate: true }) </script> <template> <app-container> <table-container> <normal-table :data="list" :total="total" :columns="columns" :query="listQuery" :list-loading="loadingTable" @change="changePage" > <template #preColumns> <el-table-column label="序号" width="55" align="center"> <template #default="scope"> {{ (listQuery.offset - 1) * listQuery.limit + scope.$index + 1 }} </template> </el-table-column> </template> <template #columns> <el-table-column fixed="right" label="操作" align="center" width="130"> <template #default="{ row }"> <el-button size="small" type="primary" link @click="detailCert(row)"> 详情 </el-button> </template> </el-table-column> </template> </normal-table> </table-container> </app-container> </template>