diff --git a/src/views/formula/formulaLibrary/components/FormulaLibraryReadDialog.vue b/src/views/formula/formulaLibrary/components/FormulaLibraryReadDialog.vue index 855edfcc..375ea5f5 100644 --- a/src/views/formula/formulaLibrary/components/FormulaLibraryReadDialog.vue +++ b/src/views/formula/formulaLibrary/components/FormulaLibraryReadDialog.vue @@ -29,7 +29,11 @@ align="center" prop="dataUnit" width="140" - /> + > + + ([]) + +const ensureUnitList = async () => { + if (unitList.value.length > 0) return + unitList.value = await ProductUnitApi.getProductUnitSimpleList() +} + +const getUnitLabel = (dataUnit: unknown) => { + const id = String(dataUnit ?? '').trim() + if (!id) return '-' + const unit = unitList.value.find((u) => String(u.id) === id) + return unit?.name ?? id +} + const queryParams = reactive({ pageNo: 1, pageSize: 10 @@ -157,6 +176,7 @@ const open = async (options: { hasExistingRecords?: boolean }) => { visible.value = true + await ensureUnitList() formulaLibraryId.value = options.id recipeId.value = options.recipeId hasExistingRecords.value = !!options.hasExistingRecords