| | |
| | | class ComTableConfig extends Component { |
| | | static propTpyes = { |
| | | menu: PropTypes.any, |
| | | optionLibs: PropTypes.any, |
| | | editTab: PropTypes.any, |
| | | editSubTab: PropTypes.any, |
| | | tabConfig: PropTypes.any, |
| | |
| | | selectedTables: [], // 已选表名 |
| | | originConfig: null, // 原始菜单 |
| | | groupVisible: false, // 全局配置模态框 |
| | | curgroup: null // 当前组,新建或编辑 |
| | | curgroup: null, // 当前组,新建或编辑 |
| | | optionLibs: null // 自定义下拉选项库 |
| | | } |
| | | |
| | | /** |
| | |
| | | * 4、设置按钮基本信息 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const {menu, editAction, tabConfig, subTabConfig, subConfig} = this.props |
| | | const {menu, editAction, tabConfig, subTabConfig, subConfig, optionLibs} = this.props |
| | | |
| | | let _config = '' |
| | | let _tab = subTabConfig ? subTabConfig : tabConfig |
| | |
| | | |
| | | if (subConfig) { |
| | | _config = subConfig |
| | | |
| | | if (_config.groups.length > 0) { |
| | | _config.groups.forEach(group => { |
| | | group.sublist.forEach(item => { |
| | | if ( |
| | | (item.type === 'select' || item.type === 'multiselect' || item.type === 'link') && |
| | | item.resourceType === '0' && |
| | | item.options && item.options.length > 0 |
| | | ) { |
| | | optionLibs.set(item.uuid, { |
| | | uuid: item.uuid, |
| | | label: item.label, |
| | | parname: editAction.label, |
| | | type: 'Modal', |
| | | options: item.options |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | } else { |
| | | _config.fields.forEach(item => { |
| | | if ( |
| | | (item.type === 'select' || item.type === 'multiselect' || item.type === 'link') && |
| | | item.resourceType === '0' && |
| | | item.options && item.options.length > 0 |
| | | ) { |
| | | optionLibs.set(item.uuid, { |
| | | uuid: item.uuid, |
| | | label: item.label, |
| | | parname: editAction.label, |
| | | type: 'Modal', |
| | | options: item.options |
| | | }) |
| | | } |
| | | }) |
| | | } |
| | | } else { |
| | | _config = JSON.parse(JSON.stringify((Source.baseConfig))) |
| | | } |
| | |
| | | |
| | | this.setState({ |
| | | menu: _menu, |
| | | optionLibs: optionLibs, |
| | | config: _config, |
| | | selectedTables: _config.tables || [], |
| | | originConfig: JSON.parse(JSON.stringify(_config)), |
| | |
| | | |
| | | let param = { |
| | | editMenu: menu, |
| | | optionLibs: this.state.optionLibs, |
| | | editTab: editTab, |
| | | tabConfig: tabConfig, |
| | | editSubTab: editSubTab, |
| | |
| | | * 3、通过loading刷新 |
| | | */ |
| | | handleSubmit = () => { |
| | | const {editAction, optionLibs} = this.props |
| | | this.formRef.handleConfirm().then(res => { |
| | | let _config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | if ( // 更新下拉字典 |
| | | (res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && |
| | | res.resourceType === '0' && |
| | | res.options && res.options.length > 0 |
| | | ) { |
| | | optionLibs.set(res.uuid, { |
| | | uuid: res.uuid, |
| | | label: res.label, |
| | | parname: editAction.label, |
| | | type: 'Modal', |
| | | options: res.options |
| | | }) |
| | | } |
| | | |
| | | if (_config.groups.length > 0) { |
| | | _config.groups.forEach(group => { |
| | |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | optionLibs: optionLibs, |
| | | visible: false |
| | | }) |
| | | }) |
| | |
| | | dict={this.state.dict} |
| | | card={this.state.card} |
| | | formlist={this.state.formlist} |
| | | optionLibs={this.state.optionLibs} |
| | | wrappedComponentRef={(inst) => this.formRef = inst} |
| | | />} |
| | | </Modal> |