|
@@ -275,7 +275,6 @@ function calculateScore(inputString) {
|
|
|
}
|
|
|
|
|
|
const countComputed = async () => {
|
|
|
- console.log("params", params.formulaType);
|
|
|
try {
|
|
|
if (params.formulaType == 0) {
|
|
|
const formula = JSON.stringify(params.formula);
|
|
@@ -324,6 +323,11 @@ const countComputed = async () => {
|
|
|
});
|
|
|
}
|
|
|
} else if (params.formulaType == 1) {
|
|
|
+ // 判断是公式还是数字
|
|
|
+ if (containsKeywordInScore(addmanyChange.outerConditionValue, GONG_SHI)) {
|
|
|
+ addmanyChange.outerConditionValueExpress =
|
|
|
+ addmanyChange.outerConditionValue;
|
|
|
+ }
|
|
|
let oldValue = JSON.parse(JSON.stringify(addmanyChange));
|
|
|
// Object.assign(oldValue, addmanyChange);
|
|
|
const formulaPar = JSON.stringify(oldValue);
|
|
@@ -339,11 +343,54 @@ const countComputed = async () => {
|
|
|
// }
|
|
|
// 暂时注释上面代码,不知道会不会影响到其他业务逻辑,待验证
|
|
|
if (formulaForm.value && Array.isArray(formulaForm.value) && oldValue) {
|
|
|
- for (const item of formulaForm.value) {
|
|
|
- if (oldValue.outerConditionValueExpress === item.name) {
|
|
|
- oldValue.outerConditionValue = item.value;
|
|
|
- break;
|
|
|
+ const keywordss = [
|
|
|
+ "完成值",
|
|
|
+ "目标值",
|
|
|
+ "门槛值",
|
|
|
+ "挑战值",
|
|
|
+ "增幅",
|
|
|
+ "降幅",
|
|
|
+ "上期完成值",
|
|
|
+ "上上期完成值"
|
|
|
+ ];
|
|
|
+ if (
|
|
|
+ keywordss.find(item => oldValue.outerConditionValueExpress == item)
|
|
|
+ ) {
|
|
|
+ for (const item of formulaForm.value) {
|
|
|
+ if (oldValue.outerConditionValueExpress === item.name) {
|
|
|
+ oldValue.outerConditionValue = item.value;
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
+ } else {
|
|
|
+ const keywords = [
|
|
|
+ "完成值",
|
|
|
+ "目标值",
|
|
|
+ "门槛值",
|
|
|
+ "挑战值",
|
|
|
+ "增幅",
|
|
|
+ "降幅",
|
|
|
+ "上期完成值",
|
|
|
+ "上上期完成值"
|
|
|
+ ];
|
|
|
+ let str = oldValue.outerConditionValueExpress;
|
|
|
+ // 创建一个正则表达式,匹配这些关键词
|
|
|
+ const regex = new RegExp(keywords.join("|"), "g");
|
|
|
+ let result = str.replace(regex, match => {
|
|
|
+ // 在 formulaForm.value 中查找匹配的项
|
|
|
+ let matchedItem = formulaForm.value.find(
|
|
|
+ item => item.name === match
|
|
|
+ );
|
|
|
+
|
|
|
+ // 如果找到匹配项,返回其 value,否则返回原始匹配值
|
|
|
+ if (matchedItem) {
|
|
|
+ return matchedItem.value; // 替换为对应的值
|
|
|
+ }
|
|
|
+ return match; // 如果没有匹配项,返回原始匹配值
|
|
|
+ });
|
|
|
+ // calculator.calculate(result);
|
|
|
+ // grade.value = calculator.get();
|
|
|
+ oldValue.outerConditionValue = eval(result).toFixed(2);
|
|
|
}
|
|
|
}
|
|
|
if (oldValue.innerConditionExpression.length > 0) {
|
|
@@ -378,6 +425,7 @@ const countComputed = async () => {
|
|
|
});
|
|
|
}
|
|
|
// let newValue = reverseReplace(formListNum, oldValue);
|
|
|
+ console.log(oldValue, "oldValue--最终传值");
|
|
|
const { code, msg, data } =
|
|
|
await calculateScoreByConditionMoCondition(oldValue);
|
|
|
if (code == 200) {
|
|
@@ -402,7 +450,7 @@ const countComputed = async () => {
|
|
|
// 判断是否为json
|
|
|
function isValidJSON(str) {
|
|
|
try {
|
|
|
- if (!str.includes("\\")) {
|
|
|
+ if (!str.includes("\\\\")) {
|
|
|
return JSON.parse(str);
|
|
|
} else {
|
|
|
return JSON.parse(JSON.parse(str));
|
|
@@ -495,6 +543,7 @@ const open = row => {
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
+ console.log("打印是否触发数据");
|
|
|
getIndexInfoApi(row.id);
|
|
|
calculatorShow.value = true;
|
|
|
};
|
|
@@ -883,7 +932,6 @@ const changeAddMay = () => {
|
|
|
let addmanyChangeOldVal = JSON.parse(JSON.stringify(addmanyChange));
|
|
|
addmanyChange.innerConditionExpression.forEach((item, index, arr) => {
|
|
|
if (index + 1 <= arr.length) {
|
|
|
- console.log("12312", addmanyChangeOldVal.innerConditionExpression);
|
|
|
if (item.endValue) {
|
|
|
if (addmanyChangeOldVal.innerConditionExpression.length > 1) {
|
|
|
addmanyChangeOldVal.innerConditionExpression[index + 1].startValue =
|
|
@@ -1293,6 +1341,7 @@ const changeValueInput = val => {
|
|
|
v-model="item.endValue"
|
|
|
class="ml-2 mr-5"
|
|
|
style="width: 80px"
|
|
|
+ @blur="changeAddMay"
|
|
|
/>
|
|
|
</div>
|
|
|
<el-text v-if="item.scoreRuleMoreInnerVO.length == 0"
|
|
@@ -1418,6 +1467,7 @@ const changeValueInput = val => {
|
|
|
v-model="itemList.endValue"
|
|
|
class="ml-2"
|
|
|
style="width: 80px"
|
|
|
+ @blur="changeAddMay"
|
|
|
/>
|
|
|
</div>
|
|
|
<div
|