Forráskód Böngészése

fix(规则管理): 修复自定义表格复制功能中合并单元格ID生成逻辑,优化colspanKey处理

yusheng 5 hónapja
szülő
commit
36fd86782e

+ 5 - 4
src/views/rulesManagement/releaseRules/components/templateDiv/customTable.vue

@@ -457,6 +457,7 @@
         if (item.colspanKey.length) {
           this.columns.forEach((cell) => {
             cell.forEach((row) => {
+          
               if (item.colspanKey.includes(row.id)) {
                 width += Number(row.style.width);
               }
@@ -541,13 +542,13 @@
       copy() {
         let columns = JSON.parse(JSON.stringify(this.columns));
         columns.forEach((item, index) => {
-          item.forEach((cell, _index) => {
-            if (cell.colspanKey.length) {
-              cell.colspanKey.forEach((key, index) => {
+          item.forEach((cell) => {
+            if (cell.colspanKey.length&&!cell.copyId) {
+              cell.colspanKey.forEach((key, _index) => {
                 let id = generateRandomString(5);
                 let { columnIndex, rowIndex } = this.getIndex(key);
                 columns[columnIndex][rowIndex]['copyId'] = id;
-                cell.colspanKey[index] = id;
+                cell.colspanKey[_index] = id;
               });
             }
             if (cell.copyId) {