From 7697e5c358436a1ff86b013918bff74ad99481f7 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Tue, 21 Mar 2023 16:17:44 +0800 Subject: [PATCH] =?UTF-8?q?add:=20=E6=B7=BB=E5=8A=A0=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=8C=87=E5=AE=9A=E5=AD=97=E5=85=B8=E6=8C=87=E5=AE=9A=E5=80=BC?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E7=9A=84label=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/dict.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/utils/dict.ts b/src/utils/dict.ts index 15e57ff2..4f5d63fb 100644 --- a/src/utils/dict.ts +++ b/src/utils/dict.ts @@ -69,7 +69,16 @@ export const getDictObj = (dictType: string, value: any) => { } }) } - +export const getDictLabel = (dictType: string, value: any) => { + const dictOptions: DictDataType[] = getDictOptions(dictType) + const dictLabel = ref('') + dictOptions.forEach((dict: DictDataType) => { + if (dict.value === value) { + dictLabel.value = dict.label + } + }) + return dictLabel.value +} export enum DICT_TYPE { USER_TYPE = 'user_type', COMMON_STATUS = 'common_status',