From 6a895347d07ac534c3a4137c2a40cc63123be7f1 Mon Sep 17 00:00:00 2001 From: dxc Date: Thu, 25 Jun 2026 15:44:31 +0800 Subject: [PATCH] V3.51 --- inventory-web/src/App.vue | 2 +- .../src/views/borrow/apply/index.vue | 48 +++++++++++-------- .../src/views/outbound/Selection.vue | 48 +++++++++++-------- 3 files changed, 59 insertions(+), 39 deletions(-) diff --git a/inventory-web/src/App.vue b/inventory-web/src/App.vue index 46cfbb1..950f335 100644 --- a/inventory-web/src/App.vue +++ b/inventory-web/src/App.vue @@ -239,7 +239,7 @@ const handleLogout = () => { diff --git a/inventory-web/src/views/borrow/apply/index.vue b/inventory-web/src/views/borrow/apply/index.vue index ac8a493..f452fa0 100644 --- a/inventory-web/src/views/borrow/apply/index.vue +++ b/inventory-web/src/views/borrow/apply/index.vue @@ -209,27 +209,34 @@ - + - + - + + + + @@ -514,7 +521,7 @@ const maxBuildableSets = computed(() => { return result === Infinity ? 0 : result }) -const shortageList = computed(() => { +const bomDetailList = computed(() => { if (!currentBomDetail.value?.length || bomSets.value <= 0) return [] return currentBomDetail.value .map((bomItem: any) => { @@ -522,19 +529,22 @@ const shortageList = computed(() => { const totalNeed = dosage * bomSets.value const stock = parseFloat(bomItem.current_stock) || 0 const shortage = Math.max(0, totalNeed - stock) - return { ...bomItem, shortage, available: stock } + return { + name: bomItem.child_name || bomItem.name || '未知物料', + sku: bomItem.child_sku || bomItem.sku || '-', + need: totalNeed, + available: stock, + shortage + } + }) + .sort((a, b) => { + if (a.available === 0 && b.available > 0) return -1 + if (a.available > 0 && b.available === 0) return 1 + return b.shortage - a.shortage }) - .filter((item: any) => item.shortage > 0) - .map((item: any) => ({ - name: item.child_name || item.name || '未知物料', - sku: item.child_sku || item.sku || '-', - need: item.dosage * bomSets.value, - available: item.available, - shortage: item.shortage - })) }) -const hasShortage = computed(() => shortageList.value.length > 0 && bomSets.value > maxBuildableSets.value) +const hasShortage = computed(() => bomDetailList.value.some((item: any) => item.shortage > 0) && bomSets.value > maxBuildableSets.value) // 打印相关 const currentTime = ref('') diff --git a/inventory-web/src/views/outbound/Selection.vue b/inventory-web/src/views/outbound/Selection.vue index c3c05cf..073b992 100644 --- a/inventory-web/src/views/outbound/Selection.vue +++ b/inventory-web/src/views/outbound/Selection.vue @@ -209,27 +209,34 @@ - + - + - + + + + @@ -537,7 +544,7 @@ const maxBuildableSets = computed(() => { return result === Infinity ? 0 : result }) -const shortageList = computed(() => { +const bomDetailList = computed(() => { if (!currentBomDetail.value?.length || bomSets.value <= 0) return [] return currentBomDetail.value .map((bomItem: any) => { @@ -545,19 +552,22 @@ const shortageList = computed(() => { const totalNeed = dosage * bomSets.value const stock = parseFloat(bomItem.current_stock) || 0 const shortage = Math.max(0, totalNeed - stock) - return { ...bomItem, shortage, available: stock } + return { + name: bomItem.child_name || bomItem.name || '未知物料', + sku: bomItem.child_sku || bomItem.sku || '-', + need: totalNeed, + available: stock, + shortage + } + }) + .sort((a, b) => { + if (a.available === 0 && b.available > 0) return -1 + if (a.available > 0 && b.available === 0) return 1 + return b.shortage - a.shortage }) - .filter((item: any) => item.shortage > 0) - .map((item: any) => ({ - name: item.child_name || item.name || '未知物料', - sku: item.child_sku || item.sku || '-', - need: item.dosage * bomSets.value, - available: item.available, - shortage: item.shortage - })) }) -const hasShortage = computed(() => shortageList.value.length > 0 && bomSets.value > maxBuildableSets.value) +const hasShortage = computed(() => bomDetailList.value.some((item: any) => item.shortage > 0) && bomSets.value > maxBuildableSets.value) // --- 辅助方法 --- const getTypeTag = (type: string) => {