|
@@ -58,20 +58,26 @@ function pageChange({ pageSize, currentPage }: any) {
|
|
}
|
|
}
|
|
|
|
|
|
// 当前信息、历史记录
|
|
// 当前信息、历史记录
|
|
-async function fetchComputerData() {
|
|
|
|
|
|
+async function fetchComputerData(view) {
|
|
|
|
+ if (view === currentView.value) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
const query = {
|
|
const query = {
|
|
id: id,
|
|
id: id,
|
|
page: gridOptions.pagerConfig.page,
|
|
page: gridOptions.pagerConfig.page,
|
|
limit: gridOptions.pagerConfig.limit,
|
|
limit: gridOptions.pagerConfig.limit,
|
|
};
|
|
};
|
|
- switch (currentView.value) {
|
|
|
|
|
|
+
|
|
|
|
+ switch (view) {
|
|
case 'current':
|
|
case 'current':
|
|
|
|
+ currentView.value = 'current';
|
|
|
|
+ await useTableData(api.getCurrentTableData, query, gridOptions);
|
|
|
|
+ break;
|
|
|
|
+ case 'history':
|
|
currentView.value = 'history';
|
|
currentView.value = 'history';
|
|
await useTableData(api.getPastTableData, query, gridOptions);
|
|
await useTableData(api.getPastTableData, query, gridOptions);
|
|
break;
|
|
break;
|
|
- case 'history':
|
|
|
|
- currentView.value = 'current';
|
|
|
|
- await useTableData(api.getCurrentTableData, query, gridOptions);
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -161,8 +167,8 @@ onMounted(() => {
|
|
<el-card body-style="padding-top: 10px" class="mt-2.5" shadow="hover" style="border: none">
|
|
<el-card body-style="padding-top: 10px" class="mt-2.5" shadow="hover" style="border: none">
|
|
<vxe-grid :cell-style="cellStyle" :header-cell-style="headerCellStyle" v-bind="gridOptions">
|
|
<vxe-grid :cell-style="cellStyle" :header-cell-style="headerCellStyle" v-bind="gridOptions">
|
|
<template #toolbar_buttons>
|
|
<template #toolbar_buttons>
|
|
- <el-button :type="currentView === 'current' ? 'primary' : 'default'" @click="fetchComputerData"> 当前信息 </el-button>
|
|
|
|
- <el-button :type="currentView === 'history' ? 'primary' : 'default'" @click="fetchComputerData"> 历史记录 </el-button>
|
|
|
|
|
|
+ <el-button :type="currentView === 'current' ? 'primary' : 'default'" @click="fetchComputerData('current')"> 当前信息 </el-button>
|
|
|
|
+ <el-button :type="currentView === 'history' ? 'primary' : 'default'" @click="fetchComputerData('history')"> 历史记录 </el-button>
|
|
</template>
|
|
</template>
|
|
<template #pager>
|
|
<template #pager>
|
|
<vxe-pager
|
|
<vxe-pager
|