refactor: 重命名 API 文件并更新引用路径

- 重命名 13 个 API 文件,去掉 -api 后缀
  * src/api/auth-api.ts  auth.ts
  * src/api/codegen-api.ts  codegen.ts
  * src/api/file-api.ts  file.ts
  * src/api/system/*.ts (9个文件)

- 批量更新 50+ 处 API 引用路径
- 修复 websocket 和枚举导入路径
- 确保零编码问题(使用 UTF-8 编码)
This commit is contained in:
Ray.Hao
2025-12-12 14:02:07 +08:00
parent 9fb1942619
commit 23b52872c5
48 changed files with 56 additions and 53 deletions

75
src/api/system/dept.ts Normal file
View File

@@ -0,0 +1,75 @@
import request from "@/utils/request";
const DEPT_BASE_URL = "/api/v1/depts";
const DeptAPI = {
/** 获取部门树形列表 */
getList(queryParams?: DeptQuery) {
return request<any, DeptVO[]>({ url: `${DEPT_BASE_URL}`, method: "get", params: queryParams });
},
/** 获取部门下拉数据源 */
getOptions() {
return request<any, OptionType[]>({ url: `${DEPT_BASE_URL}/options`, method: "get" });
},
/** 获取部门表单数据 */
getFormData(id: string) {
return request<any, DeptForm>({ url: `${DEPT_BASE_URL}/${id}/form`, method: "get" });
},
/** 新增部门 */
create(data: DeptForm) {
return request({ url: `${DEPT_BASE_URL}`, method: "post", data });
},
/** 修改部门 */
update(id: string, data: DeptForm) {
return request({ url: `${DEPT_BASE_URL}/${id}`, method: "put", data });
},
/** 批量删除部门,多个以英文逗号(,)分割 */
deleteByIds(ids: string) {
return request({ url: `${DEPT_BASE_URL}/${ids}`, method: "delete" });
},
};
export default DeptAPI;
export interface DeptQuery {
/** 搜索关键字 */
keywords?: string;
/** 状态 */
status?: number;
}
export interface DeptVO {
/** 子部门 */
children?: DeptVO[];
/** 创建时间 */
createTime?: Date;
/** 部门ID */
id?: string;
/** 部门名称 */
name?: string;
/** 部门编号 */
code?: string;
/** 父部门ID */
parentid?: string;
/** 排序 */
sort?: number;
/** 状态(1:启用0:禁用) */
status?: number;
/** 修改时间 */
updateTime?: Date;
}
export interface DeptForm {
/** 部门ID(新增不填) */
id?: string;
/** 部门名称 */
name?: string;
/** 部门编号 */
code?: string;
/** 父部门ID */
parentId: string;
/** 排序 */
sort?: number;
/** 状态(1:启用0禁用) */
status?: number;
}