|
@@ -14,7 +14,7 @@
|
|
|
<CrossingListPanel :onViewDetail="handleCrossingViewDetail"/>
|
|
<CrossingListPanel :onViewDetail="handleCrossingViewDetail"/>
|
|
|
</div>
|
|
</div>
|
|
|
<!-- 地图 -->
|
|
<!-- 地图 -->
|
|
|
- <TongzhouTrafficMap v-else
|
|
|
|
|
|
|
+ <TongzhouTrafficMap v-else ref="trafficMapRef"
|
|
|
amapKey="db2da7e3e248c3b2077d53fc809be63f"
|
|
amapKey="db2da7e3e248c3b2077d53fc809be63f"
|
|
|
securityJsCode="a7413c674852c5eaf01d90813c5b7ef6"
|
|
securityJsCode="a7413c674852c5eaf01d90813c5b7ef6"
|
|
|
:mode="activeLeftTab === 'crossing' ? '路口' : activeLeftTab === 'trunkLine' ? '干线' : activeLeftTab === 'specialDuty' ? '特勤' : ''"
|
|
:mode="activeLeftTab === 'crossing' ? '路口' : activeLeftTab === 'trunkLine' ? '干线' : activeLeftTab === 'specialDuty' ? '特勤' : ''"
|
|
@@ -197,12 +197,18 @@ export default {
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
// 处理地图点击事件
|
|
// 处理地图点击事件
|
|
|
- handleMapCrossingClick(mapData, lnglat) {
|
|
|
|
|
- console.log('父组件接收到了地图路口点击事件:', mapData, lnglat);
|
|
|
|
|
|
|
+ handleMapCrossingClick(mapData, lnglat, pixel) {
|
|
|
|
|
+ console.log('父组件接收到了地图路口点击事件:', mapData);
|
|
|
|
|
+ console.log('父组件接收到了地图路口点击事件:', lnglat);
|
|
|
|
|
+ console.log('父组件接收到了地图路口点击事件:', pixel);
|
|
|
// 组装模拟数据
|
|
// 组装模拟数据
|
|
|
|
|
+ const scale = window.innerWidth / 1920;
|
|
|
let nodeData = {
|
|
let nodeData = {
|
|
|
- id: Math.floor(Math.random()*5)+1,
|
|
|
|
|
|
|
+ id: mapData.position[0] + mapData.position[1],
|
|
|
label: mapData.road,
|
|
label: mapData.road,
|
|
|
|
|
+ // 反算为设计稿坐标(SmartDialog 内部会再乘 scale)
|
|
|
|
|
+ pixelX: pixel ? Math.round(pixel.x / scale) : 950,
|
|
|
|
|
+ pixelY: pixel ? Math.round(pixel.y / scale) : 430,
|
|
|
}
|
|
}
|
|
|
console.log(nodeData);
|
|
console.log(nodeData);
|
|
|
if (this.activeLeftTab === 'overview') { // 总览
|
|
if (this.activeLeftTab === 'overview') { // 总览
|
|
@@ -252,6 +258,19 @@ export default {
|
|
|
// 处理菜单点击
|
|
// 处理菜单点击
|
|
|
handleMenuClick(nodeData) {
|
|
handleMenuClick(nodeData) {
|
|
|
console.log('父组件接收到了最底层路口点击事件:', nodeData);
|
|
console.log('父组件接收到了最底层路口点击事件:', nodeData);
|
|
|
|
|
+ // 通过地图组件获取像素坐标(如果有经纬度的话)
|
|
|
|
|
+ // if (nodeData.lng && nodeData.lat && this.$refs.trafficMapRef) {
|
|
|
|
|
+ // // 地图联动
|
|
|
|
|
+ // this.$refs.trafficMapRef.focusByLocation([nodeData.lng, nodeData.lat]);
|
|
|
|
|
+
|
|
|
|
|
+ // const pixel = this.$refs.trafficMapRef.lngLatToPixel(nodeData.lng, nodeData.lat);
|
|
|
|
|
+ // if (pixel) {
|
|
|
|
|
+ // const scale = window.innerWidth / 1920;
|
|
|
|
|
+ // nodeData.pixelX = Math.round(pixel.x / scale) + 20;
|
|
|
|
|
+ // nodeData.pixelY = Math.round(pixel.y / scale);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+
|
|
|
// 根据Tab来显示不同的弹窗内容
|
|
// 根据Tab来显示不同的弹窗内容
|
|
|
if (this.activeLeftTab === 'overview') { // 总览
|
|
if (this.activeLeftTab === 'overview') { // 总览
|
|
|
this.showOverviewDalogs(nodeData);
|
|
this.showOverviewDalogs(nodeData);
|
|
@@ -289,7 +308,7 @@ export default {
|
|
|
height: 260,
|
|
height: 260,
|
|
|
center: false,
|
|
center: false,
|
|
|
showClose: true,
|
|
showClose: true,
|
|
|
- position: { x: 950, y: 430 },
|
|
|
|
|
|
|
+ position: { x: (nodeData.pixelX || 950) + 20, y: nodeData.pixelY || 430 },
|
|
|
noPadding: false,
|
|
noPadding: false,
|
|
|
data: {
|
|
data: {
|
|
|
...nodeData,
|
|
...nodeData,
|