Compare commits

..

2 Commits

Author SHA1 Message Date
guanj
7769c8db01 Merge branch 'master' of http://192.168.1.22:3000/Web/bigscreenWeb 2025-10-27 14:09:58 +08:00
guanj
c244b5b137 修改地图切换接线图逻辑 2025-10-27 14:09:47 +08:00
3 changed files with 179 additions and 166 deletions

BIN
src/assets/img/txzcwzj.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 916 B

View File

@@ -7,8 +7,8 @@
</div> </div>
<div class="div"> <div class="div">
<img src="@/assets/txycyzj.gif" alt="" /> <img src="@/assets/img/txzcwzj.png" alt="" />
<span>暂降监测点</span> <span>监测点</span>
</div> </div>
</div> </div>
<div class="bmSelect"> <div class="bmSelect">
@@ -70,7 +70,7 @@
v-for="path in areaLineInfo" v-for="path in areaLineInfo"
:key="path.lineId" :key="path.lineId"
:icon="path.icon" :icon="path.icon"
@click="markerClick(path)" @click="pointClick(path)"
></bm-marker> ></bm-marker>
</div> </div>
<bm-marker <bm-marker
@@ -81,75 +81,6 @@
:show="infoWindowPoint.show" :show="infoWindowPoint.show"
@close="infoWindowPoint.show = false" @close="infoWindowPoint.show = false"
> >
<el-descriptions
:title="infoWindowPoint.lineName"
style="min-width: 250px"
:column="1"
border
v-if="infoWindowPoint.lineId"
label-width="90px"
>
<el-descriptions-item label="供电区域">{{
infoWindowPoint.gdName
}}</el-descriptions-item>
<el-descriptions-item label="上级电站">{{
infoWindowPoint.stationName
}}</el-descriptions-item>
<el-descriptions-item label="上级母线">{{
infoWindowPoint.busBarName
}}</el-descriptions-item>
<el-descriptions-item label="暂降次数">{{
infoWindowPoint.eventCount
}}</el-descriptions-item>
<el-descriptions-item
label="用户"
v-if="infoWindowPoint.objName == null"
>/</el-descriptions-item
>
<template v-else>
<el-descriptions-item label="用户">
<div class="descriptionsBox">
<div
v-for="(value, index) in infoWindowPoint.objName.split(
';'
)"
style="white-space: nowrap"
>
{{ value }}
</div>
</div></el-descriptions-item
>
</template>
</el-descriptions>
<el-descriptions
:title="infoWindowPoint.stationName"
:column="1"
v-else
style="min-width: 250px"
border
>
<!-- <el-descriptions-item
:label="index == 0 ? '母线' : ''"
v-for="(value, index) in infoWindowPoint.lineEventDetails"
>
{{ value.busBarName + `-` + value.lineName }}
</el-descriptions-item> -->
<el-descriptions-item label="母线"
><div class="descriptionsBox">
<div
v-for="(value, index) in infoWindowPoint.lineEventDetails"
style="white-space: nowrap"
>
{{ value.busBarName + `-` + value.lineName }}
</div>
</div></el-descriptions-item
>
<el-descriptions-item label="暂降次数">{{
infoWindowPoint.eventCount
}}</el-descriptions-item>
</el-descriptions>
</bm-info-window> </bm-info-window>
</bm-marker> </bm-marker>
</baidu-map> </baidu-map>
@@ -157,10 +88,11 @@
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, reactive, nextTick } from "vue"; import { ref, reactive, nextTick, onMounted } from "vue";
import { substationCount } from "@/api/statistics/index"; import { substationCount } from "@/api/statistics/index";
import { useStore } from "vuex"; import { useStore } from "vuex";
// import { BmlMarkerClusterer } from "vue-baidu-map-3x"; // import { BmlMarkerClusterer } from "vue-baidu-map-3x";
const emit = defineEmits(["pointClick"]);
const store = useStore(); const store = useStore();
const mapRef = ref<any>(null); // 地图容器的ref const mapRef = ref<any>(null); // 地图容器的ref
const mapInstance: any = ref(null); // 百度地图实例 const mapInstance: any = ref(null); // 百度地图实例
@@ -177,8 +109,8 @@ const infoWindowPoint = ref<any>({
show: false, show: false,
}); });
const center = ref({ const center = ref({
lng: 120.12, lng: 120.124367,
lat: 31.55, lat: 31.555421,
}); });
const value = ref(""); const value = ref("");
const handler = async ({ BMap, map }: any) => { const handler = async ({ BMap, map }: any) => {
@@ -198,14 +130,19 @@ const markerClick = (e: any) => {
zoom.value = 15; zoom.value = 15;
infoWindowPoint.value = e; infoWindowPoint.value = e;
infoWindowPoint.value.show = true; infoWindowPoint.value.show = true;
center.value.lng = 116.404367; center.value.lng = 120.124367;
center.value.lat = 39.915421; center.value.lat = 31.555421;
setTimeout(() => { setTimeout(() => {
center.value.lng = e.lng; center.value.lng = e.lng;
center.value.lat = e.lat + 0.01; center.value.lat = e.lat + 0.01;
}, 0); }, 0);
}; };
// 点击监测点
const pointClick = (e: any) => {
emit("pointClick", e);
store.dispatch("setStateKey", { key: "showMap", value: false });
};
const init = () => { const init = () => {
loading.value = true; loading.value = true;
@@ -213,13 +150,36 @@ const init = () => {
polyline.value = []; polyline.value = [];
dataList.value = []; dataList.value = [];
areaLineInfo.value = []; areaLineInfo.value = [];
substationCount({ // substationCount({
deptId: store.state.deptId, // deptId: store.state.deptId,
type: store.state.timeType, // type: store.state.timeType,
startTime: store.state.timeValue[0], // startTime: store.state.timeValue[0],
endTime: store.state.timeValue[1], // endTime: store.state.timeValue[1],
}).then((res: any) => { // }).then((res: any) => {
dataList.value = res.data; // dataList.value = res.data;
dataList.value = [
{
stationId: 156,
stationName: "110kV北京电视台变",
gdName: "检修分公司",
longitude: 120.33,
latitude: 31.52,
lineCount: 1,
eventCount: 1,
lineEventDetails: [
{
gdName: "检修分公司",
pictureId: "5debb8bd0ce26527675eedffd74a3198",
pictureName: "无锡线上",
},
{
gdName: "检修分公司",
pictureId: "35b1301833e3fdfc872b1a27a17c7245",
pictureName: "无锡修改1011--工程部",
},
],
},
];
let data = dataList.value; let data = dataList.value;
let r = 0.0035; let r = 0.0035;
let list = data.filter((item: any) => item.latitude != 0); let list = data.filter((item: any) => item.latitude != 0);
@@ -251,14 +211,13 @@ const init = () => {
r * Math.sin((2 * Math.PI * i) / item.lineEventDetails.length); r * Math.sin((2 * Math.PI * i) / item.lineEventDetails.length);
// 监测点图标 // 监测点图标
val.icon = { val.icon = {
url: "", url: new URL("@/assets/img/txzcwzj.png", import.meta.url).href,
size: { size: {
width: 40, width: 40,
height: 40, height: 40,
}, },
}; };
val.icon.url = new URL("@/assets/txycyzj.gif", import.meta.url).href;
polyline.value.push([ polyline.value.push([
{ {
lng: item.lng, lng: item.lng,
@@ -276,11 +235,11 @@ const init = () => {
siteList.value = list; siteList.value = list;
zoom.value = 12; // zoom.value = 12;
setTimeout(() => { setTimeout(() => {
loading.value = false; loading.value = false;
}, 0); }, 0);
}); // });
}; };
const moveenFlag = ref(true); const moveenFlag = ref(true);
@@ -364,20 +323,26 @@ const setIcon = (e: string) => {
moveenFlag.value = false; moveenFlag.value = false;
siteList.value.forEach((item: any) => { siteList.value.forEach((item: any) => {
if (item.stationName == e) { if (item.stationName == e) {
// center.value.lng = item.lng; center.value.lng = 120.124367;
// center.value.lat = item.lat + 0.01; center.value.lat = 31.555421;
setTimeout(() => {
center.value.lng = item.lng;
center.value.lat = item.lat + 0.01;
infoWindowPoint.value = item; infoWindowPoint.value = item;
infoWindowPoint.value.show = true; infoWindowPoint.value.show = true;
zoom.value = 15; zoom.value = 15;
}, 0);
} }
}); });
setTimeout(() => { setTimeout(() => {
moveenFlag.value = true; moveenFlag.value = true;
}, 1500); }, 1500);
}; };
onMounted(() => {
init();
});
defineExpose({ defineExpose({
init,
setIcon, setIcon,
}); });
</script> </script>
@@ -390,7 +355,7 @@ defineExpose({
height: 600px; height: 600px;
} }
.bm-view { .bm-view {
width: 99%; width: 100%;
height: 980px; height: 980px;
} }
.iconBox { .iconBox {
@@ -458,15 +423,37 @@ defineExpose({
/* .BMap_pop div { /* .BMap_pop div {
background-color: #343849c7 !important; background-color: #343849c7 !important;
} */ } */
.BMap_top,
.BMap_bottom {
background-color: #343849c7 !important;
}
/* .BMap_pop div:nth-child(1) {
background-color: #343849c7 !important;
} */
.BMap_pop > div:nth-child(1) > div,
.BMap_pop > div:nth-child(3) > div,
.BMap_pop > div:nth-child(5) > div,
.BMap_pop > div:nth-child(7) > div {
background-color: #343849c7 !important;
}
.BMap_pop > div:nth-child(8) > img {
display: none;
}
.BMap_pop > div:nth-child(8) {
/* 设置边框宽度和颜色,上边框为可见颜色,其他边框为透明 */
width: 0 !important;
height: 0 !important;
border-left: 20px solid transparent;
border-right: 20px solid transparent;
border-top: 20px solid #343849c7; /* 倒三角的颜色 */
transform: translateX(-26px) translateY(24px);
/* 可选:添加阴影增强视觉效果 */
/* box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); */
}
.bmSelect { .bmSelect {
position: absolute; position: absolute;
right: 10px; right: 10px;
top: 10px; top: 10px;
z-index: 2000; z-index: 2000;
} }
.bm-view {
border: 0;
background-color: transparent;
}
</style> </style>

View File

@@ -1,6 +1,11 @@
<template> <template>
<div class="plan"> <div class="plan">
<bdMap v-show="store.state.showMap" width="100%" height="100%"></bdMap> <bdMap
v-show="store.state.showMap"
width="100%"
height="100%"
@pointClick="pointClick"
></bdMap>
<!-- 添加加载事件监听 --> <!-- 添加加载事件监听 -->
<iframe <iframe
@@ -13,13 +18,17 @@
id="iframeLeft" id="iframeLeft"
@load="onIframeLoad" @load="onIframeLoad"
></iframe> ></iframe>
<el-button class="backButton" @click="backButton" size="small" :icon="Back"
>返回</el-button
>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch, onMounted, onUnmounted } from "vue"; import { ref, watch, onMounted, onUnmounted } from "vue";
import { getActive } from "@/api/manage_wx/index"; import { getActive } from "@/api/manage_wx/index";
import { useStore } from "vuex"; import { Back } from "@element-plus/icons-vue";
import bdMap from "./bdMap.vue"; import bdMap from "./bdMap.vue";
import { useStore } from "vuex";
const store = useStore(); const store = useStore();
const props = defineProps<{ const props = defineProps<{
project: { id: string; name: string } | null; project: { id: string; name: string } | null;
@@ -45,32 +54,37 @@ watch(
}, },
{ immediate: true, deep: true } { immediate: true, deep: true }
); );
// 点击监测点传入 接线图id
const pointClick = (row: any) => {
setUrl(row.pictureId, row.pictureName);
};
onMounted(() => { onMounted(() => {
// store.dispatch("setStateKey", { key: "showMap", value: false });
// 监听来自 eventStatistics 组件的消息 // 监听来自 eventStatistics 组件的消息
window.addEventListener("message", handleMessage); window.addEventListener("message", handleMessage);
getActive({}).then((res: any) => { getActive({}).then((res: any) => {
if (res.code == "A0000") { if (res.code == "A0000") {
// window.location.origin // window.location.origin
setUrl(res.data.id, res.data.name);
}
});
});
const setUrl = (url: string, nam: string) => {
iframeSrc.value = iframeSrc.value =
window.location.origin + // window.location.origin +
// "http://192.168.1.128:4001" + "http://192.168.1.179:4001" +
`/zutai/?id=${res.data.id}&&name=${encodeURIComponent( `/zutai/?id=${url}&&name=${encodeURIComponent(
res.data.name nam
)}&&preview=true&&display=true&&graphicDisplay=wx#/preview`; )}&&preview=true&&display=true&&graphicDisplay=wx#/preview`;
} // const iframe = document.getElementById("iframeLeft");
}); // if (iframe) {
// 子页面 // // 监听 iframe 加载完成事件
const iframe = document.getElementById("iframeLeft"); // iframe.addEventListener("load", function () {
if (iframe) { // // 通知父页面:我已加载完毕
// 监听 iframe 加载完成事件 // store.dispatch("setStateKey", { key: "iframeLoad", value: true });
iframe.addEventListener("load", function () { // });
// 通知父页面:我已加载完毕 // }
store.dispatch("setStateKey", { key: "iframeLoad", value: true }); };
});
}
});
onUnmounted(() => { onUnmounted(() => {
// 清理事件监听器 // 清理事件监听器
@@ -79,6 +93,7 @@ onUnmounted(() => {
// iframe 加载完成回调 添加加载事件监听 // iframe 加载完成回调 添加加载事件监听
const onIframeLoad = () => { const onIframeLoad = () => {
store.dispatch("setStateKey", { key: "iframeLoad", value: true });
// console.log("iframe 加载完成"); // console.log("iframe 加载完成");
// 通知 securityDetail.vue 组件 iframe 已加载完成 // 通知 securityDetail.vue 组件 iframe 已加载完成
window.postMessage( window.postMessage(
@@ -116,6 +131,11 @@ const sendKeysToIframe = (keyList: string[]) => {
); // 在生产环境中应该指定具体的域名而不是 '*' ); // 在生产环境中应该指定具体的域名而不是 '*'
} }
}; };
// 返回地图
const backButton = () => {
window.removeEventListener("message", handleMessage);
store.dispatch("setStateKey", { key: "showMap", value: true });
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.plan { .plan {
@@ -123,4 +143,10 @@ const sendKeysToIframe = (keyList: string[]) => {
height: 990px; height: 990px;
padding: 5px; padding: 5px;
} }
.backButton {
position: absolute;
right: 10px;
top: 10px;
z-index: 1;
}
</style> </style>