From a9b02f6862522b54d0824152017bf2acfec2af7b Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 21 三月 2024 10:29:50 +0800 Subject: [PATCH] 2024-03-21 --- src/tabviews/custom/components/card/cardcellList/index.jsx | 132 +++++++++++++++++++++++++++++++++---------- 1 files changed, 100 insertions(+), 32 deletions(-) diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index cd0962e..8a38647 100644 --- a/src/tabviews/custom/components/card/cardcellList/index.jsx +++ b/src/tabviews/custom/components/card/cardcellList/index.jsx @@ -8,6 +8,7 @@ import asyncComponent from '@/utils/asyncComponent' import { getMark } from '@/utils/utils.js' import MkIcon from '@/components/mk-icon' +import MKEmitter from '@/utils/events.js' import Encrypts from '@/components/encrypts' import './index.scss' @@ -24,6 +25,7 @@ const FuncMegvii = asyncComponent(() => import('@/tabviews/zshare/actionList/funcMegvii')) const FuncZip = asyncComponent(() => import('@/tabviews/zshare/actionList/funczip')) const ExportPdf = asyncComponent(() => import('@/tabviews/zshare/actionList/exportPdf')) +const ShareLink = asyncComponent(() => import('@/tabviews/zshare/actionList/shareLink')) const EditLine = asyncComponent(() => import('@/tabviews/zshare/actionList/editLine')) const BarCode = asyncComponent(() => import('@/components/barcode')) const QrCode = asyncComponent(() => import('@/components/qrcode')) @@ -92,16 +94,45 @@ openNewView = (e, card) => { const { cardCell, data, cards } = this.props - if (data.$disabled) return + e.stopPropagation() - if (card.anchors && card.anchors.length > 0) { + if (card.anchors) { let id = card.anchors[card.anchors.length - 1] let node = document.getElementById('anchor' + id) node && node.scrollIntoView({behavior: 'smooth', block: 'center', inline: 'nearest'}) } - if (!card.link || (card.linkType === 'qywx' || card.linkType === 'linkmenu')) return - e.stopPropagation() + if (card.linkType === 'qywx') return + if (card.linkType === 'linkmenu') { + if (card.linkThdMenu) { + let __param = { + $BID: data.$$uuid + } + + if (card.field) { + __param.$searchkey = card.field.toLowerCase() + __param.$searchval = data[card.field] || '' + } + + if (card.joint === 'true' && card.linkThdMenu.urlFields) { + let lower = {} + Object.keys(data).forEach(key => { + lower[key.toLowerCase()] = data[key] + }) + + card.linkThdMenu.urlFields.split(',').forEach(field => { + __param[field] = lower[field.toLowerCase()] || '' + }) + } + + let tabmenu = card.linkThdMenu + + tabmenu.param = __param + + MKEmitter.emit('modifyTabs', tabmenu, true) + } + return + } let url = '' @@ -296,7 +327,7 @@ contents.push( <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> <div style={card.style}> - <div className={'ant-mk-text line1' + className} style={{height: card.innerHeight || 'auto'}}><span className="sequence-wrap" style={_style}>{data.$Index || ''}</span></div> + <div className={'ant-mk-text line1' + className} style={{height: card.innerHeight || 'auto'}}><span className="sequence-wrap" style={_style}>{card.prefix || ''}{data.$Index || ''}{card.postfix || ''}</span></div> </div> </div> ) @@ -433,7 +464,7 @@ } if (card.copyable === 'true') { - if (card.link || (card.anchors && card.anchors.length > 0)) { + if (card.link || card.anchors) { let url = orival if (card.link === 'static') { @@ -473,23 +504,31 @@ } className = mark.signType } - - if (card.link || (card.anchors && card.anchors.length > 0)) { - _style.cursor = 'pointer' - } if (card.bgImage && data[card.bgImage]) { _style.backgroundImage = `url('${data[card.bgImage]}')` } - - 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)}}> - {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>} + + if (!data.$disabled && (card.link || card.anchors)) { + _style.cursor = 'pointer' + 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)}}> + {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> - </div> - ) + ) + } else { + contents.push( + <div className={'ant-col ant-col-' + card.width} key={card.uuid} style={_style_} span={card.width}> + <div style={_style}> + {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} @@ -687,24 +726,31 @@ _imagestyle.backgroundPosition = _style.backgroundPosition || 'center' _imagestyle.backgroundRepeat = _style.backgroundRepeat || 'no-repeat' - if (card.link) { - _style.cursor = 'pointer' - } - if (_style.position === 'absolute') { _style.width = '100%' } - + let scale = url && card.scale === 'true' let urls = url ? url.split(',').filter(Boolean) : [''] - - urls.forEach((u, i) => { - contents.push(<div className={'ant-col ant-col-' + card.width} key={card.uuid + i} style={_style_} span={card.width}> - <div style={_style} onClick={(e) => {this.openNewView(e, card)}}> - <MkPicture style={_imagestyle} lostTip={card.lostTip !== 'false'} scale={scale} url={u} urls={urls}/> - </div> - </div>) - }) + + if (card.link && !data.$disabled) { + _style.cursor = 'pointer' + urls.forEach((u, i) => { + contents.push(<div className={'ant-col ant-col-' + card.width} key={card.uuid + i} style={_style_} span={card.width}> + <div style={_style} onClick={(e) => {this.openNewView(e, card)}}> + <MkPicture style={_imagestyle} lostTip={card.lostTip !== 'false'} scale={scale} url={u} urls={urls}/> + </div> + </div>) + }) + } else { + urls.forEach((u, i) => { + contents.push(<div className={'ant-col ant-col-' + card.width} key={card.uuid + i} style={_style_} span={card.width}> + <div style={_style}> + <MkPicture style={_imagestyle} lostTip={card.lostTip !== 'false'} scale={scale} url={u} urls={urls}/> + </div> + </div>) + }) + } } else if (card.eleType === 'splitline') { let _borderWidth = card.borderWidth === undefined ? 1 : card.borderWidth _style_ = _style_ || {} @@ -821,9 +867,14 @@ _data = [data] } + let _val = card.formula + if (/@username@|@fullName@|@bid@/ig.test(_val)) { + _val = _val.replace(/@username@/ig, sessionStorage.getItem('User_Name') || '').replace(/@fullName@/ig, sessionStorage.getItem('Full_Name') || '').replace(/@bid@/ig, data.$$BID || '') + } + try { // eslint-disable-next-line - let func = new Function('data', card.formula) + let func = new Function('data', _val) val = func(_data) } catch (e) { console.warn(e) @@ -858,6 +909,9 @@ val = '' } else if (data) { let _val = card.formula + if (/@username@|@fullName@|@bid@/ig.test(_val)) { + _val = _val.replace(/@username@/ig, sessionStorage.getItem('User_Name') || '').replace(/@fullName@/ig, sessionStorage.getItem('Full_Name') || '').replace(/@bid@/ig, data.$$BID || '') + } Object.keys(data).forEach(key => { let reg = new RegExp('@' + key + '@', 'ig') _val = _val.replace(reg, data[key]) @@ -1005,6 +1059,10 @@ } else if (data.$$empty) { _data = [] } + let name = '' + if (card.showName) { + name = data[card.showName] || ' ' + } _style_ = _style_ || {} if (card.wrapStyle) { @@ -1016,6 +1074,7 @@ if (['exec', 'prompt', 'pop', 'form'].includes(card.OpenType)) { MkButton = <NormalButton btn={card} + name={name} BID={data.$$BID} BData={data.$$BData || ''} disabled={_disabled} @@ -1044,6 +1103,7 @@ } else if (card.OpenType === 'popview') { MkButton = <PopupButton btn={card} + name={name} BID={data.$$BID} BData={data.$$BData || ''} disabled={_disabled} @@ -1053,6 +1113,7 @@ } else if (card.OpenType === 'tab') { MkButton = <TabButton btn={card} + name={name} BID={data.$$BID} BData={data.$$BData || ''} disabled={_disabled} @@ -1061,6 +1122,7 @@ } else if (card.OpenType === 'innerpage') { MkButton = <NewPageButton btn={card} + name={name} BID={data.$$BID} BData={data.$$BData || ''} disabled={_disabled} @@ -1107,6 +1169,12 @@ MkButton = <ExportPdf btn={card} /> + } else if (card.funcType === 'shareLink') { + MkButton = <ShareLink + BID={data.$$BID} + btn={card} + selectedData={_data} + /> } else if (card.funcType === 'addline' || card.funcType === 'delline') { MkButton = <EditLine btn={card} -- Gitblit v1.8.0