diff --git a/src/api/business/bench/bench.ts b/src/api/business/bench/bench.ts index 8794ef6..d9e4d45 100644 --- a/src/api/business/bench/bench.ts +++ b/src/api/business/bench/bench.ts @@ -2,9 +2,9 @@ import request from '../../index' // 样品监控 -export function getSampleMonitorList() { +export function getSampleMonitorList(data: { offset: number; limit: number }) { return request({ - url: '/workbench/sample/monitor/listPage', + url: `/workbench/sample/monitor/listPage?offset=${data.offset}&limit=${data.limit}`, method: 'get', }) } diff --git a/src/api/business/bench/bench.ts b/src/api/business/bench/bench.ts index 8794ef6..d9e4d45 100644 --- a/src/api/business/bench/bench.ts +++ b/src/api/business/bench/bench.ts @@ -2,9 +2,9 @@ import request from '../../index' // 样品监控 -export function getSampleMonitorList() { +export function getSampleMonitorList(data: { offset: number; limit: number }) { return request({ - url: '/workbench/sample/monitor/listPage', + url: `/workbench/sample/monitor/listPage?offset=${data.offset}&limit=${data.limit}`, method: 'get', }) } diff --git a/src/components/benchCol/index.vue b/src/components/benchCol/index.vue index 6f816d8..e406d0a 100644 --- a/src/components/benchCol/index.vue +++ b/src/components/benchCol/index.vue @@ -1,4 +1,6 @@ diff --git a/src/api/business/bench/bench.ts b/src/api/business/bench/bench.ts index 8794ef6..d9e4d45 100644 --- a/src/api/business/bench/bench.ts +++ b/src/api/business/bench/bench.ts @@ -2,9 +2,9 @@ import request from '../../index' // 样品监控 -export function getSampleMonitorList() { +export function getSampleMonitorList(data: { offset: number; limit: number }) { return request({ - url: '/workbench/sample/monitor/listPage', + url: `/workbench/sample/monitor/listPage?offset=${data.offset}&limit=${data.limit}`, method: 'get', }) } diff --git a/src/components/benchCol/index.vue b/src/components/benchCol/index.vue index 6f816d8..e406d0a 100644 --- a/src/components/benchCol/index.vue +++ b/src/components/benchCol/index.vue @@ -1,4 +1,6 @@ diff --git a/src/views/business/bench/bench.vue b/src/views/business/bench/bench.vue index 5fa06f9..0657cde 100644 --- a/src/views/business/bench/bench.vue +++ b/src/views/business/bench/bench.vue @@ -22,6 +22,13 @@ { text: '下一检测实验室', value: 'nextSegment', width: '125' }, { text: '进度', value: 'progressData', width: '140' }, ] +// 样品监控查询条件 +const listQuerySampleMonitor = ref({ + offset: 1, + limit: 10, +}) +const loadingTableSampleMonitor = ref(false) // 样品监控loading +const totalSampleMonitor = ref(0) // 样品监控数据总数 // 样品检测表头 const sampleMeasureHead = [ { text: '样品名称', value: 'sampleName' }, @@ -38,7 +45,7 @@ const reportHead = ref([ { text: '名称', value: 'certificateReportName', align: 'center' }, { text: '检定员', value: 'measurePersonName', align: 'center' }, - { text: '状态', value: 'status', align: 'center', width: '110' }, + { text: '状态', value: 'approvalStatusName', align: 'center', width: '110' }, ]) // 表头 @@ -96,18 +103,36 @@ // ---------------------------------------获取数据------------------------------------ // 样品监控 -const fetchSampleMonitorList = () => { - getSampleMonitorList().then((res) => { +const fetchSampleMonitorList = (isNowPage = false) => { + loadingTableSampleMonitor.value = true + if (!isNowPage) { + // 是否显示当前页,否则跳转第一页 + listQuerySampleMonitor.value.offset = 1 + } + getSampleMonitorList(listQuerySampleMonitor.value).then((res) => { + loadingTableSampleMonitor.value = false sampleMonitorData.value = res.data.rows.map((item: { progress: string; progressData: number }) => { if (item.progress.includes('%')) { item.progressData = Number(item.progress.slice(0, item.progress.indexOf('%'))) } console.log('进度', typeof item.progressData, item.progressData) - return item }) + totalSampleMonitor.value = parseInt(res.data.total) + }).catch(() => { + loadingTableSampleMonitor.value = false }) } +// 页数发生变化后的操作,可能是页码变化,可能是每页容量变化,此函数必写 +const changePage = (val: { size?: number; page?: number }) => { + if (val && val.size) { + listQuerySampleMonitor.value.limit = val.size + } + if (val && val.page) { + listQuerySampleMonitor.value.offset = val.page + } + fetchSampleMonitorList(true) +} // 证书报告 const listQueryReport = ({ @@ -124,31 +149,29 @@ }) // 证书报告获取列表数据 const fetchReportData = () => { - // loadingTable.value = true getReportList(listQueryReport).then((response) => { - reportData.value = response.data.rows - // loadingTable.value = false + reportData.value = response.data.rows.map((item: { approvalStatusName: string }) => { + return { + ...item, + // 已通过-可打印、审批中-审批中、其他所有状态-编制中 + approvalStatusName: item.approvalStatusName === '审批中' ? '审批中' : item.approvalStatusName === '已通过' ? '可打印' : '编制中', + } + }) }).catch((_) => { - // loadingTable.value = false }) } // 实时工作统计 -// 数据查询 function fetchJobAccountList() { - // loadingTable.value = true getJobAccountList().then((response) => { realTimeWorkStatisticsData.value = response.data - // loadingTable.value = false }) } // 样品检测列表 function fetchSampleMeasureList() { - // loadingTable.value = true getSampleMeasureList().then((response) => { - sampleMeasureData.value = response.data - // loadingTable.value = false + sampleMeasureData.value = response.data.rows }) } @@ -195,10 +218,15 @@ icon="icon-file" title="样品监控" :height="blockHeight" + :pagination="true" + :query="listQuerySampleMonitor" + :total="totalSampleMonitor" + @change="changePage" >