From a51f19db915bbb62593e0586b8505ae49a51fa33 Mon Sep 17 00:00:00 2001 From: hwj Date: Wed, 7 Jan 2026 18:20:14 +0800 Subject: [PATCH] =?UTF-8?q?style=EF=BC=9A=E9=85=8D=E6=96=B9=E9=85=8D?= =?UTF-8?q?=E7=BD=AE-=E4=BF=AE=E6=94=B9=E9=85=8D=E6=96=B9=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E4=BC=A0=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/formula/formulaConfig/index.vue | 26 ++++++----------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/src/views/formula/formulaConfig/index.vue b/src/views/formula/formulaConfig/index.vue index af62405e..b4729d31 100644 --- a/src/views/formula/formulaConfig/index.vue +++ b/src/views/formula/formulaConfig/index.vue @@ -232,19 +232,10 @@ const productOptions = ref[]>([]) const deviceLoading = ref(false) const deviceOptions = ref[]>([]) const recipeTypeLoading = ref(false) -const recipeTypeOptions = ref[]>([]) - -const recipeTypeLabelMap = computed>(() => { - return recipeTypeOptions.value.reduce((acc, cur) => { - acc[cur.value] = cur.label - return acc - }, {} as Record) -}) +const recipeTypeOptions = ref[]>([]) const getRecipeTypeLabel = (value: unknown) => { - const num = Number(value) - if (!Number.isNaN(num) && recipeTypeLabelMap.value[num]) return recipeTypeLabelMap.value[num] - return (value as any) ?? '' + return value === undefined || value === null ? '' : String(value) } const getProductOptions = async () => { @@ -270,11 +261,8 @@ const getDeviceOptions = async () => { const getRecipeTypeOptions = async () => { recipeTypeLoading.value = true try { - const data = await RecipeApi.getRecipePage(undefined) - recipeTypeOptions.value = (data?.list ?? []).map((item: any) => ({ - label: item.name, - value: item.id - })) + const data = await RecipeApi.getRecipePage() + recipeTypeOptions.value = (data?.list ?? []).map((item: any) => ({ label: item.name, value: item.name })) } finally { recipeTypeLoading.value = false } @@ -296,7 +284,7 @@ const dialogForm = reactive({ id: undefined as number | undefined, recipeCode: '', name: '', - recipeType: undefined as number | undefined, + recipeType: '' as string | undefined, productName: '' as string | undefined, machineName: '' as string | undefined, recipeDesc: '' @@ -319,7 +307,7 @@ const openDialog = async (mode: DialogMode, row?: RecipeConfigVO) => { dialogForm.id = undefined dialogForm.recipeCode = '' dialogForm.name = '' - dialogForm.recipeType = undefined + dialogForm.recipeType = '' dialogForm.productName = '' dialogForm.machineName = '' dialogForm.recipeDesc = '' @@ -329,7 +317,7 @@ const openDialog = async (mode: DialogMode, row?: RecipeConfigVO) => { dialogForm.id = row?.id dialogForm.recipeCode = row?.recipeCode ?? '' dialogForm.name = row?.name ?? row?.recipeName ?? '' - dialogForm.recipeType = typeof row?.recipeType === 'number' ? row.recipeType : Number(row?.recipeType) || undefined + dialogForm.recipeType = row?.recipeType === undefined || row?.recipeType === null ? '' : String(row.recipeType) dialogForm.productName = row?.productName ?? '' dialogForm.machineName = row?.machineName ?? row?.deviceName ?? '' dialogForm.recipeDesc = row?.recipeDesc ?? row?.remark ?? ''