src/menu/components/card/cardcellcomponent/formconfig.jsx | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/tabviews/custom/components/card/cardcellList/index.jsx | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/tabviews/custom/index.jsx | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/tabviews/custom/popview/index.jsx | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/menu/components/card/cardcellcomponent/formconfig.jsx
@@ -589,7 +589,7 @@ key: 'alignItems', label: '垂直对齐', initVal: card.alignItems || '', tooltip: '垂直方向的对齐方式。', tooltip: '垂直方向的对齐方式。注:高度(行)大于1时有效。', required: false, options: [ { value: '', text: '居上' }, src/tabviews/custom/components/card/cardcellList/index.jsx
@@ -35,6 +35,37 @@ '10:1': '10%', '3:4': '133.33%', '2:3': '150%', '9:16': '177.78%' } class TextCell extends Component { componentDidMount() { if (this.node && this.node.scrollHeight > this.node.offsetHeight) { this.node.style.display = 'block' } } componentDidUpdate() { if (this.node) { if (this.node.scrollHeight > this.node.offsetHeight) { this.node.style.display = 'block' } else { this.node.style.display = 'flex' } } } render() { const { card, className, value } = this.props let lineStyle = {height: card.innerHeight} lineStyle.display = 'flex' lineStyle.alignItems = card.alignItems lineStyle.justifyContent = card.style.textAlign || 'left' return ( <div ref={ref => this.node = ref} className={className} style={lineStyle}>{value}</div> ) } } class CardCellComponent extends Component { static propTpyes = { cards: PropTypes.object, // 菜单配置信息 @@ -257,7 +288,7 @@ ) } else if (card.eleType === 'text') { let val = '' let _style = card.style ? {...card.style} : {} let _style = {...card.style} if (card.datatype === 'static') { val = card.value || '' @@ -401,23 +432,17 @@ _style.backgroundImage = `url('${data[card.bgImage]}')` } let lineStyle = {height: card.innerHeight || 'auto'} if (card.alignItems) { lineStyle.display = 'flex' lineStyle.alignItems = card.alignItems lineStyle.justifyContent = _style.textAlign || 'left' } contents.push( <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> <div style={_style} onClick={(e) => {this.openNewView(e, card)}}> <div className={'ant-mk-text line' + (card.height || '') + className} style={lineStyle}>{val}</div> {card.alignItems ? <TextCell card={card} className={'ant-mk-text line' + (card.height || '') + className} value={val}/> : <div className={'ant-mk-text line' + (card.height || '') + className} style={{height: card.innerHeight}}>{val}</div>} </div> </div> ) } else if (card.eleType === 'number') { let val = '' let _style = card.style ? {...card.style} : {} let _style = {...card.style} if (card.datatype === 'static') { val = card.value @@ -478,24 +503,17 @@ className = mark.signType } let lineStyle = {height: card.innerHeight || 'auto'} if (card.alignItems) { lineStyle.display = 'flex' lineStyle.alignItems = card.alignItems lineStyle.justifyContent = _style.textAlign || 'left' } contents.push( <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> <div style={_style}> <div className={'ant-mk-text line' + (card.height || '') + className} style={lineStyle}>{val}</div> {card.alignItems ? <TextCell card={card} className={'ant-mk-text line' + (card.height || '') + className} value={val}/> : <div className={'ant-mk-text line' + (card.height || '') + className} style={{height: card.innerHeight}}>{val}</div>} </div> </div> ) } else if (card.eleType === 'icon') { let val = '' let icon = '' let height = card.innerHeight if (card.datatype === 'dynamic') { icon = data[card.field] || '' @@ -505,20 +523,6 @@ if (!icon && card.noValue === 'hide') { // 空值隐藏 return null } if (!height) { // 兼容 let fontSize = 14 let lineHeight = 1.5 if (card.style.fontSize) { fontSize = parseInt(card.style.fontSize) } if (card.style.lineHeight) { lineHeight = parseFloat(card.style.lineHeight) } height = fontSize * lineHeight } if (data.hasOwnProperty(card.tooltip)) { @@ -531,8 +535,8 @@ <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> <div style={card.style}> {val ? <Tooltip title={val}> <MkIcon className="ant-mk-icon" style={{height: height}} type={icon}/> </Tooltip> : <MkIcon className="ant-mk-icon" style={{height: height}} type={icon}/>} <MkIcon className="ant-mk-icon" style={{height: card.innerHeight}} type={icon}/> </Tooltip> : <MkIcon className="ant-mk-icon" style={{height: card.innerHeight}} type={icon}/>} </div> </div> ) @@ -566,7 +570,7 @@ ) } else if (card.eleType === 'picture') { let _imagestyle = {} let _style = card.style ? {margin: '0 auto', ...card.style} : {} let _style = {margin: '0 auto', ...card.style} let url = '' if (card.maxWidth) { _style.maxWidth = card.maxWidth @@ -722,7 +726,7 @@ ) } else if (card.eleType === 'formula') { let val = 0 let _style = card.style ? {...card.style} : {} let _style = {...card.style} if (card.$sync) { if (card.eval === 'false') { @@ -804,17 +808,11 @@ className = mark.signType } let lineStyle = {height: card.innerHeight || 'auto'} if (card.alignItems) { lineStyle.display = 'flex' lineStyle.alignItems = card.alignItems lineStyle.justifyContent = _style.textAlign || 'left' } contents.push( <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> <div style={_style}> <div className={'ant-mk-text line' + (card.height || '') + className} style={lineStyle}>{val}</div> {card.alignItems ? <TextCell card={card} className={'ant-mk-text line' + (card.height || '') + className} value={val}/> : <div className={'ant-mk-text line' + (card.height || '') + className} style={{height: card.innerHeight}}>{val}</div>} </div> </div> ) 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 } } 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 } } 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 } } cell = this.resetElement(cell) } return cell.eleType !== 'button' || skip || permAction[cell.uuid] @@ -721,13 +632,7 @@ 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] @@ -849,6 +741,66 @@ }) } 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) => { let _item = window.GLOB.UserCacheMap.get(parentId + item.uuid) src/tabviews/custom/popview/index.jsx
@@ -329,17 +329,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 }) } @@ -377,30 +367,13 @@ item.action = item.action.filter(cell => { if (cell.hidden === 'true' || ['popview', 'funcbutton'].includes(cell.OpenType)) return false cell.logLabel = item.$menuname + '-' + cell.label cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' cell.$menuId = item.uuid cell.$MenuID = Tab.$MenuID cell.$tabId = Tab.uuid cell = this.resetButton(item, cell, Tab) cell.$toolbtn = true if (!mutil && cell.syncComponentId === item.setting.supModule) { cell.syncComponentId = '' if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { cell.execSuccess = 'mainline' } } 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 || '')] } } @@ -421,12 +394,7 @@ if (cell.eleType === 'button') { if (cell.hidden === 'true' || ['popview', 'funcbutton'].includes(cell.OpenType)) return false cell.logLabel = item.$menuname + '-' + cell.label cell.Ot = cell.Ot || 'requiredSgl' cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' cell.$menuId = item.uuid cell.$MenuID = Tab.$MenuID cell.$tabId = Tab.uuid cell = this.resetButton(item, cell, Tab) if (!mutil && cell.syncComponentId === item.setting.supModule) { cell.syncComponentId = '' @@ -434,23 +402,8 @@ cell.execSuccess = 'mainline' } } 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 } } cell = this.resetElement(cell) } return true @@ -462,12 +415,7 @@ if (cell.eleType === 'button') { if (cell.hidden === 'true' || ['popview', 'funcbutton'].includes(cell.OpenType)) return false cell.logLabel = item.$menuname + '-' + cell.label cell.Ot = cell.Ot || 'requiredSgl' cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' cell.$menuId = item.uuid cell.$MenuID = Tab.$MenuID cell.$tabId = Tab.uuid cell = this.resetButton(item, cell, Tab) if (!mutil && cell.syncComponentId === item.setting.supModule) { cell.syncComponentId = '' @@ -475,24 +423,8 @@ cell.execSuccess = 'mainline' } } 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 } } cell = this.resetElement(cell) } return true @@ -510,11 +442,7 @@ if (cell.eleType === 'button') { if (cell.hidden === 'true' || ['popview', 'funcbutton'].includes(cell.OpenType)) return false cell.logLabel = item.$menuname + '-' + cell.label cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' cell.$menuId = item.uuid cell.$MenuID = Tab.$MenuID cell.$tabId = Tab.uuid cell = this.resetButton(item, cell, Tab) if (cell.syncComponentId === item.wrap.supModule) { cell.syncComponentId = '' @@ -522,23 +450,8 @@ cell.execSuccess = 'mainline' } } 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 } } cell = this.resetElement(cell) } return true @@ -549,30 +462,12 @@ col.elements = col.elements.filter(cell => { if (cell.hidden === 'true' || ['popview', 'funcbutton'].includes(cell.OpenType)) return false cell.logLabel = item.$menuname + '-' + cell.label cell.Ot = cell.Ot || 'requiredSgl' cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' cell.$menuId = item.uuid cell.$MenuID = Tab.$MenuID cell.$tabId = Tab.uuid cell = this.resetButton(item, cell, Tab) if (cell.syncComponentId === item.setting.supModule) { cell.syncComponentId = '' if (cell.execSuccess === 'line' || cell.execSuccess === 'grid') { cell.execSuccess = 'mainline' } } 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 || '')] } } @@ -671,6 +566,65 @@ }) } resetButton = (item, cell, Tab) => { cell.logLabel = item.$menuname + '-' + cell.label cell.Ot = cell.Ot || 'requiredSgl' cell.syncComponentId = cell.syncComponent ? (cell.syncComponent.pop() || '') : '' cell.$menuId = item.uuid cell.$MenuID = Tab.$MenuID cell.$tabId = Tab.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 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) => { let _item = window.GLOB.UserCacheMap.get(parentId + item.uuid)