king
2024-05-08 d08fba77101b83f211738c722403506cc7dab50b
src/tabviews/custom/components/share/normalTable/index.jsx
@@ -507,7 +507,8 @@
    chgSelectData: PropTypes.func,   // 数据切换
    autoMatic: PropTypes.any,
    allSearch: PropTypes.any,
    colsCtrls: PropTypes.any
    colsCtrls: PropTypes.any,
    parCtrl: PropTypes.any
  }
  state = {
@@ -556,10 +557,7 @@
            if (item.rowspan === 'true') {
              rowspans.push(item.field)
            }
            if (item.type === 'index') {
              item.field = '$Index'
              item.type = 'text'
            } else if (_format && !Math.floor(Math.random() * radio)) {
            if (_format && !Math.floor(Math.random() * radio)) {
              item.blur = true
            }
  
@@ -655,7 +653,7 @@
  }
  UNSAFE_componentWillReceiveProps(nextProps) {
    const { allSearch } = this.props
    const { allSearch, parCtrl } = this.props
    const { allColumns } = this.state
    if (allSearch && !is(fromJS(allSearch), fromJS(nextProps.allSearch))) {
@@ -665,6 +663,36 @@
      }, () => {
        this.setState({reseting: false})
      })
    } else if (parCtrl && !is(fromJS(this.props.columns), fromJS(nextProps.columns))) {
      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 {
            cell = {
              align: item.Align,
              dataIndex: item.uuid,
              title: item.label,
              sorter: (item.field || item.sortField) && item.IsSort === 'true',
              width: item.Width || 120,
              onCell: record => ({
                record,
                col: item,
                config: item.type === 'custom' ? {setting: this.props.setting, columns: this.props.fields} : null,
              })
            }
          }
          return cell
        })
      }
      this.setState({
        columns: getColumns(nextProps.columns)
      })
    }
  }