From c54724b0590729c677057736bd2d04715dc0c3fb Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 22 一月 2020 14:43:24 +0800 Subject: [PATCH] 2020-01-22 --- src/templates/modalconfig/index.jsx | 38 ++++++++++++++++++++++++++------------ 1 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index 56e6cd4..c31c27e 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -28,9 +28,9 @@ static propTpyes = { menu: PropTypes.any, editTab: PropTypes.any, - btnParam: PropTypes.object, + subConfig: PropTypes.any, editAction: PropTypes.object, - handleConfig: PropTypes.func + handleView: PropTypes.func } state = { @@ -64,10 +64,10 @@ * 4銆佽缃寜閽熀鏈俊鎭� */ UNSAFE_componentWillMount () { - const {menu, editAction, editTab, btnParam} = this.props + const {menu, editAction, editTab, subConfig} = this.props let _config = '' - let _menu = { + let _menu = { // 涓婄骇鑿滃崟鏄笁绾ц彍鍗曟垨鏍囩椤� type: editTab ? editTab.Template : menu.type, tables: editTab ? editTab.tables : menu.LongParam.tables, MenuID: editTab ? editTab.uuid : menu.MenuID, @@ -75,8 +75,8 @@ MenuName: editTab ? editTab.tabName : menu.MenuName } - if (btnParam) { - _config = btnParam + if (subConfig) { + _config = subConfig } else { _config = JSON.parse(JSON.stringify((Source.baseConfig))) } @@ -208,9 +208,23 @@ * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 */ componentWillUnmount () { - this.setState = (state, callback) => { + this.setState = () => { return } + } + + // 椤甸潰杩斿洖 + handleViewBack = () => { + const {menu, editTab} = this.props + let param = { + editMenu: menu, + editTab: editTab, + editAction: '', + subConfig: '', + tabview: editTab ? editTab.Template : menu.LongParam.Template + } + + this.props.handleView(param) } /** @@ -733,7 +747,7 @@ } cancelConfig = () => { - const { menu, config, originConfig } = this.state + const { config, originConfig } = this.state let _this = this let isOrigin = config.fields.filter(item => item.origin).length > 0 @@ -743,7 +757,7 @@ okText: this.state.dict['header.confirm'], cancelText: this.state.dict['header.cancel'], onOk() { - _this.props.handleConfig(menu.type) + _this.handleViewBack() }, onCancel() {} }) @@ -754,7 +768,7 @@ closeVisible: true }) } else { - this.props.handleConfig(menu.type) + this.handleViewBack() } } } @@ -1138,7 +1152,7 @@ } render () { - const { menu, config } = this.state + const { config } = this.state return ( <div className="modal-form-board"> @@ -1313,7 +1327,7 @@ onCancel={() => { this.setState({closeVisible: false}) }} footer={[ <Button key="save" className="mk-btn mk-green" loading={this.state.closeloading} onClick={this.submitConfig}>{this.state.dict['header.save']}</Button>, - <Button key="confirm" className="mk-btn mk-yellow" onClick={() => {this.props.handleConfig(menu.type)}}>{this.state.dict['header.notsave']}</Button>, + <Button key="confirm" className="mk-btn mk-yellow" onClick={this.handleViewBack}>{this.state.dict['header.notsave']}</Button>, <Button key="cancel" onClick={() => { this.setState({closeVisible: false}) }}>{this.state.dict['header.cancel']}</Button> ]} destroyOnClose -- Gitblit v1.8.0