1. 将 BasePage 重命名为 PageParam

2. 增加代码注释
3. 调整 menu 重置表单的逻辑,避免写 2 遍 null 的数据
This commit is contained in:
YunaiV 2022-11-13 18:34:23 +08:00
parent 89bd2f6d9e
commit 08c772fede
9 changed files with 19 additions and 25 deletions

View File

@ -9,7 +9,7 @@ export interface ErrorCodeVO {
createTime: string
}
export interface ErrorCodePageReqVO extends BasePage {
export interface ErrorCodePageReqVO extends PageParam {
type?: number
applicationName?: string
code?: number

View File

@ -12,7 +12,7 @@ export interface LoginLogVO {
createTime: string
}
export interface LoginLogReqVO extends BasePage {
export interface LoginLogReqVO extends PageParam {
userIp?: string
username?: string
status?: boolean

View File

@ -20,6 +20,7 @@ export interface MenuPageReqVO {
name?: string
status?: number
}
// 查询菜单(精简)列表
export const listSimpleMenusApi = () => {
return request.get({ url: '/system/menu/list-all-simple' })

View File

@ -12,7 +12,7 @@ export interface NoticeVO {
updateTime: string
}
export interface NoticePageReqVO extends BasePage {
export interface NoticePageReqVO extends PageParam {
title?: string
status?: number
}

View File

@ -11,7 +11,7 @@ export interface OAuth2TokenVO {
expiresTime: string
}
export interface OAuth2TokenPageReqVO extends BasePage {
export interface OAuth2TokenPageReqVO extends PageParam {
code?: string
name?: string
status?: number

View File

@ -22,7 +22,7 @@ export type OperateLogVO = {
resultMsg: string
resultData: string
}
export interface OperateLogPageReqVO extends BasePage {
export interface OperateLogPageReqVO extends PageParam {
module?: string
userNickname?: string
type?: number

View File

@ -10,7 +10,7 @@ export interface PostVO {
createTime?: string
}
export interface PostPageReqVO extends BasePage {
export interface PostPageReqVO extends PageParam {
code?: string
name?: string
status?: number
@ -31,6 +31,7 @@ export const getPostPageApi = async (params: PostPageReqVO) => {
export const listSimplePostsApi = async () => {
return await request.get({ url: '/system/post/list-all-simple' })
}
// 查询岗位详情
export const getPostApi = async (id: number) => {
return await request.get({ url: '/system/post/get?id=' + id })

View File

@ -277,6 +277,7 @@ import { required } from '@/utils/formRules.js'
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
import { SystemMenuTypeEnum, CommonStatusEnum } from '@/utils/constants'
import { handleTree } from '@/utils/tree'
import { deepCopy } from 'windicss/utils'
const { t } = useI18n() //
const message = useMessage() //
@ -291,7 +292,7 @@ const actionType = ref('') // 操作按钮的类型
const actionLoading = ref(false) //
//
const formRef = ref<FormInstance>()
const menuForm = ref<MenuApi.MenuVO>({
const menuFormNull = {
id: 0,
name: '',
permission: '',
@ -305,7 +306,8 @@ const menuForm = ref<MenuApi.MenuVO>({
visible: true,
keepAlive: true,
createTime: ''
})
}
const menuForm = ref<MenuApi.MenuVO>(menuFormNull)
//
const rules = reactive({
name: [required],
@ -323,6 +325,7 @@ const menuProps = {
value: 'id'
}
const menuOptions = ref<any[]>([]) //
// []
const getTree = async () => {
menuOptions.value = []
const res = await MenuApi.listSimpleMenusApi()
@ -336,6 +339,7 @@ const queryParams = reactive<MenuApi.MenuPageReqVO>({
name: undefined,
status: undefined
})
//
const getList = async () => {
tableLoading.value = true
const res = await MenuApi.getMenuListApi(queryParams)
@ -368,27 +372,14 @@ const setDialogTile = async (type: string) => {
//
const handleCreate = () => {
setDialogTile('create')
//
formRef.value?.resetFields()
menuForm.value = {
id: 0,
name: '',
permission: '',
type: SystemMenuTypeEnum.DIR,
sort: 1,
parentId: 0,
path: '',
icon: '',
component: '',
status: CommonStatusEnum.ENABLE,
visible: true,
keepAlive: true,
createTime: ''
}
menuForm.value = deepCopy(menuFormNull)
}
//
const handleUpdate = async (rowId: number) => {
setDialogTile('update')
await setDialogTile('update')
//
const res = await MenuApi.getMenuApi(rowId)
menuForm.value = res

View File

@ -37,10 +37,11 @@ declare global {
data: T extends any ? T : T & any
}
declare interface BasePage {
declare interface PageParam {
pageSize?: number
pageNo?: number
}
declare interface Tree {
id: number
name: string