From 2430a9f70124cce8ff18b84a43d55515849a0dee Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 28 十月 2021 13:05:20 +0800 Subject: [PATCH] 2021-10-28 --- src/tabviews/custom/components/share/normalTable/index.jsx | 35 ++++++++++++++++++++++++++++++++++- 1 files changed, 34 insertions(+), 1 deletions(-) diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index e56e977..c80e3d2 100644 --- a/src/tabviews/custom/components/share/normalTable/index.jsx +++ b/src/tabviews/custom/components/share/normalTable/index.jsx @@ -351,6 +351,39 @@ {content && _href ? <a href={_href} target="_blank" rel="noopener noreferrer">{content}</a> : null } </div> ) + } else if (col.type === 'formula') { + let content = col.formula + Object.keys(record).forEach(key => { + let reg = new RegExp('@' + key + '@', 'ig') + content = content.replace(reg, record[key]) + }) + + if (col.eval !== 'false') { + try { + // eslint-disable-next-line + content = eval(content) + } catch (e) { + content = '' + } + } + + content = content === undefined ? '' : content + + if (content !== '') { + content = `${col.prefix || ''}${content}${col.postfix || ''}` + + if (col.eval === 'false') { + content = content.replace(/\n/ig, '<br/>').replace(/\s/ig, ' ') + content = <span dangerouslySetInnerHTML={{__html: content}}></span> + } + } + + if (col.marks) { + style = style || {} + content = this.getMark(record, col.marks, style, content) + } + + resProps.children = content } else if (col.type === 'custom') { style.padding = '0px' if (col.style) { @@ -585,7 +618,7 @@ if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) { MKEmitter.emit('modifyTabs', tabmenu, 'replace') } else { - MKEmitter.emit('modifyTabs', tabmenu, 'plus') + MKEmitter.emit('modifyTabs', tabmenu, 'plus', true) } } else if (item.linkurl) { let src = item.linkurl -- Gitblit v1.8.0