Merge branch 'hugo-shipping-notice' into dev
# Conflicts: # frontend/src/features/chat/components/ChatViewContent.vue
This commit is contained in:
commit
80d78130f8
121 files changed
+9621
-1263
No files matched your search
@@ -24,11 +24,57 @@ export interface ShippingMyTodosCount {
|
||||
processing: number;
|
||||
done: number;
|
||||
total_pending_badge: number;
|
||||
/** 待处理桶按可动作生命周期阶段的全量聚合计数(阶段筛选 tab)。 */
|
||||
stage_counts?: {
|
||||
intake_parse: number;
|
||||
order_review: number;
|
||||
fulfillment_prep: number;
|
||||
freight_upload: number;
|
||||
};
|
||||
/** done 桶终态拆分:通知完成 vs 复核驳回/作废。 */
|
||||
done_counts?: {
|
||||
upload_complete: number;
|
||||
reject_void: number;
|
||||
};
|
||||
}
|
||||
|
||||
/** 已完成通知明细行(通知完成报表):标准 12 字段 + 溯源编号。 */
|
||||
export interface ShippingDoneLineItem {
|
||||
task_no: string;
|
||||
business_no: string | null;
|
||||
customer_name: string | null;
|
||||
customer_code: string | null;
|
||||
order_date: string | null;
|
||||
line_no: number;
|
||||
part_number: string | null;
|
||||
qty: number | null;
|
||||
required_date: string | null;
|
||||
customer_po_number: string | null;
|
||||
/** 无数据源,契约占位恒为 null(页面与导出留空)。 */
|
||||
used_qty: number | null;
|
||||
open_qty: number | null;
|
||||
source_order_number: string | null;
|
||||
unit_price: number | null;
|
||||
}
|
||||
|
||||
export interface ShippingDoneLinesPage {
|
||||
items: ShippingDoneLineItem[];
|
||||
page: number;
|
||||
page_size: number;
|
||||
total: number;
|
||||
}
|
||||
|
||||
export interface ShippingDoneLineFilters {
|
||||
customer?: string;
|
||||
part_number?: string;
|
||||
notice_date_from?: string;
|
||||
notice_date_to?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页拉取「我的待办」。
|
||||
* @param params.bucket - pending | processing | done
|
||||
* @param params.terminal_kind - done 桶终态子视图(upload_complete | reject_void)
|
||||
*/
|
||||
export function listWorkspaceShippingMyTodos(params?: {
|
||||
bucket?: 'pending' | 'processing' | 'done' | string;
|
||||
@@ -37,6 +83,7 @@ export function listWorkspaceShippingMyTodos(params?: {
|
||||
todo_category?: string;
|
||||
customer?: string;
|
||||
task_no?: string;
|
||||
terminal_kind?: string;
|
||||
}) {
|
||||
const sp = new URLSearchParams();
|
||||
if (params?.bucket) sp.set('bucket', params.bucket);
|
||||
@@ -45,6 +92,7 @@ export function listWorkspaceShippingMyTodos(params?: {
|
||||
if (params?.todo_category) sp.set('todo_category', params.todo_category);
|
||||
if (params?.customer) sp.set('customer', params.customer);
|
||||
if (params?.task_no) sp.set('task_no', params.task_no);
|
||||
if (params?.terminal_kind) sp.set('terminal_kind', params.terminal_kind);
|
||||
const q = sp.toString();
|
||||
return requestJson<ShippingMyTodosPage>(
|
||||
`/api/workspace/shipping-tasks/my-todos${q ? `?${q}` : ''}`,
|
||||
@@ -58,6 +106,68 @@ export function countWorkspaceShippingMyTodos() {
|
||||
return requestJson<ShippingMyTodosCount>('/api/workspace/shipping-tasks/my-todos/count');
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页拉取已完成通知的平铺明细行(通知完成报表)。
|
||||
* 明细行跨 Notice 混排、不按 OT 聚合,仅含已核验上传成功的通知。
|
||||
*/
|
||||
export function listWorkspaceShippingDoneLines(params?: {
|
||||
page?: number;
|
||||
page_size?: number;
|
||||
} & ShippingDoneLineFilters) {
|
||||
const sp = new URLSearchParams();
|
||||
if (params?.page) sp.set('page', String(params.page));
|
||||
if (params?.page_size) sp.set('page_size', String(params.page_size));
|
||||
if (params?.customer) sp.set('customer', params.customer);
|
||||
if (params?.part_number) sp.set('part_number', params.part_number);
|
||||
if (params?.notice_date_from) sp.set('notice_date_from', params.notice_date_from);
|
||||
if (params?.notice_date_to) sp.set('notice_date_to', params.notice_date_to);
|
||||
const q = sp.toString();
|
||||
return requestJson<ShippingDoneLinesPage>(
|
||||
`/api/workspace/shipping-tasks/my-todos/done-lines${q ? `?${q}` : ''}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载当前筛选下的已完成通知明细 Excel(固定 12 列标准格式,不含 OT 编号)。
|
||||
* 核心逻辑:浏览器受控 a[download] 下载,后端复核可见性与筛选参数。
|
||||
*/
|
||||
export async function downloadWorkspaceShippingDoneLinesExcel(
|
||||
filters?: ShippingDoneLineFilters,
|
||||
): Promise<void> {
|
||||
const sp = new URLSearchParams();
|
||||
if (filters?.customer) sp.set('customer', filters.customer);
|
||||
if (filters?.part_number) sp.set('part_number', filters.part_number);
|
||||
if (filters?.notice_date_from) sp.set('notice_date_from', filters.notice_date_from);
|
||||
if (filters?.notice_date_to) sp.set('notice_date_to', filters.notice_date_to);
|
||||
const q = sp.toString();
|
||||
const url = `/api/workspace/shipping-tasks/my-todos/done-lines/export${q ? `?${q}` : ''}`;
|
||||
const { getAuthHeaders } = await import('@/shared/utils/auth');
|
||||
const res = await fetch(url, { headers: getAuthHeaders() });
|
||||
if (!res.ok) {
|
||||
const body = await res.json().catch(() => ({}));
|
||||
throw new Error(
|
||||
(body as { error?: string; message?: string })?.error
|
||||
|| (body as { message?: string })?.message
|
||||
|| res.statusText,
|
||||
);
|
||||
}
|
||||
const disposition = res.headers.get('content-disposition');
|
||||
const blob = await res.blob();
|
||||
const objectUrl = URL.createObjectURL(blob);
|
||||
const anchor = document.createElement('a');
|
||||
anchor.href = objectUrl;
|
||||
const rawName = disposition?.match(/filename\*?=(?:UTF-8'')?["']?([^;"'\n]+)/)?.[1] || 'done-lines.xlsx';
|
||||
try {
|
||||
anchor.download = decodeURIComponent(rawName);
|
||||
} catch {
|
||||
anchor.download = rawName;
|
||||
}
|
||||
document.body.appendChild(anchor);
|
||||
anchor.click();
|
||||
document.body.removeChild(anchor);
|
||||
URL.revokeObjectURL(objectUrl);
|
||||
}
|
||||
|
||||
export {
|
||||
downloadWorkspaceShippingExcelFile,
|
||||
markWorkspaceShippingManualUploaded,
|
||||
|
||||
Reference in new issue
Block a user