From d3059a6205121ce357acef995dfdd16211a43202 Mon Sep 17 00:00:00 2001
From: wangyuhang <139@qq.com>
Date: 星期二, 18 十一月 2025 10:14:02 +0800
Subject: [PATCH] 增加字段 修改字段
---
src/utils/dict.ts | 19 ++++++++++++++++++-
1 files changed, 18 insertions(+), 1 deletions(-)
diff --git a/src/utils/dict.ts b/src/utils/dict.ts
index 8673968..4c68db7 100644
--- a/src/utils/dict.ts
+++ b/src/utils/dict.ts
@@ -21,7 +21,24 @@
return toRefs(res.value);
})();
}
-
+export function useDictPer(...args: string[]) {
+ const res = ref<Dict.resDictType>({});
+ return (() => {
+ args.forEach((dictName: string, index: number) => {
+ res.value[dictName] = [] as Array<Dict.dictType>;
+ const dicts: Array<Dict.dictType> = useDictStore().getDict(dictName);
+ if (dicts) {
+ res.value[dictName] = dicts;
+ } else {
+ getDicts(dictName).then((resp) => {
+ res.value[dictName] = resp.data.map((p: any) => ({ label: p.dictLabel, value: p.dictCode, elTagType: p.listClass, elTagClass: p.cssClass,key: p.dictValue }));
+ useDictStore().setDict(dictName, res.value[dictName]);
+ });
+ }
+ });
+ return toRefs(res.value);
+ })();
+}
// export default {
// install(app: App<Element>) {
// app.config.globalProperties.$useDict = useDict;
--
Gitblit v1.9.1