kukuasir@vip.qq.com 1 year ago
parent
commit
442e7dde0c
1 changed files with 12 additions and 14 deletions
  1. 12 14
      src/views/equip-management/report/list.vue

+ 12 - 14
src/views/equip-management/report/list.vue

@@ -110,7 +110,7 @@
 				</div>
 				<el-table
 					id="dataTable"
-					:data="pageData"
+					:data="tableData"
 					empty-text="无数据"
 					:span-method="objectSpanMethod"
 					@sort-change="handleSortChanged"
@@ -578,7 +578,6 @@ export default {
 			},
 			total: 0,
 			dataSource: [], // 原始数据源
-			pageData: [],  // 分页后的数据
 			tableData: [],
 			argsList: [],
 			selection: [],  // 选中的数据
@@ -832,21 +831,20 @@ export default {
 			console.log("排序后的数据: ", this.dataSource);
 		},
 		/** 生成tableData */
-		genTableData(reset = false) {
-			// 展开所有项目下的设备及单机
-			if (reset || !this.tableData.length) {
-				let expandNodes = expandAllNodes(this.dataSource);
-				let dataSolve = mergeTableRows(expandNodes, this.mergeColums);
-				this.tableData = dataSolve;
-				console.log('>>> tableData: ', this.tableData);
-			}
-			this.pageData = [];
+		genTableData() {
+			let pageData = [];
 			const start = (this.queryParams.page_index - 1) * this.queryParams.page_size;
-			const end = Math.min(this.queryParams.page_index * this.queryParams.page_size, this.tableData.length);
+			const end = Math.min(this.queryParams.page_index * this.queryParams.page_size, this.dataSource.length);
 			for (let index = start; index < end; index++) {
-				const element = this.tableData[index];
-				this.pageData.push(element);
+				const element = this.dataSource[index];
+				pageData.push(element);
 			}
+			// 展开所有项目下的设备及单机
+			let expandNodes = expandAllNodes(pageData);
+			// 合并行和列
+			let dataSolve = mergeTableRows(expandNodes, this.mergeColums);
+			this.tableData = dataSolve;
+			console.log('>>> tableData: ', this.tableData);
 		},
 		/** 数据行合并 */
 		objectSpanMethod({ row, column, rowIndex, columnIndex }) {