<template>
    <el-table class="simple-table" :data="list" style="width: 100%;">
      <el-table-column prop="name" label="名称" show-overflow-tooltip/>
      <el-table-column prop="productionBatchCode" label="生产批号" show-overflow-tooltip/>
      <el-table-column prop="expiryDate" label="有效期至"/>
      <el-table-column prop="productionDate" label="生产日期"/>
      <el-table-column prop="purchaseUnitPrice">
        <template #header>
          进价(元/{{ packagingUnit }})
        </template>
      </el-table-column>
      <el-table-column prop="fragmentPrice">
        <template #header>
          进价(元/{{ minPackagingUnit }})
        </template>
      </el-table-column>
      <el-table-column prop="wholeNumber" label="数量">
        <template #default="{row}">
          {{ row.wholeNumber }}
          {{ row.packagingUnit }}
          <template v-if="row.fragmentNumber!=0">
            {{ row.fragmentNumber }}
            {{ row.minPackagingUnit }}
          </template>
        </template>
      </el-table-column>
      <el-table-column prop="inventoryPurchaseCode" label="采购单号" show-overflow-tooltip/>
    </el-table>
</template>
<script setup lang="ts">
import {ref} from "vue";
import {post} from "@/utils/request.ts";
const packagingUnit = ref();
const minPackagingUnit = ref();
const show = ref(false)
const list = ref()
const init = (goodId: any) => {
  post("inventory/goods/getListByGoodsId", {goodsId: goodId}).then((res) => {
        list.value = res
        if (list.value.length == 0) return
        packagingUnit.value = list.value[0].packagingUnit
        minPackagingUnit.value = list.value[0].minPackagingUnit
        show.value = true
      }
  )
}
defineExpose({init})
</script>
<style scoped lang="scss">
//::v-deep .el-scrollbar {
//  height: 50px;
//}
</style>