2
This commit is contained in:
commit
21d41acf50
732 files changed
+55672
-15251
No files matched your search
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* features/workspace/api/voucherCheck.api.ts
|
||||
* 用途:工作台立账凭证检核任务列表、批次明细与强制重检 API 客户端。
|
||||
* 用途:工作台立账凭证检核任务列表、批次明细、企微发送记录与强制重检 API 客户端。
|
||||
* 依赖:@/shared/api/client、getAuthHeaders。
|
||||
* 逻辑:AccountingVoucherCheckView 调用;对应 /api/workspace/accounting-voucher-check/*。
|
||||
* 逻辑:AccountingVoucherCheckView / DetailView 调用;对应 /api/workspace/accounting-voucher-check/* 与排程 Excel 下载。
|
||||
*/
|
||||
import { requestJson } from '@/shared/api/client';
|
||||
import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
@@ -21,6 +21,7 @@ export interface VoucherCheckRunItem {
|
||||
technical_error_count: number;
|
||||
staged_file_count: number;
|
||||
finished_at?: string | null;
|
||||
error_message?: string | null;
|
||||
}
|
||||
|
||||
export interface VoucherCheckRunsResponse {
|
||||
@@ -36,10 +37,19 @@ export interface VoucherCheckRunInvoiceItem {
|
||||
result: string;
|
||||
status_label?: string | null;
|
||||
missing_materials?: Array<{ code?: string; name?: string }>;
|
||||
missing_count?: number | null;
|
||||
cells?: Record<string, string>;
|
||||
checked_at?: string | null;
|
||||
}
|
||||
|
||||
export interface VoucherCheckFileTypeSummary {
|
||||
rule_code: string;
|
||||
rule_name: string;
|
||||
missing_file_count: number;
|
||||
missing_invoice_count: number;
|
||||
missing_ratio: number;
|
||||
}
|
||||
|
||||
export interface VoucherCheckRunItemsResponse {
|
||||
run_id: number;
|
||||
engine_run_id?: number;
|
||||
@@ -48,6 +58,8 @@ export interface VoucherCheckRunItemsResponse {
|
||||
page_size: number;
|
||||
total: number;
|
||||
items: VoucherCheckRunInvoiceItem[];
|
||||
subject_count?: number;
|
||||
by_file_type?: VoucherCheckFileTypeSummary[];
|
||||
}
|
||||
|
||||
export interface VoucherCheckForceRunResponse {
|
||||
@@ -83,7 +95,7 @@ export function listVoucherCheckRuns(params: {
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询指定排程批次的 invoice 明细。
|
||||
* 分页查询指定排程批次的 invoice 明细,可按 result 过滤状态;同时返回 by_file_type。
|
||||
*/
|
||||
export function listVoucherCheckRunItems(runId: number, params?: { result?: string; page?: number; page_size?: number }) {
|
||||
const q = new URLSearchParams();
|
||||
@@ -97,6 +109,81 @@ export function listVoucherCheckRunItems(runId: number, params?: { result?: stri
|
||||
);
|
||||
}
|
||||
|
||||
export interface VoucherCheckNotificationItem {
|
||||
id: number;
|
||||
run_id: number;
|
||||
schedule_run_id?: number | null;
|
||||
run_no?: string | null;
|
||||
period_month?: string | null;
|
||||
subject_count: number;
|
||||
missing_file_count: number;
|
||||
missing_invoice_count: number;
|
||||
send_status: string;
|
||||
skip_reason?: string | null;
|
||||
excel_filename?: string | null;
|
||||
has_excel?: boolean;
|
||||
recipient_names?: string[];
|
||||
sent_at?: string | null;
|
||||
created_at?: string | null;
|
||||
}
|
||||
|
||||
export interface VoucherCheckNotificationsResponse {
|
||||
page: number;
|
||||
page_size: number;
|
||||
total: number;
|
||||
items: VoucherCheckNotificationItem[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询企微缺件汇总发送记录。
|
||||
*/
|
||||
export function listVoucherCheckNotifications(params?: {
|
||||
period?: string;
|
||||
send_status?: string;
|
||||
page?: number;
|
||||
page_size?: number;
|
||||
}) {
|
||||
const q = new URLSearchParams();
|
||||
if (params?.period) q.set('period', params.period);
|
||||
if (params?.send_status) q.set('send_status', params.send_status);
|
||||
if (params?.page) q.set('page', String(params.page));
|
||||
if (params?.page_size) q.set('page_size', String(params.page_size));
|
||||
const qs = q.toString();
|
||||
return requestJson<VoucherCheckNotificationsResponse>(
|
||||
`/api/workspace/accounting-voucher-check/notifications${qs ? `?${qs}` : ''}`,
|
||||
{ headers: getAuthHeaders() },
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载该排程批次的检核结果 Excel。
|
||||
* @param scheduleRunId - ScheduleRun.id
|
||||
* @param filename - 回退文件名(无 Content-Disposition 时使用)
|
||||
*/
|
||||
export async function downloadVoucherCheckExcel(scheduleRunId: number, filename?: string | null) {
|
||||
const res = await fetch(`/api/workspace/schedule-runs/${scheduleRunId}/excel`, { headers: getAuthHeaders() });
|
||||
if (!res.ok) {
|
||||
throw new Error('excel');
|
||||
}
|
||||
const blob = await res.blob();
|
||||
const url = URL.createObjectURL(blob);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
const disposition = res.headers.get('content-disposition') || '';
|
||||
const encoded = disposition.match(/filename\*=UTF-8''([^;]+)/i)?.[1];
|
||||
const plain = disposition.match(/filename="?([^";]+)"?/i)?.[1];
|
||||
const raw = encoded || plain || filename || 'voucher_check.xlsx';
|
||||
try {
|
||||
link.download = decodeURIComponent(raw);
|
||||
} catch {
|
||||
link.download = raw;
|
||||
}
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 强制重检上一个自然月(不走增量跳过)。
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user