<!-- 现行测试校准检定方法-更新记录 --> <script name="MethodUpdateRecord" lang="ts" setup> import recordDetail from './recordDetail.vue' import type { TableColumn } from '@/components/NormalTable/table_interface' import { getFileSystemList } from '@/api/resource/fileSystem' import FilePreviewDialog from '@/components/filePreview/filePreviewDialog.vue' import ImagePreviewDialog from '@/components/ImagePreview/imagePreviewDialog.vue' const $props = defineProps({ id: { type: String, required: true, }, }) const loadingTable = ref(false) // 表格loading // 表头 const columns = ref<TableColumn[]>([ { text: '实验室', value: 'labCodeName', align: 'center', width: '80' }, { text: '部门', value: 'groupCodeName', align: 'center', width: '140' }, { text: '文件编号', value: 'fileNo', align: 'center' }, { text: '文件发放号', value: 'fileDistributeNo', align: 'center', width: '150' }, { text: '文件名称', value: 'fileName', align: 'center' }, { text: '启用时间', value: 'effectiveDate', align: 'center' }, { text: '温度要求', value: 'temperature', align: 'center', width: '150' }, { text: '湿度要求', value: 'humidity', align: 'center', width: '150' }, ]) const list = ref<[]>([]) // 表格数据 // 获取数据 const fetchData = () => { if (!$props.id) { return } loadingTable.value = true getFileSystemList({ techniqueFileId: $props.id, offset: 1, limit: 9999, history: '1', }).then((res) => { list.value = res.data.rows.map((item: any) => ({ ...item, temperature: `${item.temperatureLowLimit}~${item.temperatureHighLimit}`, humidity: `${item.humidityLowLimit}~${item.humidityHighLimit}`, })) loadingTable.value = false }).catch(() => { loadingTable.value = false }) } fetchData() // 文件预览 const refFilePreviewDlg = ref() const refImagePreviewDlg = ref() const openFilePreviewDialog = (filename: string) => { // 手动新增的 if (filename.lastIndexOf('.pdf') > 0) { refFilePreviewDlg.value.initDialog(filename) } else { refImagePreviewDlg.value.initDialog(filename) } } // 详情 const detailRef = ref() const detail = (row: any) => { detailRef.value.initDialog(row) } </script> <template> <file-preview-dialog ref="refFilePreviewDlg" /> <image-preview-dialog ref="refImagePreviewDlg" /> <record-detail ref="detailRef" /> <el-table v-loading="loadingTable" :data="list" :columns="columns" border stripe> <el-table-column align="center" label="序号" width="55" type="index" /> <el-table-column v-for="col in columns" :key="col.value" :label="col.text" :align="col.align" :width="col.width"> <template #default="scope"> <span>{{ scope.row[col.value] }}</span> </template> </el-table-column> <el-table-column align="center" label="文件附件"> <template #default="scope"> <el-link @click="openFilePreviewDialog(scope.row.wordUrl || '')"> {{ scope.row.wordUrl || '' }} </el-link> </template> </el-table-column> <el-table-column align="center" label="操作" width="60"> <template #default="scope"> <el-button size="small" type="primary" link @click="detail(scope.row)"> 查看 </el-button> </template> </el-table-column> </el-table> </template>