Newer
Older
xc-business-system / src / views / business / manager / sendReceive / components / certificate.vue
dutingting on 16 Aug 2023 2 KB 修复报错
<!-- 设备收发管理详情 -- 证书报告 -->
<script name="EquipmentInfoTableLDetail" lang="ts" setup>
import type { TableColumn } from '@/components/NormalTable/table_interface'
// 查询条件
const ListQuery = ref({
  limit: 10,
  offset: 1,
})
// 表格表头
const columns = ref<TableColumn[]>([
  { text: '证书编号', value: 'certificateReportCode', width: '160', align: 'center' },
  { text: '证书名称', value: 'certificateReportName', align: 'center' },
  { text: '溯源单位', value: '', align: 'center' },
  { text: '检定日期', value: '', align: 'center', width: '120' },
  { text: '检定有效期', value: '', align: 'center', width: '120' },
  { text: '证书附件', value: '', align: 'center', width: '120' },
])
const list = ref([]) // 列表
const total = ref(0) // 数据总数
const loading = ref(false) // 加载状态
// 获取证书报告列表
function fetchData(isNowPage = false) {
  if (!isNowPage) {
    // 是否显示当前页,否则跳转第一页
    ListQuery.value.offset = 1
  }
  loading.value = true
  list.value = []
  // certificateMonitorsById({ ...ListQuery.value }).then((res) => {
  //   list.value = res.data.rows
  //   total.value = parseInt(res.data.total)
  // })
  loading.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)
}
onMounted(() => {
  fetchData()
})
</script>

<template>
  <detail-block title="证书报告">
    <normal-table
      :data="list"
      :total="total"
      :query="ListQuery"
      :columns="columns"
      :list-loading="loading"
      :pagination="true"
      :page-sizes="[10, 20, 30]"
      @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>
    </normal-table>
  </detail-block>
</template>