| | |
| | | initVal: 'folder', |
| | | required: true, |
| | | options: [{ |
| | | id: 'folder', |
| | | MenuID: 'folder', |
| | | text: 'folder' |
| | | }, { |
| | | id: 'api', |
| | | MenuID: 'api', |
| | | text: 'api' |
| | | }] |
| | | } |
| | | ], |
| | | tlevel: [ |
| | | { |
| | | type: 'select', |
| | | key: 'parentId', |
| | | label: this.props.dict['header.menu.supMenu'], |
| | | initVal: '', |
| | | required: true, |
| | | options: [] |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'menuName', |
| | | label: this.props.dict['header.menu.menuName'], |
| | | initVal: '', |
| | | required: true, |
| | | readonly: false |
| | | }, |
| | | { |
| | | type: 'text', |
| | | key: 'menuNo', |
| | | label: this.props.dict['header.menu.menuNo'], |
| | | initVal: '', |
| | | required: true, |
| | | readonly: false |
| | | } |
| | | ] |
| | | } |
| | |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | if (nextProps.options.visible && !is(fromJS(this.props.options), fromJS(nextProps.options))) { |
| | | console.log(nextProps.options) |
| | | this.resetform(nextProps.options) |
| | | } |
| | | } |
| | |
| | | if (!options.visible) return |
| | | |
| | | let formlist = JSON.parse(JSON.stringify(this.state.menuform[options.level])) |
| | | |
| | | if (options.type === 'add') { |
| | | if (options.type === 'add' && options.level === 'slevel') { |
| | | this.setState({ |
| | | formlist: formlist.map(item =>{ |
| | | if (item.key === 'parentId') { |
| | |
| | | return item |
| | | }) |
| | | }) |
| | | } else { |
| | | } else if (options.type === 'add' && options.level === 'tlevel') { |
| | | this.setState({ |
| | | formlist: formlist.map(item =>{ |
| | | if (item.key === 'parentId') { |
| | | item.initVal = options.parentMenu.MenuID |
| | | item.options = options.supMenuList |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | } else if (options.type === 'edit' && options.level === 'slevel') { |
| | | this.setState({ |
| | | formlist: formlist.map(item => { |
| | | if (item.key === 'parentId') { |
| | | item.initVal = options.parentMenu.MenuID |
| | | item.options = options.supMenuList |
| | | } else if (item.key === 'menuName') { |
| | | item.initVal = options.menu.MenuNameP |
| | | item.initVal = options.menu.text |
| | | } else if (item.key === 'icon') { |
| | | item.initVal = options.menu.PageParam.Icon |
| | | } |
| | | return item |
| | | }) |
| | | }) |
| | | } else if (options.type === 'edit' && options.level === 'tlevel') { |
| | | this.setState({ |
| | | formlist: formlist.map(item => { |
| | | if (item.key === 'parentId') { |
| | | item.initVal = options.parentMenu.MenuID |
| | | item.options = options.supMenuList |
| | | } else if (item.key === 'menuName') { |
| | | item.initVal = options.menu.text |
| | | } else if (item.key === 'menuNo') { |
| | | item.initVal = options.menu.MenuNo |
| | | } |
| | | return item |
| | | }) |
| | |
| | | })( |
| | | <Select |
| | | showSearch |
| | | filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | filterOption={(input, option) => option.props.children[2].toLowerCase().indexOf(input.toLowerCase()) >= 0} |
| | | onChange={(value) => {this.openTypeChange(item.key, value)}} |
| | | getPopupContainer={() => document.getElementById('form-box')} |
| | | > |
| | | {item.options.map(option => |
| | | <Select.Option id={option.id} title={option.text} key={option.id} value={option.id}> |
| | | <Select.Option id={option.MenuID} title={option.text} key={option.MenuID} value={option.MenuID}> |
| | | {item.key === 'icon' && <Icon type={option.text} />} {option.text} |
| | | </Select.Option> |
| | | )} |
| | |
| | | Icon: values.icon |
| | | }) |
| | | }) |
| | | } else { |
| | | } else if (this.props.options.type === 'edit' && this.props.options.level === 'slevel') { |
| | | resolve({ |
| | | ParentID: values.parentId, |
| | | MenuID: this.props.options.menu.ParentID, |
| | | MenuID: this.props.options.menu.MenuID, |
| | | MenuName: values.menuName, |
| | | PageParam: JSON.stringify({ |
| | | Icon: values.icon |
| | | }) |
| | | }) |
| | | } else if (this.props.options.type === 'add' && this.props.options.level === 'tlevel') { |
| | | resolve({ |
| | | ParentID: values.parentId, |
| | | MenuID: this.props.options.menu.MenuID, |
| | | MenuName: values.menuName, |
| | | PageParam: JSON.stringify({ |
| | | Icon: values.icon |
| | | }) |
| | | }) |
| | | } else if (this.props.options.type === 'edit' && this.props.options.level === 'tlevel') { |
| | | resolve({ |
| | | ParentID: values.parentId, |
| | | MenuID: this.props.options.menu.MenuID, |
| | | MenuName: values.menuName, |
| | | MenuNo: values.menuNo, |
| | | PageParam: JSON.stringify({ |
| | | Icon: values.icon |
| | | }) |
| | | }) |
| | | } |
| | | } else { |
| | | reject(err) |