king
2021-08-06 992f25d08ea2b5a6438ccc792a5c723b8a72f674
src/tabviews/custom/index.jsx
@@ -130,7 +130,8 @@
      // 权限过滤
      let roleId = sessionStorage.getItem('role_id') || '' // 角色ID
      config.components = this.filterComponent(config.components, roleId, permAction, permMenus)
      let balMap = new Map()
      config.components = this.filterComponent(config.components, roleId, permAction, permMenus, balMap)
      
      // 获取主搜索条件
      let mainSearch = []
@@ -190,7 +191,11 @@
        })
      }
      config.components = this.formatSetting(config.components, params, mainSearch, inherit, regs)
      config.components = this.formatSetting(config.components, params, mainSearch, inherit, regs, balMap)
      if ([...balMap.keys()].length > 0) {
        config.components = this.filterBalcony(config.components, balMap)
      }
      this.setState({
        BID: BID,
@@ -439,7 +444,7 @@
    })
  }
  filterComponent = (components, roleId, permAction, permMenus) => {
  filterComponent = (components, roleId, permAction, permMenus, balMap) => {
    return components.filter(item => {
      
      if (item.style && item.style.boxShadow) {
@@ -470,7 +475,7 @@
        })
        item.subtabs = item.subtabs.map(tab => {
          tab.components = this.filterComponent(tab.components, roleId, permAction, permMenus)
          tab.components = this.filterComponent(tab.components, roleId, permAction, permMenus, balMap)
          return tab
        })
@@ -493,7 +498,7 @@
          return false
        }
        item.components = this.filterComponent(item.components, roleId, permAction, permMenus)
        item.components = this.filterComponent(item.components, roleId, permAction, permMenus, balMap)
      } else if (['pie', 'bar', 'line', 'dashboard', 'scatter'].includes(item.type)) {
        if (
          item.plot.blacklist && item.plot.blacklist.length > 0 &&
@@ -638,6 +643,10 @@
          })
        })
      } else if (item.type === 'balcony') {
        if (item.wrap.linkType === 'sync') {
          item.wrap.syncModuleId = item.wrap.syncModule.pop()
          balMap.set(item.wrap.syncModuleId, true)
        }
        item.elements = item.elements.filter(cell => {
          if (cell.eleType === 'button') {
            cell.logLabel = item.$menuname + '-' + cell.label
@@ -729,6 +738,45 @@
    })
  }
  filterBalcony = (components, balMap) => {
    return components.filter(item => {
      if (item.type === 'tabs') {
        item.subtabs = item.subtabs.map(tab => {
          tab.components = this.filterBalcony(tab.components, balMap)
          return tab
        })
      } else if (item.type === 'group') {
        item.components = this.filterBalcony(item.components, balMap)
      }
      if (item.type === 'balcony' && item.wrap.linkType === 'sync') {
        let conf = balMap.get(item.wrap.syncModuleId)
        if (!conf || conf === true) {
          return false
        }
        item.syncConfig = {
          uuid: conf.uuid,
          wrap: conf.wrap,
          setting: conf.setting,
          columns: conf.columns
        }
        if (item.wrap.checkAll === 'show') {
          if (conf.subtype === 'datacard' && conf.wrap.cardType !== 'checkbox') {
            item.wrap.checkAll = 'hidden'
          } else if (conf.subtype === 'normaltable' && conf.wrap.tableType !== 'checkbox') {
            item.wrap.checkAll = 'hidden'
          }
        }
      }
      return true
    })
  }
  getPrinter = (item, parentId) => {
    let _item = window.GLOB.UserCacheMap.get(parentId + item.uuid)
@@ -748,17 +796,17 @@
  }
  // 格式化默认设置
  formatSetting = (components, params, mainSearch, inherit, regs) => {
  formatSetting = (components, params, mainSearch, inherit, regs, balMap) => {
    return components.map(component => {
      if (component.type === 'tabs') {
        component.subtabs = component.subtabs.map(tab => {
          tab.components = this.formatSetting(tab.components, [], [], inherit, regs)
          tab.components = this.formatSetting(tab.components, [], [], inherit, regs, balMap)
          tab = {...tab, ...inherit}
          return tab
        })
        return component
      } else if (component.type === 'group') {
        component.components = this.formatSetting(component.components, [], [], inherit, regs)
        component.components = this.formatSetting(component.components, [], [], inherit, regs, balMap)
        component = {...component, ...inherit}
        return component
      }
@@ -844,6 +892,11 @@
        }
      } else if (component.floor === 1) {
        component.setting.sync = 'false'
      }
      if (balMap.has(component.uuid)) {
        component.setting.$hasSyncModule = true
        balMap.set(component.uuid, component)
      }
      return component
@@ -1012,7 +1065,7 @@
      } else if (item.type === 'balcony') {
        return (
          <Col span={item.width} key={item.uuid}>
            <Balcony menu={config} config={item} data={data} BID={_bid} menuType={menuType} />
            <Balcony config={item} data={data} BID={_bid} menuType={menuType} />
          </Col>
        )
      } else if (item.type === 'carousel' && item.subtype === 'datacard') {