import React, { Component } from 'react';
import {
  WeaTableEditable,
  WeaLocaleProvider
} from "ecCom";

const {getLabel} = WeaLocaleProvider;

export default class ShareTable extends Component {
  constructor(props) {
    super(props);
    this.state = {
      columns: [{
        title: <span>{getLabel(21956,'对象类型')}</span>,
        dataIndex: 'type',
        width: '30%',
        com: [{
          type: 'INPUT',
          key: 'type',
          viewAttr: 1,
        }]
      }, {
        title: <span>{getLabel(106,'对象')}</span>,
        dataIndex: 'content',
        width: '30%',
        com: [{
          type: 'INPUT',
          key: 'content',
          viewAttr: 1,
        }]
      }, {
        title: <span>{getLabel(683,'安全级别')}</span>,
        dataIndex: 'seclevel',
        width: '40%',
        com: [{
          type: 'INPUT',
          key: 'seclevel',
          viewAttr: 1,
        }]
      }]
    }
  }
  
  render() {
    return (
      <WeaTableEditable ecId={`${this && this.props && this.props.ecId || ''}_WeaTableEditable@7l92yo`} 
        columns={(this.props && this.props.columns) ? this.props.columns : this.state.columns}
        datas={this.props.datas || []}
        showTitle={false}
        onRowSelect={selectedRowKeys => {
          if(this.props && this.props.onRowSelect && typeof(this.props.onRowSelect) === "function") {
            this.props.onRowSelect(selectedRowKeys);
          }
        }}
      />
    )
  }
}
