|
|
@@ -320,8 +320,8 @@
|
|
|
rowspan: 1,
|
|
|
colspan: 1,
|
|
|
colspanKey: [],
|
|
|
- width: width||100,
|
|
|
- style: { width: width||100 },
|
|
|
+ width: width || 100,
|
|
|
+ style: { width: width || 100 },
|
|
|
id: generateRandomString(5)
|
|
|
};
|
|
|
},
|
|
|
@@ -402,8 +402,11 @@
|
|
|
}
|
|
|
|
|
|
this.columns.forEach((item, index) => {
|
|
|
-
|
|
|
- this.columns[index].splice(_rowIndex + 1, 0, this.getInput(this.columns[index][_rowIndex-1]?.style.width));
|
|
|
+ this.columns[index].splice(
|
|
|
+ _rowIndex + 1,
|
|
|
+ 0,
|
|
|
+ this.getInput(this.columns[index][_rowIndex - 1]?.style.width)
|
|
|
+ );
|
|
|
});
|
|
|
|
|
|
// }
|
|
|
@@ -488,28 +491,31 @@
|
|
|
this.units = units || {};
|
|
|
},
|
|
|
editInputChange(domObj) {
|
|
|
- console.log(domObj, 'domObj');
|
|
|
let data = JSON.parse(JSON.stringify(domObj));
|
|
|
if (data.equation) {
|
|
|
- this.equation[this.domId] = data.equation;
|
|
|
+ this.equation[data.id] = data.equation;
|
|
|
}
|
|
|
if (data.units) {
|
|
|
- this.units[this.domId] = data.units;
|
|
|
+ this.units[data.id] = data.units;
|
|
|
}
|
|
|
- let dom = document.getElementById(data.id);
|
|
|
+ let parentDom = document.getElementById(this.id);
|
|
|
+ let dom = parentDom.querySelector('#' + data.id);
|
|
|
|
|
|
this.columns.forEach((item, index) => {
|
|
|
let rowsIndex = item.findIndex((cells) => cells.id == this.domId);
|
|
|
+ this.$set(this.columns[index], rowsIndex, data);
|
|
|
+ rowsIndex = item.findIndex((cells) => cells.id == data.id);
|
|
|
|
|
|
- if (rowsIndex >= 0) {
|
|
|
- let width = data.width - dom.parentElement.offsetWidth;
|
|
|
- let newWidth = this.columns[index][rowsIndex].style.width + width;
|
|
|
- this.columns[index][0].width = newWidth;
|
|
|
- this.$set(this.columns[index], rowsIndex, data);
|
|
|
- item.forEach((cell, _index) => {
|
|
|
- this.$set(this.columns[index][_index].style, 'width', newWidth);
|
|
|
- this.$set(this.columns[index][_index], 'width', newWidth);
|
|
|
- });
|
|
|
+ if (dom) {
|
|
|
+ if (rowsIndex >= 0) {
|
|
|
+ let width = data.width - dom.parentElement.offsetWidth;
|
|
|
+ let newWidth = this.columns[index][rowsIndex].style.width + width;
|
|
|
+ this.columns[index][0].width = newWidth;
|
|
|
+ item.forEach((cell, _index) => {
|
|
|
+ this.$set(this.columns[index][_index].style, 'width', newWidth);
|
|
|
+ this.$set(this.columns[index][_index], 'width', newWidth);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
@@ -534,7 +540,8 @@
|
|
|
if (!this.edit) {
|
|
|
return;
|
|
|
}
|
|
|
- let dom = document.getElementById(item.id);
|
|
|
+ let parentDom = document.getElementById(this.id);
|
|
|
+ let dom = parentDom.querySelector('#' + item.id);
|
|
|
|
|
|
this.domId = item.id;
|
|
|
this.$emit('editShow', {
|