diff --git a/src/views/overview/overviewBdOffline.vue b/src/views/overview/overviewBdOffline.vue index 8c3d6f8..0d1364e 100644 --- a/src/views/overview/overviewBdOffline.vue +++ b/src/views/overview/overviewBdOffline.vue @@ -247,6 +247,7 @@ count2: 5, showWellType: this.showWellType(), // 是否显示闸井类型下拉 wellTypeList: [], // 闸井类型列表 + wellTypeDict:{}, deptProps: { multiple: true, value: 'id', @@ -499,10 +500,12 @@ fetchWellType() { getWellType().then(response => { this.wellTypeList = [] + this.wellTypeDict = {} const wellTypes = this.$store.getters.wellTypes for (const wellType of response.data) { if (wellTypes.indexOf(wellType.value) !== -1) { this.wellTypeList.push(wellType) + this.wellTypeDict[wellType.value] = wellType.name } } if (this.wellTypeList.length <= 1) { @@ -789,6 +792,7 @@ this.alarmWells.push({ wellCode: alarm.wellCode, wellId: alarm.wellId, + wellType: alarm.wellType, position: { lng: alarm.lngBaidu, lat: alarm.latBaidu }, positionInfo: alarm.position, alarmTime: alarm.alarmTime, @@ -991,23 +995,80 @@ let count = 0 const points = polygon.getPath() const poly = new BMap.Polygon(points) + const typeCount = {} for(const item of this.showMarkers){ var ppoint = new BMap.Point(parseFloat(item.position.lng), parseFloat(item.position.lat)) var result = BMapLib.GeoUtils.isPointInPolygon(ppoint, poly); - if(result) count++ + if(result){ + if(item.wellType && typeof(typeCount[item.wellType])!='undefined'){ + typeCount[item.wellType] ++ + }else if(item.wellType){ + typeCount[item.wellType] = 1 + } + count++ + } } - this.$message.info('框选区域内有'+count+'个井') + let typeStr = '其中包含' + let typeCountList = [] + let typeStrList = [] + // 生成井类型-数量对象数组 + for(const key in typeCount){ + typeCountList.push({type:this.wellTypeDict[key],value:typeCount[key]}) + // typeStrList.push(this.wellTypeDict[key]+typeCount[key]+'个') + } + //按数量排序 + typeCountList = typeCountList.sort((x,y)=>y.value-x.value) + // 转为字符串数组 + for(const item of typeCountList){ + // typeCountList.push({type:this.wellTypeDict[key],value:typeCount[key]}) + typeStrList.push(item.type+item.value+'个') + } + // 组装成字符串 + typeStr += typeStrList.join(';')+'。' + const finalStr = '该区域内有'+count+'个井。'+(count>0?typeStr:'') + this.$alert(finalStr,'区域统计', { + confirmButtonText: '确定' + }) }, judgeAlarmWell(polygon){ let count = 0 const points = polygon.getPath() const poly = new BMap.Polygon(points) + const typeCount = {} for(const item of this.alarmWells){ var ppoint = new BMap.Point(parseFloat(item.position.lng), parseFloat(item.position.lat)) var result = BMapLib.GeoUtils.isPointInPolygon(ppoint, poly); - if(result) count++ + if(result){ + debugger + if(item.wellType && typeof(typeCount[item.wellType])!='undefined'){ + typeCount[item.wellType] ++ + }else if(item.wellType){ + typeCount[item.wellType] = 1 + } + count++ + } } - this.$message.info('框选区域内有'+count+'个井') + let typeStr = '其中包含' + let typeCountList = [] + let typeStrList = [] + // 生成井类型-数量对象数组 + for(const key in typeCount){ + typeCountList.push({type:this.wellTypeDict[key],value:typeCount[key]}) + // typeStrList.push(this.wellTypeDict[key]+typeCount[key]+'个') + } + //按数量排序 + typeCountList = typeCountList.sort((x,y)=>y.value-x.value) + // 转为字符串数组 + for(const item of typeCountList){ + // typeCountList.push({type:this.wellTypeDict[key],value:typeCount[key]}) + typeStrList.push(item.type+item.value+'个') + } + // 组装成字符串 + typeStr += typeStrList.join(';')+'。' + const finalStr = '该区域内有'+count+'个井。'+(count>0?typeStr:'') + this.$alert(finalStr,'区域统计', { + confirmButtonText: '确定' + }) }, drawDelete(){ // if(this.drawingManager.getDrawingMode()){