refactor: restore zq admin design baseline
This commit is contained in:
@@ -0,0 +1,193 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/**
|
||||
* 电子签章 API
|
||||
*/
|
||||
|
||||
// ============ 类型定义 ============
|
||||
|
||||
/** 签章类型 */
|
||||
export type SealType =
|
||||
| 'company'
|
||||
| 'contract'
|
||||
| 'department'
|
||||
| 'finance'
|
||||
| 'personal';
|
||||
|
||||
/** 签章状态 */
|
||||
export type SealStatus = 'active' | 'disabled';
|
||||
|
||||
/** 所有者类型 */
|
||||
export type OwnerType = 'all' | 'dept' | 'role' | 'user';
|
||||
|
||||
/** 使用范围 */
|
||||
export type ScopeType = 'all' | 'specific';
|
||||
|
||||
/** 电子签章 */
|
||||
export interface ElectronicSeal {
|
||||
id: string;
|
||||
name: string;
|
||||
seal_type: SealType;
|
||||
description?: string;
|
||||
seal_image_id: string;
|
||||
seal_image_url?: string;
|
||||
owner_type: OwnerType;
|
||||
owner_ids?: string[];
|
||||
scope: ScopeType;
|
||||
allowed_template_ids?: string[];
|
||||
width: number;
|
||||
height: number;
|
||||
status: SealStatus;
|
||||
sys_create_datetime?: string;
|
||||
sys_update_datetime?: string;
|
||||
}
|
||||
|
||||
/** 创建签章请求 */
|
||||
export interface ElectronicSealCreateInput {
|
||||
name: string;
|
||||
seal_type: SealType;
|
||||
description?: string;
|
||||
seal_image_id: string;
|
||||
owner_type?: OwnerType;
|
||||
owner_ids?: string[];
|
||||
scope?: ScopeType;
|
||||
allowed_template_ids?: string[];
|
||||
width?: number;
|
||||
height?: number;
|
||||
}
|
||||
|
||||
/** 更新签章请求 */
|
||||
export interface ElectronicSealUpdateInput {
|
||||
name?: string;
|
||||
description?: string;
|
||||
seal_image_id?: string;
|
||||
owner_type?: OwnerType;
|
||||
owner_ids?: string[];
|
||||
scope?: ScopeType;
|
||||
allowed_template_ids?: string[];
|
||||
width?: number;
|
||||
height?: number;
|
||||
status?: SealStatus;
|
||||
}
|
||||
|
||||
/** 列表查询参数 */
|
||||
export interface SealListParams {
|
||||
page?: number;
|
||||
pageSize?: number;
|
||||
sealType?: SealType;
|
||||
status?: SealStatus;
|
||||
keyword?: string;
|
||||
}
|
||||
|
||||
/** 签章使用记录 */
|
||||
export interface SealUsageLog {
|
||||
id: string;
|
||||
seal_id: string;
|
||||
seal_name?: string;
|
||||
document_id: string;
|
||||
document_name?: string;
|
||||
user_id: string;
|
||||
user_name?: string;
|
||||
position_x: number;
|
||||
position_y: number;
|
||||
page_number: number;
|
||||
sys_create_datetime?: string;
|
||||
}
|
||||
|
||||
/** 分页响应 */
|
||||
interface PaginatedResponse<T> {
|
||||
items: T[];
|
||||
total: number;
|
||||
}
|
||||
|
||||
// ============ API 函数 ============
|
||||
|
||||
/**
|
||||
* 获取签章列表(分页)
|
||||
*/
|
||||
export async function getSealListApi(params?: SealListParams) {
|
||||
return requestClient.get<PaginatedResponse<ElectronicSeal>>(
|
||||
'/api/online_dev/electronic-seal',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取可用签章列表
|
||||
*/
|
||||
export async function getAvailableSealsApi(templateId?: string) {
|
||||
return requestClient.get<ElectronicSeal[]>(
|
||||
'/api/online_dev/electronic-seal/available',
|
||||
{ params: { templateId } },
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取签章详情
|
||||
*/
|
||||
export async function getSealDetailApi(sealId: string) {
|
||||
return requestClient.get<ElectronicSeal>(
|
||||
`/api/online_dev/electronic-seal/${sealId}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建签章
|
||||
*/
|
||||
export async function createSealApi(data: ElectronicSealCreateInput) {
|
||||
return requestClient.post<ElectronicSeal>(
|
||||
'/api/online_dev/electronic-seal',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新签章
|
||||
*/
|
||||
export async function updateSealApi(
|
||||
sealId: string,
|
||||
data: ElectronicSealUpdateInput,
|
||||
) {
|
||||
return requestClient.put<ElectronicSeal>(
|
||||
`/api/online_dev/electronic-seal/${sealId}`,
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除签章
|
||||
*/
|
||||
export async function deleteSealApi(sealId: string) {
|
||||
return requestClient.delete(`/api/online_dev/electronic-seal/${sealId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用签章
|
||||
*/
|
||||
export async function enableSealApi(sealId: string) {
|
||||
return requestClient.post<ElectronicSeal>(
|
||||
`/api/online_dev/electronic-seal/${sealId}/enable`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 禁用签章
|
||||
*/
|
||||
export async function disableSealApi(sealId: string) {
|
||||
return requestClient.post<ElectronicSeal>(
|
||||
`/api/online_dev/electronic-seal/${sealId}/disable`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取签章使用记录
|
||||
*/
|
||||
export async function getSealUsageLogsApi(
|
||||
sealId: string,
|
||||
params?: { page?: number; pageSize?: number },
|
||||
) {
|
||||
return requestClient.get<PaginatedResponse<SealUsageLog>>(
|
||||
`/api/online_dev/electronic-seal/${sealId}/logs`,
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user