king
2022-08-15 5d41cbe3722ff40b65bfa4de82d62a79f171f5a5
src/tabviews/custom/index.jsx
@@ -73,11 +73,11 @@
   * @description 获取页面配置信息
   */
  async loadconfig () {
    const { permAction } = this.props
    const { permAction, MenuID } = this.props
    let _param = {
      func: 'sPC_Get_LongParam',
      MenuID: this.props.MenuID
      MenuID: MenuID
    }
    let result = await Api.getCacheConfig(_param)
@@ -140,7 +140,9 @@
      let skip = config.permission === 'false' || window.GLOB.mkHS
      let param = this.props.param || {} // url参数
      config.components = this.filterComponent(config.components, roleId, permAction, balMap, skip, param)
      window.GLOB.CacheData.set(MenuID, param)
      config.components = this.filterComponent(config.components, roleId, permAction, balMap, skip, param, MenuID)
      
      // 获取主搜索条件
      let mainSearch = []
@@ -443,8 +445,9 @@
    })
  }
  filterComponent = (components, roleId, permAction, balMap, skip, urlparam) => {
  filterComponent = (components, roleId, permAction, balMap, skip, urlparam, pageId) => {
    return components.filter(item => {
      item.$pageId = pageId
      
      if (item.style && item.style.boxShadow) {
        delete item.style.hShadow
@@ -526,21 +529,11 @@
        }
        item.subtabs = item.subtabs.map(tab => {
          tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam)
          tab.$pageId = pageId
          tab.components = this.filterComponent(tab.components, roleId, permAction, balMap, skip, urlparam, pageId)
          return tab
        })
        let supIds = []
        item.subtabs.forEach(tab => {
          tab.components.forEach(comp => {
            if (comp.type === 'tabs' && comp.parentIds) {
              supIds.push(...comp.parentIds)
            } else if (comp.setting && comp.setting.supModule) {
              supIds.push(comp.setting.supModule)
            }
          })
        })
        item.parentIds = supIds
        return true
      } else if (item.type === 'group') {
@@ -551,7 +544,7 @@
          return false
        }
        item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam)
        item.components = this.filterComponent(item.components, roleId, permAction, balMap, skip, urlparam, pageId)
        return true
      } else if (['pie', 'bar', 'line', 'dashboard', 'scatter', 'chart'].includes(item.type)) {
@@ -1183,6 +1176,23 @@
    }
    MKEmitter.removeListener('reloadMenuView', this.reloadMenuView)
    MKEmitter.removeListener('resetActiveMenu', this.resetActiveMenu)
    window.GLOB.CacheData.delete(this.props.MenuID)
    this.deleteCache(this.state.config.components)
  }
  deleteCache = (components) => {
    components.forEach(item => {
      if (item.type === 'tabs') {
        item.subtabs.forEach(tab => {
          this.deleteCache(tab.components)
        })
      } else if (item.type === 'group') {
        this.deleteCache(item.components)
      } else {
        window.GLOB.CacheData.delete(item.uuid)
      }
    })
  }
  reloadview = () => {
@@ -1211,51 +1221,46 @@
    if (!config || !config.components) return
    return config.components.map(item => {
      let _bid = BID
      if (item.setting && item.setting.supModule) {
        _bid = ''
      }
      if (item.type === 'bar' || item.type === 'line') {
        return (
          <Col span={item.width} key={item.uuid}>
            <AntvBarAndLine config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
            <AntvBarAndLine config={item} data={data} mainSearch={mainSearch}/>
          </Col>
        )
      } else if (item.type === 'pie') {
        return (
          <Col span={item.width} key={item.uuid}>
            <AntvPie config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
            <AntvPie config={item} data={data} mainSearch={mainSearch}/>
          </Col>
        )
      } else if (item.type === 'scatter') {
        return (
          <Col span={item.width} key={item.uuid}>
            <AntvScatter config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
            <AntvScatter config={item} data={data} mainSearch={mainSearch}/>
          </Col>
        )
      } else if (item.type === 'dashboard') {
        return (
          <Col span={item.width} key={item.uuid}>
            <AntvDashboard config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
            <AntvDashboard config={item} data={data} mainSearch={mainSearch}/>
          </Col>
        )
      } else if (item.type === 'form' && item.subtype === 'simpleform') {
        return (
          <Col span={item.width} key={item.uuid}>
            <SimpleForm config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
            <SimpleForm config={item} data={data} mainSearch={mainSearch}/>
          </Col>
        )
      } else if (item.type === 'form' && item.subtype === 'stepform') {
        return (
          <Col span={item.width} key={item.uuid}>
            <StepForm config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
            <StepForm config={item} data={data} mainSearch={mainSearch}/>
          </Col>
        )
      } else if (item.type === 'form' && item.subtype === 'tabform') {
        return (
          <Col span={item.width} key={item.uuid}>
            <TabForm config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
            <TabForm config={item} data={data} mainSearch={mainSearch}/>
          </Col>
        )
      } else if (item.type === 'search') {
@@ -1267,97 +1272,97 @@
      } else if (item.type === 'tabs') {
        return (
          <Col span={item.width} key={item.uuid}>
            <AntvTabs config={item} BID={BID} mainSearch={mainSearch} />
            <AntvTabs config={item} mainSearch={mainSearch} />
          </Col>
        )
      } else if (item.type === 'card' && item.subtype === 'datacard') {
        return (
          <Col span={item.width} key={item.uuid}>
            <DataCard config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
            <DataCard config={item} data={data} mainSearch={mainSearch}/>
          </Col>
        )
      } else if (item.type === 'card' && item.subtype === 'propcard') {
        return (
          <Col span={item.width} key={item.uuid}>
            <PropCard config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
            <PropCard config={item} data={data} mainSearch={mainSearch}/>
          </Col>
        )
      } else if (item.type === 'balcony') {
        return (
          <Col span={item.width} key={item.uuid}>
            <Balcony config={item} data={data} BID={_bid}/>
            <Balcony config={item} data={data}/>
          </Col>
        )
      } else if (item.type === 'timeline') {
        return (
          <Col span={item.width} key={item.uuid}>
            <TimeLine config={item} data={data} BID={_bid}/>
            <TimeLine config={item} data={data} mainSearch={mainSearch}/>
          </Col>
        )
      } else if (item.type === 'carousel' && item.subtype === 'datacard') {
        return (
          <Col span={item.width} key={item.uuid}>
            <CarouselDataCard config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
            <CarouselDataCard config={item} data={data} mainSearch={mainSearch}/>
          </Col>
        )
      } else if (item.type === 'carousel' && item.subtype === 'propcard') {
        return (
          <Col span={item.width} key={item.uuid}>
            <CarouselPropCard config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
            <CarouselPropCard config={item} data={data} mainSearch={mainSearch}/>
          </Col>
        )
      } else if (item.type === 'table' && item.subtype === 'tablecard') {
        return (
          <Col span={item.width} key={item.uuid}>
            <TableCard config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
            <TableCard config={item} data={data} mainSearch={mainSearch}/>
          </Col>
        )
      } else if (item.type === 'table' && item.subtype === 'normaltable') {
        return (
          <Col span={item.width} key={item.uuid}>
            <NormalTable config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
            <NormalTable config={item} data={data} mainSearch={mainSearch}/>
          </Col>
        )
      } else if (item.type === 'table' && item.subtype === 'editable') {
        return (
          <Col span={item.width} key={item.uuid}>
            <EditTable config={item} BID={_bid} mainSearch={mainSearch}/>
            <EditTable config={item} mainSearch={mainSearch}/>
          </Col>
        )
      } else if (item.type === 'group' && item.subtype === 'normalgroup') {
        return (
          <Col span={item.width} key={item.uuid}>
            <NormalGroup config={item} BID={_bid} mainSearch={mainSearch}/>
            <NormalGroup config={item} mainSearch={mainSearch}/>
          </Col>
        )
      } else if (item.type === 'editor') {
        return (
          <Col span={item.width} key={item.uuid}>
            <BraftEditor config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
            <BraftEditor config={item} data={data} mainSearch={mainSearch}/>
          </Col>
        )
      } else if (item.type === 'tree') {
        return (
          <Col span={item.width} key={item.uuid}>
            <NormalTree config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
            <NormalTree config={item} data={data} mainSearch={mainSearch}/>
          </Col>
        )
      } else if (item.type === 'code') {
        return (
          <Col span={item.width} key={item.uuid}>
            <SandBox config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
            <SandBox config={item} data={data} mainSearch={mainSearch}/>
          </Col>
        )
      } else if (item.type === 'chart') {
        return (
          <Col span={item.width} key={item.uuid}>
            <CustomChart config={item} data={data} BID={_bid} mainSearch={mainSearch}/>
            <CustomChart config={item} data={data} mainSearch={mainSearch}/>
          </Col>
        )
      } else if (item.type === 'module' && item.subtype === 'voucher') {
        return (
          <Col span={item.width} key={item.uuid}>
            <Voucher config={item} BID={_bid} />
            <Voucher config={item}/>
          </Col>
        )
      } else {