king
2019-11-26 07acb5f4dc11e484801ccfcd95eee8845128c62a
src/tabviews/commontable/mainTable/index.jsx
@@ -1,13 +1,13 @@
import React, {Component} from 'react'
import PropTypes from 'prop-types'
// import { is, fromJS } from 'immutable'
import { Table, Icon, message, Affix } from 'antd'
import { Table, message, Affix } from 'antd'
import './index.scss'
export default class MainTable extends Component {
  static propTpyes = {
    MenuNo: PropTypes.string, // 菜单参数
    fixed: PropTypes.object, // 表格头部是否固定于页面上方
    MenuID: PropTypes.string, // 菜单参数
    setting: PropTypes.object, // 表格头部是否固定于页面上方
    loading: PropTypes.bool,
    total: PropTypes.number,
    select: PropTypes.object,
@@ -24,23 +24,19 @@
    pageIndex: 1,
    pageSize: 10,
    columns: this.props.columns.map((item, index) => {
      let _width = parseInt(item.Width) || 50
      return {
        align: item.Align,
        dataIndex: item.FieldName,
        title: item.Label,
        dataIndex: item.field,
        title: item.label,
        // fixed: index < 3,
        sorter: item.IsSort === 'true',
        filterMultiple: item.CDefine1 === 'true',
        filters: item.CDefine2 && JSON.parse(item.CDefine2),
        width: _width * 30,
        width: item.Width || 120,
        render: (text, record) => (
          <div style={{ wordWrap: 'break-word', wordBreak: 'break-word', minWidth: _width + 'px' }}>
          <div style={{ wordWrap: 'break-word', wordBreak: 'break-word', minWidth: (item.Width || 120) + 'px' }}>
            {text}
            {item.FieldName === 'MenuNo' ? <Icon onClick={(e) => {this.copycontent(e, record[item.FieldName])}} type="copy"/> : ''}
            {/* {item.FieldName === 'MenuNo' ? <Icon onClick={(e) => {this.copycontent(e, record[item.FieldName])}} type="copy"/> : ''} */}
          </div>
        )
        // onHeaderCell: () => ({style:{textAlign: 'center'}})
      }
    })
  }
@@ -99,21 +95,22 @@
  render() {
    let { selectedRowKeys } = this.state
    let rowSelection = null
    if (this.props.select && this.props.select.selectable) {
    if (this.props.setting.tableType) {
      rowSelection = {
        selectedRowKeys,
        type: this.props.select.selectType === 'radio' ? 'radio' : 'checkbox',
        type: this.props.setting.tableType === 'radio' ? 'radio' : 'checkbox',
        onChange: this.onSelectChange
      }
    }
    let offset = null
    if (this.props.fixed.fixtable) {
    if (this.props.setting.columnfixed) {
      // 表格头部固定于顶部时,判断距顶部高度
      if (!this.props.fixed.fixaction) {
      if (!this.props.setting.actionfixed) {
        offset = 48
      } else {
        let box = document.getElementById(this.props.MenuNo + 'mainaction')
        let box = document.getElementById(this.props.MenuID + 'mainaction')
        if (box) {
          offset = 48 + box.offsetHeight
        } else {
@@ -123,7 +120,7 @@
    }
    return (
      <div className="main-table">
        {this.props.fixed.fixtable && <Affix offsetTop={offset} className="fix-header">
        {this.props.setting.columnfixed && <Affix offsetTop={offset} className="fix-header">
          <Table
            bordered={true}
            rowSelection={rowSelection}