| | |
| | | } |
| | | |
| | | UNSAFE_componentWillMount () { |
| | | if (sessionStorage.getItem('thdMenuList') && sessionStorage.getItem('fstMenuList')) { |
| | | this.setMenus() |
| | | } else { |
| | | this.getMenus() |
| | | } |
| | | } |
| | | |
| | | setMenus = () => { |
| | | const { MenuId, config } = this.props |
| | | |
| | | let menulist = sessionStorage.getItem('fstMenuList') |
| | | let thdMenuList = sessionStorage.getItem('thdMenuList') |
| | | |
| | | menulist = JSON.parse(menulist) |
| | | thdMenuList = JSON.parse(thdMenuList) |
| | | |
| | | let thdMenu = null |
| | | |
| | | thdMenuList.forEach(trd => { |
| | | if (MenuId === trd.MenuID) { |
| | | thdMenu = trd |
| | | } |
| | | }) |
| | | |
| | | let smenulist = [] |
| | | |
| | | if (thdMenu) { |
| | | menulist.forEach(item => { |
| | | if (item.MenuID === thdMenu.FstId) { |
| | | smenulist = item.children |
| | | } |
| | | }) |
| | | } |
| | | |
| | | this.props.updateConfig({...config, fstMenuId: thdMenu ? thdMenu.FstId : ''}) |
| | | |
| | | this.setState({ |
| | | fstMenuId: thdMenu ? thdMenu.FstId : '', |
| | | menulist, |
| | | smenulist |
| | | }, () => { |
| | | this.props.form.setFieldsValue({ |
| | | fstMenuId: thdMenu ? thdMenu.FstId : '', |
| | | parentId: thdMenu ? thdMenu.ParentId : '' |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | getMenus = () => { |
| | | const { MenuId, config } = this.props |
| | | |
| | | Api.getSystemConfig({func: 's_get_pc_menus', systemType: options.sysType, debug: 'Y'}).then(result => { |
| | | if (result.status) { |
| | | let thdMenu = null |
| | |
| | | value: trd.MenuID, |
| | | label: trd.MenuName, |
| | | type: 'CommonTable', |
| | | // disabled: trd.MenuID === MenuId |
| | | disabled: false |
| | | } |
| | | |
| | | if (MenuId === trd.MenuID) { |
| | | thdMenu = trdItem |
| | | } |
| | | |
| | | if (trd.PageParam) { |
| | |
| | | } catch (e) { |
| | | |
| | | } |
| | | } |
| | | |
| | | if (MenuId === trd.MenuID) { |
| | | thdMenu = trdItem |
| | | } |
| | | |
| | | thdMenuList.push(trdItem) |
| | |
| | | }) |
| | | |
| | | let smenulist = [] |
| | | menulist.forEach(item => { |
| | | if (thdMenu && (item.MenuID === thdMenu.FstId)) { |
| | | smenulist = item.children |
| | | } |
| | | }) |
| | | if (thdMenu) { |
| | | menulist.forEach(item => { |
| | | if (item.MenuID === thdMenu.FstId) { |
| | | smenulist = item.children |
| | | } |
| | | }) |
| | | } |
| | | sessionStorage.setItem('fstMenuList', JSON.stringify(menulist)) |
| | | sessionStorage.setItem('thdMenuList', JSON.stringify(thdMenuList)) |
| | | this.props.updateConfig({...config, fstMenuId: thdMenu ? thdMenu.FstId : ''}) |