|
@@ -16,7 +16,7 @@ import {
|
|
|
treeDept
|
|
|
} from "@/api/department";
|
|
|
import type { DrawerProps, FormItemProps, FormProps } from "element-plus";
|
|
|
-import { formulaParamsChange } from "@/utils/business";
|
|
|
+import { formulaParamsChange, echoParamsChange } from "@/utils/business";
|
|
|
// const itemLabelPosition = ref<FormItemProps["labelPosition"]>("");
|
|
|
const drawer = ref(false);
|
|
|
const disabledValue = ref(true);
|
|
@@ -87,24 +87,31 @@ const getIndexInfoApi = async id => {
|
|
|
} else {
|
|
|
params.personList = "";
|
|
|
}
|
|
|
- if (isValidJSON(data.formula)) {
|
|
|
- if (params.formulaType == 0) {
|
|
|
- params.formula = isValidJSON(data.formula);
|
|
|
- } else if (params.formulaType == 1) {
|
|
|
- let aa = JSON.parse(data.formula);
|
|
|
- let bb = JSON.parse(aa.noConditionFormula);
|
|
|
- Object.assign(addmanyChange, bb);
|
|
|
- }
|
|
|
+ if (!data.formulaType) {
|
|
|
+ params.formulaType = 0;
|
|
|
}
|
|
|
+ if (data.formulaType === 0) {
|
|
|
+ params.formula = {
|
|
|
+ noConditionFormula: params.formula
|
|
|
+ };
|
|
|
+ } else if (data.formulaType === 1) {
|
|
|
+ Object.assign(addmanyChange, echoParamsChange(data.formulaParams));
|
|
|
+ }
|
|
|
+ // if (isValidJSON(data.formula)) {
|
|
|
+ // if (params.formulaType == 0) {
|
|
|
+ // params.formula = isValidJSON(data.formula);
|
|
|
+ // } else if (params.formulaType == 1) {
|
|
|
+ // let aa = JSON.parse(data.formula);
|
|
|
+ // let bb = JSON.parse(aa.noConditionFormula);
|
|
|
+ // Object.assign(addmanyChange, bb);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
if (!data.formula) {
|
|
|
params.formula = {
|
|
|
noConditionFormula: ""
|
|
|
};
|
|
|
} else {
|
|
|
}
|
|
|
- if (!data.formulaType) {
|
|
|
- params.formulaType = 0;
|
|
|
- }
|
|
|
} else {
|
|
|
ElMessage.error(msg);
|
|
|
}
|
|
@@ -113,7 +120,7 @@ const $emit = defineEmits(["refresh"]);
|
|
|
// 更新指标
|
|
|
const postUpdateApi = async () => {
|
|
|
if (params.formulaType == 0) {
|
|
|
- params.formula = JSON.stringify(params.formula);
|
|
|
+ params.formula = params.formula.noConditionFormula;
|
|
|
} else {
|
|
|
params.formula = {
|
|
|
noConditionFormula: ""
|
|
@@ -155,7 +162,8 @@ const postUpdateApi = async () => {
|
|
|
});
|
|
|
});
|
|
|
params.formula.noConditionFormula = JSON.stringify(addmanyChange);
|
|
|
- params.formula = JSON.stringify(params.formula);
|
|
|
+ delete params.formula;
|
|
|
+ params.formulaParams = formulaParamsChange(addmanyChange);
|
|
|
}
|
|
|
const { msg, code } = await postUpdate(params);
|
|
|
if (code === 200) {
|