king
2022-03-30 25fbc16aa14667064ac5de854183b09e01105f2c
src/tabviews/custom/components/card/prop-card/index.jsx
@@ -47,26 +47,24 @@
      _sync = _config.setting.sync === 'true'
      if (_sync && data) {
        _data = data[_config.dataName] || {}
        if (_data && Array.isArray(_data)) {
          _data = _data[0] || {}
        _data = data[_config.dataName] || {$$empty: true}
        if (Array.isArray(_data)) {
          _data = _data[0] || {$$empty: true}
        }
        _sync = false
      } else if (_sync && initdata) {
        _data = initdata || {}
        if (_data && Array.isArray(_data)) {
          _data = _data[0] || {}
        _data = initdata || {$$empty: true}
        if (Array.isArray(_data)) {
          _data = _data[0] || {$$empty: true}
        }
        _sync = false
      }
    }
    if (_data) {
      _data.$$BID = BID || ''
      _data.$$BData = BData || ''
      if (_config.setting.primaryKey) {
        _data.$$uuid = _data[_config.setting.primaryKey] || ''
      }
    _data.$$BID = BID || ''
    _data.$$BData = BData || ''
    if (_config.setting.primaryKey) {
      _data.$$uuid = _data[_config.setting.primaryKey] || ''
    }
    _config.columns.forEach(item => {
@@ -115,6 +113,7 @@
    _config.wrap.selStyle = _config.wrap.selStyle || 'active'
    _config.wrap.priKeyType = _config.wrap.priKeyType || 'static'
    _config.wrap.scale = _config.wrap.scale === 'true' ? 'scale' : ''
    _config.wrap.layout = (_config.wrap.layout || 'grid') + '-layout'
    _config.wrap.wrapClass =  `${_config.wrap.selStyle} ${_config.wrap.cardType || ''} ${_config.wrap.scale || ''}`
@@ -128,7 +127,9 @@
      arr_field: _config.columns.map(col => col.field).join(','),
    }, () => {
      if (_config.wrap.datatype !== 'static' && _config.setting.sync !== 'true' && _config.setting.onload === 'true') {
        this.loadData()
        setTimeout(() => {
          this.loadData()
        }, _config.setting.delay || 0)
      } else if ((!_sync || _config.wrap.priKeyType === 'static') && selected !== 'false') {
        setTimeout(() => {
          this.checkTopLine()
@@ -167,9 +168,9 @@
    if (sync && !is(fromJS(this.props.data), fromJS(nextProps.data))) {
      let _data = { $$empty: true }
      if (nextProps.data && nextProps.data[config.dataName]) {
        _data = nextProps.data[config.dataName] || {}
        _data = nextProps.data[config.dataName]
        if (Array.isArray(_data)) {
          _data = _data[0] || {}
          _data = _data[0] || {$$empty: true}
        }
      }
@@ -270,16 +271,23 @@
    if (config.uuid !== menuId) return
    this.loadData()                                                            // 数据刷新
    let supModule = config.setting.supModule
    if (btn.syncComponentId && btn.syncComponentId !== config.uuid && btn.syncComponentId !== config.setting.supModule) {
      MKEmitter.emit('reloadData', btn.syncComponentId)                        // 同级标签刷新
    btn.syncComponentId && MKEmitter.emit('reloadData', btn.syncComponentId)
    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 (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'))
    if (position === 'popclose') { // 执行启动弹窗的按钮所选择的刷新项
      btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId)
    }
  }
@@ -288,6 +296,7 @@
    const { config } = this.state
    if (!config.setting.supModule || config.setting.supModule !== MenuID) return
    if (id !== this.state.BID || id !== '') {
      this.setState({ BID: id, BData: data }, () => {
        this.loadData()
@@ -399,6 +408,8 @@
  render() {
    const { config, loading, data, activeKey } = this.state
    if (config.wrap.empty === 'hidden' && (!data || data.$$empty)) return null
    return (
      <div className="custom-prop-card-box" style={config.style}>
        {loading ?
@@ -408,7 +419,7 @@
          </div> : null
        }
        <NormalHeader config={config}/>
        <Row className={`card-row-list data-zoom ${config.wrap.wrapClass}`}>
        <Row className={`card-row-list data-zoom ${config.wrap.wrapClass} ${config.wrap.layout}`}>
          {config.subcards.map((item, index) => {
            let className = item.setting.click ? 'mk-card pointer ' : 'mk-card '
            if (activeKey === index) {