| | |
| | | class SubTableConfig extends Component { |
| | | static propTpyes = { |
| | | config: PropTypes.object, |
| | | menu: PropTypes.any, |
| | | handleConfig: PropTypes.func, |
| | | handleSubConfig: PropTypes.func, |
| | | supMenuList: PropTypes.array |
| | |
| | | */ |
| | | UNSAFE_componentWillMount () { |
| | | const { config } = this.props |
| | | console.log(config) |
| | | |
| | | let _config = null |
| | | |
| | | if (!config || config.create) { |
| | |
| | | }) |
| | | } |
| | | |
| | | changeTemplate = () => { |
| | | this.props.handleConfig('template') |
| | | } |
| | | // changeTemplate = () => { |
| | | // this.props.handleConfig('template') |
| | | // } |
| | | |
| | | /** |
| | | * @description 标签页保存 |
| | |
| | | duration: 2 |
| | | }) |
| | | if (this.state.closeVisible) { |
| | | this.props.handleConfig('') |
| | | let view = this.props.menu ? this.props.menu.type : '' |
| | | this.props.handleConfig(view) |
| | | } else { |
| | | this.setState({ |
| | | menuloading: false, |
| | |
| | | okText: this.state.dict['header.confirm'], |
| | | cancelText: this.state.dict['header.cancel'], |
| | | onOk() { |
| | | _this.props.handleConfig('') |
| | | let view = _this.props.menu ? _this.props.menu.type : '' |
| | | _this.props.handleConfig(view) |
| | | }, |
| | | onCancel() {} |
| | | }) |
| | |
| | | closeVisible: true |
| | | }) |
| | | } else { |
| | | this.props.handleConfig('') |
| | | let view = this.props.menu ? this.props.menu.type : '' |
| | | this.props.handleConfig(view) |
| | | } |
| | | }, () => { |
| | | this.setState({ |
| | |
| | | /** |
| | | * @description 设置可配置按钮 |
| | | */ |
| | | setSubConfig = (btn, type) => { |
| | | setSubConfig = (btn) => { |
| | | const { config, originConfig } = this.state |
| | | |
| | | let isAdd = false |
| | |
| | | message: '菜单配置已修改,请保存!', |
| | | duration: 10 |
| | | }) |
| | | } else if (type === 'button') { |
| | | } else { |
| | | this.setState({ |
| | | loading: true |
| | | }) |
| | |
| | | _LongParam = '' |
| | | } |
| | | } |
| | | this.props.handleSubConfig(btn, '', _LongParam, type) |
| | | this.props.handleSubConfig(btn, config, _LongParam, 'tabButton') |
| | | } else { |
| | | this.setState({ |
| | | loading: false |
| | |
| | | }) |
| | | } |
| | | }) |
| | | } else if (type === 'tab') { |
| | | this.props.handleSubConfig(btn, '', '', type) |
| | | // this.setState({ |
| | | // loading: true |
| | | // }) |
| | | // Api.getSystemConfig({ |
| | | // func: 'sPC_Get_LongParam', |
| | | // MenuID: btn.uuid |
| | | // }).then(res => { |
| | | // if (res.status) { |
| | | // this.setState({ |
| | | // loading: false |
| | | // }) |
| | | // let _LongParam = '' |
| | | // if (res.LongParam) { |
| | | // _LongParam = window.decodeURIComponent(window.atob(res.LongParam)) |
| | | // try { |
| | | // _LongParam = JSON.parse(_LongParam) |
| | | // } catch (e) { |
| | | // _LongParam = '' |
| | | // } |
| | | // } |
| | | // this.props.handleSubConfig(btn, '', _LongParam) |
| | | // } else { |
| | | // this.setState({ |
| | | // loading: false |
| | | // }) |
| | | // notification.warning({ |
| | | // top: 92, |
| | | // message: res.message, |
| | | // duration: 10 |
| | | // }) |
| | | // } |
| | | // }) |
| | | } |
| | | }, () => { |
| | | notification.warning({ |
| | |
| | | this.setState({ |
| | | showColumnName: !showColumnName |
| | | }) |
| | | } |
| | | |
| | | dontsave = () => { |
| | | let view = this.props.menu ? this.props.menu.type : '' |
| | | this.props.handleConfig(view) |
| | | } |
| | | |
| | | render () { |
| | |
| | | icon={item.icon} |
| | | style={{marginBottom: '10px'}} |
| | | className={'mk-btn mk-' + item.class} |
| | | onClick={() => this.setSubConfig(item, 'button')} |
| | | onClick={() => this.setSubConfig(item)} |
| | | >{item.label}</Button> |
| | | </div> |
| | | ) |
| | |
| | | <Card title={this.state.dict['header.menu.page.configurable']} bordered={false} extra={ |
| | | <div> |
| | | <Switch className="big" checkedChildren="启" unCheckedChildren="停" defaultChecked={this.state.config.enabled} onChange={this.onEnabledChange} /> |
| | | <Button type="primary" onClick={this.changeTemplate}>{this.state.dict['header.menu.template.change']}</Button> |
| | | {/* <Button type="primary" onClick={this.changeTemplate}>{this.state.dict['header.menu.template.change']}</Button> */} |
| | | <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{this.state.dict['header.save']}</Button> |
| | | <Button onClick={this.cancelConfig}>{this.state.dict['header.return']}</Button> |
| | | </div> |
| | |
| | | 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.dontsave}>{this.state.dict['header.notsave']}</Button>, |
| | | <Button key="cancel" onClick={() => { this.setState({closeVisible: false}) }}>{this.state.dict['header.cancel']}</Button> |
| | | ]} |
| | | destroyOnClose |