4f8e081a by xukangle

Merge branch 'dev_20241202_xukangle' into develop

2 parents a07c4aee 71924fdc
......@@ -32,6 +32,7 @@ import {
import { TableColumnWidth } from "@/utils/enum";
import router from "@/router";
import { download } from "@/utils/common";
import { ca } from "element-plus/es/locale";
const currentPath = ref<string[]>([]);
const currentDatabasePath = ref<string[]>([]);
......@@ -1047,8 +1048,11 @@ const drawerBtnClick = async (btn, info) => {
const params: any = [];
selectedRulesData.value.guids.forEach((item: any) => {
let param;
// 根据是否有 fieldValueRange 来决定如何构建参数对象
if (fieldValueRange) {
params.push({
param = {
fieldPrecision,
dictionaryGuid,
isUnique,
......@@ -1057,9 +1061,9 @@ const drawerBtnClick = async (btn, info) => {
fieldValueRange,
fieldGuid: item,
execGuid: execGuidInfo.value.execGuid
})
};
} else {
params.push({
param = {
fieldPrecision,
dictionaryGuid,
isUnique,
......@@ -1069,9 +1073,18 @@ const drawerBtnClick = async (btn, info) => {
execGuid: execGuidInfo.value.execGuid,
startValue,
endValue
})
};
}
// 检查参数的有效性,如果无效则清空 params 数组
if (isValidParam(param)) {
params.push(param);
} else {
params.length = 0; // 清空数组
}
});
try {
const res: any = await saveBizRuleConfig(params);
if (res.code == proxy.$passCode) {
btn.loading = false;
......@@ -1089,8 +1102,17 @@ const drawerBtnClick = async (btn, info) => {
btn.loading = false;
proxy.$ElMessage.error(res.msg);
}
} catch (error) {
btn.loading = false;
}
}
}
// 辅助函数:检查对象的除 `fieldGuid` 和 `execGuid` 外的字段是否为空
const isValidParam = (param) => {
const { fieldGuid, execGuid, ...rest } = param;
return Object.values(rest).some(value => value !== null && value !== undefined && value !== '');
}
const drawerSelectChange = (val, row, info) => {
console.log('drawerSelectChange', val, row, info);
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!