|
@@ -60,7 +60,67 @@ export const formulaParamsChange = (addmanyChange: any = {}) => {
|
|
|
};
|
|
|
|
|
|
// 公式设置-多条件公式,转换数据结构,从接口返回数据后回显
|
|
|
-// export const echoParamsChange = (echoChange: any = {}) => {
|
|
|
-// const obj = {}
|
|
|
-// // echoChange.
|
|
|
-// }
|
|
|
+const removeParentheses = (str = "") => {
|
|
|
+ let newStr = str || "";
|
|
|
+ if (str) {
|
|
|
+ if (str.indexOf("(") > -1) {
|
|
|
+ newStr = newStr.replace("(", "");
|
|
|
+ }
|
|
|
+ if (str.indexOf(")") > -1) {
|
|
|
+ newStr = newStr.replace(")", "");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return newStr;
|
|
|
+};
|
|
|
+export const echoParamsChange = (echoChange: any = []) => {
|
|
|
+ const obj = {
|
|
|
+ outerConditionValue: "",
|
|
|
+ outerConditionValueExpress: "",
|
|
|
+ innerConditionExpression: []
|
|
|
+ };
|
|
|
+ if (echoChange.length) {
|
|
|
+ obj.outerConditionValue = removeParentheses(
|
|
|
+ echoChange[0].conditionalValues
|
|
|
+ );
|
|
|
+ echoChange.forEach(item => {
|
|
|
+ const iObj: any = {
|
|
|
+ startValue: removeParentheses(item.currentFormulaOne),
|
|
|
+ endValue: removeParentheses(item.currentFormulaThree),
|
|
|
+ select: item.currentFormulaType,
|
|
|
+ comparisonStart: item.operatorOne,
|
|
|
+ comparisonEnd: item.operatorTwo,
|
|
|
+ innerScore: item.score || ""
|
|
|
+ };
|
|
|
+ const voObj = {
|
|
|
+ innerConditionValue: "",
|
|
|
+ innerConditionValueExpress: null,
|
|
|
+ scoreRules: []
|
|
|
+ };
|
|
|
+ if (item.nextFormatParams && item.nextFormatParams.length) {
|
|
|
+ voObj.innerConditionValue = removeParentheses(
|
|
|
+ item.nextFormatParams[0].conditionalValues
|
|
|
+ );
|
|
|
+ let scoreRules = [];
|
|
|
+ item.nextFormatParams.forEach(el => {
|
|
|
+ scoreRules.push({
|
|
|
+ score: el.score,
|
|
|
+ scoreExpress: null,
|
|
|
+ select: el.currentFormulaType,
|
|
|
+ startValue: removeParentheses(el.currentFormulaOne),
|
|
|
+ endValue: removeParentheses(el.currentFormulaThree),
|
|
|
+ comparisonStart: el.operatorOne,
|
|
|
+ comparisonEnd: el.operatorTwo,
|
|
|
+ startExpress: null,
|
|
|
+ endExpress: null
|
|
|
+ });
|
|
|
+ });
|
|
|
+ voObj.scoreRules = scoreRules;
|
|
|
+ iObj.scoreRuleMoreInnerVO = [voObj];
|
|
|
+ } else {
|
|
|
+ iObj.scoreRuleMoreInnerVO = [];
|
|
|
+ }
|
|
|
+ obj.innerConditionExpression.push(iObj);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return obj;
|
|
|
+};
|