king
2021-01-08 da7068bd48791cdee966c786ce0dfd46f6e03df9
src/tabviews/custom/components/table/normal-table/index.jsx
@@ -399,15 +399,6 @@
  }
  /**
   * @description 按钮操作完成后(成功或失败),页面刷新,重置页码及选择项
   */
  refreshbyaction = (position, btn) => {
    if (position === 'grid' || position === 'view') {
      this.reloadtable(btn)
    }
  }
  /**
   * @description 导出Excel时,获取页面搜索排序等参数
   */
  getexceloutparam = (menuId, btnId) => {
@@ -434,16 +425,11 @@
    })
  }
  reloadData = (menuId, id, btn) => {
  reloadData = (menuId, id) => {
    const { config } = this.state
    if (config.uuid !== menuId) return
    if (id === 'empty') return
    if (id === 'formtab') { // 表单标签页刷新
      this.reloadtable(btn)
      return
    }
    
    if (!id) {
      this.reloadtable()
@@ -465,6 +451,31 @@
        this.loadmaindata(true, 'true')
        this.getStatFieldsValue()
      })
    }
  }
  /**
   * @description 按钮执行完成后页面刷新
   * @param {*} menuId     // 菜单Id
   * @param {*} position   // 刷新位置
   * @param {*} btn        // 执行的按钮
   */
  refreshByButtonResult = (menuId, position, btn) => {
    const { config, BID } = this.state
    if (config.uuid !== menuId) return
    this.reloadtable(btn)                                                      // 数据刷新
    if (btn.syncComponentId && btn.syncComponentId !== config.uuid && btn.syncComponentId !== config.setting.supModule) {
      MKEmitter.emit('reloadData', btn.syncComponentId)                        // 同级标签刷新
    }
    if (position === 'mainline' && config.setting.supModule) {                 // 主表行刷新
      MKEmitter.emit('reloadData', config.setting.supModule, (BID || 'empty'))
    } else if (position === 'popclose') {                                      // 标签关闭刷新
      config.setting.supModule && MKEmitter.emit('reloadData', config.setting.supModule, (BID || 'empty'))
      btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId)
    }
  }
@@ -501,6 +512,7 @@
    MKEmitter.addListener('reloadData', this.reloadData)
    MKEmitter.addListener('resetSelectLine', this.resetParentParam)
    MKEmitter.addListener('getexceloutparam', this.getexceloutparam)
    MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult)
  }
  /**
@@ -513,6 +525,7 @@
    MKEmitter.removeListener('reloadData', this.reloadData)
    MKEmitter.removeListener('resetSelectLine', this.resetParentParam)
    MKEmitter.removeListener('getexceloutparam', this.getexceloutparam)
    MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult)
  }
  render() {
@@ -531,7 +544,6 @@
          BData={this.state.BData}
          columns={config.columns}
          selectedData={selectedData}
          refreshdata={this.refreshbyaction}
        />
        <div className={'main-table-box ' + (!actions || actions.length === 0 ? 'no-action' : '')}>
          <MainTable
@@ -545,7 +557,6 @@
            loading={this.state.loading}
            refreshdata={this.refreshbytable}
            statFValue={this.state.statFValue}
            refreshbyaction={this.refreshbyaction}
            chgSelectData={(selects) => this.setState({selectedData: selects})}
          />
        </div>