king
2021-01-25 d33d00cafeea2c4f980ea3af268d9260269edcc1
src/tabviews/subtabtable/index.jsx
@@ -75,6 +75,7 @@
      try { // 配置信息解析
        config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam)))
        config.setting.MenuName = Tab.label
      } catch (e) {
        console.warn('Parse Failure')
        config = ''
@@ -244,7 +245,7 @@
      config.setting.execute = config.setting.default !== 'false'     // 默认sql是否执行,转为boolean 统一格式
      config.setting.customScript = ''                                // 自定义脚本
      if (config.setting.interType === 'system') {
      if (config.setting.interType === 'system' || (config.setting.interType === 'custom' && config.setting.requestMode === 'system')) {
        if (config.setting.scripts && config.setting.scripts.length > 0) {
          let _customScript = ''
          config.setting.scripts.forEach(item => {
@@ -291,7 +292,6 @@
      }, () => {
        if (config.setting.onload !== 'false' && valid) { // 初始化可加载
          this.loadmaindata()
          this.getStatFieldsValue()
        }
      })
    } else {
@@ -346,6 +346,9 @@
    }
    let result = await Api.genericInterface(param)
    this.getStatFieldsValue(searches)
    if (result.status) {
      this.setState({
        data: result.data.map((item, index) => {
@@ -381,21 +384,11 @@
  /**
   * @description 获取合计字段值
   */
  getStatFieldsValue = () => {
    const { mainSearch, BID } = this.props
    const { setting, search, orderBy, statFields } = this.state
  getStatFieldsValue = (searches) => {
    const { BID } = this.props
    const { setting, orderBy, statFields } = this.state
    let searches = fromJS(search).toJS()
    if (mainSearch && mainSearch.length > 0) { // 主表搜索条件
      searches = [...mainSearch, ...searches]
    }
    if (statFields.length === 0 || setting.interType !== 'system' || !setting.dataresource) return
    let requireFields = search.filter(item => item.required && (!item.value || item.value.length === 0))
    if (requireFields.length > 0) {
      return
    }
    if (statFields.length === 0 || !(setting.interType === 'system' || (setting.interType === 'custom' && setting.requestMode === 'system')) || !setting.dataresource) return
    let _orderBy = orderBy || setting.order
    let param = UtilsDM.getStatQueryDataParams(setting, statFields, searches, _orderBy, BID, this.props.menuType)
@@ -448,7 +441,6 @@
      search: searches
    }, () => {
      this.loadmaindata()
      this.getStatFieldsValue()
    })
  }
@@ -483,12 +475,10 @@
        pageIndex: 1
      }, () => {
        this.loadmaindata()
        this.getStatFieldsValue()
      })
    } else {
      MKEmitter.emit('resetTable', this.props.MenuID + this.props.Tab.uuid, 'false') // 列表重置
      this.loadmaindata()
      this.getStatFieldsValue()
    }
    
  }