<template>
  <ElDialog v-model="showDialog"
    destroy-on-close
    width="fit-content"
    @close="dialogCloseHandler">
    <ElDescriptions title="入库单" border>
       <ElDescriptionsItem label="Id" prop="id">
        {{ detailData.id }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="编号" prop="sn">
        {{ detailData.sn }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="责任人 Id；sys_user.id" prop="responsibleId">
        {{ detailData.responsibleId }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="仓库 Id；wh_warehouse.id" prop="warehouseId">
        {{ detailData.warehouseId }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="存放位置" prop="location">
        {{ detailData.location }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="入库时间" prop="inTime">
        {{ detailData.inTime }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="采购单 Id；wh_purchase_order.id" prop="orderId">
        {{ detailData.orderId }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="采购单单号；wh_purchase_order.sn" prop="orderSn">
        {{ detailData.orderSn }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="产品分类 Id" prop="goodsCategoryId">
        {{ detailData.goodsCategoryId }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="分类名称" prop="goodsCategoryName">
        {{ detailData.goodsCategoryName }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="产品 Id" prop="goodsId">
        {{ detailData.goodsId }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="产品名称" prop="goodsName">
        {{ detailData.goodsName }}
      </ElDescriptionsItem>
      <ElDescriptionsItem label="产品编码" prop="goodSn">
        {{ detailData.goodSn }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="数量" prop="quantity">
        {{ detailData.quantity }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="计量单位；字典代码：unit" prop="unit">
        {{ detailData.unit }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="备注" prop="memo">
        {{ detailData.memo }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="创建人 Id； sys_user.id" prop="creatorId">
        {{ detailData.creatorId }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="修改人 Id； sys_user.id" prop="modifierId">
        {{ detailData.modifierId }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="创建时间" prop="createTime">
        {{ detailData.createTime }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="修改时间" prop="modifyTime">
        {{ detailData.modifyTime }}
      </ElDescriptionsItem>
       <ElDescriptionsItem label="是否删除； 0-->未删除、1-->已删除" prop="deleted">
        {{ detailData.deleted }}
      </ElDescriptionsItem>
    </ElDescriptions>
    <template #footer>
      <ElButton @click="showDialog = false" type="primary">关闭</ElButton>
    </template>
  </ElDialog>
</template>

<script lang="ts" setup>
import InOrderApi from '@/pages/wh/in-order/in-order-api.ts'
import Utils from '@/common/utils'

const showDialog = ref(false)

const detailData = Utils.resetAble(reactive<InOrderTypes.SearchInOrderResult>({}))

function dialogCloseHandler() {
  detailData.$reset()
}

defineExpose({
  open(data: InOrderTypes.SearchInOrderResult) {
    showDialog.value = true
    InOrderApi.detail(data.id!)
      .then(res => {
        detailData.$reset(res.data)
      })
  }
})
</script>

<style lang="stylus" scoped>

</style>
