修改关联气象数据

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;
bottom: 0;
/* 确保在最上层 */
z-index: 9999 !important;
z-index: -1 !important;
/* 半透明背景 */
background-color: rgba(255, 255, 255, 0.7);
}

View File

@ -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"
/>
</ElFormItem>
<ElFormItem :label="t('timeBatch')">
<ElFormItem :label="t('timeBatch')" v-if="type === 'gkqx'">
<el-select-v2
v-model="searchPcSelectValue"
clearable

View File

@ -10,46 +10,54 @@ const searchSelectValue = ref<any>(null);
const selectOption = ref<any>([]);
//
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 = () => {
// 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(
{
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
}]
}
}
);
};
//
</script>
@ -127,15 +140,14 @@ const zxglClick = () => {
<el-date-picker
v-model="pickerValue"
unlink-panels
type="datetimerange"
type="daterange"
:default-time="new Date()"
range-separator="至"
:start-placeholder="t('startDate')"
:end-placeholder="t('endDate')"
:disabled-minutes="() => Array.from({ length: 60 }, (_, i) => i)"
:disabled-seconds="() => Array.from({ length: 60 }, (_, i) => i)"
value-format="YYYY-MM-DD HH:00:00"
:disabled-hours="disabledHour"
value-format="YYYY-MM-DD"
/>
</ElFormItem>
<ElFormItem>
@ -145,7 +157,7 @@ const zxglClick = () => {
</ElFormItem>
</ElForm>
<div class="gltext-content">
{{ pollResult }}
<li v-for="(item,index) in qxsjData" :key="index">{{item.createTime}} {{item.logContent}}</li>
</div>
</div>
</template>
@ -164,6 +176,7 @@ const zxglClick = () => {
border: solid 1px #064048;
border-radius: 5px;
color: #fff;
overflow: auto;
}
:deep(.el-date-editor .el-range-separator) {

View File

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