From cb9cd49627b65a4c0e137e08063271a8cefe1826 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期四, 23 七月 2026 17:48:49 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_pro2.0' into dev_pro2.0
---
src/views/wls/materialstock/components/batch-config-display.vue | 89 +++++++++-----------------------------------
1 files changed, 19 insertions(+), 70 deletions(-)
diff --git a/src/views/wls/materialstock/components/batch-config-display.vue b/src/views/wls/materialstock/components/batch-config-display.vue
index ff4c52b..01a4cf0 100644
--- a/src/views/wls/materialstock/components/batch-config-display.vue
+++ b/src/views/wls/materialstock/components/batch-config-display.vue
@@ -1,92 +1,41 @@
<script lang="ts" setup>
-import type { MdmItemBatchConfigApi } from '#/api/mes/md/item-batch-config';
+import type { MdmItemApi } from '#/api/mdm/item';
-import { computed, ref, watch } from 'vue';
+import { computed } from 'vue';
import { Divider, Tag } from 'ant-design-vue';
-import { getItemBatchConfigByItemId } from '#/api/mes/md/item-batch-config';
-
const props = defineProps<{
- itemId?: number;
- isBatchManaged?: boolean;
+ item?: MdmItemApi.Item | null;
}>();
-// 鎵规閰嶇疆鏁版嵁
-const config = ref<MdmItemBatchConfigApi.ItemBatchConfig | null>(null);
-
-// 鏄惁鍔犺浇涓�
-const loading = ref(false);
-
// 鏄惁鏄剧ず锛堝惎鐢ㄦ壒娆$鐞嗘椂鏄剧ず锛�
-const visible = computed(() => props.isBatchManaged === true);
+const visible = computed(() => props.item?.isBatchManaged === true);
-// 宸插惎鐢ㄧ殑鎵规灞炴�у垪琛紙浠呬繚鐣�7涓瓧娈碉級
+// 宸插惎鐢ㄧ殑鎵规灞炴�у垪琛�
const enabledProps = computed(() => {
- if (!config.value) return [];
- const props: { label: string; value: boolean }[] = [];
- if (config.value.produceDateFlag) props.push({ label: '鐢熶骇鏃ユ湡', value: true });
- if (config.value.expireDateFlag) props.push({ label: '鏈夋晥鏈�', value: true });
- if (config.value.receiptDateFlag) props.push({ label: '鍏ュ簱鏃ユ湡', value: true });
- if (config.value.vendorFlag) props.push({ label: '渚涘簲鍟�', value: true });
- if (config.value.purchaseOrderCodeFlag) props.push({ label: '閲囪喘璁㈠崟鍙�', value: true });
- if (config.value.lotNumberFlag) props.push({ label: '鐢熶骇鎵瑰彿', value: true });
- if (config.value.qualityStatusFlag) props.push({ label: '璐ㄩ噺鐘舵��', value: true });
- return props;
-});
-
-/** 鍔犺浇鎵规閰嶇疆 */
-async function loadConfig() {
- if (!props.itemId || !props.isBatchManaged) {
- config.value = null;
- return;
- }
- loading.value = true;
- try {
- const data = await getItemBatchConfigByItemId(props.itemId);
- config.value = data;
- } catch {
- config.value = null;
- } finally {
- loading.value = false;
- }
-}
-
-/** 閲嶇疆 */
-function reset() {
- config.value = null;
- loading.value = false;
-}
-
-// 鐩戝惉 itemId 鍙樺寲锛屽姞杞介厤缃�
-watch(
- () => [props.itemId, props.isBatchManaged],
- () => {
- if (props.itemId && props.isBatchManaged) {
- loadConfig();
- } else {
- reset();
- }
- },
- { immediate: true },
-);
-
-defineExpose({
- loadConfig,
- reset,
+ 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="mt-4 rounded border border-gray-200 bg-gray-50 p-4">
+ <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="loading" class="text-center text-gray-500">鍔犺浇涓�...</div>
- <div v-else-if="enabledProps.length === 0" class="text-center text-gray-500">
+ <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.label" color="blue">
- {{ prop.label }}
+ <Tag v-for="prop in enabledProps" :key="prop" color="blue">
+ {{ prop }}
</Tag>
</div>
<p class="mt-2 text-xs text-gray-500">
--
Gitblit v1.9.3