king
2019-11-28 213c70792e6af7f9ccef17d778c5f8806fbd513c
src/tabviews/commontable/mainTable/index.jsx
@@ -23,22 +23,39 @@
    selectedRowKeys: [],
    pageIndex: 1,
    pageSize: 10,
    columns: this.props.columns.map((item, index) => {
      return {
    columns: null
  }
  UNSAFE_componentWillMount () {
    const { columns } = this.props
    let _columns = []
    columns.forEach((item, index) => {
      // console.log(item)
      if (item.Hide === 'true') return
      let cell = {
        align: item.Align,
        dataIndex: item.field,
        dataIndex: item.uuid,
        title: item.label,
        // fixed: index < 3,
        sorter: item.IsSort === 'true',
        width: item.Width || 120,
        render: (text, record) => (
          <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"/> : ''} */}
          </div>
        )
        render: (text, record) => {
          let content = ''
          if (item.field) {
            content = record[item.field] || ''
          }
          return (
            <div className="content" style={{ minWidth: (item.Width || 120) + 'px' }}>
              {content}
            </div>
          )
        }
      }
      _columns.push(cell)
    })
    // {item.FieldName === 'MenuNo' ? <Icon onClick={(e) => {this.copycontent(e, record[item.FieldName])}} type="copy"/> : ''}
    this.setState({columns: _columns})
  }
  copycontent = (e, content) => {
@@ -60,12 +77,14 @@
  changeRow = (record, index) => {
    // 点击整行,触发切换,判断是否可选,单选或多选,进行对应操作
    if (!this.props.select || !this.props.select.selectable) return
    console.log(index)
    if (!this.props.setting.tableType) return
    let newkeys = JSON.parse(JSON.stringify(this.state.selectedRowKeys))
    console.log(newkeys)
    let _re = newkeys.includes(index)
    if (this.props.select.selectType === 'radio') {
    if (this.props.setting.tableType === 'radio') {
      this.setState({ selectedRowKeys: [index] })
    } else {
      if (_re) {