| | |
| | | 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 }));
|
| | | useDictStore().setDict(dictName, res.value[dictName]);
|
| | | });
|
| | | }
|
| | | });
|
| | | return toRefs(res.value);
|
| | | })();
|
| | | }
|
| | | // export default {
|
| | | // install(app: App<Element>) {
|
| | | // app.config.globalProperties.$useDict = useDict;
|