Newer
Older
xc-business-system / src / views / resource / technology / method / updateRecord.vue
<!-- 现行测试校准检定方法-更新记录 -->
<script name="MethodUpdateRecord" lang="ts" setup>
import type { TableColumn } from '@/components/NormalTable/table_interface'
import { getFileSystemList } from '@/api/resource/fileSystem'
const $props = defineProps({
  id: {
    type: String,
    required: true,
  },
})
const loadingTable = ref(false) // 表格loading

// 表头
const columns = ref<TableColumn[]>([
  { text: '实验室', value: 'labCodeName', align: 'center' },
  { text: '部门', value: 'groupCodeName', align: 'center' },
  { text: '文件编号', value: 'fileNo', align: 'center' },
  { text: '文件发放号', value: 'fileDistributeNo', align: 'center' },
  { text: '文件名称', value: 'fileName', align: 'center' },
  { text: '启用时间', value: 'effectiveDate', align: 'center' },
  { text: '温度要求', value: 'temperature', align: 'center' },
  { text: '湿度要求', value: 'humidity', align: 'center' },
])
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()
</script>

<template>
  <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>
</template>