king
2021-09-01 31ec63f0419895876cbaba99637a884a32d33d0d
src/components/header/index.jsx
@@ -4,33 +4,28 @@
import {connect} from 'react-redux'
import { is, fromJS } from 'immutable'
import moment from 'moment'
import { Dropdown, Menu, Icon, Modal, Form, notification, Switch, Button, Input, Badge } from 'antd'
import { Dropdown, Menu, Icon, Modal, Form, notification, Switch, Input, Badge } from 'antd'
import asyncComponent from '@/utils/asyncComponent'
import {
  toggleCollapse,
  modifyMenuTree,
  modifyMainMenu,
  modifyTabview,
  resetState,
  resetEditState,
  resetEditLevel,
  initActionPermission,
  initMenuPermission,
  logout
} from '@/store/action'
import Api from '@/api'
import MKEmitter from '@/utils/events.js'
import options from '@/store/options.js'
import zhCN from '@/locales/zh-CN/main.js'
import enUS from '@/locales/en-US/main.js'
import Utils from '@/utils/utils.js'
import avatar from '@/assets/img/avatar.jpg'
import MainLogo from '@/assets/img/main-logo.png'
import Resetpwd from './resetpwd'
import LoginForm from './loginform'
import './index.scss'
const EditMenu = asyncComponent(() => import('@/templates/menuconfig/editfirstmenu'))
const { confirm } = Modal
const { Search } = Input
@@ -41,7 +36,7 @@
  state = {
    menulist: null, // 一级菜单
    visible: false, // 修改密码模态框
    dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
    confirmLoading: false,
    userName: sessionStorage.getItem('User_Name'),
    logourl: window.GLOB.mainlogo,
@@ -53,15 +48,15 @@
    thdMenuList: [],
    oriVersion: '',
    newVersion: '',
    debug: sessionStorage.getItem('debug') === 'true'
    debug: sessionStorage.getItem('debug') === 'true',
    navBar: ['linkage_navigation', 'linkage', 'menu_board', 'menu_board_navigation'].includes(window.GLOB.navBar) ? 'topmenu' : '',
    menuType: window.GLOB.navBar
  }
  handleCollapse = () => {
    // 展开、收起左侧菜单栏
    if (!this.props.editState) {
      this.props.toggleCollapse(!this.props.collapse)
      localStorage.setItem('collapse', !this.props.collapse)
    }
    this.props.toggleCollapse(!this.props.collapse)
    localStorage.setItem('collapse', !this.props.collapse)
  }
  changePassword = () => {
@@ -133,49 +128,10 @@
  changeMenu (value) {
    // 主菜单切换
    if (this.props.editState && this.props.editLevel) {
      // 编辑状态下,不可切换菜单
      return
    }
    if (value.PageParam.OpenType === 'menu') {
    if (value.OpenType === 'outpage' && value.linkUrl) {
      window.open(value.linkUrl)
    } else if (value.OpenType === 'menu') {
      this.props.modifyMainMenu(value)
    } else if (value.PageParam.OpenType === 'outpage') {
      window.open(value.PageParam.linkUrl)
    }
  }
  async loadmenu () {
    // 获取主菜单
    let _param = {func: 's_get_pc_menus', systemType: options.sysType}
    if (sessionStorage.getItem('isEditState') === 'true') { // 编辑状态时,增加参数debug
      _param.debug = 'Y'
    }
    if (options.sysType !== 'cloud' && window.GLOB.systemType !== 'production') {
      _param.linkurl = window.GLOB.linkurl
    }
    _param.pro_sys = window.GLOB.systemType === 'production' ? 'Y' : ''
    let result = await Api.getSystemConfig(_param)
    // 登录超时
    if (!result) return
    if (result.status) {
      const { menulist } = this.getMenulist(result)
      this.setState({
        menulist,
        systems: []
      })
      this.props.modifyMenuTree(menulist)
      this.props.modifyMainMenu(menulist[0] || null)
    } else {
      notification.error({
        top: 92,
        message: result.message,
        duration: 10
      })
    }
  }
@@ -188,7 +144,7 @@
        edition_type: 'A',
        pro_sys: window.GLOB.systemType === 'production' ? 'Y' : ''
      }).then(result => {
        let _permAction = {} // 按钮权限
        let _permAction = {loaded: true} // 按钮权限
        if (result && result.status) {
          if (result.UserRoles_Menu) {
@@ -213,9 +169,6 @@
    // 获取主菜单参数
    let menudefer = new Promise(resolve => {
      let _param = {func: 's_get_pc_menus', systemType: options.sysType}
      if (options.sysType !== 'cloud' && window.GLOB.systemType !== 'production') {
        _param.linkurl = window.GLOB.linkurl
      }
      _param.pro_sys = window.GLOB.systemType === 'production' ? 'Y' : ''
      
      Api.getSystemConfig(_param).then(result => {
@@ -262,7 +215,7 @@
        this.props.modifyMenuTree(menulist)
        this.props.modifyMainMenu(mainMenu)
        this.props.initMenuPermission(thdMenuList)
        this.props.initMenuPermission([...thdMenuList, {MenuID: 'home_page_id', EasyCode: '', MenuName: 'home', type: 'CustomPage'}])
        resolve(_menu)
      })
@@ -273,14 +226,19 @@
        let tabs = fromJS(this.props.tabviews).toJS()
        let menu = fromJS(response[1]).toJS()
        tabs = tabs.map(tab => {
          tab.selected = false
          return tab
        })
        if (this.state.navBar === 'topmenu') {
          menu.selected = true
          this.props.modifyTabview([menu])
        } else {
          tabs = tabs.map(tab => {
            tab.selected = false
            return tab
          })
        menu.selected = true
        tabs.push(menu)
        this.props.modifyTabview(tabs)
          menu.selected = true
          tabs.push(menu)
          this.props.modifyTabview(tabs)
        }
      }
    })
  }
@@ -293,14 +251,18 @@
      let fstItem = {
        MenuID: fst.MenuID,
        MenuName: fst.MenuName,
        PageParam: {OpenType: 'menu', linkUrl: ''},
        OpenType: 'menu',
        children: []
      }
      if (fst.PageParam) {
        try {
          fstItem.PageParam = JSON.parse(fst.PageParam)
        } catch (e) {
          fstItem.PageParam = {OpenType: 'menu', linkUrl: ''}
          fstItem.PageParam = null
        }
        if (fstItem.PageParam && fstItem.PageParam.OpenType === 'outpage' && fstItem.PageParam.linkUrl) {
          fstItem.OpenType = 'outpage'
          fstItem.linkUrl = fstItem.PageParam.linkUrl
        }
      }
@@ -333,6 +295,7 @@
            debug: sessionStorage.getItem('debug'),
            role_id: sessionStorage.getItem('role_id'),
            mainlogo: window.GLOB.mainlogo,
            navBar: window.GLOB.navBar || '',
            mstyle: window.GLOB.style
          }
@@ -343,16 +306,17 @@
                ParentId: snd.MenuID,
                MenuID: trd.MenuID,
                MenuName: trd.MenuName,
                ParentNames: [fst.MenuName, snd.MenuName],
                MenuNo: trd.MenuNo,
                EasyCode: trd.EasyCode,
                type: 'CommonTable',            // 默认值为常用表
                OpenType: 'newtab'              // 打开方式
                type: 'CommonTable',
                OpenType: 'newtab',
                hidden: 'false'
              }
  
              if (trd.LinkUrl && iframes.includes(trd.LinkUrl.split('?')[0])) {
                trdItem.type = 'iframe'
                trdItem.LinkUrl = trd.LinkUrl
                trdItem.forbidden = true
                trdItem.LinkUrl = trd.LinkUrl.replace('&', '&')
              } else {
                try {
                  trdItem.PageParam = trd.PageParam ? JSON.parse(trd.PageParam) : {OpenType: 'newtab'}
@@ -362,10 +326,8 @@
                trdItem.type = trdItem.PageParam.Template || trdItem.type
                trdItem.OpenType = trdItem.PageParam.OpenType || trdItem.OpenType
                trdItem.hidden = trdItem.PageParam.hidden || trdItem.hidden
                if (trdItem.type === 'CustomPage' && this.props.memberLevel < 20) { // 会员等级大于等于20时,有编辑权限
                  trdItem.forbidden = true
                }
                if (trdItem.type === 'NewPage') {
                  trdItem.src = trdItem.PageParam.url || ''
                  
@@ -379,7 +341,7 @@
                      _param.Full_Name = sessionStorage.getItem('Full_Name')
                      trdItem.src = _url + window.btoa(window.encodeURIComponent(JSON.stringify(_param)))
                    } catch {
                    } catch (e) {
                      console.warn('菜单参数解析错误!')
                    }
                  }
@@ -398,6 +360,8 @@
            })
          }
          sndItem.children = sndItem.children.filter(item => item.hidden !== 'true')
          return sndItem
        })
      }
