Explorar o código

报表bug修复

kukuasir@vip.qq.com hai 1 ano
pai
achega
b87dc98ab2

+ 26 - 0
src/js/common.js

@@ -446,6 +446,31 @@ function formatData(data, prop) {
   }
 }
 
+/**
+ * 查找对应的order
+ */
+function getCbOrder(data, row, prop) {
+  if (prop.indexOf("end_") < 0) {
+    return 0;
+  }
+  let order = -1;
+  for (let i = 0; i < data.length; i++) {
+    const box = data[i];
+    if (row.boxId === box.box_id) {
+      const endCtrl = box.end || [];
+      for (let j = 0; j < endCtrl.length; j++) {
+        const cb = endCtrl[j];
+        if (cb[prop] == row[prop]) {
+          order = cb.end_order;
+          break;
+        }
+      }
+      break;
+    }
+  }
+  return order;
+}
+
 export default {
   runStatDict,
   runModeDict,
@@ -464,4 +489,5 @@ export default {
   calcEndMinAndMaxValue,
   getArgsColor,
   formatData,
+  getCbOrder,
 };

+ 6 - 11
src/views/equip-management/report/PopEndInfo.vue

@@ -27,7 +27,10 @@
 			<div v-if="universal">
 				<div class="end-prop-item" v-for="(item, index) in universal" :key="index" v-if="item.name">
 					<div style="min-width: 40%;">{{ item.name }}:</div>
-					<div>{{ item.value }}</div>
+					<div>
+						<span>{{ item.value }}</span>
+						<span>{{ item.unit || '' }}</span>
+					</div>
 				</div>
 			</div>
 		</div>
@@ -97,16 +100,10 @@ export default {
 				let selIndex = 0;
 				
 				// 房间分组排序
-				// const cbOrder = this.data.end_order || 0;
+				const cbOrder = this.data.end_order || 0;
 				standalone.forEach((item, index) => {
 					// 计算默认选中的位置
-					// if (item.cbOrder == cbOrder) {
-					// 	item.selection = true;
-					// 	selIndex = index;
-					// } else {
-					// 	item.selection = false;
-					// }
-					if (index == 0) {
+					if (item.cbOrder == cbOrder) {
 						item.selection = true;
 						selIndex = index;
 					} else {
@@ -129,7 +126,6 @@ export default {
 				});
 
 				// 计算已经选中的indexPath
-				/*
 				for (let i = 0; i < this.areaList.length; i++) {
 					const area = this.areaList[i];
 					const deviceList = this.areaMap[area];
@@ -142,7 +138,6 @@ export default {
 						}
 					}
 				}
-				*/
 
 				// 获取实时数据与设备详情
 				if (selIndex < standalone.length) {

+ 10 - 11
src/views/equip-management/report/list.vue

@@ -335,7 +335,7 @@
 						<el-table-column prop="end_min_temp" label="最低室内温度(℃)" align="center" width="160">
 							<template slot-scope="scope">
 								<span id="end_min_temp" class="el-table-tag" :style="{ background: calcArgsColor(scope) }"
-									@click="handleItemClick(scope)">
+									@click="handleItemClick(scope, 'end_min_temp')">
 									{{ scope.row.end_min_temp != 0 ? fixedVal(scope.row, 'end_min_temp') : '/' }}
 								</span>
 							</template>
@@ -343,7 +343,7 @@
 						<el-table-column prop="end_min_humidity" label="最低室内湿度(%)" align="center" width="160">
 							<template slot-scope="scope">
 								<span id="end_min_humidity" class="el-table-tag" :style="{ background: calcArgsColor(scope) }"
-									@click="handleItemClick(scope)">
+									@click="handleItemClick(scope, 'end_min_humidity')">
 									{{ scope.row.end_min_humidity != 0 ? fixedVal(scope.row, 'end_min_humidity') : '/' }}
 								</span>
 							</template>
@@ -351,7 +351,7 @@
 						<el-table-column prop="end_min_dew_point" label="最低室内露点(℃)" align="center" width="160">
 							<template slot-scope="scope">
 								<span id="end_min_dew_point" class="el-table-tag" :style="{ background: calcArgsColor(scope) }"
-									@click="handleItemClick(scope)">
+									@click="handleItemClick(scope, 'end_min_dew_point')">
 									{{ scope.row.end_min_dew_point != 0 ? fixedVal(scope.row, 'end_min_dew_point') : '/' }}
 								</span>
 							</template>
@@ -359,7 +359,7 @@
 						<el-table-column prop="end_max_temp" label="最高室内温度(℃)" align="center" width="160">
 							<template slot-scope="scope">
 								<span id="end_max_temp" class="el-table-tag" :style="{ background: calcArgsColor(scope) }"
-									@click="handleItemClick(scope)">
+									@click="handleItemClick(scope, 'end_max_temp')">
 									{{ scope.row.end_max_temp != 0 ? fixedVal(scope.row, 'end_max_temp') : '/' }}
 								</span>
 							</template>
@@ -367,7 +367,7 @@
 						<el-table-column prop="end_max_humidity" label="最高室内湿度(%)" align="center" width="160">
 							<template slot-scope="scope">
 								<span id="end_max_humidity" class="el-table-tag" :style="{ background: calcArgsColor(scope) }"
-									@click="handleItemClick(scope)">
+									@click="handleItemClick(scope, 'end_max_humidity')">
 									{{ scope.row.end_max_humidity != 0 ? fixedVal(scope.row, 'end_max_humidity') : '/' }}
 								</span>
 							</template>
@@ -376,7 +376,7 @@
 							<template slot-scope="scope">
 								<div>
 									<span id="end_max_dew_point" class="el-table-tag" :style="{ background: calcArgsColor(scope) }"
-										@click="handleItemClick(scope)">
+										@click="handleItemClick(scope, 'end_max_dew_point')">
 										{{ scope.row.end_max_dew_point != 0 ? fixedVal(scope.row, 'end_max_dew_point') : '/' }}
 									</span>
 									<i v-if="scope.row.cbCnt > 1 && scope.row.runStatus == 1" class="el-icon-caret-bottom ml10"
@@ -811,7 +811,6 @@ export default {
 			if (!sort || !sort.prop.length) {
 				return;
 			}
-			console.log(">>> sort: ", sort.prop, sort.order)
 			// 主机
 			if (sort.prop.indexOf('host_') >= 0) {
 				return sortBoxListByHost(this.dataSource, sort);
@@ -828,7 +827,7 @@ export default {
 			else if (sort.prop.indexOf('end_') >= 0) {
 				return sortBoxListByEnd(this.dataSource, sort);
 			}
-			console.log("排序后的数据: ", this.dataSource);
+			// console.log("排序后的数据: ", this.dataSource);
 		},
 		/** 生成tableData */
 		genTableData() {
@@ -841,7 +840,6 @@ export default {
 			}
 			// 展开所有项目下的设备及单机
 			let expandNodes = expandAllNodes(pageData);
-			// console.log(">>> 展开后: ", expandNodes);
 			// 合并行和列
 			let dataSolve = mergeTableRows(expandNodes, this.mergeColums);
 			this.tableData = dataSolve;
@@ -965,13 +963,14 @@ export default {
 			console.log(`scroll bar update`);
 		},
 		/** 点击列 */
-		handleItemClick(scope) {
+		handleItemClick(scope, prop) {
 			const argsColor = this.getItemBgColor(scope);
 			if (!argsColor.length) {
 				return;
 			}
-			this.endPop.show = true;
+			scope.row.end_order = define.getCbOrder(this.dataSource, scope.row, prop);
 			this.endPop.row = scope.row;
+			this.endPop.show = true;
 		}
 	}
 };