king
2021-10-03 3bdcb8da222aaedcc1b6b279d1d038fe3b714570
src/tabviews/custom/components/card/data-card/index.jsx
@@ -45,7 +45,7 @@
  }
  UNSAFE_componentWillMount () {
    const { data, initdata, BID } = this.props
    const { data, initdata, BID, BData } = this.props
    let _config = fromJS(this.props.config).toJS()
    let _card = null
@@ -112,6 +112,7 @@
        item.key = index
        item.$$uuid = item[_config.setting.primaryKey] || ''
        item.$$BID = BID || ''
        item.$$BData = BData || ''
        item.$Index = index + 1 + ''
        return item
      })
@@ -150,6 +151,7 @@
      sync: _sync,
      data: _data,
      BID: BID || '',
      BData: BData || '',
      config: _config,
      card: _card,
      search: Utils.initMainSearch(_config.search),
@@ -174,7 +176,7 @@
  }
  UNSAFE_componentWillReceiveProps (nextProps) {
    const { sync, config, BID, selected } = this.state
    const { sync, config, BID, BData, selected } = this.state
    if (sync && !is(fromJS(this.props.data), fromJS(nextProps.data))) {
      let _data = []
@@ -184,6 +186,7 @@
          item.key = index
          item.$$uuid = item[config.setting.primaryKey] || ''
          item.$$BID = BID || ''
          item.$$BData = BData || ''
          item.$Index = index + 1 + ''
          return item
        })
@@ -253,7 +256,19 @@
  checkTopLine = () => {
    const { config, data } = this.state
    if (!data || data.length === 0) return
    if (!data || data.length === 0) {
      this.setState({
        activeKey: '',
        selectKeys: [],
        selectedData: []
      })
      MKEmitter.emit('resetSelectLine', config.uuid, '', '')
      if (config.setting.$hasSyncModule) {
        MKEmitter.emit('syncBalconyData', config.uuid, [], false)
      }
      return
    }
    this.setState({
      activeKey: 0,
@@ -361,9 +376,19 @@
        total: 0,
        loading: false
      })
      MKEmitter.emit('resetSelectLine', config.uuid, '', '')
      if (config.setting.$hasSyncModule) {
        MKEmitter.emit('syncBalconyData', config.uuid, [], false)
      if (selected !== 'false') {
        setTimeout(() => {
          this.checkTopLine()
        }, 200)
        if (selected === 'init') {
          this.setState({selected: 'false'})
        }
      } else {
        MKEmitter.emit('resetSelectLine', config.uuid, '', '')
        if (config.setting.$hasSyncModule) {
          MKEmitter.emit('syncBalconyData', config.uuid, [], false)
        }
      }
      return
    }
@@ -406,9 +431,9 @@
        }
      } else {
        MKEmitter.emit('resetSelectLine', config.uuid, '', '')
      }
      if (config.setting.$hasSyncModule) {
        MKEmitter.emit('syncBalconyData', config.uuid, [], false)
        if (config.setting.$hasSyncModule) {
          MKEmitter.emit('syncBalconyData', config.uuid, [], false)
        }
      }
      this.setState({
@@ -634,7 +659,7 @@
            {offset ? <Col span={offset} style={{height: '10px'}}> </Col> : null}
            {precards.map((item, index) => (
              <Col key={'pre' + index} className="extend-card" span={item.setting.width || 6}>
                <CardItem card={item} cards={config} data={{$$BID: BID, $$type: 'extendCard'}}/>
                <CardItem card={item} cards={config} data={{$$BID: BID, $$BData: BData, $$type: 'extendCard'}}/>
              </Col>
            ))}
            {data && data.map((item, index) => (
@@ -644,7 +669,7 @@
            ))}
            {nextcards.map((item, index) => (
              <Col key={'next' + index} className="extend-card" span={item.setting.width || 6}>
                <CardItem card={item} cards={config} data={{$$BID: BID, $$type: 'extendCard'}}/>
                <CardItem card={item} cards={config} data={{$$BID: BID, $$BData: BData, $$type: 'extendCard'}}/>
              </Col>
            ))}
          </Row>