king
2022-04-26 5046d0d13dc6a8563b8e54e31913bc44cfa1072f
src/tabviews/custom/components/card/balcony/index.jsx
@@ -35,9 +35,8 @@
  }
  UNSAFE_componentWillMount () {
    const { data, BID } = this.props
    const { data, BID, initdata } = this.props
    let _config = fromJS(this.props.config).toJS()
    let _cols = new Map()
    let _data = { $$empty: true }
    let _sync = false
@@ -51,6 +50,12 @@
          _data = _data[0] || {}
        }
        _sync = false
      } else if (_sync && initdata) {
        _data = initdata
        if (Array.isArray(_data)) {
          _data = _data[0] || {$$empty: true}
        }
        _sync = false
      }
    }
@@ -58,12 +63,8 @@
      _data.$$BID = BID || ''
    }
    _config.columns.forEach(item => {
      _cols.set(item.field, item)
    })
    if (_config.wrap.position === 'fixed') {
      _config.style.position = 'fixed'
    if (_config.wrap.position === 'fixed' || _config.wrap.position === 'absolute') {
      _config.style.position = _config.wrap.position
      _config.style.zIndex = 2
      _config.style.left = _config.wrap.left || ''
      _config.style.right = _config.wrap.right || ''
@@ -71,6 +72,12 @@
      _config.style.bottom = _config.wrap.bottom || ''
      _config.style.transform = _config.wrap.transform || ''
      _config.style.width = _config.wrap.realwidth || ''
    } else {
      _config.style.zIndex = 2
      _config.style.left = _config.wrap.left || ''
      _config.style.right = _config.wrap.right || ''
      _config.style.top = _config.wrap.top || ''
      _config.style.bottom = _config.wrap.bottom || ''
    }
    let show = true
@@ -101,7 +108,9 @@
      arr_field: _config.columns.map(col => col.field).join(','),
    }, () => {
      if (_config.wrap.datatype !== 'static' && _config.setting && _config.setting.sync !== 'true') {
        setTimeout(() => {
        this.loadData()
        }, _config.setting.delay || 0)
      }
    })
  }
@@ -208,30 +217,35 @@
   * @param {*} position   // 刷新位置
   * @param {*} btn        // 执行的按钮
   */
  refreshByButtonResult = (menuId, position, btn) => {
  refreshByButtonResult = (menuId, position, btn, id, lines) => {
    const { config, BID, syncConfig } = this.state
    if (config.uuid !== menuId) return
    this.loadData()                                                            // 数据刷新
    if (syncConfig) {
      MKEmitter.emit('refreshByButtonResult', syncConfig.uuid, position, btn, id, lines)
      this.loadData()
    } else {
    let supModule = config.wrap.supModule
    if (syncConfig) {
      supModule = syncConfig.setting.supModule
      btn.syncComponentId && MKEmitter.emit('reloadData', btn.syncComponentId)
      MKEmitter.emit('refreshByButtonResult', syncConfig.uuid, position, btn)
      if (!btn.syncComponentId || btn.syncComponentId !== supModule) {
        if (position === 'mainline' || position === 'popclose') { // 刷新源组件时,附带刷新上级行与当前组件
          if (supModule && BID) {
            MKEmitter.emit('reloadData', supModule, BID)
          } else {
            this.loadData()
          }
        } else {
          this.loadData()
        }
    }
    if (btn.syncComponentId && btn.syncComponentId !== config.uuid && btn.syncComponentId !== supModule) {
      MKEmitter.emit('reloadData', btn.syncComponentId)                        // 同级标签刷新
    }
    if (position === 'mainline' && supModule) {                                // 主表行刷新
      MKEmitter.emit('reloadData', supModule, (BID || 'empty'))
    } else if (position === 'popclose') {                                      // 标签关闭刷新
      supModule && MKEmitter.emit('reloadData', supModule, (BID || 'empty'))
      if (position === 'popclose') {                                      // 标签关闭刷新
      btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId)
      }
    }
  }
@@ -316,6 +330,7 @@
      _data.$$BID = BID || ''
      _data.$$BData = BData
      _data.$$uuid = _data[config.setting.primaryKey] || ''
      this.setState({
        data: _data,