diff --git a/src/components/reportTemplate/ReportTemplate.vue b/src/components/reportTemplate/ReportTemplate.vue
index 467f829..5add44d 100644
--- a/src/components/reportTemplate/ReportTemplate.vue
+++ b/src/components/reportTemplate/ReportTemplate.vue
@@ -3,14 +3,13 @@
@@ -97,6 +88,7 @@ let cellId = 9025;
const initialInputColspan = 0;
const initialInputHeight = 30;
let undoRodoPointer = -1;
+let undoOrRedo = false;
export default Vue.extend({
components: { reportCell },
data() {
@@ -133,10 +125,18 @@ export default Vue.extend({
}
if (
+ undoOrRedo === false &&
this.recordHistory[this.recordHistory.length - 1] !==
- JSON.stringify(this.infos)
+ JSON.stringify(this.infos)
) {
this.recordHistory.push(JSON.stringify(this.infos));
+
+ // console.log(
+ // 'computed 长度',
+ // this.recordHistory,
+ // '长度',
+ // this.recordHistory.length,
+ // );
}
return this.infos;
@@ -165,7 +165,7 @@ export default Vue.extend({
for (const index in this.infos) {
if (this.selectedRow === this.infos[index].rowId) {
this.infos.splice(Number(index), 0, {
- rowId: (this.selectedRow += 0.1),
+ rowId: (this.selectedRow += 1),
cells: [],
});
this.selectedRow = 0;
@@ -222,16 +222,25 @@ export default Vue.extend({
if (undoRodoPointer < 0) {
undoRodoPointer = this.recordHistory.length - 1;
}
+ // console.log('总长度', this.recordHistory.length, '指针', undoRodoPointer);
+ // 赋值不成功
this.infos = JSON.parse(this.recordHistory[undoRodoPointer - 1]);
- undoRodoPointer -= 1;
+
+ console.log(JSON.parse(this.recordHistory[undoRodoPointer - 1]));
+
+ console.log(this.infos);
+
+ undoOrRedo = true;
},
redoHandler() {
if (undoRodoPointer < 0) {
undoRodoPointer = this.recordHistory.length - 1;
}
- this.infos = JSON.parse(this.recordHistory[undoRodoPointer + 1]);
- undoRodoPointer += 1;
+ // console.log('总长度', this.recordHistory.length, '指针', undoRodoPointer);
+
+ this.infos = JSON.parse(this.recordHistory[(undoRodoPointer += 1)]);
+ undoOrRedo = true;
},
importData() {
for (const row of this.infos) {