From 5b75a82df7876f7c2c3e1f9da48752e2b2008ff8 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期一, 20 三月 2023 15:41:41 +0800 Subject: [PATCH] 2023-03-20 --- src/views/menudesign/index.jsx | 70 +++++++++++++++++++++++++++++------ 1 files changed, 58 insertions(+), 12 deletions(-) diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index 56b75f7..e816b50 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -37,6 +37,7 @@ const PasteController = asyncComponent(() => import('@/menu/pastecontroller')) const StyleController = asyncComponent(() => import('@/menu/stylecontroller')) const ReplaceField = asyncComponent(() => import('@/menu/replaceField')) +const NormalCss = asyncComponent(() => import('@/menu/normalCss')) const Versions = asyncComponent(() => import('@/menu/versions')) const TableNodes = asyncComponent(() => import('@/menu/tablenodes')) const SysInterface = asyncComponent(() => import('@/menu/sysinterface')) @@ -757,6 +758,35 @@ return true } + resetSyncQuery = (components) => { + return components.map(item => { + if (item.type === 'tabs') { + item.subtabs.forEach(tab => { + tab.components = this.resetSyncQuery(tab.components) + }) + } else if (item.type === 'group') { + item.components = this.resetSyncQuery(item.components) + } else if (item.setting && item.setting.interType === 'system' && item.setting.sync === 'true') { + let sql = '' + if (item.setting.execute !== 'false' && item.setting.dataresource) { + sql = item.setting.dataresource + } + + item.scripts && item.scripts.forEach(script => { + if (script.status === 'false') return + + sql += script.sql + }) + + if (sql.length > 8000) { + item.setting.sync = 'false' + } + } + + return item + }) + } + submitConfig = () => { const { MenuType } = this.state let config = fromJS(this.state.config).toJS() @@ -777,6 +807,10 @@ setTimeout(() => { if (config.enabled && this.verifyConfig()) { config.enabled = false + } + + if (config.cacheUseful !== 'true') { + config.components = this.resetSyncQuery(config.components) } let tbs = [] @@ -847,7 +881,6 @@ btnParam.LText = Utils.formatOptions(btnParam.LText) btnParam.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') btnParam.secretkey = Utils.encrypt(btnParam.LText, btnParam.timestamp) - new Promise(resolve => { if (MenuType === 'billPrint') { // 鎵撳嵃鐢熸垚椤甸潰鏁堟灉鍥� @@ -876,7 +909,7 @@ } else { resolve(result) } - }) + }, this.netError) }) } else { resolve({status: true}) @@ -889,10 +922,7 @@ if (!res || !res.status) return res if (MenuType !== 'billPrint') { // 鍩烘湰淇℃伅鏀瑰彉鏃讹紝閫氱煡鑿滃崟鍒楄〃鏇存柊 - 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({ @@ -912,7 +942,7 @@ } return Api.getSystemConfig(_param) } - }).then(res => { // 椤甸潰鎸夐挳鍏崇郴淇濆瓨 + }, this.netError).then(res => { // 椤甸潰鎸夐挳鍏崇郴淇濆瓨 if (!res || !res.status) return res this.setState({ @@ -926,7 +956,7 @@ status: true } } - }).then(res => { + }, this.netError).then(res => { this.setState({ menuloading: false }) @@ -947,8 +977,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 = () => { @@ -1041,12 +1084,14 @@ carousel: '杞挱', tree: '鏍戝舰鍒楄〃', chart: '鑷畾涔夊浘琛�', - editor: '瀵屾枃鏈�', - group: '鍒嗙粍' + // editor: '瀵屾枃鏈�', + group: '鍒嗙粍', + iframe: 'iframe' } let subforbid = { editable: '鍙紪杈戣〃鏍�', - voucher: '鍑瘉' + voucher: '鍑瘉', + account: '璐﹀' } config.components.forEach(item => { @@ -1153,6 +1198,7 @@ {/* 琛ㄥ悕娣诲姞 */} {config ? <TableComponent config={config} updatetable={this.updateConfig}/> : null} {config ? <Paragraph style={{padding: '15px 0px 0px 18px'}} copyable={{ text: MenuId }}>鑿滃崟ID</Paragraph> : null} + {config ? <NormalCss config={config} updateConfig={this.updateConfig}/> : null} </Panel> {/* 缁勪欢娣诲姞 */} <Panel header="缁勪欢" key="component"> -- Gitblit v1.8.0