修改关联气象数据

This commit is contained in:
冯少康 2026-07-30 11:10:57 +08:00
parent c31bb50108
commit 110d82b723
4 changed files with 52 additions and 37 deletions

View File

@ -508,7 +508,7 @@ onMounted(() => {
right: 0; right: 0;
bottom: 0; bottom: 0;
/* 确保在最上层 */ /* 确保在最上层 */
z-index: 9999 !important; z-index: -1 !important;
/* 半透明背景 */ /* 半透明背景 */
background-color: rgba(255, 255, 255, 0.7); background-color: rgba(255, 255, 255, 0.7);
} }

View File

@ -153,6 +153,7 @@ function getList() {
dataSource: searchSelectValue.value || dataS, dataSource: searchSelectValue.value || dataS,
pageSize: pageSize.value, pageSize: pageSize.value,
pageNum: currentPage.value, pageNum: currentPage.value,
batchTime:searchPcSelectValue.value,
}, },
(res) => { (res) => {
taskList.value = res.rows; taskList.value = res.rows;
@ -414,7 +415,7 @@ getList();
@change="changeSjyValue" @change="changeSjyValue"
/> />
</ElFormItem> </ElFormItem>
<ElFormItem :label="t('timeBatch')"> <ElFormItem :label="t('timeBatch')" v-if="type === 'gkqx'">
<el-select-v2 <el-select-v2
v-model="searchPcSelectValue" v-model="searchPcSelectValue"
clearable clearable

View File

@ -10,46 +10,54 @@ const searchSelectValue = ref<any>(null);
const selectOption = ref<any>([]); const selectOption = ref<any>([]);
// //
const pickerValue = 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; let pollTimer = null;
// //
const isPolling = ref(false); const isPolling = ref(false);
// loading // loading
const pollLoading = ref(false); // const pollLoading = ref(false);
// // push
const pollResult = ref(null); const pollResult = ref([]);
// //
const emptyCount = ref(0); const emptyCount = ref(0);
//
const qxsjData = computed(() => {
//
return [...pollResult.value].reverse()
})
/** /**
* 轮询请求接口方法 * 轮询请求接口方法
*/ */
const fetchData = () => { const fetchData = () => {
// id0
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( getGlqxsjRzData(
{ {
lastId: "", lastId,
}, },
(res) => { (res) => {
console.log(222222, res);
// //
const isEmpty = !res.result || res.result.length === 0; const isEmpty = !res.result || res.result.length === 0;
if (isEmpty) { if (isEmpty) {
emptyCount.value += 1; emptyCount.value += 1;
// 2 // 2
if (emptyCount.value >= 2) { if (emptyCount.value >= 2||lastId) {
stopPoll(); stopPoll();
console.log("连续2次无数据终止轮询"); console.log("连续2次无数据终止轮询");
} }
} else { } else {
// //
emptyCount.value = 0; emptyCount.value = 0;
console.log("获取到数据,继续轮询"); pollResult.value.push(...res.result);
console.log("获取到数据,继续轮询",pollResult.value);
} }
} }
); );
@ -61,10 +69,10 @@ const startPoll = () => {
// //
emptyCount.value = 0; emptyCount.value = 0;
isPolling.value = true; isPolling.value = true;
pollLoading.value = true; // pollLoading.value = true;
// // //
fetchData(); // fetchData();
// 3 // 3
pollTimer = setInterval(fetchData, 3000); pollTimer = setInterval(fetchData, 3000);
}; };
@ -76,7 +84,7 @@ const stopPoll = () => {
pollTimer = null; pollTimer = null;
} }
isPolling.value = false; isPolling.value = false;
pollLoading.value = false; // pollLoading.value = false;
}; };
const dataSourceList = ref([ const dataSourceList = ref([
@ -86,21 +94,26 @@ const dataSourceList = ref([
]); ]);
const zxglClick = () => { const zxglClick = () => {
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(); startPoll();
// const startTime = dayjs(pickerValue.value[0]).format("YYYY-MM-DD"); }else{
// const endTime = dayjs(pickerValue.value[1]).format("YYYY-MM-DD"); pollResult.value = [{
// getZxglData( createTime:res.timestamp,
// { logContent:res.message
// dataType: searchSelectValue.value, }]
// startDate: startTime, }
// endDate: endTime, }
// }, );
// (res) => {
// if(res.code==200){
// startPoll();
// }
// }
// );
}; };
// //
</script> </script>
@ -127,15 +140,14 @@ const zxglClick = () => {
<el-date-picker <el-date-picker
v-model="pickerValue" v-model="pickerValue"
unlink-panels unlink-panels
type="datetimerange" type="daterange"
:default-time="new Date()" :default-time="new Date()"
range-separator="至" range-separator="至"
:start-placeholder="t('startDate')" :start-placeholder="t('startDate')"
:end-placeholder="t('endDate')" :end-placeholder="t('endDate')"
:disabled-minutes="() => Array.from({ length: 60 }, (_, i) => i)" :disabled-minutes="() => Array.from({ length: 60 }, (_, i) => i)"
:disabled-seconds="() => Array.from({ length: 60 }, (_, i) => i)" :disabled-seconds="() => Array.from({ length: 60 }, (_, i) => i)"
value-format="YYYY-MM-DD HH:00:00" value-format="YYYY-MM-DD"
:disabled-hours="disabledHour"
/> />
</ElFormItem> </ElFormItem>
<ElFormItem> <ElFormItem>
@ -145,7 +157,7 @@ const zxglClick = () => {
</ElFormItem> </ElFormItem>
</ElForm> </ElForm>
<div class="gltext-content"> <div class="gltext-content">
{{ pollResult }} <li v-for="(item,index) in qxsjData" :key="index">{{item.createTime}} {{item.logContent}}</li>
</div> </div>
</div> </div>
</template> </template>
@ -164,6 +176,7 @@ const zxglClick = () => {
border: solid 1px #064048; border: solid 1px #064048;
border-radius: 5px; border-radius: 5px;
color: #fff; color: #fff;
overflow: auto;
} }
:deep(.el-date-editor .el-range-separator) { :deep(.el-date-editor .el-range-separator) {

View File

@ -282,6 +282,7 @@ export async function getGlqxsjRzData(
url: `${serverIp}${baseURL}/weatherData/getLinkedDataLog`, url: `${serverIp}${baseURL}/weatherData/getLinkedDataLog`,
method: 'GET', method: 'GET',
params, params,
isLoding: true,
}); });
if (response.success && response.code === 200) { if (response.success && response.code === 200) {