2021-12-15 18:07:16 +08:00
|
|
|
<template>
|
|
|
|
|
<div class="detail">
|
2021-12-20 18:09:45 +08:00
|
|
|
<div class="grid-select">
|
2021-12-15 18:07:16 +08:00
|
|
|
<span class="label">网格选择</span>
|
|
|
|
|
<div class="value">
|
2021-12-23 11:07:33 +08:00
|
|
|
<AiTreePicker :ops="treeList" v-model="form.id" @select="handleSelect">
|
2021-12-24 14:35:58 +08:00
|
|
|
<div class="grid-name" :style="{ color: form.girdName ? '' : '#c0c4cc' }">{{ form.girdName || '请选择网格' }}
|
2021-12-23 11:07:33 +08:00
|
|
|
<u-icon name="arrow-right" color="#cccccc" size="14"></u-icon>
|
|
|
|
|
</div>
|
|
|
|
|
</AiTreePicker>
|
2021-12-15 18:07:16 +08:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="map-content">
|
2022-01-14 16:07:50 +08:00
|
|
|
<AiTMap ref="AiTMap" :map.sync="map" :lib.sync="lib" :libraries="['geometry','service', 'tools']"/>
|
2021-12-15 18:07:16 +08:00
|
|
|
</div>
|
|
|
|
|
<u-popup v-model="show" mode="bottom" border-radius="14">
|
|
|
|
|
<div class="popup">
|
|
|
|
|
<div class="bg"></div>
|
2021-12-23 11:07:33 +08:00
|
|
|
<div class="title">{{ form.girdName }}</div>
|
2022-01-14 14:09:46 +08:00
|
|
|
<scroll-view scroll-y="true" class="grid-info">
|
|
|
|
|
<div class="info-flex">
|
|
|
|
|
<span class="label">网格类型</span>
|
|
|
|
|
<span class="value">{{ $dict.getLabel('girdType', form.girdType) }}</span>
|
2021-12-22 16:07:00 +08:00
|
|
|
</div>
|
2022-01-14 14:09:46 +08:00
|
|
|
<div class="info-flex">
|
|
|
|
|
<span class="label">网格层级</span>
|
|
|
|
|
<span class="value">{{ $dict.getLabel('girdLevel', form.girdLevel) }}</span>
|
|
|
|
|
</div>
|
2022-01-14 16:07:50 +08:00
|
|
|
<div v-if="form.girdMemberManageList && form.girdMemberManageList.length">
|
|
|
|
|
<div class="info-flex" v-for="(item, index) in form.girdMemberManageList" :key="index">
|
|
|
|
|
<span class="label">网格长</span>
|
|
|
|
|
<span class="value">{{ item.name }} {{ item.phone }}
|
|
|
|
|
<img :src="$cdn + 'common/phone.png'" alt="" @click="callPhone(item.phone)" class="phone-icon"
|
|
|
|
|
v-if="item.phone">
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2022-01-14 14:09:46 +08:00
|
|
|
<div v-if="form.girdMemberList && form.girdMemberList.length">
|
|
|
|
|
<div class="info-flex" v-for="(item, index) in form.girdMemberList" :key="index">
|
|
|
|
|
<span class="label">网格管理员</span>
|
|
|
|
|
<span class="value">{{ item.name }} {{ item.phone }}
|
|
|
|
|
<img :src="$cdn + 'common/phone.png'" alt="" @click="callPhone(item.phone)" class="phone-icon"
|
|
|
|
|
v-if="item.phone">
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</scroll-view>
|
2021-12-15 18:07:16 +08:00
|
|
|
</div>
|
|
|
|
|
</u-popup>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2021-12-23 11:07:33 +08:00
|
|
|
import {mapState} from 'vuex'
|
|
|
|
|
|
2021-12-15 18:07:16 +08:00
|
|
|
export default {
|
|
|
|
|
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
areaId: '',
|
2021-12-23 11:07:33 +08:00
|
|
|
lib: null,
|
2021-12-15 18:07:16 +08:00
|
|
|
map: null,
|
2021-12-17 17:31:12 +08:00
|
|
|
show: false,
|
2021-12-20 18:27:47 +08:00
|
|
|
form: {girdName: '', id: ''},
|
2021-12-20 18:09:45 +08:00
|
|
|
treeList: [],
|
|
|
|
|
showSelect: false,
|
|
|
|
|
editor: null,
|
2021-12-23 11:07:33 +08:00
|
|
|
polygons: []
|
2021-12-15 18:07:16 +08:00
|
|
|
}
|
|
|
|
|
},
|
2021-12-27 10:07:15 +08:00
|
|
|
computed: {...mapState(['user', 'config'])},
|
2021-12-22 16:07:00 +08:00
|
|
|
created() {
|
2021-12-20 18:27:47 +08:00
|
|
|
this.$dict.load('girdType', 'girdLevel')
|
2021-12-15 18:07:16 +08:00
|
|
|
this.areaId = this.user.areaId
|
2021-12-23 11:07:33 +08:00
|
|
|
this.getLeafNodes()
|
2021-12-24 15:27:36 +08:00
|
|
|
},
|
|
|
|
|
onShow() {
|
|
|
|
|
document.title = "网格管理"
|
2021-12-15 18:07:16 +08:00
|
|
|
},
|
|
|
|
|
methods: {
|
2021-12-23 11:07:33 +08:00
|
|
|
getLeafNodes() {
|
|
|
|
|
this.$http.post(`/app/appgirdinfo/queryGirdMemberGirdsById`).then((res) => {
|
|
|
|
|
if (res?.data) {
|
|
|
|
|
this.treeList = res.data
|
2022-01-14 14:09:46 +08:00
|
|
|
|
2022-01-14 16:07:50 +08:00
|
|
|
const arr = res.data.filter(v => v.points).map(e => {
|
2022-01-14 14:09:46 +08:00
|
|
|
return {
|
|
|
|
|
id: e.id,
|
2022-01-14 16:07:50 +08:00
|
|
|
girdName: e.girdName,
|
2022-01-14 14:09:46 +08:00
|
|
|
points: e.points.map(p => [p.lng, p.lat])
|
2021-12-23 11:07:33 +08:00
|
|
|
}
|
|
|
|
|
})
|
2021-12-27 10:07:15 +08:00
|
|
|
arr.length > 0 && this.renderGridMap(arr)
|
2021-12-23 11:07:33 +08:00
|
|
|
}
|
|
|
|
|
})
|
2021-12-17 17:31:12 +08:00
|
|
|
},
|
2022-01-14 14:09:46 +08:00
|
|
|
|
|
|
|
|
getGridInfo (id) {
|
2022-01-14 14:45:55 +08:00
|
|
|
this.$loading()
|
2022-01-14 14:09:46 +08:00
|
|
|
this.$http.post(`/app/appgirdinfo/queryDetailById?id=${id}`).then((res) => {
|
2022-01-14 14:45:55 +08:00
|
|
|
this.$hideLoading()
|
2022-01-14 14:09:46 +08:00
|
|
|
if (res?.data) {
|
|
|
|
|
this.form = res.data
|
|
|
|
|
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.show = true
|
|
|
|
|
})
|
|
|
|
|
}
|
2022-01-14 14:45:55 +08:00
|
|
|
}).catch(() => {
|
|
|
|
|
this.$hideLoading()
|
2022-01-14 14:09:46 +08:00
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
2021-12-23 11:07:33 +08:00
|
|
|
renderGridMap(paths, count = 0) {
|
|
|
|
|
let {map, lib: TMap, $refs: {AiTMap: {fitBounds}}} = this
|
|
|
|
|
if (TMap) {
|
|
|
|
|
const colors = ["#A194F4", "#7CBDF3", "#F3A57D", "#62D063", "#58DBDA", "#F7D151"]
|
|
|
|
|
if (this.polygons.length > 0) {
|
|
|
|
|
this.polygons.forEach(e => e.destroy())
|
|
|
|
|
this.polygons = []
|
|
|
|
|
}
|
2021-12-27 10:07:15 +08:00
|
|
|
if (paths?.length > 0) {
|
|
|
|
|
let bounds = []
|
2022-01-14 16:07:50 +08:00
|
|
|
|
2021-12-27 10:07:15 +08:00
|
|
|
paths.forEach((path, i) => {
|
|
|
|
|
let color = colors[i % colors.length]
|
|
|
|
|
let polygon = new TMap.MultiPolygon({
|
|
|
|
|
map, styles: {
|
|
|
|
|
default: new TMap.PolygonStyle({
|
|
|
|
|
showBorder: true,
|
2022-01-14 14:09:46 +08:00
|
|
|
borderColor: '#5088FF',
|
2021-12-27 10:07:15 +08:00
|
|
|
borderWidth: 2,
|
2022-01-14 14:09:46 +08:00
|
|
|
color: this.$colorUtils.Hex2RGBA('#5088FF', 0.1)
|
2021-12-27 10:07:15 +08:00
|
|
|
})
|
|
|
|
|
},
|
2022-01-14 14:09:46 +08:00
|
|
|
id: path.id,
|
|
|
|
|
geometries: [{paths: path.points.map(e => new TMap.LatLng(e[1], e[0]))}]
|
2021-12-27 10:07:15 +08:00
|
|
|
})
|
|
|
|
|
this.polygons.push(polygon)
|
2022-01-14 14:09:46 +08:00
|
|
|
bounds.push(fitBounds(path.points.map(e => new TMap.LatLng(e[1], e[0]))))
|
|
|
|
|
|
|
|
|
|
polygon.on('click', e => {
|
|
|
|
|
const id = e.target.id
|
|
|
|
|
this.getGridInfo(id)
|
|
|
|
|
})
|
2022-01-14 14:45:55 +08:00
|
|
|
|
|
|
|
|
const points = path.points.map(e => new TMap.LatLng(e[1], e[0]))
|
|
|
|
|
|
2022-01-14 16:07:50 +08:00
|
|
|
var position = TMap.geometry.computeCentroid(points)
|
|
|
|
|
|
|
|
|
|
let label = new TMap.MultiLabel({
|
|
|
|
|
id: `label~${path.id}`,
|
|
|
|
|
data: path.id,
|
|
|
|
|
map: map,
|
|
|
|
|
styles: {
|
|
|
|
|
building: new TMap.LabelStyle({
|
|
|
|
|
color: '#3777FF',
|
|
|
|
|
size: 20,
|
|
|
|
|
alignment: 'center',
|
|
|
|
|
verticalAlignment: 'middle'
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
geometries: [
|
|
|
|
|
{
|
|
|
|
|
id: `label-class-${i}`,
|
|
|
|
|
styleId: 'building',
|
|
|
|
|
position: position,
|
|
|
|
|
content: path.girdName,
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
})
|
|
|
|
|
label.on('click', e => {
|
|
|
|
|
this.getGridInfo(e.target.id.split('~')[1])
|
|
|
|
|
});
|
2021-12-23 11:07:33 +08:00
|
|
|
})
|
2021-12-27 10:07:15 +08:00
|
|
|
bounds = bounds.reduce((a, b) => {
|
|
|
|
|
return fitBounds([
|
|
|
|
|
a.getNorthEast(),
|
|
|
|
|
a.getSouthWest(),
|
|
|
|
|
b.getNorthEast(),
|
|
|
|
|
b.getSouthWest(),
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
map.fitBounds(bounds, {padding: 100})
|
|
|
|
|
} else {
|
|
|
|
|
map.setCenter(this.config.latlng)
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-23 11:07:33 +08:00
|
|
|
} else {
|
|
|
|
|
if (count < 5) {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
this.renderGridMap(paths, ++count)
|
|
|
|
|
}, 1000)
|
|
|
|
|
}
|
2021-12-22 16:07:00 +08:00
|
|
|
}
|
2021-12-15 18:07:16 +08:00
|
|
|
},
|
2021-12-23 11:07:33 +08:00
|
|
|
callPhone(phone) {
|
|
|
|
|
uni.makePhoneCall({phoneNumber: phone})
|
|
|
|
|
},
|
|
|
|
|
handleSelect(e) {
|
|
|
|
|
if (e?.points?.length > 0) {
|
2022-01-14 16:07:50 +08:00
|
|
|
const points = e.points.map(e => new TMap.LatLng(e.lat, e.lng))
|
|
|
|
|
var position = TMap.geometry.computeCentroid(points)
|
|
|
|
|
this.map.setCenter(position)
|
|
|
|
|
this.map.setZoom(15)
|
2021-12-23 11:07:33 +08:00
|
|
|
} else {
|
|
|
|
|
this.$u.toast("所选网格没有标绘!")
|
|
|
|
|
}
|
2021-12-20 18:27:47 +08:00
|
|
|
},
|
2021-12-15 18:07:16 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
2021-12-23 11:07:33 +08:00
|
|
|
::v-deep uni-page-body {
|
2021-12-15 18:07:16 +08:00
|
|
|
height: 100%;
|
|
|
|
|
}
|
2021-12-23 11:07:33 +08:00
|
|
|
|
|
|
|
|
ai-tree-picker {
|
2021-12-17 17:31:12 +08:00
|
|
|
display: inline-block;
|
|
|
|
|
}
|
2021-12-23 11:07:33 +08:00
|
|
|
|
2021-12-15 18:07:16 +08:00
|
|
|
.detail {
|
|
|
|
|
height: 100%;
|
2021-12-23 11:07:33 +08:00
|
|
|
.grid-select {
|
2021-12-15 18:07:16 +08:00
|
|
|
width: 100%;
|
|
|
|
|
padding: 34px 32px;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
background: #FFF;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
line-height: 44px;
|
|
|
|
|
color: #333;
|
2021-12-23 11:07:33 +08:00
|
|
|
|
|
|
|
|
.label {
|
2021-12-15 18:07:16 +08:00
|
|
|
display: inline-block;
|
|
|
|
|
width: 140px;
|
|
|
|
|
font-size: 32px;
|
|
|
|
|
}
|
2021-12-23 11:07:33 +08:00
|
|
|
|
|
|
|
|
.value {
|
2021-12-15 18:07:16 +08:00
|
|
|
font-size: 28px;
|
2021-12-23 11:07:33 +08:00
|
|
|
|
|
|
|
|
.u-icon {
|
2021-12-15 18:07:16 +08:00
|
|
|
margin-left: 8px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-12-23 11:07:33 +08:00
|
|
|
|
|
|
|
|
.map-content {
|
2021-12-15 18:07:16 +08:00
|
|
|
width: 100%;
|
2022-01-13 09:21:45 +08:00
|
|
|
height: calc(100% - 210px);
|
2021-12-15 18:07:16 +08:00
|
|
|
}
|
2021-12-23 11:07:33 +08:00
|
|
|
|
|
|
|
|
.popup {
|
2021-12-15 18:07:16 +08:00
|
|
|
padding: 0 32px 16px;
|
2021-12-23 11:07:33 +08:00
|
|
|
|
|
|
|
|
.bg {
|
2021-12-15 18:07:16 +08:00
|
|
|
width: 64px;
|
|
|
|
|
height: 10px;
|
|
|
|
|
background: #CCC;
|
|
|
|
|
border-radius: 6px;
|
2022-01-14 14:09:46 +08:00
|
|
|
margin: 32px auto 32px auto;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.grid-info {
|
|
|
|
|
height: 800px;
|
2021-12-15 18:07:16 +08:00
|
|
|
}
|
2021-12-23 11:07:33 +08:00
|
|
|
|
|
|
|
|
.title {
|
2021-12-15 18:07:16 +08:00
|
|
|
font-size: 36px;
|
|
|
|
|
font-family: PingFang-SC-Heavy, PingFang-SC;
|
|
|
|
|
font-weight: 800;
|
|
|
|
|
color: #333;
|
|
|
|
|
line-height: 50px;
|
|
|
|
|
margin-bottom: 24px;
|
|
|
|
|
}
|
2021-12-23 11:07:33 +08:00
|
|
|
|
|
|
|
|
.info-flex {
|
2021-12-15 18:07:16 +08:00
|
|
|
padding: 26px 0 30px 0;
|
|
|
|
|
width: 100%;
|
|
|
|
|
border-bottom: 1px solid #D8DDE6;
|
|
|
|
|
line-height: 40px;
|
|
|
|
|
font-size: 28px;
|
2021-12-23 11:07:33 +08:00
|
|
|
|
2022-01-14 14:09:46 +08:00
|
|
|
&:last-child {
|
|
|
|
|
border: none;
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-23 11:07:33 +08:00
|
|
|
.label {
|
2021-12-15 18:07:16 +08:00
|
|
|
display: inline-block;
|
|
|
|
|
width: 160px;
|
|
|
|
|
font-weight: 800;
|
|
|
|
|
color: #333;
|
|
|
|
|
}
|
2021-12-23 11:07:33 +08:00
|
|
|
|
|
|
|
|
.value {
|
2021-12-15 18:07:16 +08:00
|
|
|
color: #666;
|
|
|
|
|
font-size: 26px;
|
2021-12-23 11:07:33 +08:00
|
|
|
|
|
|
|
|
.phone-icon {
|
2021-12-15 18:07:16 +08:00
|
|
|
width: 40px;
|
|
|
|
|
height: 40px;
|
|
|
|
|
vertical-align: sub;
|
|
|
|
|
margin-left: 16px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-12-23 11:07:33 +08:00
|
|
|
|
|
|
|
|
.grid-name {
|
2021-12-20 18:09:45 +08:00
|
|
|
display: inline-block;
|
|
|
|
|
}
|
2021-12-23 11:07:33 +08:00
|
|
|
|
|
|
|
|
.footer {
|
2021-12-20 18:27:47 +08:00
|
|
|
width: 100%;
|
|
|
|
|
position: fixed;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
z-index: 99999;
|
|
|
|
|
display: flex;
|
|
|
|
|
font-size: 32px;
|
|
|
|
|
font-family: PingFangSC-Medium, PingFang SC;
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
height: 112px;
|
|
|
|
|
line-height: 112px;
|
|
|
|
|
text-align: center;
|
2021-12-23 11:07:33 +08:00
|
|
|
|
|
|
|
|
.btn {
|
2021-12-20 18:27:47 +08:00
|
|
|
flex: 2;
|
|
|
|
|
background: #1365DD;
|
|
|
|
|
color: #FFF;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-12-23 11:07:33 +08:00
|
|
|
</style>
|