king
2022-08-15 5d41cbe3722ff40b65bfa4de82d62a79f171f5a5
src/tabviews/custom/components/tree/antd-tree/index.jsx
@@ -16,11 +16,9 @@
class NormalTree extends Component {
  static propTpyes = {
    BID: PropTypes.any,              // 父级Id
    data: PropTypes.array,           // 统一查询数据
    config: PropTypes.object,        // 组件配置信息
    mainSearch: PropTypes.any,       // 外层搜索条件
    menuType: PropTypes.any,         // 菜单类型
  }
  state = {
@@ -38,10 +36,22 @@
  }
  UNSAFE_componentWillMount () {
    const { config, data, initdata, BID } = this.props
    const { config, data, initdata } = this.props
    let _config = fromJS(config).toJS()
    let _data = null
    let _sync = config.setting.sync === 'true'
    let BID = ''
    let BData = ''
    if (_config.setting.supModule) {
      BData = window.GLOB.CacheData.get(_config.setting.supModule)
    } else {
      BData = window.GLOB.CacheData.get(_config.$pageId)
    }
    if (BData) {
      BID = BData.$BID || ''
    }
    if (config.setting.sync === 'true' && data) {
      _data = data[config.dataName] || []
@@ -146,22 +156,30 @@
        })
        return
      } else if (result.run_type) {
        this.setState({timer})
        let repeats = config.timerRepeats || 0
        this.setState({timer, repeats})
        this.timer = setTimeout(() => {
          this.timerTask()
          this.timerTask(repeats)
        }, timer)
      }
    })
  }
  timerTask = () => {
    const { timer } = this.state
  timerTask = (times) => {
    const { timer, repeats } = this.state
    if (!timer) return
    
    this.loadData(true)
    if (repeats) {
      times = times - 1
      if (times <= 0) {
        clearTimeout(this.timer)
        return
      }
    }
    this.timer = setTimeout(() => {
      this.timerTask()
      this.timerTask(times)
    }, timer)
  }
@@ -188,7 +206,7 @@
   * @description 数据加载
   */
  async loadData (hastimer) {
    const { mainSearch, menuType } = this.props
    const { mainSearch } = this.props
    const { config, arr_field, BID } = this.state
    if (config.setting.supModule && !BID) { // BID 不存在时,不做查询
@@ -214,7 +232,7 @@
    }
    let _orderBy = config.setting.order || ''
    let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, '', '', BID, menuType)
    let param = UtilsDM.getQueryDataParams(config.setting, arr_field, searches, _orderBy, '', '', BID)
    let result = await Api.genericInterface(param)
    if (result.status) {