fix: dict
This commit is contained in:
parent
3b107f56a0
commit
716266693b
@ -3,10 +3,10 @@ import { store } from '../index'
|
||||
import { DictDataVO } from '@/api/system/dict/types'
|
||||
|
||||
export interface DictValueType {
|
||||
value: string | number | boolean
|
||||
value: string
|
||||
label: string
|
||||
clorType: string
|
||||
cssClass: string
|
||||
clorType?: string
|
||||
cssClass?: string
|
||||
}
|
||||
export interface DictTypeType {
|
||||
dictType: string
|
||||
|
1
yudao-ui-admin-vue3/src/types/form.d.ts
vendored
1
yudao-ui-admin-vue3/src/types/form.d.ts
vendored
@ -1,6 +1,5 @@
|
||||
import type { CSSProperties } from 'vue'
|
||||
import { ColProps, ComponentProps, ComponentName } from '@/types/components'
|
||||
import { FormValueType, FormValueType } from '@/types/form'
|
||||
import type { AxiosPromise } from 'axios'
|
||||
|
||||
export type FormSetPropsType = {
|
||||
|
@ -23,8 +23,11 @@ export interface DictDataType {
|
||||
export const getDictOptions = (dictType: string) => {
|
||||
const dictOptions: DictDataType[] = []
|
||||
dictStore.getDictMap.forEach((dict: DictDataType) => {
|
||||
if (dict.dictType + '' === dictType) {
|
||||
dictOptions.push(dict)
|
||||
if (dict.dictType.toString() === dictType) {
|
||||
dictOptions.push({
|
||||
...dict,
|
||||
value: dict.value
|
||||
})
|
||||
}
|
||||
})
|
||||
return dictOptions
|
||||
@ -37,18 +40,17 @@ export const getIntDictOptions = (dictType: string) => {
|
||||
if (dict.dictType.toString() === dictType) {
|
||||
dictOptions.push({
|
||||
...dict,
|
||||
value: dict.value
|
||||
value: parseInt(dict.value + '')
|
||||
})
|
||||
}
|
||||
})
|
||||
console.log(dictOptions)
|
||||
return dictOptions
|
||||
}
|
||||
|
||||
export const getDictObj = (dictType: string, value: string | number | boolean) => {
|
||||
const dictOptions: DictDataType[] = getDictOptions(dictType)
|
||||
dictOptions.forEach((dict: DictDataType) => {
|
||||
if (dict.value === value) {
|
||||
if (dict.value === value.toString()) {
|
||||
return dict
|
||||
}
|
||||
})
|
||||
|
@ -1,8 +1,6 @@
|
||||
import { reactive } from 'vue'
|
||||
import { useI18n } from '@/hooks/web/useI18n'
|
||||
import { DICT_TYPE } from '@/utils/dict'
|
||||
import { VxeCrudSchema, useVxeCrudSchemas } from '@/hooks/web/useVxeCrudSchemas'
|
||||
const { t } = useI18n() // 国际化
|
||||
|
||||
// CrudSchema
|
||||
const crudSchemas = reactive<VxeCrudSchema>({
|
||||
@ -16,10 +14,6 @@ const crudSchemas = reactive<VxeCrudSchema>({
|
||||
field: 'logType',
|
||||
dictType: DICT_TYPE.SYSTEM_LOGIN_TYPE
|
||||
},
|
||||
{
|
||||
title: '用户类型',
|
||||
field: 'userType'
|
||||
},
|
||||
{
|
||||
title: '用户名称',
|
||||
field: 'username',
|
||||
@ -40,10 +34,10 @@ const crudSchemas = reactive<VxeCrudSchema>({
|
||||
dictType: DICT_TYPE.SYSTEM_LOGIN_RESULT
|
||||
},
|
||||
{
|
||||
title: t('common.createTime'),
|
||||
title: '登录日期',
|
||||
field: 'createTime',
|
||||
formatter: 'formatDate',
|
||||
isForm: false,
|
||||
isSearch: true,
|
||||
search: {
|
||||
itemRender: {
|
||||
name: 'XDataTimePicker'
|
||||
|
Loading…
Reference in New Issue
Block a user