diff --git a/src/views/Home.vue b/src/views/Home.vue index 4dda3fb..7eec587 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -14,7 +14,7 @@
-
+
@@ -27,7 +27,7 @@ 仅显示已收藏的项目
-
+
{ let invalid = 0; // 年龄 - if (param.ageAduRatioList[0].totalPopulation === '') return ElMessage.error('请输入城市总人口'); + if (isIllegalNum(param.ageAduRatioList[0].totalPopulation)) return ElMessage.error('请输入合理的城市总人口'); param.ageAduRatioList.some((e) => { - if (e.ageRatio === '') { - ElMessage.error('请输入年龄占比'); - invalid = 1; - return true; - } - if (isNaN(e.ageRatio)) { + if (isIllegalNum(e.ageRatio)) { ElMessage.error('请输入合理的年龄占比'); invalid = 1; return true; } - if (e.ageRatio < 0) { - ElMessage.error('年龄占比不得小于0'); - invalid = 1; - return true; - } }); if (invalid) return false; if (_.sum(param.ageAduRatioList.map((e) => +e.ageRatio)) > 100) return ElMessage.error('占比总和不得超过100%'); // 学历 edus.value.some((e) => { - if (e.eduRatio === '') { - ElMessage.error('请输入学历占比'); - invalid = 1; - return true; - } - if (isNaN(e.eduRatio)) { + if (isIllegalNum(e.eduRatio)) { ElMessage.error('请输入合理的学历占比'); invalid = 1; return true; } - if (e.eduRatio < 0) { - ElMessage.error('学历占比不得小于0'); - invalid = 1; - return true; - } }); if (invalid) return false; // 企业数量配置 param.enterpriseNumList.some((e) => { - if (e.number === '') { - ElMessage.error('请输入企业数量'); - invalid = 1; - return true; - } - if (isNaN(e.number)) { + if (isIllegalNum(e.number)) { ElMessage.error('请输入合理的企业数量'); invalid = 1; return true; } - if (e.number < 0) { - ElMessage.error('企业数量不得小于0'); - invalid = 1; - return true; - } }); if (invalid) return false; // 单个商品每日需求量 param.commodityDemandList.some((e) => { - if (e.buyerRatio === '') { - ElMessage.error('请输入买家总占比'); - invalid = 1; - return true; - } - if (isNaN(e.buyerRatio) || e.buyerRatio < 0 || e.buyerRatio > 100) { + if (isIllegalNum(e.buyerRatio) || e.buyerRatio > 100) { ElMessage.error('请输入合理的买家总占比'); invalid = 1; return true; } - - if (e.peopleNumRatio === '') { - ElMessage.error('请输入每次需求人数占比'); - invalid = 1; - return true; - } - if (isNaN(e.peopleNumRatio) || e.peopleNumRatio < 0 || e.peopleNumRatio > 100) { + if (isIllegalNum(e.peopleNumRatio) || e.peopleNumRatio > 100) { ElMessage.error('请输入合理的每次需求人数占比'); invalid = 1; return true; } - if (e.typeId != 7 && e.typeId != 8 && (e.buyerSingleDemandMin === '' || e.buyerSingleDemandMax === '')) { - console.log('🚀 ~ file: Buyer.vue:323 ~ param.commodityDemandList.some ~ e:', e); - ElMessage.error('请输入单个买家单次需求1'); - invalid = 1; - return true; - } - if (e.typeId != 7 && e.typeId != 8 && (isNaN(e.buyerSingleDemandMin) || isNaN(e.buyerSingleDemandMax))) { + if (e.typeId != 7 && e.typeId != 8 && (isIllegalNum(e.buyerSingleDemandMin) || isIllegalNum(e.buyerSingleDemandMax))) { ElMessage.error('请输入合理的单个买家单次需求'); invalid = 1; return true; } - if (e.typeId != 7 && e.typeId != 8 && (e.buyerSingleDemandMin < 0 || e.buyerSingleDemandMax < 0)) { - ElMessage.error('单个买家单次需求不得小于0'); - invalid = 1; - return true; - } - if ((e.typeId == 7 || e.typeId == 8) && e.buyerSingleDemand === '') { - ElMessage.error('请输入单个买家单次需求2'); - invalid = 1; - return true; - } - if ((e.typeId == 7 || e.typeId == 8) && isNaN(e.buyerSingleDemand)) { + if ((e.typeId == 7 || e.typeId == 8) && isIllegalNum(e.buyerSingleDemand)) { ElMessage.error('请输入合理的单个买家单次需求'); invalid = 1; return true; } - if ((e.typeId == 7 || e.typeId == 8) && e.buyerSingleDemand < 0) { - ElMessage.error('单个买家单次需求不得小于0'); - invalid = 1; - return true; - } }); if (invalid) return false; diff --git a/src/views/product/bank/Add.vue b/src/views/product/bank/Add.vue index 0eae2d6..44e8178 100644 --- a/src/views/product/bank/Add.vue +++ b/src/views/product/bank/Add.vue @@ -55,7 +55,7 @@ 企业类型 - @@ -95,7 +95,7 @@ - {{ item.options }} @@ -107,7 +107,7 @@ - {{ item.options }} @@ -158,9 +158,9 @@ { required: true, message: '请选择担保方式', trigger: 'change' }, { asyncValidator: async (rule, value, callback) => { - if (value.includes(110) && !value.find((e: any) => e > 22 && e < 33)) { + if (value.includes(110) && !value.find((e) => e > 22 && e < 33)) { callback('请选择抵押物') - } else if (value.includes(111) && !value.find((e: any) => e > 32 && e < 38)) { + } else if (value.includes(111) && !value.find((e) => e > 32 && e < 38)) { callback('请选择质押贷') } else { callback() @@ -170,11 +170,14 @@ ]">

选择本产品的担保种类。

-
{{ item.name }} + +

选择本产品可以选择的还款方式。

- {{ item.options }} @@ -273,7 +276,7 @@ import type { TabsPaneContext, FormInstance, FormRules } from 'element-plus'; import { findById, save, update } from '@/api/bank'; import { getProcessInformationBasedOnRoles, addOperation } from '@/api/judgment'; import { useRouter, useRoute } from 'vue-router'; -import { handleId } from '@/utils/common'; +import { handleId, isIllegalNum } from '@/utils/common'; import { getStatus } from '@/store/useProduct'; import Info from './Info.vue'; import Cookies from 'js-cookie'; @@ -391,7 +394,7 @@ const submit = async (formEl: FormInstance | undefined) => { if ((!param.productType && param.age) || param.productType) { if (!param.minimumAge) return ElMessage.error('请输入最小年龄'); if (!param.maximumAge) return ElMessage.error('请输入最大年龄'); - if (param.minimumAge < 0 || param.minimumAge > 999 || param.maximumAge < 0 || param.maximumAge > 999) return ElMessage.error('请输入合理的年龄'); + if (isIllegalNum(param.minimumAge) || isIllegalNum(param.maximumAge)) return ElMessage.error('请输入合理的年龄'); if (param.minimumAge > param.maximumAge) return ElMessage.error('最小年龄不得大于最大年龄'); } @@ -401,7 +404,11 @@ const submit = async (formEl: FormInstance | undefined) => { if (param.curWL && !param.currentWorkingLife.length) return ElMessage.error('请选择工作年限'); if (param.curWL && !param.currentWorkingLife.length) return ElMessage.error('请选择工作年限'); } - + if (isIllegalNum(param.minimumLoan) || isIllegalNum(param.loanCeiling) || +param.minimumLoan > +param.loanCeiling) return ElMessage.error('请输入合理的贷款额度'); + if (isIllegalNum(param.minimumAprOnLoan) || isIllegalNum(param.maximumAnnualInterestRate) || +param.minimumAprOnLoan > +param.maximumAnnualInterestRate) + return ElMessage.error('请输入合理的贷款利率'); + if (isIllegalNum(param.minimumTermOfLoan) || isIllegalNum(param.maximumTermOfLoan) || +param.minimumTermOfLoan > +param.maximumTermOfLoan) + return ElMessage.error('请输入合理的贷款期限'); param.currentWorkingLife = param.currentWorkingLife.join(); param.educationalRequirements = param.educationalRequirements.join(); param.modeRepayment = param.modeRepayment.join(); diff --git a/src/views/product/fund/Add.vue b/src/views/product/fund/Add.vue index 095493c..4572e45 100644 --- a/src/views/product/fund/Add.vue +++ b/src/views/product/fund/Add.vue @@ -317,7 +317,7 @@ import { Plus, Minus } from '@element-plus/icons-vue'; import { getAListOfAShares, saveFund } from '@/api/fund'; import { getProcessInformationBasedOnRoles, addOperation } from '@/api/judgment'; import { useRouter, useRoute } from 'vue-router'; -import { handleId } from '@/utils/common'; +import { handleId, isIllegalNum } from '@/utils/common'; import Cookies from 'js-cookie'; const emit = defineEmits(['getList']); @@ -517,22 +517,18 @@ const submit = async () => { if (!param.fundName) return ElMessage.error('请输入保险名称'); if (!param.fundType) return ElMessage.error('请选择基金类型'); if (!param.fundraisingScale) return ElMessage.error('请输入募集规模'); + if (isIllegalNum(param.fundraisingScale)) return ElMessage.error('请输入合理的募集规模'); if (!param.modeOfOperation) return ElMessage.error('请选择运作方式'); if (!param.shareholdingAllocationsList.length || !param.shareholdingAllocationsList.filter((e) => e.stockCode).length) return ElMessage.error('请配置持股'); - // 计算持股权重是否等于100 - // let sum = 0; - // param.shareholdingAllocationsList.forEach((e) => { - // if (e.stockCode && e.proportion) { - // sum += +e.proportion; - // } - // }); - // if (sum !== 100) return ElMessage.error('持股权重总和需等于100,请重新配置'); - if (!param.buyingDuration || !param.sellingTime) return ElMessage.error('请输入份额时长'); + if (isIllegalNum(param.buyingDuration) || isIllegalNum(param.sellingTime)) return ElMessage.error('请输入合理的份额时长'); if (!param.operationManagementRate) return ElMessage.error('请输入管理费'); + if (isIllegalNum(param.operationManagementRate)) return ElMessage.error('请输入合理的管理费'); if (!param.operatingEscrowRate) return ElMessage.error('请输入托管费'); + if (isIllegalNum(param.operatingEscrowRate)) return ElMessage.error('请输入合理的托管费'); if (!param.operatingSalesServiceRates) return ElMessage.error('请输入销售服务费'); + if (isIllegalNum(param.operatingSalesServiceRates)) return ElMessage.error('请输入合理的销售服务费'); // 持股配置处理 param.shareholdingAllocationsList.forEach((e) => { diff --git a/src/views/product/insurance/Add.vue b/src/views/product/insurance/Add.vue index 372a418..077d99b 100644 --- a/src/views/product/insurance/Add.vue +++ b/src/views/product/insurance/Add.vue @@ -241,14 +241,13 @@ const submit = async () => { param.premiumAmount = Number(param.premiumAmount).toFixed(2); } if (!param.formOfPayment) return ElMessage.error('请选择缴纳形式'); - if (isIllegalNum(param.insuranceDeadline)) return ElMessage.error('请输入保险期限'); + if (isIllegalNum(param.insuranceDeadline)) return ElMessage.error('请输入合理的保险期限'); if (!param.insuranceDeadlineUnit) return ElMessage.error('请选择保险期限'); param.insuranceDeadline = param.insuranceDeadline + param.insuranceDeadlineUnit; if (!param.applicationMaterial.length) return ElMessage.error('请至少选择一项申请材料'); if (!param.exemptionFromLiability.length) return ElMessage.error('请至少选择一项责任免除'); param.applicationMaterial = param.applicationMaterial.join(); param.exemptionFromLiability = param.exemptionFromLiability.join(); - debugger; await addInsuranceProducts(param); addRecord(param); ElMessage.success('提交成功!');