mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-01 02:38:43 +08:00 
			
		
		
		
	1. 将 BasePage 重命名为 PageParam
2. 增加代码注释 3. 调整 menu 重置表单的逻辑,避免写 2 遍 null 的数据
This commit is contained in:
		| @@ -9,7 +9,7 @@ export interface ErrorCodeVO { | |||||||
|   createTime: string |   createTime: string | ||||||
| } | } | ||||||
|  |  | ||||||
| export interface ErrorCodePageReqVO extends BasePage { | export interface ErrorCodePageReqVO extends PageParam { | ||||||
|   type?: number |   type?: number | ||||||
|   applicationName?: string |   applicationName?: string | ||||||
|   code?: number |   code?: number | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ export interface LoginLogVO { | |||||||
|   createTime: string |   createTime: string | ||||||
| } | } | ||||||
|  |  | ||||||
| export interface LoginLogReqVO extends BasePage { | export interface LoginLogReqVO extends PageParam { | ||||||
|   userIp?: string |   userIp?: string | ||||||
|   username?: string |   username?: string | ||||||
|   status?: boolean |   status?: boolean | ||||||
|   | |||||||
| @@ -20,6 +20,7 @@ export interface MenuPageReqVO { | |||||||
|   name?: string |   name?: string | ||||||
|   status?: number |   status?: number | ||||||
| } | } | ||||||
|  |  | ||||||
| // 查询菜单(精简)列表 | // 查询菜单(精简)列表 | ||||||
| export const listSimpleMenusApi = () => { | export const listSimpleMenusApi = () => { | ||||||
|   return request.get({ url: '/system/menu/list-all-simple' }) |   return request.get({ url: '/system/menu/list-all-simple' }) | ||||||
|   | |||||||
| @@ -12,7 +12,7 @@ export interface NoticeVO { | |||||||
|   updateTime: string |   updateTime: string | ||||||
| } | } | ||||||
|  |  | ||||||
| export interface NoticePageReqVO extends BasePage { | export interface NoticePageReqVO extends PageParam { | ||||||
|   title?: string |   title?: string | ||||||
|   status?: number |   status?: number | ||||||
| } | } | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ export interface OAuth2TokenVO { | |||||||
|   expiresTime: string |   expiresTime: string | ||||||
| } | } | ||||||
|  |  | ||||||
| export interface OAuth2TokenPageReqVO extends BasePage { | export interface OAuth2TokenPageReqVO extends PageParam { | ||||||
|   code?: string |   code?: string | ||||||
|   name?: string |   name?: string | ||||||
|   status?: number |   status?: number | ||||||
|   | |||||||
| @@ -22,7 +22,7 @@ export type OperateLogVO = { | |||||||
|   resultMsg: string |   resultMsg: string | ||||||
|   resultData: string |   resultData: string | ||||||
| } | } | ||||||
| export interface OperateLogPageReqVO extends BasePage { | export interface OperateLogPageReqVO extends PageParam { | ||||||
|   module?: string |   module?: string | ||||||
|   userNickname?: string |   userNickname?: string | ||||||
|   type?: number |   type?: number | ||||||
|   | |||||||
| @@ -10,7 +10,7 @@ export interface PostVO { | |||||||
|   createTime?: string |   createTime?: string | ||||||
| } | } | ||||||
|  |  | ||||||
| export interface PostPageReqVO extends BasePage { | export interface PostPageReqVO extends PageParam { | ||||||
|   code?: string |   code?: string | ||||||
|   name?: string |   name?: string | ||||||
|   status?: number |   status?: number | ||||||
| @@ -31,6 +31,7 @@ export const getPostPageApi = async (params: PostPageReqVO) => { | |||||||
| export const listSimplePostsApi = async () => { | export const listSimplePostsApi = async () => { | ||||||
|   return await request.get({ url: '/system/post/list-all-simple' }) |   return await request.get({ url: '/system/post/list-all-simple' }) | ||||||
| } | } | ||||||
|  |  | ||||||
| // 查询岗位详情 | // 查询岗位详情 | ||||||
| export const getPostApi = async (id: number) => { | export const getPostApi = async (id: number) => { | ||||||
|   return await request.get({ url: '/system/post/get?id=' + id }) |   return await request.get({ url: '/system/post/get?id=' + id }) | ||||||
|   | |||||||
| @@ -277,6 +277,7 @@ import { required } from '@/utils/formRules.js' | |||||||
| import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' | import { DICT_TYPE, getIntDictOptions } from '@/utils/dict' | ||||||
| import { SystemMenuTypeEnum, CommonStatusEnum } from '@/utils/constants' | import { SystemMenuTypeEnum, CommonStatusEnum } from '@/utils/constants' | ||||||
| import { handleTree } from '@/utils/tree' | import { handleTree } from '@/utils/tree' | ||||||
|  | import { deepCopy } from 'windicss/utils' | ||||||
|  |  | ||||||
| const { t } = useI18n() // 国际化 | const { t } = useI18n() // 国际化 | ||||||
| const message = useMessage() // 消息弹窗 | const message = useMessage() // 消息弹窗 | ||||||
| @@ -291,7 +292,7 @@ const actionType = ref('') // 操作按钮的类型 | |||||||
| const actionLoading = ref(false) // 遮罩层 | const actionLoading = ref(false) // 遮罩层 | ||||||
| // 新增和修改的表单值 | // 新增和修改的表单值 | ||||||
| const formRef = ref<FormInstance>() | const formRef = ref<FormInstance>() | ||||||
| const menuForm = ref<MenuApi.MenuVO>({ | const menuFormNull = { | ||||||
|   id: 0, |   id: 0, | ||||||
|   name: '', |   name: '', | ||||||
|   permission: '', |   permission: '', | ||||||
| @@ -305,7 +306,8 @@ const menuForm = ref<MenuApi.MenuVO>({ | |||||||
|   visible: true, |   visible: true, | ||||||
|   keepAlive: true, |   keepAlive: true, | ||||||
|   createTime: '' |   createTime: '' | ||||||
| }) | } | ||||||
|  | const menuForm = ref<MenuApi.MenuVO>(menuFormNull) | ||||||
| // 新增和修改的表单校验 | // 新增和修改的表单校验 | ||||||
| const rules = reactive({ | const rules = reactive({ | ||||||
|   name: [required], |   name: [required], | ||||||
| @@ -323,6 +325,7 @@ const menuProps = { | |||||||
|   value: 'id' |   value: 'id' | ||||||
| } | } | ||||||
| const menuOptions = ref<any[]>([]) // 树形结构 | const menuOptions = ref<any[]>([]) // 树形结构 | ||||||
|  | // 获取下拉框[上级菜单]的数据 | ||||||
| const getTree = async () => { | const getTree = async () => { | ||||||
|   menuOptions.value = [] |   menuOptions.value = [] | ||||||
|   const res = await MenuApi.listSimpleMenusApi() |   const res = await MenuApi.listSimpleMenusApi() | ||||||
| @@ -336,6 +339,7 @@ const queryParams = reactive<MenuApi.MenuPageReqVO>({ | |||||||
|   name: undefined, |   name: undefined, | ||||||
|   status: undefined |   status: undefined | ||||||
| }) | }) | ||||||
|  | // 执行查询 | ||||||
| const getList = async () => { | const getList = async () => { | ||||||
|   tableLoading.value = true |   tableLoading.value = true | ||||||
|   const res = await MenuApi.getMenuListApi(queryParams) |   const res = await MenuApi.getMenuListApi(queryParams) | ||||||
| @@ -368,27 +372,14 @@ const setDialogTile = async (type: string) => { | |||||||
| // 新增操作 | // 新增操作 | ||||||
| const handleCreate = () => { | const handleCreate = () => { | ||||||
|   setDialogTile('create') |   setDialogTile('create') | ||||||
|  |   // 重置表单 | ||||||
|   formRef.value?.resetFields() |   formRef.value?.resetFields() | ||||||
|   menuForm.value = { |   menuForm.value = deepCopy(menuFormNull) | ||||||
|     id: 0, |  | ||||||
|     name: '', |  | ||||||
|     permission: '', |  | ||||||
|     type: SystemMenuTypeEnum.DIR, |  | ||||||
|     sort: 1, |  | ||||||
|     parentId: 0, |  | ||||||
|     path: '', |  | ||||||
|     icon: '', |  | ||||||
|     component: '', |  | ||||||
|     status: CommonStatusEnum.ENABLE, |  | ||||||
|     visible: true, |  | ||||||
|     keepAlive: true, |  | ||||||
|     createTime: '' |  | ||||||
|   } |  | ||||||
| } | } | ||||||
|  |  | ||||||
| // 修改操作 | // 修改操作 | ||||||
| const handleUpdate = async (rowId: number) => { | const handleUpdate = async (rowId: number) => { | ||||||
|   setDialogTile('update') |   await setDialogTile('update') | ||||||
|   // 设置数据 |   // 设置数据 | ||||||
|   const res = await MenuApi.getMenuApi(rowId) |   const res = await MenuApi.getMenuApi(rowId) | ||||||
|   menuForm.value = res |   menuForm.value = res | ||||||
|   | |||||||
							
								
								
									
										3
									
								
								yudao-ui-admin-vue3/types/global.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								yudao-ui-admin-vue3/types/global.d.ts
									
									
									
									
										vendored
									
									
								
							| @@ -37,10 +37,11 @@ declare global { | |||||||
|     data: T extends any ? T : T & any |     data: T extends any ? T : T & any | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   declare interface BasePage { |   declare interface PageParam { | ||||||
|     pageSize?: number |     pageSize?: number | ||||||
|     pageNo?: number |     pageNo?: number | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   declare interface Tree { |   declare interface Tree { | ||||||
|     id: number |     id: number | ||||||
|     name: string |     name: string | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV