king
2023-08-16 7e46c386be5c2cfc20af3936d26839ad3fce44b0
src/views/design/sidemenu/index.jsx
@@ -1,12 +1,10 @@
import React, {Component} from 'react'
import { connect } from 'react-redux'
import { is, fromJS } from 'immutable'
import { Menu, Popover, Modal, notification } from 'antd'
import { EditOutlined, PlusOutlined, SettingOutlined } from '@ant-design/icons'
import moment from 'moment'
import asyncComponent from '@/utils/asyncComponent'
import { resetEditLevel } from '@/store/action'
import Utils from '@/utils/utils.js'
import Api from '@/api'
import MKEmitter from '@/utils/events.js'
@@ -46,8 +44,15 @@
    menu = fromJS(menu).toJS()
    let openKey = ''
    if (menu.children[0]) {
      openKey = menu.openId || menu.children[0].MenuID
    // 菜单更新时,展开原二级菜单
    if (this.props.mainMenu && menu.MenuID === this.props.mainMenu.MenuID && this.state.openKeys && this.state.openKeys[0]) {
      openKey = this.state.openKeys[0]
      if (menu.children.filter(m => m.MenuID === openKey).length === 0) {
        openKey = ''
      }
    }
    if (!openKey && menu.children[0]) {
      openKey = menu.children[0].MenuID
    }
    this.setState({
@@ -102,6 +107,8 @@
  }
  editmenu = (cell) => {
    if (window.GLOB.systemType === 'production') return
    if (cell.type === 'CustomPage') {
      let _param = {
        MenuType: 'custom',
@@ -112,7 +119,7 @@
      }
      _param = window.btoa(window.encodeURIComponent(JSON.stringify(_param)))
      window.open(`#/menudesign/${_param}`)
    } else if (['CommonTable', 'TreePage', 'CalendarPage'].includes(cell.type)) {
    } else if (['CommonTable', 'TreePage'].includes(cell.type)) {
      sessionStorage.setItem('menuTree', JSON.stringify(this.props.menuTree))
      let _param = window.btoa(window.encodeURIComponent(JSON.stringify(cell)))
@@ -193,7 +200,7 @@
      this.setState({
        loading: true
      })
      Api.getSystemConfig(param).then(res => {
      Api.getCloudConfig(param).then(res => {
        if (res.status) {
          this.setState({
            loading: false,
@@ -253,7 +260,7 @@
        loading: true
      })
      Api.getSystemConfig(param).then(response => {
      Api.getCloudConfig(param).then(response => {
        if (response.status) {
          this.setState({
            loading: false,
@@ -300,7 +307,7 @@
                key={item.MenuID}
                title={
                  <span className={!editLevel && index === 0 ? 'edit-control' : ''}>
                    <MkIcon type={item.PageParam.Icon} />
                    <MkIcon type={item.PageParam ? item.PageParam.Icon : 'folder'} />
                    <span>{item.MenuName}</span>
                  </span>
                }
@@ -340,6 +347,7 @@
            menulist={this.state.editMenu.children}
            supMenuList={mainMenu.children}
            supMenu={this.state.editMenu}
            menuTree={this.props.menuTree}
            exitEdit={this.exitEdit}
          /> : null
        }
@@ -360,7 +368,7 @@
        <Modal
          title="修改菜单"
          visible={thdVisible}
          width={600}
          width={700}
          onOk={this.thdSubmit}
          confirmLoading={loading}
          onCancel={() => {this.setState({thdVisible: false})}}
@@ -377,18 +385,4 @@
  }
}
const mapStateToProps = (state) => {
  return {
    mainMenu: state.mainMenu,
    menuTree: state.menuTree,
    editLevel: state.editLevel
  }
}
const mapDispatchToProps = (dispatch) => {
  return {
    resetEditLevel: (level) => dispatch(resetEditLevel(level))
  }
}
export default connect(mapStateToProps, mapDispatchToProps)(Sidemenu)
export default Sidemenu