<template>
  <div class="app-container">
    <el-tabs v-model="activeTab">
      <el-tab-pane label="待完成工单" name="unFinish">
        <TicketManagerItem :is-finish="false" :user-role="userRole"/>
      </el-tab-pane>
      <el-tab-pane label="已完成工单" name="finish">
        <TicketManagerItem :is-finish="true" :user-role="userRole"/>
      </el-tab-pane>
      <el-tab-pane :label="userRole !== 'repair_staff' ? '配件申请单' : '领退料确认'" name="getApply">
        <TicketWares :type="true" :user-role="userRole"/>
      </el-tab-pane>
<!--      <el-tab-pane label="退料申请单" name="backApply">-->
<!--        <TicketWares :type="false" :user-role="userRole"/>-->
<!--      </el-tab-pane>-->
    </el-tabs>
  </div>
</template>

<script>
import TicketManagerItem from "@/views/repair/tickets/Components/TicketManagerItem.vue";
import {getUserRole} from "@/api/repair/tickets/Tickets";
import TicketWares from "@/views/repair/tickets/Components/TicketWares.vue";

export default {
  name: "TicketManager",
  components: {TicketWares, TicketManagerItem},
  data() {
    return {
      activeTab: 'unFinish',
      userRole: "",
      exportRole:[3, 4]
    }
  },
  created() {
    this.judgeUserRole()
  },
  methods: {
    // 获得当前登录用户的角色信息
    async judgeUserRole(){
      const res = await getUserRole()
      this.userRole = res.data
    }
  }
}
</script>

<style scoped lang="scss">

</style>
