|
@@ -361,7 +361,7 @@ import customHeader from '/@/components/vent/customHeader.vue';
|
|
|
import dayjs from 'dayjs';
|
|
|
|
|
|
let activeKey = ref('device');
|
|
|
-let cardList = ref<any[]>();
|
|
|
+let cardList = ref<any[]>([]);
|
|
|
let activeIndex = ref(null);
|
|
|
let isShow = ref(false);
|
|
|
let stationName = ref('');
|
|
@@ -460,20 +460,20 @@ let stationId = ref('');
|
|
|
const scroll = reactive({
|
|
|
y: 680,
|
|
|
});
|
|
|
-// //读取分站设备下拉选项数据
|
|
|
-// let timer: null | NodeJS.Timeout = null;
|
|
|
-// function getMonitor(flag = false) {
|
|
|
-// timer = setTimeout(
|
|
|
-// async () => {
|
|
|
-// await getDeviceList();
|
|
|
-// // if (timer) {
|
|
|
-// // timer = null;
|
|
|
-// // }
|
|
|
-// getMonitor();
|
|
|
-// },
|
|
|
-// flag ? 0 : 3000
|
|
|
-// );
|
|
|
-// }
|
|
|
+//定时刷新左侧分站数据
|
|
|
+let timer: null | NodeJS.Timeout = null;
|
|
|
+function getMonitor(flag = false) {
|
|
|
+ timer = setTimeout(
|
|
|
+ async () => {
|
|
|
+ await getSubStationList();
|
|
|
+ if (timer) {
|
|
|
+ timer = null;
|
|
|
+ }
|
|
|
+ getMonitor();
|
|
|
+ },
|
|
|
+ flag ? 0 : 3000
|
|
|
+ );
|
|
|
+}
|
|
|
let timer1: null | NodeJS.Timeout = null;
|
|
|
function getMonitor1(flag = false) {
|
|
|
timer1 = setTimeout(
|
|
@@ -509,11 +509,14 @@ async function getDeviceList() {
|
|
|
function onChangeTab(tab) {
|
|
|
activeKey.value = tab;
|
|
|
stationId.value = ''
|
|
|
+ clearTimeout(timer1);
|
|
|
+ clearTimeout(timer);
|
|
|
if (activeKey.value == 'device') {
|
|
|
- // clearTimeout(timer1);
|
|
|
getSubStationList();
|
|
|
+ getMonitor()
|
|
|
} else if (activeKey.value == 'history') {
|
|
|
getSubStationList();
|
|
|
+ getMonitor()
|
|
|
} else {
|
|
|
getStationList();
|
|
|
getMonitor1();
|
|
@@ -712,7 +715,6 @@ async function getSubStationList() {
|
|
|
getStationList1();
|
|
|
} else if (activeKey.value == 'history') {
|
|
|
getStationList();
|
|
|
- getMonitor1();
|
|
|
}
|
|
|
} else {
|
|
|
cardList.value = [];
|
|
@@ -982,6 +984,7 @@ async function handleDelStation() {
|
|
|
function handleCancelDelStation() { }
|
|
|
onMounted(() => {
|
|
|
getSubStationList();
|
|
|
+ getMonitor()
|
|
|
});
|
|
|
onUnmounted(() => {
|
|
|
if (timer) {
|