Compare commits
2 Commits
859d890434
...
0ffc0cd01e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0ffc0cd01e | ||
|
|
079263ed38 |
@@ -58,7 +58,6 @@ export default createStore({
|
|||||||
state.count++;
|
state.count++;
|
||||||
},
|
},
|
||||||
[Mutations.SET_STATE](state: State, data: any) {
|
[Mutations.SET_STATE](state: State, data: any) {
|
||||||
console.log("🚀 ~ data:", data)
|
|
||||||
state[data.key] = data.value;
|
state[data.key] = data.value;
|
||||||
},
|
},
|
||||||
[Mutations.SET_TOKEN](state: State, data: any) {
|
[Mutations.SET_TOKEN](state: State, data: any) {
|
||||||
|
|||||||
@@ -362,7 +362,7 @@ defineExpose({
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 10px;
|
bottom: 10px;
|
||||||
left: 10px;
|
left: 10px;
|
||||||
z-index: 2000;
|
z-index: 1;
|
||||||
width: 110px;
|
width: 110px;
|
||||||
height: 70px;
|
height: 70px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|||||||
@@ -623,6 +623,7 @@ watch(flag, (newVal) => {
|
|||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (flag.value == 0) {
|
if (flag.value == 0) {
|
||||||
initHasEventList();
|
initHasEventList();
|
||||||
|
|
||||||
// flag 变化后重新绑定事件
|
// flag 变化后重新绑定事件
|
||||||
bindRankingClickEvent();
|
bindRankingClickEvent();
|
||||||
}
|
}
|
||||||
@@ -635,6 +636,29 @@ watch(flag, (newVal) => {
|
|||||||
}
|
}
|
||||||
}, 100);
|
}, 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 = () => {
|
const initialData = () => {
|
||||||
@@ -688,11 +712,9 @@ const initialAggregation = () => {
|
|||||||
tableData.splice(0, tableData.length);
|
tableData.splice(0, tableData.length);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
const interval = ref(null);
|
||||||
// 提取发送消息到iframe的公共方法
|
// 提取发送消息到iframe的公共方法
|
||||||
const sendMessageToIframe = (type: string, payload: any) => {
|
const sendMessageToIframe = (type: string, payload: any) => {
|
||||||
// console.log(123,store.state.iframeLoad);
|
|
||||||
|
|
||||||
// window.parent.postMessage(
|
// window.parent.postMessage(
|
||||||
// {
|
// {
|
||||||
// type,
|
// type,
|
||||||
@@ -701,6 +723,10 @@ const sendMessageToIframe = (type: string, payload: any) => {
|
|||||||
// "*"
|
// "*"
|
||||||
// );
|
// );
|
||||||
// 如果 iframe 已加载完成,直接发送消息
|
// 如果 iframe 已加载完成,直接发送消息
|
||||||
|
if (store.state.showMap) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (store.state.iframeLoad) {
|
if (store.state.iframeLoad) {
|
||||||
window.parent.postMessage(
|
window.parent.postMessage(
|
||||||
{
|
{
|
||||||
@@ -711,9 +737,13 @@ const sendMessageToIframe = (type: string, payload: any) => {
|
|||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (interval.value) {
|
||||||
|
clearInterval(interval.value);
|
||||||
|
interval.value = null;
|
||||||
|
}
|
||||||
|
|
||||||
// 如果未加载完成,每 1 秒尝试发送一次
|
// 如果未加载完成,每 1 秒尝试发送一次
|
||||||
const interval = setInterval(() => {
|
interval.value = setInterval(() => {
|
||||||
console.log("等待 iframe 加载,1 秒后重试...");
|
console.log("等待 iframe 加载,1 秒后重试...");
|
||||||
if (store.state.iframeLoad) {
|
if (store.state.iframeLoad) {
|
||||||
// 加载完成后发送消息并清除定时器
|
// 加载完成后发送消息并清除定时器
|
||||||
@@ -724,7 +754,7 @@ const sendMessageToIframe = (type: string, payload: any) => {
|
|||||||
},
|
},
|
||||||
"*" // 建议替换为具体域名
|
"*" // 建议替换为具体域名
|
||||||
);
|
);
|
||||||
clearInterval(interval);
|
clearInterval(interval.value);
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
};
|
};
|
||||||
@@ -1267,7 +1297,7 @@ const handleChildClose = () => {
|
|||||||
const init = () => {
|
const init = () => {
|
||||||
initialData();
|
initialData();
|
||||||
initialAggregation();
|
initialAggregation();
|
||||||
initHasEventList();
|
// initHasEventList();
|
||||||
initialResponsibilityList();
|
initialResponsibilityList();
|
||||||
// getInfoListAmplify();
|
// getInfoListAmplify();
|
||||||
tableInfoAmplify();
|
tableInfoAmplify();
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
frameborder="0"
|
frameborder="0"
|
||||||
scrolling="no"
|
scrolling="no"
|
||||||
id="iframeLeft"
|
id="iframeLeft"
|
||||||
|
:key="keyof"
|
||||||
@load="onIframeLoad"
|
@load="onIframeLoad"
|
||||||
></iframe>
|
></iframe>
|
||||||
<el-button class="backButton" @click="backButton" size="small" :icon="Back"
|
<el-button class="backButton" @click="backButton" size="small" :icon="Back"
|
||||||
@@ -35,7 +36,7 @@ const props = defineProps<{
|
|||||||
}>();
|
}>();
|
||||||
|
|
||||||
const iframeSrc = ref("");
|
const iframeSrc = ref("");
|
||||||
|
const keyof = ref(0);
|
||||||
// 监听 props 变化
|
// 监听 props 变化
|
||||||
watch(
|
watch(
|
||||||
() => props.project,
|
() => props.project,
|
||||||
@@ -57,6 +58,7 @@ watch(
|
|||||||
// 点击监测点传入 接线图id
|
// 点击监测点传入 接线图id
|
||||||
const pointClick = (row: any) => {
|
const pointClick = (row: any) => {
|
||||||
setUrl(row.pictureId, row.pictureName);
|
setUrl(row.pictureId, row.pictureName);
|
||||||
|
keyof.value += 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
@@ -133,8 +135,10 @@ const sendKeysToIframe = (keyList: string[]) => {
|
|||||||
};
|
};
|
||||||
// 返回地图
|
// 返回地图
|
||||||
const backButton = () => {
|
const backButton = () => {
|
||||||
window.removeEventListener("message", handleMessage);
|
store.dispatch("setStateKey", { key: "iframeLoad", value: false });
|
||||||
store.dispatch("setStateKey", { key: "showMap", value: true });
|
store.dispatch("setStateKey", { key: "showMap", value: true });
|
||||||
|
|
||||||
|
// window.removeEventListener("message", handleMessage);
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
Reference in New Issue
Block a user