| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- import { defHttp } from '@jeesite/core/utils/http/axios';
- import { useGlobSetting } from '@jeesite/core/hooks/setting';
- import type { Result } from '@jeesite/types/axios';
- const { adminPath } = useGlobSetting();
- /**
- * 案件实体信息
- */
- export interface CaseInfo {
- /**
- * 案件 ID
- */
- id?: number;
- /**
- * 案件名称
- */
- name: string;
- /**
- * 案件类型
- */
- type: string;
- /**
- * 案件备注
- */
- remark?: string;
- /**
- * 创建时间
- */
- createTime?: string;
- /**
- * 是否已经初始化 (1 是 0 否)
- */
- init?: number;
- }
- /**
- * 创建案件请求 DTO
- */
- export interface CreateCaseDTO {
- /**
- * 案件名称
- */
- name: string;
- /**
- * 案件密码
- */
- pwd: string;
- /**
- * 案件类型
- */
- type: string;
- /**
- * 案件备注
- */
- remark?: string;
- }
- /**
- * 更新案件请求 DTO(与创建使用同一个接口)
- */
- export interface UpdateCaseDTO {
- /**
- * 案件 ID(更新时必填)
- */
- id: number;
- /**
- * 案件名称
- */
- name: string;
- /**
- * 案件密码
- */
- pwd: string;
- /**
- * 案件类型
- */
- type: string;
- /**
- * 案件备注
- */
- remark?: string;
- }
- /**
- * 更新案件密码 DTO
- */
- export interface UpdateCasePwdDTO {
- /**
- * 案件 ID
- */
- id: number;
- /**
- * 新密码
- */
- newPwd: string;
- /**
- * 旧密码
- */
- oldPwd: string;
- }
- /**
- * 开启案件 DTO
- */
- export interface OpenCaseDTO {
- /**
- * 案件 ID
- */
- id: number;
- /**
- * 案件密码
- */
- pwd: string;
- }
- /**
- * 删除案件参数
- */
- export interface DeleteCaseParams {
- /**
- * 案件 ID
- */
- id: number;
- /**
- * 案件密码
- */
- pwd: string;
- }
- /**
- * 分页查询案件列表
- * @returns 案件列表
- */
- export const list = () => defHttp.get<CaseInfo[]>({ url: adminPath + '/case/list' });
- /**
- * 创建新案件
- * @param data 创建案件数据
- * @returns 创建成功的案件信息
- */
- export const create = (data: CreateCaseDTO) =>
- defHttp.postJson<Result>(
- { url: adminPath + '/case/create', data },
- { isReturnNativeResponse: false, skipSuccessMessage: true },
- );
- /**
- * 更新案件(创建或更新使用同一接口,有id则更新)
- * @param data 更新案件数据
- * @returns 更新成功的案件信息
- */
- export const update = (data: UpdateCaseDTO) =>
- defHttp.postJson<Result>({ url: adminPath + '/case/create', data }, { isReturnNativeResponse: false });
- /**
- * 删除案件
- * @param id 案件 ID
- * @param pwd 案件密码
- */
- export const deleteById = (id: number, pwd: string) =>
- defHttp.delete<void>({ url: adminPath + '/case/delete', params: { id, pwd } });
- /**
- * 更新案件密码
- * @param data 更新密码数据
- */
- export const updatePwd = (data: UpdateCasePwdDTO) =>
- defHttp.postJson<void>({ url: adminPath + '/case/updatePwd', data });
- /**
- * 开启案件
- * @param data 开启案件数据(id + 密码)
- * @returns 案件信息
- */
- export const openCase = (data: OpenCaseDTO) => defHttp.postJson<CaseInfo>({ url: adminPath + '/case/open', data });
- /**
- * 退出当前案件
- */
- export const exitCase = () => defHttp.get<void>({ url: adminPath + '/case/exit' });
|