Commit 618283e4 authored by huanghaoting's avatar huanghaoting

历史数据

parent d11947f5
This diff is collapsed.
...@@ -80,6 +80,7 @@ import zhCn from 'element-plus/dist/locale/zh-cn.mjs' ...@@ -80,6 +80,7 @@ import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import store from "../../store/index"; import store from "../../store/index";
import { getFileName } from '../../utils/utils'; import { getFileName } from '../../utils/utils';
import CfgSupply from '../../components/CfgSupply.vue'; import CfgSupply from '../../components/CfgSupply.vue';
import {boilerTitle , boilerHistory } from '../../dataJson/history/mock.js'; //导入模拟数据
//分页设置 //分页设置
const currentPage = ref(1) const currentPage = ref(1)
...@@ -256,7 +257,9 @@ function getdata() { ...@@ -256,7 +257,9 @@ function getdata() {
} }
function getcolumn() { function getcolumn() {
http.post("/api/boiler/Title", { enterpriseId: enterpriseId.value, deviceType: 2 }).then((result) => { //模拟的title数据
var result = boilerTitle;
// http.post("/api/boiler/Title", { enterpriseId: enterpriseId.value, deviceType: 2 }).then((result) => {
titleData.value = result.data.otherList; titleData.value = result.data.otherList;
var dataRows = new Array(); var dataRows = new Array();
result.data.frozenList.forEach((element) => { result.data.frozenList.forEach((element) => {
...@@ -290,7 +293,7 @@ function getcolumn() { ...@@ -290,7 +293,7 @@ function getcolumn() {
i++; i++;
}) })
otherList = othrows; otherList = othrows;
}) // })
} }
// 获取数据列表 // 获取数据列表
...@@ -303,7 +306,10 @@ function getBoiler() { ...@@ -303,7 +306,10 @@ function getBoiler() {
HisBoilerInfo.pageCount = pageSize.value - 1; HisBoilerInfo.pageCount = pageSize.value - 1;
} }
console.log(HisBoilerInfo); console.log(HisBoilerInfo);
http.post("/api/boiler/History", HisBoilerInfo).then((result) => {
//模拟的静态数据列表
var result = boilerHistory;
// http.post("/api/boiler/History", HisBoilerInfo).then((result) => {
console.log(result); console.log(result);
tableData.value = null; tableData.value = null;
if(result.data !== null){ if(result.data !== null){
...@@ -317,7 +323,7 @@ function getBoiler() { ...@@ -317,7 +323,7 @@ function getBoiler() {
total.value = 0; total.value = 0;
} }
loading.value = false; loading.value = false;
}); // });
} }
function setCellStyle({ row, column, rowIndex, columnIndex }) { function setCellStyle({ row, column, rowIndex, columnIndex }) {
...@@ -456,7 +462,7 @@ function getchart() { ...@@ -456,7 +462,7 @@ function getchart() {
const series = reactive([]); const series = reactive([]);
const titles = reactive([]); const titles = reactive([]);
const title = ref(); const title = ref();
let id = ""; let id = "";
id = HisBoilerInfo.id[0]; id = HisBoilerInfo.id[0];
HisBoilerInfo.id = []; HisBoilerInfo.id = [];
...@@ -577,4 +583,4 @@ function getchart() { ...@@ -577,4 +583,4 @@ function getchart() {
margin-top: -20px; margin-top: -20px;
margin-right: 30px; margin-right: 30px;
} }
</style> </style>
\ No newline at end of file
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<el-switch v-model="value" active-text="表格" inactive-text="曲线图" <el-switch v-model="value" active-text="表格" inactive-text="曲线图"
style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949;min-width: 130px;" @change="getchart" /> style="--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949;min-width: 130px;" @change="getchart" />
</el-form-item> </el-form-item>
<el-form-item label="选择设备:"> <el-form-item label="选择设备111:">
<el-select v-model="HisdeviceInfo.id" multiple="true" collapse-tags placeholder="请选择" style="min-width: 170px" > <el-select v-model="HisdeviceInfo.id" multiple="true" collapse-tags placeholder="请选择" style="min-width: 170px" >
<el-option v-for="item in options" :label="item.label" :value="item.value" /> <el-option v-for="item in options" :label="item.label" :value="item.value" />
</el-select> </el-select>
...@@ -96,6 +96,7 @@ import zhCn from 'element-plus/dist/locale/zh-cn.mjs' ...@@ -96,6 +96,7 @@ import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import store from "../../store/index"; import store from "../../store/index";
import { getFileName } from '../../utils/utils'; import { getFileName } from '../../utils/utils';
import CfgSupply from '../../components/CfgSupply.vue'; import CfgSupply from '../../components/CfgSupply.vue';
import {deviceTitle3, deviceHistory3} from '../../dataJson/history/mock.js'; //导入模拟数据
//分页设置 //分页设置
const currentPage = ref(1) const currentPage = ref(1)
...@@ -272,7 +273,9 @@ function getdata() { ...@@ -272,7 +273,9 @@ function getdata() {
} }
function getcolumn() { function getcolumn() {
http.post("/api/device/Title", { enterpriseId: enterpriseId.value, deviceType: 7 }).then((result) => { // http.post("/api/device/Title", { enterpriseId: enterpriseId.value, deviceType: 7 }).then((result) => {
// 模拟静态title数据
var result = deviceTitle3
titleData.value = result.data.otherList; titleData.value = result.data.otherList;
var dataRows = new Array(); var dataRows = new Array();
result.data.frozenList.forEach((element) => { result.data.frozenList.forEach((element) => {
...@@ -285,7 +288,7 @@ function getcolumn() { ...@@ -285,7 +288,7 @@ function getcolumn() {
filter: element.filter, filter: element.filter,
color: element.color, color: element.color,
isVisible: true isVisible: true
}); // });
}) })
frozenList = dataRows; frozenList = dataRows;
...@@ -318,7 +321,9 @@ function getdevice() { ...@@ -318,7 +321,9 @@ function getdevice() {
HisdeviceInfo.pageIndex = ((currentPage.value - 1) * pageSize.value) + 1; HisdeviceInfo.pageIndex = ((currentPage.value - 1) * pageSize.value) + 1;
HisdeviceInfo.pageCount = pageSize.value - 1; HisdeviceInfo.pageCount = pageSize.value - 1;
} }
http.post("/api/device/History", HisdeviceInfo).then((result) => { // http.post("/api/device/History", HisdeviceInfo).then((result) => {
// 模拟后端数据
var result = deviceHistory3;
console.log(result); console.log(result);
tableData.value = null; tableData.value = null;
if(result.data !== null){ if(result.data !== null){
...@@ -332,7 +337,7 @@ function getdevice() { ...@@ -332,7 +337,7 @@ function getdevice() {
total.value = 0; total.value = 0;
} }
loading.value = false; loading.value = false;
}); // });
} }
function setCellStyle({ row, column, rowIndex, columnIndex }) { function setCellStyle({ row, column, rowIndex, columnIndex }) {
...@@ -474,7 +479,7 @@ function getchart() { ...@@ -474,7 +479,7 @@ function getchart() {
const series = reactive([]); const series = reactive([]);
const titles = reactive([]); const titles = reactive([]);
const title = ref(); const title = ref();
let id = ""; let id = "";
id = HisdeviceInfo.id[0]; id = HisdeviceInfo.id[0];
HisdeviceInfo.id = []; HisdeviceInfo.id = [];
...@@ -596,4 +601,4 @@ function getchart() { ...@@ -596,4 +601,4 @@ function getchart() {
margin-top: -20px; margin-top: -20px;
margin-right: 30px; margin-right: 30px;
} }
</style> </style>
\ No newline at end of file
...@@ -80,6 +80,7 @@ import zhCn from 'element-plus/dist/locale/zh-cn.mjs' ...@@ -80,6 +80,7 @@ import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import store from "../../store/index"; import store from "../../store/index";
import { getFileName } from '../../utils/utils'; import { getFileName } from '../../utils/utils';
import CfgSupply from '../../components/CfgSupply.vue'; import CfgSupply from '../../components/CfgSupply.vue';
import {deviceTitle2, deviceHistory2} from '../../dataJson/history/mock.js'; //导入模拟数据
//分页设置 //分页设置
const currentPage = ref(1) const currentPage = ref(1)
...@@ -256,7 +257,10 @@ function getdata() { ...@@ -256,7 +257,10 @@ function getdata() {
} }
function getcolumn() { function getcolumn() {
http.post("/api/device/Title", { enterpriseId: enterpriseId.value, deviceType: 4 }).then((result) => { // http.post("/api/device/Title", { enterpriseId: enterpriseId.value, deviceType: 4 }).then((result) => {
// 模拟静态title数据
var result = deviceTitle2
titleData.value = result.data.otherList; titleData.value = result.data.otherList;
var dataRows = new Array(); var dataRows = new Array();
result.data.frozenList.forEach((element) => { result.data.frozenList.forEach((element) => {
...@@ -290,7 +294,7 @@ function getcolumn() { ...@@ -290,7 +294,7 @@ function getcolumn() {
i++; i++;
}) })
otherList = othrows; otherList = othrows;
}) // })
} }
//获取数据列表 //获取数据列表
...@@ -303,7 +307,8 @@ function getdevice() { ...@@ -303,7 +307,8 @@ function getdevice() {
HisdeviceInfo.pageCount = pageSize.value - 1; HisdeviceInfo.pageCount = pageSize.value - 1;
} }
console.log(HisdeviceInfo.interval); console.log(HisdeviceInfo.interval);
http.post("/api/device/History", HisdeviceInfo).then((result) => { // http.post("/api/device/History", HisdeviceInfo).then((result) => {
var result = deviceHistory2
console.log(result); console.log(result);
tableData.value = null; tableData.value = null;
if(result.data !== null){ if(result.data !== null){
...@@ -317,7 +322,7 @@ function getdevice() { ...@@ -317,7 +322,7 @@ function getdevice() {
total.value = 0; total.value = 0;
} }
loading.value = false; loading.value = false;
}); // });
} }
function setCellStyle({ row, column, rowIndex, columnIndex }) { function setCellStyle({ row, column, rowIndex, columnIndex }) {
...@@ -460,7 +465,7 @@ function getchart() { ...@@ -460,7 +465,7 @@ function getchart() {
const series = reactive([]); const series = reactive([]);
const titles = reactive([]); const titles = reactive([]);
const title = ref(); const title = ref();
let id = ""; let id = "";
id = HisdeviceInfo.id[0]; id = HisdeviceInfo.id[0];
HisdeviceInfo.id = []; HisdeviceInfo.id = [];
...@@ -582,4 +587,4 @@ function getchart() { ...@@ -582,4 +587,4 @@ function getchart() {
margin-top: -20px; margin-top: -20px;
margin-right: 30px; margin-right: 30px;
} }
</style> </style>
\ No newline at end of file
...@@ -79,6 +79,7 @@ import zhCn from 'element-plus/dist/locale/zh-cn.mjs' ...@@ -79,6 +79,7 @@ import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import store from "../../store/index"; import store from "../../store/index";
import { getFileName } from '../../utils/utils'; import { getFileName } from '../../utils/utils';
import CfgSupply from '../../components/CfgSupply.vue'; import CfgSupply from '../../components/CfgSupply.vue';
import {deviceTitle1, deviceHistory1} from '../../dataJson/history/mock.js'; //导入模拟数据
//分页设置 //分页设置
const currentPage = ref(1) const currentPage = ref(1)
...@@ -255,7 +256,9 @@ function getdata() { ...@@ -255,7 +256,9 @@ function getdata() {
} }
function getcolumn() { function getcolumn() {
http.post("/api/device/Title", { enterpriseId: enterpriseId.value, deviceType: 6 }).then((result) => { // http.post("/api/device/Title", { enterpriseId: enterpriseId.value, deviceType: 6 }).then((result) => {
//模拟静态title数据
var result = deviceTitle1
titleData.value = result.data.otherList; titleData.value = result.data.otherList;
var dataRows = new Array(); var dataRows = new Array();
result.data.frozenList.forEach((element) => { result.data.frozenList.forEach((element) => {
...@@ -289,7 +292,7 @@ function getcolumn() { ...@@ -289,7 +292,7 @@ function getcolumn() {
i++; i++;
}) })
otherList = othrows; otherList = othrows;
}) // })
} }
//获取数据列表 //获取数据列表
...@@ -302,7 +305,10 @@ function getdevice() { ...@@ -302,7 +305,10 @@ function getdevice() {
HisdeviceInfo.pageCount = pageSize.value - 1; HisdeviceInfo.pageCount = pageSize.value - 1;
} }
console.log(HisdeviceInfo.interval); console.log(HisdeviceInfo.interval);
http.post("/api/device/History", HisdeviceInfo).then((result) => { // http.post("/api/device/History", HisdeviceInfo).then((result) => {
//模拟静态的数据
const result = deviceHistory1
console.log(result); console.log(result);
tableData.value = null; tableData.value = null;
if(result.data !== null){ if(result.data !== null){
...@@ -316,7 +322,7 @@ function getdevice() { ...@@ -316,7 +322,7 @@ function getdevice() {
total.value = 0; total.value = 0;
} }
loading.value = false; loading.value = false;
}); // });
} }
function setCellStyle({ row, column, rowIndex, columnIndex }) { function setCellStyle({ row, column, rowIndex, columnIndex }) {
...@@ -459,7 +465,7 @@ function getchart() { ...@@ -459,7 +465,7 @@ function getchart() {
const series = reactive([]); const series = reactive([]);
const titles = reactive([]); const titles = reactive([]);
const title = ref(); const title = ref();
let id = ""; let id = "";
id = HisdeviceInfo.id[0]; id = HisdeviceInfo.id[0];
HisdeviceInfo.id = []; HisdeviceInfo.id = [];
...@@ -581,4 +587,4 @@ function getchart() { ...@@ -581,4 +587,4 @@ function getchart() {
margin-top: -20px; margin-top: -20px;
margin-right: 30px; margin-right: 30px;
} }
</style> </style>
\ No newline at end of file
...@@ -81,6 +81,10 @@ import zhCn from 'element-plus/dist/locale/zh-cn.mjs' ...@@ -81,6 +81,10 @@ import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import store from "../../store/index"; import store from "../../store/index";
import { getFileName } from '../../utils/utils'; import { getFileName } from '../../utils/utils';
import CfgSupply from '../../components/CfgSupply.vue'; import CfgSupply from '../../components/CfgSupply.vue';
import { pipeTitle,pipeHistory} from '../../dataJson/history/mock.js'; //导入模拟数据
console.log("sss")
console.log(pipeHistory)
//分页设置 //分页设置
const currentPage = ref(1) const currentPage = ref(1)
...@@ -281,7 +285,9 @@ function getdata() { ...@@ -281,7 +285,9 @@ function getdata() {
} }
function getcolumn() { function getcolumn() {
http.post("/api/pipe/Title", { enterpriseId: enterpriseId.value, deviceType: HisPipeInfo.deviceType }).then((result) => { //自己定义的静态数据
var result = pipeTitle
// http.post("/api/pipe/Title", { enterpriseId: enterpriseId.value, deviceType: HisPipeInfo.deviceType }).then((result) => {
if(result.success){ if(result.success){
titleData.value = result.data.otherList; titleData.value = result.data.otherList;
frozenList.length = 0; frozenList.length = 0;
...@@ -315,10 +321,11 @@ function getcolumn() { ...@@ -315,10 +321,11 @@ function getcolumn() {
i++; i++;
}) })
} }
}) // })
} }
//获取数据列表 //获取数据列表
function getPipe() { function getPipe() {
console.log(HisPipeInfo.startTime); console.log(HisPipeInfo.startTime);
if (currentPage.value == 1) { if (currentPage.value == 1) {
...@@ -328,18 +335,21 @@ function getPipe() { ...@@ -328,18 +335,21 @@ function getPipe() {
HisPipeInfo.pageIndex = ((currentPage.value - 1) * pageSize.value) + 1; HisPipeInfo.pageIndex = ((currentPage.value - 1) * pageSize.value) + 1;
HisPipeInfo.pageCount = pageSize.value - 1; HisPipeInfo.pageCount = pageSize.value - 1;
} }
if (HisPipeInfo.interval === undefined) { // if (HisPipeInfo.interval === undefined) {
HisPipeInfo.interval = 2; // HisPipeInfo.interval = 2;
} // }
http.post("/api/pipe/History", HisPipeInfo).then((result) => { //模拟的数据
var result = pipeHistory
// http.post("/api/pipe/History", HisPipeInfo).then((result) => {
tableData.value = result.data.dataInfoList; tableData.value = result.data.dataInfoList;
total.value = result.data.rowCount; total.value = result.data.rowCount;
if(result.data === null || HisPipeInfo.id.length < 1){ // if(result.data === null || HisPipeInfo.id.length < 1) 由于是模拟数据,修改一下判断条件
if(result.data === null || HisPipeInfo.id.length === 1){
tableData.value = null; tableData.value = null;
total.value = 0; total.value = 0;
} }
loading.value = false; loading.value = false;
}); // });
} }
function setCellStyle({ row, column, rowIndex, columnIndex }) { function setCellStyle({ row, column, rowIndex, columnIndex }) {
...@@ -484,7 +494,7 @@ function getchart() { ...@@ -484,7 +494,7 @@ function getchart() {
const series = reactive([]); const series = reactive([]);
const titles = reactive([]); const titles = reactive([]);
const title = ref(); const title = ref();
let id = ""; let id = "";
id = HisPipeInfo.id[0]; id = HisPipeInfo.id[0];
HisPipeInfo.id = []; HisPipeInfo.id = [];
...@@ -621,4 +631,4 @@ function getchart() { ...@@ -621,4 +631,4 @@ function getchart() {
width: 100%; width: 100%;
height: 160px; height: 160px;
} }
</style> </style>
\ No newline at end of file
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
<el-table :data="tableData" :height="tableHeight" v-loading="loading" :cell-style="setCellStyle" id="out-table" <el-table :data="tableData" :height="tableHeight" v-loading="loading" :cell-style="setCellStyle" id="out-table"
border highlight-current-row :header-cell-style="setHeaderCellStyle" @sort-change="sortMethod" :header-cell-class-name="handleHeadAddClass" > border highlight-current-row :header-cell-style="setHeaderCellStyle" @sort-change="sortMethod" :header-cell-class-name="handleHeadAddClass" >
<el-table-column v-for="(item, i) in frozenList" :prop="item.field" :label="item.title" :width="item.width" <el-table-column v-for="(item, i) in frozenList" :prop="item.field" :label="item.title" :width="item.width"
:sortable="(item.field === 'name' || item.field === 'gatherTime') ? true : false" :sortable="(item.field === 'name' || item.field === 'gatherTime') ? true : false"
fixed /> fixed />
<template v-for="(item, i) in otherList"> <template v-for="(item, i) in otherList">
<el-table-column v-if="item.isVisible" :prop="item.enName" :label="item.alias" :width="item.width"></el-table-column> <el-table-column v-if="item.isVisible" :prop="item.enName" :label="item.alias" :width="item.width"></el-table-column>
...@@ -101,6 +101,7 @@ import zhCn from 'element-plus/dist/locale/zh-cn.mjs' ...@@ -101,6 +101,7 @@ import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import store from "../../store/index"; import store from "../../store/index";
import { getFileName } from '../../utils/utils'; import { getFileName } from '../../utils/utils';
import CfgSupply from '../../components/CfgSupply.vue'; import CfgSupply from '../../components/CfgSupply.vue';
import { transferHisTitle,transferHistory} from '../../dataJson/history/mock.js'; //导入模拟数据
//分页设置 //分页设置
const currentPage = ref(1) const currentPage = ref(1)
...@@ -282,7 +283,9 @@ function getSupplys(){ ...@@ -282,7 +283,9 @@ function getSupplys(){
} }
function getcolumn() { function getcolumn() {
http.post("/api/transfer/HisTitle", enterpriseId.value).then((result) => { //模拟静态title数据
var result = transferHisTitle
// http.post("/api/transfer/HisTitle", enterpriseId.value).then((result) => {
titleData.value = result.data.otherList; titleData.value = result.data.otherList;
var dataRows = new Array(); var dataRows = new Array();
result.data.frozenList.forEach((element) => { result.data.frozenList.forEach((element) => {
...@@ -316,7 +319,7 @@ function getcolumn() { ...@@ -316,7 +319,7 @@ function getcolumn() {
i++; i++;
}) })
otherList = othrows; otherList = othrows;
}) // })
} }
//获取数据列表 //获取数据列表
...@@ -328,7 +331,9 @@ function gettransfer() { ...@@ -328,7 +331,9 @@ function gettransfer() {
HistransferInfo.pageIndex = ((currentPage.value - 1) * pageSize.value) + 1; HistransferInfo.pageIndex = ((currentPage.value - 1) * pageSize.value) + 1;
HistransferInfo.pageCount = pageSize.value - 1; HistransferInfo.pageCount = pageSize.value - 1;
} }
http.post("/api/transfer/History", HistransferInfo).then((result) => { //模拟静态数据列表
var result = transferHistory
// http.post("/api/transfer/History", HistransferInfo).then((result) => {
console.log(HistransferInfo); console.log(HistransferInfo);
tableData.value = null; tableData.value = null;
if(result.data !== null){ if(result.data !== null){
...@@ -340,7 +345,7 @@ function gettransfer() { ...@@ -340,7 +345,7 @@ function gettransfer() {
total.value = 0; total.value = 0;
} }
loading.value = false; loading.value = false;
}); // });
} }
function setCellStyle({ row, column, rowIndex, columnIndex }) { function setCellStyle({ row, column, rowIndex, columnIndex }) {
...@@ -483,7 +488,7 @@ function getchart() { ...@@ -483,7 +488,7 @@ function getchart() {
const series = reactive([]); const series = reactive([]);
const titles = reactive([]); const titles = reactive([]);
const title = ref(); const title = ref();
let id = ""; let id = "";
id = HistransferInfo.id[0]; id = HistransferInfo.id[0];
HistransferInfo.id = []; HistransferInfo.id = [];
...@@ -496,7 +501,7 @@ function getchart() { ...@@ -496,7 +501,7 @@ function getchart() {
if(ele.value === id){ if(ele.value === id){
title.value = ele.label; title.value = ele.label;
} }
}) })
}) })
}) })
http.post("/api/transfer/Curve", HistransferInfo).then((result) => { http.post("/api/transfer/Curve", HistransferInfo).then((result) => {
...@@ -617,4 +622,4 @@ function getchart() { ...@@ -617,4 +622,4 @@ function getchart() {
margin-right: 10px; margin-right: 10px;
flex-wrap: nowrap; flex-wrap: nowrap;
} }
</style> </style>
\ No newline at end of file
...@@ -79,6 +79,7 @@ import zhCn from 'element-plus/dist/locale/zh-cn.mjs' ...@@ -79,6 +79,7 @@ import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import store from "../../store/index"; import store from "../../store/index";
import { getFileName } from '../../utils/utils'; import { getFileName } from '../../utils/utils';
import CfgSupply from '../../components/CfgSupply.vue'; import CfgSupply from '../../components/CfgSupply.vue';
import { deviceTitle,deviceHistory} from '../../dataJson/history/mock.js'; ////导入模拟数据
//分页设置 //分页设置
const currentPage = ref(1) const currentPage = ref(1)
...@@ -255,7 +256,9 @@ function getdata() { ...@@ -255,7 +256,9 @@ function getdata() {
} }
function getcolumn() { function getcolumn() {
http.post("/api/device/Title", { enterpriseId: enterpriseId.value, deviceType: 5 }).then((result) => { //模拟静态title数据
var result = deviceTitle;
// http.post("/api/device/Title", { enterpriseId: enterpriseId.value, deviceType: 5 }).then((result) => {
titleData.value = result.data.otherList; titleData.value = result.data.otherList;
var dataRows = new Array(); var dataRows = new Array();
result.data.frozenList.forEach((element) => { result.data.frozenList.forEach((element) => {
...@@ -289,21 +292,42 @@ function getcolumn() { ...@@ -289,21 +292,42 @@ function getcolumn() {
i++; i++;
}) })
otherList = othrows; otherList = othrows;
}) // })
} }
//获取数据列表 //获取数据列表
function getdevice() { function getdevice() {
// if (currentPage.value == 1 ) {
// HisdeviceInfo.pageIndex = 0;
// HisdeviceInfo.pageCount = pageSize.value;
// } else {
// HisdeviceInfo.pageIndex = ((currentPage.value - 1) * pageSize.value) + 1;
// HisdeviceInfo.pageCount = pageSize.value - 1;
// }
// 初始化分页参数
let startIndex = 0;
let endIndex = 0;
if (currentPage.value == 1) { if (currentPage.value == 1) {
HisdeviceInfo.pageIndex = 0; startIndex = 0;
HisdeviceInfo.pageCount = pageSize.value; endIndex = 30; // 第一页显示 30 条数据
} else if (currentPage.value == 2) {
startIndex = 30;
endIndex = 50; // 第二页显示剩余的 20 条数据
} else { } else {
HisdeviceInfo.pageIndex = ((currentPage.value - 1) * pageSize.value) + 1; // 如果页码超出范围,可以设置为空数据或其他处理
HisdeviceInfo.pageCount = pageSize.value - 1; tableData.value = null;
total.value = 0;
loading.value = false;
return;
} }
//console.log(HisdeviceInfo.interval); //console.log(HisdeviceInfo.interval);
http.post("/api/device/History", HisdeviceInfo).then((result) => { // http.post("/api/device/History", HisdeviceInfo).then((result) => {
//模拟的数据
var result = deviceHistory
console.log(result); console.log(result);
tableData.value = null; tableData.value = null;
if(result.data !== null){ if(result.data !== null){
...@@ -312,12 +336,14 @@ function getdevice() { ...@@ -312,12 +336,14 @@ function getdevice() {
console.log(tableData.value); console.log(tableData.value);
} }
if(result.data === null || HisdeviceInfo.id.length < 1){
// if(result.data === null || HisdeviceInfo.id.length < 1)
if(result.data === null || HisdeviceInfo.id.length ===1) {
tableData.value = null; tableData.value = null;
total.value = 0; total.value = 0;
} }
loading.value = false; loading.value = false;
}); // });
} }
function setCellStyle({ row, column, rowIndex, columnIndex }) { function setCellStyle({ row, column, rowIndex, columnIndex }) {
...@@ -385,7 +411,7 @@ function currentTime() { ...@@ -385,7 +411,7 @@ function currentTime() {
// 导出表格 按钮点击后触发事件 // 导出表格 按钮点击后触发事件
async function exportExcel () { async function exportExcel () {
sessionStorage.setItem("DeviceQueryStart", HisdeviceInfo.startTime); sessionStorage.setItem("DeviceQueryStart", HisdeviceInfo.startTime);
sessionStorage.setItem("DeviceQueryEnd", HisdeviceInfo.endTime); sessionStorage.setItem("DeviceQueryEnd", HisdeviceInfo.endTime);
HisdeviceInfo.pageIndex = 0; HisdeviceInfo.pageIndex = 0;
...@@ -459,7 +485,7 @@ function getchart() { ...@@ -459,7 +485,7 @@ function getchart() {
const series = reactive([]); const series = reactive([]);
const titles = reactive([]); const titles = reactive([]);
const title = ref(); const title = ref();
let id = ""; let id = "";
id = HisdeviceInfo.id[0]; id = HisdeviceInfo.id[0];
HisdeviceInfo.id = []; HisdeviceInfo.id = [];
...@@ -581,4 +607,4 @@ function getchart() { ...@@ -581,4 +607,4 @@ function getchart() {
margin-top: -20px; margin-top: -20px;
margin-right: 30px; margin-right: 30px;
} }
</style> </style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment