From a24beb36feaa46f39cbb26ce5277e84f91241ce8 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 26 三月 2020 01:30:05 +0800 Subject: [PATCH] 2020-03-26 --- src/tabviews/subtable/index.jsx | 72 ++++++++++++++++++++++++++++++++--- 1 files changed, 65 insertions(+), 7 deletions(-) diff --git a/src/tabviews/subtable/index.jsx b/src/tabviews/subtable/index.jsx index 067cc9e..e11eef8 100644 --- a/src/tabviews/subtable/index.jsx +++ b/src/tabviews/subtable/index.jsx @@ -12,13 +12,14 @@ import options from '@/store/options.js' import SubTable from '@/tabviews/zshare/normalTable' -import SubAction from '@/tabviews/zshare/actionList' +// import SubAction from '@/tabviews/zshare/actionList' import SubSearch from '@/tabviews/zshare/topSearch' import asyncLoadComponent from '@/utils/asyncLoadComponent' import NotFount from '@/components/404' import './index.scss' +const SubAction = asyncLoadComponent(() => import('@/tabviews/zshare/actionList')) const SubTabTable = asyncLoadComponent(() => import('@/tabviews/subtabtable')) class SubTabViewTable extends Component { @@ -32,7 +33,9 @@ ContainerId: PropTypes.any, // 涓夌骇鑿滃崟Container(html) ID handleTableId: PropTypes.func, // 鎺у埗琛ㄦ牸鏁版嵁鍒囨崲鏃讹紝鏇存柊鍦ㄤ富琛ㄤ腑鐨刬d handleMainTable: PropTypes.func, // 鍒锋柊涓昏〃 - refreshtabs:PropTypes.any + refreshtabs: PropTypes.any, // 鏍囩鍒锋柊鎺у埗 + userConfig: PropTypes.any, // 鐢ㄦ埛鑷畾涔夎缃� + triggerBtn: PropTypes.any // 蹇嵎閿垨鐐瑰嚮琛屾寜閽Е鍙戜簨浠� } state = { @@ -58,7 +61,8 @@ popAction: false, // 寮规椤甸潰锛屾寜閽俊鎭� popData: false, // 寮规椤甸潰锛屾墍閫夌殑琛ㄦ牸鏁版嵁 visible: false, // 寮规鏄剧ず闅愯棌鎺у埗 - pickup: false, // 瀛愯〃鏁版嵁闅愯棌鏄剧ず鍒囨崲 + pickup: false, // 瀛愯〃鏁版嵁闅愯棌鏄剧ず鍒囨崲 + triggerBtn: null // 鎸夐挳瑙﹀彂 } /** @@ -70,6 +74,10 @@ this.loadmaindata(nextProps.BID, 'refresh') } else if (this.state.config && nextProps.refreshtabs && nextProps.refreshtabs.includes(this.props.Tab.uuid)) { this.reloadtable() + } else if (nextProps.triggerBtn && !is(fromJS(this.props.triggerBtn), fromJS(nextProps.triggerBtn)) && nextProps.triggerBtn.parentId === this.props.MenuID) { + this.setState({ + triggerBtn: nextProps.triggerBtn + }) } } @@ -77,7 +85,7 @@ * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 */ async loadconfig () { - const { permAction, Tab, BID } = this.props + const { permAction, Tab, BID, userConfig } = this.props let param = { func: 'sPC_Get_LongParam', @@ -153,6 +161,33 @@ }) } + if (userConfig) { + config.setting.tableType = userConfig.setting.tableType + + config.action = config.action.map(item => { + if (userConfig.action[item.uuid]) { + item = {...item, ...userConfig.action[item.uuid]} + } + + if (item.execMode) { + item.OpenType = 'funcbutton' + } + + if (item.OpenType === 'funcbutton' && item.funcType === 'print' && item.verify && item.printer) { + item.verify.defaultPrinter = item.printer.defaultPrinter || '' + if (item.verify.printerTypeList && item.printer.printerList) { + item.verify.printerTypeList = item.verify.printerTypeList.map(cell => { + cell.printer = item.printer.printerList[cell.Value] || '' + + return cell + }) + } + } + + return item + }) + } + // 1銆佺瓫閫夊瓧娈甸泦锛�2銆佽繃婊ら殣钘忓垪鍙婂悎骞跺垪涓殑瀛楁uuid config.columns.forEach(col => { if (col.field) { @@ -215,6 +250,21 @@ valid = false } }) + + // 娣诲姞鐢ㄦ埛鏄剧ず鍒楄缃� + if (userConfig) { + _columns = _columns.map(item => { + if (userConfig.columns[item.uuid]) { + item = {...item, ...userConfig.columns[item.uuid]} + } + + return item + }) + + _columns.sort((pre, next) => { + return pre.sort - next.sort + }) + } this.setState({ loadingview: false, @@ -640,7 +690,15 @@ * @description 琛ㄦ牸涓紝鎸夐挳瑙﹀彂浜嬩欢浼犻�� */ buttonTrigger = (btn, record) => { - this.refs.subButton.actionTrigger(btn, record) + this.setState({ + triggerBtn: { + uuid: new Date().getTime(), + parentId: this.props.MenuID, + button: btn, + data: record + } + }) + // this.refs.subButton.actionTrigger(btn, record) } /** @@ -698,7 +756,7 @@ } render() { - const { setting, searchlist, actions, columns, loadingview, viewlost, pickup } = this.state + const { setting, searchlist, actions, columns, loadingview, viewlost, pickup, triggerBtn } = this.state return ( <div className="subtable" id={'subtable' + this.props.MenuID}> @@ -713,9 +771,9 @@ {actions ? <div className="sub-action"> <SubAction - ref="subButton" type="sub" menuType={this.props.menuType} + triggerBtn={triggerBtn} setting={setting} actions={actions} Tab={this.props.Tab} -- Gitblit v1.8.0