<template>
  <div>
    <el-descriptions :column="1" border v-if="bomInfo.length > 0">
      <el-descriptions-item v-for="item in bomInfo" :key="item.attrKey" :label="item.attrKey">
        {{ item.attrValue }}
      </el-descriptions-item>
    </el-descriptions>
    <div v-else>
      <el-empty description="暂无BOM信息" />
    </div>
  </div>
</template>

<script>
import { listBomItem } from '../../../api/wms/bomItem';

export default {
  name: 'BomInfo',
  props: {
    bomId: {
      type: [String, Number],
      required: true
    }
  },
  data() {
    return {
      bomInfo: []
    }
  },
  created() {
    this.getBomInfo();
  },
  methods: {
    getBomInfo() {
      listBomItem({ bomId: this.bomId }).then(res => {
        this.bomInfo = res.rows;
      })
    }
  }
}
</script>