Browse Source

地图调整

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

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

@ -65,7 +65,7 @@
:precision="2" :precision="2"
:step="0.01" :step="0.01"
:min="0" :min="0"
:max="9999" :max="9600000"
label="占地面积"></el-input-number> label="占地面积"></el-input-number>
</el-form-item> </el-form-item>
<el-form-item label="容纳人数" <el-form-item label="容纳人数"
@ -82,51 +82,18 @@
prop="address" prop="address"
label-width="150px" label-width="150px"
style="display: block"> style="display: block">
<el-input class="item_width_1" <div class="item_width_1">
maxlength="50" <el-input
show-word-limit style="width:420px"
placeholder="请输入地址名称" :placeholder="'请输入所在地址'"
v-model="formData.address"> v-model="formData.address">
</el-input> </el-input>
</el-form-item> <el-button
style="margin-left: 10px"
<el-form-item label="位置坐标" type="default"
prop="longitude" size="small"
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> @click="handleSearchMap">查询</el-button>
</div> <div id="app" class="div_map"></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>
</div> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -201,7 +168,7 @@ export default {
this.formData.icCityManagementId = icCityManagementId this.formData.icCityManagementId = icCityManagementId
await this.loadFormData() await this.loadFormData()
} else { } 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) this.setMarker(36.0722275, 120.38945519)
} }
@ -242,8 +209,9 @@ export default {
data : this.cityManagement data : this.cityManagement
} }
this.formData = { ...data } this.formData = { ...data }
const lat = this.formData.latitude === null || this.formData.latitude === '' ? '' : this.formData.latitude; let { latitude, longitude } = this.$store.state.user;
const lon = this.formData.longitude === null || this.formData.longitude === '' ? '' : this.formData.longitude; 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)) map.setCenter(new TMap.LatLng(lat,lon))
this.setMarker(lat,lon) this.setMarker(lat,lon)
} else { } else {
@ -302,7 +270,15 @@ export default {
// init // init
initMap () { 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 TMap.Map()
map = new window.TMap.Map(document.getElementById('app'), { map = new window.TMap.Map(document.getElementById('app'), {
center: center, // center: center, //
@ -352,7 +328,7 @@ export default {
// //
search search
.searchRectangle({ .searchRectangle({
keyword: this.keyWords, keyword: this.formData.address,
bounds: map.getBounds() bounds: map.getBounds()
}) })
.then((result) => { .then((result) => {

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

@ -47,7 +47,7 @@
:precision="2" :precision="2"
:step="0.01" :step="0.01"
:min="0" :min="0"
:max="9999" :max="9600000"
label="占地面积"></el-input-number> label="占地面积"></el-input-number>
</el-form-item> </el-form-item>
<el-form-item label="容纳人数" <el-form-item label="容纳人数"
@ -64,48 +64,18 @@
prop="address" prop="address"
label-width="150px" label-width="150px"
style="display: block"> style="display: block">
<el-input class="item_width_1" <div class="item_width_1">
<el-input
style="width:420px"
:placeholder="'请输入所在地址'"
v-model="formData.address"> v-model="formData.address">
</el-input> </el-input>
</el-form-item> <el-button
style="margin-left: 10px"
<el-form-item label="位置坐标" type="default"
prop="longitude" size="small"
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> @click="handleSearchMap">查询</el-button>
</div> <div id="app" class="div_map"></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>
</div> </div>
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -220,8 +190,9 @@
} }
this.formData = { ...data } this.formData = { ...data }
const lat = this.formData.latitude === null || this.formData.latitude === '' ? '' : this.formData.latitude; let { latitude, longitude } = this.$store.state.user;
const lon = this.formData.longitude === null || this.formData.longitude === '' ? '' : this.formData.longitude; 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)) map.setCenter(new TMap.LatLng(lat, lon))
this.setMarker(lat, lon) this.setMarker(lat, lon)
} else { } else {
@ -280,8 +251,14 @@
// init // init
initMap () { 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 TMap.Map()
map = new window.TMap.Map(document.getElementById('app'), { map = new window.TMap.Map(document.getElementById('app'), {
center: center, // center: center, //
@ -331,7 +308,7 @@
// //
search search
.searchRectangle({ .searchRectangle({
keyword: this.keyWords, keyword: this.formData.address,
bounds: map.getBounds() bounds: map.getBounds()
}) })
.then((result) => { .then((result) => {
@ -432,12 +409,12 @@
address: [ address: [
{ required: true, message: '地址不能为空', trigger: 'blur' } { required: true, message: '地址不能为空', trigger: 'blur' }
], ],
longitude: [ /*longitude: [
{ required: true, message: '坐标不能为空', trigger: 'blur' } { required: true, message: '坐标不能为空', trigger: 'blur' }
], ],
latitude: [ latitude: [
{ required: true, message: '坐标不能为空', trigger: 'blur' } { required: true, message: '坐标不能为空', trigger: 'blur' }
] ]*/
} }
}, },

Loading…
Cancel
Save