From 110d82b72383ad08ecb04db529750113a4667c4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=AF=E5=B0=91=E5=BA=B7?= <2496371772@qq.com> Date: Thu, 30 Jul 2026 11:10:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=B3=E8=81=94=E6=B0=94?= =?UTF-8?q?=E8=B1=A1=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/tqybjs/index.vue | 2 +- src/pages/tqybjs/tab-2/index.vue | 3 +- src/pages/tqybjs/tab-3/index.vue | 83 +++++++++++++++++------------- src/utils/axios/tqyb/data/index.ts | 1 + 4 files changed, 52 insertions(+), 37 deletions(-) diff --git a/src/pages/tqybjs/index.vue b/src/pages/tqybjs/index.vue index cc0130cd..bc90c6db 100644 --- a/src/pages/tqybjs/index.vue +++ b/src/pages/tqybjs/index.vue @@ -508,7 +508,7 @@ onMounted(() => { right: 0; bottom: 0; /* 确保在最上层 */ - z-index: 9999 !important; + z-index: -1 !important; /* 半透明背景 */ background-color: rgba(255, 255, 255, 0.7); } diff --git a/src/pages/tqybjs/tab-2/index.vue b/src/pages/tqybjs/tab-2/index.vue index 7328f829..097cab3c 100644 --- a/src/pages/tqybjs/tab-2/index.vue +++ b/src/pages/tqybjs/tab-2/index.vue @@ -153,6 +153,7 @@ function getList() { dataSource: searchSelectValue.value || dataS, pageSize: pageSize.value, pageNum: currentPage.value, + batchTime:searchPcSelectValue.value, }, (res) => { taskList.value = res.rows; @@ -414,7 +415,7 @@ getList(); @change="changeSjyValue" /> - + (null); const selectOption = ref([]); // 时间选择 const pickerValue = ref([]); -function disabledHour() { - return [ - 1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 20, 21, 22, 23, - ]; -} // 定时器标识,用来清除轮询 let pollTimer = null; // 是否正在轮询标记,防止重复点击多次开启定时器 const isPolling = ref(false); // loading -const pollLoading = ref(false); -// 接口返回结果展示 -const pollResult = ref(null); +// const pollLoading = ref(false); +// 存放所有原始数据:旧数据在前,每次新增数据push到末尾【固定正序,不许改动】 +const pollResult = ref([]); // 连续空数据计数器 const emptyCount = ref(0); +// 页面渲染用的倒序数据(用计算属性最优,自动跟随变化) +const qxsjData = computed(() => { + // 拷贝一份再反转,不污染原数组 + return [...pollResult.value].reverse() +}) + /** * 轮询请求接口方法 */ const fetchData = () => { + + // 取原始数组最后一条id,无数据默认传0 + const lastItem = pollResult.value.at(-1); + const lastId = lastItem ? lastItem.id : "" + + // let id = pollResult.value.length? pollResult.value[pollResult.value.length-1].id:"" + console.log(lastId); getGlqxsjRzData( { - lastId: "", + lastId, }, (res) => { - console.log(222222, res); // 判断是否为空数组 const isEmpty = !res.result || res.result.length === 0; if (isEmpty) { emptyCount.value += 1; // 连续2次空,停止轮询 - if (emptyCount.value >= 2) { + if (emptyCount.value >= 2||lastId) { stopPoll(); console.log("连续2次无数据,终止轮询"); } } else { // 有数据,清空连续空计数,继续轮询 emptyCount.value = 0; - console.log("获取到数据,继续轮询"); + pollResult.value.push(...res.result); + console.log("获取到数据,继续轮询",pollResult.value); } } ); @@ -61,10 +69,10 @@ const startPoll = () => { // 重置状态 emptyCount.value = 0; isPolling.value = true; - pollLoading.value = true; + // pollLoading.value = true; - // 立即执行一次 - fetchData(); + // // 立即执行一次 + // fetchData(); // 每3秒执行 pollTimer = setInterval(fetchData, 3000); }; @@ -76,7 +84,7 @@ const stopPoll = () => { pollTimer = null; } isPolling.value = false; - pollLoading.value = false; + // pollLoading.value = false; }; const dataSourceList = ref([ @@ -86,21 +94,26 @@ const dataSourceList = ref([ ]); const zxglClick = () => { - startPoll(); - // const startTime = dayjs(pickerValue.value[0]).format("YYYY-MM-DD"); - // const endTime = dayjs(pickerValue.value[1]).format("YYYY-MM-DD"); - // getZxglData( - // { - // dataType: searchSelectValue.value, - // startDate: startTime, - // endDate: endTime, - // }, - // (res) => { - // if(res.code==200){ - // startPoll(); - // } - // } - // ); + const startTime = dayjs(pickerValue.value[0]).format("YYYY-MM-DD"); + const endTime = dayjs(pickerValue.value[1]).format("YYYY-MM-DD"); + pollResult.value = []; + getZxglData( + { + dataType: searchSelectValue.value, + startDate: startTime, + endDate: endTime, + }, + (res) => { + if(res.code==200){ + startPoll(); + }else{ + pollResult.value = [{ + createTime:res.timestamp, + logContent:res.message + }] + } + } + ); }; // 获取数据类型 @@ -127,15 +140,14 @@ const zxglClick = () => { @@ -145,7 +157,7 @@ const zxglClick = () => {
- {{ pollResult }} +
  • {{item.createTime}} {{item.logContent}}
  • @@ -164,6 +176,7 @@ const zxglClick = () => { border: solid 1px #064048; border-radius: 5px; color: #fff; + overflow: auto; } :deep(.el-date-editor .el-range-separator) { diff --git a/src/utils/axios/tqyb/data/index.ts b/src/utils/axios/tqyb/data/index.ts index cf63806f..98246b7e 100644 --- a/src/utils/axios/tqyb/data/index.ts +++ b/src/utils/axios/tqyb/data/index.ts @@ -282,6 +282,7 @@ export async function getGlqxsjRzData( url: `${serverIp}${baseURL}/weatherData/getLinkedDataLog`, method: 'GET', params, + isLoding: true, }); if (response.success && response.code === 200) {