This commit is contained in:
dxc
2026-06-25 15:44:31 +08:00
parent c1092407ad
commit 6a895347d0
3 changed files with 59 additions and 39 deletions

View File

@ -239,7 +239,7 @@ const handleLogout = () => {
<footer v-if="!isLoginPage" class="app-footer">
<span class="version-tag">
<el-icon style="vertical-align: middle; margin-right: 4px"><InfoFilled /></el-icon>
当前版本:V3.50
当前版本:V3.51
</span>
</footer>

View File

@ -209,27 +209,34 @@
</el-form-item>
</el-form>
<!-- 齐套性分析警告 -->
<!-- BOM 物料清单全量展示无库存排上面 -->
<el-alert
v-if="selectedBomNo && shortageList.length > 0 && bomSets > maxBuildableSets"
type="error"
v-if="selectedBomNo && bomDetailList.length > 0"
:type="hasShortage ? 'error' : 'success'"
:closable="false"
style="margin: 16px 0;"
>
<template #title>
<span style="font-weight: bold;">库存不足以组成 {{ bomSets }} 缺少以下物料</span>
<span style="font-weight: bold;">
{{ hasShortage ? `库存不足以组成 ${bomSets} 套,物料清单:` : `物料清单(共 ${bomDetailList.length} 种):` }}
</span>
</template>
<el-table :data="shortageList" size="small" border style="margin-top: 8px; width: 100%;">
<el-table :data="bomDetailList" size="small" border style="margin-top: 8px; width: 100%;">
<el-table-column prop="name" label="物料名称" min-width="120" />
<el-table-column prop="sku" label="SKU" width="100" />
<el-table-column label="需补足数量" width="100">
<el-table-column label="需量" width="80">
<template #default="{ row }">
<span style="color: #F56C6C; font-weight: bold;">{{ row.shortage }}</span>
<span>{{ row.need }}</span>
</template>
</el-table-column>
<el-table-column label="可用库存" width="80">
<template #default="{ row }">
<span>{{ row.available }}</span>
<span :style="{ color: row.available === 0 ? '#F56C6C' : '', fontWeight: row.available === 0 ? 'bold' : '' }">{{ row.available }}</span>
</template>
</el-table-column>
<el-table-column label="缺料" width="80">
<template #default="{ row }">
<span :style="{ color: row.shortage > 0 ? '#F56C6C' : '#67C23A', fontWeight: 'bold' }">{{ row.shortage > 0 ? row.shortage : '✓' }}</span>
</template>
</el-table-column>
</el-table>
@ -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('')

View File

@ -209,27 +209,34 @@
</el-form-item>
</el-form>
<!-- 齐套性分析警告 -->
<!-- BOM 物料清单全量展示无库存排上面 -->
<el-alert
v-if="selectedBomNo && shortageList.length > 0 && bomSets > maxBuildableSets"
type="error"
v-if="selectedBomNo && bomDetailList.length > 0"
:type="hasShortage ? 'error' : 'success'"
:closable="false"
style="margin: 16px 0;"
>
<template #title>
<span style="font-weight: bold;">库存不足以组成 {{ bomSets }} 缺少以下物料</span>
<span style="font-weight: bold;">
{{ hasShortage ? `库存不足以组成 ${bomSets} 套,物料清单:` : `物料清单(共 ${bomDetailList.length} 种):` }}
</span>
</template>
<el-table :data="shortageList" size="small" border style="margin-top: 8px; width: 100%;">
<el-table :data="bomDetailList" size="small" border style="margin-top: 8px; width: 100%;">
<el-table-column prop="name" label="物料名称" min-width="120" />
<el-table-column prop="sku" label="SKU" width="100" />
<el-table-column label="需补足数量" width="100">
<el-table-column label="需量" width="80">
<template #default="{ row }">
<span style="color: #F56C6C; font-weight: bold;">{{ row.shortage }}</span>
<span>{{ row.need }}</span>
</template>
</el-table-column>
<el-table-column label="可用库存" width="80">
<template #default="{ row }">
<span>{{ row.available }}</span>
<span :style="{ color: row.available === 0 ? '#F56C6C' : '', fontWeight: row.available === 0 ? 'bold' : '' }">{{ row.available }}</span>
</template>
</el-table-column>
<el-table-column label="缺料" width="80">
<template #default="{ row }">
<span :style="{ color: row.shortage > 0 ? '#F56C6C' : '#67C23A', fontWeight: 'bold' }">{{ row.shortage > 0 ? row.shortage : '✓' }}</span>
</template>
</el-table-column>
</el-table>
@ -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) => {