Browse Source

fix 修复3140bug

wangqin
qingzhengli 8 months ago
parent
commit
4ac7fdb4b0
  1. 17
      ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/map.js

17
ruoyi-ui/src/views/JiHeExpressway/pages/Home/components/RoadAndEvents/utils/map.js

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

Loading…
Cancel
Save