From 547e5fe219ee7bee309ecd67db74bc8df66b5433 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 23 八月 2023 11:47:45 +0800 Subject: [PATCH] 2023-08-23 --- src/tabviews/custom/index.jsx | 78 ++++++++++++++++++++++++++------------ 1 files changed, 53 insertions(+), 25 deletions(-) diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index c859a83..8cf3efe 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -50,7 +50,6 @@ class CustomPage extends Component { static propTpyes = { param: PropTypes.any, // 鍏朵粬椤甸潰浼犻�掔殑鍙傛暟 - Tab: PropTypes.string, // 寮圭獥鏍囩 MenuID: PropTypes.string, // 鑿滃崟Id MenuName: PropTypes.string, // 鑿滃崟鍚嶇О changeTemp: PropTypes.func @@ -189,19 +188,13 @@ }) } - let popview = 'CustomPage' - - if (config.version === 2.0) { - popview = 'popview' - } - config.$cache = config.cacheLocal === 'true' config.$time = config.localCacheTime || 0 let initInters = [] config.interfaces = this.formatInterSetting(config.interfaces, regs, MenuID, initInters) - config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces, popview, config.$cache, config.$time, config.MenuName, MenuID, MenuID) + config.components = this.filterComponent(config.components, roleId, window.GLOB.mkActions, balMap, skip, param, MenuID, config.interfaces, config.$cache, config.$time, config.MenuName, MenuID, MenuID) let params = [] let BID = param.$BID || '' @@ -278,9 +271,7 @@ this.loadmaindata(params) } - if (!this.props.Tab) { - this.setShortcut() - } + this.setShortcut() }) } else { this.setState({ @@ -334,7 +325,7 @@ } } - filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, time, MenuName, searchId, syncId) => { + filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, searchId, syncId) => { return components.filter(item => { item.$pageId = pageId item.$cache = cache @@ -441,7 +432,7 @@ _searchId = tab.uuid } - tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, time, MenuName, _searchId, tab.uuid) + tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, _searchId, tab.uuid) if (_searchId === tab.uuid) { tab.components.forEach(cell => { @@ -465,7 +456,7 @@ return false } - item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, popview, cache, time, MenuName, searchId, syncId) + item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId, interfaces, cache, time, MenuName, searchId, syncId) return true } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart', 'antvG6', 'antvX6'].includes(item.type)) { @@ -526,7 +517,7 @@ item.action = item.action.filter(cell => { if (cell.hidden === 'true') return false - cell = this.resetButton(item, cell, popview) + cell = this.resetButton(item, cell) cell.$toolbtn = true @@ -574,7 +565,7 @@ if (cell.eleType === 'button') { if (cell.hidden === 'true') return false - cell = this.resetButton(item, cell, popview) + cell = this.resetButton(item, cell) if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃� cell = this.getPrinter(cell, item.uuid) @@ -631,7 +622,7 @@ if (cell.eleType === 'button') { if (cell.hidden === 'true') return false - cell = this.resetButton(item, cell, popview) + cell = this.resetButton(item, cell) if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃� cell = this.getPrinter(cell, item.uuid) @@ -673,7 +664,7 @@ if (cell.eleType === 'button') { if (cell.hidden === 'true') return false - cell = this.resetButton(item, cell, popview) + cell = this.resetButton(item, cell) if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃� cell = this.getPrinter(cell, item.uuid) @@ -697,7 +688,7 @@ if (cell.eleType === 'button') { if (cell.hidden === 'true') return false - cell = this.resetButton(item, cell, popview) + cell = this.resetButton(item, cell) if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃� cell = this.getPrinter(cell, item.uuid) @@ -801,14 +792,14 @@ }) } - resetButton = (item, cell, popview) => { + resetButton = (item, cell) => { 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 + cell.$view = 'popview' if (cell.btnstyle) { // 鍏煎 cell.style = cell.style || {} @@ -820,6 +811,20 @@ cell.controlVals = cell.controlVal.split(',') } else { cell.controlVals = [(cell.controlVal || '')] + } + } + + if (cell.OpenType === 'excelOut') { // 瀵煎嚭 + cell.$menuName = item.name + + if (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0) { + cell.errorType = 'error1' + } else if (cell.intertype === 'system' && cell.verify.dataType !== 'custom') { + if (item.setting.interType !== 'system') { + cell.errorType = 'error2' + } else if (item.type === 'balcony' || item.subtype === 'propcard') { + cell.errorType = 'error2' + } } } @@ -937,6 +942,7 @@ return component } + component.setting.arr_field = component.columns ? component.columns.map(col => col.field).join(',') : '' component.setting.useMSearch = component.setting.useMSearch === 'true' if (component.setting.useMSearch) { if (!window.GLOB.SearchBox.has(component.$searchId)) { @@ -957,9 +963,15 @@ } let _customScript = '' + let _tailScript = '' component.scripts && component.scripts.forEach(script => { - if (script.status !== 'false') { + if (script.status === 'false') return + if (script.position !== 'back') { _customScript += ` + ${script.sql} + ` + } else { + _tailScript += ` ${script.sql} ` } @@ -979,17 +991,21 @@ if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 component.setting.dataresource = component.setting.dataresource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') _customScript = _customScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') + _tailScript = _tailScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') } else { component.setting.dataresource = component.setting.dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') _customScript = _customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') + _tailScript = _tailScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') } regs.forEach(cell => { component.setting.dataresource = component.setting.dataresource.replace(cell.reg, cell.value) _customScript = _customScript.replace(cell.reg, cell.value) + _tailScript = _tailScript.replace(cell.reg, cell.value) }) component.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰 + component.setting.tailScript = _tailScript // 鍚庣疆鑷畾涔夎剼鏈� if (component.setting.laypage) { component.setting.custompage = /@pageSize@/i.test(component.setting.dataresource + component.setting.customScript) @@ -1077,12 +1093,20 @@ inter.setting.onload = 'false' } + inter.setting.arr_field = inter.columns.map(col => col.field).join(',') + if (inter.setting.interType !== 'system') return inter let _customScript = '' + let _tailScript = '' inter.scripts.forEach(script => { - if (script.status !== 'false') { + if (script.status === 'false') return + if (script.position !== 'back') { _customScript += ` + ${script.sql} + ` + } else { + _tailScript += ` ${script.sql} ` } @@ -1103,17 +1127,21 @@ if (sessionStorage.getItem('dataM') === 'true') { // 鏁版嵁鏉冮檺 inter.setting.dataresource = inter.setting.dataresource.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') _customScript = _customScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') + _tailScript = _tailScript.replace(/\$@/ig, '/*').replace(/@\$/ig, '*/').replace(/@datam@/ig, '\'Y\'') } else { inter.setting.dataresource = inter.setting.dataresource.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') _customScript = _customScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') + _tailScript = _tailScript.replace(/@\$|\$@/ig, '').replace(/@datam@/ig, '\'\'') } regs.forEach(cell => { inter.setting.dataresource = inter.setting.dataresource.replace(cell.reg, cell.value) _customScript = _customScript.replace(cell.reg, cell.value) + _tailScript = _tailScript.replace(cell.reg, cell.value) }) inter.setting.customScript = _customScript // 鏁寸悊鍚庤嚜瀹氫箟鑴氭湰 + inter.setting.tailScript = _tailScript // 鍚庣疆鑷畾涔夎剼鏈� return inter }) @@ -1201,9 +1229,9 @@ } resetActiveMenu = (menuId) => { - const { MenuID, Tab } = this.props + const { MenuID } = this.props - if (MenuID !== menuId || Tab) return + if (MenuID !== menuId) return this.setShortcut() } -- Gitblit v1.8.0