Commit 716266693b0cb5300d3c839ccb9ca310ead7294a
1 parent
3b107f56
fix: dict
Showing
4 changed files
with
12 additions
and
17 deletions
yudao-ui-admin-vue3/src/store/modules/dict.ts
| ... | ... | @@ -3,10 +3,10 @@ import { store } from '../index' |
| 3 | 3 | import { DictDataVO } from '@/api/system/dict/types' |
| 4 | 4 | |
| 5 | 5 | export interface DictValueType { |
| 6 | - value: string | number | boolean | |
| 6 | + value: string | |
| 7 | 7 | label: string |
| 8 | - clorType: string | |
| 9 | - cssClass: string | |
| 8 | + clorType?: string | |
| 9 | + cssClass?: string | |
| 10 | 10 | } |
| 11 | 11 | export interface DictTypeType { |
| 12 | 12 | dictType: string | ... | ... |
yudao-ui-admin-vue3/src/types/form.d.ts
yudao-ui-admin-vue3/src/utils/dict.ts
| ... | ... | @@ -23,8 +23,11 @@ export interface DictDataType { |
| 23 | 23 | export const getDictOptions = (dictType: string) => { |
| 24 | 24 | const dictOptions: DictDataType[] = [] |
| 25 | 25 | dictStore.getDictMap.forEach((dict: DictDataType) => { |
| 26 | - if (dict.dictType + '' === dictType) { | |
| 27 | - dictOptions.push(dict) | |
| 26 | + if (dict.dictType.toString() === dictType) { | |
| 27 | + dictOptions.push({ | |
| 28 | + ...dict, | |
| 29 | + value: dict.value | |
| 30 | + }) | |
| 28 | 31 | } |
| 29 | 32 | }) |
| 30 | 33 | return dictOptions |
| ... | ... | @@ -37,18 +40,17 @@ export const getIntDictOptions = (dictType: string) => { |
| 37 | 40 | if (dict.dictType.toString() === dictType) { |
| 38 | 41 | dictOptions.push({ |
| 39 | 42 | ...dict, |
| 40 | - value: dict.value | |
| 43 | + value: parseInt(dict.value + '') | |
| 41 | 44 | }) |
| 42 | 45 | } |
| 43 | 46 | }) |
| 44 | - console.log(dictOptions) | |
| 45 | 47 | return dictOptions |
| 46 | 48 | } |
| 47 | 49 | |
| 48 | 50 | export const getDictObj = (dictType: string, value: string | number | boolean) => { |
| 49 | 51 | const dictOptions: DictDataType[] = getDictOptions(dictType) |
| 50 | 52 | dictOptions.forEach((dict: DictDataType) => { |
| 51 | - if (dict.value === value) { | |
| 53 | + if (dict.value === value.toString()) { | |
| 52 | 54 | return dict |
| 53 | 55 | } |
| 54 | 56 | }) | ... | ... |
yudao-ui-admin-vue3/src/views/system/loginlog/loginLog.data.ts
| 1 | 1 | import { reactive } from 'vue' |
| 2 | -import { useI18n } from '@/hooks/web/useI18n' | |
| 3 | 2 | import { DICT_TYPE } from '@/utils/dict' |
| 4 | 3 | import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas' |
| 5 | -const { t } = useI18n() // 国际化 | |
| 6 | 4 | |
| 7 | 5 | // CrudSchema |
| 8 | 6 | const crudSchemas = reactive<VxeCrudSchema>({ |
| ... | ... | @@ -17,10 +15,6 @@ const crudSchemas = reactive<VxeCrudSchema>({ |
| 17 | 15 | dictType: DICT_TYPE.SYSTEM_LOGIN_TYPE |
| 18 | 16 | }, |
| 19 | 17 | { |
| 20 | - title: '用户类型', | |
| 21 | - field: 'userType' | |
| 22 | - }, | |
| 23 | - { | |
| 24 | 18 | title: '用户名称', |
| 25 | 19 | field: 'username', |
| 26 | 20 | isSearch: true |
| ... | ... | @@ -40,10 +34,10 @@ const crudSchemas = reactive<VxeCrudSchema>({ |
| 40 | 34 | dictType: DICT_TYPE.SYSTEM_LOGIN_RESULT |
| 41 | 35 | }, |
| 42 | 36 | { |
| 43 | - title: t('common.createTime'), | |
| 37 | + title: '登录日期', | |
| 44 | 38 | field: 'createTime', |
| 45 | 39 | formatter: 'formatDate', |
| 46 | - isForm: false, | |
| 40 | + isSearch: true, | |
| 47 | 41 | search: { |
| 48 | 42 | itemRender: { |
| 49 | 43 | name: 'XDataTimePicker' | ... | ... |