<template>
  <div>
    <byTable :hidePagination="true" :source="formData.data.purchasePendingStorageBomList" :config="config" :loading="loading" highlight-current-row>
      <template #dimension="{ item }">
        <div>{{ item.bomSpecLength }} * {{ item.bomSpecWidth }} * {{ item.bomSpecHeight }}</div>
      </template>
    </byTable>
    <div style="text-align: center; margin: 10px">
      <el-button @click="clickCancel()" size="large">关 闭</el-button>
    </div>
  </div>
</template>

<script setup>
import byTable from "/src/components/byTable/index";

const { proxy } = getCurrentInstance();
const loading = ref(false);
const formData = reactive({
  data: {
    purchaseId: "",
    arrivalCode: "",
    purchasePendingStorageBomList: [],
  },
});
const config = computed(() => {
  return [
    {
      attrs: {
        label: "采购合同",
        prop: "purchaseCode",
        width: 160,
      },
    },
    {
      attrs: {
        label: "仓库",
        prop: "warehouseName",
        width: 140,
      },
    },
    {
      attrs: {
        label: "品号",
        prop: "bomSpecCode",
        width: 140,
      },
    },
    {
      attrs: {
        label: "品名",
        prop: "bomSpecName",
      },
    },
    {
      attrs: {
        label: "单品尺寸",
        slot: "dimension",
        width: 160,
      },
    },
    {
      attrs: {
        label: "到货数量",
        prop: "arrivalQuantity",
        width: 140,
      },
    },
  ];
});
const emit = defineEmits(["clickCancel"]);
const clickCancel = () => {
  emit("clickCancel", false);
};
const props = defineProps({
  rowData: Object,
});
onMounted(() => {
  if (props.rowData && props.rowData.id) {
    proxy.post("/purchasePendingStorage/detail", { id: props.rowData.id }).then((res) => {
      formData.data = res;
    });
  }
});
</script>

<style lang="scss" scoped></style>
