BUG 25656

This commit is contained in:
aixianling
2021-12-23 13:56:06 +08:00
parent 5bd058eef1
commit 425fc5483d

View File

@@ -3,7 +3,8 @@
<div class="grid-input"> <div class="grid-input">
<img src="./img/search-icon.png" alt="" class="search-icon"> <img src="./img/search-icon.png" alt="" class="search-icon">
<!-- <img src="./img/back-icon.png" alt="" class="back-icon"> --> <!-- <img src="./img/back-icon.png" alt="" class="back-icon"> -->
<input type="text" class="input" placeholder="请输入姓名、房屋信息" v-model="name" maxlength="10" confirm-type="search" @confirm="search" /> <input type="text" class="input" placeholder="请输入姓名、房屋信息" v-model="name" maxlength="10" confirm-type="search"
@confirm="search"/>
<div class="clear-btn"> <div class="clear-btn">
<img src="./img/del-icon.png" alt="" class="del-icon" v-if="name" @click="clear"> <img src="./img/del-icon.png" alt="" class="del-icon" v-if="name" @click="clear">
</div> </div>
@@ -14,7 +15,7 @@
<div class="title border"> <div class="title border">
<img src="./img/search-icon.png" alt="" class="search-icon">{{ name }} <img src="./img/search-icon.png" alt="" class="search-icon">{{ name }}
</div> </div>
<div class="item border" v-for="(item, index) in buildList" :key="index" @click.stop="getBuidInfo(item)"> <div class="item border" v-for="(item, index) in buildList" :key="index" @click.stop="getBuildingInfo(item)">
<img src="./img/user-icon.png" alt="" class="search-icon user-icon"> <img src="./img/user-icon.png" alt="" class="search-icon user-icon">
<div class="item-content"> <div class="item-content">
<h3>{{ item.residentName }}</h3> <h3>{{ item.residentName }}</h3>
@@ -26,7 +27,8 @@
<img src="./img/build-icon.png" alt=""> 楼栋<br/>列表 <img src="./img/build-icon.png" alt=""> 楼栋<br/>列表
</div> </div>
<div class="map-content"> <div class="map-content">
<AiTMap v-if="areaId" :areaId="areaId" :map.sync="map" :lib.sync="lib" :ops="ops" :libraries="['service', 'tools']"/> <AiTMap v-if="areaId" :areaId="areaId" :map.sync="map" :lib.sync="lib" :ops="ops"
:libraries="['service', 'tools']"/>
</div> </div>
<u-popup v-model="showPop" mode="bottom" border-radius="14"> <u-popup v-model="showPop" mode="bottom" border-radius="14">
<div class="popup"> <div class="popup">
@@ -72,7 +74,6 @@
<script> <script>
import {mapState} from 'vuex' import {mapState} from 'vuex'
export default { export default {
data() { data() {
return { return {
@@ -98,7 +99,6 @@ export default {
computed: {...mapState(['user'])}, computed: {...mapState(['user'])},
mounted() { mounted() {
this.areaId = this.user.areaId this.areaId = this.user.areaId
// Promise.all([this.getCenterLatLng(),this.getCommunityList()])
this.getCenterLatLng().then(points => { this.getCenterLatLng().then(points => {
this.getMarkerCluster(points) this.getMarkerCluster(points)
}) })
@@ -136,8 +136,8 @@ export default {
} }
}) })
}, },
getMarkerCluster(points) { getMarkerCluster(points, count = 0) {
let {lib: TMap, map, retryMapCount} = this let {lib: TMap, map} = this
if (map) { if (map) {
map.setCenter(this.latLngCenter) map.setCenter(this.latLngCenter)
let MarkerCluster = new TMap.MarkerCluster({ let MarkerCluster = new TMap.MarkerCluster({
@@ -165,6 +165,7 @@ export default {
geometries.push({ geometries.push({
styleId: 'cluster', styleId: 'cluster',
position: item.center, position: item.center,
properties: {...item},
content: item.geometries.length.toString() || "0" content: item.geometries.length.toString() || "0"
}) })
} else { } else {
@@ -173,6 +174,7 @@ export default {
function ClusterBubble(options) { function ClusterBubble(options) {
TMap.DOMOverlay.call(this, options); TMap.DOMOverlay.call(this, options);
} }
ClusterBubble.prototype = new TMap.DOMOverlay(); ClusterBubble.prototype = new TMap.DOMOverlay();
ClusterBubble.prototype.onInit = function (options) { ClusterBubble.prototype.onInit = function (options) {
this.content = options.content; this.content = options.content;
@@ -236,14 +238,17 @@ export default {
}) })
}, },
}) })
marker.on('click', (e) => {
let {bounds} = e.geometry.properties
map.fitBounds(bounds)
})
} }
}) })
return Promise.resolve() return Promise.resolve()
} else { } else {
if (retryMapCount < 5) { if (count < 5) {
setTimeout(() => { setTimeout(() => {
this.retryMapCount++ return this.getMarkerCluster(points, ++count)
return this.getMarkerCluster(points)
}, 1000) }, 1000)
} else Promise.reject("加载失败") } else Promise.reject("加载失败")
} }
@@ -281,7 +286,7 @@ export default {
} }
}) })
}, },
getBuidInfo(item) { getBuildingInfo(item) {
this.$http.post(`/app/appcommunityhouseinfo/queryDetailByIdWithBuilding?buildId=${item.buildingId}&houseId=${item.id}`).then(res => { this.$http.post(`/app/appcommunityhouseinfo/queryDetailByIdWithBuilding?buildId=${item.buildingId}&houseId=${item.id}`).then(res => {
if (res.code == 0) { if (res.code == 0) {
this.show = false this.show = false