king
2020-04-29 9b6ce1a5778c6e1a813237e87588c0052aae1bbb
src/components/sidemenu/index.jsx
@@ -4,11 +4,13 @@
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 Utils from '@/utils/utils.js'
import Api from '@/api'
import './index.scss'
@@ -47,7 +49,7 @@
      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'
@@ -55,6 +57,8 @@
    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: [],
@@ -163,26 +167,26 @@
      notification.warning({
        top: 92,
        message: result.message,
        duration: 10
        duration: 5
      })
    }
  }
  enterManageView = () => {
    let menulist = [{
      MenuID: Utils.getuuid(),
      text: '配置',
      PageParam: {Icon: 'folder'},
      children: [{
        src: '',
        PageParam: {OpenType: 'newtab', Template: 'ManageTable'},
        type: 'ManageTable',
        MenuID: '1581067625930haged11ieaivpavv77k',
        MenuNo: 'sDatasM',
        MenuName: '数据字典',
        text: '数据字典'
      }]
    }]
  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),
@@ -217,8 +221,8 @@
  }
  UNSAFE_componentWillReceiveProps (nextProps) {
    if (nextProps.mainMenu && nextProps.mainMenu.MenuID === 'systemManageView') {
      this.enterManageView()
    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)