| | |
| | | * @description 获取页面配置信息 |
| | | */ |
| | | async loadconfig () { |
| | | const { permAction, param, MenuName } = this.props |
| | | const { permAction, param, MenuName, MenuID } = this.props |
| | | |
| | | let _param = { |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: this.props.MenuID |
| | | MenuID: MenuID |
| | | } |
| | | let result = await Api.getCacheConfig(_param) |
| | | |
| | |
| | | |
| | | try { // 配置信息解析 |
| | | config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) |
| | | config.MenuID = this.props.MenuID |
| | | config.MenuID = MenuID |
| | | config.MenuName = MenuName |
| | | config.setting.$name = MenuName |
| | | } catch (e) { |
| | |
| | | group.sublist = group.sublist.filter(tab => { |
| | | if (tab.supMenu === 'mainTable' || (!tab.supMenu && tab.level === 0)) { |
| | | tab.isTreeNode = true |
| | | } |
| | | if (tab.supMenu === 'mainTable') { |
| | | tab.supMenu = MenuID |
| | | } |
| | | return permAction[tab.linkTab]} |
| | | ) |
| | |
| | | } |
| | | |
| | | selectTreeNode = (selectedKeys, {selected, node}) => { |
| | | const { config } = this.state |
| | | const { config, ContainerId } = this.state |
| | | let _expandedKeys = fromJS(this.state.expandedKeys).toJS() |
| | | let _data = fromJS(node.props.dataRef).toJS() |
| | | |
| | |
| | | }) |
| | | |
| | | delete _data.children |
| | | this.handleTableId('mainTable', _data.key, _data) |
| | | |
| | | MKEmitter.emit('changeTableLine', ContainerId, this.props.MenuID, _data.key, _data) |
| | | |
| | | this.setState({ |
| | | tabgroups: _tabgroups, |
| | | expandedKeys: _expandedKeys, |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 表格Id变化 |
| | | */ |
| | | handleTableId = (type, id, data) => { |
| | | const { BIDs } = this.state |
| | | |
| | | this.setState({ |
| | | BIDs: { |
| | | ...BIDs, |
| | | [type]: id, |
| | | [type + 'data']: data |
| | | } |
| | | }) |
| | | } |
| | | |
| | | reloadData = (menuId) => { |
| | | const { MenuID } = this.props |
| | | |
| | |
| | | this.setShortcut() |
| | | } |
| | | |
| | | changeTableLine = (ContainerId, tableId, id, data) => { |
| | | if (this.state.ContainerId !== ContainerId) return |
| | | |
| | | this.setState({ |
| | | BIDs: {...this.state.BIDs, [tableId]: id, [tableId + 'data']: data} |
| | | }) |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | // 组件加载时,获取菜单数据 |
| | | this.loadconfig() |
| | |
| | | MKEmitter.addListener('reloadData', this.reloadData) |
| | | MKEmitter.addListener('reloadMenuView', this.reloadMenuView) |
| | | MKEmitter.addListener('resetActiveMenu', this.resetActiveMenu) |
| | | MKEmitter.addListener('changeTableLine', this.changeTableLine) |
| | | } |
| | | |
| | | /** |
| | |
| | | MKEmitter.removeListener('reloadData', this.reloadData) |
| | | MKEmitter.removeListener('reloadMenuView', this.reloadMenuView) |
| | | MKEmitter.removeListener('resetActiveMenu', this.resetActiveMenu) |
| | | MKEmitter.removeListener('changeTableLine', this.changeTableLine) |
| | | } |
| | | |
| | | changeExpandedKeys = (expandedKeys) => { |
| | |
| | | ContainerId={this.state.ContainerId} |
| | | BID={this.state.BIDs[_tab.supMenu] || ''} |
| | | BData={this.state.BIDs[_tab.supMenu + 'data'] || ''} |
| | | handleTableId={this.handleTableId} |
| | | /> : null} |
| | | </TabPane> |
| | | ) |