<script setup name="history">
|
import { ref, reactive, watch, onMounted, onActivated } from "vue";
|
import siteList from "@/components/siteList/index.vue";
|
import getQueryString from "@/utils/getQueryString";
|
import formatSeconds from '@/utils/formatSeconds';
|
import hisTest from "./hisTest.vue";
|
import hisReal from "./hisReal.vue";
|
|
import { useRoute, useRouter } from "vue-router";
|
import useWebSocket from "@/hooks/useWebSocket";
|
|
const route = useRoute();
|
const router = useRouter();
|
|
const flag = ref(Math.random());
|
|
const curStationId = ref(
|
getQueryString("stationId") || ''
|
);
|
|
const curPowerId = ref(
|
getQueryString("powerId") || ''
|
);
|
|
const curBattgroupId = ref(
|
getQueryString("battgroupId") || ''
|
);
|
|
const curDevId = ref(
|
getQueryString("devId") || ''
|
);
|
|
|
const fullName = ref('');
|
const pageTab = ref(getQueryString('pageTab') || 'his-test');
|
|
const show_num = ref(5);
|
function testRecordChange() {
|
|
}
|
|
function leafClick(item) {
|
// console.log('item', item, '=============');
|
curStationId.value = item.stationId;
|
curPowerId.value = item.powerId;
|
curBattgroupId.value = item.battgroupId || 0;
|
curDevId.value = item.devId || 0;
|
// fullName.value = item.fullName;
|
}
|
|
function goRt() {
|
router.push({
|
path: '/datas/realtime',
|
query: {
|
stationId: curStationId.value || 0,
|
powerId: curPowerId.value || 0,
|
devId: curDevId.value || 0,
|
battgroupId: curBattgroupId.value || 0,
|
pageFlag: Math.random(),
|
}
|
});
|
}
|
|
onActivated(async () => {
|
let pageFlag = getQueryString("pageFlag");
|
// console.log('pageFlag', pageFlag, flag.value, '=============');
|
|
if (pageFlag && pageFlag != flag.value) {
|
pageTab.value = getQueryString('pageTab') || 'his-test';
|
flag.value = pageFlag;
|
}
|
});
|
|
</script>
|
|
<template>
|
<div class="page-contain">
|
<site-list @leaf-click="leafClick"></site-list>
|
<div class="page-inner">
|
<div class="page-header">
|
<div class="btn-grp">
|
<el-radio-group v-model="pageTab">
|
<el-radio-button label="历史测试数据" value="his-test" />
|
<el-radio-button label="历史实时数据" value="his-real" />
|
</el-radio-group>
|
</div>
|
<div class="p-title">{{ fullName }}</div>
|
<div class="btn-grp pos">
|
<!-- <div class="data-granularity" v-if="pageTab === 'his-test'"> -->
|
<div class="data-granularity" >
|
<label style="font-size: 12px; margin-right: 8px">显示粒度:</label>
|
<el-select
|
v-model="show_num"
|
size="small"
|
style="width: 90px"
|
@change="testRecordChange"
|
>
|
<el-option :value="1" label="×1"></el-option>
|
<el-option :value="2" label="×2"></el-option>
|
<el-option :value="3" label="×3"></el-option>
|
<el-option :value="4" label="×4"></el-option>
|
<el-option :value="5" label="×5"></el-option>
|
<el-option :value="6" label="×6"></el-option>
|
<el-option :value="7" label="×7"></el-option>
|
<el-option :value="8" label="×8"></el-option>
|
<el-option :value="9" label="×9"></el-option>
|
<el-option :value="10" label="×10"></el-option>
|
</el-select>
|
</div>
|
<el-button type="primary" size="small" @click="goRt">实时监测</el-button>
|
</div>
|
</div>
|
<div class="page-main">
|
<!-- 历史测试数据 -->
|
<his-test :battgroupId="curBattgroupId" :num="show_num" v-if="pageTab == 'his-test'"></his-test>
|
<!-- 历史实时数据 -->
|
<his-real :battgroupId="curBattgroupId" :num="show_num" v-if="pageTab == 'his-real'"></his-real>
|
</div>
|
</div>
|
</div>
|
</template>
|
|
<style scoped lang="less">
|
.page-contain {
|
display: flex;
|
padding: 8px 8px 8px 0;
|
margin-left: 8px;
|
overflow: hidden;
|
.page-inner {
|
display: flex;
|
flex-direction: column;
|
flex: 1;
|
margin-left: 8px;
|
}
|
|
.page-header {
|
// border: 1px solid #0ff;
|
background: #071426;
|
position: relative;
|
display: flex;
|
align-items: center;
|
border-bottom: 1px solid #497AAB;
|
padding-right: 16em;
|
|
.btn-grp {
|
display: flex;
|
align-items: center;
|
.data-granularity {
|
margin-right: 0.6em;
|
}
|
&.pos {
|
position: absolute;
|
right: 8px;
|
top: 0;
|
height: 100%;
|
}
|
:deep(.el-radio-group) {
|
label {
|
~ label {
|
margin-left: 10px;
|
}
|
}
|
span {
|
border-radius: 0;
|
border: 0 none;
|
background: #134bab;
|
color: #fff;
|
}
|
.is-active {
|
span {
|
background-color: #47cafe;
|
color: #0e344e;
|
}
|
}
|
}
|
}
|
|
.p-title {
|
flex: 1;
|
font-size: 18px;
|
font-weight: 700;
|
color: #50c7f1;
|
height: 42px;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
}
|
|
.status-bar {
|
height: 72px;
|
display: flex;
|
flex-direction: row;
|
|
.status-item {
|
flex: 1;
|
font-size: 14px;
|
font-weight: 700;
|
color: #50c7f1;
|
// border: 1px solid #0F6B79;
|
border-radius: 6px;
|
margin: 4px 2px;
|
display: flex;
|
flex-direction: column;
|
justify-content: center;
|
align-items: center;
|
box-shadow: inset 0 0 30px -10px #0F6B79;
|
background: radial-gradient(circle at -10% center, #1F6571 5%, transparent 20%) no-repeat,
|
radial-gradient(circle at 110% center, #1F6571 5%, transparent 20%) no-repeat,
|
radial-gradient(circle at center -72%, #1F6571 12%, transparent 50%) no-repeat,
|
radial-gradient(circle at center 138%, #1F6571 12%, transparent 50%) no-repeat;
|
|
.item-value {
|
margin-bottom: 6px;
|
color: #ff0;
|
font-size: 20px;
|
&.time {
|
white-space: nowrap;
|
font-size: 12px;
|
}
|
}
|
|
.item-name {
|
color: #6DCCE6;
|
}
|
}
|
}
|
|
.p-tabs {
|
display: flex;
|
flex-direction: row;
|
height: 46px;
|
border: 1px solid #426EA0;
|
padding: 4px;
|
|
.tab-item {
|
font-size: 14px;
|
font-weight: 700;
|
flex: 1;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
margin-left: 2px;
|
margin-right: 2px;
|
background: #073451;
|
cursor: pointer;
|
|
&.active {
|
background: #47CAFE;
|
color: #03216e;
|
}
|
&.btn-item {
|
background: #076fe8;
|
// border-radius: 6px;
|
}
|
}
|
}
|
}
|
|
.page-main {
|
flex: 1;
|
padding-left: 0;
|
padding-right: 0;
|
.tab-contain {
|
height: 100%;
|
}
|
|
}
|
}
|
</style>
|