From 4c6bdfe1f3557e49a315c1564bcb6164c0bc7faa Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 03 四月 2020 18:27:22 +0800 Subject: [PATCH] 2020-04-03 --- src/tabviews/commontable/index.jsx | 61 +++++++++++++++++++++++++++--- 1 files changed, 54 insertions(+), 7 deletions(-) diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx index 8407103..202b1a4 100644 --- a/src/tabviews/commontable/index.jsx +++ b/src/tabviews/commontable/index.jsx @@ -29,9 +29,10 @@ class NormalTable extends Component { static propTpyes = { + param: PropTypes.any, // 鍏朵粬椤甸潰浼犻�掔殑鎼滅储鏉′欢绛夊弬鏁� + MenuID: PropTypes.string, // 鑿滃崟Id MenuNo: PropTypes.string, // 鑿滃崟鍙傛暟 - MenuName: PropTypes.string, // 鑿滃崟鍙傛暟 - MenuID: PropTypes.string // 鑿滃崟Id + MenuName: PropTypes.string // 鑿滃崟鍚嶇О } state = { @@ -76,13 +77,13 @@ * @description 鑾峰彇椤甸潰閰嶇疆淇℃伅 */ async loadconfig () { - const { permAction } = this.props + const { permAction, param } = this.props - let param = { + let _param = { func: 'sPC_Get_LongParam', MenuID: this.props.MenuID } - let result = await Api.getSystemCacheConfig(param) + let result = await Api.getSystemCacheConfig(_param) if (result.status) { let config = '' @@ -236,6 +237,10 @@ config.columns.forEach(col => { if (_hideCol.includes(col.uuid)) return + // if (col.linkThdMenu && !permAction[col.linkThdMenu.MenuID]) { + // col.linkThdMenu = '' + // } + if (col.type === 'colspan' && col.sublist) { let _col = JSON.parse(JSON.stringify(col)) let subColumn = [] @@ -259,8 +264,12 @@ } let valid = true // 鎼滅储鏉′欢蹇呭~楠岃瘉 - config.search.forEach(field => { - if (field.required === 'true' && !field.initval) { + config.search.forEach(item => { + if (item.type === 'text' && param && param.searchkey === item.field) { + item.initval = param.searchval + } + + if (item.required === 'true' && !item.initval) { valid = false } }) @@ -1023,6 +1032,34 @@ this.setState({userParam: param}) } + linkTrigger = (menu) => { + const { tabviews, MenuID } = this.props + + menu.selected = true + + let index = 0 + let isexit = false + let tabs = tabviews.map((tab, i) => { + tab.selected = false + + if (tab.MenuID === MenuID) { + index = i + } else if (tab.MenuID === menu.MenuID) { + tab.param = menu.param + tab.selected = true + isexit = true + } + + return tab + }) + + if (!isexit) { + tabs.splice(index + 1, 0, menu) + } + + this.props.modifyTabview(tabs) + } + settingSubmit = () => { const { userParam } = this.state let _LongParam = '' @@ -1088,6 +1125,15 @@ if (selectTab && selectTab.MenuID === this.props.MenuID) { this.setShortcut() } + } else if (nextProps.param && !is(fromJS(this.props.param), fromJS(nextProps.param))) { + let search = this.state.search.map(item => { + if (item.type === 'text' && item.key === nextProps.param.searchkey) { + item.value = nextProps.param.searchval + } + + return item + }) + this.refreshbysearch(search) } } @@ -1160,6 +1206,7 @@ loading={this.state.loading} refreshdata={this.refreshbytable} buttonTrigger={this.buttonTrigger} + linkTrigger={this.linkTrigger} handleTableId={this.handleTableId} /> </div> : null -- Gitblit v1.8.0