|
|
@@ -16,7 +16,12 @@
|
|
|
></Fxsz>
|
|
|
</el-col>
|
|
|
<el-col :span="18">
|
|
|
- <Mapview class="max-width" :rightlayer="true" :click="true">
|
|
|
+ <Mapview
|
|
|
+ class="max-width"
|
|
|
+ :rightlayer="true"
|
|
|
+ :click="true"
|
|
|
+ @map-click="handleMapClick"
|
|
|
+ >
|
|
|
<template #tool> <span></span> </template>
|
|
|
</Mapview>
|
|
|
<div class="Attributes" v-show="showTable">
|
|
|
@@ -46,6 +51,38 @@
|
|
|
/>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
+ <div class="deBox" v-show="tableData2.length">
|
|
|
+ <div class="AttributesTitle">
|
|
|
+ <span> 详细信息</span>
|
|
|
+ <el-icon
|
|
|
+ class="pointer font-22 posi-abs"
|
|
|
+ @click="closeDateil"
|
|
|
+ title="关闭"
|
|
|
+ ><close
|
|
|
+ /></el-icon>
|
|
|
+ </div>
|
|
|
+ <el-table
|
|
|
+ :data="tableData2"
|
|
|
+ border
|
|
|
+ stripe
|
|
|
+ style="width: 100%"
|
|
|
+ max-height="260"
|
|
|
+ @cell-dblclick="dblClick"
|
|
|
+ >
|
|
|
+ <el-table-column
|
|
|
+ prop="label"
|
|
|
+ label="属性名"
|
|
|
+ align="center"
|
|
|
+ show-overflow-tooltip=""
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ prop="value"
|
|
|
+ label="属性值"
|
|
|
+ align="center"
|
|
|
+ show-overflow-tooltip=""
|
|
|
+ />
|
|
|
+ </el-table>
|
|
|
+ </div>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
</div>
|
|
|
@@ -73,6 +110,7 @@ import Stroke from "ol/style/Stroke";
|
|
|
import { Style, Icon } from "ol/style";
|
|
|
import Fill from "ol/style/Fill";
|
|
|
import { fromLonLat } from "ol/proj";
|
|
|
+import { transform } from "ol/proj";
|
|
|
import { get as getProjection } from "ol/proj";
|
|
|
import {
|
|
|
getAttributesById,
|
|
|
@@ -129,6 +167,7 @@ export default {
|
|
|
},
|
|
|
],
|
|
|
tableData: [],
|
|
|
+ tableData2: [],
|
|
|
tableColumns: [],
|
|
|
transfer: {},
|
|
|
showTable: false,
|
|
|
@@ -282,6 +321,46 @@ export default {
|
|
|
}
|
|
|
);
|
|
|
},
|
|
|
+ handleMapClick(event) {
|
|
|
+ const webMercatorCoord = event.coordinate;
|
|
|
+
|
|
|
+ // 转换为经纬度
|
|
|
+ const lonLatCoord = transform(
|
|
|
+ webMercatorCoord,
|
|
|
+ "EPSG:3857",
|
|
|
+ "EPSG:4326"
|
|
|
+ );
|
|
|
+ intersects({
|
|
|
+ id: ghcyfx.transfer.id,
|
|
|
+ x: lonLatCoord[0],
|
|
|
+ y: lonLatCoord[1],
|
|
|
+ }).then((res) => {
|
|
|
+ if (res.statuscode === 200) {
|
|
|
+ ghcyfx.tableData2 = ghcyfx.transValue(res.data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 这里可以添加具体的查询逻辑
|
|
|
+ // 例如:根据坐标查询要素信息
|
|
|
+ // queryFeatureByCoordinate(event.coordinate);
|
|
|
+ },
|
|
|
+ closeDateil() {
|
|
|
+ ghcyfx.tableData2 = [];
|
|
|
+ },
|
|
|
+
|
|
|
+ transValue(rawData) {
|
|
|
+ // 兼容原始数据为null/undefined的情况
|
|
|
+ if (!rawData || typeof rawData !== "object") return [];
|
|
|
+
|
|
|
+ return Object.entries(rawData).map(([key, value]) => ({
|
|
|
+ label: key, // 直接使用原始字段名
|
|
|
+ value: value === null || value === undefined ? "" : String(value), // 空值处理,转为字符串避免渲染问题
|
|
|
+ }));
|
|
|
+ },
|
|
|
+ });
|
|
|
+ onUnmounted(() => {
|
|
|
+ // 移除地图上的临时图层
|
|
|
+ ghcyfx.delPos();
|
|
|
+ // 可以添加其他需要清理的资源 ...
|
|
|
});
|
|
|
watch(
|
|
|
() => store.state.xmgl.transfer,
|
|
|
@@ -415,14 +494,22 @@ export default {
|
|
|
position: absolute;
|
|
|
bottom: 0px;
|
|
|
padding: 0px 15px;
|
|
|
- .AttributesTitle {
|
|
|
- background: #ccc;
|
|
|
- display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- height: 30px;
|
|
|
- align-items: center;
|
|
|
- padding: 0px 10px;
|
|
|
- }
|
|
|
+}
|
|
|
+.AttributesTitle {
|
|
|
+ background: #ccc;
|
|
|
+ display: flex;
|
|
|
+ justify-content: space-between;
|
|
|
+ height: 30px;
|
|
|
+ align-items: center;
|
|
|
+ padding: 0px 10px;
|
|
|
+}
|
|
|
+.deBox {
|
|
|
+ width: 300px;
|
|
|
+ height: 360px;
|
|
|
+ z-index: 9999 !important;
|
|
|
+ position: absolute;
|
|
|
+ bottom: 27%;
|
|
|
+ padding: 0px 15px;
|
|
|
}
|
|
|
</style>
|
|
|
<style lang="less"></style>
|