| | |
| | | |
| | | class SubTableConfig extends Component { |
| | | static propTpyes = { |
| | | config: PropTypes.object, |
| | | menu: PropTypes.any, |
| | | handleConfig: PropTypes.func, |
| | | editTab: PropTypes.any, |
| | | config: PropTypes.any, |
| | | handleSubConfig: PropTypes.func, |
| | | supMenuList: PropTypes.array |
| | | } |
| | |
| | | * 2、设置操作类型、原始菜单信息(每次保存后重置)、已使用表及基本信息表单 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const { config } = this.props |
| | | const { config, editTab } = this.props |
| | | |
| | | let _config = null |
| | | |
| | | if (!config || config.create) { |
| | | if (!config) { |
| | | _config = JSON.parse(JSON.stringify(Source.baseConfig)) |
| | | if (config.uuid) { |
| | | _config.uuid = config.uuid |
| | | _config.tabName = config.label |
| | | } |
| | | _config.uuid = editTab.linkTab |
| | | _config.tabName = editTab.label |
| | | _config.isAdd = true |
| | | } else { |
| | | _config = JSON.parse(JSON.stringify(config)) |
| | | } |
| | | |
| | | let _oriActions = [] |
| | | |
| | | if (_config.type === 'user') { |
| | | _config.action = _config.action.map(item => { |
| | | let uuid = Utils.getuuid() |
| | | |
| | | if (item.OpenType === 'pop') { // 含有子配置项的按钮 |
| | | _oriActions.push({ |
| | | prebtn: JSON.parse(JSON.stringify(item)), |
| | |
| | | } |
| | | |
| | | item.uuid = uuid |
| | | |
| | | return item |
| | | }) |
| | | } |
| | |
| | | this.setState = (state, callback) => { |
| | | return |
| | | } |
| | | } |
| | | |
| | | // 页面返回 |
| | | handleViewBack = () => { |
| | | const {menu} = this.props |
| | | let param = { |
| | | editMenu: menu, |
| | | editTab: '', |
| | | editAction: '', |
| | | subConfig: '', |
| | | tabview: menu ? menu.LongParam.Template : '' |
| | | } |
| | | |
| | | this.props.handleView(param) |
| | | } |
| | | |
| | | /** |
| | |
| | | }) |
| | | } |
| | | |
| | | // changeTemplate = () => { |
| | | // this.props.handleConfig('template') |
| | | // } |
| | | |
| | | /** |
| | | * @description 标签页保存 |
| | | */ |
| | | submitConfig = () => { |
| | | const { delActions } = this.state |
| | | const { delActions, originConfig } = this.state |
| | | let config = JSON.parse(JSON.stringify(this.state.config)) |
| | | |
| | | this.menuformRef.handleConfirm().then(res => { |
| | | |
| | | if (config.search[0] && config.search[0].origin) { |
| | | config.search = config.search.filter(item => !item.origin) |
| | | } |
| | | if (config.action[0] && config.action[0].origin) { |
| | | config.action = config.action.filter(item => !item.origin) |
| | | } |
| | | if (config.columns[0] && config.columns[0].origin) { |
| | | config.columns = config.columns.filter(item => !item.origin) |
| | | if (originConfig.isAdd) { |
| | | if (config.search[0] && config.search[0].origin) { |
| | | config.search = config.search.filter(item => !item.origin) |
| | | } |
| | | if (config.action[0] && config.action[0].origin) { |
| | | config.action = config.action.filter(item => !item.origin) |
| | | } |
| | | if (config.columns[0] && config.columns[0].origin) { |
| | | config.columns = config.columns.filter(item => !item.origin) |
| | | } |
| | | } |
| | | |
| | | let _LongParam = '' |
| | |
| | | |
| | | // 保存时删除配置类型,system 、user |
| | | delete _config.type |
| | | delete _config.isAdd |
| | | |
| | | try { |
| | | _LongParam = window.btoa(window.encodeURIComponent(JSON.stringify(_config))) |
| | |
| | | |
| | | let btnParam = { |
| | | func: 'sPC_Button_AddUpt', |
| | | Type: 40, |
| | | ParentID: _config.uuid, |
| | | MenuNo: res.tabNo, |
| | | Template: 'SubTable', |
| | |
| | | duration: 2 |
| | | }) |
| | | if (this.state.closeVisible) { |
| | | let view = this.props.menu ? this.props.menu.type : '' |
| | | this.props.handleConfig(view) |
| | | this.handleViewBack() |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false, |
| | |
| | | const { config, originConfig } = this.state |
| | | |
| | | let _this = this |
| | | let isAdd = false |
| | | |
| | | if ( |
| | | (config.search[0] && config.search[0].origin) || |
| | | (config.action[0] && config.action[0].origin) || |
| | | (config.columns[0] && config.columns[0].origin) |
| | | ) { |
| | | isAdd = true |
| | | } |
| | | |
| | | if (isAdd) { |
| | | if (originConfig.isAdd) { |
| | | confirm({ |
| | | content: '菜单尚未提交,确定放弃保存吗?', |
| | | okText: this.state.dict['header.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | let view = _this.props.menu ? _this.props.menu.type : '' |
| | | _this.props.handleConfig(view) |
| | | _this.handleViewBack() |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | closeVisible: true |
| | | }) |
| | | } else { |
| | | let view = this.props.menu ? this.props.menu.type : '' |
| | | this.props.handleConfig(view) |
| | | this.handleViewBack() |
| | | } |
| | | }, () => { |
| | | this.setState({ |
| | |
| | | }) |
| | | } |
| | | |
| | | dontsave = () => { |
| | | let view = this.props.menu ? this.props.menu.type : '' |
| | | this.props.handleConfig(view) |
| | | } |
| | | |
| | | render () { |
| | | const { modaltype } = this.state |
| | | const configAction = this.state.config.action.filter(_action => |
| | |
| | | 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.dontsave}>{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 |