<template>
  <div class="inline-16">
    <el-button-group>
      <el-button size="small" type="defalut" :disabled="rowindex === 1" @click="firstPage()">首条</el-button>
      <el-button size="small" type="defalut" :disabled="rowindex === 1" @click="previous()">上一条</el-button>
      <el-button size="small" type="defalut" @click="next()">下一条</el-button>
      <el-button size="small" type="defalut" @click="finalData()">末条</el-button>
    </el-button-group>
  </div>
</template>

<script>
export default {
  props:['data'],
  data () {
    return {
      rowindex:null
    }
  },
  created () {
    this.rowindex = Number(this.$route.query.rowindex)
  },
  beforeDestroy () {
    sessionStorage.removeItem('clue_pageTotal')
  },
  methods:{
    firstPage () {
      this.rowindex = 1
      this.switchOrderclueuploadbillMain(this.rowindex)
    },
    previous () {
      this.rowindex = Number(this.$route.query.rowindex) - 1
      this.switchOrderclueuploadbillMain(this.rowindex)
    },
    next () {
      this.rowindex = Number(this.$route.query.rowindex) + 1
      this.switchOrderclueuploadbillMain(this.rowindex)
    },
    finalData () {
      this.rowindex = JSON.parse(sessionStorage.getItem('clue_pageTotal'))
      this.switchOrderclueuploadbillMain(this.rowindex)
    },
    async switchOrderclueuploadbillMain (rowindex) {
      const res = await this.$api.requested({
        "classname":"webmanage.saletool.orderclue.orderclue",
        "method": "queryOrderclueuploadbillList",
        "content": {
          "rowindex": rowindex
        }
      })
      this.$router.replace({path:'/importClueDetail',query:{id:res.data.sat_orderclueuploadbillid,rowindex:rowindex}})
    },
  }
}

</script>
<style>
</style>