From 286619b69e4004c6bcaff4cb19a40b77b053453d Mon Sep 17 00:00:00 2001
From: xiaoyi <908147524@qq.com>
Date: 星期六, 07 十一月 2026 01:21:33 +0800
Subject: [PATCH] feat: 前端补齐排产约束、风险监测与招投标比价界面
---
src/views/srm/tender/detail.vue | 80 ++++++++++++++++++++++++++++++++++++++++
1 files changed, 80 insertions(+), 0 deletions(-)
diff --git a/src/views/srm/tender/detail.vue b/src/views/srm/tender/detail.vue
index 3fb5fbb..f6ad010 100644
--- a/src/views/srm/tender/detail.vue
+++ b/src/views/srm/tender/detail.vue
@@ -142,6 +142,9 @@
// ========== 鎶ヤ环绠$悊 ==========
const quoteList = ref<SrmTenderApi.QuoteVO[]>([]);
const quoteLoading = ref(false);
+const compareLoading = ref(false);
+const compareQuotes = ref<Record<number, SrmTenderApi.QuoteVO[]>>({});
+const compareLoaded = ref(false);
const quoteFormVisible = ref(false);
const quoteForm = ref<SrmTenderApi.QuoteVO>({ bidId: undefined!, tenderMaterialId: undefined! });
const selectedBidId = ref<number>();
@@ -176,8 +179,50 @@
else await createQuote(quoteForm.value);
quoteFormVisible.value = false;
await loadQuotes(selectedBidId.value);
+ compareLoaded.value = false;
} catch { /* 璇锋眰灞傚凡鎻愮ず閿欒锛屼繚鐣欒〃鍗� */ }
}
+
+/** 鎸夋姇鏍囧垎鍒鍙栨姤浠凤紝缂烘姤鐗╂枡涓嶅弬涓庡畬鏁存姤浠锋瘮杈冦�� */
+async function loadComparison() {
+ compareLoading.value = true;
+ compareLoaded.value = false;
+ try {
+ await Promise.all([loadBids(), loadMaterials()]);
+ const bids = bidList.value.filter((bid) => bid.id != null && bid.bidStatus !== BID_STATUS.WITHDRAWN);
+ const entries = await Promise.all(bids.map(async (bid) => [bid.id!, await getQuoteList(bid.id!)] as const));
+ compareQuotes.value = Object.fromEntries(entries);
+ compareLoaded.value = true;
+ } catch {
+ compareQuotes.value = {};
+ message.error('姣斾环鏁版嵁鍔犺浇澶辫触锛岃閲嶈瘯');
+ } finally {
+ compareLoading.value = false;
+ }
+}
+
+const comparisonRows = computed(() => bidList.value
+ .filter((bid) => bid.id != null && bid.bidStatus !== BID_STATUS.WITHDRAWN)
+ .map((bid) => {
+ const quotes = compareQuotes.value[bid.id!] || [];
+ const byMaterial = new Map(quotes.map((quote) => [quote.tenderMaterialId, quote]));
+ const valid = materialList.value.every((material) => material.id != null && byMaterial.get(material.id)?.quotePrice != null);
+ return { bid, quotes: byMaterial, complete: materialList.value.length > 0 && valid };
+ }));
+
+const comparableLowestPrices = computed(() => {
+ const result = new Map<number, number>();
+ for (const material of materialList.value) {
+ if (material.id == null) continue;
+ const quotes = comparisonRows.value.map((row) => row.quotes.get(material.id!))
+ .filter((quote): quote is SrmTenderApi.QuoteVO => quote?.quotePrice != null);
+ if (quotes.length < 2 || quotes.some((quote) => quote.taxRate == null)
+ || new Set(quotes.map((quote) => quote.taxRate)).size !== 1) continue;
+ const prices = quotes.map((quote) => Number(quote.quotePrice)).filter(Number.isFinite);
+ if (prices.length === quotes.length) result.set(material.id, Math.min(...prices));
+ }
+ return result;
+});
function handleAddQuote() {
quoteForm.value = { bidId: selectedBidId.value!, tenderMaterialId: undefined! };
quoteFormVisible.value = true;
@@ -752,6 +797,41 @@
</a-empty>
</a-tab-pane>
+ <a-tab-pane v-if="isSimpleMode" key="comparison">
+ <template #tab>
+ <a-space :size="4"><IconifyIcon icon="ant-design:table-outlined" />渚涘簲鍟嗘瘮浠�</a-space>
+ </template>
+ <div class="mb-3 flex items-center gap-3">
+ <a-button :loading="compareLoading" @click="loadComparison">{{ compareLoaded ? '鍒锋柊姣斾环' : '鍔犺浇姣斾环' }}</a-button>
+ <span class="text-gray-500">鎸夌墿鏂欏睍绀烘姤浠凤紱鑷冲皯涓ゅ绋庣巼涓�鑷存椂鏍囪鏈�浣庡崟浠凤紝缂烘姤鎴栫◣鐜囦笉鍚岄渶浜哄伐鏍稿锛屽畾鏍囪繕闇�鑰冭檻鍟嗗姟鏉′欢銆�</span>
+ </div>
+ <div v-if="compareLoaded" class="overflow-x-auto">
+ <table class="w-full border-collapse text-sm">
+ <thead><tr>
+ <th class="border p-2 text-left">渚涘簲鍟� / 鎶曟爣缂栧彿</th>
+ <th v-for="material in materialList" :key="material.id" class="border p-2 text-left">
+ {{ material.productName }}锛坽{ material.productCode }}锛� / {{ material.quantity }} {{ material.unit }}
+ </th>
+ <th class="border p-2 text-left">瀹屾暣鎬� / 鎶曟爣鎬婚</th>
+ </tr></thead>
+ <tbody><tr v-for="row in comparisonRows" :key="row.bid.id">
+ <td class="border p-2">{{ row.bid.supplierName }}<br />{{ row.bid.bidNo }}</td>
+ <td v-for="material in materialList" :key="material.id" class="border p-2">
+ <template v-if="material.id != null && row.quotes.get(material.id)?.quotePrice != null">
+ 鍗曚环 {{ row.quotes.get(material.id)?.quotePrice }}<br />
+ <a-tag v-if="comparableLowestPrices.has(material.id) && Number(row.quotes.get(material.id)?.quotePrice) === comparableLowestPrices.get(material.id)" color="green">鏈�浣庡崟浠�</a-tag>
+ 绋庣巼 {{ row.quotes.get(material.id)?.taxRate != null ? `${row.quotes.get(material.id)?.taxRate}%` : '鏈~' }}<br />
+ 浜ゆ湡 {{ row.quotes.get(material.id)?.deliveryCycle != null ? `${row.quotes.get(material.id)?.deliveryCycle} 澶ー : '鏈~' }}
+ </template>
+ <span v-else class="text-orange-600">鏈姤浠�</span>
+ </td>
+ <td class="border p-2">{{ row.complete ? '宸叉姤鍏ㄩ儴鐗╂枡' : '鎶ヤ环涓嶅畬鏁�' }}<br />鎬婚 {{ row.bid.bidTotalAmount ?? '鏈淮鎶�' }}</td>
+ </tr></tbody>
+ </table>
+ <a-empty v-if="!comparisonRows.length" description="鏆傛棤鏈夋晥鎶曟爣" />
+ </div>
+ </a-tab-pane>
+
<!-- Tab4: 寮�鏍� -->
<a-tab-pane v-if="!isSimpleMode" key="bidOpen">
<template #tab>
--
Gitblit v1.9.3