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