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