mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 02:08:43 +08:00 
			
		
		
		
	refactor: dict
This commit is contained in:
		| @@ -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<TableColumn, 'children'> & { | ||||
|   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) { | ||||
|         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 | ||||
|         } | ||||
|   | ||||
| @@ -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<VxeTableColumn, 'children'> & { | ||||
|   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) { | ||||
|         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 | ||||
|         } | ||||
|   | ||||
| @@ -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) | ||||
|       } | ||||
|   | ||||
| @@ -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<string, any> | ||||
| } | ||||
|  | ||||
| export const useDictStore = defineStore('dict', { | ||||
|   state: (): DictState => ({ | ||||
|     dictMap: {} | ||||
|     dictMap: new Map<string, any>() | ||||
|   }), | ||||
|   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<string, any>() | ||||
|       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 秒 过期 | ||||
|     } | ||||
|   } | ||||
| }) | ||||
|   | ||||
| @@ -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({ | ||||
|   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()) { | ||||
|   | ||||
| @@ -33,7 +33,8 @@ const crudSchemas = reactive<CrudSchema[]>([ | ||||
|   { | ||||
|     label: t('common.status'), | ||||
|     field: 'status', | ||||
|     dictType: DICT_TYPE.COMMON_STATUS | ||||
|     dictType: DICT_TYPE.COMMON_STATUS, | ||||
|     dictData: 'number' | ||||
|   }, | ||||
|   { | ||||
|     label: '备注', | ||||
|   | ||||
| @@ -41,7 +41,8 @@ const crudSchemas = reactive<CrudSchema[]>([ | ||||
|   { | ||||
|     label: t('common.status'), | ||||
|     field: 'status', | ||||
|     dictType: DICT_TYPE.COMMON_STATUS | ||||
|     dictType: DICT_TYPE.COMMON_STATUS, | ||||
|     dictData: 'number' | ||||
|   }, | ||||
|   { | ||||
|     label: '备注', | ||||
|   | ||||
| @@ -41,6 +41,7 @@ const crudSchemas = reactive<CrudSchema[]>([ | ||||
|     label: '流程分类', | ||||
|     field: 'category', | ||||
|     dictType: DICT_TYPE.BPM_MODEL_CATEGORY, | ||||
|     dictData: 'number', | ||||
|     search: { | ||||
|       show: true | ||||
|     } | ||||
|   | ||||
| @@ -28,6 +28,7 @@ const crudSchemas = reactive<CrudSchema[]>([ | ||||
|     label: '流程分类', | ||||
|     field: 'category', | ||||
|     dictType: DICT_TYPE.BPM_MODEL_CATEGORY, | ||||
|     dictData: 'number', | ||||
|     search: { | ||||
|       show: true | ||||
|     } | ||||
| @@ -40,6 +41,7 @@ const crudSchemas = reactive<CrudSchema[]>([ | ||||
|     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<CrudSchema[]>([ | ||||
|     label: '结果', | ||||
|     field: 'result', | ||||
|     dictType: DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT, | ||||
|     dictData: 'number', | ||||
|     search: { | ||||
|       show: true | ||||
|     } | ||||
|   | ||||
| @@ -29,7 +29,8 @@ const crudSchemas = reactive<CrudSchema[]>([ | ||||
|   { | ||||
|     label: '结果', | ||||
|     field: 'result', | ||||
|     dictType: DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT | ||||
|     dictType: DICT_TYPE.BPM_PROCESS_INSTANCE_RESULT, | ||||
|     dictData: 'number' | ||||
|   }, | ||||
|   { | ||||
|     label: '审批意见', | ||||
|   | ||||
| @@ -26,6 +26,7 @@ const crudSchemas = reactive<CrudSchema[]>([ | ||||
|     label: '用户类型', | ||||
|     field: 'userType', | ||||
|     dictType: DICT_TYPE.USER_TYPE, | ||||
|     dictData: 'number', | ||||
|     search: { | ||||
|       show: true | ||||
|     } | ||||
|   | ||||
| @@ -69,6 +69,7 @@ const crudSchemas = reactive<CrudSchema[]>([ | ||||
|     label: '处理状态', | ||||
|     field: 'processStatus', | ||||
|     dictType: DICT_TYPE.INFRA_API_ERROR_LOG_PROCESS_STATUS, | ||||
|     dictData: 'number', | ||||
|     search: { | ||||
|       show: true | ||||
|     } | ||||
|   | ||||
| @@ -52,6 +52,7 @@ const crudSchemas = reactive<CrudSchema[]>([ | ||||
|     label: '系统内置', | ||||
|     field: 'type', | ||||
|     dictType: DICT_TYPE.INFRA_CONFIG_TYPE, | ||||
|     dictData: 'number', | ||||
|     search: { | ||||
|       show: true | ||||
|     } | ||||
|   | ||||
| @@ -48,6 +48,7 @@ const crudSchemas = reactive<CrudSchema[]>([ | ||||
|     label: '存储器', | ||||
|     field: 'storage', | ||||
|     dictType: DICT_TYPE.INFRA_FILE_STORAGE, | ||||
|     dictData: 'number', | ||||
|     search: { | ||||
|       show: true | ||||
|     } | ||||
| @@ -55,7 +56,8 @@ const crudSchemas = reactive<CrudSchema[]>([ | ||||
|   { | ||||
|     label: '主配置', | ||||
|     field: 'primary', | ||||
|     dictType: DICT_TYPE.INFRA_BOOLEAN_STRING | ||||
|     dictType: DICT_TYPE.INFRA_BOOLEAN_STRING, | ||||
|     dictData: 'number' | ||||
|   }, | ||||
|   { | ||||
|     label: t('form.remark'), | ||||
|   | ||||
| @@ -37,6 +37,7 @@ const crudSchemas = reactive<CrudSchema[]>([ | ||||
|     label: t('common.status'), | ||||
|     field: 'status', | ||||
|     dictType: DICT_TYPE.INFRA_JOB_STATUS, | ||||
|     dictData: 'number', | ||||
|     form: { | ||||
|       show: false | ||||
|     }, | ||||
|   | ||||
| @@ -74,6 +74,7 @@ const crudSchemas = reactive<CrudSchema[]>([ | ||||
|     label: t('common.status'), | ||||
|     field: 'status', | ||||
|     dictType: DICT_TYPE.INFRA_JOB_LOG_STATUS, | ||||
|     dictData: 'number', | ||||
|     search: { | ||||
|       show: true | ||||
|     } | ||||
|   | ||||
| @@ -45,6 +45,7 @@ const crudSchemas = reactive<CrudSchema[]>([ | ||||
|     label: t('common.status'), | ||||
|     field: 'status', | ||||
|     dictType: DICT_TYPE.COMMON_STATUS, | ||||
|     dictData: 'number', | ||||
|     search: { | ||||
|       show: true | ||||
|     } | ||||
|   | ||||
| @@ -51,6 +51,7 @@ const crudSchemas = reactive<CrudSchema[]>([ | ||||
|     label: t('common.status'), | ||||
|     field: 'status', | ||||
|     dictType: DICT_TYPE.COMMON_STATUS, | ||||
|     dictData: 'number', | ||||
|     search: { | ||||
|       show: true | ||||
|     } | ||||
|   | ||||
| @@ -82,7 +82,8 @@ const crudSchemas = reactive<CrudSchema[]>([ | ||||
|   { | ||||
|     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<CrudSchema[]>([ | ||||
|     label: '支付状态', | ||||
|     field: 'status', | ||||
|     dictType: DICT_TYPE.PAY_ORDER_STATUS, | ||||
|     dictData: 'number', | ||||
|     search: { | ||||
|       show: true | ||||
|     } | ||||
| @@ -137,6 +139,7 @@ const crudSchemas = reactive<CrudSchema[]>([ | ||||
|     label: '退款状态', | ||||
|     field: 'refundStatus', | ||||
|     dictType: DICT_TYPE.PAY_ORDER_REFUND_STATUS, | ||||
|     dictData: 'number', | ||||
|     search: { | ||||
|       show: true | ||||
|     } | ||||
|   | ||||
| @@ -67,6 +67,7 @@ const crudSchemas = reactive<CrudSchema[]>([ | ||||
|     label: '退款类型', | ||||
|     field: 'type', | ||||
|     dictType: DICT_TYPE.PAY_REFUND_ORDER_TYPE, | ||||
|     dictData: 'number', | ||||
|     search: { | ||||
|       show: true | ||||
|     } | ||||
| @@ -75,6 +76,7 @@ const crudSchemas = reactive<CrudSchema[]>([ | ||||
|     label: t('common.status'), | ||||
|     field: 'status', | ||||
|     dictType: DICT_TYPE.PAY_REFUND_ORDER_STATUS, | ||||
|     dictData: 'number', | ||||
|     search: { | ||||
|       show: true | ||||
|     } | ||||
|   | ||||
| @@ -96,7 +96,8 @@ export const crudSchemas = reactive<CrudSchema[]>([ | ||||
|   { | ||||
|     label: t('common.status'), | ||||
|     field: 'status', | ||||
|     dictType: DICT_TYPE.COMMON_STATUS | ||||
|     dictType: DICT_TYPE.COMMON_STATUS, | ||||
|     dictData: 'number' | ||||
|   }, | ||||
|   { | ||||
|     label: t('form.remark'), | ||||
|   | ||||
| @@ -40,7 +40,8 @@ const crudSchemas = reactive<CrudSchema[]>([ | ||||
|   { | ||||
|     label: t('common.status'), | ||||
|     field: 'status', | ||||
|     dictType: DICT_TYPE.COMMON_STATUS | ||||
|     dictType: DICT_TYPE.COMMON_STATUS, | ||||
|     dictData: 'number' | ||||
|   }, | ||||
|   { | ||||
|     label: t('common.createTime'), | ||||
|   | ||||
| @@ -22,6 +22,7 @@ const crudSchemas = reactive<VxeCrudSchema>({ | ||||
|       title: '错误码类型', | ||||
|       field: 'type', | ||||
|       dictType: DICT_TYPE.SYSTEM_ERROR_CODE_TYPE, | ||||
|       dictData: 'number', | ||||
|       isSearch: true | ||||
|     }, | ||||
|     { | ||||
|   | ||||
| @@ -12,7 +12,8 @@ const crudSchemas = reactive<VxeCrudSchema>({ | ||||
|     { | ||||
|       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<VxeCrudSchema>({ | ||||
|     }, | ||||
|     { | ||||
|       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' | ||||
|         } | ||||
|   | ||||
| @@ -25,12 +25,14 @@ const crudSchemas = reactive<VxeCrudSchema>({ | ||||
|     { | ||||
|       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 | ||||
|     }, | ||||
|     { | ||||
|   | ||||
| @@ -45,6 +45,7 @@ const crudSchemas = reactive<VxeCrudSchema>({ | ||||
|       title: t('common.status'), | ||||
|       field: 'status', | ||||
|       dictType: DICT_TYPE.COMMON_STATUS, | ||||
|       dictData: 'number', | ||||
|       isSearch: true | ||||
|     }, | ||||
|     { | ||||
|   | ||||
| @@ -26,6 +26,7 @@ const crudSchemas = reactive<VxeCrudSchema>({ | ||||
|       title: '用户类型', | ||||
|       field: 'userType', | ||||
|       dictType: DICT_TYPE.USER_TYPE, | ||||
|       dictData: 'number', | ||||
|       isSearch: true | ||||
|     }, | ||||
|     { | ||||
|   | ||||
| @@ -21,6 +21,7 @@ const crudSchemas = reactive<VxeCrudSchema>({ | ||||
|       title: '操作类型', | ||||
|       field: 'type', | ||||
|       dictType: DICT_TYPE.SYSTEM_OPERATE_TYPE, | ||||
|       dictData: 'number', | ||||
|       isSearch: true | ||||
|     }, | ||||
|     { | ||||
|   | ||||
| @@ -36,6 +36,7 @@ const crudSchemas = reactive<VxeCrudSchema>({ | ||||
|       title: t('common.status'), | ||||
|       field: 'status', | ||||
|       dictType: DICT_TYPE.COMMON_STATUS, | ||||
|       dictData: 'number', | ||||
|       isSearch: true | ||||
|     }, | ||||
|     { | ||||
|   | ||||
| @@ -26,7 +26,8 @@ const crudSchemas = reactive<VxeCrudSchema>({ | ||||
|     { | ||||
|       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<VxeCrudSchema>({ | ||||
|       title: t('common.status'), | ||||
|       field: 'status', | ||||
|       dictType: DICT_TYPE.COMMON_STATUS, | ||||
|       dictData: 'number', | ||||
|       isSearch: true | ||||
|     }, | ||||
|     { | ||||
|   | ||||
| @@ -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')) | ||||
|   | ||||
| @@ -39,6 +39,7 @@ const crudSchemas = reactive<CrudSchema[]>([ | ||||
|     label: t('common.status'), | ||||
|     field: 'status', | ||||
|     dictType: DICT_TYPE.COMMON_STATUS, | ||||
|     dictData: 'number', | ||||
|     search: { | ||||
|       show: true | ||||
|     } | ||||
|   | ||||
| @@ -34,6 +34,7 @@ const crudSchemas = reactive<VxeCrudSchema>({ | ||||
|       title: t('common.status'), | ||||
|       field: 'status', | ||||
|       dictType: DICT_TYPE.COMMON_STATUS, | ||||
|       dictData: 'number', | ||||
|       isSearch: true | ||||
|     }, | ||||
|     { | ||||
|   | ||||
| @@ -23,18 +23,21 @@ const crudSchemas = reactive<VxeCrudSchema>({ | ||||
|       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<VxeCrudSchema>({ | ||||
|       title: '短信类型', | ||||
|       field: 'templateType', | ||||
|       dictType: DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE, | ||||
|       dictData: 'number', | ||||
|       isSearch: true | ||||
|     }, | ||||
|     { | ||||
|   | ||||
| @@ -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') | ||||
| } | ||||
|  | ||||
| // 删除操作 | ||||
|   | ||||
| @@ -46,6 +46,7 @@ const crudSchemas = reactive<VxeCrudSchema>({ | ||||
|       title: '短信类型', | ||||
|       field: 'type', | ||||
|       dictType: DICT_TYPE.SYSTEM_SMS_TEMPLATE_TYPE, | ||||
|       dictData: 'number', | ||||
|       table: { | ||||
|         width: 80 | ||||
|       } | ||||
| @@ -54,6 +55,7 @@ const crudSchemas = reactive<VxeCrudSchema>({ | ||||
|       title: t('common.status'), | ||||
|       field: 'status', | ||||
|       dictType: DICT_TYPE.COMMON_STATUS, | ||||
|       dictData: 'number', | ||||
|       table: { | ||||
|         width: 80 | ||||
|       } | ||||
|   | ||||
| @@ -106,6 +106,7 @@ const crudSchemas = reactive<CrudSchema[]>([ | ||||
|     label: '租户状态', | ||||
|     field: 'status', | ||||
|     dictType: DICT_TYPE.COMMON_STATUS, | ||||
|     dictData: 'number', | ||||
|     search: { | ||||
|       show: true | ||||
|     } | ||||
|   | ||||
| @@ -39,6 +39,7 @@ const crudSchemas = reactive<CrudSchema[]>([ | ||||
|     label: t('common.status'), | ||||
|     field: 'status', | ||||
|     dictType: DICT_TYPE.COMMON_STATUS, | ||||
|     dictData: 'number', | ||||
|     search: { | ||||
|       show: true | ||||
|     } | ||||
|   | ||||
| @@ -71,6 +71,7 @@ const crudSchemas = reactive<VxeCrudSchema>({ | ||||
|       title: t('common.status'), | ||||
|       field: 'status', | ||||
|       dictType: DICT_TYPE.COMMON_STATUS, | ||||
|       dictData: 'number', | ||||
|       isSearch: true | ||||
|     }, | ||||
|     { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 xingyu
					xingyu