@@ -408,83 +372,25 @@
    return { menulist, thdMenuList }
  }
  reload = () => {
    this.loadmenu()
  }
  changeEditState = (state) => {
    if (!state) { // 退出编辑,页面刷新
      window.location.reload()
      return
    }
  changeEditState = () => {
    // 修改编辑状态
    let UserID = sessionStorage.getItem('CloudUserID')
    let LoginUID = sessionStorage.getItem('CloudLoginUID')
    if (!UserID || !LoginUID) {
      this.setState({
        loginVisible: true
      })
    } else {
      sessionStorage.setItem('isEditState', 'true')
      sessionStorage.setItem('role_id', sessionStorage.getItem('cloudRole_id'))
      sessionStorage.setItem('dataM', sessionStorage.getItem('cloudDataM'))
      sessionStorage.setItem('isEditState', 'true')
      if (window.GLOB.systemType === 'production') {
        this.props.resetEditLevel('HS')
        this.props.modifyMainMenu({
          MenuID: 'systemManageView'
        })
        this.setState({
          userName: sessionStorage.getItem('CloudUserName'),
          avatar: Utils.getrealurl(sessionStorage.getItem('CloudAvatar'))
        })
        this.props.resetEditState(state)
        return
      }
      this.setState({
        menulist: null,
        userName: sessionStorage.getItem('CloudUserName'),
        avatar: Utils.getrealurl(sessionStorage.getItem('CloudAvatar'))
      })
      this.loadmenu()
      this.props.modifyMenuTree([])
      this.props.modifyMainMenu(null)
      this.props.resetEditState(state)
    }
      this.props.modifyTabview([])
    if (window.GLOB.systemType !== 'production') {
      Api.getSystemConfig({func: 'sPC_Get_Roles_sModular'}).then(res => {
        if (res.status) {
          let _permFuncField = []
          let _sysRoles = []
          if (res.Roles && res.Roles.length > 0) {
            _sysRoles = res.Roles.map(role => {
              return {
                uuid: Utils.getuuid(),
                value: role.RoleID,
                text: role.RoleName
              }
            })
          }
          if (res.sModular && res.sModular.length > 0) {
            res.sModular.forEach(field => {
              if (field.ModularNo) {
                _permFuncField.push(field.ModularNo)
              }
            })
            _permFuncField = _permFuncField.sort()
          }
          sessionStorage.setItem('sysRoles', JSON.stringify(_sysRoles))
          sessionStorage.setItem('permFuncField', JSON.stringify(_permFuncField))
        }
      })
      this.props.history.replace('/design')
    }
  }
@@ -507,34 +413,18 @@
          sessionStorage.setItem('dataM', res.dataM ? 'true' : '')
          sessionStorage.setItem('isEditState', 'true')
          if (window.GLOB.systemType === 'production') {
            this.props.resetEditLevel('HS')
            this.props.modifyMainMenu({
              MenuID: 'systemManageView'
            })
            this.setState({
              loginVisible: false,
              loginLoading: false,
              userName: res.UserName,
              avatar: res.icon
            })
            this.props.resetEditState(true)
            return
          }
          this.setSystemFuncs()
          this.setState({
            menulist: null,
            loginVisible: false,
            loginLoading: false,
            userName: res.UserName,
            avatar: res.icon
          })
          this.loadmenu()
          this.props.modifyMenuTree([])
          this.props.modifyMainMenu(null)
          this.props.resetEditState(true)
          this.props.modifyTabview([])
          this.props.history.replace('/design')
        } else {
          if (res.message.indexOf('密码错误') > -1) {
            const input = document.getElementById('password')
            input && input.select()
          }
          this.setState({
            loginLoading: false
          })
@@ -548,41 +438,105 @@
    })
  }
  enterEdit = () => {
    // 进入编辑状态
    this.props.resetEditLevel('level1')
  }
  enterEditManage = () => {
    const { editLevel } = this.props
    if (editLevel === 'HS')  return
    this.props.resetEditLevel('HS')
    this.props.modifyMainMenu({
      MenuID: 'systemManageView'
  setSystemFuncs = () => {
    if (!window.GLOB.WebSql && !window.GLOB.IndexDB) {
      return
    }
    this.getfuncTime().then(res => {
      Api.getSystemFuncs(res.createDate).then(result => {
        if (!result.status) {
          notification.error({
            top: 92,
            message: result.message,
            duration: 10
          })
          return
        } else if (result.func_detail && result.func_detail.length > 0) {
          this.writeFuncs(result.func_detail)
        }
      })
    })
  }
  /**
   * @description 退出管理界面菜单
   */
  exitManage = () => {
    const { menulist } = this.state
  writeFuncs = (funcs) => {
    let timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
    if (window.GLOB.systemType === 'production') { // 正式系统版本升级后,页面刷新
      window.location.reload()
      return
    let sys_datetime = sessionStorage.getItem('sys_datetime')
    let app_datetime = sessionStorage.getItem('app_datetime')
    if (sys_datetime && app_datetime) {
      let seconds = Math.floor((new Date().getTime() - app_datetime) / 1000)
      timestamp = moment(sys_datetime, 'YYYY-MM-DD HH:mm:ss').add(seconds, 'seconds').format('YYYY-MM-DD HH:mm:ss')
    }
    this.props.modifyMainMenu(menulist[0] || null)
    this.props.resetEditLevel(false)
    this.props.modifyTabview([])
    if (window.GLOB.WebSql) {
      window.GLOB.WebSql.transaction(tx => {
        tx.executeSql('DELETE FROM FUNCS')
        funcs.forEach(item => {
          if (!item.key_sql) return
          tx.executeSql('INSERT INTO FUNCS (func_code, key_sql) VALUES (?, ?)', [item.func_code, item.key_sql])
        })
        tx.executeSql(`UPDATE VERSIONS SET createDate='${timestamp}' where CDefine1='funcs'`)
      })
    } else {
      let objectStore = window.GLOB.IndexDB.transaction(['funcs'], 'readwrite').objectStore('funcs')
      objectStore.clear()
      funcs.forEach(item => {
        if (!item.key_sql) return
        item.id = item.func_code
        objectStore.add(item)
      })
      let funcStore = window.GLOB.IndexDB.transaction(['version'], 'readwrite').objectStore('version')
      funcStore.put({id: 'funcs', version: '1.0', createDate: timestamp})
    }
  }
  exitEdit = () => {
    // 退出编辑状态
    this.props.resetEditLevel(false)
  getfuncTime = () => {
    return new Promise((resolve, reject) => {
      if (window.GLOB.WebSql) {
        window.GLOB.WebSql.transaction(tx => {
          tx.executeSql("SELECT * FROM VERSIONS where CDefine1='funcs'", [], (tx, results) => {
            let rows = results.rows
            if (rows.length === 0) {
              tx.executeSql('DELETE FROM FUNCS')
              tx.executeSql('INSERT INTO VERSIONS (version, createDate, CDefine1) VALUES (?, ?, ?)', ['1.0', '1970-01-01 14:59:09.000', 'funcs'])
              resolve({createDate: '1970-01-01 14:59:09.000'})
            } else {
              resolve(rows[0])
            }
          }, (tx, results) => {
            reject()
            console.warn(results)
          })
        })
      } else {
        let objectStore = window.GLOB.IndexDB.transaction(['version'], 'readwrite').objectStore('version')
        let request = objectStore.get('funcs')
        request.onerror = (event) => {
          console.warn(event)
          reject()
        }
        request.onsuccess = () => {
          if (request.result) {
            resolve(request.result)
          } else {
            let add = objectStore.add({id: 'funcs', version: '1.0', createDate: '1970-01-01 14:59:09.000'})
            add.onerror = () => {
              reject()
            }
            add.onsuccess = () => {
              resolve({id: 'funcs', version: '1.0', createDate: '1970-01-01 14:59:09.000'})
            }
          }
        }
      }
    })
  }
  changeSystem = (system) => {
@@ -625,26 +579,6 @@
      }
    })
  }
  selectMenu = (item) => {
    let tabs = fromJS(this.props.tabviews).toJS()
    let menu = fromJS(item).toJS()
    menu.selected = true
    tabs = tabs.filter(tab => {
      tab.selected = false
      return tab.MenuID !== menu.MenuID
    })
    if (this.props.tabviews.length !== tabs.length) {
      this.props.modifyTabview(fromJS(tabs).toJS())
    }
    this.setState({}, () => {
      tabs.push(menu)
      this.props.modifyTabview(tabs)
    })
  }
  
  UNSAFE_componentWillMount () {
    // 组件加载时,获取菜单数据
@@ -662,21 +596,26 @@
  componentDidMount () {
    // 获取系统的版本信息,延时查询
    setTimeout(() => {
      new Promise((resolve, reject) => {
        Api.getAppVersion(resolve, reject)
      }).then(res => {
      Api.getAppVersion().then(res => {
        this.setState({
          oriVersion: res.oldVersion,
          newVersion: res.newVersion
        })
      }, () => {
        console.warn('websql 初始化错误!')
      })
      }, () => {})
    }, 1000)
  }
  shouldComponentUpdate (nextProps, nextState) {
    return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState))
  }
  /**
   * @description 组件销毁,清除state更新
   */
  componentWillUnmount () {
    this.setState = () => {
      return
    }
  }
  verup = () => {
@@ -688,23 +627,23 @@
      content: `最新版本${newVersion},当前版本${oriVersion}`,
      onOk() {
        return new Promise(resolve => {
          Api.updateAppVersion(newVersion).then(res => {
            if (res.status) {
              notification.success({
                top: 92,
                message: '升级成功!',
                duration: 2
              })
              _this.setState({oriVersion: newVersion})
            } else {
              notification.warning({
                top: 92,
                message: '升级失败,请刷新页面重试!',
                duration: 2
              })
            }
          if (!window.GLOB.WebSql) {
            notification.warning({
              top: 92,
              message: '升级失败,请刷新页面重试!',
              duration: 2
            })
            resolve()
          })
          } else {
            Api.updateAppVersion(newVersion)
            notification.success({
              top: 92,
              message: '升级成功!',
              duration: 2
            })
            _this.setState({oriVersion: newVersion})
            resolve()
          }
        })
      },
      onCancel() {}
@@ -721,17 +660,57 @@
    }
  }
  changeVerMenu(menu, type) {
    if (type === 'first') {
      if (menu.OpenType === 'outpage' && menu.linkUrl) {
        window.open(menu.linkUrl)
      } else if (menu.OpenType === 'menu') {
      }
    } else {
      if (menu.OpenType === 'newpage' || menu.OpenType === 'NewPage') { // NewPage为打开外部页面地址,newpage为打开系统菜单
        window.open(menu.src)
      } else if (menu.OpenType === 'blank') {
        menu.selected = true
        this.props.modifyTabview([menu])
      } else if (this.state.navBar === 'topmenu' && this.state.menuType !== 'menu_board_navigation') {
        menu.selected = true
        this.props.modifyTabview([menu])
      } else {
        let tabs = fromJS(this.props.tabviews).toJS()
        tabs = tabs.filter(tab => {
          tab.selected = false
          return tab.MenuID !== menu.MenuID
        })
        if (this.props.tabviews.length > tabs.length) {
          this.props.modifyTabview(fromJS(tabs).toJS())
        }
        this.setState({}, () => {
          menu.selected = true
          tabs.push(menu)
          this.props.modifyTabview(tabs)
        })
      }
      if (window.GLOB.systemType === 'production') {
        MKEmitter.emit('queryTrigger', {menuId: menu.MenuID, name: '菜单'})
      }
    }
  }
  render () {
    const { mainMenu, collapse } = this.props
    const { thdMenuList, searchkey, oriVersion, newVersion, debug, menulist } = this.state
    const { thdMenuList, searchkey, oriVersion, newVersion, debug, menulist, navBar, menuType } = this.state
    const menu = (
      <Menu className="header-dropdown">
        {debug && <Menu.Item key="switch">
          {this.state.dict['main.edit']}
          <Switch size="small" style={{marginLeft: '7px'}} disabled={!!this.props.editLevel} checked={this.props.editState} onChange={this.changeEditState} />
          <Switch size="small" style={{marginLeft: '7px'}} checked={false} onChange={this.changeEditState} />
        </Menu.Item>}
        {!this.props.editState ? <Menu.Item key="password" onClick={this.changePassword}>{this.state.dict['main.password']}</Menu.Item> : null}
        <Menu.Item key="password" onClick={this.changePassword}>{this.state.dict['main.password']}</Menu.Item>
        {this.state.systems.length ? <Menu.SubMenu style={{minWidth: '110px'}} title="切换系统">
          {this.state.systems.map((system, index) => (
            <Menu.Item style={{minWidth: '100px', lineHeight: '30px'}} key={'sub' + index} onClick={() => {this.changeSystem(system)}}> {system.AppName} </Menu.Item>
@@ -747,13 +726,13 @@
    return (
      <header className="header-container ant-menu-dark" id="main-header-container">
        <div className={'header-logo ' + (collapse ? 'collapse' : '')}><img src={!this.props.editState ? this.state.logourl : MainLogo} alt=""/></div>
        <div className={'header-collapse ' + (collapse ? 'collapse' : '')}>
          {menulist && menulist.length ? <Icon type={collapse ? 'menu-unfold' : 'menu-fold'} onClick={this.handleCollapse}/> : null}
        <div className={'header-logo ' + (collapse && navBar !== 'topmenu' ? 'collapse' : '')}><img src={this.state.logourl} alt=""/></div>
        <div className={'header-collapse ' + (collapse && navBar !== 'topmenu' ? 'collapse' : '')}>
          {navBar !== 'topmenu' ? <Icon type={collapse ? 'menu-unfold' : 'menu-fold'} onClick={this.handleCollapse}/> : null}
        </div>
        {/* 正常菜单 */}
        {this.props.editLevel !== 'level1' && menulist ?
          <ul className={'header-menu ' + this.props.editLevel}>{
        {navBar !== 'topmenu' && menulist ?
          <ul className="header-menu">{
            menulist.map(item => {
              return (
                <li key={item.MenuID} onClick={() => {this.changeMenu(item)}} className={mainMenu && mainMenu.MenuID === item.MenuID ? 'active' : ''}>
@@ -761,27 +740,89 @@
                </li>
              )
            })}
            {this.props.editState && (!this.props.editLevel || this.props.editLevel === 'HS') ?
              <li key="HS" onClick={this.enterEditManage} className={this.props.editLevel === 'HS' ? 'active' : ''}>
                <span>HS</span>
              </li> : null
            }
          </ul> : null
        }
        {this.props.editLevel === 'HS' ? <Button className="level4-close" type="primary" onClick={this.exitManage}>退出</Button> : null}
        {/* 进入编辑按钮 */}
        {this.props.editState && !this.props.editLevel ? <Icon onClick={this.enterEdit} className="edit-check" type="edit" /> : null}
        {this.props.editState && !this.props.editLevel && options.sysType === 'local' && window.GLOB.systemType !== 'production' ?
          <a href="#/mobmanage" target="_blank" className="mobile" type="edit"> 应用管理 <Icon type="arrow-right" /></a> : null
        {navBar === 'topmenu' && menuType !== 'menu_board' && menuType !== 'menu_board_navigation' && menulist ?
          <ul className="header-menu vertical-menu">{
            menulist.map(item => {
              if (item.children && item.children.length > 0) {
                return (
                  <Dropdown key={item.MenuID} overlayClassName="vertical-dropdown-menu" overlay={
                    <Menu mode="vertical">
                      {item.children.map(cell => {
                        if (!cell.children || cell.children.length === 0) {
                          return (
                            <Menu.Item key={cell.MenuID}>
                              {cell.MenuName}
                            </Menu.Item>
                          )
                        } else {
                          return (
                            <Menu.SubMenu popupClassName="vertical-dropdown-submenu" key={cell.MenuID} title={cell.MenuName}>
                              {cell.children.map(m => (
                                <Menu.Item key={m.MenuID} onClick={() => {this.changeVerMenu(m)}}>
                                  {m.MenuName}
                                </Menu.Item>
                              ))}
                            </Menu.SubMenu>
                          )
                        }
                      })}
                    </Menu>
                  }>
                    <li>
                      <span>{item.MenuName}</span>
                    </li>
                  </Dropdown>
                )
              } else {
                return (
                  <li key={item.MenuID} onClick={() => {this.changeVerMenu(item, 'first')}}>
                    <span>{item.MenuName}</span>
                  </li>
                )
              }
            })}
          </ul> : null
        }
        {/* window.btoa(window.encodeURIComponent(JSON.stringify({ MenuType: 'home', MenuId: 'home_page_id', MenuName: '首页' }))) */}
        {this.props.editState && !this.props.editLevel && window.GLOB.systemType !== 'production' && this.props.memberLevel >= 20 ?
          <a className="home-edit" href={`#/menudesign/JTdCJTIyTWVudVR5cGUlMjIlM0ElMjJob21lJTIyJTJDJTIyTWVudUlkJTIyJTNBJTIyaG9tZV9wYWdlX2lkJTIyJTJDJTIyTWVudU5hbWUlMjIlM0ElMjIlRTklQTYlOTYlRTklQTElQjUlMjIlN0Q=`} target="_blank" rel="noopener noreferrer">
            首页 <Icon type="arrow-right" />
          </a> : null
        {navBar === 'topmenu' && (menuType === 'menu_board' || menuType === 'menu_board_navigation') && menulist ?
          <ul className="header-menu vertical-menu">{
            menulist.map(item => {
              if (item.children && item.children.length > 0) {
                return (
                  <Dropdown key={item.MenuID} placement="bottomCenter" overlayClassName="vertical-dropdown-menu" overlay={
                    <div className="menu-board">
                      {item.children.map(cell => {
                        return (
                          <div className="menu-wrap" key={cell.MenuID}>
                            <div className="title" onClick={e => e.stopPropagation()}>{cell.MenuName}</div>
                            <div className="menu-detail">
                              {cell.children && cell.children.map(m => (
                                <div key={m.MenuID} title={m.MenuName} onClick={() => {this.changeVerMenu(m)}}>
                                  {m.MenuName}
                                </div>
                              ))}
                            </div>
                          </div>
                        )
                      })}
                    </div>
                  }>
                    <li>
                      <span>{item.MenuName}</span>
                    </li>
                  </Dropdown>
                )
              } else {
                return (
                  <li key={item.MenuID} onClick={() => {this.changeVerMenu(item, 'first')}}>
                    <span>{item.MenuName}</span>
                  </li>
                )
              }
            })}
          </ul> : null
        }
        {/* 编辑菜单 */}
        {this.props.editLevel === 'level1' ? <EditMenu menulist={this.state.menulist} reload={this.reload} exitEdit={this.exitEdit}/> : null}
        {/* 头像、用户名 */}
        <Dropdown className="header-setting" overlay={menu}>
          <div>
@@ -792,7 +833,7 @@
          </div>
        </Dropdown>
        {/* 菜单搜索 */}
        {!this.props.editState && thdMenuList.length > 0 ?
        {thdMenuList.length > 0 ?
          <Dropdown overlayClassName="menu-select-dropdown" getPopupContainer={() => document.getElementById('main-header-container')} overlay={
            <div>
              <Search
@@ -813,12 +854,12 @@
                        option.MenuNo.toLowerCase().indexOf(searchkey.toLowerCase()) >= 0 ||
                        option.EasyCode.toLowerCase().indexOf(searchkey.toLowerCase()) >= 0
                      ) {
                        return <Menu.Item key={option.MenuID} onClick={() => this.selectMenu(option)}>{option.MenuName}</Menu.Item>
                        return <Menu.Item key={option.MenuID} onClick={() => this.changeVerMenu(option)}>{option.MenuName}</Menu.Item>
                      } else {
                        return null
                      }
                    }
                    return <Menu.Item key={option.MenuID} onClick={() => this.selectMenu(option)}>{option.MenuName}</Menu.Item>
                    return <Menu.Item key={option.MenuID} onClick={() => this.changeVerMenu(option)}>{option.MenuName}</Menu.Item>
                  })}
                </Menu>
              </div>
@@ -861,10 +902,7 @@
    collapse: state.collapse,
    menuTree: state.menuTree,
    mainMenu: state.mainMenu,
    editState: state.editState,
    editLevel: state.editLevel,
    permAction: state.permAction,
    memberLevel: state.memberLevel
  }
}
@@ -874,11 +912,8 @@
    modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)),
    modifyMenuTree: (menuTree) => dispatch(modifyMenuTree(menuTree)),
    modifyMainMenu: (mainMenu) => dispatch(modifyMainMenu(mainMenu)),
    resetEditState: (state) => dispatch(resetEditState(state)),
    resetEditLevel: (level) => dispatch(resetEditLevel(level)),
    initActionPermission: (permAction) => dispatch(initActionPermission(permAction)),
    initMenuPermission: (permMenus) => dispatch(initMenuPermission(permMenus)),
    resetState: () => dispatch(resetState()),
    logout: () => dispatch(logout())
  }
}