From 83e2b9cffa9920bbefcc70baf42cd03543cc2d39 Mon Sep 17 00:00:00 2001 From: zhanghua <314079846@qq.com> Date: 星期一, 30 一月 2023 10:26:03 +0800 Subject: [PATCH] 点位显示 --- src/views/operate/car/lawCar/index.vue | 3 + src/views/operate/disposal/casepool/pool/createUser/vio/index.vue | 3 + src/components/map/leafletMap.vue | 37 +++++++++++++++--- src/views/intelligentPatrol/studyJudge/index.vue | 5 +- src/components/dispatch/index.vue | 3 + src/views/operate/disposal/casepool/escalation/createUser/vio/index.vue | 3 + public/map_lib/images/marker-icon.png | 0 src/router/index.js | 5 -- public/map_lib/images/marker-icon-2x.png | 0 src/views/operate/car/soilCar/index.vue | 3 + src/views/operate/disposal/casepool/pool/createUser/ill/index.vue | 3 + public/map_lib/images/layers-2x.png | 0 public/map_lib/images/layers.png | 0 public/map_lib/images/marker-shadow.png | 0 src/views/intelligentPatrol/trendAnalysis/index.vue | 5 +- src/views/operate/disposal/casepool/escalation/createUser/ill/index.vue | 3 + 16 files changed, 50 insertions(+), 23 deletions(-) diff --git a/public/map_lib/images/layers-2x.png b/public/map_lib/images/layers-2x.png new file mode 100644 index 0000000..200c333 --- /dev/null +++ b/public/map_lib/images/layers-2x.png Binary files differ diff --git a/public/map_lib/images/layers.png b/public/map_lib/images/layers.png new file mode 100644 index 0000000..1a72e57 --- /dev/null +++ b/public/map_lib/images/layers.png Binary files differ diff --git a/public/map_lib/images/marker-icon-2x.png b/public/map_lib/images/marker-icon-2x.png new file mode 100644 index 0000000..e4abba3 --- /dev/null +++ b/public/map_lib/images/marker-icon-2x.png Binary files differ diff --git a/public/map_lib/images/marker-icon.png b/public/map_lib/images/marker-icon.png new file mode 100644 index 0000000..950edf2 --- /dev/null +++ b/public/map_lib/images/marker-icon.png Binary files differ diff --git a/public/map_lib/images/marker-shadow.png b/public/map_lib/images/marker-shadow.png new file mode 100644 index 0000000..9fd2979 --- /dev/null +++ b/public/map_lib/images/marker-shadow.png Binary files differ diff --git a/src/components/dispatch/index.vue b/src/components/dispatch/index.vue index 491d0dc..bd209e2 100644 --- a/src/components/dispatch/index.vue +++ b/src/components/dispatch/index.vue @@ -116,7 +116,8 @@ </div> </template> <script> -import MyMap from "@/components/map"; +// import MyMap from "@/components/map"; +import MyMap from "@/components/map/leafletMap.vue"; export default { components: { MyMap, diff --git a/src/components/map/leafletMap.vue b/src/components/map/leafletMap.vue index c57b5ca..5b5faa9 100644 --- a/src/components/map/leafletMap.vue +++ b/src/components/map/leafletMap.vue @@ -3,13 +3,14 @@ </template> <script> - export default { name: "map", components: {}, data() { return { map: null, + map_point: { x: "119.27179890", y: "28.59027084" }, + map_zoom: 15, mapUrl: "http://117.139.13.157:41005/tilermap/rest/services/mapserver/baidu-image-db/{z}/{x}/{y}", // mapUrls: 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', @@ -18,8 +19,6 @@ crs: L.CRS.Baidu, minZoom: 2, maxZoom: 19, - center: [28.59582231,119.27226470], - zoom: 16, zoomControl: true, // 绂佺敤 + - 鎸夐挳 doubleClickZoom: true, // 绂佺敤鍙屽嚮鏀惧ぇ attributionControl: false, // 绉婚櫎鍙充笅瑙抣eaflet鏍囪瘑 @@ -45,25 +44,49 @@ mounted() { setTimeout(() => { this.createrMap(); - }, 500); + }, 100); }, methods: { /* 鍒涘缓鍦板浘瀹炰緥 */ createrMap() { + this.option.center = [eval(this.map_point.y), eval(this.map_point.x)]; + this.option.zoom = this.map_zoom; this.map = this.$map.createrMap("map-container", this.option); // this.$map.createrLayers(this.map, this.mapUrls) //鍒囩墖鍦板浘 // this.$map.createrChinatm(this.map, this.mapUrl); // 鍥惧眰 this.map.pm.setLang("zh"); this.map.pm.addControls(this.options); + this.locationMap(); + }, + locationMap() { + if (this.mark && this.map) { + // 鍒涘缓涓�涓� Marker 瀹炰緥锛� + var marker = L.marker([eval(this.map_point.y), eval(this.map_point.x)]).addTo( + this.map + ); + let that = this + // 灏嗗垱寤虹殑鐐规爣璁版坊鍔犲埌宸叉湁鐨勫湴鍥惧疄渚嬶細 + marker.on("click", function (e) { + console.log("666"); + that.$emit("fatherMethod"); + }); + } }, }, + watch: { + point(newval, oldval) { + this.map_point = newval; + this.locationMap(); + }, + zoom(newval, oldval) { + this.map_zoom = newval; + }, + }, + props: ["point", "zoom", "mark"], }; </script> <style > .map-container { - position: absolute; - left: 0; - top: 0; width: 100%; height: 100%; } diff --git a/src/router/index.js b/src/router/index.js index fbd1ce1..c9bedb2 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -419,11 +419,6 @@ component: () => import('@/views/info/Success'), }, { - path: '/map', - name: 'map', - component: () => import('@/components/map/leafletMap.vue') -}, -{ path: '*', redirect: '/404' } diff --git a/src/views/intelligentPatrol/studyJudge/index.vue b/src/views/intelligentPatrol/studyJudge/index.vue index b9e8b1c..89ff8f7 100644 --- a/src/views/intelligentPatrol/studyJudge/index.vue +++ b/src/views/intelligentPatrol/studyJudge/index.vue @@ -242,7 +242,8 @@ import { validateCarNum } from "@/utils/validate"; import MyDispatch from "@/components/dispatch"; import InspectionTable from "@/views/intelligentPatrol/studyJudge/inspectionTable/index.vue"; -import MyMap from "@/components/map"; +// import MyMap from "@/components/map"; +import MyMap from "@/components/map/leafletMap.vue"; export default { components: { MyDispatch, MyMap, InspectionTable }, @@ -399,7 +400,7 @@ x: this.currentEvent.longitude, y: this.currentEvent.latitude, }; - this.zoom = 19; + this.zoom = 18; this.mark = { title: this.currentEvent.address }; if (this.currentEvent?.picData) { this.imageList = this.currentEvent.picData diff --git a/src/views/intelligentPatrol/trendAnalysis/index.vue b/src/views/intelligentPatrol/trendAnalysis/index.vue index d634a41..1e26fdc 100644 --- a/src/views/intelligentPatrol/trendAnalysis/index.vue +++ b/src/views/intelligentPatrol/trendAnalysis/index.vue @@ -72,7 +72,8 @@ import * as echarts from "echarts"; import basecase from "@/api/operate/basecase"; import { CATEGOTY } from "@/utils/helper"; -import MyMap from "@/components/map"; +// import MyMap from "@/components/map"; +import MyMap from "@/components/map/leafletMap.vue"; export default { components: { MyMap }, @@ -164,7 +165,7 @@ x: data.longitude, y: data.latitude, }; - this.zoom = 19; + this.zoom = 18; this.mark = { title: data.address }; basecase .getPointTrendAnalysisData({ diff --git a/src/views/operate/car/lawCar/index.vue b/src/views/operate/car/lawCar/index.vue index fb82e66..786a661 100644 --- a/src/views/operate/car/lawCar/index.vue +++ b/src/views/operate/car/lawCar/index.vue @@ -35,7 +35,8 @@ </div> </template> <script> -import MyMap from '@/components/map' +// import MyMap from "@/components/map"; +import MyMap from "@/components/map/leafletMap.vue"; export default { components:{ MyMap diff --git a/src/views/operate/car/soilCar/index.vue b/src/views/operate/car/soilCar/index.vue index 7936dcd..ca889f1 100644 --- a/src/views/operate/car/soilCar/index.vue +++ b/src/views/operate/car/soilCar/index.vue @@ -35,7 +35,8 @@ </div> </template> <script> -import MyMap from '@/components/map' +// import MyMap from "@/components/map"; +import MyMap from "@/components/map/leafletMap.vue"; export default { components: { MyMap diff --git a/src/views/operate/disposal/casepool/escalation/createUser/ill/index.vue b/src/views/operate/disposal/casepool/escalation/createUser/ill/index.vue index 47c7fd9..dfea3a5 100644 --- a/src/views/operate/disposal/casepool/escalation/createUser/ill/index.vue +++ b/src/views/operate/disposal/casepool/escalation/createUser/ill/index.vue @@ -114,7 +114,8 @@ </div> </template> <script> -import MyMap from '@/components/map' +// import MyMap from "@/components/map"; +import MyMap from "@/components/map/leafletMap.vue"; export default { components: { MyMap diff --git a/src/views/operate/disposal/casepool/escalation/createUser/vio/index.vue b/src/views/operate/disposal/casepool/escalation/createUser/vio/index.vue index 10dd147..6545785 100644 --- a/src/views/operate/disposal/casepool/escalation/createUser/vio/index.vue +++ b/src/views/operate/disposal/casepool/escalation/createUser/vio/index.vue @@ -126,7 +126,8 @@ </div> </template> <script> -import MyMap from '@/components/map' +// import MyMap from "@/components/map"; +import MyMap from "@/components/map/leafletMap.vue"; export default { components: { MyMap diff --git a/src/views/operate/disposal/casepool/pool/createUser/ill/index.vue b/src/views/operate/disposal/casepool/pool/createUser/ill/index.vue index 134c5cb..e847637 100644 --- a/src/views/operate/disposal/casepool/pool/createUser/ill/index.vue +++ b/src/views/operate/disposal/casepool/pool/createUser/ill/index.vue @@ -133,7 +133,8 @@ </div> </template> <script> -import MyMap from '@/components/map' +// import MyMap from "@/components/map"; +import MyMap from "@/components/map/leafletMap.vue"; import {parseTime} from '@/utils/index' import { validateName, validatePhone, validateCardId, validateNum } from '@/utils/validate' export default { diff --git a/src/views/operate/disposal/casepool/pool/createUser/vio/index.vue b/src/views/operate/disposal/casepool/pool/createUser/vio/index.vue index deb2a40..15d17ee 100644 --- a/src/views/operate/disposal/casepool/pool/createUser/vio/index.vue +++ b/src/views/operate/disposal/casepool/pool/createUser/vio/index.vue @@ -138,7 +138,8 @@ </div> </template> <script> -import MyMap from '@/components/map' +// import MyMap from "@/components/map"; +import MyMap from "@/components/map/leafletMap.vue"; import { validateName, validatePhone, validateCarNum, validateCardId } from '@/utils/validate' import { getTypeList } from '@/utils/helper' import { parseTime } from "@/utils/index" -- Gitblit v1.8.0