fix 前端表格增删逻辑调整

This commit is contained in:
赵霄
2024-01-17 10:41:01 +08:00
parent c7e70e5e55
commit 07062c446e
2 changed files with 3 additions and 3 deletions
@@ -158,7 +158,7 @@ export default {
this.selectedRowKeys = selectedRowKeys this.selectedRowKeys = selectedRowKeys
}, },
formModalOk (lineData) { formModalOk (lineData) {
lineData.tableRowKey = this.realDataSource.length lineData.tableRowKey = this.realDataSource && this.realDataSource.length > 0 ? this.realDataSource[this.realDataSource.length - 1].tableRowKey + 1 : 0
this.realDataSource.push(lineData) this.realDataSource.push(lineData)
this.$emit('ok', this.realDataSource) this.$emit('ok', this.realDataSource)
}, },
@@ -190,7 +190,7 @@ export default {
* 校验文件是否上传 * 校验文件是否上传
* @returns {boolean} * @returns {boolean}
*/ */
validateTableData() { validateTableData () {
if (this.realDataSource.some(tt => !tt.meetingData)) { if (this.realDataSource.some(tt => !tt.meetingData)) {
this.$message.warning(this.$t('businessSupport.standardizationActivity.pleaseUploadMeeting')) this.$message.warning(this.$t('businessSupport.standardizationActivity.pleaseUploadMeeting'))
return false return false
@@ -191,7 +191,7 @@ export default {
return dictItem return dictItem
}) })
} }
item.tableRowKey = this.dataSource.length item.tableRowKey = this.dataSource && this.dataSource.length > 0 ? this.dataSource[this.dataSource.length - 1].tableRowKey + 1 : 0
this.dataSource.push(item) this.dataSource.push(item)
}) })
console.log(this.dataSource) console.log(this.dataSource)