From 151f90d6aa701be749ff2fc80b3599b88ece3844 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期三, 23 三月 2022 21:22:04 +0800 Subject: [PATCH] 2022-03-23 --- src/tabviews/custom/components/card/cardcellList/index.jsx | 62 +++++++++++++++++++++++-------- 1 files changed, 46 insertions(+), 16 deletions(-) diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index 828b097..bfbb71e 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -328,13 +328,19 @@ val = data[card.field] } - if (val !== '' && typeof(val) === 'number') { + if (val === '' && card.noValue === 'hide') { // 绌哄�奸殣钘� + return null + } + + if (typeof(val) === 'number') { if (card.format === 'percent') { val = val * 100 + } else if (card.format === 'abs') { + val = Math.abs(val) } - if (card.col && card.col.type === 'number') { - let decimal = card.col.decimal || 0 + if (typeof(card.decimal) === 'number') { + let decimal = card.decimal if (card.format === 'percent') { decimal = decimal - 2 @@ -620,8 +626,8 @@ if (val !== '') { val = `${card.prefix || ''}${val}${card.postfix || ''}` - if (card.eval === 'false' && /\s/ig.test(val)) { - val = val.replace(/\s/ig, ' ') + if (card.eval === 'false') { + val = val.replace(/\n/ig, '<br/>').replace(/\s/ig, ' ') val = <span dangerouslySetInnerHTML={{__html: val}}></span> } } @@ -648,27 +654,37 @@ </Col> ) } else if (card.eleType === 'button') { + let _disabled = data.$disabled if (card.control === 'hidden') { - let s = data[card.controlField] + let s = data[card.controlField] !== undefined ? data[card.controlField] + '' : '' if (s === card.controlVal || (card.controlVal && card.controlVal.split(',').includes(s))) { return null + } + } else if (card.control === 'disabled') { + let s = data[card.controlField] !== undefined ? data[card.controlField] + '' : '' + if (s === card.controlVal || (card.controlVal && card.controlVal.split(',').includes(s))) { + _disabled = true } } let _data = [data] - if (data.$$type === 'extendCard' || data.$$empty) { + if (data.$$type === 'extendCard') { + _data = data.$$selectedData || [] + } else if (data.$$empty) { _data = [] } else if (card.$sync) { _data = this.props.syncData } - if (['exec', 'prompt', 'pop'].includes(card.OpenType)) { + if (['exec', 'prompt', 'pop', 'form'].includes(card.OpenType)) { return ( - <Col key={card.uuid} className="mk-cell-btn" span={card.width}> + <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> <NormalButton BID={data.$$BID} BData={data.$$BData || ''} + disabled={_disabled} + lineId={data.$$key || ''} btn={card} show={card.show} style={card.style} @@ -680,10 +696,12 @@ ) } else if (card.OpenType === 'excelIn') { return ( - <Col key={card.uuid} className="mk-cell-btn" span={card.width}> + <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> <ExcelInButton BID={data.$$BID} BData={data.$$BData || ''} + disabled={_disabled} + lineId={data.$$key || ''} btn={card} show={card.show} style={card.style} @@ -694,10 +712,12 @@ ) } else if (card.OpenType === 'excelOut') { return ( - <Col key={card.uuid} className="mk-cell-btn" span={card.width}> + <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> <ExcelOutButton BID={data.$$BID} BData={data.$$BData || ''} + lineId={data.$$key || ''} + disabled={_disabled} btn={card} show={card.show} style={card.style} @@ -707,10 +727,12 @@ ) } else if (card.OpenType === 'popview') { return ( - <Col key={card.uuid} className="mk-cell-btn" span={card.width}> + <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> <PopupButton BID={data.$$BID} BData={data.$$BData || ''} + disabled={_disabled} + lineId={data.$$key || ''} btn={card} show={card.show} style={card.style} @@ -721,9 +743,11 @@ ) } else if (card.OpenType === 'tab') { return ( - <Col key={card.uuid} className="mk-cell-btn" span={card.width}> + <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> <TabButton BData={data.$$BData || ''} + disabled={_disabled} + lineId={data.$$key || ''} btn={card} show={card.show} style={card.style} @@ -734,9 +758,11 @@ ) } else if (card.OpenType === 'innerpage') { return ( - <Col key={card.uuid} className="mk-cell-btn" span={card.width}> + <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> <NewPageButton BData={data.$$BData || ''} + disabled={_disabled} + lineId={data.$$key || ''} btn={card} show={card.show} style={card.style} @@ -748,10 +774,12 @@ } else if (card.OpenType === 'funcbutton') { if (card.funcType === 'changeuser' || card.funcType === 'closetab') { return ( - <Col key={card.uuid} className="mk-cell-btn" span={card.width}> + <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> <ChangeUserButton BID={data.$$BID} BData={data.$$BData || ''} + disabled={_disabled} + lineId={data.$$key || ''} btn={card} show={card.show} style={card.style} @@ -762,10 +790,12 @@ ) } else if (card.funcType === 'print') { return ( - <Col key={card.uuid} className="mk-cell-btn" span={card.width}> + <Col key={card.uuid} className="mk-cell-btn" style={card.wrapStyle} span={card.width}> <PrintButton BID={data.$$BID} BData={data.$$BData || ''} + disabled={_disabled} + lineId={data.$$key || ''} btn={card} show={card.show} style={card.style} -- Gitblit v1.8.0