Commit 4ae39c53b49532fc6c31086a31e30429d2e236ed
1 parent
fa64fc8a
fix(table): treeTable editable error
修复树表格的编辑问题 fixed: #811
Showing
1 changed file
with
5 additions
and
2 deletions
src/components/Table/src/components/editable/EditableCell.vue
@@ -44,6 +44,7 @@ | @@ -44,6 +44,7 @@ | ||
44 | import { propTypes } from '/@/utils/propTypes'; | 44 | import { propTypes } from '/@/utils/propTypes'; |
45 | import { isString, isBoolean, isFunction, isNumber, isArray } from '/@/utils/is'; | 45 | import { isString, isBoolean, isFunction, isNumber, isArray } from '/@/utils/is'; |
46 | import { createPlaceholderMessage } from './helper'; | 46 | import { createPlaceholderMessage } from './helper'; |
47 | + import { set } from 'lodash-es'; | ||
47 | 48 | ||
48 | export default defineComponent({ | 49 | export default defineComponent({ |
49 | name: 'EditableCell', | 50 | name: 'EditableCell', |
@@ -227,14 +228,16 @@ | @@ -227,14 +228,16 @@ | ||
227 | if (!isPass) return false; | 228 | if (!isPass) return false; |
228 | } | 229 | } |
229 | 230 | ||
230 | - const { column, index } = props; | 231 | + const { column, index, record } = props; |
232 | + if (!record) return false; | ||
231 | const { key, dataIndex } = column; | 233 | const { key, dataIndex } = column; |
232 | const value = unref(currentValueRef); | 234 | const value = unref(currentValueRef); |
233 | if (!key || !dataIndex) return; | 235 | if (!key || !dataIndex) return; |
234 | 236 | ||
235 | const dataKey = (dataIndex || key) as string; | 237 | const dataKey = (dataIndex || key) as string; |
236 | 238 | ||
237 | - const record = await table.updateTableData(index, dataKey, value); | 239 | + set(record, dataKey, value); |
240 | + //const record = await table.updateTableData(index, dataKey, value); | ||
238 | needEmit && table.emit?.('edit-end', { record, index, key, value }); | 241 | needEmit && table.emit?.('edit-end', { record, index, key, value }); |
239 | isEdit.value = false; | 242 | isEdit.value = false; |
240 | } | 243 | } |