<!--
 * @Date: 2021-02-20 10:45:21
 * @LastEditors: gtz
 * @LastEditTime: 2022-06-15 15:34:49
 * @FilePath: \mt-bus-fe\src\views\EquipmentManager\BOMManager\components\statusBtn.vue
 * @Description:
-->
<template>
  <el-switch v-model="injectData.enabled" :active-value="1" :inactive-value="0" @change="changeStatus" />
</template>

<script>
import { editBOM } from '@/api/equipment/bom'
export default {
  props: {
    injectData: {
      type: Object,
      default: () => ({})
    }
  },
  methods: {
    async changeStatus() {
      const result = await editBOM(this.injectData)
      if (result.code === 0) {
        this.$message.success(this.$t('module.equipmentManager.bom.succeeded'))
        this.$emit('emitData')
      }
    }
  }
}
</script>
