kukuasir@vip.qq.com 1 jaar geleden
bovenliggende
commit
53d4f66d67
4 gewijzigde bestanden met toevoegingen van 52 en 31 verwijderingen
  1. 27 1
      src/js/common.js
  2. 4 6
      src/js/merge.js
  3. 12 16
      src/js/sort.js
  4. 9 8
      src/views/equip-management/report/list.vue

+ 27 - 1
src/js/common.js

@@ -275,10 +275,35 @@ const calcFloatProps = [
 ];
 
 /**
+ * 过滤主机(主机内没有供水或回水温度不显示)
+ */
+function filterHostCtrl(box) {
+  let filterHpCtrl = [];
+  const hostCtrl = box.hostCtrl || [];
+  for (let i = 0; i < hostCtrl.length; i++) {
+    const hpStandalone = hostCtrl[i];
+    if (!hpStandalone.host_su_temp || !hpStandalone.host_re_temp) {
+      continue;
+    }
+    filterHpCtrl.push(hpStandalone);
+  }
+  return filterHpCtrl;
+}
+
+/**
  * 取最大单机数
  */
 function calcMaxStandaloneCnt(box) {
-  let hpStandaloneCnt = box.hostCtrl ? box.hostCtrl.length : 0;
+  // 主机特殊处理:主机内没有供水或回水温度不显示
+  let hpStandaloneCnt = 0;
+  const hostCtrl = box.hostCtrl || [];
+  for (let i = 0; i < hostCtrl.length; i++) {
+    const hpStandalone = hostCtrl[i];
+    if (!hpStandalone.host_su_temp || !hpStandalone.host_re_temp) {
+      continue;
+    }
+    hpStandaloneCnt += 1;
+  }
   let dhStandaloneCnt = box.newTrendCtrl ? box.newTrendCtrl.length : 0;
   let hexStandaloneCnt = box.hex ? box.hex.length : 0;
   // 需求:末端最多显示一行,其他类型设备最多两行。如果其他类型设备超过一行,末端需要合并
@@ -434,6 +459,7 @@ export default {
   heatExchangeCols,
   endCols,
   calcFloatProps,
+  filterHostCtrl,
   calcMaxStandaloneCnt,
   calcEndMinAndMaxValue,
   getArgsColor,

+ 4 - 6
src/js/merge.js

@@ -4,14 +4,12 @@ import define from './common.js'
 export function expandAllNodes(boxList) {
 	let tableData = []
 	boxList.forEach((b, index) => {
+		// 主机特殊处理:主机内没有供水或回水温度不显示
+		let filterHpCtrl = define.filterHostCtrl(b);
     // 判断有多少单机,主机、新风机、换热站、末端单机数量取最大值
     let maxCnt = define.calcMaxStandaloneCnt(b);
     for (let i = 0; i < maxCnt; i++) {
-      let hpStandalone = b.hostCtrl && i < b.hostCtrl.length ? b.hostCtrl[i] : {};
-			// 主机内没有供水或回水温度不显示
-			if (!hpStandalone.host_su_temp || !hpStandalone.host_re_temp) {
-				continue;
-			}
+      let hpStandalone = filterHpCtrl && i < filterHpCtrl.length ? filterHpCtrl[i] : {};
       let dhStandalone = b.newTrendCtrl && i < b.newTrendCtrl.length ? b.newTrendCtrl[i] : {};
       let hexStandalone = b.hex && i < b.hex.length ? b.hex[i] : {};
       let cbStandalone = define.calcEndMinAndMaxValue(b.end || []);
@@ -34,6 +32,7 @@ export function expandAllNodes(boxList) {
       });
     }
   });
+	console.log(">>> 合并之后: ", tableData)
 	// 合并单机
 	return _getStandaloneSpanRows(tableData)
 }
@@ -94,7 +93,6 @@ export function mergeTableRows(data, merge) {
 			return v
 		})
 	})
-	console.log("合并后: ", data)
 	return data
 }
 

+ 12 - 16
src/js/sort.js

@@ -2,27 +2,24 @@ import define from "./common.js";
 
 /** 根据主机属性进行排序(比较最大值) */
 export function sortBoxListByHost(data, sort) {
-  // 先计算最大值
   for (let i = 0; i < data.length; i++) {
     const box = data[i];
     const hostCtrl = box.hostCtrl || [];
     let maxVal = 0;
     for (let j = 0; j < hostCtrl.length; j++) {
       const hp = hostCtrl[j];
-      if (_isFloat(sort.prop)) {
-        if (hp[sort.prop] > maxVal && box.runStatus == 1) {
-          maxVal = hp[sort.prop];
-        }
-      } else {
-        // TODO:
+      // if (_isFloat(sort.prop)) {
+      //   if (hp[sort.prop] > maxVal && box.runStatus == 1) {
+      //     maxVal = hp[sort.prop];
+      //   }
+      // } else {
+      //   // TODO:
+      // }
+      if (hp[sort.prop] > maxVal && box.runStatus == 1) {
+        maxVal = hp[sort.prop];
       }
     }
     box["max_" + sort.prop] = maxVal;
-    console.log(
-      `盒子[${box.boxName}]的${"max_" + sort.prop}值为: ${
-        box["max_" + sort.prop]
-      }`
-    );
   }
   return _sortData(data, sort);
 }
@@ -36,7 +33,7 @@ export function sortBoxListByNewTrend(data, sort) {
     let maxVal = 0;
     for (let j = 0; j < newTrendCtrl.length; j++) {
       const dh = newTrendCtrl[j];
-      if (dh[sort.prop] > maxVal) {
+      if (dh[sort.prop] > maxVal && box.runStatus == 1) {
         maxVal = dh[sort.prop];
       }
     }
@@ -54,7 +51,7 @@ export function sortBoxListByHeatExchange(data, sort) {
     let maxVal = 0;
     for (let j = 0; j < heatExchangeCtrl.length; j++) {
       const hex = heatExchangeCtrl[j];
-      if (hex[sort.prop] > maxVal) {
+      if (hex[sort.prop] > maxVal && box.runStatus == 1) {
         maxVal = hex[sort.prop];
       }
     }
@@ -65,14 +62,13 @@ export function sortBoxListByHeatExchange(data, sort) {
 
 /** 根据面板属性进行排序(比较最大值) */
 export function sortBoxListByEnd(data, sort) {
-  // 先计算最大值
   for (let i = 0; i < data.length; i++) {
     const box = data[i];
     const endCtrl = box.end || [];
     let maxVal = 0;
     for (let j = 0; j < endCtrl.length; j++) {
       const end = endCtrl[j];
-      if (end[sort.prop] > maxVal) {
+      if (end[sort.prop] > maxVal && box.runStatus == 1) {
         maxVal = end[sort.prop];
       }
     }

+ 9 - 8
src/views/equip-management/report/list.vue

@@ -121,7 +121,7 @@
 					<el-table-column type="selection" width="60" align="center" fixed />
 					<el-table-column label="序号" width="60" align="center" fixed>
 						<template slot-scope="scope">
-							<span>{{ (queryParams.page_index - 1) * queryParams.page_size + scope.$index + 1 }}</span>
+							<span>{{ (queryParams.page_index - 1) * queryParams.page_size + scope.row.index }}</span>
 						</template>
 					</el-table-column>
 					<el-table-column prop="boxName" label="盒子名称" align="center" width="180" show-overflow-tooltip fixed>
@@ -582,7 +582,7 @@ export default {
 			argsList: [],
 			selection: [],  // 选中的数据
 			nameset: [], // 选中的项目名称集合
-			mergeColums: ['boxName', 'runStatus', 'runMode'],
+			mergeColums: ['index', 'boxName', 'runStatus', 'runMode'],
 			runStatMap: define.runStatDict,
 			runModeMap: define.runModeDict,
 			connectStatMap: define.connectStatDict,
@@ -776,27 +776,27 @@ export default {
 					const newTrendCtrl = box.newTrendCtrl || [];
 					if (!newTrendCtrl.length || box.runStatus == 2) {
 						hasFilter2 = true;
-						return true;
+						return false;
 					} else {
 						for (let j = 0; j < newTrendCtrl.length; j++) {
 							const dh = newTrendCtrl[j];
 							if (dh.nt_dew_point < this.extraParams.dhDewPointMin || dh.nt_dew_point > this.extraParams.dhDewPointMax) {
 								hasFilter2 = true;
-								return true;
+								return false;
 							}
 						}
 					}
 				}
 				// 根据 换热站供水水温度 过滤盒子
-				if (filterHexSuTemp && !hasFilter1 && hasFilter2) {
+				if (filterHexSuTemp && (!hasFilter1 && !hasFilter2)) {
 					const heatExchangeCtrl = box.hex || [];
 					if (!heatExchangeCtrl.length || box.runStatus == 2) {
-						return true;
+						return false;
 					} else {
 						for (let j = 0; j < heatExchangeCtrl.length; j++) {
 							const hex = heatExchangeCtrl[j];
 							if (hex.hex_su_temp < this.extraParams.hexSuTempMin || hex.hex_su_temp > this.extraParams.hexSuTempMax) {
-								return true;
+								return false;
 							}
 						}
 					}
@@ -841,10 +841,11 @@ export default {
 			}
 			// 展开所有项目下的设备及单机
 			let expandNodes = expandAllNodes(pageData);
+			// console.log(">>> 展开后: ", expandNodes);
 			// 合并行和列
 			let dataSolve = mergeTableRows(expandNodes, this.mergeColums);
 			this.tableData = dataSolve;
-			console.log('>>> tableData: ', this.tableData);
+			console.log('>>> 合并后: ', this.tableData);
 		},
 		/** 数据行合并 */
 		objectSpanMethod({ row, column, rowIndex, columnIndex }) {