<template>
|
<div class="b-map-info-window">
|
<div class="table-row">
|
<div class="table-cell table-cell-right">地址:</div>
|
<div class="table-cell">{{address}}</div>
|
</div>
|
<div class="table-row">
|
<div class="table-cell table-cell-right">经度:</div>
|
<div class="table-cell">{{point.lng}}</div>
|
</div>
|
<div class="table-row">
|
<div class="table-cell table-cell-right">纬度:</div>
|
<div class="table-cell">{{point.lat}}</div>
|
</div>
|
<div class="table-row">
|
<div class="table-cell table-cell-right">站点名:</div>
|
<div class="table-cell">
|
<select style="border: 1px solid #ccc; width: 320px" v-model="home">
|
<option v-for="(home, index) in getHomeList" :key="index"
|
:value="index">{{home.label}}</option>
|
</select>
|
</div>
|
</div>
|
<div class="table-row">
|
<div class="table-cell"></div>
|
<div class="table-cell table-cell-right table-cell-footer">
|
<el-button type="primary" size="mini" @click="setHomeOnMap">确定</el-button>
|
</div>
|
</div>
|
</div>
|
</template>
|
|
<script>
|
export default {
|
props: {
|
text: {
|
type: String,
|
default: ""
|
}
|
},
|
data() {
|
return {
|
address: '',
|
point: {
|
lng: '', // 经度
|
lat: '', // 纬度
|
},
|
home: -1,
|
homeList: []
|
}
|
},
|
watch: {
|
homeList(n) {
|
if(this.homeList.length>0) {
|
this.home = 0;
|
}
|
}
|
},
|
methods: {
|
setHomeOnMap() {
|
let homeInfo = this.getHomeInfo;
|
if(homeInfo == -1) {
|
this.$message({
|
type: 'warning',
|
message: '暂无可设站点'
|
})
|
}else {
|
this.$emit('set-home-info', {
|
address: this.address,
|
point: this.point,
|
info: homeInfo
|
});
|
}
|
}
|
},
|
computed: {
|
getHomeList() {
|
if(this.homeList.length >0) {
|
return this.homeList;
|
}else {
|
return [{
|
value: -1,
|
label: '暂无可设置站点'
|
}]
|
}
|
},
|
getHomeInfo() {
|
let home = this.home;
|
if(home == -1) {
|
return -1;
|
}else {
|
return this.homeList[home];
|
}
|
}
|
}
|
};
|
</script>
|
|
<style scoped>
|
.b-map-info-window {
|
color: #000000;
|
padding: 8px;
|
display: table;
|
}
|
.table-row {
|
display: table-row;
|
}
|
.table-cell {
|
display: table-cell;
|
padding: 2px;
|
white-space: nowrap;
|
}
|
.table-cell.table-cell-right {
|
text-align: right;
|
}
|
.table-cell.table-cell-footer {
|
padding-top: 16px;
|
}
|
</style>
|