king
2021-10-21 1da6506bf58270bacc2a4345002c6b082835580e
src/views/rolemanage/index.jsx
@@ -35,6 +35,7 @@
        render: (text, record) => (
          <div>
            <Button type="link" onClick={() => this.deleteMenu(record)} style={{color: '#ff4d4f'}}>删除</Button>
            <Button type="link" onClick={() => this.jumpApp(record)} style={{color: '#1890ff', marginLeft: '5px'}}>编辑</Button>
          </div>
        ),
      },
@@ -47,7 +48,8 @@
    targetKeys: [],
    trees: null,
    expandedKeys: [],
    searchkey: ''
    searchkey: '',
    appViewList: []
  }
  oriTrees = null
@@ -58,6 +60,7 @@
    this.setState({app: param}, () => {
      this.getTreeList()
      this.getMenuList()
      this.getAppViewList()
    })
  }
@@ -68,6 +71,25 @@
    this.setState = () => {
      return
    }
  }
  getAppViewList = () => {
    const { app } = this.state
    Api.getSystemConfig({
      func: 's_get_keyids',
      bid: app.ID
    }).then(result => {
      if (!result.status) {
        notification.warning({
          top: 92,
          message: result.message,
          duration: 5
        })
        return
      }
      this.setState({appViewList: result.data || []})
    })
  }
  getMenuList = (reset) => {
@@ -97,10 +119,12 @@
              try {
                let pageParam = JSON.parse(window.decodeURIComponent(window.atob(item.menus_rolelist)))
                item.nodes = pageParam
                if (pageParam.type === 'navbar') {
                if (pageParam.login) {
                  item.nodes = ''
                } else if (pageParam.type === 'navbar') {
                  item.type = 'navbar'
                }
              } catch {
              } catch (e) {
                item.nodes = ''
              }
            }
@@ -315,7 +339,7 @@
  }
  deleteMenu = (record) => {
    const { app } = this.state
    const { app, appViewList } = this.state
    const _this = this
    let param = {
@@ -330,6 +354,26 @@
      param.MenuID = param.MenuID + ',' + record.nodes.popviews.join(',')
    }
    let _param = {
      func: 's_kei_link_keyids_addupt',
      BID: app.ID,
      exec_type: 'y',
      LText: ''
    }
    let _appViewList = appViewList.filter(item => item.keys_id !== record.MenuID)
    if (appViewList.length !== _appViewList.length) {
      _param.LText = _appViewList.map(item => `select '${item.keys_id}','${item.keys_type}','${item.kei_no}','${item.appkey}','${item.bid}','${sessionStorage.getItem('CloudUserID')}','${item.remark}'`)
      _param.LText = _param.LText.join(' union all ')
      _param.LText = Utils.formatOptions(_param.LText)
      _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
      _param.secretkey = Utils.encrypt('', _param.timestamp)
    } else {
      _param = null
    }
    confirm({
      content: '确定删除该菜单吗?',
      onOk() {
@@ -342,6 +386,20 @@
                duration: 3
              })
              _this.getMenuList(true)
              if (_param) {
                Api.getCloudConfig(_param).then(res => {
                  if (!res.status) {
                    notification.warning({
                      top: 92,
                      message: res.message,
                      duration: 5
                    })
                  } else {
                    _this.setState({appViewList: _appViewList})
                  }
                })
              }
            } else {
              notification.warning({
                top: 92,
@@ -414,10 +472,12 @@
                  try {
                    let pageParam = JSON.parse(window.decodeURIComponent(window.atob(item.menus_rolelist)))
                    item.nodes = pageParam
                    if (pageParam.type === 'navbar') {
                    if (pageParam.login) {
                      item.nodes = ''
                    } else if (pageParam.type === 'navbar') {
                      item.type = 'navbar'
                    }
                  } catch {
                  } catch (e) {
                    item.nodes = ''
                  }
                }
@@ -741,6 +801,17 @@
    this.setState({ visible: true, targetKeys: [] })
  }
  jumpApp = (item) => {
    const { app } = this.state
    let route = 'mobdesign'
    if (app.typename === 'pc') {
      route = 'pcdesign'
    }
    window.open(window.location.href.replace(/#.+/ig, `#/${route}/${window.btoa(window.encodeURIComponent(JSON.stringify({...app, MenuID: item.MenuID, type: 'app'})))}`))
  }
  render () {
    const { app, loading, columns, menulist, trees, searchkey } = this.state
    let _menulist = menulist
@@ -775,8 +846,8 @@
            </div>
            <div className="right-view">
              <div className="app-action">
                <Button className="mk-primary" onClick={this.initTree}>初始化</Button>
                <Button className="mk-purple" onClick={this.syncTree}>同步</Button>
                <Button className="mk-primary" onClick={this.initTree}>同步</Button>
                {/* <Button className="mk-purple" onClick={this.syncTree}>同步</Button> */}
                <Button className="mk-green save" onClick={this.saveTree}>保存</Button>
              </div>
              {trees && trees.length ? <Tree