Browse Source

地图调整

shibei_master
zxc 3 years ago
parent
commit
178018a7e1
  1. 76
      src/views/modules/shequzhili/csgltc/csglForm.vue
  2. 73
      src/views/modules/shequzhili/ggfwtc/ggfwForm.vue

76
src/views/modules/shequzhili/csgltc/csglForm.vue

@ -65,7 +65,7 @@
:precision="2"
:step="0.01"
:min="0"
:max="9999"
:max="9600000"
label="占地面积"></el-input-number>
</el-form-item>
<el-form-item label="容纳人数"
@ -82,51 +82,18 @@
prop="address"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
maxlength="50"
show-word-limit
placeholder="请输入地址名称"
<div class="item_width_1">
<el-input
style="width:420px"
:placeholder="'请输入所在地址'"
v-model="formData.address">
</el-input>
</el-form-item>
<el-form-item label="位置坐标"
prop="longitude"
label-width="150px"
style="display: block">
<div style="width:500px">
<div class="div_map">
<div id="app">
</div>
<div class="div_searchmap">
<el-input class="item_width_4"
maxlength="50"
size="mini"
placeholder="请输入关键字"
v-model="keyWords">
</el-input>
<el-button style="margin-left: 10px"
type="primary"
size="mini"
@click="handleSearchMap">查询</el-button>
</div>
</div>
<div style="margin-top: 10px">
<span>经度</span>
<el-input class="item_width_3"
maxlength="50"
placeholder="请输入经度"
v-model="formData.longitude">
</el-input>
<span style="margin-left: 20px">纬度</span>
<el-input class="item_width_3"
maxlength="50"
placeholder="请输入纬度"
v-model="formData.latitude">
</el-input>
</div>
</el-input>
<el-button
style="margin-left: 10px"
type="default"
size="small"
@click="handleSearchMap">查询</el-button>
<div id="app" class="div_map"></div>
</div>
</el-form-item>
</el-form>
@ -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) => {

73
src/views/modules/shequzhili/ggfwtc/ggfwForm.vue

@ -47,7 +47,7 @@
:precision="2"
:step="0.01"
:min="0"
:max="9999"
:max="9600000"
label="占地面积"></el-input-number>
</el-form-item>
<el-form-item label="容纳人数"
@ -64,48 +64,18 @@
prop="address"
label-width="150px"
style="display: block">
<el-input class="item_width_1"
<div class="item_width_1">
<el-input
style="width:420px"
:placeholder="'请输入所在地址'"
v-model="formData.address">
</el-input>
</el-form-item>
<el-form-item label="位置坐标"
prop="longitude"
label-width="150px"
style="display: block">
<div style="width:500px">
<div class="div_map">
<div id="app">
</div>
<div class="div_searchmap">
<el-input class="item_width_4"
maxlength="50"
size="mini"
placeholder="请输入关键字"
v-model="keyWords">
</el-input>
<el-button style="margin-left: 10px"
type="primary"
size="mini"
@click="handleSearchMap">查询</el-button>
</div>
</div>
<div style="margin-top: 10px">
<span>经度</span>
<el-input class="item_width_3"
maxlength="50"
placeholder="请输入经度"
v-model="formData.longitude">
</el-input>
<span style="margin-left: 20px">纬度</span>
<el-input class="item_width_3"
maxlength="50"
placeholder="请输入纬度"
v-model="formData.latitude">
</el-input>
</div>
</el-input>
<el-button
style="margin-left: 10px"
type="default"
size="small"
@click="handleSearchMap">查询</el-button>
<div id="app" class="div_map"></div>
</div>
</el-form-item>
</el-form>
@ -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' }
]
]*/
}
},

Loading…
Cancel
Save