fix: 将 dict 放回antd目录下

pull/60/MERGE
xingyu4j 2024-12-18 14:38:41 +08:00
parent b51045cc1b
commit 1fc3b094d1
7 changed files with 18 additions and 40 deletions

View File

@ -4,12 +4,7 @@ import { ref } from 'vue';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
import { DEFAULT_HOME_PATH, LOGIN_PATH } from '@vben/constants'; import { DEFAULT_HOME_PATH, LOGIN_PATH } from '@vben/constants';
import { import { resetAllStores, useAccessStore, useUserStore } from '@vben/stores';
resetAllStores,
useAccessStore,
useDictStore,
useUserStore,
} from '@vben/stores';
import { notification } from 'ant-design-vue'; import { notification } from 'ant-design-vue';
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
@ -17,6 +12,7 @@ import { defineStore } from 'pinia';
import { getAuthPermissionInfoApi, loginApi, logoutApi } from '#/api'; import { getAuthPermissionInfoApi, loginApi, logoutApi } from '#/api';
import { getSimpleDictDataList } from '#/api/system/dict-data'; import { getSimpleDictDataList } from '#/api/system/dict-data';
import { $t } from '#/locales'; import { $t } from '#/locales';
import { useDictStore } from '#/store';
export const useAuthStore = defineStore('auth', () => { export const useAuthStore = defineStore('auth', () => {
const accessStore = useAccessStore(); const accessStore = useAccessStore();

View File

@ -1 +1,2 @@
export * from './auth'; export * from './auth';
export * from './dict';

View File

@ -1,8 +1,9 @@
import type { DefaultOptionType } from 'ant-design-vue/es/select'; import type { DefaultOptionType } from 'ant-design-vue/es/select';
import { useDictStore } from '@vben/stores';
import { isObject } from '@vben/utils'; import { isObject } from '@vben/utils';
import { useDictStore } from '#/store';
const dictStore = useDictStore(); const dictStore = useDictStore();
/** /**

View File

@ -2,11 +2,11 @@ import type { VxeGridProps } from '#/adapter/vxe-table';
import type { CodegenApi } from '#/api/infra/codegen'; import type { CodegenApi } from '#/api/infra/codegen';
import { type VbenFormProps, z } from '@vben/common-ui'; 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 { getDataSourceConfigList } from '#/api/infra/data-source-config';
import { $t } from '#/locales'; import { $t } from '#/locales';
import { DICT_TYPE } from '#/utils/dict'; import { DICT_TYPE, getDictOptions } from '#/utils/dict';
export namespace CodegenDefaultData { export namespace CodegenDefaultData {
/** /**
@ -135,7 +135,7 @@ export namespace CodegenOptionsModalData {
rules: z.string().min(1, { message: '实体类名不能为空' }), rules: z.string().min(1, { message: '实体类名不能为空' }),
componentProps: { componentProps: {
tooltip: tooltip:
'默认去除表名的前缀。如果存在重复,则需要手动添加前缀,避免 MyBatis 报 Alias 重复的问题。', '默认去除表名的前缀。如果存在重复,则需要手动添加前缀,避免 MyBaits 报 Alias 重复的问题。',
placeholder: '请输入实体类名', placeholder: '请输入实体类名',
}, },
}, },
@ -159,15 +159,10 @@ export namespace CodegenOptionsModalData {
{ {
label: '生成模版', label: '生成模版',
fieldName: 'template', fieldName: 'template',
component: 'ApiSelect', component: 'Select',
componentProps: { componentProps: {
options: getDictOptions(DICT_TYPE.INFRA_CODEGEN_TEMPLATE_TYPE),
class: 'w-full', class: 'w-full',
placeholder: '请选择生成模版',
api: () => {
return useDictStore().getDictOptions(
DICT_TYPE.INFRA_CODEGEN_TEMPLATE_TYPE,
);
},
}, },
rules: 'required', rules: 'required',
defaultValue: '1', defaultValue: '1',
@ -175,15 +170,10 @@ export namespace CodegenOptionsModalData {
{ {
label: '前端类型', label: '前端类型',
fieldName: 'frontType', fieldName: 'frontType',
component: 'ApiSelect', component: 'Select',
componentProps: { componentProps: {
options: getDictOptions(DICT_TYPE.INFRA_CODEGEN_FRONT_TYPE),
class: 'w-full', class: 'w-full',
placeholder: '请选择前端类型',
api: () => {
return useDictStore().getDictOptions(
DICT_TYPE.INFRA_CODEGEN_FRONT_TYPE,
);
},
}, },
rules: 'required', rules: 'required',
defaultValue: '31', defaultValue: '31',
@ -191,13 +181,10 @@ export namespace CodegenOptionsModalData {
{ {
label: '生成场景', label: '生成场景',
fieldName: 'scene', fieldName: 'scene',
component: 'ApiSelect', component: 'Select',
componentProps: { componentProps: {
options: getDictOptions(DICT_TYPE.INFRA_CODEGEN_SCENE),
class: 'w-full', class: 'w-full',
placeholder: '请选择生成场景',
api: () => {
return useDictStore().getDictOptions(DICT_TYPE.INFRA_CODEGEN_SCENE);
},
}, },
rules: 'required', rules: 'required',
defaultValue: '1', defaultValue: '1',

View File

@ -3,13 +3,11 @@ import type { FileConfigApi } from '#/api/infra/file-config';
import { h } from 'vue'; import { h } from 'vue';
import { useDictStore } from '@vben/stores';
import { Tag } from 'ant-design-vue'; import { Tag } from 'ant-design-vue';
import { type VbenFormProps, z } from '#/adapter/form'; import { type VbenFormProps, z } from '#/adapter/form';
import { $t } from '#/locales'; 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', fieldName: 'storage',
label: '储存器', label: '储存器',
component: 'ApiSelect', component: 'Select',
componentProps: { componentProps: {
class: 'w-full', class: 'w-full',
placeholder: '请选择储存器', placeholder: '请选择储存器',
api: () => { options: getDictOptions(DICT_TYPE.INFRA_FILE_STORAGE),
return useDictStore().getDictOptions(DICT_TYPE.INFRA_FILE_STORAGE);
},
}, },
}, },
{ {
@ -126,9 +122,7 @@ export const editFormSchema: VbenFormProps['schema'] = [
componentProps: { componentProps: {
class: 'w-full', class: 'w-full',
placeholder: '请选择储存器', placeholder: '请选择储存器',
api: () => { options: getDictOptions(DICT_TYPE.INFRA_FILE_STORAGE),
return useDictStore().getDictOptions(DICT_TYPE.INFRA_FILE_STORAGE);
},
}, },
rules: 'required', rules: 'required',
defaultValue: '1', defaultValue: '1',

View File

@ -1,5 +1,4 @@
export * from './access'; export * from './access';
export * from './dict';
export * from './lock'; export * from './lock';
export * from './tabbar'; export * from './tabbar';
export * from './tenant'; export * from './tenant';