diff --git a/src/views/modules/base/organization/organization.vue b/src/views/modules/base/organization/organization.vue index 38367c655..73cba7801 100644 --- a/src/views/modules/base/organization/organization.vue +++ b/src/views/modules/base/organization/organization.vue @@ -1513,7 +1513,7 @@ export default { modifyGridPop(val) { if (val) { setTimeout(() => { - this.createMap(); + this.createMap("modifyGridFrom"); }, 1000); } }, @@ -2892,6 +2892,8 @@ export default { this.modifyGridFrom.manageDistrict = data.manageDistrict; this.modifyGridFrom.griId = data.grid; this.modifyGridFrom.gridSort = data.gridSort; + this.modifyGridFrom.latitude = data.latitude; + this.modifyGridFrom.longitude = data.longitude; } else { this.$message.error(msg); } @@ -2908,8 +2910,8 @@ export default { mobile: this.OrgDetailsForm.mobile, code: this.OrgDetailsForm.code, latitude: this.latitude, - remark: this.OrgDetailsForm.remark, longitude: this.longitude, + remark: this.OrgDetailsForm.remark, }; const { data, code, msg } = await requestPost(url, params); @@ -2964,6 +2966,8 @@ export default { code: this.modifyGridFrom.code, gridType: this.modifyGridFrom.gridType, sort: this.modifyGridFrom.gridSort, + latitude: this.modifyGridFrom.latitude, + longitude: this.modifyGridFrom.longitude, }; const { data, code, msg } = await requestPost(url, params); @@ -2981,8 +2985,8 @@ export default { }, /** 地图初始化 */ - createMap() { - let { latitude, longitude } = this; + createMap(type) { + let { latitude, longitude } = this[type] || this; if ( latitude === null || latitude === "" || @@ -2999,7 +3003,6 @@ export default { longitude = longitude2; } } - // var center = new window.TMap.LatLng(latitude, longitude); //设置中心点坐标 var map = new daiMap( document.getElementById("con"), { latitude, longitude }, @@ -3009,72 +3012,22 @@ export default { rotation: 45, // 设置地图旋转角度 } ); - // //初始化地图 - // var map = new window.TMap.Map("con", { - // center: center, - // zoom: 13, // 设置地图缩放级别 - // pitch: 43.5, // 设置俯仰角 - // rotation: 45, // 设置地图旋转角度 - // }); - - // // 新建一个地点搜索类 - // let markers = new window.TMap.MultiMarker({ - // map: map, - // geometries: [], - // }); - - // map.on("panend", (e) => { - // handleMoveCenter(e); - // }); // 监听地图平移结束 map.on("dragend", (e) => { - handleMoveCenter(e); - }); - - // map.setCenter(latitude, longitude); - map.setMarker(latitude, longitude); - - // setMarker(latitude, longitude); - - // function setMarker(lat, lng) { - // console.log("setMarker", lat, lng); - // markers.setGeometries([]); - - // markers.add([ - // { - // id: "4", - // styleId: "marker", - // position: new window.TMap.LatLng(lat, lng), - // properties: { - // title: "marker4", - // }, - // }, - // ]); - // } - - function handleMoveCenter(e) { //修改地图中心点 const { lat, lng } = map.getCenter(); - // const lat = lat; - // const lng = lng; map.setMarker(lat, lng); + if (type) { + this[type].latitude = lat; + this[type].longitude = lng; + } else { + this.latitude = lat; + this.longitude = lng; + } + }); - // let { msg, data } = await map.getAddress(lat, lng); - // if (msg == "success") { - // this.formData.address = data.address - // this.searchValue = data.address - // this.searchOptions = [] - - // } - - //修改地图中心点 - // const center = map.getCenter(); - // const lat = center.getLat(); - // const lng = center.getLng(); - - // setMarker(lat, lng); - } + map.setMarker(latitude, longitude); }, }, };