【fix】 暂时完成 国富栋梁定期寿险 的交费期间、保险期间的联动关系验证从后台获取。

待确认效果是否可行
This commit is contained in:
tian.guangyuan
2020-03-31 14:46:38 +08:00
parent deeb9070b9
commit 5903df5ef6

View File

@@ -375,7 +375,9 @@ export default {
//是否需存在特殊配置 0-是 1-否 //是否需存在特殊配置 0-是 1-否
isTrial: localStorage.isTrial, isTrial: localStorage.isTrial,
//缴费期间对应index索引 //缴费期间对应index索引
payEndYearColumnsIndex: 0 payEndYearColumnsIndex: 0,
// 后台配置的校验规则
ruleExpression: {}
} }
}, },
mounted() { mounted() {
@@ -471,60 +473,71 @@ export default {
let ruleExpression = JSON.parse(localStorage.ruleExpression); let ruleExpression = JSON.parse(localStorage.ruleExpression);
this.ruleExpression = ruleExpression this.ruleExpression = ruleExpression
let productCodes = Object.keys(ruleExpression) let productCodes = Object.keys(ruleExpression)
productCodes.every(itemKey => { productCodes.forEach(itemKey => {
// console.log(ruleExpression[itemKey]); // console.log(ruleExpression[itemKey]);
let rules = ruleExpression[itemKey]; let rules = ruleExpression[itemKey];
rules.eventList = []; rules.eventList = [];
rules.every( item => { rules.forEach( item => {
let config = '' let config = ''
//JSON.parse(); config = JSON.parse(item.ruleExpression);
let errorMsg = item.errorMsg; // let errorMsg = item.errorMsg;
// config = { // config = {
// eventName: 'test', // eventName: 'GFRS_M0020_payEndYear_insuYear',
// funBody: `let ageMap = { // eventType: 'onConfirm',
// "10Y":{"30Y": 55,"70A": 55,"88A": 55}, // funBody: [
// "20Y":{ "30Y": 55, "70A": 50, "88A": 55 }, // 'let ageMap = {',
// "30Y":{ "30Y": 45, "70A": 40, "88A": 45 }, // ' "10Y":{"30Y": 55,"70A": 55,"88A": 55},',
// } // ' "20Y":{ "30Y": 55, "70A": 50, "88A": 55 }, ',
// // 交费期间 数列 // ' "30Y":{ "30Y": 45, "70A": 40, "88A": 45 },',
// let payEndYear = "" // '};',
// // 保险期间 横行 // 'let payEndYear = "";',
// let insuYear = "" // 'let insuYear = "";',
// par.map(item => { // 'let age = this.saleInsuredPersonInfo.age;',
// if(item.code == "payEndYear"){ // 'let parObj = {};',
// payEndYear = item.payEndYear + item.payEndYearFlag // 'par.map(item => {',
// } // ' parObj[item.code] = item;',
// if(item.code == "insuYear"){ // '});',
// insuYear = item.insuYear + item.insuYearFlag // 'if(ParKey == "payEndYear"){',
// } // ' payEndYear = Par.value + Par.flag;',
// }) // ' lintAgeObj = ageMap[payEndYear];',
// if(ParKey == "payEndYear"){ // ' let flag = true;',
// payEndYear = Par.value + Par.flag // ' parObj.insuYear.columns.forEach(item => {',
// } // ' let lintAge = lintAgeObj[ item.value + item.flag ];',
// if(ParKey == "insuYear"){ // ' if( age > lintAge ){',
// insuYear = Par.value + Par.flag // ' item.disabled = true;',
// } // ' if(flag){',
// let age = ageMap[payEndYear][insuYear] // ' parObj.insuYear.insuYear = item.value;',
// if( this.saleInsuredPersonInfo.age > age ){ // ' parObj.insuYear.insuYearFlag = item.flag;',
// this.errorMsg.push("当前交费期间和保险期间的组合下,被保险人的年龄不能大于"+age+ "周岁。") // ' parObj.insuYear.showContent = item.text;',
// } // ' flag = false;',
// `, // ' };',
// ' }else{',
// ' item.disabled = false;',
// ' };',
// ' });',
// ' if(!flag){',
// ' this.errorMsg.push("您当前选择的交费期间下,无可搭配的保险期间。");',
// ' payEndYear = parObj.payEndYear.payEndYear + parObj.payEndYear.payEndYearFlag;',
// ' lintAgeObj = ageMap[payEndYear];',
// ' parObj.insuYear.columns.forEach(item => {',
// ' let lintAge = lintAgeObj[ item.value + item.flag ];',
// ' if( age > lintAge ){',
// ' item.disabled = true;',
// ' }else{',
// ' item.disabled = false;',
// ' };',
// ' });',
// ' return false;',
// ' };',
// ' return true;',
// '}'],
// funPar: ['par','ParKey','Par'], // funPar: ['par','ParKey','Par'],
// } // }
console.log("config",config); // console.log("config",config);
// this.$on(config.eventName, new Function(config.funPar,config.funBody)); this.$on(config.eventName, new Function( ...config.funPar, config.funBody.join('')));
this.$on(config.eventName, new Function( ...config.funPar, config.funBody)
);
rules.eventList.push(config.eventName) 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 赔付比例处理 //特殊处理 GFRS_M0016 GFRS_A0004 GFRS_A0005 赔付比例处理
@@ -641,7 +654,7 @@ export default {
//确认选择字段 //确认选择字段
onConfirm(value) { onConfirm(value) {
this.columns = [] this.columns = []
let productCode = this.chooseProducts[this.productIndex].productCode // let productCode = this.chooseProducts[this.productIndex].productCode
let currentFactor = this.chooseProducts[this.productIndex].calFactorLst let currentFactor = this.chooseProducts[this.productIndex].calFactorLst
let currentEle = currentFactor[this.calFactorIndex] let currentEle = currentFactor[this.calFactorIndex]
console.log('value', value) console.log('value', value)
@@ -673,21 +686,34 @@ export default {
this.popupShow = false this.popupShow = false
return false return false
} }
console.log("productCode ==>" , productCode) // console.log("productCode ==>" , productCode)
// if(this.ruleExpression[productCode]){
// this.errorMsg = []
// this.ruleExpression[productCode].eventList.forEach(item => {
// this.$emit(item,currentFactor,currentEle.code,value);
// })
// if(this.errorMsg.length > 0){
// this.$toast(this.errorMsg[0]);
// this.popupShow = false
// return false
// }
// }
let productCode = this.chooseProducts[this.productIndex].productCode
if(this.ruleExpression[productCode]){ if(this.ruleExpression[productCode]){
this.errorMsg = [] this.errorMsg = []
this.ruleExpression[productCode].eventList.every(item => { let currentFactor = this.chooseProducts[this.productIndex].calFactorLst
let currentEle = currentFactor[this.calFactorIndex]
this.ruleExpression[productCode].eventList.forEach(item => {
this.$emit(item,currentFactor,currentEle.code,value); this.$emit(item,currentFactor,currentEle.code,value);
}) })
if(this.errorMsg.length > 0){ if(this.errorMsg.length > 0){
this.$toast(this.errorMsg[0]); //this.$toast(this.errorMsg[0]);
this.popupShow = false this.popupShow = false
return false return false
} }
} }
// 后台配置 的 js函数 验证 // 后台配置 的 js函数 验证
// if(hasR){ // if(hasR){
// if(currentEle.code == 'payEndYear' || currentEle.code == 'insuYear'){ // if(currentEle.code == 'payEndYear' || currentEle.code == 'insuYear'){