<template>
  <!-- 列表 -->
  <ContentWrap>
    <el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true">

      <el-table-column label="产品" align="center" prop="productName" />
      <el-table-column label="成品数量" align="center" prop="qualityNumber" />
      <el-table-column label="废品数量" align="center" prop="wasteNumber" />
      <el-table-column label="总数量" align="center" prop="totalNumber" />
      <el-table-column label="成品率%" align="center" prop="qualityRate" :formatter="erpCountTableColumnFormatter"/>
      <el-table-column label="打包数量" align="center" prop="packageNumber" />
      <el-table-column label="备注" align="center" prop="remark" />
    </el-table>
  </ContentWrap>
</template>
<script setup lang="ts">
import { DICT_TYPE } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'
import { ProduceReportApi } from '@/api/mes/producereport'
import {erpCountTableColumnFormatter} from "@/utils";

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

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

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

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

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