Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/components/tables/tables.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ export default {
edittingCellId: '',
edittingText: '',
searchValue: '',
searchKey: ''
searchKey: '',
isEdittingTextChange: false
}
},
methods: {
Expand All @@ -164,20 +165,29 @@ export default {
on: {
'input': val => {
this.edittingText = val
this.isEdittingTextChange = true
},
'on-start-edit': (params) => {
this.edittingCellId = `editting-${params.index}-${params.column.key}`
this.$emit('on-start-edit', params)
this.isEdittingTextChange = false
},
'on-cancel-edit': (params) => {
this.edittingCellId = ''
this.$emit('on-cancel-edit', params)
this.isEdittingTextChange = false
},
'on-save-edit': (params) => {
if (!this.isEdittingTextChange) {
this.edittingCellId = ''
this.isEdittingTextChange = false
return
}
this.value[params.row.initRowIndex][params.column.key] = this.edittingText
this.$emit('input', this.value)
this.$emit('on-save-edit', Object.assign(params, { value: this.edittingText }))
this.edittingCellId = ''
this.edittingText = ''
}
}
})
Expand Down