You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
324 lines
9.1 KiB
324 lines
9.1 KiB
<template>
|
|
<div>
|
|
<div class="dialog-h-content scroll-h">
|
|
|
|
<div v-if="initLoading"
|
|
class="m-row">
|
|
<div class="m-info">
|
|
<div class="info-prop">
|
|
<span class="info-title-2">所属小区:</span>
|
|
<span>{{ agencyObj.agencyName }}—{{ agencyObj.gridName }}—{{ agencyObj.label }}</span>
|
|
</div>
|
|
|
|
<div class="info-prop">
|
|
<span class="info-title-2">楼栋名称:</span>
|
|
<span>{{ dataForm.buildingName?dataForm.buildingName:'--' }}</span>
|
|
</div>
|
|
|
|
<div class="info-prop">
|
|
<span class="info-title-2">楼栋编码:</span>
|
|
<span>{{ dataForm.coding?dataForm.coding:'--'}}</span>
|
|
</div>
|
|
|
|
<div class="info-prop">
|
|
<span class="info-title-2">楼栋类型:</span>
|
|
<span>{{ dataForm.typeName?dataForm.typeName:'--'}}</span>
|
|
</div>
|
|
<div class="info-prop">
|
|
<span class="info-title-2">单元数:</span>
|
|
<span>{{dataForm.totalUnitNum?dataForm.totalUnitNum:0 }}</span>
|
|
</div>
|
|
<div class="info-prop">
|
|
<span class="info-title-2">层数:</span>
|
|
<span>{{dataForm.totalFloorNum?dataForm.totalFloorNum:0 }}</span>
|
|
</div>
|
|
<div class="info-prop">
|
|
<span class="info-title-2">总户数:</span>
|
|
<span>{{dataForm.totalHouseNum?dataForm.totalHouseNum:0 }}</span>
|
|
</div>
|
|
<div class="info-prop">
|
|
<span class="info-title-2">人口数:</span>
|
|
<span>{{dataForm.realPerson?dataForm.realPerson:0 }}</span>
|
|
</div>
|
|
|
|
<div class="info-prop">
|
|
<span class="info-title-2">楼长姓名:</span>
|
|
<span>{{ dataForm.buildingLeaderName?dataForm.buildingLeaderName:'--' }}</span>
|
|
</div>
|
|
<div class="info-prop">
|
|
<span class="info-title-2">楼长电话:</span>
|
|
<span>{{ dataForm.buildingLeaderMobile?dataForm.buildingLeaderMobile:'--' }}</span>
|
|
</div>
|
|
<div class="info-prop">
|
|
<span class="info-title-2">详细地址:</span>
|
|
<span>{{ dataForm.coordinatePosition?dataForm.coordinatePosition:'--' }}</span>
|
|
</div>
|
|
|
|
<div v-if="dataForm.coordinatePosition"
|
|
class="info-prop">
|
|
<span class="info-title-2">地图位置:</span>
|
|
<div class="div_map">
|
|
|
|
<div id="app_detail"></div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="div-btn">
|
|
<el-button size="small"
|
|
@click="handleCancle">关 闭</el-button>
|
|
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapGetters } from 'vuex'
|
|
import { Loading } from 'element-ui' // 引入Loading服务
|
|
import { requestPost } from '@/js/dai/request'
|
|
var map
|
|
var search
|
|
var markers
|
|
var infoWindowList
|
|
let loading // 加载动画
|
|
export default {
|
|
data () {
|
|
return {
|
|
|
|
btnDisable: false,
|
|
initLoading: false,
|
|
|
|
dataForm: {
|
|
agencyId: '', // 所属组织ID
|
|
agencyName: '',
|
|
gridId: '', //所属网格ID
|
|
neighborHoodId: '',//所属小区id
|
|
buildingName: '',//房屋名称
|
|
// sort: 0,//排序
|
|
totalUnitNum: 1,//单元数
|
|
totalFloorNum: 0,//层数
|
|
totalHouseNum: 0,//总户数
|
|
realPerson: 0,
|
|
buildingLeaderName: '',//楼长姓名
|
|
buildingLeaderMobile: '',//楼长电话
|
|
type: '',//房屋类型
|
|
coordinatePosition: '',
|
|
sysCoding: '',
|
|
coding: '',
|
|
location: '', //坐标位置
|
|
longitude: '', //经度
|
|
latitude: '' //纬度
|
|
},
|
|
|
|
agencyObj: {},
|
|
|
|
}
|
|
},
|
|
components: {},
|
|
mounted () {
|
|
|
|
},
|
|
|
|
methods: {
|
|
handleCancle () {
|
|
this.diaDestroy()
|
|
this.$emit('diaDetailClose')
|
|
|
|
},
|
|
diaDestroy () {
|
|
if (map) {
|
|
map.destroy()
|
|
}
|
|
},
|
|
async initForm (row, agencyObj) {
|
|
|
|
this.dataForm = JSON.parse(JSON.stringify(row))
|
|
this.agencyObj = agencyObj
|
|
|
|
this.initLoading = true
|
|
|
|
this.$nextTick(() => {
|
|
this.initMap()
|
|
})
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
// 地图初始化函数,本例取名为init,开发者可根据实际情况定义
|
|
initMap () {
|
|
let { latitude, longitude } = this.$store.state.user;
|
|
console.log('lat' + latitude + ',lon' + longitude)
|
|
|
|
if (this.dataForm.latitude && this.dataForm.longitude) {
|
|
latitude = this.dataForm.latitude
|
|
longitude = this.dataForm.longitude
|
|
}
|
|
if (!latitude || latitude == "" || latitude == "0") {
|
|
latitude = 39.9088810666821;
|
|
longitude = 116.39743841556731;
|
|
}
|
|
// 定义地图中心点坐标
|
|
var center = new window.TMap.LatLng(latitude, longitude);
|
|
// 定义map变量,调用 TMap.Map() 构造函数创建地图
|
|
map = new window.TMap.Map(document.getElementById('app_detail'), {
|
|
center: center, // 设置地图中心点坐标
|
|
zoom: 17.2, // 设置地图缩放级别
|
|
pitch: 43.5, // 设置俯仰角
|
|
rotation: 45 // 设置地图旋转角度
|
|
})
|
|
|
|
search = new window.TMap.service.Search({ pageSize: 10 })
|
|
// 新建一个地点搜索类
|
|
markers = new TMap.MultiMarker({
|
|
map: map,
|
|
geometries: []
|
|
})
|
|
infoWindowList = Array(10)
|
|
|
|
// 监听地图平移结束
|
|
map.on('panend', () => {
|
|
this.handleMoveCenter()
|
|
})
|
|
this.handleMoveCenter()
|
|
},
|
|
|
|
setMarker (lat, lng) {
|
|
markers.setGeometries([])
|
|
markers.add([
|
|
{
|
|
id: '4',
|
|
styleId: 'marker',
|
|
position: new TMap.LatLng(lat, lng),
|
|
properties: {
|
|
title: 'marker4'
|
|
}
|
|
}
|
|
])
|
|
},
|
|
|
|
handleSearchMap () {
|
|
infoWindowList.forEach((infoWindow) => {
|
|
infoWindow.close()
|
|
})
|
|
infoWindowList.length = 0
|
|
markers.setGeometries([])
|
|
// 在地图显示范围内以给定的关键字搜索地点
|
|
search
|
|
.searchRectangle({
|
|
keyword: this.keyWords,
|
|
bounds: map.getBounds()
|
|
})
|
|
.then((result) => {
|
|
let { data } = result
|
|
if (Array.isArray(data) && data.length > 0) {
|
|
const {
|
|
location: { lat, lng },
|
|
address
|
|
} = data[0]
|
|
map.setCenter(new TMap.LatLng(lat, lng))
|
|
this.setMarker(lat, lng)
|
|
this.dataForm.latitude = lat
|
|
this.dataForm.longitude = lng
|
|
this.dataForm.coordinatePosition = address
|
|
} else {
|
|
this.$message.error('未检索到相关位置坐标')
|
|
}
|
|
})
|
|
},
|
|
|
|
handleMoveCenter () {
|
|
//修改地图中心点
|
|
const center = map.getCenter()
|
|
const lat = center.getLat()
|
|
const lng = center.getLng()
|
|
this.dataForm.latitude = lat
|
|
this.dataForm.longitude = lng
|
|
this.setMarker(lat, lng)
|
|
},
|
|
resetData () {
|
|
|
|
this.buildType = '1'
|
|
this.dataForm = {
|
|
agencyId: '', // 所属组织ID
|
|
agencyName: '',
|
|
gridId: '', //所属网格ID
|
|
neighborHoodId: '',//所属小区id
|
|
buildingName: '',//房屋名称
|
|
// sort: 0,//排序
|
|
totalUnitNum: 1,//单元数
|
|
totalFloorNum: 0,//层数
|
|
totalHouseNum: 0,//总户数
|
|
realPerson: 0,
|
|
buildingLeaderName: '',//楼长姓名
|
|
buildingLeaderMobile: '',//楼长电话
|
|
type: '',//房屋类型
|
|
location: '', //坐标位置
|
|
longitude: '', //经度
|
|
latitude: '', //纬度
|
|
coding: '',
|
|
sysCoding: '',
|
|
coordinatePosition: ''
|
|
}
|
|
},
|
|
// 开启加载动画
|
|
startLoading () {
|
|
loading = Loading.service({
|
|
lock: true, // 是否锁定
|
|
text: '正在加载……', // 加载中需要显示的文字
|
|
background: 'rgba(0,0,0,.7)' // 背景颜色
|
|
})
|
|
},
|
|
// 结束加载动画
|
|
endLoading () {
|
|
// clearTimeout(timer);
|
|
if (loading) {
|
|
loading.close()
|
|
}
|
|
}
|
|
},
|
|
computed: {
|
|
dataRule () {
|
|
return {
|
|
buildingName: [
|
|
{ required: true, message: '楼栋名称不能为空', trigger: 'blur' },
|
|
{
|
|
min: 1,
|
|
max: 10,
|
|
message: '小区名称长度在 1 到 10个字符',
|
|
trigger: 'blur'
|
|
}
|
|
],
|
|
type: [
|
|
{ required: true, message: '楼栋类型不能为空', trigger: 'blur' }
|
|
],
|
|
totalUnitNum: [
|
|
{ required: true, message: '单元数不能为空', trigger: 'blur' }
|
|
],
|
|
coding: [
|
|
{ required: true, message: '楼栋编码不能为空', trigger: 'blur' }
|
|
]
|
|
// totalFloorNum: [
|
|
// { required: true, message: '层数不能为空', trigger: 'blur' }
|
|
// ],
|
|
// totalHouseNum: [
|
|
// { required: true, message: '户数不能为空', trigger: 'blur' }
|
|
// ],
|
|
// longitude: [
|
|
// { required: true, message: '坐标不能为空', trigger: 'blur' }
|
|
// ],
|
|
}
|
|
},
|
|
|
|
},
|
|
props: {}
|
|
}
|
|
</script>
|
|
<style lang="scss" scoped >
|
|
@import "@/assets/scss/modules/management/detail-main.scss";
|
|
</style>
|