From 08c772fede28b35afbb53e4014fcc53f6606d31e Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 13 Nov 2022 18:34:23 +0800 Subject: [PATCH] =?UTF-8?q?1.=20=E5=B0=86=20BasePage=20=E9=87=8D=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E4=B8=BA=20PageParam=202.=20=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=B3=A8=E9=87=8A=203.=20=E8=B0=83=E6=95=B4?= =?UTF-8?q?=20menu=20=E9=87=8D=E7=BD=AE=E8=A1=A8=E5=8D=95=E7=9A=84?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E9=81=BF=E5=85=8D=E5=86=99=202=20?= =?UTF-8?q?=E9=81=8D=20null=20=E7=9A=84=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/api/system/errorCode/index.ts | 2 +- .../src/api/system/loginLog/index.ts | 2 +- .../src/api/system/menu/index.ts | 1 + .../src/api/system/notice/index.ts | 2 +- .../src/api/system/oauth2/token.ts | 2 +- .../src/api/system/operatelog/index.ts | 2 +- .../src/api/system/post/index.ts | 3 ++- .../src/views/system/menu/index.vue | 27 +++++++------------ yudao-ui-admin-vue3/types/global.d.ts | 3 ++- 9 files changed, 19 insertions(+), 25 deletions(-) diff --git a/yudao-ui-admin-vue3/src/api/system/errorCode/index.ts b/yudao-ui-admin-vue3/src/api/system/errorCode/index.ts index f75dd3c23..c97194ed7 100644 --- a/yudao-ui-admin-vue3/src/api/system/errorCode/index.ts +++ b/yudao-ui-admin-vue3/src/api/system/errorCode/index.ts @@ -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 diff --git a/yudao-ui-admin-vue3/src/api/system/loginLog/index.ts b/yudao-ui-admin-vue3/src/api/system/loginLog/index.ts index 621144c16..5e4e5d4f5 100644 --- a/yudao-ui-admin-vue3/src/api/system/loginLog/index.ts +++ b/yudao-ui-admin-vue3/src/api/system/loginLog/index.ts @@ -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 diff --git a/yudao-ui-admin-vue3/src/api/system/menu/index.ts b/yudao-ui-admin-vue3/src/api/system/menu/index.ts index b4442b81e..c5a2c287a 100644 --- a/yudao-ui-admin-vue3/src/api/system/menu/index.ts +++ b/yudao-ui-admin-vue3/src/api/system/menu/index.ts @@ -20,6 +20,7 @@ export interface MenuPageReqVO { name?: string status?: number } + // 查询菜单(精简)列表 export const listSimpleMenusApi = () => { return request.get({ url: '/system/menu/list-all-simple' }) diff --git a/yudao-ui-admin-vue3/src/api/system/notice/index.ts b/yudao-ui-admin-vue3/src/api/system/notice/index.ts index c344603e9..221a91705 100644 --- a/yudao-ui-admin-vue3/src/api/system/notice/index.ts +++ b/yudao-ui-admin-vue3/src/api/system/notice/index.ts @@ -12,7 +12,7 @@ export interface NoticeVO { updateTime: string } -export interface NoticePageReqVO extends BasePage { +export interface NoticePageReqVO extends PageParam { title?: string status?: number } diff --git a/yudao-ui-admin-vue3/src/api/system/oauth2/token.ts b/yudao-ui-admin-vue3/src/api/system/oauth2/token.ts index 2a984f2e2..9d00fbed2 100644 --- a/yudao-ui-admin-vue3/src/api/system/oauth2/token.ts +++ b/yudao-ui-admin-vue3/src/api/system/oauth2/token.ts @@ -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 diff --git a/yudao-ui-admin-vue3/src/api/system/operatelog/index.ts b/yudao-ui-admin-vue3/src/api/system/operatelog/index.ts index 313fcd8d1..994fe09c3 100644 --- a/yudao-ui-admin-vue3/src/api/system/operatelog/index.ts +++ b/yudao-ui-admin-vue3/src/api/system/operatelog/index.ts @@ -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 diff --git a/yudao-ui-admin-vue3/src/api/system/post/index.ts b/yudao-ui-admin-vue3/src/api/system/post/index.ts index 5f2557cab..02f5bd034 100644 --- a/yudao-ui-admin-vue3/src/api/system/post/index.ts +++ b/yudao-ui-admin-vue3/src/api/system/post/index.ts @@ -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 }) diff --git a/yudao-ui-admin-vue3/src/views/system/menu/index.vue b/yudao-ui-admin-vue3/src/views/system/menu/index.vue index ed3c71114..7eda811ed 100644 --- a/yudao-ui-admin-vue3/src/views/system/menu/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/menu/index.vue @@ -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() -const menuForm = ref({ +const menuFormNull = { id: 0, name: '', permission: '', @@ -305,7 +306,8 @@ const menuForm = ref({ visible: true, keepAlive: true, createTime: '' -}) +} +const menuForm = ref(menuFormNull) // 新增和修改的表单校验 const rules = reactive({ name: [required], @@ -323,6 +325,7 @@ const menuProps = { value: 'id' } const menuOptions = ref([]) // 树形结构 +// 获取下拉框[上级菜单]的数据 const getTree = async () => { menuOptions.value = [] const res = await MenuApi.listSimpleMenusApi() @@ -336,6 +339,7 @@ const queryParams = reactive({ 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 diff --git a/yudao-ui-admin-vue3/types/global.d.ts b/yudao-ui-admin-vue3/types/global.d.ts index 9acbb414b..3179c200e 100644 --- a/yudao-ui-admin-vue3/types/global.d.ts +++ b/yudao-ui-admin-vue3/types/global.d.ts @@ -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