diff --git a/src/service/api/system-manage.ts b/src/service/api/system-manage.ts index 974b1f5..301af6b 100644 --- a/src/service/api/system-manage.ts +++ b/src/service/api/system-manage.ts @@ -18,6 +18,29 @@ const POST_PREFIX = `${SYSTEM_SERVICE_PREFIX}/post`; const ORG_LEADER_PREFIX = `${SYSTEM_SERVICE_PREFIX}/org-leader`; const USER_MANAGEMENT_RELATION_PREFIX = `${SYSTEM_SERVICE_PREFIX}/user-management-relation`; +function appendQueryValue(query: URLSearchParams, key: string, value: unknown) { + if (value === null || value === undefined || value === '') { + return; + } + + if (Array.isArray(value)) { + value.forEach(item => appendQueryValue(query, key, item)); + return; + } + + query.append(key, String(value)); +} + +function buildQuery(params: object = {}) { + const query = new URLSearchParams(); + + Object.entries(params).forEach(([key, value]) => { + appendQueryValue(query, key, value); + }); + + return query.toString(); +} + function createRolePageQuery(params?: Api.SystemManage.RoleSearchParams) { const query = new URLSearchParams(); @@ -469,6 +492,17 @@ export function fetchBatchDeletePost(ids: number[]) { }); } +/** 导出岗位 */ +export function fetchExportPost(params: Api.SystemManage.PostSearchParams) { + const query = buildQuery(params); + + return request({ + url: query ? `${POST_PREFIX}/export-excel?${query}` : `${POST_PREFIX}/export-excel`, + method: 'get', + responseType: 'blob' + }); +} + /** 获取用户简单列表(用于用户选择下拉框) */ export async function fetchGetUserSimpleList() { return request({ @@ -579,6 +613,17 @@ export function fetchBatchDeleteUser(ids: number[]) { }); } +/** 导出用户 */ +export function fetchExportUser(params: Api.SystemManage.UserSearchParams) { + const query = buildQuery(params); + + return request({ + url: query ? `${USER_PREFIX}/export-excel?${query}` : `${USER_PREFIX}/export-excel`, + method: 'get', + responseType: 'blob' + }); +} + /** 获取菜单列表 */ export async function fetchGetMenuList(params?: Api.SystemManage.MenuSearchParams) { const result = await request({ diff --git a/src/typings/api/system-log.d.ts b/src/typings/api/system-log.d.ts index 821e6a3..1841844 100644 --- a/src/typings/api/system-log.d.ts +++ b/src/typings/api/system-log.d.ts @@ -77,6 +77,7 @@ declare namespace Api { id: string; traceId?: string | null; userId: string; + userNickname?: string | null; userType: number; applicationName: string; requestMethod: string; @@ -114,6 +115,7 @@ declare namespace Api { id: string; traceId?: string | null; userId: string; + userNickname?: string | null; userType: number; applicationName: string; requestMethod: string; diff --git a/src/views/infra/log-management/api-access-log/index.vue b/src/views/infra/log-management/api-access-log/index.vue index 9f3789c..ef23cf9 100644 --- a/src/views/infra/log-management/api-access-log/index.vue +++ b/src/views/infra/log-management/api-access-log/index.vue @@ -80,6 +80,7 @@ const detailSections: LogDetailSection[] = [ { title: '业务上下文', fields: [ + { label: '用户姓名', key: 'userNickname' }, { label: '用户编号', key: 'userId' }, { label: '操作模块', key: 'operateModule' }, { label: '操作名', key: 'operateName' }, @@ -114,6 +115,13 @@ const { columns, columnChecks, data, loading, getData, getDataByPage, mobilePagi columns: () => [ { prop: 'index', type: 'index', label: '序号', width: 64 }, { prop: 'applicationName', label: '应用名', minWidth: 140, showOverflowTooltip: true }, + { + prop: 'userNickname', + label: '用户姓名', + minWidth: 120, + showOverflowTooltip: true, + formatter: row => row.userNickname || '--' + }, { prop: 'requestMethod', label: '请求方式', width: 100, align: 'center' }, { prop: 'requestUrl', label: '请求地址', minWidth: 220, showOverflowTooltip: true }, { prop: 'operateModule', label: '操作模块', minWidth: 140, showOverflowTooltip: true }, @@ -182,7 +190,7 @@ async function handleExport() {