feat:增加主包(tabbar)、system(系统管理)、infra(基础设施)、bpm(工作流程)的页面
This commit is contained in:
13
src/api/bpm/category/index.ts
Normal file
13
src/api/bpm/category/index.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { http } from '@/http/http'
|
||||
|
||||
/** 流程分类 */
|
||||
export interface Category {
|
||||
id: number
|
||||
name: string
|
||||
code: string
|
||||
}
|
||||
|
||||
/** 获取流程分类简单列表 */
|
||||
export function getCategorySimpleList() {
|
||||
return http.get<Category[]>('/bpm/category/simple-list')
|
||||
}
|
||||
20
src/api/bpm/definition/index.ts
Normal file
20
src/api/bpm/definition/index.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { http } from '@/http/http'
|
||||
|
||||
/** 流程定义 */
|
||||
export interface ProcessDefinition {
|
||||
id: string
|
||||
key: string
|
||||
name: string
|
||||
description?: string
|
||||
category: string
|
||||
formType?: number
|
||||
formId?: number
|
||||
formCustomCreatePath?: string
|
||||
formCustomViewPath?: string
|
||||
suspensionState: number
|
||||
}
|
||||
|
||||
/** 获取流程定义列表 */
|
||||
export function getProcessDefinitionList(params?: { suspensionState?: number }) {
|
||||
return http.get<ProcessDefinition[]>('/bpm/process-definition/list', params)
|
||||
}
|
||||
68
src/api/bpm/processInstance/index.ts
Normal file
68
src/api/bpm/processInstance/index.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
import type { PageParam, PageResult } from '@/http/types'
|
||||
import { http } from '@/http/http'
|
||||
|
||||
/** 流程实例用户信息 */
|
||||
export interface User {
|
||||
id: number
|
||||
nickname: string
|
||||
avatar?: string
|
||||
deptName?: string
|
||||
}
|
||||
|
||||
/** 流程实例 */
|
||||
export interface ProcessInstance {
|
||||
id: string
|
||||
name: string
|
||||
status: number
|
||||
category?: string
|
||||
categoryName?: string
|
||||
createTime?: number
|
||||
startTime?: number
|
||||
endTime?: number
|
||||
startUser?: User
|
||||
summary?: {
|
||||
key: string
|
||||
value: string
|
||||
}[]
|
||||
}
|
||||
|
||||
/** 抄送流程实例 */
|
||||
export interface ProcessInstanceCopy {
|
||||
id: string
|
||||
processInstanceId: string
|
||||
processInstanceName: string
|
||||
startUser: User
|
||||
createTime: number
|
||||
summary?: {
|
||||
key: string
|
||||
value: string
|
||||
}[]
|
||||
}
|
||||
|
||||
/** 查询我发起的流程分页列表 */
|
||||
export function getProcessInstanceMyPage(params: PageParam) {
|
||||
return http.get<PageResult<ProcessInstance>>('/bpm/process-instance/my-page', params)
|
||||
}
|
||||
|
||||
/** 查询抄送我的流程分页列表 */
|
||||
export function getProcessInstanceCopyPage(params: PageParam) {
|
||||
return http.get<PageResult<ProcessInstanceCopy>>('/bpm/process-instance/copy/page', params)
|
||||
}
|
||||
|
||||
/** 查询流程实例详情 */
|
||||
export function getProcessInstance(id: string) {
|
||||
return http.get<ProcessInstance>(`/bpm/process-instance/get?id=${id}`)
|
||||
}
|
||||
|
||||
/** 新增流程实例 */
|
||||
export function createProcessInstance(data: {
|
||||
processDefinitionId: string
|
||||
variables: Record<string, any>
|
||||
}) {
|
||||
return http.post<string>('/bpm/process-instance/create', data)
|
||||
}
|
||||
|
||||
/** 申请人取消流程实例 */
|
||||
export function cancelProcessInstanceByStartUser(id: string, reason: string) {
|
||||
return http.delete<boolean>('/bpm/process-instance/cancel-by-start-user', { id, reason })
|
||||
}
|
||||
50
src/api/bpm/task/index.ts
Normal file
50
src/api/bpm/task/index.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import type { ProcessInstance } from '@/api/bpm/processInstance'
|
||||
import type { PageParam, PageResult } from '@/http/types'
|
||||
import { http } from '@/http/http'
|
||||
|
||||
/** 任务处理人 */
|
||||
// TODO @芋艿:貌似暂时不需要这个?!
|
||||
export interface TaskUser {
|
||||
id: number
|
||||
nickname: string
|
||||
avatar?: string
|
||||
deptName?: string
|
||||
}
|
||||
|
||||
/** 流程任务 */
|
||||
export interface Task {
|
||||
id: string
|
||||
name: string
|
||||
status: number
|
||||
createTime: number
|
||||
endTime?: number
|
||||
reason?: string
|
||||
assigneeUser?: TaskUser
|
||||
ownerUser?: TaskUser
|
||||
processInstance: ProcessInstance
|
||||
}
|
||||
|
||||
/** 查询待办任务分页列表 */
|
||||
export function getTaskTodoPage(params: PageParam) {
|
||||
return http.get<PageResult<Task>>('/bpm/task/todo-page', params)
|
||||
}
|
||||
|
||||
/** 查询已办任务分页列表 */
|
||||
export function getTaskDonePage(params: PageParam) {
|
||||
return http.get<PageResult<Task>>('/bpm/task/done-page', params)
|
||||
}
|
||||
|
||||
/** 审批通过 */
|
||||
export function approveTask(data: { id: string, reason: string }) {
|
||||
return http.put<boolean>('/bpm/task/approve', data)
|
||||
}
|
||||
|
||||
/** 审批拒绝 */
|
||||
export function rejectTask(data: { id: string, reason: string }) {
|
||||
return http.put<boolean>('/bpm/task/reject', data)
|
||||
}
|
||||
|
||||
/** 根据流程实例 ID 查询任务列表 */
|
||||
export function getTaskListByProcessInstanceId(processInstanceId: string) {
|
||||
return http.get<Task[]>(`/bpm/task/list-by-process-instance-id?processInstanceId=${processInstanceId}`)
|
||||
}
|
||||
36
src/api/infra/apiAccessLog/index.ts
Normal file
36
src/api/infra/apiAccessLog/index.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import type { PageParam, PageResult } from '@/http/types'
|
||||
import { http } from '@/http/http'
|
||||
|
||||
/** API 访问日志信息 */
|
||||
export interface ApiAccessLog {
|
||||
id: number
|
||||
traceId: string
|
||||
userId: number
|
||||
userType: number
|
||||
applicationName: string
|
||||
requestMethod: string
|
||||
requestParams: string
|
||||
responseBody: string
|
||||
requestUrl: string
|
||||
userIp: string
|
||||
userAgent: string
|
||||
operateModule: string
|
||||
operateName: string
|
||||
operateType: number
|
||||
beginTime: string
|
||||
endTime: string
|
||||
duration: number
|
||||
resultCode: number
|
||||
resultMsg: string
|
||||
createTime: string
|
||||
}
|
||||
|
||||
/** 获取 API 访问日志分页列表 */
|
||||
export function getApiAccessLogPage(params: PageParam) {
|
||||
return http.get<PageResult<ApiAccessLog>>('/infra/api-access-log/page', params)
|
||||
}
|
||||
|
||||
/** 获取 API 访问日志详情 */
|
||||
export function getApiAccessLog(id: number) {
|
||||
return http.get<ApiAccessLog>(`/infra/api-access-log/get?id=${id}`)
|
||||
}
|
||||
45
src/api/infra/apiErrorLog/index.ts
Normal file
45
src/api/infra/apiErrorLog/index.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import type { PageParam, PageResult } from '@/http/types'
|
||||
import { http } from '@/http/http'
|
||||
|
||||
/** API 错误日志信息 */
|
||||
export interface ApiErrorLog {
|
||||
id: number
|
||||
traceId: string
|
||||
userId: number
|
||||
userType: number
|
||||
applicationName: string
|
||||
requestMethod: string
|
||||
requestParams: string
|
||||
requestUrl: string
|
||||
userIp: string
|
||||
userAgent: string
|
||||
exceptionTime: string
|
||||
exceptionName: string
|
||||
exceptionMessage: string
|
||||
exceptionRootCauseMessage: string
|
||||
exceptionStackTrace: string
|
||||
exceptionClassName: string
|
||||
exceptionFileName: string
|
||||
exceptionMethodName: string
|
||||
exceptionLineNumber: number
|
||||
processUserId: number
|
||||
processStatus: number
|
||||
processTime: string
|
||||
resultCode: number
|
||||
createTime: string
|
||||
}
|
||||
|
||||
/** 获取 API 错误日志分页列表 */
|
||||
export function getApiErrorLogPage(params: PageParam) {
|
||||
return http.get<PageResult<ApiErrorLog>>('/infra/api-error-log/page', params)
|
||||
}
|
||||
|
||||
/** 获取 API 错误日志详情 */
|
||||
export function getApiErrorLog(id: number) {
|
||||
return http.get<ApiErrorLog>(`/infra/api-error-log/get?id=${id}`)
|
||||
}
|
||||
|
||||
/** 更新 API 错误日志的处理状态 */
|
||||
export function updateApiErrorLogStatus(id: number, processStatus: number) {
|
||||
return http.put<boolean>(`/infra/api-error-log/update-status?id=${id}&processStatus=${processStatus}`)
|
||||
}
|
||||
82
src/api/infra/file/index.ts
Normal file
82
src/api/infra/file/index.ts
Normal file
@@ -0,0 +1,82 @@
|
||||
import { http } from '@/http/http'
|
||||
import { useTokenStore } from '@/store/token'
|
||||
import { useUserStore } from '@/store/user'
|
||||
|
||||
/** 文件预签名信息 */
|
||||
export interface FilePresignedUrlRespVO {
|
||||
configId: number // 配置编号
|
||||
uploadUrl: string // 文件上传 URL
|
||||
url: string // 文件访问 URL
|
||||
path: string // 文件路径
|
||||
}
|
||||
|
||||
/** 创建文件请求 */
|
||||
export interface FileCreateReqVO {
|
||||
configId: number
|
||||
url: string
|
||||
path: string
|
||||
name: string
|
||||
type?: string
|
||||
size?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件预签名地址
|
||||
*
|
||||
* @param name 文件名
|
||||
* @param directory 目录(可选)
|
||||
*/
|
||||
export function getFilePresignedUrl(name: string, directory?: string) {
|
||||
return http.get<FilePresignedUrlRespVO>('/infra/file/presigned-url', { name, directory })
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建文件记录
|
||||
*
|
||||
* @param data 文件信息
|
||||
*/
|
||||
export function createFile(data: FileCreateReqVO) {
|
||||
return http.post<string>('/infra/file/create', data)
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件到后端
|
||||
*
|
||||
* @param filePath 本地文件路径
|
||||
* @param directory 目录(可选)
|
||||
* @returns 文件访问 URL
|
||||
*/
|
||||
export function uploadFile(filePath: string, directory?: string): Promise<string> {
|
||||
const tokenStore = useTokenStore()
|
||||
const userStore = useUserStore()
|
||||
return new Promise((resolve, reject) => {
|
||||
uni.uploadFile({
|
||||
url: `${import.meta.env.VITE_SERVER_BASEURL}/infra/file/upload`,
|
||||
filePath,
|
||||
name: 'file',
|
||||
header: {
|
||||
'Accept': '*/*',
|
||||
'tenant-id': userStore.tenantId,
|
||||
'Authorization': `Bearer ${tokenStore.validToken}`,
|
||||
},
|
||||
formData: directory ? { directory } : undefined,
|
||||
success: (res) => {
|
||||
if (res.statusCode === 200) {
|
||||
const result = JSON.parse(res.data)
|
||||
if (result.code === 0) {
|
||||
resolve(result.data)
|
||||
} else {
|
||||
uni.showToast({ icon: 'none', title: result.msg || '上传失败' })
|
||||
reject(new Error(result.msg || '上传失败'))
|
||||
}
|
||||
} else {
|
||||
reject(new Error('上传失败'))
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.error('上传失败:', err)
|
||||
reject(err)
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
134
src/api/login.ts
134
src/api/login.ts
@@ -1,12 +1,68 @@
|
||||
import type { IAuthLoginRes, ICaptcha, IDoubleTokenRes, IUpdateInfo, IUpdatePassword, IUserInfoRes } from './types/login'
|
||||
import { http } from '@/http/http'
|
||||
import type {
|
||||
AuthPermissionInfo,
|
||||
IAuthLoginRes,
|
||||
ICaptcha,
|
||||
IDoubleTokenRes,
|
||||
IUpdateInfo,
|
||||
IUpdatePassword,
|
||||
IUserInfoRes,
|
||||
} from "./types/login";
|
||||
import { http } from "@/http/http";
|
||||
|
||||
/**
|
||||
* 登录表单
|
||||
*/
|
||||
export interface ILoginForm {
|
||||
username: string
|
||||
password: string
|
||||
type: "username" | "register" | "sms";
|
||||
username?: string;
|
||||
password?: string;
|
||||
nickname?: string;
|
||||
captchaVerification?: string;
|
||||
mobile?: string;
|
||||
code?: string;
|
||||
}
|
||||
|
||||
/** 账号密码登录 Request VO */
|
||||
export interface AuthLoginReqVO {
|
||||
password?: string;
|
||||
username?: string;
|
||||
captchaVerification?: string;
|
||||
// 绑定社交登录时,需要传递如下参数
|
||||
socialType?: number;
|
||||
socialCode?: string;
|
||||
socialState?: string;
|
||||
}
|
||||
|
||||
/** 注册 Request VO */
|
||||
export interface AuthRegisterReqVO {
|
||||
username: string;
|
||||
password: string;
|
||||
captchaVerification: string;
|
||||
}
|
||||
|
||||
/** 短信登录 Request VO */
|
||||
export interface AuthSmsLoginReqVO {
|
||||
mobile: string;
|
||||
code: string;
|
||||
}
|
||||
|
||||
/** 发送短信验证码 Request VO */
|
||||
export interface AuthSmsSendReqVO {
|
||||
mobile: string;
|
||||
scene: number;
|
||||
}
|
||||
|
||||
/** 租户信息 */
|
||||
export interface TenantVO {
|
||||
id: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/** 重置密码 Request VO */
|
||||
export interface AuthResetPasswordReqVO {
|
||||
mobile: string;
|
||||
code: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -14,15 +70,42 @@ export interface ILoginForm {
|
||||
* @returns ICaptcha 验证码
|
||||
*/
|
||||
export function getCode() {
|
||||
return http.get<ICaptcha>('/user/getCode')
|
||||
return http.get<ICaptcha>("/user/getCode");
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户登录
|
||||
* @param loginForm 登录表单
|
||||
*/
|
||||
export function login(loginForm: ILoginForm) {
|
||||
return http.post<IAuthLoginRes>('/auth/login', loginForm)
|
||||
/** 使用账号密码登录 */
|
||||
export function login(data: AuthLoginReqVO) {
|
||||
return http.post<IAuthLoginRes>("/system/auth/login", data);
|
||||
}
|
||||
|
||||
/** 注册用户 */
|
||||
export function register(data: AuthRegisterReqVO) {
|
||||
return http.post<IAuthLoginRes>("/system/auth/register", data);
|
||||
}
|
||||
|
||||
/** 短信登录 */
|
||||
export function smsLogin(data: AuthSmsLoginReqVO) {
|
||||
return http.post<IAuthLoginRes>("/system/auth/sms-login", data);
|
||||
}
|
||||
|
||||
/** 发送短信验证码 */
|
||||
export function sendSmsCode(data: AuthSmsSendReqVO) {
|
||||
return http.post<boolean>("/system/auth/send-sms-code", data);
|
||||
}
|
||||
|
||||
/** 获取租户简单列表 */
|
||||
export function getTenantSimpleList() {
|
||||
return http.get<TenantVO[]>("/system/tenant/simple-list");
|
||||
}
|
||||
|
||||
/** 根据租户域名获取租户信息 */
|
||||
export function getTenantByWebsite(website: string) {
|
||||
return http.get<TenantVO>(`/system/tenant/get-by-website?website=${website}`);
|
||||
}
|
||||
|
||||
/** 通过短信重置密码 */
|
||||
export function smsResetPassword(data: AuthResetPasswordReqVO) {
|
||||
return http.post<boolean>("/system/auth/reset-password", data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -30,35 +113,40 @@ export function login(loginForm: ILoginForm) {
|
||||
* @param refreshToken 刷新token
|
||||
*/
|
||||
export function refreshToken(refreshToken: string) {
|
||||
return http.post<IDoubleTokenRes>('/auth/refreshToken', { refreshToken })
|
||||
return http.post<IDoubleTokenRes>(`/system/auth/refresh-token?refreshToken=${refreshToken}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*/
|
||||
export function getUserInfo() {
|
||||
return http.get<IUserInfoRes>('/user/info')
|
||||
return http.get<IUserInfoRes>("/user/info");
|
||||
}
|
||||
|
||||
/**
|
||||
* 退出登录
|
||||
* 获取权限信息
|
||||
*/
|
||||
export function getAuthPermissionInfo() {
|
||||
return http.get<AuthPermissionInfo>("/system/auth/get-permission-info");
|
||||
}
|
||||
|
||||
/** 退出登录 */
|
||||
export function logout() {
|
||||
return http.get<void>('/auth/logout')
|
||||
return http.post<void>("/system/auth/logout");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户信息
|
||||
*/
|
||||
export function updateInfo(data: IUpdateInfo) {
|
||||
return http.post('/user/updateInfo', data)
|
||||
return http.post("/user/updateInfo", data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户密码
|
||||
*/
|
||||
export function updateUserPassword(data: IUpdatePassword) {
|
||||
return http.post('/user/updatePassword', data)
|
||||
return http.post("/user/updatePassword", data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,11 +156,11 @@ export function updateUserPassword(data: IUpdatePassword) {
|
||||
export function getWxCode() {
|
||||
return new Promise<UniApp.LoginRes>((resolve, reject) => {
|
||||
uni.login({
|
||||
provider: 'weixin',
|
||||
success: res => resolve(res),
|
||||
fail: err => reject(new Error(err)),
|
||||
})
|
||||
})
|
||||
provider: "weixin",
|
||||
success: (res) => resolve(res),
|
||||
fail: (err) => reject(new Error(err)),
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,5 +169,5 @@ export function getWxCode() {
|
||||
* @returns Promise 包含登录结果
|
||||
*/
|
||||
export function wxLogin(data: { code: string }) {
|
||||
return http.post<IAuthLoginRes>('/auth/wxLogin', data)
|
||||
return http.post<IAuthLoginRes>("/auth/wxLogin", data);
|
||||
}
|
||||
|
||||
45
src/api/system/dept/index.ts
Normal file
45
src/api/system/dept/index.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
import { http } from '@/http/http'
|
||||
|
||||
/** 部门信息 */
|
||||
export interface Dept {
|
||||
id?: number
|
||||
name: string
|
||||
parentId: number
|
||||
status: number
|
||||
sort: number
|
||||
leaderUserId?: number
|
||||
phone?: string
|
||||
email?: string
|
||||
createTime?: string
|
||||
children?: Dept[]
|
||||
}
|
||||
|
||||
/** 获取部门列表 */
|
||||
export function getDeptList(params?: { name?: string; status?: number }) {
|
||||
return http.get<Dept[]>('/system/dept/list', params)
|
||||
}
|
||||
|
||||
/** 获取部门精简列表 */
|
||||
export function getSimpleDeptList() {
|
||||
return http.get<Dept[]>('/system/dept/simple-list')
|
||||
}
|
||||
|
||||
/** 获取部门详情 */
|
||||
export function getDept(id: number) {
|
||||
return http.get<Dept>(`/system/dept/get?id=${id}`)
|
||||
}
|
||||
|
||||
/** 创建部门 */
|
||||
export function createDept(data: Dept) {
|
||||
return http.post<number>('/system/dept/create', data)
|
||||
}
|
||||
|
||||
/** 更新部门 */
|
||||
export function updateDept(data: Dept) {
|
||||
return http.put<boolean>('/system/dept/update', data)
|
||||
}
|
||||
|
||||
/** 删除部门 */
|
||||
export function deleteDept(id: number) {
|
||||
return http.delete<boolean>(`/system/dept/delete?id=${id}`)
|
||||
}
|
||||
20
src/api/system/dict/data/index.ts
Normal file
20
src/api/system/dict/data/index.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { http } from '@/http/http'
|
||||
|
||||
/** 字典数据 */
|
||||
export interface DictData {
|
||||
id?: number
|
||||
dictType: string
|
||||
label: string
|
||||
value: string
|
||||
colorType?: string
|
||||
cssClass?: string
|
||||
sort?: number
|
||||
status: number
|
||||
remark?: string
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
/** 查询字典数据(精简)列表 */
|
||||
export function getSimpleDictDataList() {
|
||||
return http.get<DictData[]>('/system/dict-data/simple-list')
|
||||
}
|
||||
51
src/api/system/menu/index.ts
Normal file
51
src/api/system/menu/index.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import { http } from '@/http/http'
|
||||
|
||||
/** 菜单信息 */
|
||||
export interface Menu {
|
||||
id?: number
|
||||
name: string
|
||||
permission: string
|
||||
type: number
|
||||
sort: number
|
||||
parentId: number
|
||||
path: string
|
||||
icon: string
|
||||
component: string
|
||||
componentName?: string
|
||||
status: number
|
||||
visible: boolean
|
||||
keepAlive: boolean
|
||||
alwaysShow?: boolean
|
||||
createTime?: string
|
||||
children?: Menu[]
|
||||
}
|
||||
|
||||
/** 获取菜单列表 */
|
||||
export function getMenuList(params?: { name?: string, status?: number }) {
|
||||
return http.get<Menu[]>('/system/menu/list', params)
|
||||
}
|
||||
|
||||
/** 获取菜单精简列表 */
|
||||
export function getSimpleMenuList() {
|
||||
return http.get<Menu[]>('/system/menu/simple-list')
|
||||
}
|
||||
|
||||
/** 获取菜单详情 */
|
||||
export function getMenu(id: number) {
|
||||
return http.get<Menu>(`/system/menu/get?id=${id}`)
|
||||
}
|
||||
|
||||
/** 创建菜单 */
|
||||
export function createMenu(data: Menu) {
|
||||
return http.post<number>('/system/menu/create', data)
|
||||
}
|
||||
|
||||
/** 更新菜单 */
|
||||
export function updateMenu(data: Menu) {
|
||||
return http.put<boolean>('/system/menu/update', data)
|
||||
}
|
||||
|
||||
/** 删除菜单 */
|
||||
export function deleteMenu(id: number) {
|
||||
return http.delete<boolean>(`/system/menu/delete?id=${id}`)
|
||||
}
|
||||
39
src/api/system/notify/index.ts
Normal file
39
src/api/system/notify/index.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import type { PageParam, PageResult } from '@/http/types'
|
||||
import { http } from '@/http/http'
|
||||
|
||||
/** 站内信消息 */
|
||||
export interface NotifyMessage {
|
||||
id: number
|
||||
userId: number
|
||||
userType: number
|
||||
templateId: number
|
||||
templateCode: string
|
||||
templateNickname: string
|
||||
templateContent: string
|
||||
templateType: number
|
||||
templateParams: string
|
||||
readStatus: boolean
|
||||
readTime: string
|
||||
createTime: string
|
||||
}
|
||||
|
||||
/** 获取我的站内信分页 */
|
||||
export function getMyNotifyMessagePage(params: PageParam) {
|
||||
return http.get<PageResult<NotifyMessage>>('/system/notify-message/my-page', params)
|
||||
}
|
||||
|
||||
/** 批量标记站内信已读 */
|
||||
export function updateNotifyMessageRead(ids: number | number[]) {
|
||||
const idsArray = Array.isArray(ids) ? ids : [ids]
|
||||
return http.put<boolean>('/system/notify-message/update-read', undefined, { ids: idsArray })
|
||||
}
|
||||
|
||||
/** 标记所有站内信为已读 */
|
||||
export function updateAllNotifyMessageRead() {
|
||||
return http.put<boolean>('/system/notify-message/update-all-read')
|
||||
}
|
||||
|
||||
/** 获取当前用户的未读站内信数量 */
|
||||
export function getUnreadNotifyMessageCount() {
|
||||
return http.get<number>('/system/notify-message/get-unread-count')
|
||||
}
|
||||
43
src/api/system/post/index.ts
Normal file
43
src/api/system/post/index.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import type { PageParam, PageResult } from '@/http/types'
|
||||
import { http } from '@/http/http'
|
||||
|
||||
/** 岗位信息 */
|
||||
export interface Post {
|
||||
id?: number
|
||||
name: string
|
||||
code: string
|
||||
sort: number
|
||||
status: number
|
||||
remark?: string
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
/** 获取岗位分页列表 */
|
||||
export function getPostPage(params: PageParam) {
|
||||
return http.get<PageResult<Post>>('/system/post/page', params)
|
||||
}
|
||||
|
||||
/** 获取岗位精简列表 */
|
||||
export function getSimplePostList() {
|
||||
return http.get<Post[]>('/system/post/simple-list')
|
||||
}
|
||||
|
||||
/** 获取岗位详情 */
|
||||
export function getPost(id: number) {
|
||||
return http.get<Post>(`/system/post/get?id=${id}`)
|
||||
}
|
||||
|
||||
/** 创建岗位 */
|
||||
export function createPost(data: Post) {
|
||||
return http.post<number>('/system/post/create', data)
|
||||
}
|
||||
|
||||
/** 更新岗位 */
|
||||
export function updatePost(data: Post) {
|
||||
return http.put<boolean>('/system/post/update', data)
|
||||
}
|
||||
|
||||
/** 删除岗位 */
|
||||
export function deletePost(id: number) {
|
||||
return http.delete<boolean>(`/system/post/delete?id=${id}`)
|
||||
}
|
||||
46
src/api/system/role/index.ts
Normal file
46
src/api/system/role/index.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { http } from '@/http/http'
|
||||
import { PageParam, PageResult } from '@/http/types';
|
||||
|
||||
/** 角色信息 */
|
||||
export interface Role {
|
||||
id: number
|
||||
name: string
|
||||
code: string
|
||||
sort: number
|
||||
status: number
|
||||
type?: number
|
||||
remark?: string
|
||||
dataScope?: number
|
||||
dataScopeDeptIds?: number[]
|
||||
createTime: string
|
||||
}
|
||||
|
||||
/** 获取角色分页列表 */
|
||||
export function getRolePage(params: PageParam) {
|
||||
return http.get<PageResult<Role>>('/system/role/page', params)
|
||||
}
|
||||
|
||||
/** 获取角色详情 */
|
||||
export function getRole(id: number) {
|
||||
return http.get<Role>(`/system/role/get?id=${id}`)
|
||||
}
|
||||
|
||||
/** 创建角色 */
|
||||
export function createRole(data: Role) {
|
||||
return http.post<number>('/system/role/create', data)
|
||||
}
|
||||
|
||||
/** 更新角色 */
|
||||
export function updateRole(data: Role) {
|
||||
return http.put<boolean>('/system/role/update', data)
|
||||
}
|
||||
|
||||
/** 删除角色 */
|
||||
export function deleteRole(id: number) {
|
||||
return http.delete<boolean>(`/system/role/delete?id=${id}`)
|
||||
}
|
||||
|
||||
/** 获取角色精简列表 */
|
||||
export function getSimpleRoleList() {
|
||||
return http.get<Role[]>('/system/role/simple-list')
|
||||
}
|
||||
72
src/api/system/user/index.ts
Normal file
72
src/api/system/user/index.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
import type { PageParam, PageResult } from '@/http/types'
|
||||
import { http } from '@/http/http'
|
||||
|
||||
/** 用户信息 */
|
||||
export interface User {
|
||||
id?: number
|
||||
username: string
|
||||
nickname: string
|
||||
password?: string
|
||||
deptId?: number
|
||||
deptName?: string
|
||||
postIds?: number[]
|
||||
email?: string
|
||||
mobile?: string
|
||||
sex?: number
|
||||
avatar?: string
|
||||
status: number
|
||||
remark?: string
|
||||
loginIp?: string
|
||||
loginDate?: string
|
||||
createTime?: string
|
||||
}
|
||||
|
||||
/** 获取用户分页列表 */
|
||||
export function getUserPage(params: PageParam) {
|
||||
return http.get<PageResult<User>>('/system/user/page', params)
|
||||
}
|
||||
|
||||
/** 获取用户详情 */
|
||||
export function getUser(id: number) {
|
||||
return http.get<User>(`/system/user/get?id=${id}`)
|
||||
}
|
||||
|
||||
/** 创建用户 */
|
||||
export function createUser(data: User) {
|
||||
return http.post<number>('/system/user/create', data)
|
||||
}
|
||||
|
||||
/** 更新用户 */
|
||||
export function updateUser(data: User) {
|
||||
return http.put<boolean>('/system/user/update', data)
|
||||
}
|
||||
|
||||
/** 删除用户 */
|
||||
export function deleteUser(id: number) {
|
||||
return http.delete<boolean>(`/system/user/delete?id=${id}`)
|
||||
}
|
||||
|
||||
/** 重置用户密码 */
|
||||
export function resetUserPassword(id: number, password: string) {
|
||||
return http.put<boolean>('/system/user/update-password', { id, password })
|
||||
}
|
||||
|
||||
/** 修改用户状态 */
|
||||
export function updateUserStatus(id: number, status: number) {
|
||||
return http.put<boolean>('/system/user/update-status', { id, status })
|
||||
}
|
||||
|
||||
/** 获取用户拥有的角色列表 */
|
||||
export function getUserRoleIds(userId: number) {
|
||||
return http.get<number[]>(`/system/permission/list-user-roles?userId=${userId}`)
|
||||
}
|
||||
|
||||
/** 分配用户角色 */
|
||||
export function assignUserRole(userId: number, roleIds: number[]) {
|
||||
return http.post<boolean>('/system/permission/assign-user-role', { userId, roleIds })
|
||||
}
|
||||
|
||||
/** 获取用户精简列表 */
|
||||
export function getSimpleUserList() {
|
||||
return http.get<User[]>('/system/user/simple-list')
|
||||
}
|
||||
48
src/api/system/user/profile/index.ts
Normal file
48
src/api/system/user/profile/index.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { http } from '@/http/http'
|
||||
|
||||
/** 用户个人中心信息 */
|
||||
export interface UserProfileVO {
|
||||
id: number
|
||||
username: string
|
||||
nickname: string
|
||||
email?: string
|
||||
mobile?: string
|
||||
sex?: number
|
||||
avatar?: string
|
||||
loginIp: string
|
||||
loginDate: string
|
||||
createTime: string
|
||||
roles: { id: number, name: string }[]
|
||||
dept: { id: number, name: string }
|
||||
posts: { id: number, name: string }[]
|
||||
}
|
||||
|
||||
/** 更新个人信息请求 */
|
||||
export interface UpdateProfileReqVO {
|
||||
nickname?: string
|
||||
email?: string
|
||||
mobile?: string
|
||||
sex?: number
|
||||
avatar?: string
|
||||
}
|
||||
|
||||
/** 更新密码请求 */
|
||||
export interface UpdatePasswordReqVO {
|
||||
oldPassword: string
|
||||
newPassword: string
|
||||
}
|
||||
|
||||
/** 获取登录用户个人信息 */
|
||||
export function getUserProfile() {
|
||||
return http.get<UserProfileVO>('/system/user/profile/get')
|
||||
}
|
||||
|
||||
/** 修改用户个人信息 */
|
||||
export function updateUserProfile(data: UpdateProfileReqVO) {
|
||||
return http.put<boolean>('/system/user/profile/update', data)
|
||||
}
|
||||
|
||||
/** 修改用户个人密码 */
|
||||
export function updateUserPassword(data: UpdatePasswordReqVO) {
|
||||
return http.put<boolean>('/system/user/profile/update-password', data)
|
||||
}
|
||||
@@ -11,8 +11,9 @@ export interface ISingleTokenRes {
|
||||
export interface IDoubleTokenRes {
|
||||
accessToken: string
|
||||
refreshToken: string
|
||||
accessExpiresIn: number // 访问令牌有效期(秒)
|
||||
refreshExpiresIn: number // 刷新令牌有效期(秒)
|
||||
// accessExpiresIn: number // 访问令牌有效期(秒)
|
||||
// refreshExpiresIn: number // 刷新令牌有效期(秒)
|
||||
expiresTime: number // 访问令牌过期时间,单位:毫秒
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -31,7 +32,18 @@ export interface IUserInfoRes {
|
||||
[key: string]: any // 允许其他扩展字段
|
||||
}
|
||||
|
||||
/**
|
||||
* 权限信息
|
||||
*/
|
||||
export interface AuthPermissionInfo {
|
||||
user: IUserInfoRes;
|
||||
roles: string[];
|
||||
permissions: string[];
|
||||
// menus: AppRouteRecordRaw[]; // add by 芋艿:暂时用不到
|
||||
}
|
||||
|
||||
// 认证存储数据结构
|
||||
// TODO @芋艿:可以考虑删除
|
||||
export interface AuthStorage {
|
||||
mode: AuthMode
|
||||
tokens: ISingleTokenRes | IDoubleTokenRes
|
||||
|
||||
Reference in New Issue
Block a user