feat: 管理后台增强——用户启停操作、shadcn日期区间/后缀标签组件
1. 用户管理页:新增启用状态列与启用/禁用操作按钮(对接 user/enable|disable) 2. 机构账号/记录查询页:时间区间改用官方 shadcn Range Picker 模式 (Popover+Calendar mode=range 双月面板,新增 components/date-range-picker.tsx) 3. 上传配置页:文件类型限制改为标签式输入(新增 suffix-tag-input.tsx, Badge标签+回车添加+常用后缀快捷点选),替换自由文本框 4. 修复:.env 的 VITE_APP_TITLE 加引号,规避 Bun 1.3.10 env 解析 对行尾多字节中文的截断(标题乱码"森睿智�") 5. 新增共享 hook hooks/use-user-status-actions.ts(从 org-account 迁出) 6. vite 代理保留 本地Docker(localhost:8080)/公司 两种目标,切换注释即可
This commit is contained in:
170
src/apis/file.ts
Normal file
170
src/apis/file.ts
Normal file
@@ -0,0 +1,170 @@
|
||||
import { http, HTTP_CONTENT_TYPE } from "@/lib/http";
|
||||
|
||||
const baseUrl = import.meta.env.VITE_API_URL;
|
||||
|
||||
export const RootType = {
|
||||
// 1普通/2内穿外/3外传内/4我的分享
|
||||
MY: "1",
|
||||
INSIDE: "2",
|
||||
OUTSIDE: "3",
|
||||
SHARE: "4",
|
||||
} as const;
|
||||
|
||||
export type RootType = (typeof RootType)[keyof typeof RootType];
|
||||
|
||||
export const FileStatus = {
|
||||
// 1正常2失效11解析中12待审核13传输中14失败
|
||||
VALID: "1",
|
||||
INVALID: "2",
|
||||
PARSING: "11",
|
||||
AUDITING: "12",
|
||||
TRANSFERING: "13",
|
||||
FAILED: "14",
|
||||
} as const;
|
||||
|
||||
export type FileStatus = (typeof FileStatus)[keyof typeof FileStatus];
|
||||
|
||||
export const FileType = {
|
||||
// 1文件/2目录
|
||||
FILE: "1",
|
||||
DIRECTORY: "2",
|
||||
} as const;
|
||||
|
||||
export type FileType = (typeof FileType)[keyof typeof FileType];
|
||||
|
||||
// 获取文件下载地址
|
||||
export const getFileUrl = (code?: string, appendBaseUrl = true) => {
|
||||
if (!code) {
|
||||
return;
|
||||
}
|
||||
const url = `/file/download/${code}?time=` + Date.now();
|
||||
if (appendBaseUrl && baseUrl != "/") {
|
||||
return baseUrl + url;
|
||||
}
|
||||
return url;
|
||||
};
|
||||
|
||||
// 下载
|
||||
export const downloadFile = ({ url, code, ...rest }: any) => {
|
||||
const newUrl = url ?? getFileUrl(code, false);
|
||||
if (!newUrl) {
|
||||
return;
|
||||
}
|
||||
return http.get(newUrl, { responseType: "blob", ...rest });
|
||||
};
|
||||
|
||||
// 上传
|
||||
export const uploadFile = (file: File) => {
|
||||
const data = new FormData();
|
||||
data.append("file", file);
|
||||
const headers = { "content-type": HTTP_CONTENT_TYPE.MULTIPART_FORM_DATA };
|
||||
return http.post("/file/upload", data, { headers });
|
||||
};
|
||||
|
||||
// 创建分享
|
||||
export const createShare = (data: any) => {
|
||||
return http.post("/share_user_file/create", data);
|
||||
};
|
||||
|
||||
// 查询
|
||||
export const getFile = (params: any) => {
|
||||
return http.get("/user_file/find", { params });
|
||||
};
|
||||
|
||||
// 失效
|
||||
export const invalidFile = (id: number) => {
|
||||
return http.put(`/user_file/invalid/${id}`);
|
||||
};
|
||||
|
||||
// 列表查询
|
||||
export const getFileList = (params: any) => {
|
||||
return http.get("/user_file/list", { params });
|
||||
};
|
||||
|
||||
// 修改
|
||||
export const modifyFile = (data: any) => {
|
||||
return http.post("/user_file/modify", data);
|
||||
};
|
||||
|
||||
// 分页查询
|
||||
export const getFilePage = (params: any) => {
|
||||
return http.get("/user_file/page", { params });
|
||||
};
|
||||
|
||||
// 彻底删除文件
|
||||
export const removeFile = (id: number) => {
|
||||
return http.delete(`/user_file/remove/${id}`);
|
||||
};
|
||||
|
||||
// 彻底删除文件
|
||||
export const removeFileByIds = (ids: number[]) => {
|
||||
return http.delete(`/user_file/remove_by_ids`, { data: ids });
|
||||
};
|
||||
|
||||
// 创建
|
||||
export const createFile = (data: any) => {
|
||||
return http.post("/normal_user_file/create", data);
|
||||
};
|
||||
|
||||
// 恢复
|
||||
export const recoverFile = (id: number) => {
|
||||
return http.put(`/normal_user_file/recover/${id}`);
|
||||
};
|
||||
|
||||
// 转移
|
||||
export const transferFile = (data: any) => {
|
||||
return http.post(`/transfer_user_file/create`, data);
|
||||
};
|
||||
|
||||
// 获取统计
|
||||
export const getStatistics = () => {
|
||||
return http.get(`/user_file/statistics/category`);
|
||||
};
|
||||
|
||||
// 获取风险等级列表
|
||||
export const getRiskLevel = (params?: any) => {
|
||||
return http.get("/file_risk/min_audit_risk_level", { params });
|
||||
};
|
||||
|
||||
// 保存风险等级数据
|
||||
export const saveRiskLevel = (data: any) => {
|
||||
return http.post("/file_risk/min_audit_risk_level", data);
|
||||
};
|
||||
|
||||
// 获取风险规则列表
|
||||
export const getRiskRule = (params?: any) => {
|
||||
return http.get("/file_risk/rule", { params });
|
||||
};
|
||||
|
||||
// 保存风险规则数据
|
||||
export const saveRiskRule = (data?: any) => {
|
||||
return http.post("/file_risk/rule", data);
|
||||
};
|
||||
|
||||
// 分页查询
|
||||
export const getFileRiskPage = (params?: any) => {
|
||||
return http.get("/file_risk/page", { params });
|
||||
};
|
||||
|
||||
// 分页查询
|
||||
export const getFilePageSuper = (params: any) => {
|
||||
return http.get("/user_file/page_super", { params });
|
||||
};
|
||||
|
||||
// 按手机号分页查询文件记录(上传/发送/接收,平台管理员)
|
||||
export const getFileRecordPageByPhone = (params: any) => {
|
||||
return http.get("/user_file/record/page_by_phone", { params });
|
||||
};
|
||||
|
||||
// 修改状态
|
||||
export const modifyFileStatus = (data: any) => {
|
||||
return http.put("/user_file/modify_status", data);
|
||||
};
|
||||
|
||||
export const getShareFileList = ({ shareId, ...params }: any) => {
|
||||
return http.get(`/share_user_file/${shareId}`, { params });
|
||||
};
|
||||
|
||||
export const getDiffRiskRule = (fileCode: string) => {
|
||||
return http.get(`/file_risk/dify_risk_rule`, { params: { fileCode } });
|
||||
};
|
||||
17
src/apis/org.ts
Normal file
17
src/apis/org.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { http } from "@/lib/http";
|
||||
|
||||
export const getUserPage = (params: any) => {
|
||||
return http.get("/user/page/platform_user", { params });
|
||||
};
|
||||
|
||||
export const createOrg = (data: any) => {
|
||||
return http.post("/uc/org/create", data);
|
||||
};
|
||||
|
||||
export const modifyOrg = (data: any) => {
|
||||
return http.put("/uc/org/modify", data);
|
||||
};
|
||||
|
||||
export const getOrgPage = (params: any) => {
|
||||
return http.get("/uc/org/page", { params });
|
||||
};
|
||||
24
src/apis/upload-config.ts
Normal file
24
src/apis/upload-config.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { http } from "@/lib/http";
|
||||
|
||||
// 查询当前机构的上传配置(所有登录用户)
|
||||
export const getUploadConfig = () => {
|
||||
return http.get("/upload_config/info");
|
||||
};
|
||||
|
||||
// 保存机构的上传配置(机构管理员/平台超管,upsert)
|
||||
export const modifyUploadConfig = (data: {
|
||||
uploadEnabled: boolean;
|
||||
allowAllType: boolean;
|
||||
allowedSuffixes?: string[];
|
||||
maxFileSize?: number;
|
||||
}) => {
|
||||
return http.post("/upload_config/modify", data);
|
||||
};
|
||||
|
||||
// 上传预检:按文件名/大小校验当前机构配置,不通过时 success=false
|
||||
export const checkUploadConfig = (params: {
|
||||
fileName: string;
|
||||
fileSize?: number;
|
||||
}) => {
|
||||
return http.get("/upload_config/check", { params });
|
||||
};
|
||||
68
src/apis/user.ts
Normal file
68
src/apis/user.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
import { http, HTTP_CONTENT_TYPE } from "@/lib/http";
|
||||
|
||||
// 账号登录
|
||||
export const login = (data = {}) => {
|
||||
return http.post("/login", data, {
|
||||
headers: {
|
||||
"content-type": HTTP_CONTENT_TYPE.APPLICATION_FORM_URLENCODED,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
// 登出
|
||||
export const logout = () => {
|
||||
return http.post("/logout");
|
||||
};
|
||||
|
||||
// 获取用户信息
|
||||
export const getUser = () => {
|
||||
return http.get("/user/info");
|
||||
};
|
||||
|
||||
export const createUser = (data: any) => {
|
||||
return http.post("/user/create_org_user", data);
|
||||
};
|
||||
|
||||
export const getUserOrg = () => {
|
||||
return http.get("/uc/org/find");
|
||||
};
|
||||
|
||||
export const cancelUser = (userId: number) => {
|
||||
return http.post("/user/cancel", { userId });
|
||||
};
|
||||
|
||||
export const modifyUserInfo = (data: any) => {
|
||||
return http.post("/user/modify_org_user_info", data);
|
||||
};
|
||||
|
||||
export const resetUserPwd = (data: any) => {
|
||||
return http.post("/user/reset_org_user_pwd", data);
|
||||
};
|
||||
|
||||
export const initUserPassword = (data: any) => {
|
||||
return http.post("/unac/user/init_user_password", data);
|
||||
};
|
||||
|
||||
export const modifyPassword = (data: any) => {
|
||||
return http.post("/unac/user/modify_password", data);
|
||||
};
|
||||
|
||||
// 启用用户(平台管理员,幂等)
|
||||
export const enableUser = (userId: number) => {
|
||||
return http.post("/user/enable", { userId });
|
||||
};
|
||||
|
||||
// 禁用用户(平台管理员,幂等)
|
||||
export const disableUser = (userId: number) => {
|
||||
return http.post("/user/disable", { userId });
|
||||
};
|
||||
|
||||
// 管理员直接注销用户(平台管理员,不走注销审批流程,幂等)
|
||||
export const adminCancelUser = (userId: number) => {
|
||||
return http.post("/user/admin_cancel", { userId });
|
||||
};
|
||||
|
||||
// 分页查询机构账号(平台管理员,一行 = 一个机构下的一个账号)
|
||||
export const getOrgAccountPage = (params: any) => {
|
||||
return http.get("/user/page/org_account", { params });
|
||||
};
|
||||
Reference in New Issue
Block a user