<template>
  <div>
      <el-button slot="reference" size="mini" style="width:100%" :type="!disabled?'':'primary'" :disabled="!disabled" @click="copyData">复 制</el-button>
  </div>
</template>

<script>
export default {
  name: "copyTo",
  props:["data","disabled"],
  data(){
    return {
      historicalData:[],
      historicalShow:false,
      total:0,
      currentPage:0,
      saQuotedPriceData:'',
      param:{
        "content": {
          "isExport": 0,
          "pageNumber": 1,
          "pageSize": 10,
          "where": {
            "status": "",
            "isproject": "",
            "startdate": "",
            "enddate": ""
          },
          "type": "0",
          "sa_quotedpriceid":""
        },
        "id": 20221209093003,
      }
    }
  },
  methods:{
    async copyData(){
      const res = await this.$api.requested({
        "content": {
          "sa_quotedpriceid":this.$route.query.id
        },
        "id": 20221209094103,
      })
      this.saQuotedPriceData = res.data
      this.copyList()
    },
    copyList(){
      this.$store.dispatch('changeDetailDrawer',false)
      setTimeout(()=>{
        this.$router.replace({
          path:'/quotedPriceDetail',
          query:{
            id:this.saQuotedPriceData.sa_quotedpriceid
          }
        })
        this.$store.dispatch('changeDetailDrawer',true)
      },500)


    },
    handleSizeChange(val) {
      // console.log(`每页 ${val} 条`);
      this.param.content.pageSize = val
      this.listData()
    },
    handleCurrentChange(val) {
      // console.log(`当前页: ${val}`);
      this.param.content.pageNumber = val
      this.listData()
    },
  },
  mounted() {

  }
}
</script>

<style scoped>

</style>