File was renamed from src/tabviews/commontable/mainTable/index.jsx |
| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | // import { is, fromJS } from 'immutable' |
| | | import { Table, message, Affix, Button, Typography } from 'antd' |
| | | import './index.scss' |
| | | |
| | |
| | | |
| | | export default class MainTable extends Component { |
| | | static propTpyes = { |
| | | tableId: PropTypes.string, // 列表Id |
| | | dict: PropTypes.object, // 字典项 |
| | | MenuID: PropTypes.string, // 菜单Id |
| | | setting: PropTypes.object, // 表格全局设置:tableType(表格是否可选、单选、多选)、columnfixed(列固定)、actionfixed(按钮固定) |
| | |
| | | |
| | | changedata = (index) => { |
| | | const { data, setting } = this.props |
| | | |
| | | if (!this.props.tableId) return |
| | | |
| | | let _id = '' |
| | | let _data = '' |
| | | |
| | |
| | | _data = data[index] || '' |
| | | } |
| | | |
| | | this.props.handleTableId('mainTable', _id, _data) |
| | | this.props.handleTableId(this.props.tableId, _id, _data) |
| | | } |
| | | |
| | | resetTable = () => { |
| | |
| | | const { setting, pickup } = this.props |
| | | let { selectedRowKeys } = this.state |
| | | |
| | | // 设置表格选择属性:单选、多选、不可选 |
| | | let rowSelection = null |
| | | if (setting.tableType) { |
| | | rowSelection = { |
| | |
| | | onChange: this.onSelectChange |
| | | } |
| | | } |
| | | |
| | | // 表格头部固定于顶部时,判断距顶部高度 |
| | | let offset = null |
| | | if (setting.columnfixed) { |
| | | // 表格头部固定于顶部时,判断距顶部高度 |
| | | if (this.props.tableId === 'mainTable' && setting.columnfixed) { |
| | | if (!setting.actionfixed) { |
| | | offset = 48 |
| | | } else { |
| | |
| | | } |
| | | } |
| | | |
| | | // 数据收起时,过滤已选数据 |
| | | let _data = this.props.data ? this.props.data : [] |
| | | |
| | | if (pickup) { |
| | |
| | | } |
| | | |
| | | return ( |
| | | <div className="main-table"> |
| | | {setting.columnfixed && <Affix offsetTop={offset} className="fix-header"> |
| | | <div className="normal-data-table"> |
| | | {offset && <Affix offsetTop={offset} className="fix-header"> |
| | | <Table |
| | | size="middle" |
| | | bordered={true} |