king
2021-10-18 4b6a4e2f04f492d770573cf48ca52d4e748a086a
src/tabviews/zshare/normalTable/index.jsx
@@ -45,7 +45,6 @@
    total: PropTypes.any,            // 总数
    loading: PropTypes.bool,         // 表格加载中
    refreshdata: PropTypes.func,     // 表格中排序列、页码的变化时刷新
    handleTableId: PropTypes.func,   // 数据切换
    chgSelectData: PropTypes.func,   // 数据切换
  }
@@ -237,6 +236,8 @@
  componentDidMount () {
    MKEmitter.addListener('resetTable', this.resetTable)
    MKEmitter.addListener('autoQueryData', this.autoQueryData)
    MKEmitter.addListener('autoSelectData', this.autoSelectData)
    MKEmitter.addListener('mkTableCheckTopLine', this.mkTableCheckTopLine)
  }
@@ -248,6 +249,8 @@
      return
    }
    MKEmitter.removeListener('resetTable', this.resetTable)
    MKEmitter.removeListener('autoQueryData', this.autoQueryData)
    MKEmitter.removeListener('autoSelectData', this.autoSelectData)
    MKEmitter.removeListener('mkTableCheckTopLine', this.mkTableCheckTopLine)
  }
@@ -257,6 +260,43 @@
    if (this.props.data.length > 0) {
      this.changeRow(null, 0)
    }
  }
  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(null, 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
    }
    let pageIndex = Math.ceil(index / pageSize)
    this.setState({
      pageIndex: pageIndex,
      selectedRowKeys: [],
      activeIndex: null
    })
    this.props.refreshdata({pageIndex})
  }
  // 字段透视
@@ -1016,7 +1056,9 @@
  }
  changedata = (index) => {
    const { data, setting } = this.props
    const { data, setting, tableId, ContainerId } = this.props
    if (!tableId || !ContainerId) return
    let _id = ''
    let _data = ''
@@ -1026,13 +1068,13 @@
      _data = data[index] || ''
    }
    this.props.handleTableId(this.props.tableId, _id, _data)
    MKEmitter.emit('changeTableLine', ContainerId, tableId, _id, _data)
  }
  resetTable = (id, repage) => {
    const { MenuID, tableId } = this.props
    const { tableId } = this.props
    if (id !== (MenuID + tableId)) return
    if (id !== tableId) return
    if (repage === 'false') {
      this.setState({