refactor: ♻️ 字典重构,系统权限模块优化
This commit is contained in:
72
src/api/auth.ts
Normal file
72
src/api/auth.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
const AUTH_BASE_URL = "/api/v1/auth";
|
||||
|
||||
class AuthAPI {
|
||||
/** 登录 接口*/
|
||||
static login(data: LoginData) {
|
||||
const formData = new FormData();
|
||||
formData.append("username", data.username);
|
||||
formData.append("password", data.password);
|
||||
formData.append("captchaKey", data.captchaKey);
|
||||
formData.append("captchaCode", data.captchaCode);
|
||||
return request<any, LoginResult>({
|
||||
url: `${AUTH_BASE_URL}/login`,
|
||||
method: "post",
|
||||
data: formData,
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/** 注销 接口*/
|
||||
static logout() {
|
||||
return request({
|
||||
url: `${AUTH_BASE_URL}/logout`,
|
||||
method: "delete",
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取验证码 接口*/
|
||||
static getCaptcha() {
|
||||
return request<any, CaptchaResult>({
|
||||
url: `${AUTH_BASE_URL}/captcha`,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default AuthAPI;
|
||||
|
||||
/** 登录请求参数 */
|
||||
export interface LoginData {
|
||||
/** 用户名 */
|
||||
username: string;
|
||||
/** 密码 */
|
||||
password: string;
|
||||
/** 验证码缓存key */
|
||||
captchaKey: string;
|
||||
/** 验证码 */
|
||||
captchaCode: string;
|
||||
}
|
||||
|
||||
/** 登录响应 */
|
||||
export interface LoginResult {
|
||||
/** 访问token */
|
||||
accessToken?: string;
|
||||
/** 过期时间(单位:毫秒) */
|
||||
expires?: number;
|
||||
/** 刷新token */
|
||||
refreshToken?: string;
|
||||
/** token 类型 */
|
||||
tokenType?: string;
|
||||
}
|
||||
|
||||
/** 验证码响应 */
|
||||
export interface CaptchaResult {
|
||||
/** 验证码缓存key */
|
||||
captchaKey: string;
|
||||
/** 验证码图片Base64字符串 */
|
||||
captchaBase64: string;
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
import request from "@/utils/request";
|
||||
import { CaptchaResult, LoginData, LoginResult } from "./model";
|
||||
|
||||
const AUTH_BASE_URL = "/api/v1/auth";
|
||||
|
||||
class AuthAPI {
|
||||
/**
|
||||
* 登录API
|
||||
*
|
||||
* @param data 登录数据
|
||||
* @returns 登录结果
|
||||
*/
|
||||
static login(data: LoginData) {
|
||||
const formData = new FormData();
|
||||
formData.append("username", data.username);
|
||||
formData.append("password", data.password);
|
||||
formData.append("captchaKey", data.captchaKey || "");
|
||||
formData.append("captchaCode", data.captchaCode || "");
|
||||
return request<any, LoginResult>({
|
||||
url: `${AUTH_BASE_URL}/login`,
|
||||
method: "post",
|
||||
data: formData,
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 注销API
|
||||
*
|
||||
* @returns 请求结果
|
||||
*/
|
||||
static logout() {
|
||||
return request({
|
||||
url: `${AUTH_BASE_URL}/logout`,
|
||||
method: "delete",
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取验证码
|
||||
*
|
||||
* @returns 验证码结果
|
||||
*/
|
||||
static getCaptcha() {
|
||||
return request<any, CaptchaResult>({
|
||||
url: `${AUTH_BASE_URL}/captcha`,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default AuthAPI;
|
||||
@@ -1,59 +0,0 @@
|
||||
/**
|
||||
* 登录请求参数
|
||||
*/
|
||||
export interface LoginData {
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
username: string;
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
password: string;
|
||||
|
||||
/**
|
||||
* 验证码缓存key
|
||||
*/
|
||||
captchaKey?: string;
|
||||
|
||||
/**
|
||||
* 验证码
|
||||
*/
|
||||
captchaCode?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录响应
|
||||
*/
|
||||
export interface LoginResult {
|
||||
/**
|
||||
* 访问token
|
||||
*/
|
||||
accessToken?: string;
|
||||
/**
|
||||
* 过期时间(单位:毫秒)
|
||||
*/
|
||||
expires?: number;
|
||||
/**
|
||||
* 刷新token
|
||||
*/
|
||||
refreshToken?: string;
|
||||
/**
|
||||
* token 类型
|
||||
*/
|
||||
tokenType?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证码响应
|
||||
*/
|
||||
export interface CaptchaResult {
|
||||
/**
|
||||
* 验证码缓存key
|
||||
*/
|
||||
captchaKey: string;
|
||||
/**
|
||||
* 验证码图片Base64字符串
|
||||
*/
|
||||
captchaBase64: string;
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
import request from "@/utils/request";
|
||||
import { DeptForm, DeptQuery, DeptVO } from "./model";
|
||||
|
||||
const DEPT_BASE_URL = "/api/v1/dept";
|
||||
|
||||
class DeptAPI {
|
||||
/**
|
||||
* 获取部门树形表格列表
|
||||
* 获取部门列表
|
||||
*
|
||||
* @param queryParams 查询参数(可选)
|
||||
* @returns 部门树形表格数据
|
||||
@@ -18,11 +17,7 @@ class DeptAPI {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门下拉列表选项
|
||||
*
|
||||
* @returns 部门下拉列表选项
|
||||
*/
|
||||
/** 获取部门下拉列表 */
|
||||
static getOptions() {
|
||||
return request<any, OptionType[]>({
|
||||
url: `${DEPT_BASE_URL}/options`,
|
||||
@@ -87,3 +82,47 @@ class DeptAPI {
|
||||
}
|
||||
|
||||
export default DeptAPI;
|
||||
|
||||
/** 部门查询参数 */
|
||||
export interface DeptQuery {
|
||||
/** 搜索关键字 */
|
||||
keywords?: string;
|
||||
/** 状态 */
|
||||
status?: number;
|
||||
}
|
||||
|
||||
/** 部门类型 */
|
||||
export interface DeptVO {
|
||||
/** 子部门 */
|
||||
children?: DeptVO[];
|
||||
/** 创建时间 */
|
||||
createTime?: Date;
|
||||
/** 部门ID */
|
||||
id?: number;
|
||||
/** 部门名称 */
|
||||
name?: string;
|
||||
/** 部门编号 */
|
||||
code?: string;
|
||||
/** 父部门ID */
|
||||
parentId?: number;
|
||||
/** 排序 */
|
||||
sort?: number;
|
||||
/** 状态(1:启用;0:禁用) */
|
||||
status?: number;
|
||||
/** 修改时间 */
|
||||
updateTime?: Date;
|
||||
}
|
||||
|
||||
/** 部门表单类型 */
|
||||
export interface DeptForm {
|
||||
/** 部门ID(新增不填) */
|
||||
id?: number;
|
||||
/** 部门名称 */
|
||||
name?: string;
|
||||
/** 父部门ID */
|
||||
parentId: number;
|
||||
/** 排序 */
|
||||
sort?: number;
|
||||
/** 状态(1:启用;0:禁用) */
|
||||
status?: number;
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/**
|
||||
* 部门查询参数
|
||||
*/
|
||||
export interface DeptQuery {
|
||||
keywords?: string;
|
||||
status?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门类型
|
||||
*/
|
||||
export interface DeptVO {
|
||||
/**
|
||||
* 子部门
|
||||
*/
|
||||
children?: DeptVO[];
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
createTime?: Date;
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
id?: number;
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* 父部门ID
|
||||
*/
|
||||
parentId?: number;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
sort?: number;
|
||||
/**
|
||||
* 状态(1:启用;0:禁用)
|
||||
*/
|
||||
status?: number;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
updateTime?: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门表单类型
|
||||
*/
|
||||
export interface DeptForm {
|
||||
/**
|
||||
* 部门ID(新增不填)
|
||||
*/
|
||||
id?: number;
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* 父部门ID
|
||||
*/
|
||||
parentId: number;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
sort?: number;
|
||||
/**
|
||||
* 状态(1:启用;0:禁用)
|
||||
*/
|
||||
status?: number;
|
||||
}
|
||||
183
src/api/dict.ts
Normal file
183
src/api/dict.ts
Normal file
@@ -0,0 +1,183 @@
|
||||
import request from "@/utils/request";
|
||||
|
||||
const DICT_BASE_URL = "/api/v1/dict";
|
||||
|
||||
class DictAPI {
|
||||
/**
|
||||
* 获取字典分页列表
|
||||
*
|
||||
* @param queryParams 查询参数
|
||||
* @returns 字典分页结果
|
||||
*/
|
||||
static getPage(queryParams: DictPageQuery) {
|
||||
return request<any, PageResult<DictPageVO[]>>({
|
||||
url: `${DICT_BASE_URL}/page`,
|
||||
method: "get",
|
||||
params: queryParams,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典表单数据
|
||||
*
|
||||
* @param id 字典ID
|
||||
* @returns 字典表单数据
|
||||
*/
|
||||
static getFormData(id: number) {
|
||||
return request<any, ResponseData<DictForm>>({
|
||||
url: `${DICT_BASE_URL}/${id}/form`,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典
|
||||
*
|
||||
* @param data 字典表单数据
|
||||
* @returns 请求结果
|
||||
*/
|
||||
static add(data: DictForm) {
|
||||
return request({
|
||||
url: `${DICT_BASE_URL}`,
|
||||
method: "post",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典
|
||||
*
|
||||
* @param id 字典ID
|
||||
* @param data 字典表单数据
|
||||
* @returns 请求结果
|
||||
*/
|
||||
static update(id: number, data: DictForm) {
|
||||
return request({
|
||||
url: `${DICT_BASE_URL}/${id}`,
|
||||
method: "put",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典
|
||||
*
|
||||
* @param ids 字典ID,多个以英文逗号(,)分隔
|
||||
* @returns 请求结果
|
||||
*/
|
||||
static deleteByIds(ids: string) {
|
||||
return request({
|
||||
url: `${DICT_BASE_URL}/${ids}`,
|
||||
method: "delete",
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典的数据项
|
||||
*
|
||||
* @param typeCode 字典编码
|
||||
* @returns 字典数据项
|
||||
*/
|
||||
static getOptions(code: string) {
|
||||
return request<any, OptionType[]>({
|
||||
url: `${DICT_BASE_URL}/${code}/options`,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default DictAPI;
|
||||
|
||||
/**
|
||||
* 字典查询参数
|
||||
*/
|
||||
export interface DictPageQuery extends PageQuery {
|
||||
/**
|
||||
* 关键字(字典名称/编码)
|
||||
*/
|
||||
keywords?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 字典分页对象
|
||||
*/
|
||||
export interface DictPageVO {
|
||||
/**
|
||||
* 字典ID
|
||||
*/
|
||||
id: number;
|
||||
/**
|
||||
* 字典名称
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* 字典编码
|
||||
*/
|
||||
code: string;
|
||||
/**
|
||||
* 字典状态(1-启用,0-禁用)
|
||||
*/
|
||||
status: number;
|
||||
/**
|
||||
* 字典项列表
|
||||
*/
|
||||
dictItems: DictItem[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 字典项
|
||||
*/
|
||||
export interface DictItem {
|
||||
/**
|
||||
* 字典项ID
|
||||
*/
|
||||
id?: number;
|
||||
/**
|
||||
* 字典项名称
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* 字典项值
|
||||
*/
|
||||
value?: string;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
sort?: number;
|
||||
/**
|
||||
* 状态(1-启用,0-禁用)
|
||||
*/
|
||||
status?: number;
|
||||
}
|
||||
|
||||
// TypeScript 类型声明
|
||||
|
||||
/**
|
||||
* 字典
|
||||
*/
|
||||
export interface DictForm {
|
||||
/**
|
||||
* 字典ID
|
||||
*/
|
||||
id?: number;
|
||||
/**
|
||||
* 字典名称
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* 字典编码
|
||||
*/
|
||||
code?: string;
|
||||
/**
|
||||
* 字典状态(1-启用,0-禁用)
|
||||
*/
|
||||
status?: number;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark?: string;
|
||||
/**
|
||||
* 字典数据项列表
|
||||
*/
|
||||
dictItems?: DictItem[];
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
import request from "@/utils/request";
|
||||
import {
|
||||
DictTypeQuery,
|
||||
DictTypePageResult,
|
||||
DictTypeForm,
|
||||
DictQuery,
|
||||
DictForm,
|
||||
DictPageResult,
|
||||
} from "./model";
|
||||
|
||||
const DICT_BASE_URL = "/api/v1/dict";
|
||||
|
||||
class DictAPI {
|
||||
/**
|
||||
* 获取字典类型分页列表
|
||||
*
|
||||
* @param queryParams 查询参数
|
||||
* @returns 字典类型分页结果
|
||||
*/
|
||||
static getDictTypePage(queryParams: DictTypeQuery) {
|
||||
return request<any, DictTypePageResult>({
|
||||
url: `${DICT_BASE_URL}/types/page`,
|
||||
method: "get",
|
||||
params: queryParams,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典类型表单数据
|
||||
*
|
||||
* @param id 字典类型ID
|
||||
* @returns 字典类型表单数据
|
||||
*/
|
||||
static getDictTypeForm(id: number) {
|
||||
return request<any, ResponseData<DictTypeForm>>({
|
||||
url: `${DICT_BASE_URL}/types/${id}/form`,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*
|
||||
* @param data 字典类型表单数据
|
||||
* @returns 请求结果
|
||||
*/
|
||||
static addDictType(data: DictTypeForm) {
|
||||
return request({
|
||||
url: `${DICT_BASE_URL}/types`,
|
||||
method: "post",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典类型
|
||||
*
|
||||
* @param id 字典类型ID
|
||||
* @param data 字典类型表单数据
|
||||
* @returns 请求结果
|
||||
*/
|
||||
static updateDictType(id: number, data: DictTypeForm) {
|
||||
return request({
|
||||
url: `${DICT_BASE_URL}/types/${id}`,
|
||||
method: "put",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典类型
|
||||
*
|
||||
* @param ids 字典类型ID,多个以英文逗号(,)分隔
|
||||
* @returns 请求结果
|
||||
*/
|
||||
static deleteDictTypes(ids: string) {
|
||||
return request({
|
||||
url: `${DICT_BASE_URL}/types/${ids}`,
|
||||
method: "delete",
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典类型的数据项
|
||||
*
|
||||
* @param typeCode 字典类型编码
|
||||
* @returns 字典类型的数据项
|
||||
*/
|
||||
static getDictOptions(typeCode: string) {
|
||||
return request<any, OptionType[]>({
|
||||
url: `${DICT_BASE_URL}/${typeCode}/options`,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典分页列表
|
||||
*
|
||||
* @param queryParams 查询参数
|
||||
* @returns 字典分页结果
|
||||
*/
|
||||
static getDictPage(queryParams: DictQuery) {
|
||||
return request<any, DictPageResult>({
|
||||
url: `${DICT_BASE_URL}/page`,
|
||||
method: "get",
|
||||
params: queryParams,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典表单数据
|
||||
*
|
||||
* @param id 字典项ID
|
||||
* @returns 字典表单数据
|
||||
*/
|
||||
static getDictFormData(id: number) {
|
||||
return request<any, DictForm>({
|
||||
url: `${DICT_BASE_URL}/${id}/form`,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典
|
||||
*
|
||||
* @param data 字典表单数据
|
||||
* @returns 请求结果
|
||||
*/
|
||||
static addDict(data: DictForm) {
|
||||
return request({
|
||||
url: `${DICT_BASE_URL}`,
|
||||
method: "post",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典项
|
||||
*
|
||||
* @param id 字典项ID
|
||||
* @param data 字典表单数据
|
||||
* @returns 请求结果
|
||||
*/
|
||||
static updateDict(id: number, data: DictForm) {
|
||||
return request({
|
||||
url: `${DICT_BASE_URL}/${id}`,
|
||||
method: "put",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典
|
||||
*
|
||||
* @param ids 字典项ID,多个以英文逗号(,)分隔
|
||||
* @returns 请求结果
|
||||
*/
|
||||
static deleteDictByIds(ids: string) {
|
||||
return request({
|
||||
url: `${DICT_BASE_URL}/${ids}`,
|
||||
method: "delete",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default DictAPI;
|
||||
@@ -1,142 +0,0 @@
|
||||
/**
|
||||
* 字典类型查询参数
|
||||
*/
|
||||
export interface DictTypeQuery extends PageQuery {
|
||||
/**
|
||||
* 关键字(字典类型名称/编码)
|
||||
*/
|
||||
keywords?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 字典类型分页对象
|
||||
*/
|
||||
export interface DictTypePageVO {
|
||||
/**
|
||||
* 字典类型ID
|
||||
*/
|
||||
id: number;
|
||||
/**
|
||||
* 类型编码
|
||||
*/
|
||||
code: string;
|
||||
/**
|
||||
* 类型名称
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* 状态(1:启用;0:禁用)
|
||||
*/
|
||||
status?: number;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 字典分页项类型声明
|
||||
*/
|
||||
export type DictTypePageResult = PageResult<DictTypePageVO[]>;
|
||||
|
||||
/**
|
||||
* 字典表单类型声明
|
||||
*/
|
||||
export interface DictTypeForm {
|
||||
/**
|
||||
* 字典类型ID
|
||||
*/
|
||||
id?: number;
|
||||
/**
|
||||
* 类型名称
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* 类型编码
|
||||
*/
|
||||
code?: string;
|
||||
/**
|
||||
* 类型状态:1:启用;0:禁用
|
||||
*/
|
||||
status: number;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 字典查询参数
|
||||
*/
|
||||
export interface DictQuery extends PageQuery {
|
||||
/**
|
||||
* 字典项名称
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* 字典类型编码
|
||||
*/
|
||||
typeCode?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 字典分页对象
|
||||
*/
|
||||
export interface DictPageVO {
|
||||
/**
|
||||
* 字典ID
|
||||
*/
|
||||
id?: number;
|
||||
/**
|
||||
* 字典名称
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* 状态(1:启用;0:禁用)
|
||||
*/
|
||||
status?: number;
|
||||
/**
|
||||
* 字典值
|
||||
*/
|
||||
value?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 字典分页
|
||||
*/
|
||||
export type DictPageResult = PageResult<DictPageVO[]>;
|
||||
|
||||
/**
|
||||
* 字典表单
|
||||
*/
|
||||
export interface DictForm {
|
||||
/**
|
||||
* 字典ID
|
||||
*/
|
||||
id?: number;
|
||||
/**
|
||||
* 字典名称
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
sort?: number;
|
||||
/**
|
||||
* 状态(1:启用;0:禁用)
|
||||
*/
|
||||
status?: number;
|
||||
/**
|
||||
* 类型编码
|
||||
*/
|
||||
typeCode?: string;
|
||||
/**
|
||||
* 值
|
||||
*/
|
||||
value?: string;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
remark?: string;
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
import request from "@/utils/request";
|
||||
import { FileInfo } from "./model";
|
||||
|
||||
class FileAPI {
|
||||
/**
|
||||
@@ -35,3 +34,13 @@ class FileAPI {
|
||||
}
|
||||
|
||||
export default FileAPI;
|
||||
|
||||
/**
|
||||
* 文件API类型声明
|
||||
*/
|
||||
export interface FileInfo {
|
||||
/** 文件名 */
|
||||
name: string;
|
||||
/** 文件路径 */
|
||||
url: string;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
/**
|
||||
* 文件API类型声明
|
||||
*/
|
||||
export interface FileInfo {
|
||||
name: string;
|
||||
url: string;
|
||||
}
|
||||
209
src/api/menu.ts
Normal file
209
src/api/menu.ts
Normal file
@@ -0,0 +1,209 @@
|
||||
import request from "@/utils/request";
|
||||
// 菜单基础URL
|
||||
const MENU_BASE_URL = "/api/v1/menus";
|
||||
|
||||
class MenuAPI {
|
||||
/**
|
||||
* 获取路由列表
|
||||
*
|
||||
* @returns 路由列表
|
||||
*/
|
||||
static getRoutes() {
|
||||
return request<any, RouteVO[]>({
|
||||
url: `${MENU_BASE_URL}/routes`,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单树形列表
|
||||
*
|
||||
* @param queryParams 查询参数
|
||||
* @returns 菜单树形列表
|
||||
*/
|
||||
static getList(queryParams: MenuQuery) {
|
||||
return request<any, MenuVO[]>({
|
||||
url: `${MENU_BASE_URL}`,
|
||||
method: "get",
|
||||
params: queryParams,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单下拉数据源
|
||||
*
|
||||
* @returns 菜单下拉数据源
|
||||
*/
|
||||
static getOptions() {
|
||||
return request<any, OptionType[]>({
|
||||
url: `${MENU_BASE_URL}/options`,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单表单数据
|
||||
*
|
||||
* @param id 菜单ID
|
||||
* @returns 菜单表单数据
|
||||
*/
|
||||
static getFormData(id: number) {
|
||||
return request<any, MenuForm>({
|
||||
url: `${MENU_BASE_URL}/${id}/form`,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加菜单
|
||||
*
|
||||
* @param data 菜单表单数据
|
||||
* @returns 请求结果
|
||||
*/
|
||||
static add(data: MenuForm) {
|
||||
return request({
|
||||
url: `${MENU_BASE_URL}`,
|
||||
method: "post",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改菜单
|
||||
*
|
||||
* @param id 菜单ID
|
||||
* @param data 菜单表单数据
|
||||
* @returns 请求结果
|
||||
*/
|
||||
static update(id: string, data: MenuForm) {
|
||||
return request({
|
||||
url: `${MENU_BASE_URL}/${id}`,
|
||||
method: "put",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
*
|
||||
* @param id 菜单ID
|
||||
* @returns 请求结果
|
||||
*/
|
||||
static deleteById(id: number) {
|
||||
return request({
|
||||
url: `${MENU_BASE_URL}/${id}`,
|
||||
method: "delete",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default MenuAPI;
|
||||
|
||||
import { MenuTypeEnum } from "@/enums/MenuTypeEnum";
|
||||
|
||||
/** 菜单查询参数 */
|
||||
export interface MenuQuery {
|
||||
/** 搜索关键字 */
|
||||
keywords?: string;
|
||||
}
|
||||
|
||||
/** 菜单视图对象 */
|
||||
export interface MenuVO {
|
||||
/** 子菜单 */
|
||||
children?: MenuVO[];
|
||||
/** 组件路径 */
|
||||
component?: string;
|
||||
/** ICON */
|
||||
icon?: string;
|
||||
/** 菜单ID */
|
||||
id?: number;
|
||||
/** 菜单名称 */
|
||||
name?: string;
|
||||
/** 父菜单ID */
|
||||
parentId?: number;
|
||||
/** 按钮权限标识 */
|
||||
perm?: string;
|
||||
/** 跳转路径 */
|
||||
redirect?: string;
|
||||
/** 路由名称 */
|
||||
routeName?: string;
|
||||
/** 路由相对路径 */
|
||||
routePath?: string;
|
||||
/** 菜单排序(数字越小排名越靠前) */
|
||||
sort?: number;
|
||||
/** 菜单 */
|
||||
type?: MenuTypeEnum;
|
||||
/** 菜单是否可见(1:显示;0:隐藏) */
|
||||
visible?: number;
|
||||
}
|
||||
|
||||
/** 菜单表单对象 */
|
||||
export interface MenuForm {
|
||||
/** 菜单ID */
|
||||
id?: string;
|
||||
/** 父菜单ID */
|
||||
parentId?: number;
|
||||
/** 菜单名称 */
|
||||
name?: string;
|
||||
/** 菜单是否可见(1-是 0-否) */
|
||||
visible: number;
|
||||
/** ICON */
|
||||
icon?: string;
|
||||
/** 排序 */
|
||||
sort?: number;
|
||||
/** 路由名称 */
|
||||
routeName?: string;
|
||||
/** 路由路径 */
|
||||
routePath?: string;
|
||||
/** 组件路径 */
|
||||
component?: string;
|
||||
/** 跳转路由路径 */
|
||||
redirect?: string;
|
||||
/** 菜单 */
|
||||
type?: MenuTypeEnum;
|
||||
/** 权限标识 */
|
||||
perm?: string;
|
||||
/** 【菜单】是否开启页面缓存 */
|
||||
keepAlive?: number;
|
||||
/** 【目录】只有一个子路由是否始终显示 */
|
||||
alwaysShow?: number;
|
||||
/** 参数 */
|
||||
params?: KeyValue[];
|
||||
}
|
||||
|
||||
interface KeyValue {
|
||||
key: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
/** RouteVO,路由对象 */
|
||||
export interface RouteVO {
|
||||
/** 子路由列表 */
|
||||
children: RouteVO[];
|
||||
/** 组件路径 */
|
||||
component?: string;
|
||||
/** 路由属性 */
|
||||
meta?: Meta;
|
||||
/** 路由名称 */
|
||||
name?: string;
|
||||
/** 路由路径 */
|
||||
path?: string;
|
||||
/** 跳转链接 */
|
||||
redirect?: string;
|
||||
}
|
||||
|
||||
/** Meta,路由属性 */
|
||||
export interface Meta {
|
||||
/** 【目录】只有一个子路由是否始终显示 */
|
||||
alwaysShow?: boolean;
|
||||
/** 是否隐藏(true-是 false-否) */
|
||||
hidden?: boolean;
|
||||
/** ICON */
|
||||
icon?: string;
|
||||
/** 【菜单】是否开启页面缓存 */
|
||||
keepAlive?: boolean;
|
||||
/** 拥有路由权限的角色编码 */
|
||||
roles?: string[];
|
||||
/** 路由title */
|
||||
title?: string;
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
import request from "@/utils/request";
|
||||
import { MenuQuery, MenuVO, MenuForm, RouteVO } from "./model";
|
||||
|
||||
const MENU_BASE_URL = "/api/v1/menus";
|
||||
|
||||
class MenuAPI {
|
||||
/**
|
||||
* 获取路由列表
|
||||
*
|
||||
* @returns 路由列表
|
||||
*/
|
||||
static getRoutes() {
|
||||
return request<any, RouteVO[]>({
|
||||
url: `${MENU_BASE_URL}/routes`,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单树形列表
|
||||
*
|
||||
* @param queryParams 查询参数
|
||||
* @returns 菜单树形列表
|
||||
*/
|
||||
static getList(queryParams: MenuQuery) {
|
||||
return request<any, MenuVO[]>({
|
||||
url: `${MENU_BASE_URL}`,
|
||||
method: "get",
|
||||
params: queryParams,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单下拉数据源
|
||||
*
|
||||
* @returns 菜单下拉数据源
|
||||
*/
|
||||
static getOptions() {
|
||||
return request<any, OptionType[]>({
|
||||
url: `${MENU_BASE_URL}/options`,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单表单数据
|
||||
*
|
||||
* @param id 菜单ID
|
||||
* @returns 菜单表单数据
|
||||
*/
|
||||
static getFormData(id: number) {
|
||||
return request<any, MenuForm>({
|
||||
url: `${MENU_BASE_URL}/${id}/form`,
|
||||
method: "get",
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加菜单
|
||||
*
|
||||
* @param data 菜单表单数据
|
||||
* @returns 请求结果
|
||||
*/
|
||||
static add(data: MenuForm) {
|
||||
return request({
|
||||
url: `${MENU_BASE_URL}`,
|
||||
method: "post",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改菜单
|
||||
*
|
||||
* @param id 菜单ID
|
||||
* @param data 菜单表单数据
|
||||
* @returns 请求结果
|
||||
*/
|
||||
static update(id: string, data: MenuForm) {
|
||||
return request({
|
||||
url: `${MENU_BASE_URL}/${id}`,
|
||||
method: "put",
|
||||
data: data,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
*
|
||||
* @param id 菜单ID
|
||||
* @returns 请求结果
|
||||
*/
|
||||
static deleteById(id: number) {
|
||||
return request({
|
||||
url: `${MENU_BASE_URL}/${id}`,
|
||||
method: "delete",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default MenuAPI;
|
||||
@@ -1,188 +0,0 @@
|
||||
import { MenuTypeEnum } from "@/enums/MenuTypeEnum";
|
||||
|
||||
/**
|
||||
* 菜单查询参数类型
|
||||
*/
|
||||
export interface MenuQuery {
|
||||
keywords?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单视图对象类型
|
||||
*/
|
||||
export interface MenuVO {
|
||||
/**
|
||||
* 子菜单
|
||||
*/
|
||||
children?: MenuVO[];
|
||||
/**
|
||||
* 组件路径
|
||||
*/
|
||||
component?: string;
|
||||
/**
|
||||
* ICON
|
||||
*/
|
||||
icon?: string;
|
||||
/**
|
||||
* 菜单ID
|
||||
*/
|
||||
id?: number;
|
||||
/**
|
||||
* 菜单名称
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* 父菜单ID
|
||||
*/
|
||||
parentId?: number;
|
||||
/**
|
||||
* 按钮权限标识
|
||||
*/
|
||||
perm?: string;
|
||||
/**
|
||||
* 跳转路径
|
||||
*/
|
||||
redirect?: string;
|
||||
/**
|
||||
* 路由名称
|
||||
*/
|
||||
routeName?: string;
|
||||
/**
|
||||
* 路由相对路径
|
||||
*/
|
||||
routePath?: string;
|
||||
/**
|
||||
* 菜单排序(数字越小排名越靠前)
|
||||
*/
|
||||
sort?: number;
|
||||
/**
|
||||
* 菜单类型
|
||||
*/
|
||||
type?: MenuTypeEnum;
|
||||
/**
|
||||
* 菜单是否可见(1:显示;0:隐藏)
|
||||
*/
|
||||
visible?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 菜单表单对象类型
|
||||
*/
|
||||
export interface MenuForm {
|
||||
/**
|
||||
* 菜单ID
|
||||
*/
|
||||
id?: string;
|
||||
/**
|
||||
* 父菜单ID
|
||||
*/
|
||||
parentId?: number;
|
||||
/**
|
||||
* 菜单名称
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* 菜单是否可见(1:是;0:否;)
|
||||
*/
|
||||
visible: number;
|
||||
icon?: string;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
sort?: number;
|
||||
/**
|
||||
* 组件路径
|
||||
*/
|
||||
component?: string;
|
||||
/**
|
||||
* 路由路径
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* 跳转路由路径
|
||||
*/
|
||||
redirect?: string;
|
||||
|
||||
/**
|
||||
* 菜单类型
|
||||
*/
|
||||
type?: MenuTypeEnum;
|
||||
|
||||
/**
|
||||
* 权限标识
|
||||
*/
|
||||
perm?: string;
|
||||
/**
|
||||
* 【菜单】是否开启页面缓存
|
||||
*/
|
||||
keepAlive?: number;
|
||||
|
||||
/**
|
||||
* 【目录】只有一个子路由是否始终显示
|
||||
*/
|
||||
alwaysShow?: number;
|
||||
|
||||
params?: KeyValue[];
|
||||
}
|
||||
|
||||
interface KeyValue {
|
||||
key: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* RouteVO,路由对象
|
||||
*/
|
||||
export interface RouteVO {
|
||||
/**
|
||||
* 子路由列表
|
||||
*/
|
||||
children: RouteVO[];
|
||||
/**
|
||||
* 组件路径
|
||||
*/
|
||||
component?: string;
|
||||
meta?: Meta;
|
||||
/**
|
||||
* 路由名称
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* 路由路径
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* 跳转链接
|
||||
*/
|
||||
redirect?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta,路由属性类型
|
||||
*/
|
||||
export interface Meta {
|
||||
/**
|
||||
* 【目录】只有一个子路由是否始终显示
|
||||
*/
|
||||
alwaysShow?: boolean;
|
||||
/**
|
||||
* 是否隐藏(true-是 false-否)
|
||||
*/
|
||||
hidden?: boolean;
|
||||
/**
|
||||
* ICON
|
||||
*/
|
||||
icon?: string;
|
||||
/**
|
||||
* 【菜单】是否开启页面缓存
|
||||
*/
|
||||
keepAlive?: boolean;
|
||||
/**
|
||||
* 拥有路由权限的角色编码
|
||||
*/
|
||||
roles?: string[];
|
||||
/**
|
||||
* 路由title
|
||||
*/
|
||||
title?: string;
|
||||
}
|
||||
@@ -1,34 +1,22 @@
|
||||
import request from "@/utils/request";
|
||||
import { RoleQuery, RolePageResult, RoleForm } from "./model";
|
||||
|
||||
const ROLE_BASE_URL = "/api/v1/roles";
|
||||
|
||||
class RoleAPI {
|
||||
/**
|
||||
* 获取角色分页数据
|
||||
*
|
||||
* @param queryParams 查询参数
|
||||
* @returns 角色分页数据
|
||||
*/
|
||||
static getPage(queryParams?: RoleQuery) {
|
||||
return request<any, RolePageResult>({
|
||||
/** 获取角色分页数据 */
|
||||
static getPage(queryParams?: RolePageQuery) {
|
||||
return request<any, PageResult<RolePageVO[]>>({
|
||||
url: `${ROLE_BASE_URL}/page`,
|
||||
method: "get",
|
||||
params: queryParams,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色下拉数据源
|
||||
*
|
||||
* @param queryParams 查询参数(可选)
|
||||
* @returns 角色下拉数据源
|
||||
*/
|
||||
static getOptions(queryParams?: RoleQuery) {
|
||||
/** 获取角色下拉数据源 */
|
||||
static getOptions() {
|
||||
return request<any, OptionType[]>({
|
||||
url: `${ROLE_BASE_URL}/options`,
|
||||
method: "get",
|
||||
params: queryParams,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -46,7 +34,7 @@ class RoleAPI {
|
||||
}
|
||||
|
||||
/**
|
||||
* 分配菜单权限给角色
|
||||
* 分配菜单权限
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param data 菜单ID集合
|
||||
@@ -73,12 +61,7 @@ class RoleAPI {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加角色
|
||||
*
|
||||
* @param data 角色表单数据
|
||||
* @returns 请求结果
|
||||
*/
|
||||
/** 添加角色 */
|
||||
static add(data: RoleForm) {
|
||||
return request({
|
||||
url: `${ROLE_BASE_URL}`,
|
||||
@@ -92,7 +75,6 @@ class RoleAPI {
|
||||
*
|
||||
* @param id 角色ID
|
||||
* @param data 角色表单数据
|
||||
* @returns 请求结果
|
||||
*/
|
||||
static update(id: number, data: RoleForm) {
|
||||
return request({
|
||||
@@ -106,7 +88,6 @@ class RoleAPI {
|
||||
* 批量删除角色,多个以英文逗号(,)分割
|
||||
*
|
||||
* @param ids 角色ID字符串,多个以英文逗号(,)分割
|
||||
* @returns 请求结果
|
||||
*/
|
||||
static deleteByIds(ids: string) {
|
||||
return request({
|
||||
@@ -117,3 +98,43 @@ class RoleAPI {
|
||||
}
|
||||
|
||||
export default RoleAPI;
|
||||
|
||||
/** 角色分页查询参数 */
|
||||
export interface RolePageQuery extends PageQuery {
|
||||
/** 搜索关键字 */
|
||||
keywords?: string;
|
||||
}
|
||||
|
||||
/** 角色分页对象 */
|
||||
export interface RolePageVO {
|
||||
/** 角色编码 */
|
||||
code?: string;
|
||||
/** 角色ID */
|
||||
id?: number;
|
||||
/** 角色名称 */
|
||||
name?: string;
|
||||
/** 排序 */
|
||||
sort?: number;
|
||||
/** 角色状态 */
|
||||
status?: number;
|
||||
/** 创建时间 */
|
||||
createTime?: Date;
|
||||
/** 修改时间 */
|
||||
updateTime?: Date;
|
||||
}
|
||||
|
||||
/** 角色表单对象 */
|
||||
export interface RoleForm {
|
||||
/** 角色ID */
|
||||
id?: number;
|
||||
/** 角色编码 */
|
||||
code: string;
|
||||
/** 数据权限 */
|
||||
dataScope?: number;
|
||||
/** 角色名称 */
|
||||
name: string;
|
||||
/** 排序 */
|
||||
sort?: number;
|
||||
/** 角色状态(1-正常;0-停用) */
|
||||
status?: number;
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
/**
|
||||
* 角色查询参数
|
||||
*/
|
||||
export interface RoleQuery extends PageQuery {
|
||||
keywords?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色分页对象
|
||||
*/
|
||||
export interface RolePageVO {
|
||||
/**
|
||||
* 角色编码
|
||||
*/
|
||||
code?: string;
|
||||
|
||||
/**
|
||||
* 角色ID
|
||||
*/
|
||||
id?: number;
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
name?: string;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
sort?: number;
|
||||
/**
|
||||
* 角色状态
|
||||
*/
|
||||
status?: number;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
createTime?: Date;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
updateTime?: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色分页
|
||||
*/
|
||||
export type RolePageResult = PageResult<RolePageVO[]>;
|
||||
|
||||
/**
|
||||
* 角色表单对象
|
||||
*/
|
||||
export interface RoleForm {
|
||||
/**
|
||||
* 角色ID
|
||||
*/
|
||||
id?: number;
|
||||
|
||||
/**
|
||||
* 角色编码
|
||||
*/
|
||||
code: string;
|
||||
/**
|
||||
* 数据权限
|
||||
*/
|
||||
dataScope?: number;
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
sort?: number;
|
||||
/**
|
||||
* 角色状态(1-正常;0-停用)
|
||||
*/
|
||||
status?: number;
|
||||
}
|
||||
@@ -1,13 +1,12 @@
|
||||
import request from "@/utils/request";
|
||||
import { UserForm, UserInfo, UserPageVO, UserQuery } from "./model";
|
||||
|
||||
const USER_BASE_URL = "/api/v1/users";
|
||||
|
||||
class UserAPI {
|
||||
/**
|
||||
* 登录成功后获取用户信息(昵称、头像、权限集合和角色集合)
|
||||
* 获取当前登录用户信息
|
||||
*
|
||||
* @returns 用户信息
|
||||
* @returns 登录用户昵称、头像信息,包括角色和权限
|
||||
*/
|
||||
static getInfo() {
|
||||
return request<any, UserInfo>({
|
||||
@@ -20,9 +19,8 @@ class UserAPI {
|
||||
* 获取用户分页列表
|
||||
*
|
||||
* @param queryParams 查询参数
|
||||
* @returns 用户分页列表
|
||||
*/
|
||||
static getPage(queryParams: UserQuery) {
|
||||
static getPage(queryParams: UserPageQuery) {
|
||||
return request<any, PageResult<UserPageVO[]>>({
|
||||
url: `${USER_BASE_URL}/page`,
|
||||
method: "get",
|
||||
@@ -47,7 +45,6 @@ class UserAPI {
|
||||
* 添加用户
|
||||
*
|
||||
* @param data 用户表单数据
|
||||
* @returns 请求结果
|
||||
*/
|
||||
static add(data: UserForm) {
|
||||
return request({
|
||||
@@ -62,7 +59,6 @@ class UserAPI {
|
||||
*
|
||||
* @param id 用户ID
|
||||
* @param data 用户表单数据
|
||||
* @returns 请求结果
|
||||
*/
|
||||
static update(id: number, data: UserForm) {
|
||||
return request({
|
||||
@@ -77,7 +73,6 @@ class UserAPI {
|
||||
*
|
||||
* @param id 用户ID
|
||||
* @param password 新密码
|
||||
* @returns 请求结果
|
||||
*/
|
||||
static updatePassword(id: number, password: string) {
|
||||
return request({
|
||||
@@ -91,7 +86,6 @@ class UserAPI {
|
||||
* 批量删除用户,多个以英文逗号(,)分割
|
||||
*
|
||||
* @param ids 用户ID字符串,多个以英文逗号(,)分割
|
||||
* @returns 请求结果
|
||||
*/
|
||||
static deleteByIds(ids: string) {
|
||||
return request({
|
||||
@@ -100,11 +94,7 @@ class UserAPI {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载用户导入模板
|
||||
*
|
||||
* @returns 用户导入模板文件
|
||||
*/
|
||||
/** 下载用户导入模板 */
|
||||
static downloadTemplate() {
|
||||
return request({
|
||||
url: `${USER_BASE_URL}/template`,
|
||||
@@ -117,9 +107,8 @@ class UserAPI {
|
||||
* 导出用户
|
||||
*
|
||||
* @param queryParams 查询参数
|
||||
* @returns 导出文件
|
||||
*/
|
||||
static export(queryParams: UserQuery) {
|
||||
static export(queryParams: UserPageQuery) {
|
||||
return request({
|
||||
url: `${USER_BASE_URL}/export`,
|
||||
method: "get",
|
||||
@@ -133,7 +122,6 @@ class UserAPI {
|
||||
*
|
||||
* @param deptId 部门ID
|
||||
* @param file 导入文件
|
||||
* @returns 请求结果
|
||||
*/
|
||||
static import(deptId: number, file: File) {
|
||||
const formData = new FormData();
|
||||
@@ -151,3 +139,94 @@ class UserAPI {
|
||||
}
|
||||
|
||||
export default UserAPI;
|
||||
|
||||
/** 登录用户信息 */
|
||||
export interface UserInfo {
|
||||
/** 用户ID */
|
||||
userId?: number;
|
||||
|
||||
/** 用户名 */
|
||||
username?: string;
|
||||
|
||||
/** 昵称 */
|
||||
nickname?: string;
|
||||
|
||||
/** 头像URL */
|
||||
avatar?: string;
|
||||
|
||||
/** 角色 */
|
||||
roles: string[];
|
||||
|
||||
/** 权限 */
|
||||
perms: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户分页查询对象
|
||||
*/
|
||||
export interface UserPageQuery extends PageQuery {
|
||||
/** 搜索关键字 */
|
||||
keywords?: string;
|
||||
|
||||
/** 用户状态 */
|
||||
status?: number;
|
||||
|
||||
/** 部门ID */
|
||||
deptId?: number;
|
||||
|
||||
/** 开始时间 */
|
||||
startTime?: string;
|
||||
|
||||
/** 结束时间 */
|
||||
endTime?: string;
|
||||
}
|
||||
|
||||
/** 用户分页对象 */
|
||||
export interface UserPageVO {
|
||||
/** 用户头像URL */
|
||||
avatar?: string;
|
||||
/** 创建时间 */
|
||||
createTime?: Date;
|
||||
/** 部门名称 */
|
||||
deptName?: string;
|
||||
/** 用户邮箱 */
|
||||
email?: string;
|
||||
/** 性别 */
|
||||
genderLabel?: string;
|
||||
/** 用户ID */
|
||||
id?: number;
|
||||
/** 手机号 */
|
||||
mobile?: string;
|
||||
/** 用户昵称 */
|
||||
nickname?: string;
|
||||
/** 角色名称,多个使用英文逗号(,)分割 */
|
||||
roleNames?: string;
|
||||
/** 用户状态(1:启用;0:禁用) */
|
||||
status?: number;
|
||||
/** 用户名 */
|
||||
username?: string;
|
||||
}
|
||||
|
||||
/** 用户表单类型 */
|
||||
export interface UserForm {
|
||||
/** 用户头像 */
|
||||
avatar?: string;
|
||||
/** 部门ID */
|
||||
deptId?: number;
|
||||
/** 邮箱 */
|
||||
email?: string;
|
||||
/** 性别 */
|
||||
gender?: number;
|
||||
/** 用户ID */
|
||||
id?: number;
|
||||
/** 手机号 */
|
||||
mobile?: string;
|
||||
/** 昵称 */
|
||||
nickname?: string;
|
||||
/** 角色ID集合 */
|
||||
roleIds?: number[];
|
||||
/** 用户状态(1:正常;0:禁用) */
|
||||
status?: number;
|
||||
/** 用户名 */
|
||||
username?: string;
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
/**
|
||||
* 登录用户信息
|
||||
*/
|
||||
export interface UserInfo {
|
||||
userId?: number;
|
||||
username?: string;
|
||||
nickname?: string;
|
||||
avatar?: string;
|
||||
roles: string[];
|
||||
perms: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户查询对象类型
|
||||
*/
|
||||
export interface UserQuery extends PageQuery {
|
||||
keywords?: string;
|
||||
status?: number;
|
||||
deptId?: number;
|
||||
startTime?: string;
|
||||
endTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户分页对象
|
||||
*/
|
||||
export interface UserPageVO {
|
||||
/**
|
||||
* 用户头像地址
|
||||
*/
|
||||
avatar?: string;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
createTime?: Date;
|
||||
/**
|
||||
* 部门名称
|
||||
*/
|
||||
deptName?: string;
|
||||
/**
|
||||
* 用户邮箱
|
||||
*/
|
||||
email?: string;
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
genderLabel?: string;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
id?: number;
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
mobile?: string;
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
nickname?: string;
|
||||
/**
|
||||
* 角色名称,多个使用英文逗号(,)分割
|
||||
*/
|
||||
roleNames?: string;
|
||||
/**
|
||||
* 用户状态(1:启用;0:禁用)
|
||||
*/
|
||||
status?: number;
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
username?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户表单类型
|
||||
*/
|
||||
export interface UserForm {
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
avatar?: string;
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
deptId?: number;
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
email?: string;
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
gender?: number;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
id?: number;
|
||||
mobile?: string;
|
||||
/**
|
||||
* 昵称
|
||||
*/
|
||||
nickname?: string;
|
||||
/**
|
||||
* 角色ID集合
|
||||
*/
|
||||
roleIds?: number[];
|
||||
/**
|
||||
* 用户状态(1:正常;0:禁用)
|
||||
*/
|
||||
status?: number;
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
username?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user