From 528efc81f99bb1d3b7cc58313f4d8987ae344ca4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=A1=E5=A4=8D=E4=B9=A0?= <2353956224@qq.com> Date: Thu, 16 Oct 2025 13:50:51 +0800 Subject: [PATCH] =?UTF-8?q?=E7=88=AC=E5=A4=A7=E5=93=A5=E7=9A=84=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=88=86=E9=85=8D=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/server/bigbrother/index.vue | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/views/server/bigbrother/index.vue b/src/views/server/bigbrother/index.vue index 6ec5506..37ee0f2 100644 --- a/src/views/server/bigbrother/index.vue +++ b/src/views/server/bigbrother/index.vue @@ -154,7 +154,9 @@ @@ -204,7 +206,25 @@ import { BigBrotherApi, BigBrotherVO } from '@/api/server/bigbrother' import { getAllocation, getSimpleUserList } from '@/api/system/user' import { useCache } from '@/hooks/web/useCache' import BigBrotherForm from './BigBrotherForm.vue' +import { useDictStore } from '@/store/modules/dict' // 如果你项目里有字典 store +const dictStore = useDictStore?.() // 有就用;没有的话把 dictStore 相关行删掉 +// 统一用字符串比较,自动识别并翻译 i18n key +function dictLabelI18n(type: string, val: any) { + const v = val == null ? '' : String(val) + + // 优先从 store 取;若没有,就从你现有的工具取(getIntDictOptions / getStrDictOptions) + const opts = + (dictStore?.getDictOptions?.(type) as any[]) || + getIntDictOptions(type) || + getStrDictOptions(type) || + [] + + const hit = opts.find(o => String(o.value) === v) + const label = hit?.label ?? '' + // 形如 a.b 或包含点号的,大概率是 i18n key,则用 t() 翻 + return label && label.includes('.') ? t(label) : label +} const { wsCache } = useCache() /** 大哥数据 列表 */ defineOptions({ name: 'BigBrother' })