diff --git a/apps/web-antd/src/store/auth.ts b/apps/web-antd/src/store/auth.ts index aab24b206..cce5699c4 100644 --- a/apps/web-antd/src/store/auth.ts +++ b/apps/web-antd/src/store/auth.ts @@ -4,12 +4,7 @@ import { ref } from 'vue'; import { useRouter } from 'vue-router'; import { DEFAULT_HOME_PATH, LOGIN_PATH } from '@vben/constants'; -import { - resetAllStores, - useAccessStore, - useDictStore, - useUserStore, -} from '@vben/stores'; +import { resetAllStores, useAccessStore, useUserStore } from '@vben/stores'; import { notification } from 'ant-design-vue'; import { defineStore } from 'pinia'; @@ -17,6 +12,7 @@ import { defineStore } from 'pinia'; import { getAuthPermissionInfoApi, loginApi, logoutApi } from '#/api'; import { getSimpleDictDataList } from '#/api/system/dict-data'; import { $t } from '#/locales'; +import { useDictStore } from '#/store'; export const useAuthStore = defineStore('auth', () => { const accessStore = useAccessStore(); diff --git a/packages/stores/src/modules/dict.ts b/apps/web-antd/src/store/dict.ts similarity index 100% rename from packages/stores/src/modules/dict.ts rename to apps/web-antd/src/store/dict.ts diff --git a/apps/web-antd/src/store/index.ts b/apps/web-antd/src/store/index.ts index 269586ee8..b6a7763b1 100644 --- a/apps/web-antd/src/store/index.ts +++ b/apps/web-antd/src/store/index.ts @@ -1 +1,2 @@ export * from './auth'; +export * from './dict'; diff --git a/apps/web-antd/src/utils/dict.ts b/apps/web-antd/src/utils/dict.ts index 046e3f36b..9094cd857 100644 --- a/apps/web-antd/src/utils/dict.ts +++ b/apps/web-antd/src/utils/dict.ts @@ -1,8 +1,9 @@ import type { DefaultOptionType } from 'ant-design-vue/es/select'; -import { useDictStore } from '@vben/stores'; import { isObject } from '@vben/utils'; +import { useDictStore } from '#/store'; + const dictStore = useDictStore(); /** diff --git a/apps/web-antd/src/views/infra/codegen/codegen.data.ts b/apps/web-antd/src/views/infra/codegen/codegen.data.ts index a93bb5f46..0d182c76a 100644 --- a/apps/web-antd/src/views/infra/codegen/codegen.data.ts +++ b/apps/web-antd/src/views/infra/codegen/codegen.data.ts @@ -2,11 +2,11 @@ import type { VxeGridProps } from '#/adapter/vxe-table'; import type { CodegenApi } from '#/api/infra/codegen'; import { type VbenFormProps, z } from '@vben/common-ui'; -import { useDictStore, useUserStore } from '@vben/stores'; +import { useUserStore } from '@vben/stores'; import { getDataSourceConfigList } from '#/api/infra/data-source-config'; import { $t } from '#/locales'; -import { DICT_TYPE } from '#/utils/dict'; +import { DICT_TYPE, getDictOptions } from '#/utils/dict'; export namespace CodegenDefaultData { /** @@ -135,7 +135,7 @@ export namespace CodegenOptionsModalData { rules: z.string().min(1, { message: '实体类名不能为空' }), componentProps: { tooltip: - '默认去除表名的前缀。如果存在重复,则需要手动添加前缀,避免 MyBatis 报 Alias 重复的问题。', + '默认去除表名的前缀。如果存在重复,则需要手动添加前缀,避免 MyBaits 报 Alias 重复的问题。', placeholder: '请输入实体类名', }, }, @@ -159,15 +159,10 @@ export namespace CodegenOptionsModalData { { label: '生成模版', fieldName: 'template', - component: 'ApiSelect', + component: 'Select', componentProps: { + options: getDictOptions(DICT_TYPE.INFRA_CODEGEN_TEMPLATE_TYPE), class: 'w-full', - placeholder: '请选择生成模版', - api: () => { - return useDictStore().getDictOptions( - DICT_TYPE.INFRA_CODEGEN_TEMPLATE_TYPE, - ); - }, }, rules: 'required', defaultValue: '1', @@ -175,15 +170,10 @@ export namespace CodegenOptionsModalData { { label: '前端类型', fieldName: 'frontType', - component: 'ApiSelect', + component: 'Select', componentProps: { + options: getDictOptions(DICT_TYPE.INFRA_CODEGEN_FRONT_TYPE), class: 'w-full', - placeholder: '请选择前端类型', - api: () => { - return useDictStore().getDictOptions( - DICT_TYPE.INFRA_CODEGEN_FRONT_TYPE, - ); - }, }, rules: 'required', defaultValue: '31', @@ -191,13 +181,10 @@ export namespace CodegenOptionsModalData { { label: '生成场景', fieldName: 'scene', - component: 'ApiSelect', + component: 'Select', componentProps: { + options: getDictOptions(DICT_TYPE.INFRA_CODEGEN_SCENE), class: 'w-full', - placeholder: '请选择生成场景', - api: () => { - return useDictStore().getDictOptions(DICT_TYPE.INFRA_CODEGEN_SCENE); - }, }, rules: 'required', defaultValue: '1', diff --git a/apps/web-antd/src/views/infra/file-config/file-config.data.ts b/apps/web-antd/src/views/infra/file-config/file-config.data.ts index 72156e54c..c29e5e935 100644 --- a/apps/web-antd/src/views/infra/file-config/file-config.data.ts +++ b/apps/web-antd/src/views/infra/file-config/file-config.data.ts @@ -3,13 +3,11 @@ import type { FileConfigApi } from '#/api/infra/file-config'; import { h } from 'vue'; -import { useDictStore } from '@vben/stores'; - import { Tag } from 'ant-design-vue'; import { type VbenFormProps, z } from '#/adapter/form'; import { $t } from '#/locales'; -import { DICT_TYPE } from '#/utils/dict'; +import { DICT_TYPE, getDictOptions } from '#/utils/dict'; /** * 文件配置 表格查询表单配置 @@ -26,13 +24,11 @@ export const formSchema: VbenFormProps['schema'] = [ { fieldName: 'storage', label: '储存器', - component: 'ApiSelect', + component: 'Select', componentProps: { class: 'w-full', placeholder: '请选择储存器', - api: () => { - return useDictStore().getDictOptions(DICT_TYPE.INFRA_FILE_STORAGE); - }, + options: getDictOptions(DICT_TYPE.INFRA_FILE_STORAGE), }, }, { @@ -126,9 +122,7 @@ export const editFormSchema: VbenFormProps['schema'] = [ componentProps: { class: 'w-full', placeholder: '请选择储存器', - api: () => { - return useDictStore().getDictOptions(DICT_TYPE.INFRA_FILE_STORAGE); - }, + options: getDictOptions(DICT_TYPE.INFRA_FILE_STORAGE), }, rules: 'required', defaultValue: '1', diff --git a/packages/stores/src/modules/index.ts b/packages/stores/src/modules/index.ts index ba5ab1a98..ec97a39c7 100644 --- a/packages/stores/src/modules/index.ts +++ b/packages/stores/src/modules/index.ts @@ -1,5 +1,4 @@ export * from './access'; -export * from './dict'; export * from './lock'; export * from './tabbar'; export * from './tenant';