king
2021-12-22 bd1dfc9e6c9b9f8076ca2783ce598e0936b4c664
src/tabviews/zshare/cardcomponent/index.jsx
@@ -1,10 +1,12 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { Icon, Card, Spin, Empty } from 'antd'
import { Card, Spin, Empty } from 'antd'
import asyncComponent from '@/utils/asyncComponent'
import asyncExcelComponent from './asyncButtonComponent'
import MKEmitter from '@/utils/events.js'
import MkIcon from '@/components/mk-icon'
import '@/assets/css/table.scss'
import './index.scss'
@@ -25,12 +27,11 @@
    Tab: PropTypes.any,               // 如果当前元素为标签时,tab为标签信息
    MenuID: PropTypes.string,         // 菜单ID
    setting: PropTypes.object,        // 页面设定
    logcolumns: PropTypes.array,      // 字段列
    columns: PropTypes.array,         // 显示列
    card: PropTypes.object,           // 卡片设置信息
    data: PropTypes.object,           // 卡片数据
    selectKey: PropTypes.string,      // 选择卡片的序号
    colMap: PropTypes.any,            // 显示列信息,用于设置标记
    refreshdata: PropTypes.func,      // 按钮操作后数据刷新
    switchCard: PropTypes.func        // 卡片切换
  }
@@ -129,40 +130,38 @@
   * @description 获取按钮元素
   */
  getActionList = (actions, show) => {
    const { BID, BData, Tab, setting, logcolumns, ContainerId, data, MenuID } = this.props
    const { BData, Tab, setting, columns, ContainerId, data, MenuID } = this.props
    
    return actions.map(item => {
      if (['exec', 'prompt', 'pop'].includes(item.OpenType)) {
        return (
          <NormalButton
            key={item.uuid}
            BID={BID}
            BID={data.$$BID}
            Tab={Tab}
            btn={item}
            show={show}
            BData={BData}
            setting={setting}
            columns={logcolumns}
            columns={columns}
            selectedData={[data]}
            ContainerId={ContainerId}
            updateStatus={this.updateStatus}
          />
        )
      } else if (item.OpenType === 'popview') {
        return (
          <PopupButton
            key={item.uuid}
            BID={BID}
            BID={data.$$BID}
            Tab={Tab}
            btn={item}
            show={show}
            BData={BData}
            setting={setting}
            selectedData={[data]}
            updateStatus={this.updateStatus}
          />
        )
      } else if (item.OpenType === 'tab' || item.OpenType === 'blank') {
      } else if (item.OpenType === 'tab') {
        return (
          <TabButton
            key={item.uuid}
@@ -171,7 +170,6 @@
            MenuID={MenuID}
            setting={setting}
            selectedData={[data]}
            updateStatus={this.updateStatus}
          />
        )
      } else if (item.OpenType === 'innerpage' || item.OpenType === 'outerpage') {
@@ -182,27 +180,25 @@
            show={show}
            setting={setting}
            selectedData={[data]}
            updateStatus={this.updateStatus}
          />
        )
      } else if (item.OpenType === 'funcbutton') {
        if (item.funcType === 'changeuser') {
        if (item.funcType === 'changeuser' || item.funcType === 'closetab') {
          return (
            <ChangeUserButton
              key={item.uuid}
              BID={BID}
              BID={data.$$BID}
              btn={item}
              show={show}
              setting={setting}
              selectedData={[data]}
              updateStatus={this.updateStatus}
            />
          )
        } else if (item.funcType === 'print') {
          return (
            <PrintButton
              key={item.uuid}
              BID={BID}
              BID={data.$$BID}
              Tab={Tab}
              btn={item}
              show={show}
@@ -210,7 +206,6 @@
              setting={setting}
              selectedData={[data]}
              ContainerId={ContainerId}
              updateStatus={this.updateStatus}
            />
          )
        }
@@ -218,15 +213,6 @@
      return null
    })
  }
  /**
   * @description 操作完成后,数据刷新
   */
  updateStatus = (type, positon) => {
    if (type === 'refresh') {
      this.props.refreshdata(positon)
    }
  }
  /**
@@ -260,7 +246,7 @@
          if (isNaN(originVal) || isNaN(contrastVal)) {
            originVal = ''
          }
        } catch {
        } catch (e) {
          originVal = ''
        }
      }
@@ -288,7 +274,7 @@
        if (mark.position === 'front') {
          position = 'front'
        }
        icon = <Icon className={'font ' + className} type={mark.icon} />
        icon = <MkIcon className={'font ' + className} type={mark.icon} />
        className = ''
      }
@@ -347,7 +333,7 @@
          if (isNaN(content)) {
            content = ''
          }
        } catch {
        } catch (e) {
          content = ''
        }
      }
@@ -505,10 +491,9 @@
              show={'plus' + plusSize}
              BData={this.props.BData}
              setting={this.props.setting}
              columns={this.props.logcolumns}
              columns={this.props.columns}
              selectedData={[]}
              ContainerId={this.props.ContainerId}
              updateStatus={this.updateStatus}
            />
          </div>
        </Card> : null}
@@ -524,15 +509,12 @@
    Tab: PropTypes.any,               // 如果当前元素为标签时,tab为标签信息
    MenuID: PropTypes.string,         // 菜单ID
    config: PropTypes.object,         // 页面配置信息
    logcolumns: PropTypes.array,      // 显示列
    columns: PropTypes.array,         // 显示列
    ContainerId: PropTypes.any,       // tab页面ID,用于弹窗控制
    plot: PropTypes.object,
    tableId: PropTypes.string,
    loading: PropTypes.bool,
    data: PropTypes.array,
    refreshdata: PropTypes.func,
    getexceloutparam: PropTypes.func,
    handleTableId: PropTypes.func
  }
  state = {
@@ -754,11 +736,11 @@
    this.setState({selectKey: data.key})
    this.props.handleTableId(this.props.tableId, _id, data)
    MKEmitter.emit('changeTableLine', this.props.ContainerId, this.props.tableId, _id, data)
  }
  render() {
    const { plot, data, loading, BID, BData, Tab, MenuID, config, logcolumns, ContainerId } = this.props
    const { plot, data, loading, BID, BData, Tab, MenuID, config, columns, ContainerId } = this.props
    const { card, colMap, selectKey, actionList } = this.state
    
    return (
@@ -779,10 +761,9 @@
                    key={action.uuid}
                    BID={BID}
                    Tab={Tab}
                    btn={action}
                    show="icon"
                    btn={action}
                    setting={config.setting}
                    updateStatus={() => {}}
                  />
                )
              } else {
@@ -791,11 +772,9 @@
                    key={action.uuid}
                    BID={BID}
                    Tab={Tab}
                    btn={action}
                    show="icon"
                    btn={action}
                    setting={config.setting}
                    getexceloutparam={this.props.getexceloutparam}
                    updateStatus={() => {}}
                  />
                )
              }
@@ -814,12 +793,11 @@
              BData={BData}
              MenuID={MenuID}
              colMap={colMap}
              columns={columns}
              selectKey={selectKey}
              logcolumns={logcolumns}
              setting={config.setting}
              ContainerId={ContainerId}
              switchCard={this.switchCard}
              refreshdata={this.props.refreshdata}
            />
          ))
        }
@@ -836,7 +814,6 @@
            setting={config.setting}
            ContainerId={ContainerId}
            switchCard={() => {}}
            refreshdata={this.props.refreshdata}
          /> : null
        }
        {(loading || !card.insertAction) && (!data || data.length === 0) ? <Empty description={false}/> : null}