修改关联气象数据
This commit is contained in:
parent
c31bb50108
commit
110d82b723
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 = () => {
|
||||
|
||||
// 取原始数组最后一条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
|
||||
}]
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
// 获取数据类型
|
||||
</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) {
|
||||
|
|
|
|||
|
|
@ -282,6 +282,7 @@ export async function getGlqxsjRzData(
|
|||
url: `${serverIp}${baseURL}/weatherData/getLinkedDataLog`,
|
||||
method: 'GET',
|
||||
params,
|
||||
isLoding: true,
|
||||
});
|
||||
|
||||
if (response.success && response.code === 200) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user