From 05eada1e66951fbb4d388518206c6f5adc93841c Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 15 三月 2024 22:09:20 +0800 Subject: [PATCH] 2024-03-15 --- src/tabviews/custom/components/card/cardcellList/index.jsx | 105 ++++++++++++----- src/menu/components/table/base-table/columns/editColumn/index.jsx | 2 src/components/header/index.jsx | 1 src/tabviews/custom/components/share/normalTable/index.scss | 8 + src/tabviews/custom/popview/index.jsx | 11 + src/menu/components/card/cardcellcomponent/formconfig.jsx | 36 ++++- src/views/tabledesign/index.jsx | 3 src/menu/components/table/normal-table/columns/editColumn/index.jsx | 2 src/tabviews/basetable/index.jsx | 11 + src/tabviews/custom/index.jsx | 11 + src/tabviews/custom/components/share/normalTable/index.jsx | 109 +++++++++-------- src/tabviews/zshare/topSearch/index.scss | 1 src/views/menudesign/index.jsx | 3 13 files changed, 210 insertions(+), 93 deletions(-) diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx index 1600d6b..8465cc8 100644 --- a/src/components/header/index.jsx +++ b/src/components/header/index.jsx @@ -336,6 +336,7 @@ trdItem.OpenType = PageParam.OpenType || 'newtab' trdItem.hidden = PageParam.hidden || 'false' trdItem.menuColor = PageParam.menuColor || '' + trdItem.urlFields = PageParam.urlFields || '' if (trdItem.type === 'NewPage') { trdItem.OpenType = 'newpage' diff --git a/src/menu/components/card/cardcellcomponent/formconfig.jsx b/src/menu/components/card/cardcellcomponent/formconfig.jsx index f0464b2..2ce967c 100644 --- a/src/menu/components/card/cardcellcomponent/formconfig.jsx +++ b/src/menu/components/card/cardcellcomponent/formconfig.jsx @@ -60,6 +60,7 @@ let linkTypes = [ { value: 'tel', text: '鐢佃瘽' }, { value: 'email', text: '閭' }, + { value: 'linkmenu', text: '鍏宠仈鑿滃崟' }, { value: 'download', text: '涓嬭浇' }, { value: 'other', text: '鍏朵粬' } ] @@ -89,13 +90,25 @@ card.linkType = '' card.linkurl = '' } - } else if (card.linkType === 'linkmenu') { - if (appType !== 'mob' && appType !== 'pc') { - card.link = '' - card.linkType = '' - card.linkurl = '' - card.linkmenu = '' + // } else if (card.linkType === 'linkmenu') { + // if (appType !== 'mob' && appType !== 'pc') { + // card.link = '' + // card.linkType = '' + // card.linkurl = '' + // card.linkmenu = '' + // } + } + + let menulist = sessionStorage.getItem('fstMenuList') + + if (appType === '' && menulist) { + try { + menulist = JSON.parse(menulist) + } catch (e) { + menulist = [] } + } else { + menulist = [] } let appMenus = sessionStorage.getItem('appMenus') @@ -589,7 +602,7 @@ forbid: isHeader }, { - type: linkTypes.length > 4 ? 'select' : 'radio', + type: 'select', key: 'linkType', label: '閾炬帴绫诲瀷', initVal: card.linkType || 'other', @@ -617,6 +630,15 @@ forbid: !['pc', 'mob'].includes(appType) }, { + type: 'cascader', + key: 'linkmenu', + label: '鍏宠仈鑿滃崟', + initVal: card.linkmenu || [], + required: true, + options: menulist, + forbid: ['pc', 'mob'].includes(appType) + }, + { type: 'select', key: 'linkurl', label: '閾炬帴鍦板潃', diff --git a/src/menu/components/table/base-table/columns/editColumn/index.jsx b/src/menu/components/table/base-table/columns/editColumn/index.jsx index 8af9c30..3377f09 100644 --- a/src/menu/components/table/base-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/base-table/columns/editColumn/index.jsx @@ -91,7 +91,7 @@ if (this.record.type === 'text' || this.record.type === 'number') { if (this.record.perspective === 'linkmenu') { - _options.push('linkmenu', 'linkfields', 'open') + _options.push('linkmenu', 'open') } else if (this.record.perspective === 'linkurl') { _options.push('linkurl', 'linkfields', 'open') } diff --git a/src/menu/components/table/normal-table/columns/editColumn/index.jsx b/src/menu/components/table/normal-table/columns/editColumn/index.jsx index bb4f805..7104329 100644 --- a/src/menu/components/table/normal-table/columns/editColumn/index.jsx +++ b/src/menu/components/table/normal-table/columns/editColumn/index.jsx @@ -89,7 +89,7 @@ if (this.record.type === 'text' || this.record.type === 'number') { if (this.record.perspective === 'linkmenu') { - _options.push('linkmenu', 'linkfields', 'open') + _options.push('linkmenu', 'open') } else if (this.record.perspective === 'linkurl') { _options.push('linkurl', 'linkfields', 'open') } diff --git a/src/tabviews/basetable/index.jsx b/src/tabviews/basetable/index.jsx index 83f496c..0ca4327 100644 --- a/src/tabviews/basetable/index.jsx +++ b/src/tabviews/basetable/index.jsx @@ -410,9 +410,20 @@ } } + if (cell.linkmenu && cell.linkmenu.length > 0) { + let menu_id = cell.linkmenu.pop() + cell.linkThdMenu = window.GLOB.mkThdMenus.get(menu_id) || '' + if (!cell.linkThdMenu) { + cell.link = '' + } + } + if (cell.marks && cell.marks.length === 0) { cell.marks = null } + if (cell.anchors && cell.anchors.length === 0) { + cell.anchors = null + } return true }) diff --git a/src/tabviews/custom/components/card/cardcellList/index.jsx b/src/tabviews/custom/components/card/cardcellList/index.jsx index c9c2579..d551b2b 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' @@ -93,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 + __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 = '' @@ -434,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') { @@ -474,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} @@ -688,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_ || {} diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index 66f8c96..3ab8096 100644 --- a/src/tabviews/custom/components/share/normalTable/index.jsx +++ b/src/tabviews/custom/components/share/normalTable/index.jsx @@ -20,6 +20,60 @@ '5:1': '20%', '6:1': '16.67%', '7:1': '14.29%', '8:1': '12.5%', '9:1': '11.11%', '10:1': '10%', '3:4': '133.33%', '2:3': '150%', '9:16': '177.78%' } + +// 瀛楁閫忚 +const triggerLink = (e, item, record) => { + e.stopPropagation() + + if (item.linkThdMenu) { + let __param = { + $searchkey: item.field, + $searchval: record[item.field] || '', + $BID: record.$$uuid + } + + if (item.linkThdMenu.urlFields) { + let lower = {} + Object.keys(record).forEach(key => { + lower[key.toLowerCase()] = record[key] + }) + + item.linkThdMenu.urlFields.split(',').forEach(field => { + __param[field] = lower[field.toLowerCase()] || '' + }) + } else if (item.linkfields && item.linkfields.length > 0) { + item.linkfields.forEach(field => { + __param[field] = record[field] || '' + }) + } + + let tabmenu = item.linkThdMenu + + tabmenu.param = __param + + MKEmitter.emit('modifyTabs', tabmenu, true) + } else if (item.linkurl) { + let src = item.linkurl + + let con = '?' + + if (/\?/ig.test(src)) { + con = '&' + } + + if (item.linkfields && item.linkfields.length > 0) { + item.linkfields.forEach(field => { + if (field.toLowerCase() === 'id') return + con += `${field}=${record[field] || ''}&` + }) + } + + src = src + `${con}id=${record.$$uuid}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}` + + window.open(src) + } +} + class BodyRow extends React.Component { shouldComponentUpdate (nextProps, nextState) { return !is(fromJS(this.props.data), fromJS(nextProps.data)) || this.props.className !== nextProps.className @@ -107,7 +161,7 @@ } render() { - let { col, config, record, className, style, triggerLink, ...resProps } = this.props + let { col, config, record, className, style, ...resProps } = this.props if (!col) return (<td {...resProps} className={className} style={style}/>) @@ -169,10 +223,7 @@ resProps.children = content if (!record.$disabled && (col.linkThdMenu || col.linkurl)) { - style = style || {} - style.cursor = 'pointer' - - return (<td {...resProps} className={className} onDoubleClick={() => triggerLink(col, record)} style={style}/>) + return (<td {...resProps} className={className + ' clickable'} onClick={(e) => triggerLink(e, col, record)} style={style}/>) } } else if (col.type === 'number') { let content = '' @@ -243,10 +294,7 @@ resProps.children = content if (!record.$disabled && (col.linkThdMenu || col.linkurl)) { - style = style || {} - style.cursor = 'pointer' - - return (<td {...resProps} className={className} onDoubleClick={() => triggerLink(col, record)} style={style}/>) + return (<td {...resProps} className={className + ' clickable'} onClick={(e) => triggerLink(e, col, record)} style={style}/>) } } else if (col.type === 'picture') { let photos = '' @@ -528,7 +576,6 @@ record, col: item, config: item.type === 'custom' ? {setting, columns: fields} : null, - triggerLink: this.triggerLink }) } } @@ -802,48 +849,6 @@ MKEmitter.emit('resetSelectLine', MenuID, '', '') MKEmitter.emit('syncBalconyData', MenuID, [], false) - } - } - - // 瀛楁閫忚 - triggerLink = (item, record) => { - let __param = { - $searchkey: item.field, - $searchval: record[item.field] || '', - $BID: record.$$uuid - } - - if (item.linkfields && item.linkfields.length > 0) { - item.linkfields.forEach(field => { - __param[field] = record[field] || '' - }) - } - - if (item.linkThdMenu) { - let tabmenu = item.linkThdMenu - - tabmenu.param = __param - - MKEmitter.emit('modifyTabs', tabmenu, true) - } else if (item.linkurl) { - let src = item.linkurl - - let con = '?' - - if (/\?/ig.test(src)) { - con = '&' - } - - if (item.linkfields && item.linkfields.length > 0) { - item.linkfields.forEach(field => { - if (field.toLowerCase() === 'id') return - con += `${field}=${record[field] || ''}&` - }) - } - - src = src + `${con}id=${record.$$uuid}&appkey=${window.GLOB.appkey}&userid=${sessionStorage.getItem('UserID')}&LoginUID=${sessionStorage.getItem('LoginUID') || ''}` - - window.open(src) } } diff --git a/src/tabviews/custom/components/share/normalTable/index.scss b/src/tabviews/custom/components/share/normalTable/index.scss index 6dbd534..f53051a 100644 --- a/src/tabviews/custom/components/share/normalTable/index.scss +++ b/src/tabviews/custom/components/share/normalTable/index.scss @@ -33,6 +33,14 @@ font-size: inherit; } + .clickable { + color: var(--mk-sys-color); + cursor: pointer; + } + .clickable:hover { + text-decoration: underline; + } + .mk-disabled { color: #bcbcbc; cursor: not-allowed; diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx index 983d3c3..a2870b1 100644 --- a/src/tabviews/custom/index.jsx +++ b/src/tabviews/custom/index.jsx @@ -981,6 +981,17 @@ if (cell.marks && cell.marks.length === 0) { cell.marks = null } + if (cell.anchors && cell.anchors.length === 0) { + cell.anchors = null + } + + if (cell.linkmenu && cell.linkmenu.length > 0) { + let menu_id = cell.linkmenu.pop() + cell.linkThdMenu = window.GLOB.mkThdMenus.get(menu_id) || '' + if (!cell.linkThdMenu) { + cell.link = '' + } + } if (['text', 'number', 'formula'].includes(cell.eleType)) { if (!cell.height) { diff --git a/src/tabviews/custom/popview/index.jsx b/src/tabviews/custom/popview/index.jsx index ca70341..7166489 100644 --- a/src/tabviews/custom/popview/index.jsx +++ b/src/tabviews/custom/popview/index.jsx @@ -699,6 +699,17 @@ if (cell.marks && cell.marks.length === 0) { cell.marks = null } + if (cell.anchors && cell.anchors.length === 0) { + cell.anchors = null + } + + if (cell.linkmenu && cell.linkmenu.length > 0) { + let menu_id = cell.linkmenu.pop() + cell.linkThdMenu = window.GLOB.mkThdMenus.get(menu_id) || '' + if (!cell.linkThdMenu) { + cell.link = '' + } + } if (['text', 'number', 'formula'].includes(cell.eleType)) { if (!cell.height) { diff --git a/src/tabviews/zshare/topSearch/index.scss b/src/tabviews/zshare/topSearch/index.scss index 9d96cca..142697e 100644 --- a/src/tabviews/zshare/topSearch/index.scss +++ b/src/tabviews/zshare/topSearch/index.scss @@ -5,6 +5,7 @@ display: inline-block; float: none; vertical-align: top; + text-align: left; } .ant-checkbox-wrapper { color: rgba(0, 0, 0, 0.85); diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index 7d3ece5..f77e0a4 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -828,6 +828,7 @@ } let interfaces = getFuncsAndInters(config) + let urlFields = config.urlFields ? config.urlFields.join(',') : '' let param = { func: 'sPC_TrdMenu_AddUpt', @@ -839,7 +840,7 @@ EasyCode: config.easyCode || '', Template: 'CustomPage', MenuName: config.MenuName || '', - PageParam: JSON.stringify({Template: 'CustomPage', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false', menuColor: config.menuColor || '', interfaces}), + PageParam: JSON.stringify({Template: 'CustomPage', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false', menuColor: config.menuColor || '', interfaces, urlFields}), open_edition: config.open_edition, LText: '', LTexttb: '', diff --git a/src/views/tabledesign/index.jsx b/src/views/tabledesign/index.jsx index 8a10070..916905e 100644 --- a/src/views/tabledesign/index.jsx +++ b/src/views/tabledesign/index.jsx @@ -581,6 +581,7 @@ } let interfaces = getFuncsAndInters(config) + let urlFields = config.urlFields ? config.urlFields.join(',') : '' let param = { func: 'sPC_TrdMenu_AddUpt', @@ -592,7 +593,7 @@ EasyCode: config.easyCode || '', Template: 'BaseTable', MenuName: config.MenuName || '', - PageParam: JSON.stringify({Template: 'BaseTable', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false', menuColor: config.menuColor || '', interfaces}), + PageParam: JSON.stringify({Template: 'BaseTable', OpenType: config.OpenType || 'newtab', hidden: config.hidden || 'false', menuColor: config.menuColor || '', interfaces, urlFields}), open_edition: config.open_edition, LText: '', LTexttb: '', -- Gitblit v1.8.0