From deeb9070b94ab9cee813a6f447e4d1d903e494ca Mon Sep 17 00:00:00 2001 From: "tian.guangyuan" Date: Mon, 30 Mar 2020 16:13:55 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=89=E7=85=A7=20=E6=8F=90=E7=A4=BA=20?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ebiz/common/CalculatePremium.vue | 85 +++++++++++++++++++++- src/views/ebiz/common/MainRiskList.vue | 8 +- 2 files changed, 91 insertions(+), 2 deletions(-) diff --git a/src/views/ebiz/common/CalculatePremium.vue b/src/views/ebiz/common/CalculatePremium.vue index b5bff10e3..e84cbd1c8 100644 --- a/src/views/ebiz/common/CalculatePremium.vue +++ b/src/views/ebiz/common/CalculatePremium.vue @@ -465,6 +465,67 @@ export default { //初始化数据试算 this.getTrial() }) + + // 判断是否 含有 后台配置js验证函数 + if(localStorage.ruleExpression){ + let ruleExpression = JSON.parse(localStorage.ruleExpression); + this.ruleExpression = ruleExpression + let productCodes = Object.keys(ruleExpression) + productCodes.every(itemKey => { + // console.log(ruleExpression[itemKey]); + let rules = ruleExpression[itemKey]; + rules.eventList = []; + rules.every( item => { + let config = '' + //JSON.parse(); + let errorMsg = item.errorMsg; + // config = { + // eventName: 'test', + // funBody: `let ageMap = { + // "10Y":{"30Y": 55,"70A": 55,"88A": 55}, + // "20Y":{ "30Y": 55, "70A": 50, "88A": 55 }, + // "30Y":{ "30Y": 45, "70A": 40, "88A": 45 }, + // } + // // 交费期间 数列 + // let payEndYear = "" + // // 保险期间 横行 + // let insuYear = "" + // par.map(item => { + // if(item.code == "payEndYear"){ + // payEndYear = item.payEndYear + item.payEndYearFlag + // } + // if(item.code == "insuYear"){ + // insuYear = item.insuYear + item.insuYearFlag + // } + // }) + // if(ParKey == "payEndYear"){ + // payEndYear = Par.value + Par.flag + // } + // if(ParKey == "insuYear"){ + // insuYear = Par.value + Par.flag + // } + // let age = ageMap[payEndYear][insuYear] + // if( this.saleInsuredPersonInfo.age > age ){ + // this.errorMsg.push("当前交费期间和保险期间的组合下,被保险人的年龄不能大于"+age+ "周岁。") + // } + // `, + // funPar: ['par','ParKey','Par'], + // } + console.log("config",config); + // this.$on(config.eventName, new Function(config.funPar,config.funBody)); + this.$on(config.eventName, new Function( ...config.funPar, config.funBody) + ); + rules.eventList.push(config.eventName) + }) + // let funObj = JSON.parse(item); + // this.ruleExpression[funObj.name] = new Function('obj',funObj.) + }) + // this.$emit('test',50) + // if(this.errorMsg){ + // this.$toast(this.errorMsg) + // alert(this.errorMsg) + // } + } }, //特殊处理 GFRS_M0016 GFRS_A0004 GFRS_A0005 赔付比例处理 async dogetLimitAndGetRate() { @@ -580,6 +641,7 @@ export default { //确认选择字段 onConfirm(value) { this.columns = [] + let productCode = this.chooseProducts[this.productIndex].productCode let currentFactor = this.chooseProducts[this.productIndex].calFactorLst let currentEle = currentFactor[this.calFactorIndex] console.log('value', value) @@ -611,7 +673,28 @@ export default { this.popupShow = false return false } - + console.log("productCode ==>" , productCode) + + if(this.ruleExpression[productCode]){ + this.errorMsg = [] + this.ruleExpression[productCode].eventList.every(item => { + this.$emit(item,currentFactor,currentEle.code,value); + }) + if(this.errorMsg.length > 0){ + this.$toast(this.errorMsg[0]); + this.popupShow = false + return false + } + } + + + // 后台配置 的 js函数 验证 + // if(hasR){ + // if(currentEle.code == 'payEndYear' || currentEle.code == 'insuYear'){ + // this.payEndYear(currentEle.code,value.value,this.tmpInsuYear.insuYear + this.tmpInsuYear.insuYearFlag) + // } + // } + currentEle.showContent = value.text let name = currentEle.code currentEle[name] = value.value diff --git a/src/views/ebiz/common/MainRiskList.vue b/src/views/ebiz/common/MainRiskList.vue index a26021366..31c410c18 100644 --- a/src/views/ebiz/common/MainRiskList.vue +++ b/src/views/ebiz/common/MainRiskList.vue @@ -110,7 +110,13 @@ export default { } }) } - + + if(resultData.productTrialInfoDTO.ruleExpression){ + let ruleExpression = localStorage.ruleExpression ? JSON.parse(localStorage.ruleExpression) : {}; + ruleExpression[resultData.productCode] = resultData.productTrialInfoDTO.ruleExpression + localStorage.ruleExpression = JSON.stringify(ruleExpression) + } + /********start 主险选择限制 start******/ if (riskRules.ageLimit(resultData, this)) {