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/subtableconfig/index.jsx | 85 ++++++++++++++++++++---------------------- 1 files changed, 40 insertions(+), 45 deletions(-) diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx index 7877567..f9863eb 100644 --- a/src/templates/subtableconfig/index.jsx +++ b/src/templates/subtableconfig/index.jsx @@ -34,9 +34,9 @@ class SubTableConfig extends Component { static propTpyes = { - config: PropTypes.object, menu: PropTypes.any, - handleConfig: PropTypes.func, + editTab: PropTypes.any, + config: PropTypes.any, handleSubConfig: PropTypes.func, supMenuList: PropTypes.array } @@ -78,25 +78,24 @@ * 2銆佽缃搷浣滅被鍨嬨�佸師濮嬭彍鍗曚俊鎭紙姣忔淇濆瓨鍚庨噸缃級銆佸凡浣跨敤琛ㄥ強鍩烘湰淇℃伅琛ㄥ崟 */ UNSAFE_componentWillMount () { - const { config } = this.props + const { config, editTab } = this.props let _config = null - if (!config || config.create) { + if (!config) { _config = JSON.parse(JSON.stringify(Source.baseConfig)) - if (config.uuid) { - _config.uuid = config.uuid - _config.tabName = config.label - } + _config.uuid = editTab.linkTab + _config.tabName = editTab.label + _config.isAdd = true } else { _config = JSON.parse(JSON.stringify(config)) } let _oriActions = [] + if (_config.type === 'user') { _config.action = _config.action.map(item => { let uuid = Utils.getuuid() - if (item.OpenType === 'pop') { // 鍚湁瀛愰厤缃」鐨勬寜閽� _oriActions.push({ prebtn: JSON.parse(JSON.stringify(item)), @@ -106,7 +105,6 @@ } item.uuid = uuid - return item }) } @@ -267,6 +265,20 @@ this.setState = (state, callback) => { return } + } + + // 椤甸潰杩斿洖 + handleViewBack = () => { + const {menu} = this.props + let param = { + editMenu: menu, + editTab: '', + editAction: '', + subConfig: '', + tabview: menu ? menu.LongParam.Template : '' + } + + this.props.handleView(param) } /** @@ -1081,27 +1093,25 @@ }) } - // changeTemplate = () => { - // this.props.handleConfig('template') - // } - /** * @description 鏍囩椤典繚瀛� */ submitConfig = () => { - const { delActions } = this.state + const { delActions, originConfig } = this.state let config = JSON.parse(JSON.stringify(this.state.config)) this.menuformRef.handleConfirm().then(res => { - if (config.search[0] && config.search[0].origin) { - config.search = config.search.filter(item => !item.origin) - } - if (config.action[0] && config.action[0].origin) { - config.action = config.action.filter(item => !item.origin) - } - if (config.columns[0] && config.columns[0].origin) { - config.columns = config.columns.filter(item => !item.origin) + if (originConfig.isAdd) { + if (config.search[0] && config.search[0].origin) { + config.search = config.search.filter(item => !item.origin) + } + if (config.action[0] && config.action[0].origin) { + config.action = config.action.filter(item => !item.origin) + } + if (config.columns[0] && config.columns[0].origin) { + config.columns = config.columns.filter(item => !item.origin) + } } let _LongParam = '' @@ -1109,6 +1119,7 @@ // 淇濆瓨鏃跺垹闄ら厤缃被鍨嬶紝system 銆乽ser delete _config.type + delete _config.isAdd try { _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) @@ -1123,6 +1134,7 @@ let btnParam = { func: 'sPC_Button_AddUpt', + Type: 40, ParentID: _config.uuid, MenuNo: res.tabNo, Template: 'SubTable', @@ -1323,8 +1335,7 @@ duration: 2 }) if (this.state.closeVisible) { - let view = this.props.menu ? this.props.menu.type : '' - this.props.handleConfig(view) + this.handleViewBack() } else { this.setState({ menuloading: false, @@ -1344,24 +1355,14 @@ const { config, originConfig } = this.state let _this = this - let isAdd = false - if ( - (config.search[0] && config.search[0].origin) || - (config.action[0] && config.action[0].origin) || - (config.columns[0] && config.columns[0].origin) - ) { - isAdd = true - } - - if (isAdd) { + if (originConfig.isAdd) { confirm({ content: '鑿滃崟灏氭湭鎻愪氦锛岀‘瀹氭斁寮冧繚瀛樺悧锛�', okText: this.state.dict['header.confirm'], cancelText: this.state.dict['header.cancel'], onOk() { - let view = _this.props.menu ? _this.props.menu.type : '' - _this.props.handleConfig(view) + _this.handleViewBack() }, onCancel() {} }) @@ -1374,8 +1375,7 @@ closeVisible: true }) } else { - let view = this.props.menu ? this.props.menu.type : '' - this.props.handleConfig(view) + this.handleViewBack() } }, () => { this.setState({ @@ -1781,11 +1781,6 @@ }) } - dontsave = () => { - let view = this.props.menu ? this.props.menu.type : '' - this.props.handleConfig(view) - } - render () { const { modaltype } = this.state const configAction = this.state.config.action.filter(_action => @@ -2105,7 +2100,7 @@ onCancel={() => { this.setState({closeVisible: false}) }} footer={[ <Button key="save" className="mk-btn mk-green" loading={this.state.menucloseloading} onClick={this.submitConfig}>{this.state.dict['header.save']}</Button>, - <Button key="confirm" className="mk-btn mk-yellow" onClick={this.dontsave}>{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