king
2024-01-06 920e94fc5483b081b3d43c86df8f56d838f2f14d
src/tabviews/custom/components/card/double-data-card/index.jsx
@@ -36,7 +36,7 @@
    loading: false,            // 数据加载状态
    card: null,                // 卡片设置
    data: [],                // 数据
    total: null,
    total: 0,
    precards: [],
    nextcards: [],
    selected: 'false',
@@ -129,6 +129,12 @@
    _config.wrap.wrapClass =  `${_config.wrap.selStyle} ${_config.wrap.cardType || ''}`
    if (_config.wrap.shifting === 'true') {
      _config.wrap.shifting = 'shifting'
    } else {
      _config.wrap.shifting = ''
    }
    let wrapStyle = null
    let subcard = fromJS(_card).toJS()
    let subconfig = fromJS(_config).toJS()
@@ -163,6 +169,9 @@
      if (!pageOptions.includes(size)) {
        pageOptions.push(size)
        pageOptions = pageOptions.sort((a, b) => a - b)
      }
      if (_config.wrap.maxPageSize) {
        pageOptions = pageOptions.filter(item => item <= _config.wrap.maxPageSize)
      }
    }
@@ -223,6 +232,8 @@
    if (config.setting.onload === 'true') {
      this.initExec()
    }
    this.autoExec()
  }
  shouldComponentUpdate (nextProps, nextState) {
@@ -316,6 +327,25 @@
    }
  }
  autoExec = (times) => {
    const { config } = this.state
    if (!config.wrap.autoExec) return
    let btn = document.getElementById('button' + config.wrap.autoExec)
    this.autoTimer && clearTimeout(this.autoTimer)
    if (btn) {
      MKEmitter.emit('triggerBtnId', config.wrap.autoExec, [])
    } else if (!times || times < 20) {
      times = times ? times + 1 : 1
      this.autoTimer = setTimeout(() => {
        this.autoExec(times)
      }, 1000)
    }
  }
  searchRefresh = (searchId) => {
    const { config } = this.state
@@ -336,9 +366,9 @@
    let supModule = config.setting.supModule
    if (position === 'line') {
    if (position === 'line' || position === 'line_grid') {
      if (lines && lines.length === 1) {
        this.loadLinedata(lines[0].$$parentId || lines[0].$$uuid)
        this.loadLinedata(lines[0].$$parentId || lines[0].$$uuid, position)
      } else {
        this.loadData(id)
      }
@@ -516,7 +546,9 @@
    if (!config.setting.supModule || config.setting.supModule !== MenuID) return
    if (id !== this.state.BID || id !== '') {
      this.setState({ BID: id, BData: data, pageIndex: 1 }, () => {
        this.loadData()
        if (!config.checkBid) {
          this.loadData()
        }
      })
    }
  }
@@ -771,7 +803,7 @@
  /**
   * @description 获取单行数据
   */ 
  async loadLinedata (id) {
  async loadLinedata (id, position) {
    const { config, pageIndex, pageSize, search, BID, BData, orderBy } = this.state
    if (config.forbidLine) {
@@ -803,6 +835,11 @@
    let result = await Api.genericInterface(param)
    if (result.status) {
      if (position === 'line_grid' && (!result.data || !result.data[0])) {
        this.loadData()
        return
      }
      let data = fromJS(this.state.data).toJS()
      let selectedData = fromJS(this.state.selectedData).toJS()
      let selectKeys = fromJS(this.state.selectKeys).toJS()
@@ -1130,7 +1167,7 @@
    }
    return (
      <div className="double-data-card-box" id={'anchor' + config.uuid} style={config.style}>
      <div className={'double-data-card-box ' + config.wrap.shifting} id={'anchor' + config.uuid} style={config.style}>
        {loading ?
          <div className="loading-mask">
            {data.length ? <div className="ant-spin-blur"></div> : null}
@@ -1182,6 +1219,20 @@
                    subClass = opens.indexOf(item.key) > -1 ? 'mk-unfold' : 'mk-collapse'
                    unfold = opens.indexOf(item.key) > -1
                  }
                  if (!unfold && item.children.length > 5) {
                    return (
                      <Col key={index} span={card.setting.width} style={card.wStyle}>
                        <div className={className} style={wrapStyle}>
                          <CardItem card={card} cards={config} data={item} onDoubleClick={() => this.onDoubleClick(item.key, subClass)} onClick={() => {this.changeCard(item.key, item, subClass)}}>
                            <span className="circle-select"></span>
                            {card.setting.controlIcon === 'left' ? <PlusSquareOutlined className={subClass} onClick={(e) => this.changeUnfold(e, item.key, subClass)}/> : null}
                            {card.setting.controlIcon === 'right' ? <UpOutlined className={subClass} onClick={(e) => this.changeUnfold(e, item.key, subClass)}/> : null}
                          </CardItem>
                        </div>
                      </Col>
                    )
                  }
                }
                return (