|
|
@@ -234,6 +234,16 @@ export default {
|
|
|
pixelX: pixel ? Math.round(pixel.x / scale) : 950,
|
|
|
pixelY: pixel ? Math.round(pixel.y / scale) : 430,
|
|
|
}
|
|
|
+ // 干线marker点击时,从菜单数据中匹配对应干线
|
|
|
+ if (this.activeLeftTab === 'trunkLine' && mapData.id && String(mapData.id).startsWith('MOCK-干')) {
|
|
|
+ const matched = this.findTrunkMenuNode(mapData.id);
|
|
|
+ if (matched) {
|
|
|
+ nodeData.id = matched.id;
|
|
|
+ nodeData.label = matched.label;
|
|
|
+ nodeData.intersections = matched.intersections;
|
|
|
+ nodeData.distances = matched.distances;
|
|
|
+ }
|
|
|
+ }
|
|
|
console.log(nodeData);
|
|
|
if (this.activeLeftTab === 'overview') { // 总览
|
|
|
this.showCrossingDetailDialogs(nodeData);
|
|
|
@@ -466,6 +476,25 @@ export default {
|
|
|
console.log('干线菜单点击:', nodeData);
|
|
|
this.showTrunkLineDalogs(nodeData);
|
|
|
},
|
|
|
+ findTrunkMenuNode(markerId) {
|
|
|
+ // markerId 格式: MOCK-干-{lineIdx}-{segmentIdx}-{idx}
|
|
|
+ const parts = markerId.split('-');
|
|
|
+ const lineIdx = parseInt(parts[2], 10);
|
|
|
+ const segmentIdx = parseInt(parts[3], 10);
|
|
|
+ // 前4条路线各拆2段,第5条1段,计算干线编号
|
|
|
+ const trunkIdx = lineIdx < 4 ? lineIdx * 2 + segmentIdx : 8;
|
|
|
+ // 从菜单树中找叶子节点
|
|
|
+ const leaves = [];
|
|
|
+ const walk = (nodes) => {
|
|
|
+ if (!Array.isArray(nodes)) return;
|
|
|
+ for (const n of nodes) {
|
|
|
+ if (n.children && n.children.length > 0) walk(n.children);
|
|
|
+ else leaves.push(n);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ walk(this.trunkLineMenuData);
|
|
|
+ return leaves[trunkIdx] || null;
|
|
|
+ },
|
|
|
async showTrunkLineDalogs(nodeData) {
|
|
|
console.log('显示干线弹窗组', nodeData.id, nodeData.label);
|
|
|
// 优先使用菜单节点自带的路口和距离数据
|