|
|
|
@ -42,22 +42,22 @@ |
|
|
|
</el-input> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="小区编码" |
|
|
|
prop="coding" |
|
|
|
label-width="150px" |
|
|
|
style="display: block"> |
|
|
|
<el-input class="item_width_2" |
|
|
|
maxlength="50" |
|
|
|
placeholder="请输入楼栋编码" |
|
|
|
v-model="dataForm.coding"> |
|
|
|
|
|
|
|
</el-input> |
|
|
|
<el-button style="margin-left: 10px" |
|
|
|
prop="coding" |
|
|
|
label-width="150px" |
|
|
|
style="display: block"> |
|
|
|
<el-input class="item_width_2" |
|
|
|
maxlength="50" |
|
|
|
placeholder="请输入楼栋编码" |
|
|
|
v-model="dataForm.coding"> |
|
|
|
|
|
|
|
</el-input> |
|
|
|
<el-button style="margin-left: 10px" |
|
|
|
type="primary" |
|
|
|
size="small" |
|
|
|
@click="handleCode">生成</el-button> |
|
|
|
</el-form-item> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<div v-if="dataForm.qrcodeUrl" |
|
|
|
<div v-if="dataForm.qrcodeUrl" |
|
|
|
style="display: flex;flex-direction: column;"> |
|
|
|
<img style="margin-left: 70px;width: 200px;" |
|
|
|
:src="dataForm.qrcodeUrl"> |
|
|
|
@ -87,15 +87,41 @@ |
|
|
|
@click="handleAddProperty">添加物业</el-button> |
|
|
|
</el-form-item> |
|
|
|
<el-form-item label="实有楼栋" |
|
|
|
style="display: block" |
|
|
|
prop="realBuilding" |
|
|
|
label-width="150px"> |
|
|
|
<el-input-number class="item_width_4" |
|
|
|
v-model="dataForm.realBuilding" |
|
|
|
:min="0" |
|
|
|
:max="9999" |
|
|
|
label="总户数"></el-input-number> |
|
|
|
</el-form-item> |
|
|
|
style="display: block" |
|
|
|
prop="realBuilding" |
|
|
|
label-width="150px"> |
|
|
|
<el-input-number class="item_width_4" |
|
|
|
v-model="dataForm.realBuilding" |
|
|
|
:min="0" |
|
|
|
:max="9999" |
|
|
|
label="总户数"></el-input-number> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="地图位置" |
|
|
|
prop="longitude" |
|
|
|
label-width="150px" |
|
|
|
style="display: block"> |
|
|
|
<div style="width: 500px"> |
|
|
|
<el-select v-model="searchValue" |
|
|
|
filterable |
|
|
|
style="width: 500px" |
|
|
|
remote |
|
|
|
:reserve-keyword="true" |
|
|
|
placeholder="请输入关键词" |
|
|
|
:remote-method="remoteMethod" |
|
|
|
:loading="loading"> |
|
|
|
<el-option v-for="(item,index) in searchOptions" |
|
|
|
@click.native="handleClickKey(index)" |
|
|
|
:key="item.value" |
|
|
|
:label="item.label" |
|
|
|
:value="item.value"> |
|
|
|
</el-option> |
|
|
|
</el-select> |
|
|
|
<div id="app_community" |
|
|
|
class="div_map"></div> |
|
|
|
</div> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="详细地址" |
|
|
|
prop="address" |
|
|
|
label-width="150px" |
|
|
|
@ -108,39 +134,6 @@ |
|
|
|
</el-input> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="位置坐标" |
|
|
|
prop="longitude" |
|
|
|
label-width="150px" |
|
|
|
style="display: block"> |
|
|
|
<div style="width:500px"> |
|
|
|
<el-input class="item_width_4" |
|
|
|
maxlength="50" |
|
|
|
placeholder="请输入关键字" |
|
|
|
v-model="keyWords"> |
|
|
|
</el-input> |
|
|
|
<el-button style="margin-left: 10px" |
|
|
|
type="primary" |
|
|
|
size="small" |
|
|
|
@click="handleSearchMap">查询</el-button> |
|
|
|
<div id="app" |
|
|
|
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> |
|
|
|
</el-form-item> |
|
|
|
|
|
|
|
<el-form-item label="备注" |
|
|
|
prop="remark" |
|
|
|
label-width="150px" |
|
|
|
@ -190,6 +183,7 @@ |
|
|
|
import { mapGetters } from 'vuex' |
|
|
|
import { Loading } from 'element-ui' // 引入Loading服务 |
|
|
|
import { requestPost } from '@/js/dai/request' |
|
|
|
import daiMap from "@/utils/dai-map"; |
|
|
|
var map |
|
|
|
var search |
|
|
|
var markers |
|
|
|
@ -199,6 +193,11 @@ export default { |
|
|
|
data () { |
|
|
|
return { |
|
|
|
formType: 'add', //表单操作类型 add新增,edit编辑,detail详情 |
|
|
|
searchOptions: [], |
|
|
|
searchValue: '', |
|
|
|
resultList: [], |
|
|
|
loading: false, |
|
|
|
|
|
|
|
|
|
|
|
gridList: [], |
|
|
|
propertyList: [], |
|
|
|
@ -232,121 +231,125 @@ export default { |
|
|
|
}, |
|
|
|
components: {}, |
|
|
|
mounted () { |
|
|
|
this.initMap() |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
// 地图初始化函数,本例取名为init,开发者可根据实际情况定义 |
|
|
|
initMap () { |
|
|
|
// 定义地图中心点坐标 |
|
|
|
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 }) |
|
|
|
// 新建一个地点搜索类 |
|
|
|
markers = new TMap.MultiMarker({ |
|
|
|
map: map, |
|
|
|
geometries: [] |
|
|
|
}) |
|
|
|
infoWindowList = Array(10) |
|
|
|
async initForm (type, row, agencyObj) { |
|
|
|
this.$refs.ref_form.resetFields(); |
|
|
|
this.agencyObj = agencyObj |
|
|
|
let { latitude, longitude } = this.$store.state.user; |
|
|
|
this.formType = type |
|
|
|
if (row) { |
|
|
|
this.dataForm = JSON.parse(JSON.stringify(row)) |
|
|
|
this.dataForm.neighborHoodId = this.dataForm.id |
|
|
|
this.neighborHoodId = this.dataForm.neighborHoodId |
|
|
|
|
|
|
|
// 监听地图平移结束 |
|
|
|
map.on('panend', () => { |
|
|
|
this.handleMoveCenter() |
|
|
|
}) |
|
|
|
this.handleMoveCenter() |
|
|
|
} else { |
|
|
|
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); |
|
|
|
} |
|
|
|
await this.loadAgency() |
|
|
|
await this.loadGrid() |
|
|
|
await this.loadProperty() |
|
|
|
}, |
|
|
|
// 地图初始化函数,本例取名为init,开发者可根据实际情况定义 |
|
|
|
initMap (latitude, longitude) { |
|
|
|
|
|
|
|
setMarker (lat, lng) { |
|
|
|
markers.setGeometries([]) |
|
|
|
markers.add([ |
|
|
|
map = new daiMap( |
|
|
|
document.getElementById("app_community"), |
|
|
|
{ latitude, longitude }, |
|
|
|
{ |
|
|
|
id: '4', |
|
|
|
styleId: 'marker', |
|
|
|
position: new TMap.LatLng(lat, lng), |
|
|
|
properties: { |
|
|
|
title: 'marker4' |
|
|
|
} |
|
|
|
zoom: 16.2, // 设置地图缩放级别 |
|
|
|
pitch: 43.5, // 设置俯仰角 |
|
|
|
rotation: 45, // 设置地图旋转角度 |
|
|
|
} |
|
|
|
]) |
|
|
|
}, |
|
|
|
); |
|
|
|
|
|
|
|
// 监听地图平移结束 |
|
|
|
map.on("dragend", (e) => { |
|
|
|
this.handleMoveCenter(e); |
|
|
|
}); |
|
|
|
|
|
|
|
map.setCenter(latitude, longitude); |
|
|
|
map.setMarker(latitude, longitude); |
|
|
|
|
|
|
|
handleSearchMap () { |
|
|
|
infoWindowList.forEach((infoWindow) => { |
|
|
|
infoWindow.close() |
|
|
|
}) |
|
|
|
infoWindowList.length = 0 |
|
|
|
markers.setGeometries([]) |
|
|
|
// 在地图显示范围内以给定的关键字搜索地点 |
|
|
|
search |
|
|
|
.searchNearby({ |
|
|
|
keyword: this.keyWords, |
|
|
|
radius: 1000, |
|
|
|
autoExtend: true, |
|
|
|
center: map.getCenter(), |
|
|
|
}) |
|
|
|
.then((result) => { |
|
|
|
let { data } = result |
|
|
|
if (Array.isArray(data) && data.length > 0) { |
|
|
|
const { |
|
|
|
location: { lat, lng } |
|
|
|
} = data[0] |
|
|
|
map.setCenter(new TMap.LatLng(lat, lng)) |
|
|
|
this.setMarker(lat, lng) |
|
|
|
this.dataForm.latitude = lat |
|
|
|
this.dataForm.longitude = lng |
|
|
|
} else { |
|
|
|
this.$message.error('未检索到相关位置坐标') |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
handleMoveCenter () { |
|
|
|
|
|
|
|
async 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) |
|
|
|
const { lat, lng } = map.getCenter(); |
|
|
|
this.dataForm.latitude = lat; |
|
|
|
this.dataForm.longitude = lng; |
|
|
|
map.setMarker(lat, lng); |
|
|
|
|
|
|
|
let { msg, data } = await map.getAddress(lat, lng); |
|
|
|
if (msg == "success") { |
|
|
|
this.dataForm.address = data.address |
|
|
|
this.searchValue = data.address |
|
|
|
this.searchOptions = [] |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
async initForm (type, row, agencyObj) { |
|
|
|
this.$refs.ref_form.resetFields(); |
|
|
|
this.agencyObj = agencyObj |
|
|
|
async remoteMethod (query) { |
|
|
|
|
|
|
|
this.formType = type |
|
|
|
if (row) { |
|
|
|
this.dataForm = JSON.parse(JSON.stringify(row)) |
|
|
|
this.dataForm.neighborHoodId = this.dataForm.id |
|
|
|
this.neighborHoodId = this.dataForm.neighborHoodId |
|
|
|
map.setCenter(new TMap.LatLng(this.dataForm.latitude, this.dataForm.longitude)) |
|
|
|
this.setMarker(this.dataForm.latitude, this.dataForm.longitude) |
|
|
|
if (query !== '') { |
|
|
|
this.loading = true; |
|
|
|
|
|
|
|
const { msg, data } = await map.searchNearby(query); |
|
|
|
this.loading = false; |
|
|
|
this.resultList = [] |
|
|
|
|
|
|
|
if (msg == "success" && data.resultList && data.resultList.length > 0) { |
|
|
|
|
|
|
|
if (data.resultList && data.resultList.length > 0) { |
|
|
|
this.resultList = data.resultList |
|
|
|
this.searchOptions = this.resultList.map(item => { |
|
|
|
return { value: `${item.hotPointID}`, label: `${item.address + item.name}` }; |
|
|
|
|
|
|
|
}); |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.searchOptions = [ |
|
|
|
{ |
|
|
|
value: '0', |
|
|
|
label: '未检索到结果' |
|
|
|
} |
|
|
|
] |
|
|
|
} |
|
|
|
} else { |
|
|
|
map.setCenter(new TMap.LatLng(agencyObj.latitude, agencyObj.longitude)) |
|
|
|
this.searchOptions = []; |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
await this.loadAgency() |
|
|
|
await this.loadGrid() |
|
|
|
await this.loadProperty() |
|
|
|
handleClickKey (index) { |
|
|
|
let selPosition = this.resultList[index] |
|
|
|
let lonlat = selPosition.lonlat.split(" ") |
|
|
|
map.setCenter(lonlat[1], lonlat[0]); |
|
|
|
map.setMarker(lonlat[1], lonlat[0]); |
|
|
|
this.dataForm.latitude = lonlat[1]; |
|
|
|
this.dataForm.longitude = lonlat[0]; |
|
|
|
this.dataForm.address = selPosition.address + selPosition.name |
|
|
|
}, |
|
|
|
async handleCode() { |
|
|
|
|
|
|
|
|
|
|
|
async handleCode () { |
|
|
|
if (!this.dataForm.gridId) return this.$message.error('请选择网格') |
|
|
|
const { data, code, msg } = await requestPost( |
|
|
|
"/gov/org/houseInformation/getNeighborHoodCoding/" + this.dataForm.gridId); |
|
|
|
if (msg == "success" && code == 0) { |
|
|
|
this.dataForm.coding = data.coding |
|
|
|
this.dataForm.sysCoding = data.sysCoding |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
}, |
|
|
|
//加载组织 |
|
|
|
async loadAgency () { |
|
|
|
@ -488,7 +491,9 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
resetData () { |
|
|
|
this.keyWords = '' |
|
|
|
this.searchValue = '' |
|
|
|
this.searchOptions = [] |
|
|
|
this.resultList = [] |
|
|
|
this.neighborHoodId = '' //小区ID |
|
|
|
this.dataForm = { |
|
|
|
neighborHoodName: '', // 小区名称【不超过50字】 |
|
|
|
|