king
2021-11-17 c51f5e007a3e03c9d6731ab7f28f0080de009990
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
        })
@@ -223,12 +226,14 @@
   * @param {*} position   // 刷新位置
   * @param {*} btn        // 执行的按钮
   */
  refreshByButtonResult = (menuId, position, btn) => {
  refreshByButtonResult = (menuId, position, btn, id, lines) => {
    const { config, BID } = this.state
    if (config.uuid !== menuId) return
    if (!btn || btn.resetPageIndex !== 'false') {
    if (position === 'line' && lines && lines.length === 1) {
      this.loadLinedata(lines[0].$$uuid)
    } else if (!btn || btn.resetPageIndex !== 'false') {
      this.setState({
        pageIndex: 1
      }, () => {
@@ -253,7 +258,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,
@@ -313,7 +330,7 @@
    const { config } = this.state
    if (!config.setting.supModule || config.setting.supModule !== MenuID) return
    if (id !== this.state.BID) {
    if (id !== this.state.BID || id !== '') {
      this.setState({ BID: id, BData: data, pageIndex: 1 }, () => {
        this.loadData()
      })
@@ -361,9 +378,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 +433,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 +661,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 +671,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>