From cad4c57867b08541bb560e871b690e4e730cc1b8 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期六, 15 四月 2023 14:29:27 +0800 Subject: [PATCH] Merge branch 'develop' --- src/tabviews/custom/index.jsx | 200 +++++++++++++++++++------------------------------- 1 files changed, 76 insertions(+), 124 deletions(-) diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index cbf6415..1074471 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -482,17 +482,7 @@ } } else if (col.type === 'custom') { col.elements = col.elements.map(cell => { - if (['text', 'number', 'formula'].includes(cell.eleType)) { - if (!cell.height) { - cell.innerHeight = 'auto' - } - if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { - cell.round = Math.pow(10, cell.decimal) - if (cell.format === 'percent') { - cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 - } - } - } + cell = this.resetElement(cell) return cell }) } @@ -530,12 +520,8 @@ item.action = item.action.filter(cell => { if (cell.hidden === 'true') return false - cell.logLabel = item.$menuname + '-' + cell.label - 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 = this.resetButton(item, cell, popview) + cell.$toolbtn = true if (!mutil && cell.syncComponentId === item.setting.supModule) { @@ -547,19 +533,6 @@ if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃� cell = this.getPrinter(cell, item.uuid) - } - - if (cell.btnstyle) { // 鍏煎 - cell.style = cell.style || {} - cell.style = {...cell.style, ...cell.btnstyle} - } - - if (cell.controlField) { - if (/,/ig.test(cell.controlVal)) { - cell.controlVals = cell.controlVal.split(',') - } else { - cell.controlVals = [(cell.controlVal || '')] - } } return skip || permAction[cell.uuid] @@ -579,13 +552,7 @@ 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 + cell = this.resetButton(item, cell, popview) if (!mutil && cell.syncComponentId === item.setting.supModule) { cell.syncComponentId = '' @@ -597,23 +564,8 @@ 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 || '')] - } - } - } else if (['text', 'number', 'formula'].includes(cell.eleType)) { - if (!cell.height) { - cell.innerHeight = 'auto' - } - if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { - cell.round = Math.pow(10, cell.decimal) - if (cell.format === 'percent') { - cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 - } - } + } else { + cell = this.resetElement(cell) } return cell.eleType !== 'button' || skip || permAction[cell.uuid] @@ -625,13 +577,7 @@ 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 + cell = this.resetButton(item, cell, popview) if (!mutil && cell.syncComponentId === item.setting.supModule) { cell.syncComponentId = '' @@ -643,23 +589,8 @@ 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 || '')] - } - } - } else if (['text', 'number', 'formula'].includes(cell.eleType)) { - if (!cell.height) { - cell.innerHeight = 'auto' - } - if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { - cell.round = Math.pow(10, cell.decimal) - if (cell.format === 'percent') { - cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 - } - } + } else { + cell = this.resetElement(cell) } return cell.eleType !== 'button' || skip || permAction[cell.uuid] @@ -677,12 +608,7 @@ if (cell.eleType === 'button') { if (cell.hidden === 'true') return false - cell.logLabel = item.$menuname + '-' + cell.label - 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 = this.resetButton(item, cell, popview) if (cell.syncComponentId === item.wrap.supModule) { cell.syncComponentId = '' @@ -694,23 +620,8 @@ 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 || '')] - } - } - } else if (['text', 'number', 'formula'].includes(cell.eleType)) { - if (!cell.height) { - cell.innerHeight = 'auto' - } - if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { - cell.round = Math.pow(10, cell.decimal) - if (cell.format === 'percent') { - cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 - } - } + } else { + cell = this.resetElement(cell) } return cell.eleType !== 'button' || skip || permAction[cell.uuid] @@ -720,14 +631,8 @@ 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 + + cell = this.resetButton(item, cell, popview) if (cell.syncComponentId === item.setting.supModule) { cell.syncComponentId = '' @@ -738,19 +643,6 @@ if (cell.OpenType === 'funcbutton' && cell.funcType === 'print' && cell.verify) { // 鎵撳嵃鏈鸿缃� cell = this.getPrinter(cell, item.uuid) - } - - if (cell.btnstyle) { // 鍏煎 - cell.style = cell.style || {} - cell.style = {...cell.style, ...cell.btnstyle} - } - - if (cell.controlField) { - if (/,/ig.test(cell.controlVal)) { - cell.controlVals = cell.controlVal.split(',') - } else { - cell.controlVals = [(cell.controlVal || '')] - } } return skip || permAction[cell.uuid] @@ -847,6 +739,66 @@ return true }) + } + + resetButton = (item, cell, popview) => { + 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.btnstyle) { // 鍏煎 + cell.style = cell.style || {} + cell.style = {...cell.style, ...cell.btnstyle} + } + + if (cell.controlField) { + if (/,/ig.test(cell.controlVal)) { + cell.controlVals = cell.controlVal.split(',') + } else { + cell.controlVals = [(cell.controlVal || '')] + } + } + + return cell + } + + resetElement = (cell) => { + cell.style = cell.style || {} + if (['text', 'number', 'formula'].includes(cell.eleType)) { + if (!cell.height) { + cell.innerHeight = 'auto' + } + + cell.innerHeight = cell.innerHeight || 'auto' + cell.alignItems = cell.height > 1 ? cell.alignItems : '' + + if (cell.eleType === 'number' && typeof(cell.decimal) === 'number') { + cell.round = Math.pow(10, cell.decimal) + if (cell.format === 'percent') { + cell.decimal = cell.decimal > 2 ? cell.decimal - 2 : 0 + } + } + } else if (cell.eleType === 'icon') { + if (!cell.innerHeight) { // 鍏煎 + let fontSize = 14 + let lineHeight = 1.5 + + if (cell.style.fontSize) { + fontSize = parseInt(cell.style.fontSize) + } + if (cell.style.lineHeight) { + lineHeight = parseFloat(cell.style.lineHeight) + } + + cell.innerHeight = fontSize * lineHeight + } + } + + return cell } getPrinter = (item, parentId) => { @@ -1384,9 +1336,9 @@ const { loadingview, viewlost, config, loading, shortcuts, BID } = this.state return ( - <div className={'custom-page-wrap ' + (loadingview || loading ? 'loading' : '')} id={this.state.ContainerId} style={config ? config.style : null}> + <div className={`custom-page-wrap ${config && config.minWidth ? 'mk-scroll' : ''} ${loadingview || loading ? 'loading' : ''}`} id={this.state.ContainerId} style={config ? config.style : null}> {(loadingview || (loading && !config.$cache)) ? <Spin className="view-spin" size="large" /> : null} - <Row id={config ? 'menu' + config.uuid : ''} className="component-wrap">{this.getComponents()}</Row> + <Row id={config ? 'menu' + config.uuid : ''} style={config && config.minWidth ? {minWidth: config.minWidth} : null} className="component-wrap">{this.getComponents()}</Row> {config && config.interfaces.length > 0 ? <MkInterfaces BID={BID} interfaces={config.interfaces}/> : null} {config && window.GLOB.breakpoint ? <DebugTable /> : null} {!window.GLOB.mkHS && window.GLOB.systemType !== 'production' ? <TableNodes config={config} /> : null} -- Gitblit v1.8.0