BUG 30095

This commit is contained in:
aixianling
2022-06-08 10:19:42 +08:00
parent c9dc8940ed
commit fa7c5428c5
2 changed files with 125 additions and 121 deletions

View File

@@ -86,7 +86,8 @@
<!-- </div>--> <!-- </div>-->
<div class="community-btn"> <div class="community-btn">
<el-button icon="iconfont iconloudongmoxing" size="small" <el-button icon="iconfont iconloudongmoxing" size="small"
@click="$router.push({query: {communityId: info.communityId, buildingId: info.id,unitNum:house ? house.unitNumber : 1,buildingNumber:info.buildingNumber}})">楼栋模型 @click="$router.push({query: {communityId: info.communityId, buildingId: info.id,unitNum:house ? house.unitNumber : 1,buildingNumber:info.buildingNumber}})">
楼栋模型
</el-button> </el-button>
</div> </div>
</div> </div>
@@ -160,12 +161,12 @@ export default {
buildList: [], buildList: [],
searchList: [], searchList: [],
house: null, house: null,
center: [] center: [],
mapLib: null
} }
}, },
computed: { computed: {
...mapState(['user']), ...mapState(['user']),
hasCommunityId() { hasCommunityId() {
return !!this.$route.query?.communityId return !!this.$route.query?.communityId
} }
@@ -293,7 +294,7 @@ export default {
<div class="polymeric-container"> <div class="polymeric-container">
<p>${context.count}</p> <p>${context.count}</p>
</div> </div>
</div>` </div>`, {mapLib: AMap} = this
let offset = new AMap.Pixel(-9, -9) let offset = new AMap.Pixel(-9, -9)
context.marker.setContent(el) context.marker.setContent(el)
@@ -336,6 +337,7 @@ export default {
}, },
addMakert(points) { addMakert(points) {
let {mapLib: AMap} = this
new AMap.MarkerClusterer(this.map, points, { new AMap.MarkerClusterer(this.map, points, {
gridSize: 60, gridSize: 60,
maxZoom: 15, maxZoom: 15,
@@ -352,7 +354,7 @@ export default {
size: 1000000 size: 1000000
} }
}).then(res => { }).then(res => {
if (res.code === 0) { if (res?.data) {
this.buildList = res.data.records this.buildList = res.data.records
const points = res.data.records.map(item => { const points = res.data.records.map(item => {
return { return {
@@ -364,17 +366,14 @@ export default {
communityName: item.communityName communityName: item.communityName
} }
}) })
this.addMakert(points) this.addMakert(points)
} }
}) })
}, },
hidePopup() { hidePopup() {
this.isShowArea = false this.isShowArea = false
this.isShowSearch = false this.isShowSearch = false
}, },
switchLayer(flag) { switchLayer(flag) {
if (flag) { if (flag) {
this.map.addLayer(this.satellite) this.map.addLayer(this.satellite)
@@ -384,7 +383,6 @@ export default {
this.isImageMap = flag this.isImageMap = flag
}, },
initMap({lng, lat}) { initMap({lng, lat}) {
this.center = [lng, lat]; this.center = [lng, lat];
AMapLoader.load({ AMapLoader.load({
@@ -396,6 +394,7 @@ export default {
plugins: [] plugins: []
} }
}).then((AMap) => { }).then((AMap) => {
this.mapLib = AMap
this.map = new AMap.Map('map', { this.map = new AMap.Map('map', {
resizeEnable: true, resizeEnable: true,
zooms: [6, 20], zooms: [6, 20],

View File

@@ -102,7 +102,8 @@
</div> </div>
<div class="community-btn" v-if="!info.name"> <div class="community-btn" v-if="!info.name">
<el-button icon="iconfont iconloudongmoxing" size="small" <el-button icon="iconfont iconloudongmoxing" size="small"
@click="showStatistics=true; $router.push({query: {communityId: info.communityId, buildingId: info.id,unitNum:house ? house.unitNumber : 1,buildingNumber:info.buildingNumber}})">楼栋模型 @click="showStatistics=true; $router.push({query: {communityId: info.communityId, buildingId: info.id,unitNum:house ? house.unitNumber : 1,buildingNumber:info.buildingNumber}})">
楼栋模型
</el-button> </el-button>
</div> </div>
</div> </div>
@@ -158,6 +159,7 @@ export default {
data() { data() {
return { return {
map: null, map: null,
mapLib: null,
community: '', community: '',
isShowLayer: false, isShowLayer: false,
isShowSearch: false, isShowSearch: false,
@@ -365,7 +367,7 @@ export default {
<p>${context.count}</p> <p>${context.count}</p>
</div> </div>
</div>` </div>`
let {mapLib: AMap} = this
let offset = new AMap.Pixel(-9, -9) let offset = new AMap.Pixel(-9, -9)
context.marker.setContent(el) context.marker.setContent(el)
context.marker.setOffset(offset) context.marker.setOffset(offset)
@@ -421,6 +423,7 @@ export default {
}, },
addMakert(points) { addMakert(points) {
let {mapLib: AMap} = this
new AMap.MarkerClusterer(this.map, points, { new AMap.MarkerClusterer(this.map, points, {
gridSize: 60, gridSize: 60,
maxZoom: 15, maxZoom: 15,
@@ -481,6 +484,7 @@ export default {
plugins: [] plugins: []
} }
}).then((AMap) => { }).then((AMap) => {
this.mapLib = AMap
this.map = new AMap.Map('map', { this.map = new AMap.Map('map', {
resizeEnable: true, resizeEnable: true,
zooms: [6, 20], zooms: [6, 20],
@@ -1336,6 +1340,7 @@ export default {
color: #89B; color: #89B;
} }
} }
.map-area__right { .map-area__right {
margin-left: 16px; margin-left: 16px;
} }