From dcde4b33fa739b09486c39faade9ed19b29a6d7a Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 03 八月 2026 14:58:35 +0800
Subject: [PATCH] feat(srm): 优化供应商选择组件功能
---
src/views/srm/tender/detail.vue | 44 ++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/src/views/srm/tender/detail.vue b/src/views/srm/tender/detail.vue
index 772d2eb..7de94be 100644
--- a/src/views/srm/tender/detail.vue
+++ b/src/views/srm/tender/detail.vue
@@ -6,7 +6,7 @@
import { Page } from '@vben/common-ui';
-import { message } from 'ant-design-vue';
+import { message, Modal } from 'ant-design-vue';
import { IconifyIcon } from '@vben/icons';
import {
@@ -63,6 +63,25 @@
const materialLoading = ref(false);
const materialFormVisible = ref(false);
const materialForm = ref<SrmTenderApi.TenderMaterialVO>({ tenderProjectId: projectId });
+
+// 宸叉坊鍔犵殑鐗╂枡浜у搧ID闆嗗悎锛岄伩鍏嶉噸澶嶆坊鍔�
+const addedProductIds = computed(() => {
+ const ids = new Set(
+ materialList.value
+ .filter((m) => m.productId !== undefined)
+ .map((m) => m.productId!),
+ );
+ // 缂栬緫鏃跺厑璁镐繚鐣欏綋鍓嶇墿鏂欑殑 productId
+ if (materialForm.value.id && materialForm.value.productId) {
+ ids.delete(materialForm.value.productId);
+ }
+ return ids;
+});
+
+// 鐗╂枡涓嬫媺鍙�夊垪琛紙鎺掗櫎宸叉坊鍔犵殑锛�
+const availableMdmItems = computed(() =>
+ mdmItemList.value.filter((item) => !addedProductIds.value.has(item.id!)),
+);
async function loadProject() {
project.value = await getTenderProject(projectId);
@@ -150,6 +169,27 @@
try { quoteList.value = await getQuoteList(bidId); } finally { quoteLoading.value = false; }
}
async function handleSaveQuote() {
+ // 鏍¢獙锛氭姤浠烽噾棰濅笌鎶曟爣閲戦涓�鑷存��
+ const bid = bidList.value.find((b) => b.id === quoteForm.value.bidId);
+ if (bid?.bidTotalAmount != null) {
+ const otherQuotesTotal = quoteList.value
+ .filter((q) => q.id !== quoteForm.value.id)
+ .reduce((sum, q) => sum + (q.quotePrice ?? 0), 0);
+ const newTotal = otherQuotesTotal + (quoteForm.value.quotePrice ?? 0);
+ if (newTotal !== bid.bidTotalAmount) {
+ await new Promise<void>((resolve, reject) => {
+ Modal.confirm({
+ title: '閲戦涓嶄竴鑷存彁绀�',
+ content: `鎶ヤ环鎬婚噾棰濓紙${newTotal.toLocaleString()}锛変笌鎶曟爣閲戦锛�${bid.bidTotalAmount!.toLocaleString()}锛変笉涓�鑷达紝鏄惁缁х画鎻愪氦锛焋,
+ okText: '缁х画鎻愪氦',
+ cancelText: '鍙栨秷',
+ onOk: () => { resolve(); },
+ onCancel: () => { reject(new Error('cancel')); },
+ });
+ });
+ }
+ }
+
if (quoteForm.value.id) {
await updateQuote(quoteForm.value);
} else {
@@ -685,7 +725,7 @@
<a-form layout="vertical" class="mt-4">
<a-form-item label="MDM鐗╂枡" required>
<a-select v-model:value="materialForm.productId" show-search placeholder="鎼滅储骞堕�夋嫨MDM鐗╂枡" :filter-option="filterOption" option-label-prop="label" @change="onMaterialSelect">
- <a-select-option v-for="item in mdmItemList" :key="item.id" :value="item.id" :label="`${item.code} ${item.name}`">
+ <a-select-option v-for="item in availableMdmItems" :key="item.id" :value="item.id" :label="`${item.code} ${item.name}`">
<div class="flex flex-col">
<span class="font-medium">{{ item.code }}</span>
<span class="text-xs text-gray-400">{{ item.name }}{{ item.specification ? ` 路 ${item.specification}` : '' }}</span>
--
Gitblit v1.9.3