修改关联气象数据
This commit is contained in:
parent
c31bb50108
commit
110d82b723
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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 = () => {
|
||||||
|
|
||||||
|
// 取原始数组最后一条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(
|
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 = () => {
|
||||||
startPoll();
|
const startTime = dayjs(pickerValue.value[0]).format("YYYY-MM-DD");
|
||||||
// const startTime = dayjs(pickerValue.value[0]).format("YYYY-MM-DD");
|
const endTime = dayjs(pickerValue.value[1]).format("YYYY-MM-DD");
|
||||||
// const endTime = dayjs(pickerValue.value[1]).format("YYYY-MM-DD");
|
pollResult.value = [];
|
||||||
// getZxglData(
|
getZxglData(
|
||||||
// {
|
{
|
||||||
// dataType: searchSelectValue.value,
|
dataType: searchSelectValue.value,
|
||||||
// startDate: startTime,
|
startDate: startTime,
|
||||||
// endDate: endTime,
|
endDate: endTime,
|
||||||
// },
|
},
|
||||||
// (res) => {
|
(res) => {
|
||||||
// if(res.code==200){
|
if(res.code==200){
|
||||||
// startPoll();
|
startPoll();
|
||||||
// }
|
}else{
|
||||||
// }
|
pollResult.value = [{
|
||||||
// );
|
createTime:res.timestamp,
|
||||||
|
logContent:res.message
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
};
|
};
|
||||||
// 获取数据类型
|
// 获取数据类型
|
||||||
</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) {
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user