From 178018a7e1d806ae9e1102d9d8633ee7cfc9e137 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 28 Jun 2022 15:50:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/shequzhili/csgltc/csglForm.vue | 76 +++++++------------ .../modules/shequzhili/ggfwtc/ggfwForm.vue | 73 ++++++------------ 2 files changed, 51 insertions(+), 98 deletions(-) diff --git a/src/views/modules/shequzhili/csgltc/csglForm.vue b/src/views/modules/shequzhili/csgltc/csglForm.vue index 63ab806f..ad390cca 100644 --- a/src/views/modules/shequzhili/csgltc/csglForm.vue +++ b/src/views/modules/shequzhili/csgltc/csglForm.vue @@ -65,7 +65,7 @@ :precision="2" :step="0.01" :min="0" - :max="9999" + :max="9600000" label="占地面积">平方公里 - + - - - - -
- -
-
- -
-
- - - 查询 -
-
-
- 经度 - - - 纬度 - - -
+ + 查询 +
@@ -201,7 +168,7 @@ export default { this.formData.icCityManagementId = icCityManagementId await this.loadFormData() } else { - map.setCenter(new TMap.LatLng(36.0722275, 120.38945519)) + // map.setCenter(new TMap.LatLng(36.0722275, 120.38945519)) this.setMarker(36.0722275, 120.38945519) } @@ -242,8 +209,9 @@ export default { data : this.cityManagement } this.formData = { ...data } - const lat = this.formData.latitude === null || this.formData.latitude === '' ? '' : this.formData.latitude; - const lon = this.formData.longitude === null || this.formData.longitude === '' ? '' : this.formData.longitude; + let { latitude, longitude } = this.$store.state.user; + const lat = this.formData.latitude === null || this.formData.latitude === '' ? latitude : this.formData.latitude; + const lon = this.formData.longitude === null || this.formData.longitude === '' ? longitude : this.formData.longitude; map.setCenter(new TMap.LatLng(lat,lon)) this.setMarker(lat,lon) } else { @@ -302,7 +270,15 @@ export default { // 地图初始化函数,本例取名为init,开发者可根据实际情况定义 initMap () { // 定义地图中心点坐标 - var center = new window.TMap.LatLng(36.52799, 120.7553) + let { latitude, longitude } = this.$store.state.user; + console.log('lat'+latitude+',lon'+longitude) + if (!latitude || latitude == "" || latitude == "0") { + latitude = 39.9088810666821; + longitude = 116.39743841556731; + } + // 定义地图中心点坐标 + var center = new window.TMap.LatLng(latitude, longitude); + // var center = new window.TMap.LatLng(36.52799, 120.7553) // 定义map变量,调用 TMap.Map() 构造函数创建地图 map = new window.TMap.Map(document.getElementById('app'), { center: center, // 设置地图中心点坐标 @@ -352,7 +328,7 @@ export default { // 在地图显示范围内以给定的关键字搜索地点 search .searchRectangle({ - keyword: this.keyWords, + keyword: this.formData.address, bounds: map.getBounds() }) .then((result) => { diff --git a/src/views/modules/shequzhili/ggfwtc/ggfwForm.vue b/src/views/modules/shequzhili/ggfwtc/ggfwForm.vue index 963de114..5e4e521e 100644 --- a/src/views/modules/shequzhili/ggfwtc/ggfwForm.vue +++ b/src/views/modules/shequzhili/ggfwtc/ggfwForm.vue @@ -47,7 +47,7 @@ :precision="2" :step="0.01" :min="0" - :max="9999" + :max="9600000" label="占地面积">平方公里 - + - - - - -
- -
-
- -
-
- - - 查询 -
-
-
- 经度 - - - 纬度 - - -
+ + 查询 +
@@ -220,8 +190,9 @@ } this.formData = { ...data } - const lat = this.formData.latitude === null || this.formData.latitude === '' ? '' : this.formData.latitude; - const lon = this.formData.longitude === null || this.formData.longitude === '' ? '' : this.formData.longitude; + let { latitude, longitude } = this.$store.state.user; + const lat = this.formData.latitude === null || this.formData.latitude === '' ? latitude : this.formData.latitude; + const lon = this.formData.longitude === null || this.formData.longitude === '' ? longitude : this.formData.longitude; map.setCenter(new TMap.LatLng(lat, lon)) this.setMarker(lat, lon) } else { @@ -280,8 +251,14 @@ // 地图初始化函数,本例取名为init,开发者可根据实际情况定义 initMap () { + let { latitude, longitude } = this.$store.state.user; + console.log('lat'+latitude+',lon'+longitude) + if (!latitude || latitude == "" || latitude == "0") { + latitude = 39.9088810666821; + longitude = 116.39743841556731; + } // 定义地图中心点坐标 - var center = new window.TMap.LatLng(36.0722275, 120.38945519) + var center = new window.TMap.LatLng(latitude, longitude); // 定义map变量,调用 TMap.Map() 构造函数创建地图 map = new window.TMap.Map(document.getElementById('app'), { center: center, // 设置地图中心点坐标 @@ -331,7 +308,7 @@ // 在地图显示范围内以给定的关键字搜索地点 search .searchRectangle({ - keyword: this.keyWords, + keyword: this.formData.address, bounds: map.getBounds() }) .then((result) => { @@ -432,12 +409,12 @@ address: [ { required: true, message: '地址不能为空', trigger: 'blur' } ], - longitude: [ + /*longitude: [ { required: true, message: '坐标不能为空', trigger: 'blur' } ], latitude: [ { required: true, message: '坐标不能为空', trigger: 'blur' } - ] + ]*/ } },