初始化版本,引入智慧食堂模块,第三方模块

This commit is contained in:
zjf committed 2024-12-06 18:48:18 +08:00
commit d22f88efd3
677 files changed
+69341

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
import { dict } from '/@/stores/dict';
import { getDicts } from '/@/api/admin/dict';
import { ref, toRefs } from 'vue';
/**
* 获取字典数据
*/
export function useDict(...args: any): any {
const res = ref({});
return (() => {
args.forEach((dictType: String) => {
// @ts-ignore
res.value[dictType] = [];
const dicts = dict().getDict(dictType);
if (dicts) {
// @ts-ignore
res.value[dictType] = dicts;
} else {
getDicts(dictType).then((resp) => {
// @ts-ignore
res.value[dictType] = resp.data.map((p: any) => ({ label: p.label, value: p.value, elTagType: p.listClass, elTagClass: p.cssClass }));
// @ts-ignore
dict().setDict(dictType, res.value[dictType]);
});
}
});
return toRefs(res.value);
})();
}