diff --git a/src/api/auth.ts b/src/api/auth.ts index 245df6f..1b1119e 100644 --- a/src/api/auth.ts +++ b/src/api/auth.ts @@ -14,13 +14,23 @@ export interface MenuItem { code: string icon: string path: string - parentId: string + parentId: string | null sort: number type: number - children?: MenuItem[] + children: MenuItem[] } -// 用户信息接口 +// 登录响应中的用户信息 +export interface LoginUserInfo { + userId: string + username: string + realName: string + token: string + roles: string[] + permissions: string[] +} + +// 完整的用户信息接口 export interface UserInfo { userId: string username: string @@ -28,22 +38,23 @@ export interface UserInfo { email: string phone: string status: number - lastLoginIp: string - lastLoginTime: string + lastLoginIp: string | null + lastLoginTime: string | null roles: string[] permissions: string[] menus: MenuItem[] } export interface LoginResponse { - token: string - userInfo?: UserInfo + code: number + message: string + data: LoginUserInfo } export interface UserInfoResponse { code: number - data: UserInfo message: string + data: UserInfo } // 用户登录 @@ -53,7 +64,7 @@ export function login(data: LoginParams) { // 获取当前用户信息 export function getUserInfo() { - return get('/api/system/auth/info') + return get('/api/system/auth/info') } // 登出接口 diff --git a/src/api/dict.ts b/src/api/dict.ts new file mode 100644 index 0000000..508307c --- /dev/null +++ b/src/api/dict.ts @@ -0,0 +1,109 @@ +import { get, post, put, del } from './request' + +// 字典参数接口 +export interface DictParam { + id: string + createBy: string + createTime: string + updateBy: string + updateTime: string + dataType: string + flag: number + paramName: string + paramType: string + paramValue: string + remark: string + sortOrder: number + status: number +} + +// 字典参数表单数据 +export interface DictParamFormData { + id?: string + createBy?: string + createTime?: string + updateBy?: string + updateTime?: string + dataType: string + flag?: number + paramName: string + paramType: string + paramValue: string + remark?: string + sortOrder: number + status: number +} + +// 分页查询参数 +export interface DictPageParams { + typeCode?: string + pageSize: number + pageNum: number +} + +// 批量获取参数 +export interface BatchParamsQuery { + typeCodes: string // 参数类型编码列表,多个用逗号分隔 +} + +// 获取参数值查询参数 +export interface ParamValueQuery { + paramName: string + typeCode: string +} + +// API响应接口 +export interface ApiResponse { + code: number + message: string + data: T +} + +export interface PageResponse { + records: T[] + total: number + size: number + current: number + pages: number +} + +// 新增参数 +export function addDictParam(data: DictParamFormData) { + return post('/system/param', data) +} + +// 修改参数 +export function updateDictParam(data: DictParamFormData) { + return put('/system/param', data) +} + +// 批量获取多个参数类型的参数列表 +export function getBatchDictParams(params: BatchParamsQuery) { + return get>('/system/param/batch', params) +} + +// 分页查询参数列表 +export function getDictParamPage(params: DictPageParams) { + return get>>('/system/param/list', params) +} + +// 刷新参数缓存 +export function refreshDictCache(typeCode?: string) { + const data = typeCode ? { typeCode } : {} + return post('/system/param/refresh', data) +} + +// 根据参数类型获取参数列表 +export function getDictParamsByType(typeCode: string) { + return get>(`/system/param/type/${typeCode}`) +} + +// 获取参数值 +export function getDictParamValue(params: ParamValueQuery) { + return get>('/system/param/value', params) +} + +// 删除参数 +export function deleteDictParam(id: string) { + return del(`/system/param/${id}`) +} \ No newline at end of file diff --git a/src/api/permission.ts b/src/api/permission.ts new file mode 100644 index 0000000..ac67172 --- /dev/null +++ b/src/api/permission.ts @@ -0,0 +1,50 @@ +import { get, post } from './request' + +// 权限树节点接口 +export interface PermissionTreeNode { + id: string + createTime?: string + createBy?: string | null + updateTime?: string + updateBy?: string | null + flag?: number + permissionName: string + permissionCode: string + permissionType: number + parentId: string | null + path: string + component: string + icon: string + sort: number + status: number | null + children?: PermissionTreeNode[] +} + +// 更新角色权限参数 +export interface UpdateRolePermissionsData { + roleId: string + permissionIds: string[] +} + +// API响应接口 +export interface ApiResponse { + code: number + message: string + data: T +} + +// 根据角色获取权限树 +export function getPermissionTreeForRole(roleId?: string) { + const params = roleId ? { roleId } : {} + return get>('/api/permission/listForRoleTree', params) +} + +// 获取角色已分配的权限ID列表 +export function getRolePermissionIds(roleId: string) { + return get>(`/api/permission/role/${roleId}/permissionIds`) +} + +// 更新角色权限 +export function updateRolePermissions(data: UpdateRolePermissionsData) { + return post('/api/permission/updateRolePermissions', data) +} \ No newline at end of file diff --git a/src/api/role.ts b/src/api/role.ts new file mode 100644 index 0000000..03ef535 --- /dev/null +++ b/src/api/role.ts @@ -0,0 +1,103 @@ +import { get, post, put, del } from './request' + +// 角色信息接口 +export interface Role { + id: string + roleCode: string + roleName: string + roleDesc: string + status: number + sort: number + loginType: number + flag: number + createBy: string + createTime: string + updateBy: string + updateTime: string +} + +// 角色列表查询参数 +export interface RoleListParams { + roleName?: string + status?: number +} + +// 角色分页查询参数 +export interface RolePageParams { + pageNum: number + pageSize: number + roleCode?: string + roleName?: string + status?: number +} + +// 角色新增/更新参数 +export interface RoleFormData { + id?: string + roleCode: string + roleName: string + roleDesc: string + status: number + sort: number + loginType?: number + flag?: number + createBy?: string + createTime?: string + updateBy?: string + updateTime?: string +} + +// API响应接口 +export interface ApiResponse { + code: number + message: string + data: T +} + +export interface PageResponse { + records: T[] + total: number + size: number + current: number + pages: number +} + +// 获取角色列表 +export function getRoleList(params?: RoleListParams) { + return get>('/api/role/list', params) +} + +// 分页查询角色列表 +export function getRolePage(params: RolePageParams) { + return get>>('/api/role/page', params) +} + +// 获取角色详情 +export function getRoleDetail(roleId: string) { + return get>(`/api/role/detail/${roleId}`) +} + +// 新增角色 +export function addRole(data: RoleFormData) { + return post('/api/role/add', data) +} + +// 更新角色 +export function updateRole(data: RoleFormData) { + return put('/api/role/update', data) +} + +// 删除角色 +export function deleteRole(roleId: string) { + return del(`/api/role/delete/${roleId}`) +} + +// 启用角色 +export function enableRole(roleId: string) { + return put(`/api/role/restore/${roleId}`) +} + +// 禁用角色 +export function disableRole(roleId: string) { + return put(`/api/role/disable/${roleId}`) +} \ No newline at end of file diff --git a/src/api/user.ts b/src/api/user.ts new file mode 100644 index 0000000..3c22634 --- /dev/null +++ b/src/api/user.ts @@ -0,0 +1,126 @@ +import { get, post, put, del } from './request' + +// 用户信息接口 +export interface User { + id: string + createBy: string + createTime: string + updateBy: string + updateTime: string + email: string + flag: number + lastLoginIp: string | null + lastLoginTime: string | null + password?: string + phone: string + realName: string + status: number + username: string + roles?: string[] // 用户角色ID数组 +} + +// 用户分页查询参数 +export interface UserPageParams { + pageNum: number + pageSize: number + realName?: string + status?: number + username?: string +} + +// 用户新增/更新参数 +export interface UserFormData { + id?: string + createBy?: string + createTime?: string + updateBy?: string + updateTime?: string + email: string + flag?: number + lastLoginIp?: string + lastLoginTime?: string + password?: string + phone: string + realName: string + status: number + username: string +} + +// 分配角色参数 +export interface AssignRolesData { + userId: string + roleIds: string[] +} + +// 修改密码参数 +export interface ChangePasswordData { + id: string + newPassword: string + oldPassword: string +} + +// 修改用户状态参数 +export interface UpdateUserStatusData { + id: string + status: number +} + +// API响应接口 +export interface ApiResponse { + code: number + message: string + data: T +} + +export interface PageResponse { + records: T[] + total: number + size: number + current: number + pages: number +} + +// 新增用户 +export function addUser(data: UserFormData) { + return post('/system/user/add', data) +} + +// 分配用户角色 +export function assignUserRoles(data: AssignRolesData) { + return post('/system/user/assignRoles', data) +} + +// 删除用户 +export function deleteUser(id: string) { + return del(`/system/user/delete/${id}`) +} + +// 分页查询用户列表 +export function getUserPage(params: UserPageParams) { + return get>>('/system/user/page', params) +} + +// 修改密码 +export function changePassword(data: ChangePasswordData) { + return put('/system/user/password', data) +} + +// 重置密码 +export function resetUserPassword(id: string) { + return put(`/system/user/reset-password/${id}`) +} + +// 修改用户状态 +export function updateUserStatus(data: UpdateUserStatusData) { + return put('/system/user/status', data) +} + +// 修改用户 +export function updateUser(data: UserFormData) { + return put('/system/user/update', data) +} + +// 获取用户详情 +export function getUserDetail(id: string) { + return get>(`/system/user/${id}`) +} \ No newline at end of file diff --git a/src/config/menu.ts b/src/config/menu.ts new file mode 100644 index 0000000..a97eff6 --- /dev/null +++ b/src/config/menu.ts @@ -0,0 +1,61 @@ +// 菜单路径映射配置 +export const MENU_PATH_MAP: Record = { + // 系统管理 + '/system': '/admin/system', + '/system/user': '/admin/users', + '/system/role': '/admin/roles', // 角色管理 + '/system/permission': '/admin/permissions', + '/system/param': '/admin/dict', + + // 人才管理 + '/talent': '/admin/talent', + '/talent/basic': '/admin/talent-profile', + '/talent/unit': '/admin/talent-unit', + '/talent/resume': '/admin/talent-resume', + '/talent/domain': '/admin/talent-domain', + + // 科研管理 + '/research': '/admin/research', + '/research/project': '/admin/tech-projects', + '/research/initiation': '/admin/research-initiation', + '/research/report': '/admin/tech-reports', + + // 成果管理 + '/achievement': '/admin/achievement', + '/achievement/paper': '/admin/tech-achievements', + '/achievement/patent': '/admin/tech-patents', + '/achievement/award': '/admin/tech-awards', + '/achievement/honor': '/admin/tech-honors' +} + +// 图标映射配置 +export const MENU_ICON_MAP: Record = { + 'setting': 'Setting', + 'user': 'User', + 'peoples': 'UserFilled', + 'tree-table': 'Lock', + 'dict': 'Setting', + 'profile': 'User', + 'company': 'OfficeBuilding', + 'education': 'Document', + 'skill': 'Star', + 'research': 'DataAnalysis', + 'project': 'Folder', + 'form': 'Document', + 'documentation': 'DataAnalysis', + 'trophy': 'Trophy', + 'document': 'Document', + 'patent': 'Files', + 'award': 'Trophy', + 'medal': 'Medal' +} + +// 将后端菜单路径转换为前端路由路径 +export function convertMenuPath(backendPath: string): string { + return MENU_PATH_MAP[backendPath] || backendPath +} + +// 将后端图标转换为 Element Plus 图标 +export function convertMenuIcon(backendIcon: string): string { + return MENU_ICON_MAP[backendIcon] || 'Menu' +} \ No newline at end of file diff --git a/src/layouts/AdminLayout.vue b/src/layouts/AdminLayout.vue index 6aceab3..f04e3ee 100644 --- a/src/layouts/AdminLayout.vue +++ b/src/layouts/AdminLayout.vue @@ -33,71 +33,37 @@ active-text-color="#409eff" router > + 数据概览 - - - - 新闻政策 - - - - - - - 科技问答 - + + @@ -128,11 +94,15 @@ import { computed, onMounted } from 'vue' import { useRoute, useRouter } from 'vue-router' import { ElMessage, ElMessageBox } from 'element-plus' import { useUserStore } from '@/store/user' +import { convertMenuPath, convertMenuIcon } from '@/config/menu' const route = useRoute() const router = useRouter() const userStore = useUserStore() +// 获取用户菜单 +const userMenus = computed(() => userStore.menus) + // 初始化用户信息 onMounted(() => { userStore.initUserInfo() @@ -158,7 +128,9 @@ const breadcrumbConfig: Record = { '/admin/tech-reports': { title: '科技报告', parent: '科技资源' }, '/admin/tech-awards': { title: '科技奖励', parent: '科技资源' }, '/admin/users': { title: '用户管理', parent: '系统管理' }, + '/admin/roles': { title: '角色管理', parent: '系统管理' }, '/admin/permissions': { title: '权限管理', parent: '系统管理' }, + '/admin/permission-config': { title: '权限配置', parent: '系统管理' }, '/admin/dict': { title: '字典管理', parent: '系统管理' } } @@ -218,6 +190,8 @@ const handleCommand = (command: string) => { break } } + + \ No newline at end of file diff --git a/src/views/admin/system/permissions.vue b/src/views/admin/system/permissions.vue index 5f63074..b7c8904 100644 --- a/src/views/admin/system/permissions.vue +++ b/src/views/admin/system/permissions.vue @@ -2,223 +2,195 @@
-
-
- - - - - - - - - - - - - 搜索 - 重置搜索 - - -
-
- 新增角色 -
+ +
+ + + + + + + + + + + + + + + + + 搜索 + + + + 重置 + + +
+
- - - - - - - - \ No newline at end of file diff --git a/src/views/test.json b/src/views/test.json deleted file mode 100644 index 14b628e..0000000 --- a/src/views/test.json +++ /dev/null @@ -1,374 +0,0 @@ -{ - "tool_call_id": "tool_4af0d1db-1bf4-4a48-8566-32bef59a73e8", - "status": "succeeded", - "content": "获取订舱列表成功,分页数据{'total': 60, 'page': 1, 'page_size': 10, 'total_pages': 6, 'has_next': True, 'has_prev': False}", - "raw": { - "code": 200, - "msg": "获取订舱列表成功,分页数据{'total': 60, 'page': 1, 'page_size': 10, 'total_pages': 6, 'has_next': True, 'has_prev': False}", - "data": { - "preview": { - "title": "", - "type": 1, - "id": "", - "content": { - "mcpName": "订舱列表", - "type": 1, - "id": "", - "fullscreen": false, - "formData": [ - { - "name": "订舱列表", - "tag": "table", - "key": "booking_list", - "headerColumns": [ - { - "title": "id", - "key": "id", - "align": "left", - "sortable": false, - "hidden": true, - "width": "", - "isExternal": false, - "externalType": 1 - }, - { - "title": "文件名", - "key": "file_name", - "align": "left", - "hidden": false, - "width": "", - "isExternal": false, - "externalType": 1 - }, - { - "title": "订舱编号", - "key": "booking_number", - "align": "left", - "hidden": false, - "width": "", - "isExternal": false, - "externalType": 1 - }, - { - "title": "状态", - "key": "status", - "align": "left", - "hidden": false, - "width": "", - "isExternal": false, - "externalType": 1 - }, - { - "title": "汇率", - "key": "usd", - "align": "left", - "hidden": false, - "width": "", - "isExternal": false, - "externalType": 1 - }, - { - "title": "实例id", - "key": "instance_id", - "align": "left", - "hidden": true, - "width": "", - "isExternal": false, - "externalType": 1 - }, - { - "title": "创建人", - "key": "create_by", - "align": "left", - "hidden": false, - "width": "", - "isExternal": false, - "externalType": 1 - }, - { - "title": "审核文件", - "key": "audit_file", - "align": "left", - "hidden": false, - "width": "", - "isExternal": true, - "externalType": 2 - }, - { - "title": "合同文件", - "key": "final_file", - "align": "left", - "hidden": false, - "width": "", - "isExternal": true, - "externalType": 2 - }, - { - "title": "操作", - "key": "operations", - "type": "operations", - "align": "center" - } - ], - "contentColumns": [ - "id", - "file_name", - "booking_number", - "status", - "usd", - "instance_id", - "create_by", - "audit_file", - "final_file", - "operations" - ], - "dataRows": [ - { - "id": "fd096220-da85-4c2b-99f6-b9d0962ee273", - "file_name": "高泰出口货订单表.xlsx", - "booking_number": "HO547781", - "status": "已完成", - "usd": "3.0000", - "instance_id": 694, - "create_by": "test123", - "audit_file": [ - { - "fileName": "订舱明细HO54778120250920161525.xlsx", - "fileId": "cfb70f5f-f503-4674-a796-81d21365cbd7", - "fileType": "xlsx" - } - ], - "final_file": [ - { - "fileName": "订舱合同_HO547781_20250920161532_98601.xlsx", - "fileId": "a6136963-b75d-4753-aed6-be67ae28890f", - "fileType": "xlsx" - }, - { - "fileName": "订舱合同_HO547781_20250920161534_94197.xlsx", - "fileId": "19e49396-605e-469c-9aed-e494c4514849", - "fileType": "xlsx" - }, - { - "fileName": "订舱合同_HO547781_20250920161536_69715.xlsx", - "fileId": "47ed34a3-8f51-4c63-96b4-9adf425bd432", - "fileType": "xlsx" - } - ] - }, - { - "id": "8de4b287-e5f0-460d-bdb7-8bcaa4e618d8", - "file_name": "高泰出口货订单.xlsx", - "booking_number": null, - "status": "待审核", - "usd": null, - "instance_id": 692, - "create_by": "test123", - "audit_file": null, - "final_file": null - }, - { - "id": "a54db8cc-c92d-4018-b57e-ebc64337baa1", - "file_name": "高泰出口货订单表.xlsx", - "booking_number": null, - "status": "待处理", - "usd": null, - "instance_id": 691, - "create_by": "test123", - "audit_file": null, - "final_file": null - }, - { - "id": "f46ec726-97a6-4e19-b009-27c585444158", - "file_name": "高泰出口货订单.xlsx", - "booking_number": null, - "status": "待审核", - "usd": null, - "instance_id": 689, - "create_by": "test123", - "audit_file": null, - "final_file": null - }, - { - "id": "aa75c1d8-3d63-4090-94a4-bcf340d7879d", - "file_name": "高泰出口货订单表.xlsx", - "booking_number": "LA158968", - "status": "已完成", - "usd": "3.0000", - "instance_id": 688, - "create_by": "test123", - "audit_file": [ - { - "fileName": "订舱明细LA15896820250920155818.xlsx", - "fileId": "fa01de0a-af07-49c1-b101-30c4e98aa0f0", - "fileType": "xlsx" - } - ], - "final_file": [ - { - "fileName": "订舱合同_LA158968_20250920155824_68312.xlsx", - "fileId": "eb235513-f136-495e-9ee4-34e811a1d6a8", - "fileType": "xlsx" - }, - { - "fileName": "订舱合同_LA158968_20250920155826_42587.xlsx", - "fileId": "5c6b39aa-4f06-4136-937b-7ef0f642b7a4", - "fileType": "xlsx" - }, - { - "fileName": "订舱合同_LA158968_20250920155828_15180.xlsx", - "fileId": "4c83559c-182f-4e28-8acb-67796bac1703", - "fileType": "xlsx" - } - ] - }, - { - "id": "d7ab299b-d455-4b6e-8e43-507ea1a6f462", - "file_name": "高泰出口货订单.xlsx", - "booking_number": null, - "status": "待审核", - "usd": null, - "instance_id": 686, - "create_by": "test123", - "audit_file": null, - "final_file": null - }, - { - "id": "ad21ebf2-d87a-43bf-8639-1cdabcd77c97", - "file_name": "高泰出口货订单表.xlsx", - "booking_number": "UO815266", - "status": "已完成", - "usd": "3.0000", - "instance_id": 685, - "create_by": "test123", - "audit_file": [ - { - "fileName": "订舱明细UO81526620250920153747.xlsx", - "fileId": "2ccff892-ec61-4a8e-9901-f01c3daf72b7", - "fileType": "xlsx" - } - ], - "final_file": [ - { - "fileName": "订舱合同_UO815266_20250920153753_92191.xlsx", - "fileId": "d55d7929-5ea8-4129-a8c1-5d6f28ce89d9", - "fileType": "xlsx" - }, - { - "fileName": "订舱合同_UO815266_20250920153755_44609.xlsx", - "fileId": "19ef6a3b-d9d8-4987-b6bd-0bb48b0532e2", - "fileType": "xlsx" - }, - { - "fileName": "订舱合同_UO815266_20250920153757_77201.xlsx", - "fileId": "a1ebe5c5-bd9f-40f7-b919-8011e60915c3", - "fileType": "xlsx" - } - ] - }, - { - "id": "bae2609b-7608-41e3-93a2-02a81f7e738f", - "file_name": "高泰出口货订单.xlsx", - "booking_number": null, - "status": "待审核", - "usd": null, - "instance_id": 683, - "create_by": "test123", - "audit_file": null, - "final_file": null - }, - { - "id": "e58886df-727b-4803-b13d-df0682d9e226", - "file_name": "高泰出口货订单表.xlsx", - "booking_number": "DR677738", - "status": "已完成", - "usd": "3.0000", - "instance_id": 682, - "create_by": "test123", - "audit_file": [ - { - "fileName": "订舱明细DR67773820250920153514.xlsx", - "fileId": "85125ce5-708b-4eb0-81cf-94a29d014fec", - "fileType": "xlsx" - } - ], - "final_file": [ - { - "fileName": "订舱合同_DR677738_20250920153522_95548.xlsx", - "fileId": "8275efd6-b7ea-4f23-b7eb-116c5d6a89ec", - "fileType": "xlsx" - }, - { - "fileName": "订舱合同_DR677738_20250920153524_32804.xlsx", - "fileId": "60581a74-11b0-4ef0-b7da-6f8190479880", - "fileType": "xlsx" - }, - { - "fileName": "订舱合同_DR677738_20250920153526_19680.xlsx", - "fileId": "97cee51d-e172-4edc-8021-76940c43c91e", - "fileType": "xlsx" - } - ] - }, - { - "id": "af5f54c2-d207-4c1a-91db-05631c1a6369", - "file_name": "高泰出口货订单表.xlsx", - "booking_number": "MY512871", - "status": "已完成", - "usd": "3.0000", - "instance_id": 679, - "create_by": "test123", - "audit_file": [ - { - "fileName": "订舱明细MY51287120250920152648.xlsx", - "fileId": "62bbd275-d902-4b51-b557-6b45ac7d49ad", - "fileType": "xlsx" - } - ], - "final_file": [ - { - "fileName": "订舱合同_MY512871_20250920152704_47232.xlsx", - "fileId": "ed9a0baa-9962-48d9-bcec-2dfc0d500dd4", - "fileType": "xlsx" - }, - { - "fileName": "订舱合同_MY512871_20250920152707_39135.xlsx", - "fileId": "ff01b42c-3fd8-4d02-867b-37a7d16446c3", - "fileType": "xlsx" - }, - { - "fileName": "订舱合同_MY512871_20250920152708_52585.xlsx", - "fileId": "681368c2-92c1-4de7-a596-a235214e5e42", - "fileType": "xlsx" - } - ] - } - ], - "striped": true, - "scrollX": false, - "fullscreen": false, - "operationsButtons": [ - { - "label": "修改订舱", - "key": "btn1", - "type": "primary", - "prompt": "prompt:modify_booking()", - "passAllParams": false - }, - { - "label": "删除订舱", - "key": "btn2", - "type": "primary", - "prompt": "prompt:delete_booking()", - "passAllParams": false - } - ] - } - ] - } - } - }, - "success": true, - "time": "2025-10-13 11:35:44" - } -} \ No newline at end of file diff --git a/vue.config.js b/vue.config.js index e39b5b2..fa6a1a6 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,17 +1,17 @@ -const { defineConfig } = require('@vue/cli-service') +const { defineConfig } = require("@vue/cli-service"); module.exports = defineConfig({ transpileDependencies: true, devServer: { port: 8080, proxy: { - '/brain': { - target: 'http://47.110.148.47:8090', + "/brain": { + target: "http://47.110.148.47:8090", changeOrigin: true, ws: true, pathRewrite: { - '^/brain': '/brain' - } - } - } - } -}) + "^/brain": "/brain", + }, + }, + }, + }, +});