| | |
| | | supMenuList: PropTypes.any // 表格数据 |
| | | } |
| | | |
| | | state = {} |
| | | state = { |
| | | menu: null |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | this.setState({ |
| | | menu: this.props.menu |
| | | }) |
| | | } |
| | | |
| | | changeMenu = (val) => { |
| | | const { menu } = this.state |
| | | |
| | | let submenu = menu.fstMenuList.filter(item => item.MenuID === val)[0] |
| | | |
| | | if (submenu) { |
| | | this.setState({ |
| | | menu: {...menu, supMenuList: submenu.options} |
| | | }, () => { |
| | | this.props.form.setFieldsValue({ParentID: submenu.options[0] ? submenu.options[0].MenuID : ''}) |
| | | }) |
| | | } |
| | | } |
| | | |
| | | handleConfirm = () => { |
| | | // 表单提交时检查输入值是否正确 |
| | |
| | | |
| | | render() { |
| | | const { getFieldDecorator } = this.props.form |
| | | const { menu } = this.state |
| | | const formItemLayout = { |
| | | labelCol: { |
| | | xs: { span: 24 }, |
| | |
| | | sm: { span: 16 } |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <Form {...formItemLayout} style={{paddingRight: '20px'}}> |
| | | <Row gutter={24}> |
| | | <Col span={24}> |
| | | <Form.Item label={'上级菜单'}> |
| | | <Form.Item label={'一级菜单'}> |
| | | {getFieldDecorator('fstMenuId', { |
| | | initialValue: menu.fstMenuId, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | | message: this.props.dict['form.required.select'] + '上级菜单!' |
| | | } |
| | | ] |
| | | })( |
| | | <Select |
| | | showSearch |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onChange={this.changeMenu} |
| | | > |
| | | {menu.fstMenuList.map(option => |
| | | <Select.Option id={option.MenuID} title={option.text} key={option.MenuID} value={option.MenuID}>{option.text}</Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | | </Form.Item> |
| | | </Col> |
| | | <Col span={24}> |
| | | <Form.Item label={'二级菜单'}> |
| | | {getFieldDecorator('ParentID', { |
| | | initialValue: this.props.menu.ParentID, |
| | | initialValue: menu.ParentID, |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | showSearch |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | > |
| | | {this.props.supMenuList.map(option => |
| | | <Select.Option id={option.id} title={option.text} key={option.id} value={option.id}>{option.text}</Select.Option> |
| | | {menu.supMenuList.map(option => |
| | | <Select.Option id={option.MenuID} title={option.text} key={option.MenuID} value={option.MenuID}>{option.text}</Select.Option> |
| | | )} |
| | | </Select> |
| | | )} |
| | |
| | | <Col span={24}> |
| | | <Form.Item label={'菜单名称'}> |
| | | {getFieldDecorator('MenuName', { |
| | | initialValue: this.props.menu.MenuName || '', |
| | | initialValue: menu.MenuName || '', |
| | | rules: [ |
| | | { |
| | | required: true, |
| | |
| | | <Col span={24}> |
| | | <Form.Item label={'菜单参数'}> |
| | | {getFieldDecorator('MenuNo', { |
| | | initialValue: this.props.menu.MenuNo || '', |
| | | initialValue: menu.MenuNo || '', |
| | | rules: [ |
| | | { |
| | | required: true, |