Browse Source

Merge remote-tracking branch 'origin/master'

64060764@qq.com 1 year ago
parent
commit
93b6ac773b
1 changed files with 25 additions and 16 deletions
  1. 25 16
      src/views/equip-management/report/list.vue

+ 25 - 16
src/views/equip-management/report/list.vue

@@ -397,6 +397,7 @@ import ScrollBar from '../../../js/scrollbar.js';
 import "perfect-scrollbar/css/perfect-scrollbar.css";
 import { getAreaList, getCityList, getProvinceList } from "../../../js/api";
 import { getReportTitle } from "@/js/api";
+import { deepClone } from '@/utils';
 Vue.directive('fixed-scroll', ScrollBar);
 
 export default {
@@ -714,7 +715,6 @@ export default {
 			listProjects(params).then(resp => {
 				let data = resp.data || {};
 				let result = data.result || {};
-				this.total = result.count;
 				this.filterDataSource(result.data || []);
 				this.genTableData();
 				loading.close();
@@ -733,6 +733,7 @@ export default {
 		},
 		/** 本地过滤数据 */
 		filterDataSource(data) {
+			let newDataSource = [];
 			const hpSuTempMin = this.extraParams.hpSuTempMin;
 			const hpSuTempMax = this.extraParams.hpSuTempMax;
 			const dhDewPointMin = this.extraParams.dhDewPointMin;
@@ -742,50 +743,58 @@ export default {
 			const filterHpSuTemp = (this.extraParams.hpSuTempMax > this.extraParams.hpSuTempMin);
 			const filterDhDewPoint = (this.extraParams.dhDewPointMax > this.extraParams.dhDewPointMin);
 			const filterHexSuTemp = (this.extraParams.hexSuTempMax > this.extraParams.hexSuTempMin);
+			// 凡是不满足条件的盒子,全都过滤掉
 			for (let i = 0; i < data.length; i++) {
 				const element = data[i];
 				const boxList = element.boxList || [];
+				let newBoxList = deepClone(boxList);
 				for (let j = 0; j < boxList.length; j++) {
 					const box = boxList[j];
+					let hasFilter1 = false;  // 主机供水温度是否把盒子过滤掉了
+					let hasFilter2 = false;  // 新风送风露点是否把盒子过滤掉了
 					// 过滤主机
 					if (filterHpSuTemp) {
 						const hostCtrl = box.hostCtrl || [];
-						let newHpCtrl = [];
 						for (let x = 0; x < hostCtrl.length; x++) {
 							const hp = hostCtrl[x];
-							if (hp.host_su_temp >= hpSuTempMin && hp.host_su_temp <= hpSuTempMax) {
-								newHpCtrl.push(hp);
+							if (hp.host_su_temp < hpSuTempMin || hp.host_su_temp > hpSuTempMax) {
+								newBoxList.splice(j, 1);
+								hasFilter1 = true;
+								break;
 							}
 						}
-						box.hostCtrl = newHpCtrl;
 					}
 					// 过滤新风机
-					if (filterDhDewPoint) {
+					if (filterDhDewPoint && !hasFilter1) {
 						const newTrendCtrl = box.newTrendCtrl || [];
-						let newDhCtrl = [];
 						for (let x = 0; x < newTrendCtrl.length; x++) {
 							const dh = newTrendCtrl[x];
-							if (dh.nt_dew_point >= dhDewPointMin && dh.nt_dew_point <= dhDewPointMax) {
-								newDhCtrl.push(dh);
+							if (dh.nt_dew_point < dhDewPointMin || dh.nt_dew_point > dhDewPointMax) {
+								newBoxList.splice(j, 1);
+								hasFilter2 = true;
+								break;
 							}
 						}
-						box.newTrendCtrl = newDhCtrl;
 					}
 					// 过滤换热站
-					if (filterHexSuTemp) {
+					if (filterHexSuTemp && !hasFilter1 && hasFilter2) {
 						const heatExchangeCtrl = box.hex || [];
-						let newHexCtrl = [];
 						for (let x = 0; x < heatExchangeCtrl.length; x++) {
 							const hex = heatExchangeCtrl[x];
-							if (hex.hex_su_temp >= hexSuTempMin && hex.hex_su_temp <= hexSuTempMax) {
-								newHexCtrl.push(hex);
+							if (hex.hex_su_temp < hexSuTempMin || hex.hex_su_temp > hexSuTempMax) {
+								newBoxList.splice(j, 1);
+								break;
 							}
 						}
-						box.hex = newHexCtrl;
 					}
 				}
+				if (newBoxList.length > 0) {
+					element.boxList = newBoxList;
+					newDataSource.push(element);
+				}
 			}
-			this.dataSource = data;
+			this.total = newDataSource.length;
+			this.dataSource = newDataSource;
 		},
 		/** 计算主机供水温度属性值是否在范围内 */
 		hpSuTempIsInRange(ele) {