|
|
@@ -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', {
|