diff --git a/src/views/overview/overviewBdOffline.vue b/src/views/overview/overviewBdOffline.vue index 0380652..1246fae 100644 --- a/src/views/overview/overviewBdOffline.vue +++ b/src/views/overview/overviewBdOffline.vue @@ -373,6 +373,7 @@ showAllWells(val) { if (val) { // 显示全部 this.listQuery.isAlarm = '0' + this.zoom = 15 this.filterAlarm(false) } else { // 仅显示报警 this.listQuery.isAlarm = '1' @@ -476,7 +477,11 @@ clearSelected() { this.listQuery.deptid = [] this.listQuery.wellType = '' - this.filter() + if (this.showAll) { + this.filterAlarm(false) + } else { + this.filterAlarm(true) + } }, // 获取闸井类型 fetchWellType() { @@ -511,7 +516,7 @@ this.searchWells = [] // 符合查询结果放入searchWells,查询前先置空 this.showMarkers = [] // 清空所有marker for (const alarmWell of this.alarmWells) { - alarmWell.visible = false + alarmWell.visible = true } // this.showMarkers = [] // 需要显示的结果放入showMarkers for (const marker of this.markers) { @@ -556,11 +561,13 @@ const hideWellIds = [] const hideWellCodes = [] // 如果查询条件为空,直接全部返回 - if (deptid && deptid.length === 0 && wellType && wellType === '') { + if (deptid && deptid.length === 0 && wellType === '') { this.showMarkers = this.markers this.showAll = true } else { this.showMarkers = [] + const centerxs = [] + const centerys = [] this.showAll = false for (const marker of this.markers) { let show = true @@ -572,13 +579,11 @@ if (wellType && wellType !== '' && marker.wellType !== wellType) { show = false } - // 如果只显示报警,井的状态不是报警 - // if (isAlarm === '1' && marker.wellStatus !== 'alarm') { - // show = false - // } // 如果符合显示的条件 if (show) { this.showMarkers.push(marker) + centerxs.push(parseFloat(marker.lng)) + centerys.push(parseFloat(marker.lat)) marker.visible = true } else { hideWellIds.push(marker.wellId) @@ -586,6 +591,11 @@ marker.visible = false } } + centerxs.sort() + centerys.sort() + const index = Math.floor(centerxs.length / 2) + this.center = { lng: centerxs[index], lat: centerys[index] } + this.zoom = 15 } console.log(hideWellCodes.length) for (const alarmWell of this.alarmWells) { @@ -602,29 +612,26 @@ }, // 报警筛选 filterAlarm(isAlarm) { + // 清除筛选、搜索条件 this.listQuery.wellType = '' this.listQuery.deptid = [] this.keywords = '' this.searchWells = [] - const hideWellIds = [] const hideWellCodes = [] if (isAlarm) { - this.showMarkers = this.markers.filter(function(marker) { - if (marker.wellStatus === 'alarm') { - return marker - } else { - hideWellIds.push(marker.wellId) - hideWellCodes.push(marker.wellCode) - } - }) + this.showMarkers = [] + // const showMarkers = this.markers.filter(function(marker) { + // if (marker.wellStatus === 'alarm') { + // return marker + // } else { + // hideWellIds.push(marker.wellId) + // hideWellCodes.push(marker.wellCode) + // } + // }) for (const alarmWell of this.alarmWells) { - if (hideWellIds.indexOf(alarmWell.wellId) > -1) { - alarmWell.visible = false - } else { - alarmWell.visible = true - } + alarmWell.visible = true } - this.hideWellCodes = hideWellCodes + // this.hideWellCodes = hideWellCodes } else { for (const alarmWell of this.alarmWells) { alarmWell.visible = true @@ -665,10 +672,10 @@ deptid: well.deptid, bfzt: well.bfzt, visible: true, - wellStatus: 'alarm' + wellStatus: 'normal' } this.markers.push(marker) - this.showMarkers.push(marker) + // this.showMarkers.push(marker) centerxs.push(parseFloat(well.lngBaidu)) centerys.push(parseFloat(well.latBaidu)) }