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 @@
-
+
- 库存不足以组成 {{ bomSets }} 套,缺少以下物料:
+
+ {{ hasShortage ? `库存不足以组成 ${bomSets} 套,物料清单:` : `物料清单(共 ${bomDetailList.length} 种):` }}
+
-
+
-
+
- {{ row.shortage }}
+ {{ row.need }}
- {{ row.available }}
+ {{ row.available }}
+
+
+
+
+ {{ row.shortage > 0 ? row.shortage : '✓' }}
@@ -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 @@
-
+
- 库存不足以组成 {{ bomSets }} 套,缺少以下物料:
+
+ {{ hasShortage ? `库存不足以组成 ${bomSets} 套,物料清单:` : `物料清单(共 ${bomDetailList.length} 种):` }}
+
-
+
-
+
- {{ row.shortage }}
+ {{ row.need }}
- {{ row.available }}
+ {{ row.available }}
+
+
+
+
+ {{ row.shortage > 0 ? row.shortage : '✓' }}
@@ -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) => {