| | |
| | | import {connect} from 'react-redux' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Menu, Icon, notification } from 'antd' |
| | | |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import {modifyTabview, resetEditLevel} from '@/store/action' |
| | | import { modifyTabview, resetEditLevel } from '@/store/action' |
| | | import { SySMenuList } from './config' |
| | | import options from '@/store/options.js' |
| | | import zhCN from '@/locales/zh-CN/header.js' |
| | | import enUS from '@/locales/en-US/header.js' |
| | | import Api from '@/api' |
| | |
| | | return |
| | | } |
| | | |
| | | let _param = {func: 'sPC_Get_FunMenu', ParentID: menu.MenuID} |
| | | let _param = {func: 'sPC_Get_FunMenu', ParentID: menu.MenuID, systemType: options.systemType} |
| | | |
| | | if (sessionStorage.getItem('isEditState') === 'true') { // 编辑状态时,获取菜单,增加参数debug |
| | | _param.debug = 'Y' |
| | |
| | | |
| | | let result = await Api.getSystemConfig(_param) |
| | | if (result.status) { |
| | | if (this.props.editState && this.props.editLevel) return |
| | | |
| | | if (result.data.length === 0) { // 查询菜单为空 |
| | | this.setState({ |
| | | subMenulist: [], |
| | |
| | | notification.warning({ |
| | | top: 92, |
| | | message: result.message, |
| | | duration: 10 |
| | | duration: 5 |
| | | }) |
| | | } |
| | | } |
| | | |
| | | enterManageView = (type) => { |
| | | let menulist = SySMenuList[type] |
| | | |
| | | if (window.GLOB.systemType === 'official') { |
| | | menulist.forEach(menu => { |
| | | menu.children = menu.children.filter(item => item.systems && item.systems.includes(window.GLOB.systemType)) |
| | | }) |
| | | |
| | | menulist = menulist.filter(menu => menu.children.length > 0) |
| | | } else { |
| | | menulist.forEach(menu => { |
| | | menu.children = menu.children.filter(item => !item.systems || item.systems.includes(options.systemType)) |
| | | }) |
| | | } |
| | | |
| | | this.setState({ |
| | | subMenulist: menulist, |
| | | rootSubmenuKeys: menulist.map(item => item.MenuID), |
| | | openKeys: this.props.collapse ? [] : [menulist[0].MenuID] |
| | | }) |
| | | } |
| | | |
| | | changemenu(e) { |
| | | if (this.props.editState) { |
| | | if (this.props.editState && this.props.editLevel !== 'level4') { |
| | | e.preventDefault() |
| | | return |
| | | } |
| | |
| | | } |
| | | |
| | | UNSAFE_componentWillReceiveProps (nextProps) { |
| | | if (!is(fromJS(this.props.mainMenu), fromJS(nextProps.mainMenu))) { |
| | | if (!is(fromJS(this.props.mainMenu), fromJS(nextProps.mainMenu)) && nextProps.mainMenu && nextProps.mainMenu.MenuID === 'systemManageView') { |
| | | this.enterManageView(nextProps.mainMenu.MenuID) |
| | | } else if (!is(fromJS(this.props.mainMenu), fromJS(nextProps.mainMenu))) { |
| | | // 主菜单切换,请求2、3级菜单数据 |
| | | this.loadsubmenu(nextProps.mainMenu) |
| | | } else if (nextProps.collapse && this.props.collapse !== nextProps.collapse) { |