From 0c86e5e2eaf907dfcb63aea13e6efac3ccc52cce Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 25 二月 2020 11:06:20 +0800 Subject: [PATCH] 2020-02-25 --- src/templates/modalconfig/index.jsx | 31 ++++++++++++++++++++++++++++++- 1 files changed, 30 insertions(+), 1 deletions(-) diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index f290ca9..716b5bc 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -971,6 +971,35 @@ }) } + editModalCancel = () => { + const { config, card } = this.state + + if (card.focus) { + let _config = null + if (config.groups.length > 0) { + let _groups = config.groups.map(group => { + group.sublist = group.sublist.filter(item => item.uuid !== card.uuid) + return group + }) + _config = {...config, groups: _groups} + } else { + let _fields = config.fields.filter(item => item.uuid !== card.uuid) + _config = {...config, fields: _fields} + } + + this.setState({ + card: null, + config: _config, + visible: false + }) + } else { + this.setState({ + card: null, + visible: false + }) + } + } + render () { const { config } = this.state @@ -1098,7 +1127,7 @@ title={this.state.dict['header.edit']} visible={this.state.visible} width={700} - onCancel={() => { this.setState({ visible: false }) }} + onCancel={this.editModalCancel} onOk={this.handleSubmit} destroyOnClose > -- Gitblit v1.8.0