Commit 487a0780 authored by 郭铭瑶's avatar 郭铭瑶 🤘

添加按小区检索(测试)

parent 809a74a0
...@@ -252,7 +252,7 @@ export default { ...@@ -252,7 +252,7 @@ export default {
[121.522611, 31.213471] [121.522611, 31.213471]
] ]
}, { }, {
name: '高小区', name: '高小区',
address: '蓝村路60弄3-29号', address: '蓝村路60弄3-29号',
level: 3, level: 3,
location: [121.531587, 31.210669], location: [121.531587, 31.210669],
......
...@@ -651,6 +651,31 @@ export default { ...@@ -651,6 +651,31 @@ export default {
[121.553082, 31.246488], [121.553082, 31.246488],
[121.552659, 31.246203] [121.552659, 31.246203]
] ]
}, {
'name': '阳光二村',
'address': '栖山路400弄1-29号',
'level': 2,
'location': [121.551121, 31.24577],
'path': [
[121.550387, 31.244868],
[121.549787, 31.245432],
[121.55088, 31.246705],
[121.551085, 31.246812],
[121.551153, 31.24681],
[121.551467, 31.246656],
[121.551594, 31.246606],
[121.551804, 31.246517],
[121.55214, 31.246369],
[121.552242, 31.246315],
[121.552396, 31.246224],
[121.552286, 31.246078],
[121.551841, 31.245526],
[121.552029, 31.245387],
[121.551896, 31.24525],
[121.551481, 31.244696],
[121.550675, 31.245224],
[121.550387, 31.244868],
]
}, { }, {
'name': '桃林一小区', 'name': '桃林一小区',
'address': '灵山路600弄1-44号', 'address': '灵山路600弄1-44号',
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<Panel v-for="street in streetList" :key="street" :name="street"> <Panel v-for="street in streetList" :key="street" :name="street">
{{curStreetData.name}}小区列表 {{curStreetData.name}}小区列表
<div slot="content" class="community-list"> <div slot="content" class="community-list">
<div v-for="(item, i) in curStreetData.community" :key="item.name + i"> <div v-for="(item, i) in curCommunity" :key="item.name + i">
<Button <Button
@click="handleView(item)" @click="handleView(item)"
size="small" size="small"
...@@ -299,6 +299,7 @@ export default { ...@@ -299,6 +299,7 @@ export default {
this.highlightArea(streetData) this.highlightArea(streetData)
}, },
highlightArea(area) { // 高亮区域 highlightArea(area) { // 高亮区域
if (this.$route.query && this.$route.query.community) return
if (!area.path || area.path <= 0) return if (!area.path || area.path <= 0) return
if (this.curStreetPolygon) { // 先清除已存在的高亮区域 if (this.curStreetPolygon) { // 先清除已存在的高亮区域
this.map.clearMap() this.map.clearMap()
...@@ -326,7 +327,7 @@ export default { ...@@ -326,7 +327,7 @@ export default {
}, },
initLayers() { // 配置地图图层信息 initLayers() { // 配置地图图层信息
if (!this.curStreetData.name) return if (!this.curStreetData.name) return
const communityList = [...this.curStreetData.community, ...this.buildingData.community] const communityList = [...this.curCommunity, ...this.curBuildingData]
const buildingOptions = { const buildingOptions = {
areas: communityList.map(community => { areas: communityList.map(community => {
if (community.type != 'building') { if (community.type != 'building') {
...@@ -461,7 +462,7 @@ export default { ...@@ -461,7 +462,7 @@ export default {
const buildingName = item.name && (item.name + '').replace('(补)', '').replace('(补)', '') const buildingName = item.name && (item.name + '').replace('(补)', '').replace('(补)', '')
if (buildingName.indexOf(name) < 0 && (item.buildingNo + '').indexOf(name) < 0) return // (筛选出点击的小区的楼栋)楼栋的小区名和name一致则往下走 if (buildingName.indexOf(name) < 0 && (item.buildingNo + '').indexOf(name) < 0) return // (筛选出点击的小区的楼栋)楼栋的小区名和name一致则往下走
// const curObj = buildingDatas.find(e => e.unitAddr.indexOf(item.buildingNo) >= 0 || item.buildingNo.indexOf(e.unitAddr) >= 0) // 查找出返回数据中的同一幢楼栋数据 // const curObj = buildingDatas.find(e => e.unitAddr.indexOf(item.buildingNo) >= 0 || item.buildingNo.indexOf(e.unitAddr) >= 0) // 查找出返回数据中的同一幢楼栋数据
const curObj = buildingDatas.find(e => e.unitNo.indexOf(item.buildingNo) >= 0 || item.buildingNo.indexOf(e.unitNo) >= 0) // 查找出返回数据中的同一幢楼栋数据 const curObj = buildingDatas.find(e => e.unitNo.indexOf(item.buildingNo + '') >= 0 || (item.buildingNo + '').indexOf(e.unitNo) >= 0) // 查找出返回数据中的同一幢楼栋数据
if (!curObj) return if (!curObj) return
if (curObj.ratio < 0.25) return if (curObj.ratio < 0.25) return
...@@ -551,6 +552,20 @@ export default { ...@@ -551,6 +552,20 @@ export default {
tableHeight() { tableHeight() {
return screen.height / 2 return screen.height / 2
}, },
curCommunity() { // 小区列表大致颜色
if (this.$route.query && this.$route.query.community) {
const {community} = this.$route.query
return [...this.curStreetData.community].filter(item => item.name.indexOf(community) >= 0 || community.indexOf(item.name) >= 0)
}
return [...this.curStreetData.community]
},
curBuildingData() { // 附加的自描的楼栋
if (this.$route.query && this.$route.query.community) {
const {community} = this.$route.query
return [...this.buildingData.community].filter(item => item.name.indexOf(community) >= 0 || community.indexOf(item.name) >= 0)
}
return [...this.buildingData.community]
},
}, },
watch: { watch: {
async curStreet(cur) { // 监控转换后的路由街镇名来获取匹配数据 async curStreet(cur) { // 监控转换后的路由街镇名来获取匹配数据
...@@ -561,11 +576,13 @@ export default { ...@@ -561,11 +576,13 @@ export default {
building: [], building: [],
} }
this.initLayers() this.initLayers()
const communityList = [...this.curStreetData.community] this.curCommunity.forEach(item => {
communityList.forEach(item => {
this.addMarker(item.name) this.addMarker(item.name)
}) })
this.addSpecialMarker() // TODO 是否先清除之前的? this.addSpecialMarker() // TODO 是否先清除之前的?
if (this.$route.query && this.$route.query.community) { // 如果有输入小区名则直接聚焦该小区
this.handleView(this.curCommunity[0])
}
} }
} }
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment