Browse Source

bug fixed

kukuasir@vip.qq.com 1 year ago
parent
commit
a0eed21bb7
3 changed files with 5 additions and 31 deletions
  1. 0 13
      src/js/common.js
  2. 3 16
      src/js/export.js
  3. 2 2
      src/views/equip-management/report/list.vue

+ 0 - 13
src/js/common.js

@@ -268,18 +268,6 @@ function calcMaxStandaloneCnt(box) {
   return max;
 }
 
-function calcMaxStandaloneCntExt(box) {
-  // 需求:末端最多显示一行,其他类型设备最多两行。如果其他类型设备超过一行,末端需要合并
-  // 如果主机新风机换热站的单机数都是0,还需取一下末端的数量(最大为1)
-  let max = Math.max(box.hpCnt || 0, box.dhCnt || 0, box.hexCnt || 0);
-  max = Math.min(2, max);
-  if (max <= 0) {
-    let cbStandaloneCnt = box.end ? box.end.length : 0;
-    max = Math.min(cbStandaloneCnt, 1);
-  }
-  return max;
-}
-
 /**
  * 计算每个盒子下末端的最大值与最小值
  */
@@ -429,7 +417,6 @@ export default {
   heatExchangeCols,
   endCols,
   calcMaxStandaloneCnt,
-  calcMaxStandaloneCntExt,
   calcEndMinAndMaxValue,
   getArgsColor,
   formatData,

+ 3 - 16
src/js/export.js

@@ -76,26 +76,14 @@ export function exportToExcel(datas, fn) {
 
 	// 数据
 	let expand = _transferDataToXlsx(datas)
-	console.log("expand: ", expand);
+	// console.log("expand: ", expand);
 
 	// 合并表头
 	const merges = ['A1:A2', 'B1:B2', 'C1:C2', 'D1:I1', 'J1:O1', 'P1:V1', 'W1:AC1']
 
 	// 合并列
-	// let projectSet = _calcProjectRowMap(expand)
 	let boxSet = _calcBoxRowMap(expand)
-	console.log("boxSet: ", boxSet);
-	// 计算项目合并列
-	// if (projectSet.length > 0) {
-	// 	let first = projectSet[0]
-	// 	merges.push('A'+(3+first.s)+':A'+(3+first.l-1))
-	// 	for (let i = 1; i < projectSet.length; i++) {
-	// 		let pre = projectSet[i - 1]
-	// 		let cur = projectSet[i]
-	// 		let start = 3 + pre.s + pre.l
-	// 		merges.push('A'+start+':A'+(start+cur.l-1))
-	// 	}
-	// }
+
 	// 计算盒子/盒子运行状态/盒子运行模式合并列
 	if (boxSet.length > 0) {
 		let first = boxSet[0]
@@ -111,7 +99,6 @@ export function exportToExcel(datas, fn) {
 			merges.push('C'+start+':C'+(start+cur.l-1))
 		}
 	}
-	console.log("merges: ", merges);
 
 	// 导出
 	Export2ExcelMerge({
@@ -152,7 +139,7 @@ function _transferDataToXlsx(boxList) {
 	let tableData = []
 	boxList.forEach((b) => {
     // 继续判断有多少单机,主机、新风机、换热站、末端单机数量取最大值
-    let maxCnt = define.calcMaxStandaloneCntExt(b);
+    let maxCnt = define.calcMaxStandaloneCnt(b);
     for (let i = 0; i < maxCnt; i++) {
       let hpStandalone =
         b.hostCtrl && i < b.hostCtrl.length ? b.hostCtrl[i] : undefined;

+ 2 - 2
src/views/equip-management/report/list.vue

@@ -895,7 +895,7 @@ export default {
 		},
 		/** 获取对应设备下的末端列表 */
 		getDatasByRow(row, prop) {
-			let box = this.pageData.find(b => b.box_id === row.boxId);
+			let box = this.dataSource.find(b => b.box_id === row.boxId);
 			if (!box) {
 				return [];
 			}
@@ -938,7 +938,7 @@ export default {
 			this.nameset = Array.from(new Set(boxIds));
 			let boxList = [];
 			this.nameset.forEach(name => {
-				let box = this.pageData.find(d => d.boxId === name);
+				let box = this.dataSource.find(d => d.box_id === name);
 				boxList.push(box);
 			});
 			this.selection = boxList;