From dddb2c96f42d9c852dba26ff9a27daa12bd85008 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 14 十月 2021 00:07:20 +0800 Subject: [PATCH] 2021-10-14 --- src/tabviews/custom/components/share/normalTable/index.jsx | 67 ++++++++++++++++++++++----------- 1 files changed, 44 insertions(+), 23 deletions(-) diff --git a/src/tabviews/custom/components/share/normalTable/index.jsx b/src/tabviews/custom/components/share/normalTable/index.jsx index b71831a..c80e3d2 100644 --- a/src/tabviews/custom/components/share/normalTable/index.jsx +++ b/src/tabviews/custom/components/share/normalTable/index.jsx @@ -5,7 +5,6 @@ import { is, fromJS } from 'immutable' import { Table, Typography, Icon, Col, Switch, message } from 'antd' -import { modifyTabview } from '@/store/action' import asyncComponent from '@/utils/asyncComponent' import MKEmitter from '@/utils/events.js' import zhCN from '@/locales/zh-CN/main.js' @@ -352,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) { @@ -564,7 +596,6 @@ // 瀛楁閫忚 triggerLink = (e, item, record) => { - const { tabviews } = this.props e.stopPropagation() let __param = { @@ -583,21 +614,12 @@ let tabmenu = item.linkThdMenu tabmenu.param = __param - tabmenu.selected = true - - let tabs = tabviews.filter((tab, i) => { - tab.selected = false - return tab.MenuID !== tabmenu.MenuID - }) - - if (tabviews.length > tabs.length) { - this.props.modifyTabview(fromJS(tabs).toJS()) + + if (['linkage_navigation', 'linkage', 'menu_board'].includes(window.GLOB.navBar)) { + MKEmitter.emit('modifyTabs', tabmenu, 'replace') + } else { + MKEmitter.emit('modifyTabs', tabmenu, 'plus', true) } - - this.setState({}, () => { - tabs.push(tabmenu) - this.props.modifyTabview(tabs) - }) } else if (item.linkurl) { let src = item.linkurl @@ -869,8 +891,10 @@ _footer = statFValue.map(f => `${f.label}(鍚堣)锛�${f.value}`).join('锛�') } + let height = setting.height || false + return ( - <div className={`normal-custom-table ${setting.tableHeader || ''} ${setting.mode || ''}`} id={tableId}> + <div className={`normal-custom-table ${setting.tableHeader || ''} ${height ? 'fixed-height' : ''} ${setting.mode || ''}`} id={tableId}> {(setting.tableType === 'radio' || setting.tableType === 'checkbox') && data && data.length > 0 ? <Switch title="鏀惰捣" className="main-pickup" checkedChildren="寮�" unCheckedChildren="鍏�" checked={pickup} onChange={this.pickupChange} /> : null } @@ -883,7 +907,7 @@ columns={this.state.columns} dataSource={_data} loading={this.props.loading} - scroll={{ x: '100%', y: false }} + scroll={{ x: '100%', y: height }} onRow={(record, index) => { return { lineMarks, @@ -905,15 +929,12 @@ const mapStateToProps = (state) => { return { menuType: state.editLevel, - tabviews: state.tabviews, memberLevel: state.memberLevel } } -const mapDispatchToProps = (dispatch) => { - return { - modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)) - } +const mapDispatchToProps = () => { + return {} } export default connect(mapStateToProps, mapDispatchToProps)(NormalTable) \ No newline at end of file -- Gitblit v1.8.0