fix : 分类分级
Showing
1 changed file
with
41 additions
and
19 deletions
| ... | @@ -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,28 +1073,46 @@ const drawerBtnClick = async (btn, info) => { | ... | @@ -1069,28 +1073,46 @@ 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 | }); |
| 1075 | const res: any = await saveBizRuleConfig(params); | 1086 | |
| 1076 | if (res.code == proxy.$passCode) { | 1087 | try { |
| 1077 | btn.loading = false; | 1088 | const res: any = await saveBizRuleConfig(params); |
| 1078 | proxy.$ElMessage.success('配置成功!'); | 1089 | if (res.code == proxy.$passCode) { |
| 1079 | drawerInfo.value.visible = false; | 1090 | btn.loading = false; |
| 1080 | getCgDirFieldPage({ | 1091 | proxy.$ElMessage.success('配置成功!'); |
| 1081 | execGuid: execGuidInfo.value.execGuid, | 1092 | drawerInfo.value.visible = false; |
| 1082 | classifyDetail: classifyDetailGuidInfo.value, | 1093 | getCgDirFieldPage({ |
| 1083 | gradeDetailGuid: levelGuidInfo.value, | 1094 | execGuid: execGuidInfo.value.execGuid, |
| 1084 | databaseGuid: selectedA.value, | 1095 | classifyDetail: classifyDetailGuidInfo.value, |
| 1085 | tableGuid: selectedB.value, | 1096 | gradeDetailGuid: levelGuidInfo.value, |
| 1086 | fieldGuid: selectedC.value, | 1097 | databaseGuid: selectedA.value, |
| 1087 | }); | 1098 | tableGuid: selectedB.value, |
| 1088 | } else { | 1099 | fieldGuid: selectedC.value, |
| 1100 | }); | ||
| 1101 | } else { | ||
| 1102 | btn.loading = false; | ||
| 1103 | proxy.$ElMessage.error(res.msg); | ||
| 1104 | } | ||
| 1105 | } catch (error) { | ||
| 1089 | btn.loading = false; | 1106 | btn.loading = false; |
| 1090 | proxy.$ElMessage.error(res.msg); | ||
| 1091 | } | 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); | ... | ... |
-
Please register or sign in to post a comment