From cc87fc060c30597ec2efe38d0c3efe62f4957fd5 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 14 七月 2023 11:20:02 +0800 Subject: [PATCH] 2023-07-14 --- src/tabviews/basetable/index.jsx | 144 +++++++++++++++++++++++++++++++++++------------- 1 files changed, 105 insertions(+), 39 deletions(-) diff --git a/src/tabviews/basetable/index.jsx b/src/tabviews/basetable/index.jsx index 7965a78..ccc4b1c 100644 --- a/src/tabviews/basetable/index.jsx +++ b/src/tabviews/basetable/index.jsx @@ -25,7 +25,6 @@ param: PropTypes.any, // 鍏朵粬椤甸潰浼犻�掔殑鍙傛暟 Tab: PropTypes.string, // 寮圭獥鏍囩 MenuID: PropTypes.string, // 鑿滃崟Id - MenuNo: PropTypes.string, // 鑿滃崟鍙傛暟 MenuName: PropTypes.string, // 鑿滃崟鍚嶇О changeTemp: PropTypes.func } @@ -51,12 +50,17 @@ * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 */ async loadconfig () { - const { MenuID } = this.props + const { MenuID, MenuName } = this.props let _param = { func: 'sPC_Get_LongParam', MenuID: MenuID } + + if (window.GLOB.mkHS) { + _param.appkey = '20191106103859640976D6E924E464D029CF0' + } + let result = await Api.getCacheConfig(_param) if (result.status) { @@ -67,6 +71,8 @@ config = window.decodeURIComponent(window.atob(result.LongParam)) config = config.replace(/@mywebsite@\//ig, window.GLOB.baseurl) config = JSON.parse(config) + config.MenuID = MenuID + config.MenuName = MenuName || config.MenuName } catch (e) { console.warn('Parse Failure') config = '' @@ -156,7 +162,7 @@ }) } - config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, skip, param, MenuID) + config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, skip, param, MenuID, config.MenuName) let autoMatic = null if (config.autoMatic && config.autoMatic.enable === 'true') { @@ -191,7 +197,7 @@ let BID = param.$BID || '' - config.components = this.formatSetting(config.components, mainSearch, regs) + config.components = this.formatSetting(config.components, regs) this.setState({ BID: BID, @@ -263,11 +269,11 @@ } } - filterComponent = (components, roleId, permAction, skip, urlparam, pageId) => { + filterComponent = (components, roleId, permAction, skip, urlparam, pageId, MenuName) => { return components.filter(item => { item.$pageId = pageId - item.$menuname = (this.props.MenuName || '') + '-' + (item.name || '涓昏〃') + item.$menuname = (MenuName || '') + '-' + (item.name || '涓昏〃') if (item.type === 'tabs') { item.subtabs = item.subtabs.filter(tab => { @@ -286,13 +292,13 @@ if (tab.permission !== 'true') { // 鏉冮檺鏈紑鍚笉鍋氭潈闄愭帶鍒� skip = true } - tab.components = this.filterComponent(tab.components, roleId, permAction, skip, urlparam, pageId) + tab.components = this.filterComponent(tab.components, roleId, permAction, skip, urlparam, pageId, MenuName) return tab }) return true } else { - item.name = (this.props.MenuName || '') + item.name = (MenuName || '') } // 鎼滅储鏉′欢鍒濆鍖� @@ -316,6 +322,8 @@ return false } else if (col.Hide === 'true') { return false + } else if (col.type === 'action') { + col.type = 'custom' } if (col.type === 'number') { @@ -334,8 +342,58 @@ return false } } else if (col.type === 'custom') { - col.elements = col.elements.map(cell => { - if (['text', 'number', 'formula'].includes(cell.eleType)) { + col.elements = col.elements.filter(cell => { + if (cell.eleType === 'button') { + if (cell.hidden === 'true') return false + + cell.logLabel = item.$menuname + '-' + cell.label + cell.Ot = cell.Ot || 'requiredSgl' + cell.ContainerId = this.state.ContainerId + cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' + cell.$menuId = item.uuid + cell.$MenuID = this.props.MenuID + cell.$view = 'popview' + + if (cell.syncComponentId) { + if (cell.syncComponentId === item.setting.supModule) { + cell.syncComponentId = '' + if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { + cell.execSuccess = 'mainline' + } + } else if (cell.syncComponentId === 'multiComponent') { + let ids = cell.syncComponents.map(m => { + return m.syncComId.pop() || '' + }) + + if (item.setting.supModule && ids.includes(item.setting.supModule)) { + if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { + cell.execSuccess = 'mainline' + } + ids = ids.filter(id => id !== item.setting.supModule) + } + + if (ids.length === 0) { + cell.syncComponentId = '' + } else { + cell.syncComponentIds = ids + } + } + } + + if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃� + cell = this.getPrinter(cell, item.uuid) + } + + if (cell.controlField) { + if (/,/ig.test(cell.controlVal)) { + cell.controlVals = cell.controlVal.split(',') + } else { + cell.controlVals = [(cell.controlVal || '')] + } + } + + return skip || permAction[cell.uuid] + } else if (['text', 'number', 'formula'].includes(cell.eleType)) { if (!cell.height) { cell.innerHeight = 'auto' } @@ -346,8 +404,12 @@ } } } - return cell + return true }) + + if (col.elements.length === 0) { + return false + } } if (col.linkmenu && col.linkmenu.length > 0) { @@ -377,43 +439,47 @@ cell.$view = 'popview' cell.$toolbtn = true - if (cell.syncComponentId === item.setting.supModule) { - cell.syncComponentId = '' + if (cell.syncComponentId) { + if (cell.syncComponentId === item.setting.supModule) { + cell.syncComponentId = '' + if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { + cell.execSuccess = 'mainline' + } + } else if (cell.syncComponentId === 'multiComponent') { + let ids = cell.syncComponents.map(m => { + return m.syncComId.pop() || '' + }) + + if (item.setting.supModule && ids.includes(item.setting.supModule)) { + if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { + cell.execSuccess = 'mainline' + } + ids = ids.filter(id => id !== item.setting.supModule) + } + + if (ids.length === 0) { + cell.syncComponentId = '' + } else { + cell.syncComponentIds = ids + } + } } if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃� cell = this.getPrinter(cell, item.uuid) + } + + if (cell.controlField) { + if (/,/ig.test(cell.controlVal)) { + cell.controlVals = cell.controlVal.split(',') + } else { + cell.controlVals = [(cell.controlVal || '')] + } } return skip || permAction[cell.uuid] }) } - - item.cols = item.cols.filter(col => { - if (col.type !== 'action') return true - col.elements = col.elements.filter(cell => { - if (cell.hidden === 'true') return false - - cell.logLabel = item.$menuname + '-' + cell.label - cell.Ot = cell.Ot || 'requiredSgl' - cell.ContainerId = this.state.ContainerId - cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' - cell.$menuId = item.uuid - cell.$MenuID = this.props.MenuID - cell.$view = 'popview' - - if (cell.syncComponentId === item.setting.supModule) { - cell.syncComponentId = '' - } - - if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃� - cell = this.getPrinter(cell, item.uuid) - } - - return skip || permAction[cell.uuid] - }) - return col.elements.length !== 0 - }) return true }) -- Gitblit v1.8.0