From e4184c65a2997073e042492d1e2c7258cf4adc38 Mon Sep 17 00:00:00 2001 From: hwj Date: Thu, 26 Feb 2026 17:11:03 +0800 Subject: [PATCH] =?UTF-8?q?style=EF=BC=9A=E9=85=8D=E6=96=B9=E5=BA=93-?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=E5=BC=B9=E6=A1=86-=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=98=A0=E5=B0=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/FormulaLibraryReadDialog.vue | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) 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