king
2020-12-25 e843aabbda5e8761b6a8af0fe85119bdcf5b3fe8
src/tabviews/custom/components/share/normalTable/index.jsx
@@ -387,16 +387,16 @@
    columns: null,        // 显示列
    activeIndex: null,    // 标记当前选中行
    rowspans: null,       // 行合并字段信息
    pickup: false
    pickup: false,        // 收起未选择项
    orderfields: {}       // 排序id与field转换
  }
  UNSAFE_componentWillMount () {
    const { menuType, memberLevel, setting, fields } = this.props
    let columns = fromJS(this.props.columns).toJS()
    let _columns = []
    const { menuType, memberLevel, setting, fields, columns } = this.props
    let radio = 5          // 虚化比例
    let _format = false    // 是否虚化处理
    let rowspans = []
    let orderfields = {}
    if (window.GLOB.dataFormat && menuType !== 'HS' && memberLevel) {
      _format = true
@@ -408,70 +408,50 @@
      }
    }
    columns.forEach(item => {
      if (item.hidden === true || item.Hide === 'true') return
      let cell = null
      if (item.type === 'colspan') {
        cell = {title: item.label, children: []}
        item.subcols.forEach(col => {
          if (col.rowspan === 'true') {
            rowspans.push(col.field)
    let getColumns = (cols) => {
      return cols.map(item => {
        let cell = null
        if (item.type === 'colspan') {
          cell = { title: item.label, align: item.Align }
          cell.children = getColumns(item.subcols)
        } else {
          if (item.rowspan === 'true') {
            rowspans.push(item.field)
          }
          if (_format && !Math.floor(Math.random() * radio)) {
            col.blur = true
            item.blur = true
          }
          if (item.marks && item.marks.length === 0) {
            item.marks = ''
          }
          if (col.marks && col.marks.length === 0) {
            col.marks = ''
          if (item.field) {
            orderfields[item.uuid] = item.field
          }
          cell.children.push({
            align: col.Align,
            title: col.label,
            dataIndex: col.field || col.uuid,
            key: col.uuid,
            width: col.Width || 120,
          cell = {
            align: item.Align,
            dataIndex: item.uuid,
            title: item.label,
            sorter: item.field && item.IsSort === 'true',
            width: item.Width || 120,
            onCell: record => ({
              record,
              col,
              config: col.type === 'custom' ? {setting, columns: fields} : null,
              col: item,
              config: item.type === 'custom' || item.type === 'action' ? {setting, columns: fields} : null,
              triggerLink: this.triggerLink,
              updateStatus: this.updateStatus
            })
          })
        })
      } else {
        if (item.rowspan === 'true') {
          rowspans.push(item.field)
          }
        }
        if (_format && !Math.floor(Math.random() * radio)) {
          item.blur = true
        }
        return cell
      })
    }
        if (item.marks && item.marks.length === 0) {
          item.marks = ''
        }
        cell = {
          align: item.Align,
          dataIndex: item.field || item.uuid,
          title: item.label,
          sorter: item.field && item.IsSort === 'true',
          width: item.Width || 120,
          onCell: record => ({
            record,
            col: item,
            config: item.type === 'custom' || item.type === 'action' ? {setting, columns: fields} : null,
            triggerLink: this.triggerLink,
            updateStatus: this.updateStatus
          })
        }
      }
      _columns.push(cell)
    })
    let _columns = getColumns(columns)
    if (rowspans.length === 0) {
      rowspans = null
@@ -479,7 +459,8 @@
    this.setState({
      columns: _columns,
      rowspans
      rowspans,
      orderfields
    })
  }
@@ -632,6 +613,8 @@
  }
  changeTable = (pagination, filters, sorter) => {
    const { orderfields } = this.state
    this.setState({
      pageIndex: pagination.current,
      pageSize: pagination.pageSize,
@@ -639,6 +622,9 @@
      activeIndex: null,
      pickup: false
    })
    sorter.field = orderfields[sorter.field] || ''
    this.props.refreshdata(pagination, filters, sorter)
  }