king
2020-12-04 d441fa1e1cc80f4ea462a750a42a2b25c1f2b202
src/tabviews/subtable/index.jsx
@@ -144,30 +144,20 @@
        config.action = config.action.filter(item => permAction[item.uuid])
      }
      let roleId = sessionStorage.getItem('role_id') || '' // 角色ID
      // 字段权限黑名单
      config.search = config.search.map(item => {
        item.oriInitval = item.initval
        if (!item.blacklist || item.blacklist.length === 0) return item
        let _black = item.blacklist.filter(v => {
          return this.props.permRoles.indexOf(v) !== -1
        })
        if (_black.length > 0) {
        if (item.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
          item.Hide = 'true'
        }
        return item
      })
      config.columns = config.columns.map(col => {
        if (!col.field || !col.blacklist || col.blacklist.length === 0 || config.setting.primaryKey === col.field) return col
        let _black = col.blacklist.filter(v => {
          return this.props.permRoles.indexOf(v) !== -1
        })
        if (_black.length > 0) {
        if (!col.blacklist || col.blacklist.length === 0) return col
        if (col.blacklist.filter(v => roleId.indexOf(v) > -1).length > 0) {
          col.Hide = 'true'
        }
@@ -178,16 +168,7 @@
      config.charts = config.charts.filter(item => {
        if (item.Hide === 'true') return false
        if (!item.blacklist || item.blacklist.length === 0) return true
        let _black = item.blacklist.filter(v => {
          return this.props.permRoles.indexOf(v) !== -1
        })
        if (_black.length > 0 || item.Hide === 'true') {
          return false
        } else {
          return true
        }
        return item.blacklist.filter(v => roleId.indexOf(v) > -1).length === 0
      })
      if (config.charts.length <= 1) {
@@ -339,7 +320,7 @@
          config.setting.dataresource = '(' + config.setting.dataresource + ') tb'
        }
  
        if (this.props.dataManager) { // 数据权限
        if (sessionStorage.getItem('dataM') === 'true') { // 数据权限
          config.setting.dataresource = config.setting.dataresource.replace(/\$@/ig, '/*')
          config.setting.dataresource = config.setting.dataresource.replace(/@\$/ig, '*/')
          config.setting.customScript = config.setting.customScript.replace(/\$@/ig, '/*')
@@ -428,7 +409,7 @@
    })
    let _orderBy = orderBy || setting.order
    let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, _BID, this.props.menuType, this.props.dataManager)
    let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, _BID, this.props.menuType)
    this.handleTableId()
@@ -477,7 +458,7 @@
    })
    let _orderBy = orderBy || setting.order
    let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, this.props.menuType, this.props.dataManager, id)
    let param = UtilsDM.getQueryDataParams(setting, arr_field, searches, _orderBy, pageIndex, pageSize, BID, this.props.menuType, id)
    if (param.func === 'sPC_Get_TableData') {
      param.menuname = this.props.Tab.label || ''
@@ -551,7 +532,7 @@
    }
    let _orderBy = orderBy || setting.order
    let param = UtilsDM.getStatQueryDataParams(setting, statFields, searches, _orderBy, _BID, this.props.menuType, this.props.dataManager)
    let param = UtilsDM.getStatQueryDataParams(setting, statFields, searches, _orderBy, _BID, this.props.menuType)
    if (param.func === 'sPC_Get_TableData') {
      param.menuname = this.props.Tab.label || ''
@@ -770,7 +751,6 @@
            dict={this.state.dict}
            searchlist={searchlist}
            menuType={this.props.menuType}
            dataManager={this.props.dataManager}
            refreshdata={this.refreshbysearch}
          /> : null
        }
@@ -883,9 +863,7 @@
    tabviews: state.tabviews,
    menuType: state.editLevel,
    permAction: state.permAction,
    permRoles: state.permRoles,
    permMenus: state.permMenus,
    dataManager: state.dataManager,
  }
}