<template>
  <div>


    <el-tabs v-model="activeName" type="border-card" style="margin: 15px" @tab-click="handleTabClick">
      <el-tab-pane label="上传失败" name="second3" >
        <prescribePanel
          ref="prescribePanel3"
          style="margin: -15px"
          :tagStatus="3"
          :RowType="type"
          :workPlaceCode="workPlaceCode"
          :buttonType="3"
          :status="3"
        ></prescribePanel>
      </el-tab-pane>
      <el-tab-pane label="未上传单" name="second1" >
        <prescribePanel
          ref="prescribePanel1"
          style="margin: -15px"
          :tagStatus="3"
          :RowType="type"
          :workPlaceCode="workPlaceCode"
          :buttonType="1"
          :status="1"
        ></prescribePanel>
      </el-tab-pane>
      <el-tab-pane label="已上传单" name="second2">
        <prescribePanel
          ref="prescribePanel2"
          style="margin: -15px"
          :tagStatus="3"
          :RowType="type"
          :workPlaceCode="workPlaceCode"
          :buttonType="2"
          :status="2"
        ></prescribePanel>
      </el-tab-pane>
    </el-tabs>


  </div>
</template>

<script>

import prescribePanel from "./PanelOrderUpload";

/**
 * 已完成处方
 */
export default {
  name: "PrescribeTagCode",
  components: {
    prescribePanel
  },
  data() {
    return {
      type: 1,
      workPlaceCode: null,
      activeName: 'second3'

    }
  },
  methods: {

    handleTabClick(tab) {
      if (tab.name === 'second1') {
        if (this.$refs.prescribePanel1) {
          this.$refs.prescribePanel1.getList();
        }
      } else if (tab.name === 'second2') {
        if (this.$refs.prescribePanel2) {
          this.$refs.prescribePanel2.getList();
        }

      } else if (tab.name === 'second3') {
        if (this.$refs.prescribePanel3) {
          this.$refs.prescribePanel3.getList();
        }

      }
    }
  },
  created() {

    console.log('window.location.aaa',this.$route.query.status)
    if (this.$route.query.workplaceId != null){
      this.workPlaceCode = Number(this.$route.query.workplaceId);
    }

    if('1' == this.$route.query.status
      || '2' == this.$route.query.status
      || '3' == this.$route.query.status

    ){
      this.activeName = 'second'+this.$route.query.status
    }else {
      this.activeName = 'second3'

    }
  }

}
</script>

<style scoped>

</style>
