|
@@ -113,11 +113,15 @@ const markerIcon = L.icon({
|
|
|
popupAnchor: [1, -38]
|
|
|
})
|
|
|
L.Marker.prototype.options.icon = markerIcon
|
|
|
+import mixins from '@/mixin/mqtt.js'
|
|
|
+import { NumConvertLM, Uint8ArrayToString } from '@/utils'
|
|
|
+const iconSize = [110, 110]
|
|
|
export default {
|
|
|
name: 'GoafVisualEditor',
|
|
|
components: {
|
|
|
MapSelector
|
|
|
},
|
|
|
+ mixins: [mixins],
|
|
|
data() {
|
|
|
return {
|
|
|
viewData: {},
|
|
@@ -195,11 +199,16 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
init() {
|
|
|
- this.initMap()
|
|
|
getGoafBaseInfo().then((res) => {
|
|
|
this.goaf = res.data
|
|
|
this.goafOrebelts = this.unique(res.data, 'goafOrebelt')
|
|
|
})
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.initMap()
|
|
|
+ this.initMqtt({
|
|
|
+ mqttResponse: this.mqttResponse
|
|
|
+ })
|
|
|
+ })
|
|
|
},
|
|
|
|
|
|
// 加载数据
|
|
@@ -288,7 +297,7 @@ export default {
|
|
|
const html = `<div class="goaf-icon-box" style="width:100%;height:100%;position: relative;"></div>`
|
|
|
var icon = L.divIcon({
|
|
|
html,
|
|
|
- iconSize: [50, 50]
|
|
|
+ iconSize
|
|
|
})
|
|
|
layer.setIcon(icon)
|
|
|
}
|
|
@@ -300,7 +309,7 @@ export default {
|
|
|
const html = `<div class="goaf-icon-box" style="width:100%;height:100%;position: relative;"></div>`
|
|
|
var icon = L.divIcon({
|
|
|
html,
|
|
|
- iconSize: [50, 50]
|
|
|
+ iconSize
|
|
|
})
|
|
|
layer.setIcon(icon)
|
|
|
self.layer = layer
|
|
@@ -355,15 +364,24 @@ export default {
|
|
|
L.geoJSON(feature, {
|
|
|
pointToLayer: function(_feature, latlng) {
|
|
|
const goafInfo = _feature.properties.goafInfo
|
|
|
+ const goafOrebelt = _feature.properties.goafOrebelt
|
|
|
+ const goafOrebody = _feature.properties.goafOrebody
|
|
|
+ const goafOreheight = _feature.properties.goafOreheight
|
|
|
+ const goafName = _feature.properties.goafName
|
|
|
+ var goafAlarmStatus = ''
|
|
|
let Volume = 0
|
|
|
if (goafInfo) {
|
|
|
Volume = (goafInfo.goafCanfillVolume - goafInfo.goafRemainVolume) / goafInfo.goafCanfillVolume
|
|
|
Volume = (Volume * 100).toFixed(2)
|
|
|
}
|
|
|
- const html = `<div class="goaf-icon-box" style="width:100%;height:100%;position: relative;"><div class="goaf-fill-v" style="height:${Volume}%;"></div></div>`
|
|
|
+ if (_feature.properties.goafAlarmStatus === '1') {
|
|
|
+ goafAlarmStatus = 'ico-warning'
|
|
|
+ }
|
|
|
+ const goaf_icon_tag = `<div class="goaf-icon-tag" title="${NumConvertLM(goafOrebelt)}-${goafOrebody}-${goafOreheight}-${goafName}">${NumConvertLM(goafOrebelt)}-${goafOrebody}-${goafOreheight}-${goafName}</div>`
|
|
|
+ const html = `<div class="goaf-icon-box ${goafAlarmStatus}" style="width:100%;height:100%;position: relative;">${goaf_icon_tag}<div class="goaf-fill-v" style="height:${Volume}%;"></div></div>`
|
|
|
var icon = L.divIcon({
|
|
|
html,
|
|
|
- iconSize: [50, 50]
|
|
|
+ iconSize
|
|
|
})
|
|
|
return L.marker(latlng, { icon })
|
|
|
},
|
|
@@ -492,10 +510,15 @@ export default {
|
|
|
}
|
|
|
let Volume = (goafNames[i].goafCanfillVolume - goafNames[i].goafRemainVolume) / goafNames[i].goafCanfillVolume
|
|
|
Volume = (Volume * 100).toFixed(2)
|
|
|
- const html = `<div class="goaf-icon-box" style="width:100%;height:100%;position: relative;"><div class="goaf-fill-v" style="height:${Volume}%;"></div></div>`
|
|
|
+ const goafOrebelt = goafNames[i].goafOrebelt
|
|
|
+ const goafOrebody = goafNames[i].goafOrebody
|
|
|
+ const goafOreheight = goafNames[i].goafOreheight
|
|
|
+ const goafName = goafNames[i].goafName
|
|
|
+ const goaf_icon_tag = `<div class="goaf-icon-tag" title="${NumConvertLM(goafOrebelt)}-${goafOrebody}-${goafOreheight}-${goafName}">${NumConvertLM(goafOrebelt)}-${goafOrebody}-${goafOreheight}-${goafName}</div>`
|
|
|
+ const html = `<div class="goaf-icon-box" style="width:100%;height:100%;position: relative;">${goaf_icon_tag}<div class="goaf-fill-v" style="height:${Volume}%;"></div></div>`
|
|
|
var icon = L.divIcon({
|
|
|
html,
|
|
|
- iconSize: [50, 50]
|
|
|
+ iconSize
|
|
|
})
|
|
|
layer.setIcon(icon)
|
|
|
this.saveForm.goafId = goafNames[i].goafId
|
|
@@ -567,6 +590,7 @@ export default {
|
|
|
'goafOrebody': this.saveForm.goafOrebody,
|
|
|
'goafOreheight': this.saveForm.goafOreheight,
|
|
|
'goafName': this.saveForm.goafName,
|
|
|
+ 'goafAlarmStatus': '0',
|
|
|
'mapId': this.formData.mapId,
|
|
|
'layerId': '',
|
|
|
'layerCatId': '',
|
|
@@ -684,6 +708,14 @@ export default {
|
|
|
}
|
|
|
return geojson
|
|
|
},
|
|
|
+ mqttResponse(message) {
|
|
|
+ const data = message ? Uint8ArrayToString(message) : ''
|
|
|
+ this.$nextTick(() => {
|
|
|
+ if (data.topictype === 'add' || data.topictype === 'completed') {
|
|
|
+ this.getLayers()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
unique(arr = [], name = 'name') {
|
|
|
const res = new Map()
|
|
|
return arr.filter((item) => !res.has(item[name]) && res.set(item[name], 1))
|
|
@@ -855,5 +887,41 @@ export default {
|
|
|
background-image: url("./goaf/stone.png");
|
|
|
}
|
|
|
}
|
|
|
+ .goaf-icon-tag{
|
|
|
+ width: 100%;
|
|
|
+ display: inline-block;
|
|
|
+ background: linear-gradient(90deg, #21649c 0.21%, #060F1E 100%);
|
|
|
+ background-color: rgba(33, 100, 156,0.6);
|
|
|
+ overflow:hidden;
|
|
|
+ text-overflow:ellipsis;
|
|
|
+ white-space:nowrap;
|
|
|
+ color: #fff;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ /*动画*/
|
|
|
+.ico-warning {
|
|
|
+ position: relative;
|
|
|
+ &::after{
|
|
|
+ display: block;
|
|
|
+ content: "";
|
|
|
+ height: 60%;
|
|
|
+ width: 60%;
|
|
|
+ background-image: radial-gradient(yellow,red);
|
|
|
+ border-radius: 50% 50% 10% 10%;
|
|
|
+ animation: twinkle 0.5s infinite alternate;
|
|
|
+ position: absolute;
|
|
|
+ transform: translate(-50%,-50%);
|
|
|
+ left: 50%;
|
|
|
+ top: 50%;
|
|
|
+ box-shadow: 0 0 20px red;
|
|
|
+ z-index: 9999;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+@keyframes twinkle {
|
|
|
+ 0% {opacity: 0.9;}
|
|
|
+ 50% {opacity: 0.5;}
|
|
|
+ 100% {opacity: 0;}
|
|
|
+}
|
|
|
</style>
|
|
|
|