king
2023-06-22 79e4981aa6cc9354276fc54cdf6d14eb08ab7fee
src/tabviews/custom/components/card/double-data-card/index.jsx
@@ -79,6 +79,7 @@
    }
    _config.$extend = false
    _config.$empty = true
    _config.subcards.forEach(item => {
      if (item.setting.click === 'button' && !item.setting.linkbtn) {
@@ -96,9 +97,13 @@
        _card = item
      } else if (!_card) {
        _config.$extend = true
        if (item.setting.width !== 24) {
          _config.$empty = false
        }
        precards.push(item)
      } else {
        _config.$extend = true
        _config.$empty = false
        nextcards.push(item)
      }
    })
@@ -133,9 +138,9 @@
    subcard.setting = subcard.backSetting
    if (_card.setting.position === 'inner') {
      wrapStyle = {}
      wrapStyle = {backgroundColor: '#ffffff'}
      Object.keys(_card.style).forEach(key => {
        if (!/^(margin|border|box)/.test(key)) return
        if (!/^(margin|border|box|backgroundColor)/.test(key)) return
        wrapStyle[key] = _card.style[key]
        delete _card.style[key]
      })
@@ -200,6 +205,7 @@
    MKEmitter.addListener('reloadData', this.reloadData)
    MKEmitter.addListener('resetSelectLine', this.resetParentParam)
    MKEmitter.addListener('queryModuleParam', this.queryModuleParam)
    MKEmitter.addListener('refreshLineData', this.refreshLineData)
    MKEmitter.addListener('refreshByButtonResult', this.refreshByButtonResult)
    
    if (config.timer) {
@@ -245,7 +251,7 @@
          item.$Index = index + 1 + ''
          if (config.wrap.controlField) {
            if (config.wrap.controlVal.includes(item[config.wrap.controlField])) {
            if (config.wrap.controlVal.includes(item[config.wrap.controlField] + '')) {
              item.$disabled = true
            }
          }
@@ -279,6 +285,7 @@
    MKEmitter.removeListener('reloadData', this.reloadData)
    MKEmitter.removeListener('resetSelectLine', this.resetParentParam)
    MKEmitter.removeListener('queryModuleParam', this.queryModuleParam)
    MKEmitter.removeListener('refreshLineData', this.refreshLineData)
    MKEmitter.removeListener('refreshByButtonResult', this.refreshByButtonResult)
    this.timer && this.timer.stop()
@@ -318,6 +325,28 @@
    if (position === 'popclose') { // 执行启动弹窗的按钮所选择的刷新项
      btn.$tabId && MKEmitter.emit('refreshPopButton', btn.$tabId)
    }
  }
  refreshLineData = (menuId, btn, uuid, count) => {
    const { config, data } = this.state
    if (config.uuid !== menuId) return
    let _data = fromJS(data).toJS().map(item => {
      if (item.$$uuid === uuid) {
        item[btn.field] = count
      }
      item.children.forEach(cell => {
        if (cell.$$uuid === uuid) {
          cell[btn.field] = count
        }
      })
      return item
    })
    this.setState({
      data: _data
    })
  }
  checkTopLine = (id) => {
@@ -605,7 +634,7 @@
          item.$Index = index + 1 + ''
          if (config.wrap.controlField) {
            if (config.wrap.controlVal.includes(item[config.wrap.controlField])) {
            if (config.wrap.controlVal.includes(item[config.wrap.controlField] + '')) {
              item.$disabled = true
            }
          }
@@ -644,7 +673,7 @@
          item.$Index = index + start + ''
          if (config.wrap.controlField) {
            if (config.wrap.controlVal.includes(item[config.wrap.controlField])) {
            if (config.wrap.controlVal.includes(item[config.wrap.controlField] + '')) {
              item.$disabled = true
            }
          }
@@ -886,6 +915,43 @@
    }
  }
  changeSubCard = (item) => {
    const { subcard, card } = this.state
    if (subcard.setting.click || card.setting.position !== 'inner' || card.setting.click !== 'menu') return
    let menuId = card.setting.MenuID || card.setting.menu.slice(-1)[0]
    let menu = window.GLOB.mkThdMenus.filter(m => m.MenuID === menuId)[0]
    if (!menu && card.setting.MenuName && card.setting.tabType) {
      menu = {
        MenuID: menuId,
        MenuName: card.setting.MenuName,
        MenuNo: card.setting.MenuNo || '',
        type: card.setting.tabType
      }
    }
    if (!menu) return
    let newtab = {
      ...menu,
      param: {}
    }
    if (card.setting.joint === 'true') {
      newtab.param.$BID = item.$$uuid || ''
      Object.keys(item).forEach(key => {
        if (/^\$/.test(key)) return
        if (key === 'children') return
        newtab.param[key] = item[key]
      })
    }
    MKEmitter.emit('modifyTabs', newtab, true)
  }
  onDoubleClick = (i, subClass) => {
    const { opens, card } = this.state
@@ -975,7 +1041,7 @@
                let unfold = true
                if (item.$disabled) {
                  className = 'mk-disabled ' + mainBox
                  className = 'card-item-wrap mk-disabled ' + mainBox
                } else if (activeKey === index) {
                  className += 'active'
                } else if (selectKeys.indexOf(index) > -1) {
@@ -1000,7 +1066,7 @@
                        {card.setting.controlIcon === 'left' ? (!unfold ? <PlusSquareOutlined className={subClass} onClick={(e) => this.changeUnfold(e, index, subClass)}/> : <MinusSquareOutlined className={subClass} onClick={(e) => this.changeUnfold(e, index, subClass)}/>) : null}
                        {card.setting.controlIcon === 'right' ? <UpOutlined className={subClass} onClick={(e) => this.changeUnfold(e, index, subClass)}/> : null}
                      </CardItem>
                      <div className={'sub-card-wrap ' + subClass + (config.wrap.parity === 'true' ? ' mk-parity-bg' : '')}>
                      <div className={'sub-card-wrap ' + subClass + (config.wrap.parity === 'true' ? ' mk-parity-bg' : '')} onClick={() => this.changeSubCard(item)}>
                        {item.children.map((cell, index) => <Col key={'sub' + index} span={subcard.setting.width || 24}>
                          <CardItem card={subcard} cards={subconfig} data={cell} />
                        </Col>)}
@@ -1019,8 +1085,8 @@
                </Col>
              ))}
            </Row>
            {!config.$extend && (!data || data.length === 0) ? <Empty description={false}/> : null}
          </div>
          {config.$empty && (!data || data.length === 0) ? <Empty description={false}/> : null}
        </div>
        {config.wrap.pagestyle === 'page' && data ? <Pagination size="small" total={total} showTotal={(t, range) => total > 0 ? `${range[0]}-${range[1]} 共 ${total} 条` : `共 ${total} 条`} pageSize={pageSize} showSizeChanger={true} pageSizeOptions={this.state.pageOptions} onChange={this.changePageIndex} onShowSizeChange={this.pageSizeChange} current={pageIndex}/> : null}
        {config.wrap.pagestyle === 'more' && data && data.length > 0 ? <div className={'mk-more' + (pageSize * pageIndex >= total ? ' disabled' : '')} onClick={this.loadMore}>查看更多<DownOutlined/></div> : null}