lion 3 years ago
parent 07c135f75e
commit a8581d9c4c

@ -1,156 +0,0 @@
<template>
<!-- // 使 -->
<div
:wrapperClosable="false"
size="40%"
title="位置选择"
:visible.sync="showStatus"
direction="rtl"
width="600px">
<!-- // -->
<el-form style="margin-left: 20px" class="searchForm" size="small" :model="searchFrom">
<el-row :gutter="5">
<el-col :span="10">
<el-form-item prop="name">
<el-input clearable placeholder="请输入搜索位置信息"
v-model="searchFrom.name"
name="name"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-button icon="el-icon-search" type="primary" size="mini"
@click="searchAddress">搜索位置
</el-button>
</el-col>
</el-row>
</el-form>
<!-- // idid -->
<div id="mapContainer" style="width:100%;height:300px;"></div>
<!-- // -->
<el-table
highlight-current-row
:data="nearPointList"
max-height="300"
style="width: 100%">
<el-table-column
prop="name"
label="附近地点名称">
</el-table-column>
<el-table-column
fixed="right"
label="操作"
width="100">
<template slot-scope="scope">
<el-button
@click.native.prevent="selectAddress(scope.row)"
type="text"
size="small">
确认选择
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</template>
<script>
// qqmap
import maps from 'qqmap'
export default {
name: "mapSelect",
data() {
return {
rootAddress: '',
searchFrom: {name: ''},
nearPointList: [],
showStatus: false,
map: '',
data: '',
markersArray: [],
}
},
mounted() {
//
this.initMap()
},
methods: {
//
searchAddress() {
if (!this.searchFrom.name) {
this.$message.error('未输入搜索内容')
return
}
this.setLocationByAddress(this.rootAddress + ',' + this.searchFrom.name)
},
//
initMap() {
let that = this
maps.init('4TWBZ-2XDO4-G27U2-D5MK4-GS5F6-Y2F5H', () => {
let latLon = new qq.maps.LatLng(26.326248944008693, 116.35539315640926)
let myOpts = {
zoom: 14,
center: latLon,
mapTypeId: qq.maps.MapTypeId.ROADMAP
}
that.map = new qq.maps.Map(
document.getElementById('mapContainer'),
myOpts
)
qq.maps.event.addListener(that.map, 'click', function (event) {
that.setLocationByLatLng(event.latLng.getLat(), event.latLng.getLng())
})
})
//
that.geocoder = new qq.maps.Geocoder({
complete: function (result) {
that.nearPointList = result.detail.nearPois
that.map.setCenter(result.detail.location);
let marker = new qq.maps.Marker({
map: that.map,
position: result.detail.location
});
that.markersArray.push(marker);
if (that.markersArray.length > 1) {
for (let i = 0; i < that.markersArray.length - 1; i++) {
that.markersArray[i].setMap(null);//
}
}
}
});
//
that.geocoderLocation = new qq.maps.Geocoder({
complete: function (result) {
//
let latLng = new qq.maps.LatLng(result.detail.location.lat, result.detail.location.lng);
that.geocoder.getAddress(latLng);
}
});
},
//
selectAddress(row) {
this.$emit("on-select", this.rootAddress, row.name, row.latLng.lat, row.latLng.lng)
this.showStatus = false
},
//
show() {
this.initMap()
this.showStatus = true
},
//
setLocationByAddress(address) {
this.rootAddress = address
this.geocoderLocation.getLocation(address);
},
//
setLocationByLatLng(lat, lng) {
let latLng = new qq.maps.LatLng(lat, lng);
this.geocoder.getAddress(latLng);
}
}
}
</script>
<style scoped>
</style>

@ -390,7 +390,7 @@
}]
},
markerLayer: {},
map: {},
map: null,
imgsrc: "/src/assets/imgs/ditu.png"
}
},
@ -420,10 +420,10 @@
},
methods: {
initMap() {
//
// if (!!this.map) {
// this.map.destroy();
// }
//
if (this.map!=null) {
this.map.destroy()
}
this.$nextTick(() => {
let that = this;
console.log(window); // window
@ -433,7 +433,6 @@
zoom: 18, //
center: center, //
});
console.log(map);
this.map = map;
map.on("click", (e) => {
this.markerLayer.setGeometries([]);
@ -523,7 +522,19 @@
},
submitForm(formName) {
var that = this;
that.form.end_time = that.form.start_time.substring(0, 10) + " " + that.form.end_time;
that.form.end_time = that.form.start_time.substring(0, 10) + " " + that.form.end_time;
let listUrl = [];
for (var m of that.bannersList) {
if (m.response)
listUrl.push({
"upload_id": m.response.id
});
else
listUrl.push({
"upload_id": m.upload_id
});
}
that.form.banners_list = listUrl;
this.$refs[formName].validate((valid) => {
if (valid) {
if (that.form.id) {

@ -7,7 +7,7 @@
<div slot="content"></div>
<slot>
<div>
<Input style="width: 200px; margin-right: 10px" v-model="searchFields.Name" placeholder="关键字搜索" />
<Input style="width: 200px; margin-right: 10px" v-model="searchFields.name" placeholder="关键字搜索" />
<Button type="primary" @click="load" style="margin-left: 10px">查询</Button>
<Button type="primary" @click="edit()" style="margin-left: 10px">新增</Button>
</div>
@ -234,6 +234,21 @@
required: true,
message: '请输入停车场名称',
trigger: 'blur'
}],
address: [{
required: true,
message: '请输入停车场地址',
trigger: 'blur'
}],
longitude: [{
required: true,
message: '请输入经度',
trigger: 'blur'
}],
latitude: [{
required: true,
message: '请输入纬度',
trigger: 'blur'
}]
},

Loading…
Cancel
Save