king
2020-07-22 0c94290767a88c913ed736e65970eafee9e41519
src/tabviews/zshare/cardcomponent/index.jsx
@@ -4,11 +4,14 @@
import { Icon, Card, Spin, Empty, Tabs } from 'antd'
import asyncComponent from '@/utils/asyncComponent'
import asyncExcelComponent from './asyncButtonComponent'
import '@/assets/css/table.scss'
import './index.scss'
const NormalButton = asyncComponent(() => import('@/tabviews/zshare/actionList/normalbutton'))
const PopupButton = asyncComponent(() => import('@/tabviews/zshare/actionList/popupbutton'))
const ExcelInButton = asyncExcelComponent(() => import('@/tabviews/zshare/actionList/excelInbutton'))
const ExcelOutButton = asyncExcelComponent(() => import('@/tabviews/zshare/actionList/exceloutbutton'))
const TabButton = asyncComponent(() => import('@/tabviews/zshare/actionList/tabbutton'))
const NewPageButton = asyncComponent(() => import('@/tabviews/zshare/actionList/newpagebutton'))
const ChangeUserButton = asyncComponent(() => import('@/tabviews/zshare/actionList/changeuserbutton'))
@@ -530,13 +533,15 @@
    loading: PropTypes.bool,
    data: PropTypes.array,
    refreshdata: PropTypes.func,
    getexceloutparam: PropTypes.func,
    handleTableId: PropTypes.func
  }
  state = {
    card: null,
    colMap: null,
    selectKey: ''
    selectKey: '',
    actionList: null
  }
  /**
@@ -551,6 +556,7 @@
    let columns = fromJS(config.columns).toJS()
    let actions = fromJS(config.action).toJS()
    let insertAction = null
    let actionList = []
    columns.forEach(col => {
      if (col.field) {
@@ -563,6 +569,8 @@
        actionMap.set(item.uuid, item)
      } else if (plot.insert === 'true' && !insertAction && item.OpenType === 'pop' && item.sqlType === 'insert' && item.Ot === 'notRequired') {
        insertAction = item
      } else if (plot.actions && plot.actions.length > 0 && plot.actions.includes(item.uuid) && (item.OpenType === 'excelOut' || (item.OpenType === 'excelIn' && item.Ot === 'notRequired'))) {
        actionList.push(item)
      }
    })
@@ -702,7 +710,7 @@
    card.insertAction = insertAction // 添加卡片
    this.setState({card: card, colMap: colMap})
    this.setState({card: card, colMap: colMap, actionList: actionList})
  }
  UNSAFE_componentWillReceiveProps(nextProps) {
@@ -764,8 +772,8 @@
  render() {
    const { plot, data, loading, BID, BData, Tab, MenuID, config, logcolumns, ContainerId } = this.props
    const { card, colMap, selectKey } = this.state
    const { card, colMap, selectKey, actionList } = this.state
    return (
      <div className="card-row-box mingke-table" ref={(ref) => this.cardRef = ref} style={!plot.title ? {paddingTop: '15px'} : null}>
        {loading ?
@@ -774,7 +782,40 @@
            <Spin />
          </div> : null
        }
        {plot.title ? <p className="chart-title">{plot.title}</p> : null}
        <div>
          {plot.title ? <p className="chart-title">{plot.title}</p> : null}
          <div style={{float: 'right', marginRight: 10}}>
            {actionList && actionList.map(action => {
              if (action.OpenType === 'excelIn') {
                return (
                  <ExcelInButton
                    key={action.uuid}
                    BID={BID}
                    Tab={Tab}
                    btn={action}
                    show="icon"
                    setting={config.setting}
                    updateStatus={() => {}}
                  />
                )
              } else {
                return (
                  <ExcelOutButton
                    key={action.uuid}
                    BID={BID}
                    Tab={Tab}
                    btn={action}
                    show="icon"
                    setting={config.setting}
                    getexceloutparam={this.props.getexceloutparam}
                    updateStatus={() => {}}
                  />
                )
              }
            })}
          </div>
          <div style={{clear: 'both'}}></div>
        </div>
        {plot.over !== 'roll' && data && data.length > 0 &&
          data.map((item, i) => (
            <CardCell