From 8a6584fe53bab0942361624cfd8a82962e827cf3 Mon Sep 17 00:00:00 2001 From: 123456 <17862666717> Date: Thu, 30 Jun 2022 15:19:06 +0800 Subject: [PATCH] =?UTF-8?q?=E2=80=9Cfix:=E4=BF=AE=E6=94=B9=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...icpointnucleicmonitoring-add-or-update.vue | 36 +++++++------ .../point/icpointnucleicmonitoring.vue | 29 +++++----- ...pointvaccinesinoculation-add-or-update.vue | 40 +++++++------- .../point/icpointvaccinesinoculation.vue | 54 ++++++++----------- 4 files changed, 77 insertions(+), 82 deletions(-) diff --git a/src/views/modules/plugins/point/icpointnucleicmonitoring-add-or-update.vue b/src/views/modules/plugins/point/icpointnucleicmonitoring-add-or-update.vue index 5af3d475..9fb1b95a 100644 --- a/src/views/modules/plugins/point/icpointnucleicmonitoring-add-or-update.vue +++ b/src/views/modules/plugins/point/icpointnucleicmonitoring-add-or-update.vue @@ -148,8 +148,8 @@ export default { serveTime: "", mobile: "", address: "", - longitude: "120.38945519", - latitude: "36.0722275", + longitude: '', + latitude: '', }, keyWords: null, organizationList: [], @@ -247,12 +247,14 @@ export default { }, // 地图初始化函数,本例取名为init,开发者可根据实际情况定义 initMap() { + let { latitude, longitude } = this.dataForm; // 定义地图中心点坐标 - let _this = this; - var center = new window.TMap.LatLng( - _this.dataForm.latitude, - _this.dataForm.longitude - ); + if (!latitude || latitude == "" || latitude == "0") { + latitude = 39.9088810666821; + longitude = 116.39743841556731; + } + console.log(latitude,longitude); + var center = new window.TMap.LatLng(latitude, longitude); // 定义map变量,调用 TMap.Map() 构造函数创建地图 map = new window.TMap.Map(document.getElementById("map_add"), { center: center, // 设置地图中心点坐标 @@ -297,7 +299,6 @@ export default { // 在地图显示范围内以给定的关键字搜索地点 search .searchRectangle({ - // keyword: this.keyWords, keyword: this.dataForm.address, bounds: map.getBounds(), }) @@ -307,6 +308,7 @@ export default { const { location: { lat, lng }, } = data[0]; + map.setCenter(new TMap.LatLng(lat, lng)); this.setMarker(lat, lng); this.dataForm.latitude = lat; @@ -340,8 +342,14 @@ export default { geocoder .getAddress({ location: location }) // 将给定的坐标位置转换为地址 .then((result) => { - this.dataForm.address = result.result.address; + this.dataForm.address = + this.dataForm.address !== "" && + this.dataForm.address !== null && + (this.dataForm.longitude === "" || this.dataForm.longitude === null) + ? this.dataForm.address + : result.result.address; // 显示搜索到的地址 + console.log(this.dataForm.address); }); }, @@ -363,7 +371,7 @@ export default { this.$http .post(`/gov/org/agency/communityListByCustomerId`) .then(({ data: res }) => { - if (res.code !== 0) { + if (tMapres.code !== 0) { return this.$message.error(res.msg); } this.organizationList = res.data; @@ -376,8 +384,7 @@ export default { if (this.dataForm.id) { this.getInfo(); } else { - this.dataForm.longitude = "120.38945519"; - this.dataForm.latitude = "36.0722275"; + this.initMap(); } }); @@ -395,11 +402,6 @@ export default { ...this.dataForm, ...res.data, }; - - if (!this.dataForm.longitude && !this.dataForm.latitude) { - this.dataForm.longitude = "120.38945519"; - this.dataForm.latitude = "36.0722275"; - } this.initMap(); }) .catch(() => {}); diff --git a/src/views/modules/plugins/point/icpointnucleicmonitoring.vue b/src/views/modules/plugins/point/icpointnucleicmonitoring.vue index 8650234e..ecf6cf11 100644 --- a/src/views/modules/plugins/point/icpointnucleicmonitoring.vue +++ b/src/views/modules/plugins/point/icpointnucleicmonitoring.vue @@ -112,13 +112,12 @@ v-loading="dataListLoading" :data="dataList" border - @selection-change="dataListSelectionChangeHandle" - style="width: 100%;height:564px;" - > - - - + + >> .el-dialog__body{ +.dialog-h >>> .el-dialog__body { overflow: scroll; } diff --git a/src/views/modules/plugins/point/icpointvaccinesinoculation-add-or-update.vue b/src/views/modules/plugins/point/icpointvaccinesinoculation-add-or-update.vue index 4d5dd0d4..c0709d64 100644 --- a/src/views/modules/plugins/point/icpointvaccinesinoculation-add-or-update.vue +++ b/src/views/modules/plugins/point/icpointvaccinesinoculation-add-or-update.vue @@ -123,7 +123,7 @@ >查询 -->
@@ -188,8 +188,8 @@ export default { noAvailableVaccines: "1", mobile: "", address: "", - longitude: "120.38945519", - latitude: "36.0722275", + longitude: "", + latitude: "", }, keyWords: null, // organizationList: [], @@ -333,14 +333,16 @@ export default { }, // 地图初始化函数,本例取名为init,开发者可根据实际情况定义 initMap() { + let { latitude, longitude } = this.dataForm; // 定义地图中心点坐标 - let _this = this; - var center = new window.TMap.LatLng( - _this.dataForm.latitude, - _this.dataForm.longitude - ); + if (!latitude || latitude == "" || latitude == "0") { + latitude = 39.9088810666821; + longitude = 116.39743841556731; + } + console.log(latitude,longitude); + var center = new window.TMap.LatLng(latitude, longitude); // 定义map变量,调用 TMap.Map() 构造函数创建地图 - map = new window.TMap.Map(document.getElementById("map_app"), { + map = new window.TMap.Map(document.getElementById("map_add"), { center: center, // 设置地图中心点坐标 zoom: 17.2, // 设置地图缩放级别 pitch: 43.5, // 设置俯仰角 @@ -353,12 +355,14 @@ export default { geometries: [], }); infoWindowList = Array(10); + geocoder = new TMap.service.Geocoder(); // 新建一个正逆地址解析类 + // 监听地图平移结束 map.on("panend", () => { this.handleMoveCenter(); }); - this.handleMoveCenter(); + // this.handleMoveCenter() this.convert(); }, handleMoveCenter() { @@ -381,7 +385,6 @@ export default { // 在地图显示范围内以给定的关键字搜索地点 search .searchRectangle({ - // keyword: this.keyWords, keyword: this.dataForm.address, bounds: map.getBounds(), }) @@ -391,6 +394,7 @@ export default { const { location: { lat, lng }, } = data[0]; + map.setCenter(new TMap.LatLng(lat, lng)); this.setMarker(lat, lng); this.dataForm.latitude = lat; @@ -424,8 +428,14 @@ export default { geocoder .getAddress({ location: location }) // 将给定的坐标位置转换为地址 .then((result) => { - this.dataForm.address = result.result.address; + this.dataForm.address = + this.dataForm.address !== "" && + this.dataForm.address !== null && + (this.dataForm.longitude === "" || this.dataForm.longitude === null) + ? this.dataForm.address + : result.result.address; // 显示搜索到的地址 + console.log(this.dataForm.address); }); }, @@ -461,8 +471,6 @@ export default { if (this.dataForm.id) { this.getInfo(); } else { - this.dataForm.longitude = "120.38945519"; - this.dataForm.latitude = "36.0722275"; this.initMap(); } }); @@ -481,10 +489,6 @@ export default { }; this.morningTime = [res.data.moStartTime,res.data.moEndTime] this.afterTime = [res.data.afStartTime,res.data.afEndTime] - if(!this.dataForm.longitude && !this.dataForm.latitude){ - this.dataForm.longitude = "120.38945519" - this.dataForm.latitude = "36.0722275" - } this.initMap(); }) .catch(() => {}); diff --git a/src/views/modules/plugins/point/icpointvaccinesinoculation.vue b/src/views/modules/plugins/point/icpointvaccinesinoculation.vue index 2ef3f5d1..697c44da 100644 --- a/src/views/modules/plugins/point/icpointvaccinesinoculation.vue +++ b/src/views/modules/plugins/point/icpointvaccinesinoculation.vue @@ -102,13 +102,13 @@ v-loading="dataListLoading" :data="dataList" border - @selection-change="dataListSelectionChangeHandle" - style="width: 100%;height:564px;" + style="width: 100%; height: 564px" > @@ -130,29 +130,23 @@ align="center" >
- + > + + - + > + + - - + +