fix
Showing
6 changed files
with
107 additions
and
10 deletions
| ... | @@ -840,3 +840,14 @@ export const getFidldEnName = (data) => request({ | ... | @@ -840,3 +840,14 @@ export const getFidldEnName = (data) => request({ |
| 840 | method: 'post', | 840 | method: 'post', |
| 841 | data | 841 | data |
| 842 | }) | 842 | }) |
| 843 | |||
| 844 | /** | ||
| 845 | * 数据库目录-查询字段分类分级 | ||
| 846 | * @param {Object} | ||
| 847 | * @path /db-dir/field/get-classify-and-grade | ||
| 848 | */ | ||
| 849 | export const getFieldClassifyAndGrade = (data) => request({ | ||
| 850 | url: `${import.meta.env.VITE_APP_CHECK_BASEURL}/db-dir/field/get-classify-and-grade`, | ||
| 851 | method: 'post', | ||
| 852 | data | ||
| 853 | }) | ... | ... |
| ... | @@ -99,10 +99,16 @@ const onClickOutside = (e: any) => { | ... | @@ -99,10 +99,16 @@ const onClickOutside = (e: any) => { |
| 99 | }; | 99 | }; |
| 100 | 100 | ||
| 101 | const getDrawerConRef = (refName) => { | 101 | const getDrawerConRef = (refName) => { |
| 102 | console.log(refName, '----------') | ||
| 102 | if (refName == 'drawerTableRef') { | 103 | if (refName == 'drawerTableRef') { |
| 103 | const dtf = drawerTableRef.value[0] || drawerTableRef.value | 104 | const dtf = drawerTableRef.value[0] || drawerTableRef.value |
| 104 | return dtf?.tableRef | 105 | return dtf?.tableRef |
| 105 | } | 106 | } |
| 107 | // const drawerForm = drawerFormRef.value[0] || drawerFormRef.value; | ||
| 108 | if (refName == 'drawerFormRef') { | ||
| 109 | const drawerForm = drawerFormRef.value[0] || drawerFormRef.value; | ||
| 110 | return drawerForm | ||
| 111 | } | ||
| 106 | } | 112 | } |
| 107 | 113 | ||
| 108 | defineExpose({ | 114 | defineExpose({ | ... | ... |
| ... | @@ -924,6 +924,7 @@ const classEditFormItems = ref<any>([{ | ... | @@ -924,6 +924,7 @@ const classEditFormItems = ref<any>([{ |
| 924 | type: 'input', | 924 | type: 'input', |
| 925 | placeholder: '请输入', | 925 | placeholder: '请输入', |
| 926 | field: 'startValue', | 926 | field: 'startValue', |
| 927 | default: '', | ||
| 927 | clearable: true, | 928 | clearable: true, |
| 928 | required: false, | 929 | required: false, |
| 929 | min: 1, | 930 | min: 1, |
| ... | @@ -933,6 +934,7 @@ const classEditFormItems = ref<any>([{ | ... | @@ -933,6 +934,7 @@ const classEditFormItems = ref<any>([{ |
| 933 | type: 'input', | 934 | type: 'input', |
| 934 | placeholder: '请输入', | 935 | placeholder: '请输入', |
| 935 | field: 'endValue', | 936 | field: 'endValue', |
| 937 | default: '', | ||
| 936 | clearable: true, | 938 | clearable: true, |
| 937 | min: 1, | 939 | min: 1, |
| 938 | required: false, | 940 | required: false, |
| ... | @@ -971,7 +973,7 @@ const classEditFormItems = ref<any>([{ | ... | @@ -971,7 +973,7 @@ const classEditFormItems = ref<any>([{ |
| 971 | { | 973 | { |
| 972 | label: '是否必填', | 974 | label: '是否必填', |
| 973 | type: "select", | 975 | type: "select", |
| 974 | field: "notNull", | 976 | field: "isNotNull", |
| 975 | disabled: false, | 977 | disabled: false, |
| 976 | default: '', | 978 | default: '', |
| 977 | options: [ | 979 | options: [ |
| ... | @@ -1037,7 +1039,7 @@ const drawerBtnClick = async (btn, info) => { | ... | @@ -1037,7 +1039,7 @@ const drawerBtnClick = async (btn, info) => { |
| 1037 | } else { | 1039 | } else { |
| 1038 | btn.loading = true; | 1040 | btn.loading = true; |
| 1039 | console.log('drawerBtnClick', info); | 1041 | console.log('drawerBtnClick', info); |
| 1040 | const { orderNumLength, orderNum, startNumber, endNumber, fieldValueRange, startValue, endValue, fieldPrecision, dictionaryGuid, isUnique, notNull } = info; | 1042 | const { orderNumLength, orderNum, startNumber, endNumber, fieldValueRange, startValue, endValue, fieldPrecision, dictionaryGuid, isUnique, isNotNull } = info; |
| 1041 | // 判断长度orderNumLength,orderNum 要么都有值,要么都没有值,不能只有一个有值,一个没有值精确提醒 | 1043 | // 判断长度orderNumLength,orderNum 要么都有值,要么都没有值,不能只有一个有值,一个没有值精确提醒 |
| 1042 | let fieldLengthCondition: any = ''; | 1044 | let fieldLengthCondition: any = ''; |
| 1043 | if ((orderNumLength === 'between' && !startNumber) || (orderNumLength === 'between' && !endNumber)) { | 1045 | if ((orderNumLength === 'between' && !startNumber) || (orderNumLength === 'between' && !endNumber)) { |
| ... | @@ -1075,10 +1077,10 @@ const drawerBtnClick = async (btn, info) => { | ... | @@ -1075,10 +1077,10 @@ const drawerBtnClick = async (btn, info) => { |
| 1075 | // 根据是否有 fieldValueRange 来决定如何构建参数对象 | 1077 | // 根据是否有 fieldValueRange 来决定如何构建参数对象 |
| 1076 | if (fieldValueRange) { | 1078 | if (fieldValueRange) { |
| 1077 | param = { | 1079 | param = { |
| 1078 | fieldPrecision: fieldPrecision || '', | 1080 | fieldPrecision, |
| 1079 | dictionaryGuid, | 1081 | dictionaryGuid, |
| 1080 | isUnique, | 1082 | isUnique, |
| 1081 | notNull, | 1083 | isNotNull, |
| 1082 | fieldLengthCondition, | 1084 | fieldLengthCondition, |
| 1083 | fieldValueRange, | 1085 | fieldValueRange, |
| 1084 | fieldGuid: item, | 1086 | fieldGuid: item, |
| ... | @@ -1086,10 +1088,10 @@ const drawerBtnClick = async (btn, info) => { | ... | @@ -1086,10 +1088,10 @@ const drawerBtnClick = async (btn, info) => { |
| 1086 | }; | 1088 | }; |
| 1087 | } else { | 1089 | } else { |
| 1088 | param = { | 1090 | param = { |
| 1089 | fieldPrecision: fieldPrecision || '', | 1091 | fieldPrecision, |
| 1090 | dictionaryGuid, | 1092 | dictionaryGuid, |
| 1091 | isUnique, | 1093 | isUnique, |
| 1092 | notNull, | 1094 | isNotNull, |
| 1093 | fieldLengthCondition, | 1095 | fieldLengthCondition, |
| 1094 | fieldGuid: item, | 1096 | fieldGuid: item, |
| 1095 | execGuid: execGuidInfo.value.execGuid, | 1097 | execGuid: execGuidInfo.value.execGuid, |
| ... | @@ -1136,8 +1138,9 @@ const isValidParam = (param) => { | ... | @@ -1136,8 +1138,9 @@ const isValidParam = (param) => { |
| 1136 | return Object.values(rest).some(value => value !== null && value !== undefined && value !== ''); | 1138 | return Object.values(rest).some(value => value !== null && value !== undefined && value !== ''); |
| 1137 | } | 1139 | } |
| 1138 | 1140 | ||
| 1141 | const drawerRef = ref<any>(); | ||
| 1139 | const drawerSelectChange = (val, row, info) => { | 1142 | const drawerSelectChange = (val, row, info) => { |
| 1140 | console.log('drawerSelectChange', val, row, info); | 1143 | const tempInfo = drawerRef.value.getDrawerConRef('drawerFormRef').formInline; |
| 1141 | if (val === 'between') { | 1144 | if (val === 'between') { |
| 1142 | classEditFormItems.value.forEach(item => { | 1145 | classEditFormItems.value.forEach(item => { |
| 1143 | if (item.field === 'orderNum') { | 1146 | if (item.field === 'orderNum') { |
| ... | @@ -1166,6 +1169,34 @@ const drawerSelectChange = (val, row, info) => { | ... | @@ -1166,6 +1169,34 @@ const drawerSelectChange = (val, row, info) => { |
| 1166 | }); | 1169 | }); |
| 1167 | } | 1170 | } |
| 1168 | } | 1171 | } |
| 1172 | classEditFormItems.value.forEach(item => { | ||
| 1173 | if (item.field === 'orderNum') { | ||
| 1174 | item.default = tempInfo.orderNum; | ||
| 1175 | } | ||
| 1176 | if (item.field === 'dictionaryGuid') { | ||
| 1177 | item.default = tempInfo.dictionaryGuid; | ||
| 1178 | } | ||
| 1179 | if (item.field === 'isNotNull') { | ||
| 1180 | item.default = tempInfo.isNotNull; | ||
| 1181 | } | ||
| 1182 | if (item.field === 'isUnique') { | ||
| 1183 | item.default = tempInfo.isUnique; | ||
| 1184 | } | ||
| 1185 | if (item.field === 'fieldValueRange' && item.children) { | ||
| 1186 | item.children.forEach(item => { | ||
| 1187 | if (item.field === 'startValue') { | ||
| 1188 | item.default = tempInfo.startValue; | ||
| 1189 | } | ||
| 1190 | if (item.field === 'endValue') { | ||
| 1191 | item.default = tempInfo.endValue; | ||
| 1192 | } | ||
| 1193 | }); | ||
| 1194 | } | ||
| 1195 | if (item.field === 'fieldValueRange' && !item.children) { | ||
| 1196 | item.default = tempInfo.fieldValueRange; | ||
| 1197 | } | ||
| 1198 | }); | ||
| 1199 | |||
| 1169 | } | 1200 | } |
| 1170 | 1201 | ||
| 1171 | // tab切换 | 1202 | // tab切换 |
| ... | @@ -1984,7 +2015,7 @@ watchEffect(() => { | ... | @@ -1984,7 +2015,7 @@ watchEffect(() => { |
| 1984 | <Table :tableInfo="tableFieldsDataInfo" @tablePageChange="dataFieldTablePageChange" /> | 2015 | <Table :tableInfo="tableFieldsDataInfo" @tablePageChange="dataFieldTablePageChange" /> |
| 1985 | </div> | 2016 | </div> |
| 1986 | </div> | 2017 | </div> |
| 1987 | <Drawer :drawerInfo="drawerInfo" @drawerBtnClick="drawerBtnClick" class="v-drawer" | 2018 | <Drawer :drawerInfo="drawerInfo" @drawerBtnClick="drawerBtnClick" class="v-drawer" ref="drawerRef" |
| 1988 | @drawerSelectChange="drawerSelectChange" /> | 2019 | @drawerSelectChange="drawerSelectChange" /> |
| 1989 | 2020 | ||
| 1990 | </div> | 2021 | </div> | ... | ... |
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
| ... | @@ -33,7 +33,7 @@ import { | ... | @@ -33,7 +33,7 @@ import { |
| 33 | getSubjectTableDetail, | 33 | getSubjectTableDetail, |
| 34 | checkSubjectTableData | 34 | checkSubjectTableData |
| 35 | } from "@/api/modules/dataCatalogService"; | 35 | } from "@/api/modules/dataCatalogService"; |
| 36 | import { getDictionaryAll, getFidldEnName, getGradeList, getNewDataTypeList, getTaskExeTreeList, saveDbDirTable } from "@/api/modules/dataInventory"; | 36 | import { getDictionaryAll, getFidldEnName, getGradeList, getNewDataTypeList, getTaskExeTreeList, saveDbDirTable, getFieldClassifyAndGrade } from "@/api/modules/dataInventory"; |
| 37 | import { useDefault } from "@/hooks/useDefault"; | 37 | import { useDefault } from "@/hooks/useDefault"; |
| 38 | import uploadExcelFile from "./components/uploadExcelFile.vue"; | 38 | import uploadExcelFile from "./components/uploadExcelFile.vue"; |
| 39 | import { add } from "lodash-es"; | 39 | import { add } from "lodash-es"; |
| ... | @@ -115,7 +115,7 @@ const uploadFileRef = ref(); | ... | @@ -115,7 +115,7 @@ const uploadFileRef = ref(); |
| 115 | 115 | ||
| 116 | const getSubjectField = () => { | 116 | const getSubjectField = () => { |
| 117 | tableFieldsLoading.value = true; | 117 | tableFieldsLoading.value = true; |
| 118 | getFidldEnName(fileTableFields.value.map(f => f.chName)).then((res: any) => { | 118 | getFidldEnName(fileTableFields.value.map(f => f.chName)).then(async (res: any) => { |
| 119 | tableFieldsLoading.value = false; | 119 | tableFieldsLoading.value = false; |
| 120 | if (res.code == proxy.$passCode) { | 120 | if (res.code == proxy.$passCode) { |
| 121 | tableCreateInfo.value.tableFields = res.data?.map((field, i) => { | 121 | tableCreateInfo.value.tableFields = res.data?.map((field, i) => { |
| ... | @@ -125,6 +125,55 @@ const getSubjectField = () => { | ... | @@ -125,6 +125,55 @@ const getSubjectField = () => { |
| 125 | !field.notNull && (field.notNull = 'N'); | 125 | !field.notNull && (field.notNull = 'N'); |
| 126 | return field; | 126 | return field; |
| 127 | }) || []; | 127 | }) || []; |
| 128 | console.log(tableCreateInfo.value.tableFields, '7897987'); | ||
| 129 | // 遍历 tableCreateInfo.value.tableFields,找到item.fieldName,组合成入参 | ||
| 130 | let tempFileNames: any = [] | ||
| 131 | tableCreateInfo.value.tableFields.forEach((item: any) => { | ||
| 132 | tempFileNames.push(item.fieldName); | ||
| 133 | }); | ||
| 134 | const classify: any = await getFieldClassifyAndGrade({ | ||
| 135 | fieldName: tempFileNames, | ||
| 136 | execGuid: execGuid.value, | ||
| 137 | type: 'C' | ||
| 138 | }) | ||
| 139 | const grade: any = await getFieldClassifyAndGrade({ | ||
| 140 | fieldName: tempFileNames, | ||
| 141 | execGuid: execGuid.value, | ||
| 142 | type: 'G' | ||
| 143 | }) | ||
| 144 | // 通过分类数据和分级数据赋值给 tableFields 的每一项 | ||
| 145 | tableCreateInfo.value.tableFields.forEach((item: any) => { | ||
| 146 | // 在分类数据中查找对应 fieldName 的项 | ||
| 147 | const classifyItem = classify.find((classify: any) => classify.fieldName === item.fieldName); | ||
| 148 | |||
| 149 | // 在分级数据中查找对应 fieldName 的项 | ||
| 150 | const gradeItem = grade.find((grade: any) => grade.fieldName === item.fieldName); | ||
| 151 | |||
| 152 | // 如果找到对应的分类数据,赋值给 tableFields 的相应项 | ||
| 153 | if (classifyItem) { | ||
| 154 | item.classifyDetailGuid = classifyItem.classifyDetailGuid || null; | ||
| 155 | item.classifyDetailName = classifyItem.classifyDetailName || null; | ||
| 156 | item.classifyDetailGuidRoutes = classifyItem.classifyDetailGuidRoutes || null; | ||
| 157 | item.classifyDetailNameRoutes = classifyItem.classifyDetailNameRoutes || null; | ||
| 158 | } | ||
| 159 | |||
| 160 | // 如果找到对应的分级数据,赋值给 tableFields 的相应项 | ||
| 161 | if (gradeItem) { | ||
| 162 | item.gradeDetailGuid = gradeItem.gradeDetailGuid || null; | ||
| 163 | item.gradeDetailName = gradeItem.gradeDetailName || null; | ||
| 164 | } | ||
| 165 | }); | ||
| 166 | |||
| 167 | } else { | ||
| 168 | ElMessage.error(res.msg); | ||
| 169 | } | ||
| 170 | }); | ||
| 171 | } | ||
| 172 | |||
| 173 | const getGradeClassifyInfo = (params) => { | ||
| 174 | getFieldClassifyAndGrade(params).then((res: any) => { | ||
| 175 | if (res.code === proxy.$passCode) { | ||
| 176 | |||
| 128 | } else { | 177 | } else { |
| 129 | ElMessage.error(res.msg); | 178 | ElMessage.error(res.msg); |
| 130 | } | 179 | } | ... | ... |
-
Please register or sign in to post a comment