| | |
| | | static propTpyes = { |
| | | menu: PropTypes.any, |
| | | editTab: PropTypes.any, |
| | | btnParam: PropTypes.object, |
| | | subConfig: PropTypes.any, |
| | | editAction: PropTypes.object, |
| | | handleConfig: PropTypes.func |
| | | handleView: PropTypes.func |
| | | } |
| | | |
| | | state = { |
| | |
| | | * 4、设置按钮基本信息 |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const {menu, editAction, editTab, btnParam} = this.props |
| | | const {menu, editAction, editTab, subConfig} = this.props |
| | | |
| | | let _config = '' |
| | | let _menu = { |
| | | let _menu = { // 上级菜单是三级菜单或标签页 |
| | | type: editTab ? editTab.Template : menu.type, |
| | | tables: editTab ? editTab.tables : menu.LongParam.tables, |
| | | MenuID: editTab ? editTab.uuid : menu.MenuID, |
| | |
| | | MenuName: editTab ? editTab.tabName : menu.MenuName |
| | | } |
| | | |
| | | if (btnParam) { |
| | | _config = btnParam |
| | | if (subConfig) { |
| | | _config = subConfig |
| | | } else { |
| | | _config = JSON.parse(JSON.stringify((Source.baseConfig))) |
| | | } |
| | |
| | | * @description 组件销毁,清除state更新 |
| | | */ |
| | | componentWillUnmount () { |
| | | this.setState = (state, callback) => { |
| | | this.setState = () => { |
| | | return |
| | | } |
| | | } |
| | | |
| | | // 页面返回 |
| | | handleViewBack = () => { |
| | | const {menu, editTab} = this.props |
| | | let param = { |
| | | editMenu: menu, |
| | | editTab: editTab, |
| | | editAction: '', |
| | | subConfig: '', |
| | | tabview: editTab ? editTab.Template : menu.LongParam.Template |
| | | } |
| | | |
| | | this.props.handleView(param) |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | cancelConfig = () => { |
| | | const { menu, config, originConfig } = this.state |
| | | const { config, originConfig } = this.state |
| | | let _this = this |
| | | |
| | | let isOrigin = config.fields.filter(item => item.origin).length > 0 |
| | |
| | | okText: this.state.dict['header.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | _this.props.handleConfig(menu.type) |
| | | _this.handleViewBack() |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | closeVisible: true |
| | | }) |
| | | } else { |
| | | this.props.handleConfig(menu.type) |
| | | this.handleViewBack() |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | render () { |
| | | const { menu, config } = this.state |
| | | const { config } = this.state |
| | | |
| | | return ( |
| | | <div className="modal-form-board"> |
| | |
| | | onCancel={() => { this.setState({closeVisible: false}) }} |
| | | footer={[ |
| | | <Button key="save" className="mk-btn mk-green" loading={this.state.closeloading} onClick={this.submitConfig}>{this.state.dict['header.save']}</Button>, |
| | | <Button key="confirm" className="mk-btn mk-yellow" onClick={() => {this.props.handleConfig(menu.type)}}>{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 |