From 81cceb58070894df40665544106f820409b6867c Mon Sep 17 00:00:00 2001 From: afc163 Date: Wed, 1 Nov 2017 22:28:34 +0800 Subject: [PATCH] Fix Editable Table, close #68 --- src/routes/Forms/TableForm.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/routes/Forms/TableForm.js b/src/routes/Forms/TableForm.js index 28a758d2..44f91339 100644 --- a/src/routes/Forms/TableForm.js +++ b/src/routes/Forms/TableForm.js @@ -89,11 +89,12 @@ export default class TableForm extends PureComponent { return; } const target = this.getRowByKey(key); - delete target.isNew; if (!target.workId || !target.name || !target.department) { message.error('请填写完整成员信息。'); + e.target.focus(); return; } + delete target.isNew; this.toggleEditable(e, key); this.props.onChange(this.state.data); }, 10); @@ -176,15 +177,17 @@ export default class TableForm extends PureComponent { if (record.isNew) { return ( - this.saveRow(e, record.key)}>保存 + 保存 - this.remove(e, record.key)}>删除 + this.remove(record.key)}> + 删除 + ); } return ( - this.saveRow(e, record.key)}>保存 + 保存 this.cancel(e, record.key)}>取消 -- GitLab