From 72160787f9482c08c90de5f45f49d590bebf4833 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E7=BA=A2=E5=85=B5?= <374362909@qq.com> Date: Wed, 4 Mar 2026 17:00:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E9=A1=B5=E9=9D=A2=E4=BC=9A=E8=AE=AE=E7=BA=AA?= =?UTF-8?q?=E8=A6=81=E5=AD=97=E6=AE=B5=E5=8F=8A=E5=8A=A8=E6=80=81=E9=85=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 统一会议纪要字段名称为校党委会议纪要 2. 部门自行采购会议纪要使用动态配置替代硬编码2000 3. 动态配置获取不到值时直接报错而非使用默认值 4. 调整部门自行采购会议纪要显示条件为金额>=2000 --- src/hooks/usePurchaseRules.ts | 39 ++++++++++--------- .../purchase/purchasingrequisition/add.vue | 19 ++++----- 2 files changed, 31 insertions(+), 27 deletions(-) diff --git a/src/hooks/usePurchaseRules.ts b/src/hooks/usePurchaseRules.ts index bf855ee..f0daa11 100644 --- a/src/hooks/usePurchaseRules.ts +++ b/src/hooks/usePurchaseRules.ts @@ -1,4 +1,4 @@ -import { ref, computed, watch } from 'vue'; +import { ref } from 'vue'; import { evaluateRules, getEnabledRules } from '/@/api/purchase/purchasingRuleConfig'; const RULE_CACHE_KEY = 'purchase_rule_cache'; @@ -65,26 +65,29 @@ export function usePurchaseRules() { const getThresholds = () => { const thresholds: Record = { - deptPurchase: 50000, - feasibility: 300000, - publicSelect: 300000, - govPurchase: 1000000 + deptPurchase: 0, + feasibility: 0, + publicSelect: 0, + govPurchase: 0, + deptSelfMeetingMinutes: 0 }; - rules.value.forEach(rule => { - if (rule.ruleCode === 'DEPT_PURCHASE_THRESHOLD' && rule.amountMax) { - thresholds.deptPurchase = Number(rule.amountMax); + const getRuleAmount = (code: string, defaultVal?: number) => { + const rule = rules.value.find(r => r.ruleCode === code); + if (!rule || rule.amountMin === undefined || rule.amountMin === null) { + if (defaultVal === undefined) { + throw new Error(`采购规则配置缺失: ${code},请在系统配置中维护`); + } + return defaultVal; } - if (rule.ruleCode === 'FEASIBILITY_REPORT' && rule.amountMin) { - thresholds.feasibility = Number(rule.amountMin); - } - if (rule.ruleCode === 'PUBLIC_BID_40W_100W' && rule.amountMin) { - thresholds.publicSelect = Number(rule.amountMin); - } - if (rule.ruleCode === 'GOV_PURCHASE_THRESHOLD' && rule.amountMin) { - thresholds.govPurchase = Number(rule.amountMin); - } - }); + return Number(rule.amountMin); + }; + + thresholds.deptPurchase = getRuleAmount('DEPT_PURCHASE_THRESHOLD'); + thresholds.feasibility = getRuleAmount('FEASIBILITY_REPORT'); + thresholds.publicSelect = getRuleAmount('PUBLIC_BID_40W_100W'); + thresholds.govPurchase = getRuleAmount('GOV_PURCHASE_THRESHOLD'); + thresholds.deptSelfMeetingMinutes = getRuleAmount('DEPT_SELF_MEETING_MINUTES', 2000); return thresholds; }; diff --git a/src/views/purchase/purchasingrequisition/add.vue b/src/views/purchase/purchasingrequisition/add.vue index 3cb4233..3c8c936 100644 --- a/src/views/purchase/purchasingrequisition/add.vue +++ b/src/views/purchase/purchasingrequisition/add.vue @@ -154,7 +154,7 @@ 下载《部门采购询价模版》模版 - + @@ -271,12 +271,12 @@ - + - + @@ -287,7 +287,7 @@ - + @@ -298,7 +298,7 @@ - + @@ -725,10 +725,11 @@ Object.entries(FILE_TYPE_MAP).forEach(([field, type]) => { // 金额阈值(从规则配置动态获取,默认值与后端 PurchaseConstants 保持一致) const { rules: purchaseRules, getThresholds, evaluate: evaluatePurchaseRules } = usePurchaseRulesSingleton(); -const BUDGET_DEPT_PURCHASE_THRESHOLD = computed(() => getThresholds().deptPurchase || 50000); -const BUDGET_FEASIBILITY_THRESHOLD = computed(() => getThresholds().feasibility || 300000); -const BUDGET_PUBLIC_SELECT_THRESHOLD = computed(() => getThresholds().publicSelect || 400000); -const BUDGET_GOV_PURCHASE_THRESHOLD = computed(() => getThresholds().govPurchase || 1000000); +const BUDGET_DEPT_PURCHASE_THRESHOLD = computed(() => getThresholds().deptPurchase); +const BUDGET_FEASIBILITY_THRESHOLD = computed(() => getThresholds().feasibility); +const BUDGET_PUBLIC_SELECT_THRESHOLD = computed(() => getThresholds().publicSelect); +const BUDGET_GOV_PURCHASE_THRESHOLD = computed(() => getThresholds().govPurchase); +const BUDGET_DEPT_SELF_MEETING_MINUTES = computed(() => getThresholds().deptSelfMeetingMinutes); // 部门采购方式字典 value(与 DeptPurchaseTypeEnum 一致) const DEPT_PURCHASE_TYPE = {