From 295b93984fd94a11d0337637f76ff91b5a618215 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 24 四月 2023 09:49:26 +0800 Subject: [PATCH] 2023-04-24 --- src/views/tabledesign/index.jsx | 71 ++++++++++++++++++++++++++--------- 1 files changed, 53 insertions(+), 18 deletions(-) diff --git a/src/views/tabledesign/index.jsx b/src/views/tabledesign/index.jsx index b68db34..18311e8 100644 --- a/src/views/tabledesign/index.jsx +++ b/src/views/tabledesign/index.jsx @@ -386,6 +386,20 @@ style: { backgroundColor: '#ffffff', paddingTop: '16px', paddingBottom: '80px', paddingLeft: '16px', paddingRight: '16px'}, } } else { + if (config.Template === 'CommonTable' && !config.components) { + let urlparam = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param))) + urlparam.type = 'CommonTable' + if (urlparam.PageParam) { + urlparam.PageParam.Template = 'CommonTable' + } + urlparam = window.btoa(window.encodeURIComponent(JSON.stringify(urlparam))) + + let url = `#/basedesign/${urlparam}` + + window.history.replaceState(null, null, window.location.href.split('#')[0] + url) + window.location.reload() + return + } config.uuid = MenuId config.MenuID = MenuId config.Template = 'BaseTable' @@ -504,8 +518,14 @@ }) setTimeout(() => { - if (config.enabled && this.verifyConfig()) { + let _pass = this.verifyConfig(config) + + if (config.enabled && !_pass) { config.enabled = false + config.force = true + } else if (!config.enabled && config.force && _pass) { + config.enabled = true + delete config.force } let tbs = [] @@ -581,14 +601,11 @@ new Promise(resolve => { Api.getSystemConfig(param).then(res => { resolve(res) - }) + }, this.netError) }).then(res => { if (!res || !res.status) return res - let ori = this.state.oriConfig - if (config.MenuName !== ori.MenuName || config.MenuNo !== ori.MenuNo || config.parentId !== ori.parentId) { - localStorage.setItem('menuUpdate', new Date().getTime()) - } + localStorage.setItem('menuUpdate', new Date().getTime() + ',' + config.uuid) config.open_edition = res.open_edition || '' this.setState({ @@ -618,8 +635,21 @@ duration: 5 }) } - }) + }, this.netError) }, 300 + (+sessionStorage.getItem('mkDelay'))) + } + + netError = (error) => { + this.setState({ + menuloading: false + }) + if (!error) { + notification.warning({ + top: 92, + message: '淇濆瓨澶辫触锛岃妫�鏌ョ綉缁滄槸鍚︽甯搞��', + duration: 5 + }) + } } getRoleFields = () => { @@ -657,17 +687,22 @@ onEnabledChange = () => { const { config } = this.state - if (!config || (!config.enabled && this.verifyConfig(true))) { - return - } + let _config = {...config, enabled: !config.enabled} - this.setState({ - config: {...config, enabled: !config.enabled} - }) + delete _config.force + + if (!_config.enabled) { + this.setState({ + config: _config + }) + } else if (this.verifyConfig(_config)) { + this.setState({ + config: _config + }) + } } - verifyConfig = (show) => { - const { config } = this.state + verifyConfig = (config) => { let error = '' config.components.forEach(item => { @@ -701,7 +736,7 @@ } } - if (show && error) { + if (config.enabled && error) { notification.warning({ top: 92, message: error, @@ -709,7 +744,7 @@ }) } - return error + return error === '' } // 鏇存柊閰嶇疆淇℃伅 @@ -819,7 +854,7 @@ <TableNodes config={config} /> <ReplaceField type="custom" config={config} updateConfig={this.resetConfig}/> <PasteBaseTable type="page" insert={this.insert}/> - <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config && config.enabled} onChange={this.onEnabledChange} /> + {config ? <Switch className="big" checkedChildren="鍚�" unCheckedChildren="鍋�" checked={config.enabled} onChange={this.onEnabledChange} /> : null} <Button type="primary" id="save-config" onClick={this.submitConfig} loading={menuloading}>淇濆瓨</Button> <Button type="default" onClick={this.closeView}>鍏抽棴</Button> </div> -- Gitblit v1.8.0