|
@@ -19,6 +19,21 @@ import type { DrawerProps, FormItemProps, FormProps } from "element-plus";
|
|
|
// const itemLabelPosition = ref<FormItemProps["labelPosition"]>("");
|
|
|
const drawer = ref(false);
|
|
|
const disabledValue = ref(true);
|
|
|
+const GONG_SHI = ["完成值", "目标值", "门槛值", "挑战值", "增幅", "降幅"];
|
|
|
+// 判断 score 字符串是否包含 GONG_SHI 中的关键字
|
|
|
+function containsKeywordInScore(score, keywordss) {
|
|
|
+ // 确保 score 是字符串,keywords 是数组
|
|
|
+ if (score && typeof score == "string") {
|
|
|
+ const cleanedScore = score.replace(/[\s\-]/g, ""); // 去除空格和破折号
|
|
|
+ const cleanedKeywords = keywordss.map(keyword =>
|
|
|
+ keyword.replace(/[\s\-]/g, "")
|
|
|
+ );
|
|
|
+ return cleanedKeywords.some(keyword => cleanedScore.includes(keyword));
|
|
|
+ // 遍历 keywords 数组,检查 score 是否包含其中的任何一个关键字
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+}
|
|
|
const direction = ref<DrawerProps["direction"]>("rtl");
|
|
|
const formLabelAlign = reactive({
|
|
|
name: "",
|
|
@@ -89,6 +104,42 @@ const postUpdateApi = async () => {
|
|
|
params.formula = {
|
|
|
noConditionFormula: ""
|
|
|
};
|
|
|
+ // 判断是公式还是数字
|
|
|
+ if (containsKeywordInScore(addmanyChange.outerConditionValue, GONG_SHI)) {
|
|
|
+ addmanyChange.outerConditionValueExpress =
|
|
|
+ addmanyChange.outerConditionValue;
|
|
|
+ }
|
|
|
+ addmanyChange.innerConditionExpression.map(inn => {
|
|
|
+ if (containsKeywordInScore(inn.startValue, GONG_SHI)) {
|
|
|
+ inn.startExpress = inn.startValue;
|
|
|
+ }
|
|
|
+ if (containsKeywordInScore(inn.endValue, GONG_SHI)) {
|
|
|
+ inn.endExpress = inn.endValue;
|
|
|
+ }
|
|
|
+ if (containsKeywordInScore(inn.innerScore, GONG_SHI)) {
|
|
|
+ inn.innerScoreExpress = inn.innerScore;
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ containsKeywordInScore(
|
|
|
+ inn.scoreRuleMoreInnerVO[0].innerConditionValue,
|
|
|
+ GONG_SHI
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ inn.scoreRuleMoreInnerVO[0].innerConditionValueExpress =
|
|
|
+ inn.scoreRuleMoreInnerVO[0].innerConditionValue;
|
|
|
+ }
|
|
|
+ inn.scoreRuleMoreInnerVO[0].scoreRules.map(isc => {
|
|
|
+ if (containsKeywordInScore(isc.score, GONG_SHI)) {
|
|
|
+ isc.scoreExpress = isc.score;
|
|
|
+ }
|
|
|
+ if (containsKeywordInScore(isc.startValue, GONG_SHI)) {
|
|
|
+ isc.startExpress = isc.startValue;
|
|
|
+ }
|
|
|
+ if (containsKeywordInScore(isc.endValue, GONG_SHI)) {
|
|
|
+ isc.endExpress = isc.endValue;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
params.formula.noConditionFormula = JSON.stringify(addmanyChange);
|
|
|
params.formula = JSON.stringify(params.formula);
|
|
|
}
|
|
@@ -316,6 +367,7 @@ const open = row => {
|
|
|
});
|
|
|
Object.assign(addmanyChange, {
|
|
|
outerConditionValue: "",
|
|
|
+ outerConditionValueExpress: "",
|
|
|
innerConditionExpression: [
|
|
|
{
|
|
|
startValue: null,
|
|
@@ -323,6 +375,8 @@ const open = row => {
|
|
|
select: null,
|
|
|
comparisonStart: null,
|
|
|
comparisonEnd: null,
|
|
|
+ innerScore: null,
|
|
|
+ innerScoreExpress: null,
|
|
|
scoreRuleMoreInnerVO: []
|
|
|
}
|
|
|
]
|
|
@@ -417,6 +471,7 @@ const count = item => {
|
|
|
// 多条件公式
|
|
|
const addmanyChange = reactive({
|
|
|
outerConditionValue: "",
|
|
|
+ outerConditionValueExpress: "",
|
|
|
innerConditionExpression: [
|
|
|
{
|
|
|
startValue: null,
|
|
@@ -424,6 +479,8 @@ const addmanyChange = reactive({
|
|
|
select: null,
|
|
|
comparisonStart: null,
|
|
|
comparisonEnd: null,
|
|
|
+ innerScore: null,
|
|
|
+ innerScoreExpress: null,
|
|
|
scoreRuleMoreInnerVO: [
|
|
|
// {
|
|
|
// innerConditionValue: null,
|
|
@@ -447,11 +504,15 @@ const addItemFormulaList = (item, index) => {
|
|
|
addmanyChange.innerConditionExpression[index].scoreRuleMoreInnerVO = [
|
|
|
{
|
|
|
innerConditionValue: null,
|
|
|
+ innerConditionValueExpress: null,
|
|
|
scoreRules: [
|
|
|
{
|
|
|
score: null,
|
|
|
+ scoreExpress: null,
|
|
|
startValue: null,
|
|
|
+ startExpress: null,
|
|
|
endValue: null,
|
|
|
+ endExpress: null,
|
|
|
select: null,
|
|
|
comparisonStart: null,
|
|
|
comparisonEnd: null
|
|
@@ -459,6 +520,7 @@ const addItemFormulaList = (item, index) => {
|
|
|
]
|
|
|
}
|
|
|
];
|
|
|
+ addmanyChange.innerConditionExpression[index].innerScore = "";
|
|
|
};
|
|
|
|
|
|
const deleteItem = index => {
|
|
@@ -504,11 +566,13 @@ const addItemDataList = (
|
|
|
].scoreRuleMoreInnerVO[0].scoreRules.push({
|
|
|
select: null,
|
|
|
score: null,
|
|
|
+ scoreExpress: null,
|
|
|
startValue: itemList.endValue,
|
|
|
endValue: null,
|
|
|
comparisonStart: itemList.comparisonEnd,
|
|
|
comparisonEnd: null
|
|
|
});
|
|
|
+ addmanyChange.innerConditionExpression[index].innerScore = "";
|
|
|
};
|
|
|
// 多条件公式验证
|
|
|
const keywords = ["目标值", "完成值", "挑战值", "增幅", "降幅"];
|
|
@@ -583,6 +647,9 @@ const countNoConditionFormula4 = (item, index, indexList) => {
|
|
|
index
|
|
|
].scoreRuleMoreInnerVO[0].scoreRules[indexList].score = item;
|
|
|
};
|
|
|
+const countNoConditionFormulaInnerScore = (item, index, indexList) => {
|
|
|
+ addmanyChange.innerConditionExpression[index].innerScore = item;
|
|
|
+};
|
|
|
|
|
|
// 转换函数 --- 人员
|
|
|
const convertDepartmentDataRecursive_Person = data => {
|
|
@@ -951,6 +1018,30 @@ const handleRreeSelect = () => {
|
|
|
style="width: 80px"
|
|
|
/>
|
|
|
</div>
|
|
|
+ <el-text v-if="item.scoreRuleMoreInnerVO.length == 0"
|
|
|
+ >得分 =
|
|
|
+ </el-text>
|
|
|
+ <el-input
|
|
|
+ v-if="
|
|
|
+ index + 1 ==
|
|
|
+ addmanyChange.innerConditionExpression.length &&
|
|
|
+ index >= 1
|
|
|
+ "
|
|
|
+ disabled
|
|
|
+ class="ml-2 mr-5"
|
|
|
+ style="width: 100px"
|
|
|
+ />
|
|
|
+ <div v-else>
|
|
|
+ <jishuanqi
|
|
|
+ v-if="item.scoreRuleMoreInnerVO.length == 0"
|
|
|
+ ref="jishuanqiRef"
|
|
|
+ :index="index"
|
|
|
+ :outerConditionValue="item.innerScore"
|
|
|
+ class="ml-2 mr-6"
|
|
|
+ style="width: 100px"
|
|
|
+ @handClick="countNoConditionFormulaInnerScore"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
<el-text type="danger" @click="deleteItem(index)">
|
|
|
<el-icon>
|
|
|
<Delete />
|