修改 接线图第一次加载问题
This commit is contained in:
@@ -623,6 +623,7 @@ watch(flag, (newVal) => {
|
||||
setTimeout(() => {
|
||||
if (flag.value == 0) {
|
||||
initHasEventList();
|
||||
|
||||
// flag 变化后重新绑定事件
|
||||
bindRankingClickEvent();
|
||||
}
|
||||
@@ -635,6 +636,29 @@ watch(flag, (newVal) => {
|
||||
}
|
||||
}, 100);
|
||||
});
|
||||
watch(
|
||||
() => store.state.showMap,
|
||||
(newVal) => {
|
||||
if (newVal) {
|
||||
return;
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (flag.value == 0) {
|
||||
initHasEventList();
|
||||
|
||||
// flag 变化后重新绑定事件
|
||||
bindRankingClickEvent();
|
||||
}
|
||||
if (flag.value == 2) {
|
||||
renderChart2();
|
||||
initHasUpEventList();
|
||||
}
|
||||
if (flag.value == 1) {
|
||||
callHarmOneImageApi(getFirstTableData.value, getTimes.value);
|
||||
}
|
||||
}, 100);
|
||||
}
|
||||
);
|
||||
|
||||
// 暂降记录个数
|
||||
const initialData = () => {
|
||||
@@ -688,11 +712,9 @@ const initialAggregation = () => {
|
||||
tableData.splice(0, tableData.length);
|
||||
});
|
||||
};
|
||||
|
||||
const interval = ref(null);
|
||||
// 提取发送消息到iframe的公共方法
|
||||
const sendMessageToIframe = (type: string, payload: any) => {
|
||||
// console.log(123,store.state.iframeLoad);
|
||||
|
||||
// window.parent.postMessage(
|
||||
// {
|
||||
// type,
|
||||
@@ -701,6 +723,10 @@ const sendMessageToIframe = (type: string, payload: any) => {
|
||||
// "*"
|
||||
// );
|
||||
// 如果 iframe 已加载完成,直接发送消息
|
||||
if (store.state.showMap) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (store.state.iframeLoad) {
|
||||
window.parent.postMessage(
|
||||
{
|
||||
@@ -711,9 +737,13 @@ const sendMessageToIframe = (type: string, payload: any) => {
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (interval.value) {
|
||||
clearInterval(interval.value);
|
||||
interval.value = null;
|
||||
}
|
||||
|
||||
// 如果未加载完成,每 1 秒尝试发送一次
|
||||
const interval = setInterval(() => {
|
||||
interval.value = setInterval(() => {
|
||||
console.log("等待 iframe 加载,1 秒后重试...");
|
||||
if (store.state.iframeLoad) {
|
||||
// 加载完成后发送消息并清除定时器
|
||||
@@ -724,7 +754,7 @@ const sendMessageToIframe = (type: string, payload: any) => {
|
||||
},
|
||||
"*" // 建议替换为具体域名
|
||||
);
|
||||
clearInterval(interval);
|
||||
clearInterval(interval.value);
|
||||
}
|
||||
}, 1000);
|
||||
};
|
||||
@@ -1267,7 +1297,7 @@ const handleChildClose = () => {
|
||||
const init = () => {
|
||||
initialData();
|
||||
initialAggregation();
|
||||
initHasEventList();
|
||||
// initHasEventList();
|
||||
initialResponsibilityList();
|
||||
// getInfoListAmplify();
|
||||
tableInfoAmplify();
|
||||
|
||||
Reference in New Issue
Block a user