| | |
| | | class ComTableConfig extends Component { |
| | | static propTpyes = { |
| | | menu: PropTypes.any, |
| | | optionLibs: PropTypes.any, |
| | | btnTab: PropTypes.object, |
| | | config: PropTypes.any, |
| | | handleView: PropTypes.func |
| | |
| | | profileVisible: false, // 验证信息模态框 |
| | | editgroup: null, // 当前编辑组 |
| | | groupVisible: false, // 编辑组模态框 |
| | | optionLibs: null, // 自定义下拉选项库 |
| | | activeKey: '0', // 默认展开基本信息 |
| | | pasteVisible: false, // 粘贴模态框 |
| | | sqlVerifing: false, // sql验证 |
| | |
| | | * 2、设置操作类型、原始菜单信息(每次保存后重置)、已使用表及基本信息表单 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const { menu, btnTab, config, optionLibs } = this.props |
| | | const { menu, btnTab, config } = this.props |
| | | |
| | | let _config = '' |
| | | let columns = [] |
| | |
| | | if (menu && menu.LongParam && menu.LongParam.setting) { |
| | | _config.setting.primaryKey = menu.LongParam.setting.primaryKey |
| | | } |
| | | |
| | | _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(btnTab.uuid + item.uuid, { |
| | | uuid: btnTab.uuid + item.uuid, |
| | | label: item.label, |
| | | parname: btnTab.label, |
| | | type: 'Modal', |
| | | options: item.options |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | if (!_config.tabgroups) { |
| | |
| | | |
| | | // 配置默认值,兼容 |
| | | _config.Template = 'FormTab' |
| | | _config.action = _config.action.map(item => { |
| | | if (item.intertype === 'inner' && !item.innerFunc) { |
| | | item.intertype = 'system' |
| | | } |
| | | return item |
| | | }) |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | activeKey: btnTab.activeKey || '0', |
| | | openEdition: btnTab.open_edition || '', |
| | | optionLibs: optionLibs, |
| | | columns: columns, |
| | | originMenu: JSON.parse(JSON.stringify(_config)), |
| | | selectedTables: _config.tables, |
| | |
| | | let _tabview = menu ? menu.LongParam.Template : '' |
| | | let param = { |
| | | editMenu: menu, |
| | | optionLibs: this.state.optionLibs, |
| | | editTab: null, |
| | | tabConfig: null, |
| | | editSubTab: null, |
| | |
| | | this.setState({ |
| | | modaltype: 'search', |
| | | card: card, |
| | | formlist: getModalForm(card, _inputfields, _linkableFields, _linksupFields, false, roleList) |
| | | formlist: getModalForm(card, _inputfields, _linkableFields, _linksupFields, false, roleList).map(item => { |
| | | if (item.key === 'type') { |
| | | item.options = item.options.filter(option => !['switch', 'checkbox', 'radio', 'checkcard', 'hint'].includes(option.value)) |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | } |
| | | |
| | |
| | | * 3、添加或编辑列,保存时,如按钮位置设置为表格,则修改操作列显示状态 |
| | | */ |
| | | handleSubmit = () => { |
| | | const { btnTab } = this.props |
| | | const { config, modaltype, optionLibs, card } = this.state |
| | | const { config, modaltype, card } = this.state |
| | | |
| | | if (modaltype === 'search') { |
| | | this.modalFormRef.handleConfirm().then(res => { |
| | |
| | | duration: 5 |
| | | }) |
| | | return |
| | | } |
| | | if ( // 更新下拉字典 |
| | | (res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && |
| | | res.resourceType === '0' && |
| | | res.options && res.options.length > 0 |
| | | ) { |
| | | optionLibs.set(btnTab.uuid + res.uuid, { |
| | | uuid: btnTab.uuid + res.uuid, |
| | | label: res.label, |
| | | parname: btnTab.label, |
| | | type: 'Modal', |
| | | options: res.options |
| | | }) |
| | | } |
| | | |
| | | let _groups = null |
| | |
| | | this.setState({ |
| | | sqlVerifing: false, |
| | | config: {..._config, groups: _groups}, |
| | | optionLibs: optionLibs, |
| | | modaltype: '' |
| | | }) |
| | | } else { |
| | |
| | | } else { |
| | | this.setState({ |
| | | config: {..._config, groups: _groups}, |
| | | optionLibs: optionLibs, |
| | | modaltype: '' |
| | | }) |
| | | } |
| | |
| | | newLText = Utils.formatOptions(DevUtils.getfunc(_param, btn, menu, _config)) |
| | | DelText = Utils.formatOptions(DevUtils.dropfunc(_param.funcName)) |
| | | |
| | | this.refs.btnCreatFunc.exec(btn.innerFunc, newLText, DelText).then(result => { |
| | | if (result !== 'success') return |
| | | |
| | | let isupdate = false |
| | | _config.action = _config.action.map(item => { |
| | | if (item.uuid === btn.uuid) { |
| | | isupdate = true |
| | | return btn |
| | | } else { |
| | | return item |
| | | } |
| | | }) |
| | | |
| | | if (!isupdate) { // 操作不是修改,添加元素至列表 |
| | | _config.action.push(btn) |
| | | } |
| | | |
| | | this.setState({ |
| | | config: _config |
| | | }) |
| | | }) |
| | | this.refs.btnCreatFunc.exec(btn.innerFunc, newLText, DelText) |
| | | }) |
| | | } |
| | | |
| | |
| | | |
| | | let param = { |
| | | editMenu: menu, |
| | | optionLibs: this.state.optionLibs, |
| | | editTab: btn, |
| | | tabConfig: null, |
| | | editSubTab: null, |
| | |
| | | card={this.state.card} |
| | | formlist={this.state.formlist} |
| | | inputSubmit={this.handleSubmit} |
| | | optionLibs={this.state.optionLibs} |
| | | wrappedComponentRef={(inst) => this.modalFormRef = inst} |
| | | /> |
| | | </Modal> |