From d677207af13d7cb6d9fdc3ca306d383c08bdd18e Mon Sep 17 00:00:00 2001 From: xingyu Date: Thu, 17 Nov 2022 00:22:38 +0800 Subject: [PATCH] fix: user --- .../src/hooks/web/useVxeGrid.ts | 18 ++++---- .../src/views/system/errorCode/index.vue | 4 +- .../src/views/system/notice/index.vue | 4 +- .../src/views/system/oauth2/client/index.vue | 4 +- .../src/views/system/oauth2/token/index.vue | 4 +- .../src/views/system/post/index.vue | 4 +- .../src/views/system/role/index.vue | 4 +- .../src/views/system/sms/smsChannel/index.vue | 4 +- .../views/system/sms/smsTemplate/index.vue | 4 +- .../src/views/system/user/index.vue | 41 +++++++++---------- .../src/views/system/user/user.data.ts | 5 +-- 11 files changed, 47 insertions(+), 49 deletions(-) diff --git a/yudao-ui-admin-vue3/src/hooks/web/useVxeGrid.ts b/yudao-ui-admin-vue3/src/hooks/web/useVxeGrid.ts index 40c751d30..8a20f1a8d 100644 --- a/yudao-ui-admin-vue3/src/hooks/web/useVxeGrid.ts +++ b/yudao-ui-admin-vue3/src/hooks/web/useVxeGrid.ts @@ -14,7 +14,8 @@ interface UseVxeGridConfig { getListApi: (option: any) => Promise deleteApi?: (option: any) => Promise exportListApi?: (option: any) => Promise - exportName?: string + exportName?: string // 导出文件夹名称 + queryParams?: any // 其他查询参数 } const appStore = useAppStore() @@ -64,7 +65,7 @@ export const useVxeGrid = (config?: UseVxeGridConfig) => { pagerConfig: { border: false, // 带边框 background: true, // 带背景颜色 - perfect: true, // 配套的样式 + perfect: false, // 配套的样式 pageSize: 10, // 每页大小 pagerCount: 7, // 显示页码按钮的数量 autoHidden: true, // 当只有一页时自动隐藏 @@ -72,11 +73,11 @@ export const useVxeGrid = (config?: UseVxeGridConfig) => { layouts: [ 'PrevJump', 'PrevPage', - 'Jump', - 'PageCount', + 'JumpNumber', 'NextPage', 'NextJump', 'Sizes', + 'FullJump', 'Total' ] }, @@ -86,7 +87,10 @@ export const useVxeGrid = (config?: UseVxeGridConfig) => { props: { result: 'list', total: 'total' }, ajax: { query: ({ page, form }) => { - const queryParams = Object.assign({}, JSON.parse(JSON.stringify(form))) + let queryParams: any = Object.assign({}, JSON.parse(JSON.stringify(form))) + if (config?.queryParams) { + queryParams = Object.assign(queryParams, config.queryParams) + } queryParams.pageSize = page.pageSize queryParams.pageNo = page.currentPage gridOptions.loading = false @@ -121,7 +125,7 @@ export const useVxeGrid = (config?: UseVxeGridConfig) => { * @param ref * @returns */ - const reloadList = async (ref) => { + const getList = async (ref) => { if (!ref) { console.error('未传入gridRef') return @@ -214,7 +218,7 @@ export const useVxeGrid = (config?: UseVxeGridConfig) => { return { gridOptions, - reloadList, + getList, getSearchData, deleteData, exportList, diff --git a/yudao-ui-admin-vue3/src/views/system/errorCode/index.vue b/yudao-ui-admin-vue3/src/views/system/errorCode/index.vue index 5e93dfcb0..ab95a3e9f 100644 --- a/yudao-ui-admin-vue3/src/views/system/errorCode/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/errorCode/index.vue @@ -83,7 +83,7 @@ const { t } = useI18n() // 国际化 const message = useMessage() // 消息弹窗 // 列表相关的变量 const xGrid = ref() // grid Ref -const { gridOptions, reloadList, deleteData } = useVxeGrid({ +const { gridOptions, getList, deleteData } = useVxeGrid({ allSchemas: allSchemas, getListApi: ErrorCodeApi.getErrorCodePageApi, deleteApi: ErrorCodeApi.deleteErrorCodeApi @@ -150,7 +150,7 @@ const submitForm = async () => { } finally { actionLoading.value = false // 刷新列表 - await reloadList(xGrid) + await getList(xGrid) } } }) diff --git a/yudao-ui-admin-vue3/src/views/system/notice/index.vue b/yudao-ui-admin-vue3/src/views/system/notice/index.vue index c1b6a42bf..2e8aabcc1 100644 --- a/yudao-ui-admin-vue3/src/views/system/notice/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/notice/index.vue @@ -82,7 +82,7 @@ const { t } = useI18n() // 国际化 const message = useMessage() // 消息弹窗 // 列表相关的变量 const xGrid = ref() // 列表 Grid Ref -const { gridOptions, reloadList, deleteData } = useVxeGrid({ +const { gridOptions, getList, deleteData } = useVxeGrid({ allSchemas: allSchemas, getListApi: NoticeApi.getNoticePageApi, deleteApi: NoticeApi.deleteNoticeApi @@ -148,7 +148,7 @@ const submitForm = async () => { dialogVisible.value = false } finally { actionLoading.value = false - await reloadList(xGrid) + await getList(xGrid) } } }) diff --git a/yudao-ui-admin-vue3/src/views/system/oauth2/client/index.vue b/yudao-ui-admin-vue3/src/views/system/oauth2/client/index.vue index d651b11ac..b28396381 100644 --- a/yudao-ui-admin-vue3/src/views/system/oauth2/client/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/oauth2/client/index.vue @@ -147,7 +147,7 @@ const message = useMessage() // 消息弹窗 // 列表相关的变量 const xGrid = ref() // 列表 Grid Ref -const { gridOptions, reloadList, deleteData } = useVxeGrid({ +const { gridOptions, getList, deleteData } = useVxeGrid({ allSchemas: allSchemas, getListApi: ClientApi.getOAuth2ClientPageApi, deleteApi: ClientApi.deleteOAuth2ClientApi @@ -213,7 +213,7 @@ const submitForm = async () => { } finally { actionLoading.value = false // 刷新列表 - await reloadList(xGrid) + await getList(xGrid) } } }) diff --git a/yudao-ui-admin-vue3/src/views/system/oauth2/token/index.vue b/yudao-ui-admin-vue3/src/views/system/oauth2/token/index.vue index a43807440..41a7acb75 100644 --- a/yudao-ui-admin-vue3/src/views/system/oauth2/token/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/oauth2/token/index.vue @@ -39,7 +39,7 @@ const { t } = useI18n() // 国际化 const message = useMessage() // 消息弹窗 // 列表相关的变量 const xGrid = ref() // 列表 Grid Ref -const { gridOptions, reloadList } = useVxeGrid({ +const { gridOptions, getList } = useVxeGrid({ allSchemas: allSchemas, getListApi: TokenApi.getAccessTokenPageApi }) @@ -65,7 +65,7 @@ const handleForceLogout = (rowId: number) => { }) .finally(async () => { // 刷新列表 - await reloadList(xGrid) + await getList(xGrid) }) } diff --git a/yudao-ui-admin-vue3/src/views/system/post/index.vue b/yudao-ui-admin-vue3/src/views/system/post/index.vue index 82b0b20bf..041913a86 100644 --- a/yudao-ui-admin-vue3/src/views/system/post/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/post/index.vue @@ -90,7 +90,7 @@ const { t } = useI18n() // 国际化 const message = useMessage() // 消息弹窗 // 列表相关的变量 const xGrid = ref() // 列表 Grid Ref -const { gridOptions, reloadList, deleteData, exportList } = useVxeGrid({ +const { gridOptions, getList, deleteData, exportList } = useVxeGrid({ allSchemas: allSchemas, getListApi: PostApi.getPostPageApi, deleteApi: PostApi.deletePostApi, @@ -167,7 +167,7 @@ const submitForm = async () => { } finally { actionLoading.value = false // 刷新列表 - await reloadList(xGrid) + await getList(xGrid) } } }) diff --git a/yudao-ui-admin-vue3/src/views/system/role/index.vue b/yudao-ui-admin-vue3/src/views/system/role/index.vue index 28326f475..bee540371 100644 --- a/yudao-ui-admin-vue3/src/views/system/role/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/role/index.vue @@ -174,7 +174,7 @@ const { t } = useI18n() // 国际化 const message = useMessage() // 消息弹窗 // 列表相关的变量 const xGrid = ref() // 列表 Grid Ref -const { gridOptions, reloadList, deleteData } = useVxeGrid({ +const { gridOptions, getList, deleteData } = useVxeGrid({ allSchemas: allSchemas, getListApi: RoleApi.getRolePageApi, deleteApi: RoleApi.deleteRoleApi @@ -242,7 +242,7 @@ const submitForm = async () => { } finally { actionLoading.value = false // 刷新列表 - await reloadList(xGrid) + await getList(xGrid) } } }) diff --git a/yudao-ui-admin-vue3/src/views/system/sms/smsChannel/index.vue b/yudao-ui-admin-vue3/src/views/system/sms/smsChannel/index.vue index e2ddb0bd5..ac61bcd77 100644 --- a/yudao-ui-admin-vue3/src/views/system/sms/smsChannel/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/sms/smsChannel/index.vue @@ -85,7 +85,7 @@ const message = useMessage() // 消息弹窗 // 列表相关的变量 const xGrid = ref() // 列表 Grid Ref -const { gridOptions, reloadList, deleteData } = useVxeGrid({ +const { gridOptions, getList, deleteData } = useVxeGrid({ allSchemas: allSchemas, getListApi: SmsChannelApi.getSmsChannelPageApi, deleteApi: SmsChannelApi.deleteSmsChannelApi @@ -152,7 +152,7 @@ const submitForm = async () => { } finally { actionLoading.value = false // 刷新列表 - await reloadList(xGrid) + await getList(xGrid) } } }) 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 5cc4ba07f..b5959f84f 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 @@ -128,7 +128,7 @@ const message = useMessage() // 消息弹窗 // 列表相关的变量 const xGrid = ref() // 列表 Grid Ref -const { gridOptions, reloadList, deleteData } = useVxeGrid({ +const { gridOptions, getList, deleteData } = useVxeGrid({ allSchemas: allSchemas, getListApi: SmsTemplateApi.getSmsTemplatePageApi, deleteApi: SmsTemplateApi.deleteSmsTemplateApi @@ -196,7 +196,7 @@ const submitForm = async () => { } finally { actionLoading.value = false // 刷新列表 - await reloadList(xGrid) + await getList(xGrid) } } }) diff --git a/yudao-ui-admin-vue3/src/views/system/user/index.vue b/yudao-ui-admin-vue3/src/views/system/user/index.vue index e4ffdcaf9..af2fef3ed 100644 --- a/yudao-ui-admin-vue3/src/views/system/user/index.vue +++ b/yudao-ui-admin-vue3/src/views/system/user/index.vue @@ -242,7 +242,7 @@