<template>
  <!-- 列表 -->
  <ContentWrap>
    <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
<!--      <el-table-column label="ID" align="center" prop="id" />-->
      <el-table-column :label="t('FactoryModeling.ProductBOM.detailTableMaterialColumn')" align="center" prop="productName" />
      <el-table-column :label="t('FactoryModeling.ProductBOM.detailTableUsageNumberColumn')" align="center" prop="usageNumber" />
      <el-table-column :label="t('FactoryModeling.ProductBOM.detailTableUnitColumn')" align="center" prop="unitName" />
      <el-table-column :label="t('FactoryModeling.ProductBOM.detailTableLossRateColumn')" align="center" prop="yieldRate" />
      <el-table-column :label="t('FactoryModeling.ProductBOM.detailTableRemarkColumn')" align="center" prop="remark" />

    </el-table>
  </ContentWrap>
</template>
<script setup lang="ts">

import { BomApi } from '@/api/mes/bom'

const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗

const props = defineProps<{
  bomId?: number // BOM ID（主表的关联字段）
}>()
const loading = ref(false) // 列表的加载中
const list = ref([]) // 列表的数据

/** 查询列表 */
const getList = async () => {
  loading.value = true
  try {
    list.value = await BomApi.getBomDetailListByBomId(props.bomId)
  } finally {
    loading.value = false
  }
}

/** 搜索按钮操作 */
const handleQuery = () => {
  queryParams.pageNo = 1
  getList()
}

/** 初始化 **/
onMounted(() => {
  getList()
})
</script>
