gaoluyang
昨天 b64a0deae5b5d33f9e20671a68936b27f0b9b00b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<script lang="ts" setup>
import type { MdmItemApi } from '#/api/mdm/item';
 
import { computed } from 'vue';
 
import { Divider, Tag } from 'ant-design-vue';
 
const props = defineProps<{
  item?: MdmItemApi.Item | null;
}>();
 
// 是否显示(启用批次管理时显示)
const visible = computed(() => props.item?.isBatchManaged === true);
 
// 已启用的批次属性列表
const enabledProps = computed(() => {
  if (!props.item) return [];
  const list: string[] = [];
  if (props.item.produceDateFlag) list.push('生产日期');
  if (props.item.expireDateFlag) list.push('有效期');
  if (props.item.receiptDateFlag) list.push('入库日期');
  if (props.item.vendorFlag) list.push('供应商');
  if (props.item.purchaseOrderCodeFlag) list.push('采购订单号');
  if (props.item.lotNumberFlag) list.push('生产批号');
  if (props.item.qualityStatusFlag) list.push('质量状态');
  return list;
});
</script>
 
<template>
  <div v-if="visible" class="mx-4 mt-4 rounded border border-gray-200 bg-gray-50 p-4">
    <Divider orientation="left">批次属性</Divider>
    <div v-if="enabledProps.length === 0" class="text-center text-gray-500">
      该物料未配置批次属性
    </div>
    <div v-else class="flex flex-wrap gap-2">
      <Tag v-for="prop in enabledProps" :key="prop" color="blue">
        {{ prop }}
      </Tag>
    </div>
    <p class="mt-2 text-xs text-gray-500">
      以上字段创建批次时必填
    </p>
  </div>
</template>