| | |
| | | class ComTableConfig extends Component { |
| | | static propTpyes = { |
| | | menu: PropTypes.any, |
| | | editAction: PropTypes.object, |
| | | btnTab: PropTypes.object, |
| | | config: PropTypes.any, |
| | | handleConfig: PropTypes.func, |
| | | handleSubConfig: PropTypes.func |
| | | handleView: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | |
| | | * 2、设置操作类型、原始菜单信息(每次保存后重置)、已使用表及基本信息表单 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const { menu, editAction, config } = this.props |
| | | const { menu, btnTab, config } = this.props |
| | | |
| | | let _config = '' |
| | | let _originMenu = '' |
| | | |
| | | if (!config) { |
| | | _config = JSON.parse(JSON.stringify(Source.baseConfig)) |
| | | _config.isAdd = true |
| | | } else { |
| | | _config = config |
| | | _originMenu = JSON.parse(JSON.stringify(_config)) |
| | | } |
| | | |
| | | this.setState({ |
| | | config: _config, |
| | | originMenu: _originMenu, |
| | | originMenu: JSON.parse(JSON.stringify(_config)), |
| | | selectedTables: _config.tables, |
| | | menuformlist: [ |
| | | { |
| | |
| | | type: 'text', |
| | | key: 'actionName', |
| | | label: '按钮名称', |
| | | initVal: editAction.label, |
| | | initVal: btnTab.label, |
| | | readonly: true |
| | | } |
| | | ] |
| | |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | } |
| | | |
| | | // 页面返回 |
| | | handleViewBack = () => { |
| | | const { menu } = this.props |
| | | let _tabview = menu ? menu.LongParam.Template : '' |
| | | let param = { |
| | | editMenu: menu, |
| | | editTab: null, |
| | | tabConfig: null, |
| | | editSubTab: null, |
| | | subTabConfig: null, |
| | | btnTab: null, |
| | | btnTabConfig: null, |
| | | editAction: null, |
| | | subConfig: null, |
| | | tabview: _tabview |
| | | } |
| | | |
| | | this.props.handleView(param) |
| | | } |
| | | |
| | | handleList = (type, list, card, groupId, elementId) => { |
| | |
| | | * @description 菜单保存 |
| | | */ |
| | | submitConfig = () => { |
| | | const { menu, editAction } = this.props |
| | | const { menu, btnTab } = this.props |
| | | const { delActions } = this.state |
| | | |
| | | let config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | this.menuformRef.handleConfirm().then(res => { |
| | | |
| | | if (config.groups[0] && config.groups[0].sublist[0] && config.groups[0].sublist[0].origin) { |
| | | config.groups[0].sublist = config.groups[0].sublist.filter(item => !item.origin) |
| | | } |
| | | if (config.action[0] && config.action[0].origin) { |
| | | config.action = config.action.filter(item => !item.origin) |
| | | } |
| | | if (config.tabs[0] && config.tabs[0].origin) { |
| | | config.tabs = config.tabs.filter(item => !item.origin) |
| | | if (config.isAdd) { |
| | | if (config.groups[0] && config.groups[0].sublist[0] && config.groups[0].sublist[0].origin) { |
| | | config.groups[0].sublist = config.groups[0].sublist.filter(item => !item.origin) |
| | | } |
| | | if (config.action[0] && config.action[0].origin) { |
| | | config.action = config.action.filter(item => !item.origin) |
| | | } |
| | | if (config.tabs[0] && config.tabs[0].origin) { |
| | | config.tabs = config.tabs.filter(item => !item.origin) |
| | | } |
| | | } |
| | | |
| | | let _LongParam = '' |
| | |
| | | } |
| | | }) |
| | | } |
| | | |
| | | delete _config.isAdd |
| | | |
| | | try { |
| | | _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) |
| | |
| | | |
| | | let tabParam = { // 添加菜单tab页 |
| | | func: 'sPC_sMenusTab_AddUpt', |
| | | MenuID: editAction.uuid, |
| | | MenuID: btnTab.uuid, |
| | | LText: config.tabs.map((item, index) => { |
| | | return `select '${editAction.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${(index + 1) * 10}' as Sort` |
| | | return `select '${btnTab.uuid}' as MenuID ,'${item.linkTab}' as Tabid,'${item.label}' as TabName ,'${(index + 1) * 10}' as Sort` |
| | | }) |
| | | } |
| | | tabParam.LText = tabParam.LText.join(' union all ') |
| | |
| | | let param = { |
| | | func: 'sPC_ButtonParam_AddUpt', |
| | | ParentID: menu.MenuID, |
| | | MenuID: editAction.uuid, |
| | | MenuID: btnTab.uuid, |
| | | MenuNo: menu.MenuNo, |
| | | Template: 'FormTab', |
| | | MenuName: editAction.label, |
| | | MenuName: btnTab.label, |
| | | PageParam: JSON.stringify({Template: 'FormTab'}), |
| | | LongParam: _LongParam |
| | | } |
| | |
| | | duration: 2 |
| | | }) |
| | | if (this.state.closeVisible) { |
| | | this.props.handleConfig('') |
| | | this.handleViewBack() |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false, |
| | |
| | | |
| | | let _this = this |
| | | |
| | | if (!originMenu) { |
| | | if (config.isAdd) { |
| | | confirm({ |
| | | content: '按钮配置尚未提交,确定放弃保存吗?', |
| | | okText: this.state.dict['header.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | _this.props.handleConfig('') |
| | | _this.handleViewBack() |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | closeVisible: true |
| | | }) |
| | | } else { |
| | | this.props.handleConfig('') |
| | | this.handleViewBack() |
| | | } |
| | | } |
| | | } |
| | |
| | | * @description 设置可配置标签 |
| | | */ |
| | | setSubConfig = (btn, type) => { |
| | | const {menu, btnTab} = this.props |
| | | const { config, originMenu } = this.state |
| | | |
| | | let isAdd = false |
| | | |
| | | if ( |
| | | (config.search[0] && config.search[0].origin) || |
| | | (config.action[0] && config.action[0].origin) || |
| | | (config.tabs[0] && config.tabs[0].origin) |
| | | ) { |
| | | isAdd = true |
| | | } |
| | | |
| | | if (isAdd) { |
| | | if (config.isAdd) { |
| | | notification.warning({ |
| | | top: 92, |
| | | message: '菜单尚未保存,请保存菜单配置!', |
| | |
| | | loading: true |
| | | }) |
| | | |
| | | let uuid = '' |
| | | let _type = type |
| | | if (type === 'button' && btn.OpenType === 'popview') { |
| | | _type = 'tab' |
| | | } |
| | | |
| | | if (_type === 'button') { |
| | | uuid = btn.uuid |
| | | } else { |
| | | uuid = btn.linkTab |
| | | let param = { |
| | | editMenu: menu, |
| | | editTab: btn, |
| | | tabConfig: null, |
| | | editSubTab: null, |
| | | subTabConfig: null, |
| | | btnTab: btnTab, |
| | | btnTabConfig: _config, |
| | | editAction: null, |
| | | subConfig: '', |
| | | tabview: btn.type |
| | | } |
| | | |
| | | Api.getSystemConfig({ |
| | | func: 'sPC_Get_LongParam', |
| | | MenuID: uuid |
| | | MenuID: btn.linkTab |
| | | }).then(res => { |
| | | if (res.status) { |
| | | this.setState({ |
| | |
| | | } |
| | | } |
| | | |
| | | if (_type === 'tab' && !_LongParam) { |
| | | _LongParam = { |
| | | ...btn, |
| | | uuid: btn.linkTab, |
| | | create: true |
| | | } |
| | | if (_LongParam && param.tabview === 'SubTable' && _LongParam.Template === 'SubTable') { |
| | | param.subConfig = _LongParam |
| | | } |
| | | |
| | | this.props.handleSubConfig(btn, originMenu, _LongParam, _type) |
| | | this.props.handleView(param) |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | onCancel={() => { this.setState({closeVisible: false}) }} |
| | | footer={[ |
| | | <Button key="save" className="mk-btn mk-green" loading={this.state.menucloseloading} onClick={this.submitConfig}>{this.state.dict['header.save']}</Button>, |
| | | <Button key="confirm" className="mk-btn mk-yellow" onClick={() => {this.props.handleConfig('')}}>{this.state.dict['header.notsave']}</Button>, |
| | | <Button key="confirm" className="mk-btn mk-yellow" onClick={this.handleViewBack}>{this.state.dict['header.notsave']}</Button>, |
| | | <Button key="cancel" onClick={() => { this.setState({closeVisible: false}) }}>{this.state.dict['header.cancel']}</Button> |
| | | ]} |
| | | destroyOnClose |