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,87 +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: '数据字典'
      }, {
        src: '',
        PageParam: {OpenType: 'newtab', Template: 'ManageTable'},
        type: 'ManageTable',
        MenuID: '1581734956310scks442ul2d955g9tu5',
        MenuNo: 'sVersionM',
        MenuName: '传输号管理',
        text: '传输号管理'
      }, {
        src: '',
        PageParam: {OpenType: 'newtab', Template: 'ManageTable'},
        type: 'ManageTable',
        MenuID: '1583991994144ndddg0bhh0is6shi0v1',
        MenuNo: 'sVersionQueryM',
        MenuName: '传输号查询',
        text: '传输号查询'
      }, {
        src: '',
        PageParam: {OpenType: 'newtab', Template: 'ManageTable'},
        type: 'ManageTable',
        MenuID: '1583979633842550imkchl4qt4qppsiv',
        MenuNo: 'sVersionMUpgrade',
        MenuName: '版本升级',
        text: '版本升级'
      }, {
        src: '',
        PageParam: {OpenType: 'newtab', Template: 'ManageTable'},
        type: 'ManageTable',
        MenuID: '1578900109100np8aqd0a77q3na46oas',
        MenuNo: 'sPrintTemplateM',
        MenuName: '打印模板',
        text: '打印模板'
      }]
    }, {
      MenuID: Utils.getuuid(),
      text: '接口',
      PageParam: {Icon: 'folder'},
      children: [{
        src: '',
        PageParam: {OpenType: 'newtab', Template: 'ManageTable'},
        type: 'ManageTable',
        MenuID: '1582771068837vsv54a089lgp45migbg',
        MenuNo: 'KUNTitleM',
        MenuName: '接口主数据',
        text: '接口主数据'
      }, {
        src: '',
        PageParam: {OpenType: 'newtab', Template: 'ManageTable'},
        type: 'ManageTable',
        MenuID: '1582777675954ifu05upurs465omoth7',
        MenuNo: 'KUNMainM',
        MenuName: '查询接口',
        text: '查询接口'
      }, {
        src: '',
        PageParam: {OpenType: 'newtab', Template: 'ManageTable'},
        type: 'ManageTable',
        MenuID: '158294809668898cklbv6c5bou8e1fpu',
        MenuNo: 'KUNMainMOut_advanced',
        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),
@@ -279,7 +222,7 @@
  UNSAFE_componentWillReceiveProps (nextProps) {
    if (!is(fromJS(this.props.mainMenu), fromJS(nextProps.mainMenu)) && nextProps.mainMenu && nextProps.mainMenu.MenuID === 'systemManageView') {
      this.enterManageView()
      this.enterManageView(nextProps.mainMenu.MenuID)
    } else if (!is(fromJS(this.props.mainMenu), fromJS(nextProps.mainMenu))) {
      // 主菜单切换,请求2、3级菜单数据
      this.loadsubmenu(nextProps.mainMenu)