WARCH2 增加企微审批历史只读查询

这个提交包含在:
2026-05-20 10:23:23 +08:00
父节点 7a32399ca9
当前提交 123ebc9c95
共修改 23 个文件,包含 1358 行新增和 36 行删除
+112
查看文件
@@ -0,0 +1,112 @@
import { apiRequestData } from "./http";
export type WecomApprovalArchiveScope = "self" | "team" | "all";
export type WecomApprovalArchiveType = "leave" | "missed_punch";
export type WecomApprovalArchiveStatus = "pending" | "approved" | "rejected" | "revoked" | "terminated" | "changed" | "unknown";
export type WecomApprovalArchiveFinding = "open" | "resolved" | "any";
export type WecomApprovalArchiveEmployee = {
id: string;
employeeNo: string | null;
name: string;
} | null;
export type WecomApprovalArchiveItem = {
id: string;
spNoPrefix: string | null;
templateIdPrefix: string | null;
templateType: string;
spName: string | null;
normalizedStatus: string;
applicant: WecomApprovalArchiveEmployee;
appliedAt: string | null;
submittedAt: string | null;
completedAt: string | null;
statusObservedAt: string | null;
lastSource: string | null;
lastCallbackAt: string | null;
lastCompensationAt: string | null;
readabilityStatus: string | null;
singleTapApproveRisk: boolean;
templateAdjustmentRequired: boolean;
participantCount: number;
actionCount: number;
fieldCount: number;
findingCount: number;
openFindingCount: number;
};
export type WecomApprovalArchiveDetail = WecomApprovalArchiveItem & {
participants: Array<{
id: string;
role: string;
nodeIndex: number;
employee: WecomApprovalArchiveEmployee;
isCurrent: boolean;
mappingStatus: string;
}>;
actions: Array<{
id: string;
actionType: string;
operator: WecomApprovalArchiveEmployee;
actionTime: string | null;
nodeIndex: number;
source: string;
}>;
fields: Array<{
id: string;
fieldKey: string;
fieldIndex: number;
fieldName: string | null;
fieldType: string | null;
sensitiveLevel: string;
displayAllowed: boolean;
}>;
findings: Array<{
id: string;
findingType: string;
status: string;
severity: string;
source: string;
detectedAt: string | null;
resolvedAt: string | null;
}>;
};
export type WecomApprovalArchiveListQuery = {
scope?: WecomApprovalArchiveScope;
type?: "" | WecomApprovalArchiveType;
status?: "" | WecomApprovalArchiveStatus;
finding?: "" | WecomApprovalArchiveFinding;
page?: number;
pageSize?: number;
};
export type WecomApprovalArchiveListResponse = {
scope: WecomApprovalArchiveScope;
requestedScope: WecomApprovalArchiveScope;
canViewAll: boolean;
page: number;
pageSize: number;
total: number;
status: "OK" | "PARTIAL_ARCHIVE_NEEDS_DATA";
items: WecomApprovalArchiveItem[];
};
function buildQuery(query: WecomApprovalArchiveListQuery = {}) {
const search = new URLSearchParams();
Object.entries(query).forEach(([key, value]) => {
if (value === undefined || value === null || value === "") return;
search.set(key, String(value));
});
const value = search.toString();
return value ? `?${value}` : "";
}
export function fetchWecomApprovalArchive(query: WecomApprovalArchiveListQuery = {}) {
return apiRequestData<WecomApprovalArchiveListResponse>(`/api/wecom/approval-archive${buildQuery(query)}`);
}
export function fetchWecomApprovalArchiveDetail(id: string) {
return apiRequestData<{ item: WecomApprovalArchiveDetail }>(`/api/wecom/approval-archive/${encodeURIComponent(id)}`);
}