From d2e610d8814c4f2dbd4f0b8825ae595871668237 Mon Sep 17 00:00:00 2001
From: licp <lichunping@guanfang.com.cn>
Date: 星期二, 09 四月 2024 15:52:48 +0800
Subject: [PATCH] 特殊的表格合并

---
 src/components/tool/value-table.vue |   42 ++++++++++++++++++++++++++++++++++++------
 1 files changed, 36 insertions(+), 6 deletions(-)

diff --git a/src/components/tool/value-table.vue b/src/components/tool/value-table.vue
index d13d1f4..6942552 100644
--- a/src/components/tool/value-table.vue
+++ b/src/components/tool/value-table.vue
@@ -100,7 +100,7 @@
 				@row-click="rowClick" :show-summary="data.countFleid!=undefined && data.countFleid.length > 0"
 				:summary-method="getSummaries" :row-class-name="tableRowClassName"
         :row-key="record=>record.id" :current-row-key="data.currentId"
-        highlight-current-row
+        :highlight-current-row="data.highlight===undefined||data.highlight"
         :span-method="spanMethod">
 				<el-table-column type="selection" width="65" v-if="data.showSelect" :key="Math.random()">
 				</el-table-column>
@@ -390,8 +390,12 @@
           //   position:0
           // }
         ],
-        testArr: [],
-        testPosition: 0,
+        specialSpanList:[
+          // {
+          //   arr:[],
+          //   position:0
+          // }
+        ],
 			}
 		},
 		watch: {
@@ -435,6 +439,7 @@
         });
       },
       spanMethod({ row, column, rowIndex, columnIndex }){
+        // 涓�鑸殑鍚堝苟琛�
         if(this.data.spanConfig!=undefined&&this.data.spanConfig.rows&&this.data.spanConfig.rows.length>0){
           let i = null;
           let obj = this.data.spanConfig.rows.find((item,index)=>{
@@ -443,6 +448,22 @@
           })
           if(obj){
             const _row = this.spanList[i].arr[rowIndex];
+            const _col = _row > 0 ? 1 : 0;
+            return {
+              rowspan: _row,
+              colspan: _col,
+            };
+          }
+        }
+        // 鐗规畩鐨勫悎骞惰
+        if(this.data.spanConfig!=undefined&&this.data.spanConfig.special&&this.data.spanConfig.special.main&&this.data.spanConfig.special.rows&&this.data.spanConfig.special.rows.length>0){
+          let i = null;
+          let obj = this.data.spanConfig.special.rows.find((item,index)=>{
+            i = index;
+            return item.index==columnIndex
+          })
+          if(obj){
+            const _row = this.specialSpanList[i].arr[rowIndex];
             const _col = _row > 0 ? 1 : 0;
             return {
               rowspan: _row,
@@ -519,6 +540,7 @@
 							})
 						}
 					}
+          // 涓�鑸殑鍚堝苟琛�
           if(this.data.spanConfig!=undefined&&this.data.spanConfig.rows&&this.data.spanConfig.rows.length>0){
             this.spanList = [];
             this.data.spanConfig.rows.forEach((item,index)=>{
@@ -528,9 +550,17 @@
               })
               this.rowspan(this.spanList[index].arr, this.spanList[index].position, item.name);
             })
-            // this.testArr = []
-            // this.testPosition = 0
-            // this.rowspan(this.testArr, this.testPosition, this.data.spanConfig.rows.name);
+          }
+          // 鐗规畩鐨勫悎骞惰
+          if(this.data.spanConfig!=undefined&&this.data.spanConfig.special&&this.data.spanConfig.special.main&&this.data.spanConfig.special.rows&&this.data.spanConfig.special.rows.length>0){
+            this.specialSpanList = []
+            this.data.spanConfig.special.rows.forEach((item,index)=>{
+              this.specialSpanList.push({
+                arr:[],
+                position:0
+              })
+              this.rowspan(this.specialSpanList[index].arr, this.specialSpanList[index].position, this.data.spanConfig.special.main);
+            })
           }
 					this.loading = false
 				}).catch(e => {

--
Gitblit v1.9.3