From 2473f4ce35cda8dcd1194618c5d22c2e5b0354e3 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期五, 01 三月 2024 17:38:14 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/views/common/ztt-table.vue |   52 ++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 38 insertions(+), 14 deletions(-)

diff --git a/src/views/common/ztt-table.vue b/src/views/common/ztt-table.vue
index 717635e..0701521 100644
--- a/src/views/common/ztt-table.vue
+++ b/src/views/common/ztt-table.vue
@@ -568,6 +568,11 @@
         return 'id'
       }
     },
+    //闇�瑕佸悎骞剁殑瀛楁闆嗗悎
+    mergeSpanArr: {
+        type: Array,
+        default: []
+    },
     toolbarMaxLength: {
       type: Number,
       default: 5,
@@ -928,22 +933,41 @@
     },
     objectSpanMethod({ row, column, rowIndex, columnIndex }) {
       if (this.options.tableCellMerge) {
-        let result = ''
-        this.$emit(
-          'objectSpanMethod',
-          row,
-          column,
-          rowIndex,
-          columnIndex,
-          (val) => {
-            if (val) {
-              result = val
+        const propName = column.property
+        if (propName) {
+            if(this.mergeSpanArr.includes(propName)){
+                if (rowIndex > 0 && row[propName] === this.tableData[rowIndex - 1][propName]) {
+                    return { rowspan: 0, colspan: 0 };
+                } else {
+                    let rowspan = 1;
+                    for (let i = rowIndex + 1; i < this.tableData.length; i++) {
+                        if (this.tableData[i][propName] === row[propName]) {
+                            rowspan++;
+                        } else {
+                            break;
+                        }
+                    }
+                    return { rowspan: rowspan, colspan: 1 };
+                }
             }
-          }
-        )
-        if (result) {
-          return result
         }
+        // let result = ''
+        // this.$emit(
+        //   'objectSpanMethod',
+        //   row,
+        //   column,
+        //   rowIndex,
+        //   columnIndex,
+        //   (val) => {
+        //     console.log(val);
+        //     if (val) {
+        //       result = val
+        //     }
+        //   }
+        // )
+        // if (result) {
+        //   return result
+        // }
       }
     },
     getDataList(selectedId) {

--
Gitblit v1.9.3