diff --git a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/map.js b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/map.js index d00e4d0b..dd6222fc 100644 --- a/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/map.js +++ b/ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/map.js @@ -343,9 +343,10 @@ export class MarkerCluster { const findIndex = this.data.findIndex( (removeData) => removeData === item ); - let { stakeMark } = item.extData; + let { stakeMark, direction } = item.extData; stakeMark = upperFirst(stakeMark); //统一格式 大写K - const existNode = graphInstance.getCellById(stakeMark); + const id = `${stakeMark}_${direction || ""}`; + const existNode = graphInstance.getCellById(id); const lnglat = item.lnglat; if (lnglat) { const { lat, lng } = getLatAndLng(lnglat); @@ -357,10 +358,10 @@ export class MarkerCluster { window.graphInstance.removeNode(existNode.id); else { //更新节点 - const updateNode = graphInstance.getCellById(stakeMark); + const updateNode = graphInstance.getCellById(id); updateNode.updateData(getDataConf(lngLatArr, item.extData)); } - } else window.graphInstance.removeNode(stakeMark); + } else window.graphInstance.removeNode(id); } } if (findIndex > -1) this.data.splice(findIndex, 1); @@ -482,9 +483,10 @@ export function marksAddInGraph(data) { export function addInGraphHandle(data) { const graphInstance = window.graphInstance; const extData = data[0].extData; + console.log(extData, "extData"); const { item: eventItem } = data[0].config; if (eventItem.id.match("./事件专题")) { - let { stakeMark, lang } = extData; + let { stakeMark, lang, direction } = extData; stakeMark = upperFirst(stakeMark); //统一格式 大写K const distance = (Number( @@ -496,7 +498,8 @@ export function addInGraphHandle(data) { const node = { shape: "custom-html", effect: ["data"] }; node.data = getDataConf(data, extData); - const existNode = graphInstance.getCellById(stakeMark); + const id = `${stakeMark}_${direction || ""}`; + const existNode = graphInstance.getCellById(id); if (existNode) { existNode.updateData(node.data); } else { @@ -508,7 +511,7 @@ export function addInGraphHandle(data) { height: 20, ...node, zIndex: 1, - id: stakeMark, + id: id, }); // }, 0); }