fix(editReportingData): 修复删除报关数据行后重新添加的问题
- 修复删除最后一行报关数据后重新添加时,序号计算错误的问题 -增加判断,避免删除第一行数据时出现错误
Showing
1 changed file
with
4 additions
and
1 deletions
| ... | @@ -870,7 +870,8 @@ | ... | @@ -870,7 +870,8 @@ |
| 870 | this.$router.go(-1); | 870 | this.$router.go(-1); |
| 871 | }, | 871 | }, |
| 872 | addNewItem() { | 872 | addNewItem() { |
| 873 | - let orderNum = this.detailData.at(-1).gnum + 1 | 873 | + console.log(this.detailData.at(-1)) |
| 874 | + let orderNum = this.detailData.at(-1) === undefined ? 1 : this.detailData.at(-1).gnum + 1 | ||
| 874 | this.detailData.push({ | 875 | this.detailData.push({ |
| 875 | "gnum":orderNum, | 876 | "gnum":orderNum, |
| 876 | "accountBookMaterialNumber": "", | 877 | "accountBookMaterialNumber": "", |
| ... | @@ -943,7 +944,9 @@ | ... | @@ -943,7 +944,9 @@ |
| 943 | }, | 944 | }, |
| 944 | cancelEditRowData(index){ | 945 | cancelEditRowData(index){ |
| 945 | this.expandRowKeys = [] | 946 | this.expandRowKeys = [] |
| 947 | + if(index!==0){ | ||
| 946 | this.detailData.splice(index) | 948 | this.detailData.splice(index) |
| 949 | + } | ||
| 947 | }, | 950 | }, |
| 948 | 951 | ||
| 949 | //提交更新数据 | 952 | //提交更新数据 | ... | ... |
-
Please register or login to post a comment