| | |
| | | BIDs: {}, // 上级表id |
| | | setsingle: false, // 主表单选多选切换 |
| | | pickup: false, // 主表数据隐藏显示切换 |
| | | isLinkMain: false, // 是否存在与主表关联的子表 |
| | | popData: false, // 弹框页面,所选的表格数据 |
| | | visible: false, // 弹框显示隐藏控制 |
| | | primaryId: null |
| | | primaryId: null, |
| | | refreshtabs: null |
| | | } |
| | | |
| | | /** |
| | |
| | | // if (!config[group]) return |
| | | // config[group] = config[group].filter(tab => permAction[tab.uuid]) |
| | | // }) |
| | | |
| | | let _isLinkMain = false // 检查是否有与主表关联的子表 |
| | | let supmenus = {} |
| | | config.tabgroups.forEach(group => { |
| | | if (config[group] && config[group].length > 0) { |
| | | config[group] = config[group].map(tab => { |
| | | if (tab.subtabs && tab.subtabs.length > 0) { |
| | | tab.subtabs.forEach(id => { |
| | | supmenus[id] = tab.uuid |
| | | }) |
| | | } |
| | | if (config.setting.subtabs.includes(tab.uuid)) { |
| | | tab.supMenu = 'mainTable' |
| | | _isLinkMain = true |
| | | } else if (supmenus[tab.uuid]) { |
| | | tab.supMenu = supmenus[tab.uuid] |
| | | } |
| | | |
| | | return tab |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | this.setState({ |
| | | config: config, |
| | | setting: config.setting, |
| | | actions: config.action, |
| | | isLinkMain: _isLinkMain, |
| | | arr_field: _arrField, |
| | | primaryId: this.props.param.primaryId || '', |
| | | data: config.setting.datatype === 'query' ? null : this.props.param.data, |
| | |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * @description 子表操作完成后刷新主表 |
| | | */ |
| | | handleMainTable = (type, tab) => { |
| | | if (type === 'maingrid' && tab.supMenu === 'mainTable') { |
| | | this.loadmaindata() |
| | | } else if (type === 'maingrid' && tab.supMenu) { |
| | | this.setState({ |
| | | refreshtabs: [tab.supMenu] |
| | | }, () => { |
| | | this.setState({ |
| | | refreshtabs: null |
| | | }) |
| | | }) |
| | | } else if (type === 'equaltab' && tab.equalTab && tab.equalTab.length > 0) { |
| | | this.setState({ |
| | | refreshtabs: tab.equalTab |
| | | }, () => { |
| | | this.setState({ |
| | | refreshtabs: null |
| | | }) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @description 获取表单参数 |
| | | */ |
| | | getFormData = () => { |
| | | return this.formGroupRef.handleConfirm() |
| | | } |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { setting, actions, loadingview, viewlost, isLinkMain, config, groups, data } = this.state |
| | | const { setting, actions, loadingview, viewlost, config, groups, data } = this.state |
| | | let hasform = false |
| | | |
| | | if (groups && (groups.length > 1 || groups[0].sublist.length > 0)) { |
| | |
| | | } |
| | | |
| | | return ( |
| | | <div className={'formtab ' + (isLinkMain ? 'pick-control' : '')} id={this.state.ContainerId}> |
| | | <div className="formtab" id={this.state.ContainerId}> |
| | | {loadingview && <Spin size="large" />} |
| | | {hasform ? |
| | | <FormGroup |
| | |
| | | Tab={_tab} |
| | | MenuID={_tab.linkTab} |
| | | SupMenuID={this.props.MenuID} |
| | | refreshtabs={this.state.refreshtabs} |
| | | ContainerId={this.state.ContainerId} |
| | | BID={this.state.BIDs[_tab.supMenu] || ''} |
| | | BData={this.state.BIDs[_tab.supMenu + 'data'] || ''} |
| | | handleTableId={this.handleTableId} |
| | | handleMainTable={this.handleMainTable} |
| | | handleMainTable={(type) => this.handleMainTable(type, _tab)} |
| | | /> : null} |
| | | </TabPane> |
| | | ) |