king
2021-08-26 e9c48bd7356462ba9257540b130a47a65ad1861d
src/components/breadview/index.jsx
@@ -1,16 +1,18 @@
import React, {Component} from 'react'
import {connect} from 'react-redux'
import { is, fromJS } from 'immutable'
import { BackTop, Breadcrumb, Icon} from 'antd'
import { BackTop, Breadcrumb, Icon, notification} from 'antd'
import moment from 'moment'
import 'moment/locale/zh-cn'
import asyncComponent from '@/utils/asyncLoadComponent'
import NotFount from '@/components/404'
import options from '@/store/options.js'
import mzhCN from '@/locales/zh-CN/main.js'
import menUS from '@/locales/en-US/main.js'
import MKEmitter from '@/utils/events.js'
import { initActionPermission } from '@/store/action'
import Api from '@/api'
import './index.scss'
const Home = asyncComponent(() => import('@/tabviews/home'))
@@ -34,14 +36,59 @@
  state = {
    tabview: null, // 标签
    dict: sessionStorage.getItem('lang') !== 'en-US' ? mzhCN : menUS,
    hasNavBar: window.GLOB.navBar !== 'linkage'
    hasNavBar: window.GLOB.navBar === 'linkage_navigation'
  }
  refreshTabview = () => {
    const { tabview } = this.state
    window.GLOB.CacheMap = new Map()
    MKEmitter.emit('reloadMenuView', tabview.MenuID)
    if (options.sysType === 'local' && window.GLOB.systemType !== 'production') {
      let roledefer = new Promise(resolve => {
        Api.getSystemConfig({
          func: 's_Get_TrdMenu_Role',
          edition_type: 'A',
          pro_sys: ''
        }).then(result => {
          if (!result) return
          if (!result.status) {
            notification.error({
              top: 92,
              message: result.message,
              duration: 10
            })
          } else {
            let _permAction = {loaded: true} // 按钮权限
            if (result.UserRoles_Menu) {
              result.UserRoles_Menu.forEach(menu => {
                if (!menu.MenuID) return
                _permAction[menu.MenuID] = true
              })
            }
            this.props.initActionPermission(_permAction)
          }
          resolve()
        })
      })
      // 获取主菜单参数
      let menudefer = new Promise(resolve => {
        Api.getAppVersion().then(() => {
          resolve()
        }, () => {
          resolve()
        })
      })
      Promise.all([roledefer, menudefer]).then(() => {
        MKEmitter.emit('reloadMenuView', tabview.MenuID)
      })
    } else {
      MKEmitter.emit('reloadMenuView', tabview.MenuID)
    }
  }
  selectcomponent = (view) => {
@@ -154,8 +201,10 @@
  }
}
const mapDispatchToProps = () => {
  return {}
const mapDispatchToProps = (dispatch) => {
  return {
    initActionPermission: (permAction) => dispatch(initActionPermission(permAction)),
  }
}
export default connect(mapStateToProps, mapDispatchToProps)(BreadView)