diff --git a/src/store/index.ts b/src/store/index.ts index 2ae6f53..b59b81f 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -20,6 +20,7 @@ interface State { eventDuration: number; realData: []; //实时数据 iframeLoad: boolean; + showMap: boolean; } // 初始状态 @@ -37,13 +38,14 @@ const state: State = { eventValue: 0.7, eventDuration: 5, realData: [], //实时数据 - iframeLoad: false, + iframeLoad: false,//无锡接线图是否加载完成 + showMap: true,//无锡地图显示 }; // 定义Mutation类型 enum Mutations { INCREMENT = "INCREMENT", - IFRAMELOAD = "IFRAMELOAD", + SET_STATE= "SET_STATE", SET_TOKEN = "SET_TOKEN", SET_TIME = "SET-TIME", SET_CONFIG = "SET-CONFIG-TIME", @@ -55,8 +57,9 @@ export default createStore({ [Mutations.INCREMENT](state: State) { state.count++; }, - [Mutations.IFRAMELOAD](state: State, data: boolean) { - state.iframeLoad = data; + [Mutations.SET_STATE](state: State, data: any) { + console.log("🚀 ~ data:", data) + state[data.key] = data.value; }, [Mutations.SET_TOKEN](state: State, data: any) { window.sessionStorage.setItem("token", data.token); @@ -103,8 +106,8 @@ export default createStore({ increment({ commit }) { commit(Mutations.INCREMENT); }, - setIframeLoad({ commit }, data: any) { - commit(Mutations.IFRAMELOAD,data); + setStateKey({ commit }, data: any) { + commit(Mutations.SET_STATE,data); }, setTimeType({ commit }, data: any) { commit(Mutations.SET_TIME, data); diff --git a/src/views/SagTraceResult_WX/components/bdMap.vue b/src/views/SagTraceResult_WX/components/bdMap.vue new file mode 100644 index 0000000..7b394f1 --- /dev/null +++ b/src/views/SagTraceResult_WX/components/bdMap.vue @@ -0,0 +1,472 @@ + + + + + + 变电站 + + + + + 暂降监测点 + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ + infoWindowPoint.gdName + }} + {{ + infoWindowPoint.stationName + }} + {{ + infoWindowPoint.busBarName + }} + {{ + infoWindowPoint.eventCount + }} + / + + + + + {{ value }} + + + + + + + + + + {{ value.busBarName + `-` + value.lineName }} + + + + {{ + infoWindowPoint.eventCount + }} + + + + + + + + + + diff --git a/src/views/SagTraceResult_WX/components/plan.vue b/src/views/SagTraceResult_WX/components/plan.vue index 925485a..68cfe7e 100644 --- a/src/views/SagTraceResult_WX/components/plan.vue +++ b/src/views/SagTraceResult_WX/components/plan.vue @@ -1,14 +1,10 @@ - - + + { + // store.dispatch("setStateKey", { key: "showMap", value: false }); // 监听来自 eventStatistics 组件的消息 window.addEventListener("message", handleMessage); getActive({}).then((res: any) => { @@ -65,12 +63,13 @@ onMounted(() => { }); // 子页面 const iframe = document.getElementById("iframeLeft"); - - // 监听 iframe 加载完成事件 - iframe.addEventListener("load", function () { - // 通知父页面:我已加载完毕 - store.dispatch("setIframeLoad", true); - }); + if (iframe) { + // 监听 iframe 加载完成事件 + iframe.addEventListener("load", function () { + // 通知父页面:我已加载完毕 + store.dispatch("setStateKey", { key: "iframeLoad", value: true }); + }); + } }); onUnmounted(() => {