|
|
@ -32,12 +32,12 @@ |
|
|
maxlength="50" |
|
|
maxlength="50" |
|
|
placeholder="请输入楼栋编码" |
|
|
placeholder="请输入楼栋编码" |
|
|
v-model="dataForm.coding"> |
|
|
v-model="dataForm.coding"> |
|
|
|
|
|
|
|
|
</el-input> |
|
|
</el-input> |
|
|
<el-button style="margin-left: 10px" |
|
|
<el-button style="margin-left: 10px" |
|
|
type="primary" |
|
|
type="primary" |
|
|
size="small" |
|
|
size="small" |
|
|
@click="handleCode">生成</el-button> |
|
|
@click="handleCode">生成</el-button> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item label="楼栋类型" |
|
|
<el-form-item label="楼栋类型" |
|
|
prop="type" |
|
|
prop="type" |
|
|
@ -119,39 +119,29 @@ |
|
|
</el-input> |
|
|
</el-input> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
|
|
|
|
|
|
<el-form-item label="位置坐标" |
|
|
<el-form-item label="地图位置" |
|
|
prop="longitude" |
|
|
prop="longitude" |
|
|
label-width="150px" |
|
|
label-width="150px" |
|
|
style="display: block"> |
|
|
style="display: block"> |
|
|
|
|
|
<div style="width: 500px"> |
|
|
<div style="width:500px"> |
|
|
<el-select v-model="searchValue" |
|
|
<el-input class="item_width_4" |
|
|
filterable |
|
|
maxlength="50" |
|
|
style="width: 500px" |
|
|
placeholder="请输入关键字" |
|
|
remote |
|
|
v-model="keyWords"> |
|
|
:reserve-keyword="true" |
|
|
</el-input> |
|
|
placeholder="请输入关键词" |
|
|
<el-button style="margin-left: 10px" |
|
|
:remote-method="remoteMethod" |
|
|
type="primary" |
|
|
:loading="loading"> |
|
|
size="small" |
|
|
<el-option v-for="(item,index) in searchOptions" |
|
|
@click="handleSearchMap">查询</el-button> |
|
|
@click.native="handleClickKey(index)" |
|
|
<div id="app" |
|
|
:key="item.value" |
|
|
|
|
|
:label="item.label" |
|
|
|
|
|
:value="item.value"> |
|
|
|
|
|
</el-option> |
|
|
|
|
|
</el-select> |
|
|
|
|
|
<div id="app_build" |
|
|
class="div_map"></div> |
|
|
class="div_map"></div> |
|
|
<div style="margin-top: 10px"> |
|
|
|
|
|
<span>经度</span> |
|
|
|
|
|
<el-input class="item_width_3" |
|
|
|
|
|
maxlength="50" |
|
|
|
|
|
placeholder="请输入经度" |
|
|
|
|
|
v-model="dataForm.longitude"> |
|
|
|
|
|
</el-input> |
|
|
|
|
|
<span style="margin-left: 20px">纬度</span> |
|
|
|
|
|
<el-input class="item_width_3" |
|
|
|
|
|
maxlength="50" |
|
|
|
|
|
placeholder="请输入纬度" |
|
|
|
|
|
v-model="dataForm.latitude"> |
|
|
|
|
|
</el-input> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
<el-form-item label="楼栋地址" |
|
|
<el-form-item label="楼栋地址" |
|
|
prop="coordinatePosition" |
|
|
prop="coordinatePosition" |
|
|
@ -160,7 +150,6 @@ |
|
|
<!-- <span>{{ dataForm.coordinatePosition }}</span> --> |
|
|
<!-- <span>{{ dataForm.coordinatePosition }}</span> --> |
|
|
<el-input class="item_width_1" |
|
|
<el-input class="item_width_1" |
|
|
placeholder="请选择楼栋地址" |
|
|
placeholder="请选择楼栋地址" |
|
|
disabled |
|
|
|
|
|
v-model="dataForm.coordinatePosition" /> |
|
|
v-model="dataForm.coordinatePosition" /> |
|
|
</el-form-item> |
|
|
</el-form-item> |
|
|
</el-form> |
|
|
</el-form> |
|
|
@ -182,6 +171,7 @@ |
|
|
import { mapGetters } from 'vuex' |
|
|
import { mapGetters } from 'vuex' |
|
|
import { Loading } from 'element-ui' // 引入Loading服务 |
|
|
import { Loading } from 'element-ui' // 引入Loading服务 |
|
|
import { requestPost } from '@/js/dai/request' |
|
|
import { requestPost } from '@/js/dai/request' |
|
|
|
|
|
import daiMap from "@/utils/dai-map"; |
|
|
var map |
|
|
var map |
|
|
var search |
|
|
var search |
|
|
var markers |
|
|
var markers |
|
|
@ -191,6 +181,11 @@ export default { |
|
|
data () { |
|
|
data () { |
|
|
return { |
|
|
return { |
|
|
formType: 'add', //表单操作类型 add新增,edit编辑,detail详情 |
|
|
formType: 'add', //表单操作类型 add新增,edit编辑,detail详情 |
|
|
|
|
|
searchOptions: [], |
|
|
|
|
|
searchValue: '', |
|
|
|
|
|
resultList: [], |
|
|
|
|
|
loading: false, |
|
|
|
|
|
|
|
|
btnDisable: false, |
|
|
btnDisable: false, |
|
|
buildingId: '', //楼栋ID |
|
|
buildingId: '', //楼栋ID |
|
|
buildType: "1", |
|
|
buildType: "1", |
|
|
@ -204,7 +199,7 @@ export default { |
|
|
totalUnitNum: 1,//单元数 |
|
|
totalUnitNum: 1,//单元数 |
|
|
totalFloorNum: 0,//层数 |
|
|
totalFloorNum: 0,//层数 |
|
|
totalHouseNum: 0,//总户数 |
|
|
totalHouseNum: 0,//总户数 |
|
|
realPerson: 0, |
|
|
realPerson: 0, |
|
|
buildingLeaderName: '',//楼长姓名 |
|
|
buildingLeaderName: '',//楼长姓名 |
|
|
buildingLeaderMobile: '',//楼长电话 |
|
|
buildingLeaderMobile: '',//楼长电话 |
|
|
type: '',//房屋类型 |
|
|
type: '',//房屋类型 |
|
|
@ -223,12 +218,13 @@ export default { |
|
|
}, |
|
|
}, |
|
|
components: {}, |
|
|
components: {}, |
|
|
mounted () { |
|
|
mounted () { |
|
|
this.initMap() |
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
methods: { |
|
|
methods: { |
|
|
async initForm (type, row, agencyObj) { |
|
|
async initForm (type, row, agencyObj) { |
|
|
this.$refs.ref_form.resetFields(); |
|
|
this.$refs.ref_form.resetFields(); |
|
|
|
|
|
let { latitude, longitude } = this.$store.state.user; |
|
|
this.agencyObj = agencyObj |
|
|
this.agencyObj = agencyObj |
|
|
this.dataForm.agencyId = agencyObj.agencyId |
|
|
this.dataForm.agencyId = agencyObj.agencyId |
|
|
this.dataForm.gridId = agencyObj.gridId |
|
|
this.dataForm.gridId = agencyObj.gridId |
|
|
@ -241,13 +237,16 @@ export default { |
|
|
// this.buildType = this.dataForm.buildingTypeKey |
|
|
// this.buildType = this.dataForm.buildingTypeKey |
|
|
this.buildType = this.dataForm.type |
|
|
this.buildType = this.dataForm.type |
|
|
|
|
|
|
|
|
map.setCenter(new TMap.LatLng(this.dataForm.latitude, this.dataForm.longitude)) |
|
|
|
|
|
this.setMarker(this.dataForm.latitude, this.dataForm.longitude) |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
map.setCenter(new TMap.LatLng(agencyObj.latitude, agencyObj.longitude)) |
|
|
this.dataForm.latitude = latitude |
|
|
|
|
|
this.dataForm.longitude = longitude |
|
|
|
|
|
} |
|
|
|
|
|
if (!map) { |
|
|
|
|
|
this.initMap(this.dataForm.latitude, this.dataForm.longitude); |
|
|
|
|
|
} else { |
|
|
|
|
|
map.setCenter(this.dataForm.latitude, this.dataForm.longitude); |
|
|
|
|
|
map.setMarker(this.dataForm.latitude, this.dataForm.longitude); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
async handleComfirm () { |
|
|
async handleComfirm () { |
|
|
@ -266,7 +265,7 @@ export default { |
|
|
|
|
|
|
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
async handleCode() { |
|
|
async handleCode () { |
|
|
const { data, code, msg } = await requestPost( |
|
|
const { data, code, msg } = await requestPost( |
|
|
"/gov/org/houseInformation/getBuildingCoding/" + this.dataForm.neighborHoodId); |
|
|
"/gov/org/houseInformation/getBuildingCoding/" + this.dataForm.neighborHoodId); |
|
|
console.log('data----', data) |
|
|
console.log('data----', data) |
|
|
@ -275,8 +274,8 @@ export default { |
|
|
if (msg == "success" && code == 0) { |
|
|
if (msg == "success" && code == 0) { |
|
|
this.dataForm.coding = data.coding |
|
|
this.dataForm.coding = data.coding |
|
|
this.dataForm.sysCoding = data.sysCoding |
|
|
this.dataForm.sysCoding = data.sysCoding |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
async addBuild () { |
|
|
async addBuild () { |
|
|
if (this.dataForm.buildingLeaderMobile) { |
|
|
if (this.dataForm.buildingLeaderMobile) { |
|
|
@ -324,89 +323,91 @@ export default { |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
// 地图初始化函数,本例取名为init,开发者可根据实际情况定义 |
|
|
// 地图初始化函数,本例取名为init,开发者可根据实际情况定义 |
|
|
initMap () { |
|
|
initMap (latitude, longitude) { |
|
|
// 定义地图中心点坐标 |
|
|
|
|
|
var center = new window.TMap.LatLng(36.0722275, 120.38945519) |
|
|
|
|
|
// 定义map变量,调用 TMap.Map() 构造函数创建地图 |
|
|
|
|
|
map = new window.TMap.Map(document.getElementById('app'), { |
|
|
|
|
|
center: center, // 设置地图中心点坐标 |
|
|
|
|
|
zoom: 17.2, // 设置地图缩放级别 |
|
|
|
|
|
pitch: 43.5, // 设置俯仰角 |
|
|
|
|
|
rotation: 45 // 设置地图旋转角度 |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
search = new window.TMap.service.Search({ pageSize: 10 }) |
|
|
map = new daiMap( |
|
|
// 新建一个地点搜索类 |
|
|
document.getElementById("app_build"), |
|
|
markers = new TMap.MultiMarker({ |
|
|
{ latitude, longitude }, |
|
|
map: map, |
|
|
{ |
|
|
geometries: [] |
|
|
zoom: 16.2, // 设置地图缩放级别 |
|
|
}) |
|
|
pitch: 43.5, // 设置俯仰角 |
|
|
infoWindowList = Array(10) |
|
|
rotation: 45, // 设置地图旋转角度 |
|
|
|
|
|
} |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
// 监听地图平移结束 |
|
|
// 监听地图平移结束 |
|
|
map.on('panend', () => { |
|
|
map.on("dragend", (e) => { |
|
|
this.handleMoveCenter() |
|
|
this.handleMoveCenter(e); |
|
|
}) |
|
|
}); |
|
|
this.handleMoveCenter() |
|
|
|
|
|
|
|
|
map.setCenter(latitude, longitude); |
|
|
|
|
|
map.setMarker(latitude, longitude); |
|
|
|
|
|
|
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
setMarker (lat, lng) { |
|
|
|
|
|
markers.setGeometries([]) |
|
|
async handleMoveCenter () { |
|
|
markers.add([ |
|
|
//修改地图中心点 |
|
|
{ |
|
|
const { lat, lng } = map.getCenter(); |
|
|
id: '4', |
|
|
this.dataForm.latitude = lat; |
|
|
styleId: 'marker', |
|
|
this.dataForm.longitude = lng; |
|
|
position: new TMap.LatLng(lat, lng), |
|
|
map.setMarker(lat, lng); |
|
|
properties: { |
|
|
|
|
|
title: 'marker4' |
|
|
let { msg, data } = await map.getAddress(lat, lng); |
|
|
} |
|
|
if (msg == "success") { |
|
|
} |
|
|
this.dataForm.coordinatePosition = data.address |
|
|
]) |
|
|
this.searchValue = data.address |
|
|
|
|
|
this.searchOptions = [] |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
handleSearchMap () { |
|
|
async remoteMethod (query) { |
|
|
infoWindowList.forEach((infoWindow) => { |
|
|
|
|
|
infoWindow.close() |
|
|
if (query !== '') { |
|
|
}) |
|
|
this.loading = true; |
|
|
infoWindowList.length = 0 |
|
|
|
|
|
markers.setGeometries([]) |
|
|
const { msg, data } = await map.searchNearby(query); |
|
|
// 在地图显示范围内以给定的关键字搜索地点 |
|
|
this.loading = false; |
|
|
search |
|
|
this.resultList = [] |
|
|
.searchNearby({ |
|
|
|
|
|
keyword: this.keyWords, |
|
|
if (msg == "success" && data.resultList && data.resultList.length > 0) { |
|
|
radius: 1000, |
|
|
|
|
|
autoExtend: true, |
|
|
if (data.resultList && data.resultList.length > 0) { |
|
|
center: map.getCenter(), |
|
|
this.resultList = data.resultList |
|
|
}) |
|
|
this.searchOptions = this.resultList.map(item => { |
|
|
.then((result) => { |
|
|
return { value: `${item.hotPointID}`, label: `${item.address + item.name}` }; |
|
|
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('未检索到相关位置坐标') |
|
|
|
|
|
} |
|
|
} |
|
|
}) |
|
|
} else { |
|
|
|
|
|
this.searchOptions = [ |
|
|
|
|
|
{ |
|
|
|
|
|
value: '0', |
|
|
|
|
|
label: '未检索到结果' |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
this.searchOptions = []; |
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
handleMoveCenter () { |
|
|
handleClickKey (index) { |
|
|
//修改地图中心点 |
|
|
let selPosition = this.resultList[index] |
|
|
const center = map.getCenter() |
|
|
let lonlat = selPosition.lonlat.split(" ") |
|
|
const lat = center.getLat() |
|
|
map.setCenter(lonlat[1], lonlat[0]); |
|
|
const lng = center.getLng() |
|
|
map.setMarker(lonlat[1], lonlat[0]); |
|
|
this.dataForm.latitude = lat |
|
|
this.dataForm.latitude = lonlat[1]; |
|
|
this.dataForm.longitude = lng |
|
|
this.dataForm.longitude = lonlat[0]; |
|
|
this.setMarker(lat, lng) |
|
|
this.dataForm.coordinatePosition = selPosition.address + selPosition.name |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
resetData () { |
|
|
resetData () { |
|
|
this.keyWords = '' |
|
|
this.searchValue = '' |
|
|
|
|
|
this.searchOptions = [] |
|
|
|
|
|
this.resultList = [] |
|
|
this.buildingId = '' //楼栋ID |
|
|
this.buildingId = '' //楼栋ID |
|
|
this.buildType = '1' |
|
|
this.buildType = '1' |
|
|
this.dataForm = { |
|
|
this.dataForm = { |
|
|
|