<template>
  <!-- 列表 -->
  <ContentWrap>
    <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">
      <el-table-column label="原料" align="center" prop="productName" width="160px" />
      <el-table-column label="单位" align="center" prop="unitName" width="80px"/>
      <el-table-column label="需求数量" align="center" prop="number" width="120px" />
      <el-table-column label="已下料" align="center" prop="finishNumber"  width="120px"/>
      <el-table-column label="进度" align="center" >
        <template #default="scope">
          <el-progress :percentage="erpPriceInputFormatter((scope.row.finishNumber/scope.row.number)*100)" :stroke-width="15" striped striped-flow />
        </template>
      </el-table-column>
      <!-- <el-table-column label="操作" align="center"/> -->
    </el-table>
  </ContentWrap>
</template>
<script setup lang="ts">
import { ItemRequisitionApi } from '@/api/mes/itemrequisition'
import {DICT_TYPE} from "@/utils/dict";
import {erpPriceInputFormatter} from "@/utils";

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

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

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


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