From a94b0a4d15b26ecf8fe99f0a1c3e60d60b97766d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 15 八月 2023 14:22:03 +0800 Subject: [PATCH] 2023-08-15 --- src/tabviews/custom/components/card/cardcellList/index.jsx | 41 ++++++++++++++++++++++++++++++----------- 1 files changed, 30 insertions(+), 11 deletions(-) diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index 275b422..493a682 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -5,8 +5,7 @@ import moment from 'moment' // import Api from '@/api' -import asyncComponent from './asyncButtonComponent' -import asyncElementComponent from '@/utils/asyncComponent' +import asyncComponent from '@/utils/asyncComponent' import { getMark } from '@/utils/utils.js' import MkIcon from '@/components/mk-icon' import Encrypts from '@/components/encrypts' @@ -25,9 +24,9 @@ const FuncMegvii = asyncComponent(() => import('@/tabviews/zshare/actionList/funcMegvii')) const FuncZip = asyncComponent(() => import('@/tabviews/zshare/actionList/funczip')) const EditLine = asyncComponent(() => import('@/tabviews/zshare/actionList/editLine')) -const BarCode = asyncElementComponent(() => import('@/components/barcode')) -const QrCode = asyncElementComponent(() => import('@/components/qrcode')) -const MkProgress = asyncElementComponent(() => import('@/components/mkProgress')) +const BarCode = asyncComponent(() => import('@/components/barcode')) +const QrCode = asyncComponent(() => import('@/components/qrcode')) +const MkProgress = asyncComponent(() => import('@/components/mkProgress')) const Video = asyncComponent(() => import('@/components/video')) const MkPicture = asyncComponent(() => import('@/components/mkPicture')) const PicRadio = { @@ -543,6 +542,16 @@ val = card.tooltip } + if (/\\n|\n/.test(val)) { + val = val.replace(/(\\n|\n)$/, '') + + if (val) { + val = val.split(/\\n|\n/) + + val = <div>{val.map((cell, i) => <div style={{marginBottom: 2}} key={i}>{cell}</div>)}</div> + } + } + if (card.tipType === 'text') { contents.push( <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> @@ -765,7 +774,7 @@ let func = new Function('data', card.formula) val = func(_data) } catch (e) { - if (window.debugger) { + if (window.GLOB.debugger === true) { console.warn(e) } val = '' @@ -785,7 +794,7 @@ // eslint-disable-next-line _val = eval(_val) } catch (e) { - if (window.debugger) { + if (window.GLOB.debugger === true) { console.info(_val) console.warn(e) } @@ -811,7 +820,7 @@ // eslint-disable-next-line _val = eval(_val) } catch (e) { - if (window.debugger) { + if (window.GLOB.debugger === true) { console.info(_val) console.warn(e) } @@ -824,6 +833,15 @@ if (!val && card.noValue === 'hide') { // 绌哄�奸殣钘� return null + } else if (card.eval === 'func') { + 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 || '')} style={{height: card.innerHeight}} dangerouslySetInnerHTML={{__html: val}}></div> + </div> + </div> + ) + return } if (card.round && typeof(val) === 'number') { @@ -831,9 +849,7 @@ val = val.toFixed(card.decimal) } - if (card.eval === 'func') { - val = <span dangerouslySetInnerHTML={{__html: val}}></span> - } else if (val !== '') { + if (val !== '') { if (val && typeof(val) === 'string') { val = val.replace(/\n/ig, '<br/>') if (!/<(span|div|p|a|img)\s/g.test(val)) { @@ -929,6 +945,9 @@ if (data.$$type === 'extendCard') { _data = data.$$selectedData || [] + if (card.Ot === 'notRequired' && _data.length === 0) { + _data = [data] + } } else if (card.$sync) { _data = this.props.syncData || [] } else if (data.$$empty) { -- Gitblit v1.8.0