Merge branch 'feature-purchase' into developer
This commit is contained in:
@@ -74,13 +74,22 @@ export function usePurchaseRules() {
|
|||||||
|
|
||||||
const getRuleAmount = (code: string, defaultVal?: number) => {
|
const getRuleAmount = (code: string, defaultVal?: number) => {
|
||||||
const rule = rules.value.find(r => r.ruleCode === code);
|
const rule = rules.value.find(r => r.ruleCode === code);
|
||||||
if (!rule || rule.amountMin === undefined || rule.amountMin === null) {
|
if (!rule) {
|
||||||
if (defaultVal === undefined) {
|
if (defaultVal === undefined) {
|
||||||
throw new Error(`采购规则配置缺失: ${code},请在系统配置中维护`);
|
throw new Error(`采购规则配置缺失: ${code},请在系统配置中维护`);
|
||||||
}
|
}
|
||||||
return defaultVal;
|
return defaultVal;
|
||||||
}
|
}
|
||||||
|
if (rule.amountMin !== undefined && rule.amountMin !== null) {
|
||||||
return Number(rule.amountMin);
|
return Number(rule.amountMin);
|
||||||
|
}
|
||||||
|
if (rule.amountMax !== undefined && rule.amountMax !== null) {
|
||||||
|
return Number(rule.amountMax);
|
||||||
|
}
|
||||||
|
if (defaultVal === undefined) {
|
||||||
|
throw new Error(`采购规则配置缺失: ${code},请在系统配置中维护`);
|
||||||
|
}
|
||||||
|
return defaultVal;
|
||||||
};
|
};
|
||||||
|
|
||||||
thresholds.deptPurchase = getRuleAmount('DEPT_PURCHASE_THRESHOLD');
|
thresholds.deptPurchase = getRuleAmount('DEPT_PURCHASE_THRESHOLD');
|
||||||
|
|||||||
Reference in New Issue
Block a user