修改比对规则

This commit is contained in:
wuweihua
2026-10-21 11:01:59 +08:00
parent 36837f94bf
commit 8f1cf5c755
5 changed files with 384 additions and 105 deletions
@@ -1,5 +1,5 @@
<template>
<el-drawer v-model="visible" size="920px" title="产品库比对(套餐销售价)" append-to-body destroy-on-close>
<el-drawer v-model="visible" size="920px" title="产品套餐比对" append-to-body destroy-on-close>
<div v-loading="loading">
<el-empty v-if="!loading && !result" description="暂无结果" />
<template v-else-if="result">
@@ -7,7 +7,8 @@
<el-descriptions-item label="筛选订单数">{{ result.orderTotal ?? 0 }}</el-descriptions-item>
<el-descriptions-item label="套餐截止时间">{{ result.asOfTime || '-' }}</el-descriptions-item>
<el-descriptions-item label="套餐产品数">{{ result.packageProductCount ?? 0 }}</el-descriptions-item>
<el-descriptions-item label="库内/缺失">
<el-descriptions-item label="订单产品数">{{ result.distinctOrderProducts ?? 0 }}</el-descriptions-item>
<el-descriptions-item label="命中/缺失">
<el-tag type="success" size="small">{{ result.matchedCount ?? 0 }}</el-tag>
<span class="sep">/</span>
<el-tag type="danger" size="small">{{ result.missingCount ?? 0 }}</el-tag>
@@ -18,33 +19,49 @@
<el-tab-pane :label="missingTabLabel" name="missing">
<el-table :data="result.missingProducts || []" border size="small" max-height="520">
<el-table-column prop="customerCode" label="客户代码" min-width="110" show-overflow-tooltip />
<el-table-column prop="productCode" label="套餐产品代码" min-width="130" show-overflow-tooltip />
<el-table-column prop="upstreamCode" label="上游产品代码" min-width="120" show-overflow-tooltip />
<el-table-column prop="productName" label="产品名称" min-width="140" show-overflow-tooltip />
<el-table-column prop="mappedCode" label="映射后代码" min-width="120" show-overflow-tooltip>
<template #default="{ row }">{{ row.mappedCode || '-' }}</template>
</el-table-column>
<el-table-column prop="orderCount" label="订单数" width="100" align="center">
<template #default="{ row }">
<el-button link type="primary" :title="'点击查订单'" @click="openOrders(row)">{{ row.orderCount ?? 0 }}</el-button>
</template>
</el-table-column>
</el-table>
<el-empty v-if="!(result.missingProducts || []).length" description="未发现产品库缺失" />
<el-empty v-if="!(result.missingProducts || []).length" description="未发现缺失产品" />
</el-tab-pane>
<el-tab-pane :label="packageTabLabel" name="package">
<el-table :data="result.packageProducts || []" border size="small" max-height="520">
<el-tab-pane label="全部比对" name="all">
<el-table :data="result.orderProducts || []" border size="small" max-height="520">
<el-table-column prop="customerCode" label="客户代码" min-width="110" show-overflow-tooltip />
<el-table-column prop="productCode" label="套餐产品代码" min-width="130" show-overflow-tooltip />
<el-table-column prop="upstreamCode" label="上游产品代码" min-width="120" show-overflow-tooltip />
<el-table-column prop="productName" label="产品名称" min-width="140" show-overflow-tooltip />
<el-table-column label="产品库" width="110" align="center">
<el-table-column prop="mappedCode" label="映射后代码" min-width="120" show-overflow-tooltip>
<template #default="{ row }">{{ row.mappedCode || '-' }}</template>
</el-table-column>
<el-table-column label="是否在套餐" width="120" align="center">
<template #default="{ row }">
<el-tag v-if="row.inLibrary" size="small" type="success">在库</el-tag>
<el-tag v-else size="small" type="danger">不在库</el-tag>
<el-tag v-if="row.covered" size="small" type="success">在套餐</el-tag>
<el-tag v-else size="small" type="danger">不在套餐</el-tag>
</template>
</el-table-column>
<el-table-column label="命中方式" min-width="140" show-overflow-tooltip>
<template #default="{ row }">{{ hitText(row) }}</template>
</el-table-column>
<el-table-column prop="orderCount" label="订单数" width="100" align="center">
<template #default="{ row }">
<el-button link type="primary" @click="openOrders(row)">{{ row.orderCount ?? 0 }}</el-button>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<el-tab-pane :label="packageTabLabel" name="package">
<el-table :data="result.packageProducts || []" border size="small" max-height="520">
<el-table-column prop="customerCode" label="客户代码" min-width="110" show-overflow-tooltip />
<el-table-column prop="productCode" label="套餐产品代码" min-width="130" show-overflow-tooltip />
<el-table-column prop="productName" label="产品名称" min-width="160" show-overflow-tooltip />
</el-table>
<el-empty v-if="!(result.packageProducts || []).length" description="客户未绑定套餐产品" />
</el-tab-pane>
</el-tabs>
@@ -87,17 +104,25 @@ const packageTabLabel = computed(() => {
return '套餐产品 (' + n + ')'
})
function hitText(row) {
if (!row) return '-'
if (row.inPackage) return '直接命中'
if (row.mappedInPackage) return '映射后命中'
if (row.mappedCode) return '有映射但仍不在套餐'
return '无映射'
}
function openOrders(row) {
if (!row || !row.productCode || !lastQuery.value) {
if (!row || !row.upstreamCode || !lastQuery.value) {
ElMessage.warning('请先选择客户并选择计费时间')
return
}
const q = {
...lastQuery.value,
customerCodes: row.customerCode ? [row.customerCode] : lastQuery.value.customerCodes,
productCode: row.productCode
productCode: row.upstreamCode
}
orderDialogTitle.value = '产品订单: ' + row.productCode
orderDialogTitle.value = '产品订单: ' + row.upstreamCode
orderDialogVisible.value = true
orderRows.value = []
orderLoading.value = true
@@ -128,7 +153,7 @@ function open(query) {
if ((result.value?.missingCount || 0) > 0) {
activeTab.value = 'missing'
} else {
activeTab.value = 'package'
activeTab.value = 'all'
}
}).catch(() => {
result.value = null