Lmm há 1 ano atrás
pai
commit
cf88d1a1bb
2 ficheiros alterados com 52 adições e 11 exclusões
  1. 20 4
      src/App.vue
  2. 32 7
      src/dataHandler.js

+ 20 - 4
src/App.vue

@@ -76,9 +76,12 @@
 				</el-table-column>
 				<el-table-column prop="host_temp_diff" label="温差" align="center" width="100">
 					<template slot-scope="scope">
-						<span class="el-table-tag" :style="{ background: scope.row.host_temp_diff && scope.row.host_temp_diff <= 5 ? 'yellowgreen' : '' }">
-							{{ fixedVal(scope.row.host_temp_diff) }}
-						</span>
+						<div>
+							<span class="el-table-tag" :style="{ background: scope.row.host_temp_diff && scope.row.host_temp_diff <= 5 ? 'yellowgreen' : '' }">
+								{{ fixedVal(scope.row.host_temp_diff) }}
+							</span>
+							<i v-if="scope.row.hpCnt > scope.row.maxCnt" class="el-icon-caret-bottom ml10" @click.stop="handleClickMore(scope.row, 'host')"></i>
+						</div>
 					</template>
 				</el-table-column>
 			</el-table-column>
@@ -426,8 +429,21 @@ export default {
 		},
 		/** 数据行合并 */
 		objectSpanMethod({ row, column, rowIndex, columnIndex }) {
+			// 主机合并
+			if (columnIndex >= 5 && columnIndex <= 10) {
+				return { rowspan: row.hpSpanRows, colspan: 1 };
+			}
+			// 新风机
+			if (columnIndex >= 11 && columnIndex <= 16) {
+				return { rowspan: row.dhSpanRows, colspan: 1 };
+			}
+			// 换热站
+			if (columnIndex >= 17 && columnIndex <= 23) {
+				return { rowspan: row.hexSpanRows, colspan: 1 };
+			}
+			// 末端
 			if (columnIndex >= 24) {
-				return { rowspan: row.spanRows, colspan: 1 };
+				return { rowspan: row.cbSpanRows, colspan: 1 };
 			}
 			const span = column['property'] + '-span';
 			if (row[span]) {

+ 32 - 7
src/dataHandler.js

@@ -32,7 +32,7 @@ export function expandAllNodes(projects) {
 			})
 		}
 	})
-	return _getEndSpanRows(tableData);
+	return _getStandaloneSpanRows(tableData);
 }
 
 // 合并行数据
@@ -108,15 +108,40 @@ function _calcMaxStandaloneCnt(box) {
 }
 
 // 计算每条记录末端所占的行数
-function _getEndSpanRows(tableData) {
+function _getStandaloneSpanRows(tableData) {
 	tableData.map((td, index) => {
 		let previous = tableData[index - 1]
-		if (td.maxCnt > 1 && previous.spanRows < 2) {
-			td.spanRows = td.maxCnt
-		} else if (index > 0 && previous.spanRows > 1) {
-			td.spanRows = 0
+		// 主机合并
+		if (td.maxCnt > 1 && td.hpCnt < td.maxCnt && previous.hpSpanRows < 2) {
+			td.hpSpanRows = td.maxCnt
+		} else if (index > 0 && previous.hpSpanRows > 1) {
+			td.hpSpanRows = 0
 		} else {
-			td.spanRows = 1
+			td.hpSpanRows = 1
+		}
+		// 新风机合并
+		if (td.maxCnt > 1 && td.dhCnt < td.maxCnt && previous.dhSpanRows < 2) {
+			td.dhSpanRows = td.maxCnt
+		} else if (index > 0 && previous.dhSpanRows > 1) {
+			td.dhSpanRows = 0
+		} else {
+			td.dhSpanRows = 1
+		}
+		// 换热站合并
+		if (td.maxCnt > 1 && td.hexCnt < td.maxCnt && previous.hexSpanRows < 2) {
+			td.hexSpanRows = td.maxCnt
+		} else if (index > 0 && previous.hexSpanRows > 1) {
+			td.hexSpanRows = 0
+		} else {
+			td.hexSpanRows = 1
+		}
+		// 末端合并
+		if (td.maxCnt > 1 && previous.cbSpanRows < 2) {
+			td.cbSpanRows = td.maxCnt
+		} else if (index > 0 && previous.cbSpanRows > 1) {
+			td.cbSpanRows = 0
+		} else {
+			td.cbSpanRows = 1
 		}
 		tableData[index] = td
 		return td