|
@@ -1,18 +1,35 @@
|
|
|
<template>
|
|
|
- <div id="map2DViewer"></div>
|
|
|
+ <div id="map2DViewer">
|
|
|
+ <!-- <LabelCasePopup
|
|
|
+ v-show="true"
|
|
|
+ style="position: fixed; left: 40%; top: 30%; z-index: 99999"
|
|
|
+ /> -->
|
|
|
+ <CaseAuditPopup
|
|
|
+ v-show="auditPopupShow"
|
|
|
+ :status="auditPopupStatus"
|
|
|
+ ref="auditPopup"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
</template>
|
|
|
<script>
|
|
|
import publicFun from "@/utils/publicFunction.js";
|
|
|
import { get } from "@/utils/request";
|
|
|
+import CaseAuditPopup from "@/components/popup/CaseAuditPopup.vue";
|
|
|
+import LabelCasePopup from "@/components/popup/LabelCasePopup.vue";
|
|
|
export default {
|
|
|
name: "MapHolder",
|
|
|
+ components: { CaseAuditPopup, LabelCasePopup },
|
|
|
data() {
|
|
|
return {
|
|
|
JLControlShowStatus: false,
|
|
|
town: "祝桥镇,南汇新城镇,川沙新镇,老港镇,惠南镇,航头镇,泥城镇,书院镇,新场镇,大团镇,唐镇,曹路镇,宣桥镇,张江镇,合庆镇,周浦镇,康桥镇,三林镇,高桥镇,高东镇,金桥镇,北蔡镇,万祥镇,高行镇",
|
|
|
+ auditPopupShow: false,
|
|
|
+ auditPopupStatus: "normal",
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
+ // let a = new Vue()
|
|
|
+ // console.log(a,"print Vue");
|
|
|
// 监听全局事件总线中的卷帘对比事件(JLControl)
|
|
|
this.$bus.$on("JLControl", () => {
|
|
|
this.JLControl();
|
|
@@ -26,13 +43,16 @@ export default {
|
|
|
|
|
|
//地图初始化
|
|
|
this.mapInit();
|
|
|
+ // 可视化区域图
|
|
|
this.getJSonData();
|
|
|
|
|
|
// 地图常用渲染方法
|
|
|
// console.log(this.$store.state.mapMethodsCollection,"methods");
|
|
|
- this.$store.state.mapMethodsCollection.set("RENDER",{
|
|
|
- drawPolygon:this.drawPolygon
|
|
|
- })
|
|
|
+ this.$store.state.mapMethodsCollection.set("RENDER", {
|
|
|
+ addPolygonLayer: this.addPolygonLayer,
|
|
|
+ setView: this.setView,
|
|
|
+ deletePolygonLayer: this.deletePolygonLayer,
|
|
|
+ });
|
|
|
},
|
|
|
beforeDestroyed() {
|
|
|
// 当容器销毁时,需要停止监听该事件
|
|
@@ -43,6 +63,48 @@ export default {
|
|
|
this.$bus.$off("labelCaseEvent");
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 弹窗修改
|
|
|
+ createDynamicDiv(str) {
|
|
|
+ // 根据ref获取组件的dom元素
|
|
|
+ let html = this.$refs.auditPopup.$el.innerHTML;
|
|
|
+ if (html) {
|
|
|
+ let div = document.createElement("div");
|
|
|
+ div.id = str + "_id";
|
|
|
+ // 动态创建div后赋值模板样式
|
|
|
+ div.innerHTML = html;
|
|
|
+ $(() => {
|
|
|
+ // 修改弹窗宽高
|
|
|
+ $(`#${str}_id`).css("width", "300px");
|
|
|
+ $(`#${str}_id`).css("height", "320px");
|
|
|
+ if ($(`#${str}_id a`)) {
|
|
|
+ $(`#${str}_id a`).click((e) => {
|
|
|
+ console.log(e, "a label");
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // input添加点击事件
|
|
|
+ if ($(`#${str}_id input`)[1]) {
|
|
|
+ $(`#${str}_id input`).click((e) => {
|
|
|
+ switch (e.target.defaultValue) {
|
|
|
+ case "修改":
|
|
|
+ this.modifyBtnEvent();
|
|
|
+ break;
|
|
|
+ case "确认":
|
|
|
+ this.confirmBtnEvent();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return div;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ modifyBtnEvent() {
|
|
|
+ console.log("用户点击了地图中的修改按钮!");
|
|
|
+ },
|
|
|
+ confirmBtnEvent() {
|
|
|
+ console.log("用户点击地图中的确认按钮");
|
|
|
+ },
|
|
|
+
|
|
|
// 卷帘对比
|
|
|
JLControl() {
|
|
|
console.log("用户点击了卷帘对比菜单!");
|
|
@@ -62,7 +124,7 @@ export default {
|
|
|
attributionControl: false,
|
|
|
zoomControl: false,
|
|
|
minZoom: 10,
|
|
|
- maxZoom: 15,
|
|
|
+ maxZoom: 17,
|
|
|
}).setView(systemConfig.mapViewer.center, systemConfig.mapViewer.zoom);
|
|
|
|
|
|
//添加默认图层
|
|
@@ -97,7 +159,7 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
setView: function (coord, zoom) {
|
|
|
- console.log(coord, "位置");
|
|
|
+ // console.log(coord, "位置");
|
|
|
let center = L.latLng(coord[0], coord[1]);
|
|
|
map2DViewer.map.setView(center, zoom);
|
|
|
},
|
|
@@ -161,8 +223,52 @@ export default {
|
|
|
return "#00ffd5";
|
|
|
}
|
|
|
},
|
|
|
- drawPolygon(cid, color, show) {
|
|
|
- console.log("drawPolygon");
|
|
|
+ // 综合分析 - 图层绘制面
|
|
|
+ addPolygonLayer(data, cid, color) {
|
|
|
+ // cid -- 'yongjiu'
|
|
|
+ console.log(data, cid, color);
|
|
|
+ data.map((feature) => {
|
|
|
+ let polygonData = JSON.parse(JSON.stringify(feature));
|
|
|
+ let coordinates = polygonData.geometry.coordinates[0];
|
|
|
+ let infos = polygonData.properties;
|
|
|
+ let polygon = L.polygon(coordinates, {
|
|
|
+ color: color,
|
|
|
+ weight: 3,
|
|
|
+ fillColor: color,
|
|
|
+ opacity: 1,
|
|
|
+ fillOpacity: 0.4,
|
|
|
+ }).addTo(map2DViewer.map);
|
|
|
+ map2DViewer.polygons[`${cid}_layer`].push(polygon);
|
|
|
+ polygon.infos = infos;
|
|
|
+ // this.createDynamicDiv()
|
|
|
+ // polygon.bindPopup(
|
|
|
+ // "<div style='color:red'>Hello world! I am a popup.</div>",
|
|
|
+ // infos
|
|
|
+ // );
|
|
|
+ polygon.on("click", (e) => {
|
|
|
+ // console.log(e, "polygon");
|
|
|
+ this.auditPopupShow = true;
|
|
|
+
|
|
|
+ let popup = L.popup({ maxWidth: 700, maxHeight: 600 })
|
|
|
+ .setLatLng(e.latlng)
|
|
|
+ .setContent(this.createDynamicDiv("cid"));
|
|
|
+ // .openOn(map2DViewer.map);
|
|
|
+ this.auditPopupShow = false;
|
|
|
+ popup.openOn(map2DViewer.map);
|
|
|
+ // let b = $(`#cid_id`);
|
|
|
+ // console.log(b, "b");
|
|
|
+ // let a = $(`#cid_id`).children("input");
|
|
|
+ // console.log(a, "input");
|
|
|
+ });
|
|
|
+ });
|
|
|
+ console.log(map2DViewer.polygons[`${cid}_layer`]);
|
|
|
+ },
|
|
|
+
|
|
|
+ //综合分析 - 标记疑点 - 删除面
|
|
|
+ deletePolygonLayer(layer) {
|
|
|
+ map2DViewer.polygons[layer].forEach((polygon) => {
|
|
|
+ map2DViewer.map.removeLayer(polygon);
|
|
|
+ });
|
|
|
},
|
|
|
},
|
|
|
};
|