<template>
  <div>
    <el-select v-model="repairSelected">
      <el-option v-for="repair in repairList" :key="repair.id" :label="repair.name" :value="repair.id" />
    </el-select>
  </div>
</template>

<script>

import {getBaseTypeList} from "@/api/base/type";

export default {
  name: "RepairTypeChoose",
  data() {
    return {
      repairList: [],
      repairSelected: undefined,
    }
  },
  watch:{
    repairSelected(val){
      const repair = this.repairList.find(item => item.id === val)
      this.$emit('selected', repair)
    }
  },
  mounted() {
    this.listRepair()
  },
  methods: {
    async listRepair(){
      const res = await getBaseTypeList({type: "03"})
      this.repairList = res.data
    }
  }
}
</script>

<style scoped lang="scss">

</style>
