From b7d32e315b40824cce52cc724d0e5c4ad49f6a41 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 27 Oct 2025 08:44:07 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E3=80=90=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E3=80=91use-dict-select.ts=20=E7=9A=84=20API?= =?UTF-8?q?=20=E5=AF=BC=E5=85=A5=E9=97=AE=E9=A2=98=EF=BC=8C=E4=B8=8D?= =?UTF-8?q?=E5=9C=A8=20import=20*?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/form-create/rules/use-dict-select.ts | 8 +++++--- .../src/components/form-create/rules/use-dict-select.ts | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/apps/web-antd/src/components/form-create/rules/use-dict-select.ts b/apps/web-antd/src/components/form-create/rules/use-dict-select.ts index 0054cd41e..c486b6716 100644 --- a/apps/web-antd/src/components/form-create/rules/use-dict-select.ts +++ b/apps/web-antd/src/components/form-create/rules/use-dict-select.ts @@ -1,8 +1,10 @@ +import type { SystemDictTypeApi } from '#/api/system/dict/type'; + import { onMounted, ref } from 'vue'; import { buildUUID, cloneDeep } from '@vben/utils'; -import * as DictDataApi from '#/api/system/dict/type'; +import { getSimpleDictTypeList } from '#/api/system/dict/type'; import { localeProps, makeRequiredRule, @@ -18,12 +20,12 @@ export function useDictSelectRule() { const rules = cloneDeep(selectRule); const dictOptions = ref<{ label: string; value: string }[]>([]); // 字典类型下拉数据 onMounted(async () => { - const data = await DictDataApi.getSimpleDictTypeList(); + const data = await getSimpleDictTypeList(); if (!data || data.length === 0) { return; } dictOptions.value = - data?.map((item: DictDataApi.SystemDictTypeApi.DictType) => ({ + data?.map((item: SystemDictTypeApi.DictType) => ({ label: item.name, value: item.type, })) ?? []; diff --git a/apps/web-ele/src/components/form-create/rules/use-dict-select.ts b/apps/web-ele/src/components/form-create/rules/use-dict-select.ts index c9c438e8b..104277195 100644 --- a/apps/web-ele/src/components/form-create/rules/use-dict-select.ts +++ b/apps/web-ele/src/components/form-create/rules/use-dict-select.ts @@ -1,8 +1,10 @@ +import type { SystemDictTypeApi } from '#/api/system/dict/type'; + import { onMounted, ref } from 'vue'; import { buildUUID, cloneDeep } from '@vben/utils'; -import * as DictDataApi from '#/api/system/dict/type'; +import { getSimpleDictTypeList } from '#/api/system/dict/type'; import { localeProps, makeRequiredRule, @@ -18,12 +20,12 @@ export const useDictSelectRule = () => { const rules = cloneDeep(selectRule); const dictOptions = ref<{ label: string; value: string }[]>([]); // 字典类型下拉数据 onMounted(async () => { - const data = await DictDataApi.getSimpleDictTypeList(); + const data = await getSimpleDictTypeList(); if (!data || data.length === 0) { return; } dictOptions.value = - data?.map((item: DictDataApi.SystemDictTypeApi.DictType) => ({ + data?.map((item: SystemDictTypeApi.DictType) => ({ label: item.name, value: item.type, })) ?? [];