Procházet zdrojové kódy

fix(规则管理): 优化自定义表格组件样式和复制逻辑,修复表格合并单元格边界问题

yusheng před 5 měsíci
rodič
revize
76f99df40b

+ 1 - 1
src/views/rulesManagement/releaseRules/components/experimentationProcess.vue

@@ -21,7 +21,7 @@
         group="project1"
         :animation="300"
         handle=".sort-handle"
-        style="flex: 1"
+        style="flex: 1;max-height:calc(100vh - 500px);overflow: auto;"
       >
         <div
           class="demo-drag-list-item ele-cell"

+ 17 - 2
src/views/rulesManagement/releaseRules/components/templateDiv/customTable.vue

@@ -328,7 +328,7 @@
       },
       getIndex(id) {
         let columnIndex, rowIndex;
-        console.log(id);
+
         this.columns.forEach((cell, _columnIndex) => {
           let cellIndex = cell.findIndex((data) => data.id == id);
           if (cellIndex != '-1') {
@@ -365,6 +365,9 @@
             this.columns[columnIndex].forEach((cell, rowIndex) => {
               if (cell.colspanKey.length) {
                 //当前删除的列其他行有合并过单元格的处理
+                if (!this.columns[columnIndex + 1]) {
+                  return;
+                }
                 let data = this.columns[columnIndex + 1][rowIndex];
 
                 data.colspan = cell.colspan - 1;
@@ -539,7 +542,19 @@
         let columns = JSON.parse(JSON.stringify(this.columns));
         columns.forEach((item, index) => {
           item.forEach((cell, _index) => {
-            cell.id = generateRandomString(5);
+            if (cell.colspanKey.length) {
+              cell.colspanKey.forEach((key, index) => {
+                let id = generateRandomString(5);
+                let { columnIndex, rowIndex } = this.getIndex(key);
+                columns[columnIndex][rowIndex]['copyId'] = id;
+                cell.colspanKey[index] = id;
+              });
+            }
+            if (cell.copyId) {
+              cell.id = cell.copyId;
+            } else {
+              cell.id = generateRandomString(5);
+            }
           });
         });
         this.$emit('copy', {