4f8e081a by xukangle

Merge branch 'dev_20241202_xukangle' into develop

2 parents a07c4aee 71924fdc
...@@ -32,6 +32,7 @@ import { ...@@ -32,6 +32,7 @@ import {
32 import { TableColumnWidth } from "@/utils/enum"; 32 import { TableColumnWidth } from "@/utils/enum";
33 import router from "@/router"; 33 import router from "@/router";
34 import { download } from "@/utils/common"; 34 import { download } from "@/utils/common";
35 import { ca } from "element-plus/es/locale";
35 36
36 const currentPath = ref<string[]>([]); 37 const currentPath = ref<string[]>([]);
37 const currentDatabasePath = ref<string[]>([]); 38 const currentDatabasePath = ref<string[]>([]);
...@@ -1047,8 +1048,11 @@ const drawerBtnClick = async (btn, info) => { ...@@ -1047,8 +1048,11 @@ const drawerBtnClick = async (btn, info) => {
1047 1048
1048 const params: any = []; 1049 const params: any = [];
1049 selectedRulesData.value.guids.forEach((item: any) => { 1050 selectedRulesData.value.guids.forEach((item: any) => {
1051 let param;
1052
1053 // 根据是否有 fieldValueRange 来决定如何构建参数对象
1050 if (fieldValueRange) { 1054 if (fieldValueRange) {
1051 params.push({ 1055 param = {
1052 fieldPrecision, 1056 fieldPrecision,
1053 dictionaryGuid, 1057 dictionaryGuid,
1054 isUnique, 1058 isUnique,
...@@ -1057,9 +1061,9 @@ const drawerBtnClick = async (btn, info) => { ...@@ -1057,9 +1061,9 @@ const drawerBtnClick = async (btn, info) => {
1057 fieldValueRange, 1061 fieldValueRange,
1058 fieldGuid: item, 1062 fieldGuid: item,
1059 execGuid: execGuidInfo.value.execGuid 1063 execGuid: execGuidInfo.value.execGuid
1060 }) 1064 };
1061 } else { 1065 } else {
1062 params.push({ 1066 param = {
1063 fieldPrecision, 1067 fieldPrecision,
1064 dictionaryGuid, 1068 dictionaryGuid,
1065 isUnique, 1069 isUnique,
...@@ -1069,9 +1073,18 @@ const drawerBtnClick = async (btn, info) => { ...@@ -1069,9 +1073,18 @@ const drawerBtnClick = async (btn, info) => {
1069 execGuid: execGuidInfo.value.execGuid, 1073 execGuid: execGuidInfo.value.execGuid,
1070 startValue, 1074 startValue,
1071 endValue 1075 endValue
1072 }) 1076 };
1077 }
1078
1079 // 检查参数的有效性,如果无效则清空 params 数组
1080 if (isValidParam(param)) {
1081 params.push(param);
1082 } else {
1083 params.length = 0; // 清空数组
1073 } 1084 }
1074 }); 1085 });
1086
1087 try {
1075 const res: any = await saveBizRuleConfig(params); 1088 const res: any = await saveBizRuleConfig(params);
1076 if (res.code == proxy.$passCode) { 1089 if (res.code == proxy.$passCode) {
1077 btn.loading = false; 1090 btn.loading = false;
...@@ -1089,8 +1102,17 @@ const drawerBtnClick = async (btn, info) => { ...@@ -1089,8 +1102,17 @@ const drawerBtnClick = async (btn, info) => {
1089 btn.loading = false; 1102 btn.loading = false;
1090 proxy.$ElMessage.error(res.msg); 1103 proxy.$ElMessage.error(res.msg);
1091 } 1104 }
1105 } catch (error) {
1106 btn.loading = false;
1107 }
1108
1092 } 1109 }
1093 } 1110 }
1111 // 辅助函数:检查对象的除 `fieldGuid` 和 `execGuid` 外的字段是否为空
1112 const isValidParam = (param) => {
1113 const { fieldGuid, execGuid, ...rest } = param;
1114 return Object.values(rest).some(value => value !== null && value !== undefined && value !== '');
1115 }
1094 1116
1095 const drawerSelectChange = (val, row, info) => { 1117 const drawerSelectChange = (val, row, info) => {
1096 console.log('drawerSelectChange', val, row, info); 1118 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!