king
2022-01-21 46f79b491173d284a4900d19e7aecf7509481438
src/views/rolemanage/index.jsx
@@ -34,7 +34,15 @@
        align: 'center',
        render: (text, record) => (
          <div>
            <Button type="link" onClick={() => this.deleteMenu(record)} style={{color: '#ff4d4f'}}>删除</Button>
            {record.type !== 'none' ?
              <Button type="link" onClick={() => this.deleteMenu(record)} style={{color: '#ff4d4f'}}>删除</Button> :
              <Button type="link" onClick={() => {
                notification.warning({
                  top: 92,
                  message: '当前系统菜单尚未创建。',
                  duration: 5
                })
              }} style={{color: '#ff4d4f', opacity: '0.5'}}>删除</Button>}
            <Button type="link" onClick={() => this.jumpApp(record)} style={{color: '#1890ff', marginLeft: '5px'}}>编辑</Button>
          </div>
        ),
@@ -55,6 +63,7 @@
  oriTrees = null
  UNSAFE_componentWillMount() {
    document.body.className = ''
    let param = JSON.parse(window.decodeURIComponent(window.atob(this.props.match.params.param)))
    this.setState({app: param}, () => {
@@ -111,26 +120,48 @@
    Api.getCloudConfig(param).then(result => {
      if (result.status) {
        this.setState({
          menulist: result.menus.map(item => {
            item.nodes = ''
            item.type = 'view'
            if (item.menus_rolelist) {
              try {
                let pageParam = JSON.parse(window.decodeURIComponent(window.atob(item.menus_rolelist)))
                item.nodes = pageParam
                if (pageParam.login) {
                  item.nodes = ''
                } else if (pageParam.type === 'navbar') {
                  item.type = 'navbar'
                }
              } catch (e) {
        let ub = app.user_binding === 'true' && app.userbind ? false : true
        let im = app.instantMessage ? false : true
        let menus = result.menus.map(item => {
          item.nodes = ''
          item.type = 'view'
          if (item.menus_rolelist) {
            try {
              let pageParam = JSON.parse(window.decodeURIComponent(window.atob(item.menus_rolelist)))
              item.nodes = pageParam
              if (pageParam.login) {
                item.nodes = ''
              } else if (pageParam.type === 'navbar') {
                item.type = 'navbar'
              } else if (pageParam.type === 'im') {
                item.type = 'im'
                item.nodes = ''
              }
            } catch (e) {
              item.nodes = ''
            }
            return item
          })
          }
          if (!ub && app.userbind === item.MenuID) {
            ub = true
          }
          if (!im && app.instantMessage === item.MenuID) {
            im = true
          }
          return item
        })
        if (!im) {
          menus.push({nodes: '', type: 'none', MenuID: app.instantMessage, MenuName: '即时通信'})
        }
        if (!ub) {
          menus.push({nodes: '', type: 'none', MenuID: app.userbind, MenuName: '用户绑定'})
        }
        this.setState({
          menulist: menus
        }, () => {
          if (reset && (!this.oriTrees || this.oriTrees.length === 0)) {
            this.initMenutree()
@@ -808,6 +839,18 @@
    if (app.typename === 'pc') {
      route = 'pcdesign'
    }
    if (item.type === 'navbar') {
      notification.warning({
        top: 92,
        message: '导航栏不可单独编辑,请在含有导航栏的页面中修改。',
        duration: 5
      })
      return
    }
    if (app.instantMessage && item.MenuID === app.instantMessage) {
      route = 'imdesign'
    }
    window.open(window.location.href.replace(/#.+/ig, `#/${route}/${window.btoa(window.encodeURIComponent(JSON.stringify({...app, MenuID: item.MenuID, type: 'app'})))}`))
  }