From 7455348a6e578ae6a48e4a11e0fa07a4b58b6182 Mon Sep 17 00:00:00 2001 From: xingyu Date: Wed, 16 Nov 2022 23:15:14 +0800 Subject: [PATCH] refactor: dict --- .../src/hooks/web/useCrudSchemas.ts | 23 ++++++-- .../src/hooks/web/useVxeCrudSchemas.ts | 21 +++++-- yudao-ui-admin-vue3/src/router/index.ts | 6 +- yudao-ui-admin-vue3/src/store/modules/dict.ts | 18 +++--- yudao-ui-admin-vue3/src/utils/dict.ts | 55 ++++++++++++------- .../src/views/bpm/form/form.data.ts | 3 +- .../src/views/bpm/group/group.data.ts | 3 +- .../src/views/bpm/model/model.data.ts | 1 + .../views/bpm/processInstance/process.data.ts | 3 + .../src/views/bpm/task/done/done.data.ts | 3 +- .../infra/apiAccessLog/apiAccessLog.data.ts | 1 + .../infra/apiErrorLog/apiErrorLog.data.ts | 1 + .../src/views/infra/config/config.data.ts | 1 + .../views/infra/fileConfig/fileConfig.data.ts | 4 +- .../src/views/infra/job/job.data.ts | 1 + .../src/views/infra/job/jobLog.data.ts | 1 + .../src/views/pay/app/app.data.ts | 1 + .../src/views/pay/merchant/merchant.data.ts | 1 + .../src/views/pay/order/order.data.ts | 5 +- .../src/views/pay/refund/refund.data.ts | 2 + .../src/views/system/dict/dict.data.ts | 3 +- .../src/views/system/dict/dict.type.ts | 3 +- .../views/system/errorCode/errorCode.data.ts | 1 + .../views/system/loginlog/loginLog.data.ts | 18 ++++-- .../src/views/system/notice/notice.data.ts | 4 +- .../views/system/oauth2/client/client.data.ts | 1 + .../views/system/oauth2/token/token.data.ts | 1 + .../system/operatelog/operatelog.data.ts | 1 + .../src/views/system/post/post.data.ts | 1 + .../src/views/system/role/role.data.ts | 4 +- .../src/views/system/sensitiveWord/index.vue | 3 + .../sensitiveWord/sensitiveWord.data.ts | 1 + .../system/sms/smsChannel/sms.channel.data.ts | 1 + .../views/system/sms/smsLog/sms.log.data.ts | 4 ++ .../views/system/sms/smsTemplate/index.vue | 4 +- .../sms/smsTemplate/sms.template.data.ts | 2 + .../src/views/system/tenant/tenant.data.ts | 1 + .../tenantPackage/tenantPackage.data.ts | 1 + .../src/views/system/user/user.data.ts | 1 + 39 files changed, 155 insertions(+), 54 deletions(-) diff --git a/yudao-ui-admin-vue3/src/hooks/web/useCrudSchemas.ts b/yudao-ui-admin-vue3/src/hooks/web/useCrudSchemas.ts index 5043097f1..8ca9097be 100644 --- a/yudao-ui-admin-vue3/src/hooks/web/useCrudSchemas.ts +++ b/yudao-ui-admin-vue3/src/hooks/web/useCrudSchemas.ts @@ -1,6 +1,6 @@ import { reactive } from 'vue' import { eachTree, treeMap, filter } from '@/utils/tree' -import { getIntDictOptions } from '@/utils/dict' +import { getBoolDictOptions, getDictOptions, getIntDictOptions } from '@/utils/dict' import { FormSchema } from '@/types/form' import { TableColumn } from '@/types/table' import { DescriptionsSchema } from '@/types/descriptions' @@ -12,7 +12,8 @@ export type CrudSchema = Omit & { form?: CrudFormParams detail?: CrudDescriptionsParams children?: CrudSchema[] - dictType?: string + dictType?: string // 字典类型 + dictData?: 'string' | 'number' | 'boolean' // 字典数据类型 string | number | boolean } type CrudSearchParams = { @@ -86,7 +87,7 @@ const filterSearchSchema = (crudSchema: CrudSchema[]): FormSchema[] => { if (schemaItem.dictType) { const allOptions: ComponentOptions = { label: '全部', value: '' } options.push(allOptions) - getIntDictOptions(schemaItem.dictType).forEach((dict) => { + getDictOptions(schemaItem.dictType).forEach((dict) => { options.push(dict) }) comonentProps = { @@ -144,9 +145,19 @@ const filterFormSchema = (crudSchema: CrudSchema[]): FormSchema[] => { const options: ComponentOptions[] = [] let comonentProps = {} if (schemaItem.dictType) { - getIntDictOptions(schemaItem.dictType).forEach((dict) => { - options.push(dict) - }) + if (schemaItem.dictData && schemaItem.dictData === 'number') { + getIntDictOptions(schemaItem.dictType).forEach((dict) => { + options.push(dict) + }) + } else if (schemaItem.dictData && schemaItem.dictData === 'boolean') { + getBoolDictOptions(schemaItem.dictType).forEach((dict) => { + options.push(dict) + }) + } else { + getDictOptions(schemaItem.dictType).forEach((dict) => { + options.push(dict) + }) + } comonentProps = { options: options } diff --git a/yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts b/yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts index 00ef5094e..4288e3464 100644 --- a/yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts +++ b/yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts @@ -1,5 +1,5 @@ import { DescriptionsSchema } from '@/types/descriptions' -import { getIntDictOptions } from '@/utils/dict' +import { getBoolDictOptions, getDictOptions, getIntDictOptions } from '@/utils/dict' import { reactive } from 'vue' import { FormItemRenderOptions, @@ -38,6 +38,7 @@ type VxeCrudColumns = Omit & { print?: CrudPrintParams // vxe 打印的字段 children?: VxeCrudColumns[] // 子级 dictType?: string // 字典类型 + dictData?: 'string' | 'number' | 'boolean' // 字典数据类型 string | number | boolean } type CrudSearchParams = { @@ -124,7 +125,7 @@ const filterSearchSchema = (crudSchema: VxeCrudSchema): VxeFormItemProps[] => { if (schemaItem.dictType) { const allOptions = { label: '全部', value: '' } options.push(allOptions) - getIntDictOptions(schemaItem.dictType).forEach((dict) => { + getDictOptions(schemaItem.dictType).forEach((dict) => { options.push(dict) }) itemRender.options = options @@ -229,9 +230,19 @@ const filterFormSchema = (crudSchema: VxeCrudSchema): FormSchema[] => { const options: ComponentOptions[] = [] let comonentProps = {} if (schemaItem.dictType) { - getIntDictOptions(schemaItem.dictType).forEach((dict) => { - options.push(dict) - }) + if (schemaItem.dictData && schemaItem.dictData === 'number') { + getIntDictOptions(schemaItem.dictType).forEach((dict) => { + options.push(dict) + }) + } else if (schemaItem.dictData && schemaItem.dictData === 'boolean') { + getBoolDictOptions(schemaItem.dictType).forEach((dict) => { + options.push(dict) + }) + } else { + getDictOptions(schemaItem.dictType).forEach((dict) => { + options.push(dict) + }) + } comonentProps = { options: options } diff --git a/yudao-ui-admin-vue3/src/router/index.ts b/yudao-ui-admin-vue3/src/router/index.ts index 2dc045062..c207e4da3 100644 --- a/yudao-ui-admin-vue3/src/router/index.ts +++ b/yudao-ui-admin-vue3/src/router/index.ts @@ -12,6 +12,9 @@ import { useUserStoreWithOut } from '@/store/modules/user' import { listSimpleDictDataApi } from '@/api/system/dict/dict.data' import { isRelogin } from '@/config/axios/service' import { getInfoApi } from '@/api/login' +import { useCache } from '@/hooks/web/useCache' + +const { wsCache } = useCache() const { start, done } = useNProgress() @@ -47,7 +50,8 @@ router.beforeEach(async (to, from, next) => { const dictStore = useDictStoreWithOut() const userStore = useUserStoreWithOut() const permissionStore = usePermissionStoreWithOut() - if (!dictStore.getHasDictData) { + const dictMap = wsCache.get('dictCache') + if (!dictMap) { const res = await listSimpleDictDataApi() dictStore.setDictMap(res) } diff --git a/yudao-ui-admin-vue3/src/store/modules/dict.ts b/yudao-ui-admin-vue3/src/store/modules/dict.ts index 30442982f..309595938 100644 --- a/yudao-ui-admin-vue3/src/store/modules/dict.ts +++ b/yudao-ui-admin-vue3/src/store/modules/dict.ts @@ -1,9 +1,11 @@ import { defineStore } from 'pinia' import { store } from '../index' import { DictDataVO } from '@/api/system/dict/types' +import { useCache } from '@/hooks/web/useCache' +const { wsCache } = useCache('sessionStorage') export interface DictValueType { - value: string + value: any label: string clorType?: string cssClass?: string @@ -13,19 +15,20 @@ export interface DictTypeType { dictValue: DictValueType[] } export interface DictState { - dictMap: Recordable + dictMap: Map } export const useDictStore = defineStore('dict', { state: (): DictState => ({ - dictMap: {} + dictMap: new Map() }), getters: { getDictMap(): Recordable { - return this.dictMap + const dictMap = wsCache.get('dictCache') + return dictMap ? dictMap : this.dictMap }, getHasDictData(): boolean { - if (this.dictMap.length > 0) { + if (this.dictMap.size > 0) { return true } else { return false @@ -35,7 +38,7 @@ export const useDictStore = defineStore('dict', { actions: { setDictMap(dictMap: Recordable) { // 设置数据 - const dictDataMap = {} + const dictDataMap = new Map() dictMap.forEach((dictData: DictDataVO) => { // 获得 dictType 层级 const enumValueObj = dictDataMap[dictData.dictType] @@ -50,7 +53,8 @@ export const useDictStore = defineStore('dict', { cssClass: dictData.cssClass }) }) - this.dictMap = dictMap + this.dictMap = dictDataMap + wsCache.set('dictCache', dictDataMap, { exp: 60 }) // 60 秒 过期 } } }) diff --git a/yudao-ui-admin-vue3/src/utils/dict.ts b/yudao-ui-admin-vue3/src/utils/dict.ts index c601693ee..4d1142370 100644 --- a/yudao-ui-admin-vue3/src/utils/dict.ts +++ b/yudao-ui-admin-vue3/src/utils/dict.ts @@ -15,36 +15,53 @@ const dictStore = useDictStoreWithOut() export interface DictDataType { dictType: string label: string - value: string | number + value: string | number | boolean colorType: ElementPlusInfoType | '' | 'default' | 'primary' cssClass: string } export const getDictOptions = (dictType: string) => { - const dictOptions: DictDataType[] = [] - dictStore.getDictMap.forEach((dict: DictDataType) => { - if (dict.dictType + '' === dictType) { - dictOptions.push(dict) - } - }) - return dictOptions + return dictStore.getDictMap[dictType] } -// TODO @芋艿:暂时提供这个方法,主要考虑 ElSelect。下拉如果可以解,就可以不用这个方法 export const getIntDictOptions = (dictType: string) => { - const dictOptions: DictDataType[] = [] - dictStore.getDictMap.forEach((dict: DictDataType) => { - if (dict.dictType.toString() === dictType) { - dictOptions.push({ - ...dict, - value: parseInt(dict.value + '') - }) - } + const dictOption: DictDataType[] = [] + const dictOptions: DictDataType[] = getDictOptions(dictType) + dictOptions.forEach((dict: DictDataType) => { + dictOption.push({ + ...dict, + value: parseInt(dict.value + '') + }) }) - return dictOptions + + return dictOption } -export const getDictObj = (dictType: string, value: string | number | boolean) => { +export const getStrDictOptions = (dictType: string) => { + const dictOption: DictDataType[] = [] + const dictOptions: DictDataType[] = getDictOptions(dictType) + dictOptions.forEach((dict: DictDataType) => { + dictOption.push({ + ...dict, + value: dict.value + '' + }) + }) + return dictOption +} + +export const getBoolDictOptions = (dictType: string) => { + const dictOption: DictDataType[] = [] + const dictOptions: DictDataType[] = getDictOptions(dictType) + dictOptions.forEach((dict: DictDataType) => { + dictOption.push({ + ...dict, + value: dict.value + '' === 'true' ? true : false + }) + }) + return dictOption +} + +export const getDictObj = (dictType: string, value: any) => { const dictOptions: DictDataType[] = getDictOptions(dictType) dictOptions.forEach((dict: DictDataType) => { if (dict.value === value.toString()) { diff --git a/yudao-ui-admin-vue3/src/views/bpm/form/form.data.ts b/yudao-ui-admin-vue3/src/views/bpm/form/form.data.ts index 32de7da57..3b5eddd45 100644 --- a/yudao-ui-admin-vue3/src/views/bpm/form/form.data.ts +++ b/yudao-ui-admin-vue3/src/views/bpm/form/form.data.ts @@ -33,7 +33,8 @@ const crudSchemas = reactive([ { label: t('common.status'), field: 'status', - dictType: DICT_TYPE.COMMON_STATUS + dictType: DICT_TYPE.COMMON_STATUS, + dictData: 'number' }, { label: '备注', diff --git a/yudao-ui-admin-vue3/src/views/bpm/group/group.data.ts b/yudao-ui-admin-vue3/src/views/bpm/group/group.data.ts index 78b3270e8..76dd7d9d5 100644 --- a/yudao-ui-admin-vue3/src/views/bpm/group/group.data.ts +++ b/yudao-ui-admin-vue3/src/views/bpm/group/group.data.ts @@ -41,7 +41,8 @@ const crudSchemas = reactive([ { label: t('common.status'), field: 'status', - dictType: DICT_TYPE.COMMON_STATUS + dictType: DICT_TYPE.COMMON_STATUS, + dictData: 'number' }, { label: '备注', diff --git a/yudao-ui-admin-vue3/src/views/bpm/model/model.data.ts b/yudao-ui-admin-vue3/src/views/bpm/model/model.data.ts index a1ffaadfc..842ea092f 100644 --- a/yudao-ui-admin-vue3/src/views/bpm/model/model.data.ts +++ b/yudao-ui-admin-vue3/src/views/bpm/model/model.data.ts @@ -41,6 +41,7 @@ const crudSchemas = reactive([ label: '流程分类', field: 'category', dictType: DICT_TYPE.BPM_MODEL_CATEGORY, + dictData: 'number', search: { show: true } diff --git a/yudao-ui-admin-vue3/src/views/bpm/processInstance/process.data.ts b/yudao-ui-admin-vue3/src/views/bpm/processInstance/process.data.ts index dff3dc076..d979dc6e8 100644 --- a/yudao-ui-admin-vue3/src/views/bpm/processInstance/process.data.ts +++ b/yudao-ui-admin-vue3/src/views/bpm/processInstance/process.data.ts @@ -28,6 +28,7 @@ const crudSchemas = reactive([ label: '流程分类', field: 'category', dictType: DICT_TYPE.BPM_MODEL_CATEGORY, + dictData: 'number', search: { show: true } @@ -40,6 +41,7 @@ const crudSchemas = reactive([ label: t('common.status'), field: 'status', dictType: DICT_TYPE.BPM_PROCESS_INSTANCE_STATUS, + dictData: 'number', search: { show: true } @@ -48,6 +50,7 @@ const crudSchemas = reactive([ label: '结果', field: 'result', dictType: DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT, + dictData: 'number', search: { show: true } diff --git a/yudao-ui-admin-vue3/src/views/bpm/task/done/done.data.ts b/yudao-ui-admin-vue3/src/views/bpm/task/done/done.data.ts index 773395ff4..3bcb5f2c5 100644 --- a/yudao-ui-admin-vue3/src/views/bpm/task/done/done.data.ts +++ b/yudao-ui-admin-vue3/src/views/bpm/task/done/done.data.ts @@ -29,7 +29,8 @@ const crudSchemas = reactive([ { label: '结果', field: 'result', - dictType: DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT + dictType: DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT, + dictData: 'number' }, { label: '审批意见', diff --git a/yudao-ui-admin-vue3/src/views/infra/apiAccessLog/apiAccessLog.data.ts b/yudao-ui-admin-vue3/src/views/infra/apiAccessLog/apiAccessLog.data.ts index 69423dd9d..832cdfd6a 100644 --- a/yudao-ui-admin-vue3/src/views/infra/apiAccessLog/apiAccessLog.data.ts +++ b/yudao-ui-admin-vue3/src/views/infra/apiAccessLog/apiAccessLog.data.ts @@ -26,6 +26,7 @@ const crudSchemas = reactive([ label: '用户类型', field: 'userType', dictType: DICT_TYPE.USER_TYPE, + dictData: 'number', search: { show: true } diff --git a/yudao-ui-admin-vue3/src/views/infra/apiErrorLog/apiErrorLog.data.ts b/yudao-ui-admin-vue3/src/views/infra/apiErrorLog/apiErrorLog.data.ts index 404262be5..db41b275d 100644 --- a/yudao-ui-admin-vue3/src/views/infra/apiErrorLog/apiErrorLog.data.ts +++ b/yudao-ui-admin-vue3/src/views/infra/apiErrorLog/apiErrorLog.data.ts @@ -69,6 +69,7 @@ const crudSchemas = reactive([ label: '处理状态', field: 'processStatus', dictType: DICT_TYPE.INFRA_API_ERROR_LOG_PROCESS_STATUS, + dictData: 'number', search: { show: true } diff --git a/yudao-ui-admin-vue3/src/views/infra/config/config.data.ts b/yudao-ui-admin-vue3/src/views/infra/config/config.data.ts index 425918d15..8912a8e75 100644 --- a/yudao-ui-admin-vue3/src/views/infra/config/config.data.ts +++ b/yudao-ui-admin-vue3/src/views/infra/config/config.data.ts @@ -52,6 +52,7 @@ const crudSchemas = reactive([ label: '系统内置', field: 'type', dictType: DICT_TYPE.INFRA_CONFIG_TYPE, + dictData: 'number', search: { show: true } diff --git a/yudao-ui-admin-vue3/src/views/infra/fileConfig/fileConfig.data.ts b/yudao-ui-admin-vue3/src/views/infra/fileConfig/fileConfig.data.ts index b2383346f..2aa9b3be5 100644 --- a/yudao-ui-admin-vue3/src/views/infra/fileConfig/fileConfig.data.ts +++ b/yudao-ui-admin-vue3/src/views/infra/fileConfig/fileConfig.data.ts @@ -48,6 +48,7 @@ const crudSchemas = reactive([ label: '存储器', field: 'storage', dictType: DICT_TYPE.INFRA_FILE_STORAGE, + dictData: 'number', search: { show: true } @@ -55,7 +56,8 @@ const crudSchemas = reactive([ { label: '主配置', field: 'primary', - dictType: DICT_TYPE.INFRA_BOOLEAN_STRING + dictType: DICT_TYPE.INFRA_BOOLEAN_STRING, + dictData: 'number' }, { label: t('form.remark'), diff --git a/yudao-ui-admin-vue3/src/views/infra/job/job.data.ts b/yudao-ui-admin-vue3/src/views/infra/job/job.data.ts index 50bba5cd9..9cac9b055 100644 --- a/yudao-ui-admin-vue3/src/views/infra/job/job.data.ts +++ b/yudao-ui-admin-vue3/src/views/infra/job/job.data.ts @@ -37,6 +37,7 @@ const crudSchemas = reactive([ label: t('common.status'), field: 'status', dictType: DICT_TYPE.INFRA_JOB_STATUS, + dictData: 'number', form: { show: false }, diff --git a/yudao-ui-admin-vue3/src/views/infra/job/jobLog.data.ts b/yudao-ui-admin-vue3/src/views/infra/job/jobLog.data.ts index f05100832..8998cec26 100644 --- a/yudao-ui-admin-vue3/src/views/infra/job/jobLog.data.ts +++ b/yudao-ui-admin-vue3/src/views/infra/job/jobLog.data.ts @@ -74,6 +74,7 @@ const crudSchemas = reactive([ label: t('common.status'), field: 'status', dictType: DICT_TYPE.INFRA_JOB_LOG_STATUS, + dictData: 'number', search: { show: true } diff --git a/yudao-ui-admin-vue3/src/views/pay/app/app.data.ts b/yudao-ui-admin-vue3/src/views/pay/app/app.data.ts index 544428cba..ac3b0a579 100644 --- a/yudao-ui-admin-vue3/src/views/pay/app/app.data.ts +++ b/yudao-ui-admin-vue3/src/views/pay/app/app.data.ts @@ -45,6 +45,7 @@ const crudSchemas = reactive([ label: t('common.status'), field: 'status', dictType: DICT_TYPE.COMMON_STATUS, + dictData: 'number', search: { show: true } diff --git a/yudao-ui-admin-vue3/src/views/pay/merchant/merchant.data.ts b/yudao-ui-admin-vue3/src/views/pay/merchant/merchant.data.ts index 53a2dc581..f079f487a 100644 --- a/yudao-ui-admin-vue3/src/views/pay/merchant/merchant.data.ts +++ b/yudao-ui-admin-vue3/src/views/pay/merchant/merchant.data.ts @@ -51,6 +51,7 @@ const crudSchemas = reactive([ label: t('common.status'), field: 'status', dictType: DICT_TYPE.COMMON_STATUS, + dictData: 'number', search: { show: true } diff --git a/yudao-ui-admin-vue3/src/views/pay/order/order.data.ts b/yudao-ui-admin-vue3/src/views/pay/order/order.data.ts index 8cdf1c9b0..f4c4fbeaa 100644 --- a/yudao-ui-admin-vue3/src/views/pay/order/order.data.ts +++ b/yudao-ui-admin-vue3/src/views/pay/order/order.data.ts @@ -82,7 +82,8 @@ const crudSchemas = reactive([ { label: '回调商户状态', field: 'notifyStatus', - dictType: DICT_TYPE.PAY_ORDER_NOTIFY_STATUS + dictType: DICT_TYPE.PAY_ORDER_NOTIFY_STATUS, + dictData: 'number' }, { label: '支付金额', @@ -109,6 +110,7 @@ const crudSchemas = reactive([ label: '支付状态', field: 'status', dictType: DICT_TYPE.PAY_ORDER_STATUS, + dictData: 'number', search: { show: true } @@ -137,6 +139,7 @@ const crudSchemas = reactive([ label: '退款状态', field: 'refundStatus', dictType: DICT_TYPE.PAY_ORDER_REFUND_STATUS, + dictData: 'number', search: { show: true } diff --git a/yudao-ui-admin-vue3/src/views/pay/refund/refund.data.ts b/yudao-ui-admin-vue3/src/views/pay/refund/refund.data.ts index 6d1fef177..42981e95d 100644 --- a/yudao-ui-admin-vue3/src/views/pay/refund/refund.data.ts +++ b/yudao-ui-admin-vue3/src/views/pay/refund/refund.data.ts @@ -67,6 +67,7 @@ const crudSchemas = reactive([ label: '退款类型', field: 'type', dictType: DICT_TYPE.PAY_REFUND_ORDER_TYPE, + dictData: 'number', search: { show: true } @@ -75,6 +76,7 @@ const crudSchemas = reactive([ label: t('common.status'), field: 'status', dictType: DICT_TYPE.PAY_REFUND_ORDER_STATUS, + dictData: 'number', search: { show: true } diff --git a/yudao-ui-admin-vue3/src/views/system/dict/dict.data.ts b/yudao-ui-admin-vue3/src/views/system/dict/dict.data.ts index 6c869dbd8..cceb991d5 100644 --- a/yudao-ui-admin-vue3/src/views/system/dict/dict.data.ts +++ b/yudao-ui-admin-vue3/src/views/system/dict/dict.data.ts @@ -96,7 +96,8 @@ export const crudSchemas = reactive([ { label: t('common.status'), field: 'status', - dictType: DICT_TYPE.COMMON_STATUS + dictType: DICT_TYPE.COMMON_STATUS, + dictData: 'number' }, { label: t('form.remark'), diff --git a/yudao-ui-admin-vue3/src/views/system/dict/dict.type.ts b/yudao-ui-admin-vue3/src/views/system/dict/dict.type.ts index 2328ddd03..bfe6909d3 100644 --- a/yudao-ui-admin-vue3/src/views/system/dict/dict.type.ts +++ b/yudao-ui-admin-vue3/src/views/system/dict/dict.type.ts @@ -40,7 +40,8 @@ const crudSchemas = reactive([ { label: t('common.status'), field: 'status', - dictType: DICT_TYPE.COMMON_STATUS + dictType: DICT_TYPE.COMMON_STATUS, + dictData: 'number' }, { label: t('common.createTime'), diff --git a/yudao-ui-admin-vue3/src/views/system/errorCode/errorCode.data.ts b/yudao-ui-admin-vue3/src/views/system/errorCode/errorCode.data.ts index e7f7af2a5..918fa8353 100644 --- a/yudao-ui-admin-vue3/src/views/system/errorCode/errorCode.data.ts +++ b/yudao-ui-admin-vue3/src/views/system/errorCode/errorCode.data.ts @@ -22,6 +22,7 @@ const crudSchemas = reactive({ title: '错误码类型', field: 'type', dictType: DICT_TYPE.SYSTEM_ERROR_CODE_TYPE, + dictData: 'number', isSearch: true }, { diff --git a/yudao-ui-admin-vue3/src/views/system/loginlog/loginLog.data.ts b/yudao-ui-admin-vue3/src/views/system/loginlog/loginLog.data.ts index 8fa7af3dd..b6bfd3101 100644 --- a/yudao-ui-admin-vue3/src/views/system/loginlog/loginLog.data.ts +++ b/yudao-ui-admin-vue3/src/views/system/loginlog/loginLog.data.ts @@ -12,7 +12,8 @@ const crudSchemas = reactive({ { title: '日志类型', field: 'logType', - dictType: DICT_TYPE.SYSTEM_LOGIN_TYPE + dictType: DICT_TYPE.SYSTEM_LOGIN_TYPE, + dictData: 'number' }, { title: '用户名称', @@ -26,19 +27,26 @@ const crudSchemas = reactive({ }, { title: '浏览器', - field: 'userAgent' // TODO 星语:调宽一点,UA 稍微多展示一点,虽然最终都会缩略 + field: 'userAgent', + table: { + width: 100 + } }, { title: '登陆结果', field: 'result', - dictType: DICT_TYPE.SYSTEM_LOGIN_RESULT + dictType: DICT_TYPE.SYSTEM_LOGIN_RESULT, + dictData: 'number' }, { - title: '登录日期', // TODO 星语:有点窄,看看咋调宽一点,避免日期展示不全 + title: '登录日期', field: 'createTime', formatter: 'formatDate', - isSearch: true, + table: { + width: 100 + }, search: { + show: true, itemRender: { name: 'XDataTimePicker' } diff --git a/yudao-ui-admin-vue3/src/views/system/notice/notice.data.ts b/yudao-ui-admin-vue3/src/views/system/notice/notice.data.ts index 9023e4403..bbf7b53ae 100644 --- a/yudao-ui-admin-vue3/src/views/system/notice/notice.data.ts +++ b/yudao-ui-admin-vue3/src/views/system/notice/notice.data.ts @@ -25,12 +25,14 @@ const crudSchemas = reactive({ { title: '公告类型', field: 'type', - dictType: DICT_TYPE.SYSTEM_NOTICE_TYPE + dictType: DICT_TYPE.SYSTEM_NOTICE_TYPE, + dictData: 'number' }, { title: t('common.status'), field: 'status', dictType: DICT_TYPE.COMMON_STATUS, + dictData: 'number', isSearch: true }, { diff --git a/yudao-ui-admin-vue3/src/views/system/oauth2/client/client.data.ts b/yudao-ui-admin-vue3/src/views/system/oauth2/client/client.data.ts index 6d81a3d0e..73f02b63b 100644 --- a/yudao-ui-admin-vue3/src/views/system/oauth2/client/client.data.ts +++ b/yudao-ui-admin-vue3/src/views/system/oauth2/client/client.data.ts @@ -45,6 +45,7 @@ const crudSchemas = reactive({ title: t('common.status'), field: 'status', dictType: DICT_TYPE.COMMON_STATUS, + dictData: 'number', isSearch: true }, { diff --git a/yudao-ui-admin-vue3/src/views/system/oauth2/token/token.data.ts b/yudao-ui-admin-vue3/src/views/system/oauth2/token/token.data.ts index a88526f44..e5e108382 100644 --- a/yudao-ui-admin-vue3/src/views/system/oauth2/token/token.data.ts +++ b/yudao-ui-admin-vue3/src/views/system/oauth2/token/token.data.ts @@ -26,6 +26,7 @@ const crudSchemas = reactive({ title: '用户类型', field: 'userType', dictType: DICT_TYPE.USER_TYPE, + dictData: 'number', isSearch: true }, { diff --git a/yudao-ui-admin-vue3/src/views/system/operatelog/operatelog.data.ts b/yudao-ui-admin-vue3/src/views/system/operatelog/operatelog.data.ts index 3aeccf921..a2424228f 100644 --- a/yudao-ui-admin-vue3/src/views/system/operatelog/operatelog.data.ts +++ b/yudao-ui-admin-vue3/src/views/system/operatelog/operatelog.data.ts @@ -21,6 +21,7 @@ const crudSchemas = reactive({ title: '操作类型', field: 'type', dictType: DICT_TYPE.SYSTEM_OPERATE_TYPE, + dictData: 'number', isSearch: true }, { diff --git a/yudao-ui-admin-vue3/src/views/system/post/post.data.ts b/yudao-ui-admin-vue3/src/views/system/post/post.data.ts index c22828be2..438ca69aa 100644 --- a/yudao-ui-admin-vue3/src/views/system/post/post.data.ts +++ b/yudao-ui-admin-vue3/src/views/system/post/post.data.ts @@ -36,6 +36,7 @@ const crudSchemas = reactive({ title: t('common.status'), field: 'status', dictType: DICT_TYPE.COMMON_STATUS, + dictData: 'number', isSearch: true }, { diff --git a/yudao-ui-admin-vue3/src/views/system/role/role.data.ts b/yudao-ui-admin-vue3/src/views/system/role/role.data.ts index 4338e4295..535096470 100644 --- a/yudao-ui-admin-vue3/src/views/system/role/role.data.ts +++ b/yudao-ui-admin-vue3/src/views/system/role/role.data.ts @@ -26,7 +26,8 @@ const crudSchemas = reactive({ { title: '角色类型', field: 'type', - dictType: DICT_TYPE.SYSTEM_ROLE_TYPE + dictType: DICT_TYPE.SYSTEM_ROLE_TYPE, + dictData: 'number' }, { title: '角色标识', @@ -41,6 +42,7 @@ const crudSchemas = reactive({ title: t('common.status'), field: 'status', dictType: DICT_TYPE.COMMON_STATUS, + dictData: 'number', isSearch: true }, { diff --git a/yudao-ui-admin-vue3/src/views/system/sensitiveWord/index.vue b/yudao-ui-admin-vue3/src/views/system/sensitiveWord/index.vue index f76c6ce46..39e605c6b 100644 --- a/yudao-ui-admin-vue3/src/views/system/sensitiveWord/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/sensitiveWord/index.vue @@ -154,6 +154,7 @@ const setDialogTile = (type: string) => { // 新增操作 const handleCreate = () => { + tags.value = null setDialogTile('create') } @@ -162,6 +163,7 @@ const handleUpdate = async (rowId: number) => { setDialogTile('update') // 设置数据 const res = await SensitiveWordApi.getSensitiveWordApi(rowId) + tags.value = res.tags unref(formRef)?.setValues(res) } @@ -175,6 +177,7 @@ const submitForm = async () => { // 提交请求 try { const data = unref(formRef)?.formModel as SensitiveWordVO + data.tags = tags.value if (actionType.value === 'create') { await SensitiveWordApi.createSensitiveWordApi(data) ElMessage.success(t('common.createSuccess')) diff --git a/yudao-ui-admin-vue3/src/views/system/sensitiveWord/sensitiveWord.data.ts b/yudao-ui-admin-vue3/src/views/system/sensitiveWord/sensitiveWord.data.ts index 8aa1b71c0..a5dde8174 100644 --- a/yudao-ui-admin-vue3/src/views/system/sensitiveWord/sensitiveWord.data.ts +++ b/yudao-ui-admin-vue3/src/views/system/sensitiveWord/sensitiveWord.data.ts @@ -39,6 +39,7 @@ const crudSchemas = reactive([ label: t('common.status'), field: 'status', dictType: DICT_TYPE.COMMON_STATUS, + dictData: 'number', search: { show: true } diff --git a/yudao-ui-admin-vue3/src/views/system/sms/smsChannel/sms.channel.data.ts b/yudao-ui-admin-vue3/src/views/system/sms/smsChannel/sms.channel.data.ts index dee195a6a..72f83568b 100644 --- a/yudao-ui-admin-vue3/src/views/system/sms/smsChannel/sms.channel.data.ts +++ b/yudao-ui-admin-vue3/src/views/system/sms/smsChannel/sms.channel.data.ts @@ -34,6 +34,7 @@ const crudSchemas = reactive({ title: t('common.status'), field: 'status', dictType: DICT_TYPE.COMMON_STATUS, + dictData: 'number', isSearch: true }, { diff --git a/yudao-ui-admin-vue3/src/views/system/sms/smsLog/sms.log.data.ts b/yudao-ui-admin-vue3/src/views/system/sms/smsLog/sms.log.data.ts index c6bd48526..585ae5eff 100644 --- a/yudao-ui-admin-vue3/src/views/system/sms/smsLog/sms.log.data.ts +++ b/yudao-ui-admin-vue3/src/views/system/sms/smsLog/sms.log.data.ts @@ -23,18 +23,21 @@ const crudSchemas = reactive({ title: '短信渠道', field: 'channelId', dictType: DICT_TYPE.SYSTEM_SMS_CHANNEL_CODE, + dictData: 'number', isSearch: true }, { title: '发送状态', field: 'sendStatus', dictType: DICT_TYPE.SYSTEM_SMS_SEND_STATUS, + dictData: 'number', isSearch: true }, { title: '接收状态', field: 'receiveStatus', dictType: DICT_TYPE.SYSTEM_SMS_RECEIVE_STATUS, + dictData: 'number', isSearch: true }, { @@ -46,6 +49,7 @@ const crudSchemas = reactive({ title: '短信类型', field: 'templateType', dictType: DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE, + dictData: 'number', isSearch: true }, { diff --git a/yudao-ui-admin-vue3/src/views/system/sms/smsTemplate/index.vue b/yudao-ui-admin-vue3/src/views/system/sms/smsTemplate/index.vue index 47641e5a4..5cc4ba07f 100644 --- a/yudao-ui-admin-vue3/src/views/system/sms/smsTemplate/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/sms/smsTemplate/index.vue @@ -156,18 +156,18 @@ const handleCreate = () => { // 修改操作 const handleUpdate = async (rowId: number) => { + setDialogTile('update') // 设置数据 const res = await SmsTemplateApi.getSmsTemplateApi(rowId) unref(formRef)?.setValues(res) - setDialogTile('update') } // 详情操作 const handleDetail = async (rowId: number) => { + setDialogTile('detail') // 设置数据 const res = await SmsTemplateApi.getSmsTemplateApi(rowId) detailData.value = res - setDialogTile('detail') } // 删除操作 diff --git a/yudao-ui-admin-vue3/src/views/system/sms/smsTemplate/sms.template.data.ts b/yudao-ui-admin-vue3/src/views/system/sms/smsTemplate/sms.template.data.ts index cf3075e38..39dc35760 100644 --- a/yudao-ui-admin-vue3/src/views/system/sms/smsTemplate/sms.template.data.ts +++ b/yudao-ui-admin-vue3/src/views/system/sms/smsTemplate/sms.template.data.ts @@ -46,6 +46,7 @@ const crudSchemas = reactive({ title: '短信类型', field: 'type', dictType: DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE, + dictData: 'number', table: { width: 80 } @@ -54,6 +55,7 @@ const crudSchemas = reactive({ title: t('common.status'), field: 'status', dictType: DICT_TYPE.COMMON_STATUS, + dictData: 'number', table: { width: 80 } diff --git a/yudao-ui-admin-vue3/src/views/system/tenant/tenant.data.ts b/yudao-ui-admin-vue3/src/views/system/tenant/tenant.data.ts index 64eb63d0c..19a2e530c 100644 --- a/yudao-ui-admin-vue3/src/views/system/tenant/tenant.data.ts +++ b/yudao-ui-admin-vue3/src/views/system/tenant/tenant.data.ts @@ -106,6 +106,7 @@ const crudSchemas = reactive([ label: '租户状态', field: 'status', dictType: DICT_TYPE.COMMON_STATUS, + dictData: 'number', search: { show: true } diff --git a/yudao-ui-admin-vue3/src/views/system/tenantPackage/tenantPackage.data.ts b/yudao-ui-admin-vue3/src/views/system/tenantPackage/tenantPackage.data.ts index 5591e4f44..eaaabd3e9 100644 --- a/yudao-ui-admin-vue3/src/views/system/tenantPackage/tenantPackage.data.ts +++ b/yudao-ui-admin-vue3/src/views/system/tenantPackage/tenantPackage.data.ts @@ -39,6 +39,7 @@ const crudSchemas = reactive([ label: t('common.status'), field: 'status', dictType: DICT_TYPE.COMMON_STATUS, + dictData: 'number', search: { show: true } diff --git a/yudao-ui-admin-vue3/src/views/system/user/user.data.ts b/yudao-ui-admin-vue3/src/views/system/user/user.data.ts index 6cc2e7b85..f90c929a9 100644 --- a/yudao-ui-admin-vue3/src/views/system/user/user.data.ts +++ b/yudao-ui-admin-vue3/src/views/system/user/user.data.ts @@ -71,6 +71,7 @@ const crudSchemas = reactive({ title: t('common.status'), field: 'status', dictType: DICT_TYPE.COMMON_STATUS, + dictData: 'number', isSearch: true }, {