king
2022-11-07 af6486b3629d23e426ce85b87dbc20dfa15b1afe
src/tabviews/custom/components/share/normalTable/index.jsx
@@ -404,12 +404,12 @@
    columns: PropTypes.array,        // 表格列
    lineMarks: PropTypes.array,      // 行标记
    fields: PropTypes.array,         // 组件字段集
    ContainerId: PropTypes.any,      // 标签页外层Id
    data: PropTypes.any,             // 表格数据
    total: PropTypes.any,            // 总数
    loading: PropTypes.bool,         // 表格加载中
    refreshdata: PropTypes.func,     // 表格中排序列、页码的变化时刷新
    chgSelectData: PropTypes.func,   // 数据切换
    autoMatic: PropTypes.any
  }
  state = {
@@ -549,9 +549,17 @@
  }
  componentDidMount () {
    MKEmitter.addListener('mkCheckTopLine', this.mkCheckTopLine)
    const { autoMatic } = this.props
    MKEmitter.addListener('mkCheckAll', this.mkCheckAll)
    MKEmitter.addListener('resetTable', this.resetTable)
    if (autoMatic === true) {
      MKEmitter.addListener('autoQueryData', this.autoQueryData)
      MKEmitter.addListener('autoSelectData', this.autoSelectData)
    }
    MKEmitter.addListener('mkCheckTopLine', this.mkCheckTopLine)
  }
  /**
@@ -561,9 +569,50 @@
    this.setState = () => {
      return
    }
    MKEmitter.removeListener('mkCheckTopLine', this.mkCheckTopLine)
    MKEmitter.removeListener('mkCheckAll', this.mkCheckAll)
    MKEmitter.removeListener('resetTable', this.resetTable)
    MKEmitter.removeListener('autoQueryData', this.autoQueryData)
    MKEmitter.removeListener('autoSelectData', this.autoSelectData)
    MKEmitter.removeListener('mkCheckTopLine', this.mkCheckTopLine)
  }
  autoSelectData = (id, index) => {
    if (id !== this.props.MenuID) return
    const { pageSize, pageIndex } = this.state
    let i = index - (pageIndex - 1) * pageSize - 1
    if (this.props.data[i]) {
      this.changeRow(this.props.data[i], i)
      MKEmitter.emit('autoTransSelectData', this.props.MenuID, this.props.data[i])
    } else {
      MKEmitter.emit('autoMaticOver', this.props.MenuID)
    }
  }
  autoQueryData = (id, index) => {
    if (id !== this.props.MenuID) return
    const { total } = this.props
    const { pageSize } = this.state
    if (index !== 1 && (!total || index > total)) {
      MKEmitter.emit('autoMaticOver', this.props.MenuID)
      return
    }
    console.clear()
    let pageIndex = Math.ceil(index / pageSize)
    this.setState({
      pageIndex: pageIndex,
      selectedRowKeys: [],
      activeIndex: null
    })
    this.props.refreshdata({pageIndex})
  }
  mkCheckTopLine = (menuId, id) => {