Commit 81cceb58 authored by afc163's avatar afc163

Fix Editable Table, close #68

parent e9bfdedf
...@@ -89,11 +89,12 @@ export default class TableForm extends PureComponent { ...@@ -89,11 +89,12 @@ export default class TableForm extends PureComponent {
return; return;
} }
const target = this.getRowByKey(key); const target = this.getRowByKey(key);
delete target.isNew;
if (!target.workId || !target.name || !target.department) { if (!target.workId || !target.name || !target.department) {
message.error('请填写完整成员信息。'); message.error('请填写完整成员信息。');
e.target.focus();
return; return;
} }
delete target.isNew;
this.toggleEditable(e, key); this.toggleEditable(e, key);
this.props.onChange(this.state.data); this.props.onChange(this.state.data);
}, 10); }, 10);
...@@ -176,15 +177,17 @@ export default class TableForm extends PureComponent { ...@@ -176,15 +177,17 @@ export default class TableForm extends PureComponent {
if (record.isNew) { if (record.isNew) {
return ( return (
<span> <span>
<a onClick={e => this.saveRow(e, record.key)}>保存</a> <a>保存</a>
<Divider type="vertical" /> <Divider type="vertical" />
<a onClick={e => this.remove(e, record.key)}>删除</a> <Popconfirm title="是否要删除此行?" onConfirm={() => this.remove(record.key)}>
<a>删除</a>
</Popconfirm>
</span> </span>
); );
} }
return ( return (
<span> <span>
<a onClick={e => this.saveRow(e, record.key)}>保存</a> <a>保存</a>
<Divider type="vertical" /> <Divider type="vertical" />
<a onClick={e => this.cancel(e, record.key)}>取消</a> <a onClick={e => this.cancel(e, record.key)}>取消</a>
</span> </span>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment