king
2019-12-18 1a14ff6035932eadfb6ef7970e3adb24b4e158a6
src/tabviews/commontable/mainTable/index.jsx
@@ -6,30 +6,29 @@
export default class MainTable extends Component {
  static propTpyes = {
    MenuID: PropTypes.string, // 菜单参数
    setting: PropTypes.object, // 表格头部是否固定于页面上方
    loading: PropTypes.bool,
    total: PropTypes.number,
    select: PropTypes.object,
    dict: PropTypes.object, // 字典项
    columns: PropTypes.array, // 表格列
    data: PropTypes.oneOfType([
      PropTypes.object,
      PropTypes.array
    ])
    dict: PropTypes.object,        // 字典项
    MenuID: PropTypes.string,      // 菜单Id
    setting: PropTypes.object,     // 表格全局设置:tableType(表格是否可选、单选、多选)、columnfixed(列固定)、actionfixed(按钮固定)
    columns: PropTypes.array,      // 表格列
    data: PropTypes.any,           // 表格数据
    total: PropTypes.number,       // 总数
    loading: PropTypes.bool,       // 表格加载中
    refreshdata: PropTypes.func,   // 表格中排序列、页码的变化时刷新
    buttonTrigger: PropTypes.func  // 表格中按钮触发操作
  }
  state = {
    selectedRowKeys: [],
    pageIndex: 1,
    pageSize: 10,
    columns: null
    selectedRowKeys: [], // 表格中选中行
    pageIndex: 1,        // 初始页面索引
    pageSize: 10,        // 每页数据条数
    columns: null        // 显示列
  }
  UNSAFE_componentWillMount () {
    const { columns } = this.props
    let _columns = []
    columns.forEach((item, index) => {
    columns.forEach(item => {
      let cell = {
        align: item.Align,
        dataIndex: item.field || item.uuid,
@@ -164,8 +163,7 @@
  actionTrigger = (e, btn, record) => {
    e.stopPropagation()
    console.log(btn)
    console.log(record)
    this.props.buttonTrigger(btn, record)
  }
  copycontent = (e, content) => {
@@ -251,9 +249,9 @@
      <div className="main-table">
        {this.props.setting.columnfixed && <Affix offsetTop={offset} className="fix-header">
          <Table
            size="middle"
            bordered={true}
            rowSelection={rowSelection}
            size="middle"
            columns={this.state.columns.map(column => {
              return {
                align: column.align,
@@ -265,9 +263,9 @@
          />
        </Affix>}
        <Table
          size="middle"
          bordered={true}
          rowSelection={rowSelection}
          size="middle"
          columns={this.state.columns}
          dataSource={this.props.data ? this.props.data : []}
          loading={this.props.loading}