feat(freight-rpa): 库存/收料改名在手/入站,报表归属RPA,类名统一FreightRpa
把 shipping 侧 inventory/receipt 词根迁到 onhand/inbound,29 张表与 枚举/权限/前端/i18n 同步改名;在手与入站报表配置及文件改由 freight_rpa 持有,发货与调拨仅按 source_code 消费;ORM 类加 FreightRpa 前缀, 上传动作改为 freight_rpa_upload。含类名与上传动作改名规格文档。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
ffc0d4a430
commit
39fe3c05f2
453 files changed
+17945
-8646
No files matched your search
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* features/workspace/api/inbound-report.api.spec.ts
|
||||
* 用途:锁定收料报表列表与下载地址的工作台契约。
|
||||
* 依赖:inbound-report.api、vitest。
|
||||
* 逻辑:普通接收人只能经工作台受控下载,不拼接对象存储地址。
|
||||
*/
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import {
|
||||
listFailedInboundRpaUnits, inboundReportDownloadUrl, resendInboundReportFile, retryInboundRpaUnit,
|
||||
} from './inbound-report.api';
|
||||
|
||||
describe('inboundReportDownloadUrl', () => {
|
||||
it('uses the workspace authorization endpoint instead of an object storage URL', () => {
|
||||
// 关键断言:浏览器只能使用后端鉴权下载代理,不能得到 MinIO bucket/key。
|
||||
expect(inboundReportDownloadUrl(42)).toBe('/api/workspace/inbound-report-files/42/download');
|
||||
});
|
||||
|
||||
it('keeps manual compensation routes in the admin namespace', () => {
|
||||
expect(String(listFailedInboundRpaUnits)).toContain('inbound-rpa-units?status=failed');
|
||||
expect(String(retryInboundRpaUnit)).toContain('/api/admin/inbound-rpa-units/');
|
||||
expect(String(resendInboundReportFile)).toContain('/api/admin/inbound-report-files/');
|
||||
});
|
||||
});
|
||||
+12
-12
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* features/workspace/api/receipt-report.api.ts
|
||||
* features/workspace/api/inbound-report.api.ts
|
||||
* 用途:工作台收料归档列表与受控下载 API。
|
||||
* 依赖:requestJson、getAuthHeaders。
|
||||
* 逻辑:列表由服务端按当前接收人/管理员授权裁剪;下载始终经过工作台鉴权代理。
|
||||
@@ -8,7 +8,7 @@
|
||||
import { requestJson } from '@/shared/api/client';
|
||||
import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
|
||||
export type ReceiptReportFile = {
|
||||
export type InboundReportFile = {
|
||||
id: number;
|
||||
original_filename: string;
|
||||
content_type?: string | null;
|
||||
@@ -22,7 +22,7 @@ export type ReceiptReportFile = {
|
||||
download_url: string;
|
||||
};
|
||||
|
||||
export type ReceiptRpaUnit = {
|
||||
export type InboundRpaUnit = {
|
||||
id: number;
|
||||
source_code: string;
|
||||
warehouse_id?: string | null;
|
||||
@@ -40,8 +40,8 @@ export type ReceiptRpaUnit = {
|
||||
* 核心逻辑:不接收 user_id 或对象存储参数,服务端以当前会话和排程接收人关系授权。
|
||||
* @returns 脱敏归档元数据和受控下载地址。
|
||||
*/
|
||||
export const listWorkspaceReceiptReportFiles = (limit = 100) => requestJson<{ items: ReceiptReportFile[] }>(
|
||||
`/api/workspace/receipt-report-files?limit=${encodeURIComponent(String(limit))}`,
|
||||
export const listWorkspaceInboundReportFiles = (limit = 100) => requestJson<{ items: InboundReportFile[] }>(
|
||||
`/api/workspace/inbound-report-files?limit=${encodeURIComponent(String(limit))}`,
|
||||
{ headers: getAuthHeaders() },
|
||||
);
|
||||
|
||||
@@ -51,21 +51,21 @@ export const listWorkspaceReceiptReportFiles = (limit = 100) => requestJson<{ it
|
||||
* @param fileId - 收料归档文件主键。
|
||||
* @returns 由后端再次校验接收人权限的下载路径。
|
||||
*/
|
||||
export const receiptReportDownloadUrl = (fileId: number) => `/api/workspace/receipt-report-files/${encodeURIComponent(String(fileId))}/download`;
|
||||
export const inboundReportDownloadUrl = (fileId: number) => `/api/workspace/inbound-report-files/${encodeURIComponent(String(fileId))}/download`;
|
||||
|
||||
/** 管理员读取失败收料单元;普通用户不调用此管理端接口。 */
|
||||
export const listFailedReceiptRpaUnits = () => requestJson<{ items: ReceiptRpaUnit[] }>(
|
||||
'/api/admin/receipt-rpa-units?status=failed&limit=100', { headers: getAuthHeaders() },
|
||||
export const listFailedInboundRpaUnits = () => requestJson<{ items: InboundRpaUnit[] }>(
|
||||
'/api/admin/inbound-rpa-units?status=failed&limit=100', { headers: getAuthHeaders() },
|
||||
);
|
||||
|
||||
/** 管理员以必填原因新建失败单元的独立人工重试事实。 */
|
||||
export const retryReceiptRpaUnit = (unitId: number, reason: string) => requestJson<unknown>(
|
||||
`/api/admin/receipt-rpa-units/${encodeURIComponent(String(unitId))}/retry`,
|
||||
export const retryInboundRpaUnit = (unitId: number, reason: string) => requestJson<unknown>(
|
||||
`/api/admin/inbound-rpa-units/${encodeURIComponent(String(unitId))}/retry`,
|
||||
{ method: 'POST', headers: { ...getAuthHeaders(), 'Content-Type': 'application/json' }, body: JSON.stringify({ reason }) },
|
||||
);
|
||||
|
||||
/** 管理员仅重发已归档文件的企微消息,不会重新导出。 */
|
||||
export const resendReceiptReportFile = (fileId: number) => requestJson<unknown>(
|
||||
`/api/admin/receipt-report-files/${encodeURIComponent(String(fileId))}/resend`,
|
||||
export const resendInboundReportFile = (fileId: number) => requestJson<unknown>(
|
||||
`/api/admin/inbound-report-files/${encodeURIComponent(String(fileId))}/resend`,
|
||||
{ method: 'POST', headers: getAuthHeaders() },
|
||||
);
|
||||
@@ -1,24 +0,0 @@
|
||||
/**
|
||||
* features/workspace/api/receipt-report.api.spec.ts
|
||||
* 用途:锁定收料报表列表与下载地址的工作台契约。
|
||||
* 依赖:receipt-report.api、vitest。
|
||||
* 逻辑:普通接收人只能经工作台受控下载,不拼接对象存储地址。
|
||||
*/
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import {
|
||||
listFailedReceiptRpaUnits, receiptReportDownloadUrl, resendReceiptReportFile, retryReceiptRpaUnit,
|
||||
} from './receipt-report.api';
|
||||
|
||||
describe('receiptReportDownloadUrl', () => {
|
||||
it('uses the workspace authorization endpoint instead of an object storage URL', () => {
|
||||
// 关键断言:浏览器只能使用后端鉴权下载代理,不能得到 MinIO bucket/key。
|
||||
expect(receiptReportDownloadUrl(42)).toBe('/api/workspace/receipt-report-files/42/download');
|
||||
});
|
||||
|
||||
it('keeps manual compensation routes in the admin namespace', () => {
|
||||
expect(String(listFailedReceiptRpaUnits)).toContain('receipt-rpa-units?status=failed');
|
||||
expect(String(retryReceiptRpaUnit)).toContain('/api/admin/receipt-rpa-units/');
|
||||
expect(String(resendReceiptReportFile)).toContain('/api/admin/receipt-report-files/');
|
||||
});
|
||||
});
|
||||
@@ -41,7 +41,7 @@ const i18n = createI18n({
|
||||
admin: '管理控制台',
|
||||
applications: '应用管理',
|
||||
scheduleRuns: '排程记录',
|
||||
receiptReports: '收料文件',
|
||||
inboundReports: '收料文件',
|
||||
shippingNotice: '货代发货',
|
||||
shippingCustomers: '客户主数据',
|
||||
shippingMyTasks: '我的待办',
|
||||
@@ -68,7 +68,7 @@ async function mountSidebar(user: { role: string; is_platform_admin?: boolean })
|
||||
{ path: WORKSPACE_PATHS.applications, name: 'workspace-applications', component: { template: '<div />' } },
|
||||
{ path: WORKSPACE_PATHS.profile, name: 'workspace-profile', component: { template: '<div />' } },
|
||||
{ path: WORKSPACE_PATHS.scheduleRuns, name: 'workspace-schedule-runs', component: { template: '<div />' } },
|
||||
{ path: WORKSPACE_PATHS.receiptReports, name: 'workspace-receipt-reports', component: { template: '<div />' } },
|
||||
{ path: WORKSPACE_PATHS.inboundReports, name: 'workspace-inbound-reports', component: { template: '<div />' } },
|
||||
{ path: WORKSPACE_PATHS.feedback, name: 'workspace-feedback', component: { template: '<div />' } },
|
||||
{ path: WORKSPACE_PATHS.updates, name: 'workspace-updates', component: { template: '<div />' } },
|
||||
{ path: WORKSPACE_PATHS.shippingNoticeCustomers, name: 'workspace-shipping-customers', component: { template: '<div />' } },
|
||||
|
||||
@@ -33,7 +33,7 @@ const primaryLinkItems = [
|
||||
{ path: WORKSPACE_PATHS.profile, labelKey: 'workspace.nav.profile', icon: User, match: ['workspace-profile'] },
|
||||
{ path: WORKSPACE_PATHS.applications, labelKey: 'workspace.nav.applications', icon: LayoutGrid, match: ['workspace-applications'] },
|
||||
{ path: WORKSPACE_PATHS.scheduleRuns, labelKey: 'workspace.nav.scheduleRuns', icon: Clock, match: ['workspace-schedule-runs'] },
|
||||
{ path: WORKSPACE_PATHS.receiptReports, labelKey: 'workspace.nav.receiptReports', icon: FileDown, match: ['workspace-receipt-reports'] },
|
||||
{ path: WORKSPACE_PATHS.inboundReports, labelKey: 'workspace.nav.inboundReports', icon: FileDown, match: ['workspace-inbound-reports'] },
|
||||
] as const;
|
||||
|
||||
const secondaryLinkItems = [
|
||||
|
||||
@@ -21,7 +21,7 @@ const ROUTE_NAME_TO_SIDEBAR: Record<string, WorkspaceSidebarItem> = {
|
||||
'workspace-knowledge-base': 'knowledge_base',
|
||||
'workspace-knowledge-base-group': 'knowledge_base',
|
||||
'workspace-schedule-runs': 'schedule_runs',
|
||||
'workspace-receipt-reports': 'receipt_reports',
|
||||
'workspace-inbound-reports': 'receipt_reports',
|
||||
'workspace-shipping-customers': 'shipping_notice',
|
||||
'workspace-shipping-tasks': 'shipping_notice',
|
||||
'workspace-shipping-my-tasks': 'shipping_notice',
|
||||
|
||||
@@ -11,7 +11,7 @@ export const WORKSPACE_PATHS = {
|
||||
updates: '/workspace/updates',
|
||||
knowledgeBase: '/workspace/knowledge-base',
|
||||
scheduleRuns: '/workspace/schedule-runs',
|
||||
receiptReports: '/workspace/receipt-reports',
|
||||
inboundReports: '/workspace/inbound-reports',
|
||||
shippingNotice: '/workspace/shipping-notice/my-tasks',
|
||||
shippingNoticeCustomers: '/workspace/shipping-notice/customers',
|
||||
shippingNoticeTasks: '/workspace/shipping-notice/tasks',
|
||||
@@ -35,7 +35,7 @@ export const LEGACY_VIEW_TO_PATH: Record<string, string> = {
|
||||
updates: WORKSPACE_PATHS.updates,
|
||||
knowledge_base: WORKSPACE_PATHS.knowledgeBase,
|
||||
schedule_runs: WORKSPACE_PATHS.scheduleRuns,
|
||||
receipt_reports: WORKSPACE_PATHS.receiptReports,
|
||||
receipt_reports: WORKSPACE_PATHS.inboundReports,
|
||||
shipping_notice: WORKSPACE_PATHS.shippingNotice,
|
||||
accounting_voucher_check: WORKSPACE_PATHS.accountingVoucherCheck,
|
||||
contract_payment: WORKSPACE_PATHS.contractPayment,
|
||||
|
||||
+25
-25
@@ -1,26 +1,26 @@
|
||||
/**
|
||||
* features/workspace/pages/ReceiptReportFilesPage.spec.ts
|
||||
* features/workspace/pages/InboundReportFilesPage.spec.ts
|
||||
* 用途:验证收料归档页的接收人与管理员补偿权限边界。
|
||||
* 依赖:Vue Test Utils、Vue I18n、receipt-report.api、Workspace 上下文。
|
||||
* 依赖:Vue Test Utils、Vue I18n、inbound-report.api、Workspace 上下文。
|
||||
* 逻辑:普通接收人只能下载获授权文件;管理员才会查询失败单元并看到重发/重试操作。
|
||||
*/
|
||||
|
||||
import { flushPromises, mount } from '@vue/test-utils';
|
||||
import { createI18n } from 'vue-i18n';
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import ReceiptReportFilesPage from './ReceiptReportFilesPage.vue';
|
||||
import InboundReportFilesPage from './InboundReportFilesPage.vue';
|
||||
import { WORKSPACE_KEY } from '../composables/workspace.context';
|
||||
|
||||
const listWorkspaceReceiptReportFiles = vi.fn();
|
||||
const listFailedReceiptRpaUnits = vi.fn();
|
||||
const resendReceiptReportFile = vi.fn();
|
||||
const listWorkspaceInboundReportFiles = vi.fn();
|
||||
const listFailedInboundRpaUnits = vi.fn();
|
||||
const resendInboundReportFile = vi.fn();
|
||||
|
||||
vi.mock('../api/receipt-report.api', () => ({
|
||||
listWorkspaceReceiptReportFiles: (...args: unknown[]) => listWorkspaceReceiptReportFiles(...args),
|
||||
listFailedReceiptRpaUnits: (...args: unknown[]) => listFailedReceiptRpaUnits(...args),
|
||||
receiptReportDownloadUrl: (id: number) => `/download/${id}`,
|
||||
resendReceiptReportFile: (...args: unknown[]) => resendReceiptReportFile(...args),
|
||||
retryReceiptRpaUnit: vi.fn(),
|
||||
vi.mock('../api/inbound-report.api', () => ({
|
||||
listWorkspaceInboundReportFiles: (...args: unknown[]) => listWorkspaceInboundReportFiles(...args),
|
||||
listFailedInboundRpaUnits: (...args: unknown[]) => listFailedInboundRpaUnits(...args),
|
||||
inboundReportDownloadUrl: (id: number) => `/download/${id}`,
|
||||
resendInboundReportFile: (...args: unknown[]) => resendInboundReportFile(...args),
|
||||
retryInboundRpaUnit: vi.fn(),
|
||||
}));
|
||||
|
||||
const i18n = createI18n({
|
||||
@@ -29,7 +29,7 @@ const i18n = createI18n({
|
||||
messages: {
|
||||
en: {
|
||||
workspace: {
|
||||
receiptReports: {
|
||||
inboundReports: {
|
||||
title: 'Receipt Files', hint: 'hint', refresh: 'Refresh', loading: 'Loading', empty: 'Empty',
|
||||
file: 'File', site: 'Site', warehouse: 'Warehouse', createdAt: 'Created', expiresAt: 'Expires',
|
||||
action: 'Action', download: 'Download', resend: 'Resend to WeCom', failedUnits: 'Failed receipt units',
|
||||
@@ -41,7 +41,7 @@ const i18n = createI18n({
|
||||
});
|
||||
|
||||
function mountPage(role: string) {
|
||||
return mount(ReceiptReportFilesPage, {
|
||||
return mount(InboundReportFilesPage, {
|
||||
global: {
|
||||
plugins: [i18n],
|
||||
provide: { [WORKSPACE_KEY as symbol]: { currentUser: { role } } },
|
||||
@@ -49,12 +49,12 @@ function mountPage(role: string) {
|
||||
});
|
||||
}
|
||||
|
||||
describe('ReceiptReportFilesPage permissions', () => {
|
||||
describe('InboundReportFilesPage permissions', () => {
|
||||
it('does not expose administrator compensation actions to a recipient', async () => {
|
||||
listWorkspaceReceiptReportFiles.mockResolvedValue({ items: [{
|
||||
listWorkspaceInboundReportFiles.mockResolvedValue({ items: [{
|
||||
id: 1, original_filename: 'receipt.xlsx', file_size: 12, sha256: 'a'.repeat(64),
|
||||
}] });
|
||||
listFailedReceiptRpaUnits.mockResolvedValue({ items: [{ id: 9, source_code: 'DBS-A', status: 'failed' }] });
|
||||
listFailedInboundRpaUnits.mockResolvedValue({ items: [{ id: 9, source_code: 'DBS-A', status: 'failed' }] });
|
||||
|
||||
const wrapper = mountPage('user');
|
||||
await flushPromises();
|
||||
@@ -63,12 +63,12 @@ describe('ReceiptReportFilesPage permissions', () => {
|
||||
expect(wrapper.text()).toContain('Download');
|
||||
expect(wrapper.text()).not.toContain('Resend to WeCom');
|
||||
expect(wrapper.text()).not.toContain('Failed receipt units');
|
||||
expect(listFailedReceiptRpaUnits).not.toHaveBeenCalled();
|
||||
expect(listFailedInboundRpaUnits).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('shows failed-unit compensation only to an administrator', async () => {
|
||||
listWorkspaceReceiptReportFiles.mockResolvedValue({ items: [] });
|
||||
listFailedReceiptRpaUnits.mockResolvedValue({ items: [{
|
||||
listWorkspaceInboundReportFiles.mockResolvedValue({ items: [] });
|
||||
listFailedInboundRpaUnits.mockResolvedValue({ items: [{
|
||||
id: 9, source_code: 'DBS-A', warehouse_id: 'WH-01', status: 'failed', error_code: 'RPA.TIMEOUT',
|
||||
}] });
|
||||
|
||||
@@ -79,15 +79,15 @@ describe('ReceiptReportFilesPage permissions', () => {
|
||||
expect(wrapper.text()).toContain('Failed receipt units');
|
||||
expect(wrapper.text()).toContain('DBS-A / WH-01');
|
||||
expect(wrapper.text()).toContain('Retry with reason');
|
||||
expect(listFailedReceiptRpaUnits).toHaveBeenCalledOnce();
|
||||
expect(listFailedInboundRpaUnits).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it('uses the notification resend action without creating another export', async () => {
|
||||
listWorkspaceReceiptReportFiles.mockResolvedValue({ items: [{
|
||||
listWorkspaceInboundReportFiles.mockResolvedValue({ items: [{
|
||||
id: 7, original_filename: 'receipt.xlsx', file_size: 12, sha256: 'b'.repeat(64),
|
||||
}] });
|
||||
listFailedReceiptRpaUnits.mockResolvedValue({ items: [] });
|
||||
resendReceiptReportFile.mockResolvedValue({});
|
||||
listFailedInboundRpaUnits.mockResolvedValue({ items: [] });
|
||||
resendInboundReportFile.mockResolvedValue({});
|
||||
|
||||
const wrapper = mountPage('admin');
|
||||
await flushPromises();
|
||||
@@ -95,7 +95,7 @@ describe('ReceiptReportFilesPage permissions', () => {
|
||||
await flushPromises();
|
||||
|
||||
// 重发只调用归档文件的通知接口,不存在浏览器侧重新导出入口。
|
||||
expect(resendReceiptReportFile).toHaveBeenCalledWith(7);
|
||||
expect(resendInboundReportFile).toHaveBeenCalledWith(7);
|
||||
expect(wrapper.text()).not.toContain('Export');
|
||||
});
|
||||
});
|
||||
+22
-22
@@ -1,22 +1,22 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* features/workspace/pages/ReceiptReportFilesPage.vue
|
||||
* features/workspace/pages/InboundReportFilesPage.vue
|
||||
* 用途:向排程收件人展示可下载的收料原样归档文件。
|
||||
* 依赖:receipt-report.api、Vue I18n、Lucide。
|
||||
* 依赖:inbound-report.api、Vue I18n、Lucide。
|
||||
* 逻辑:文件列表始终由服务端按收件人授权裁剪;浏览器只请求受控下载地址。
|
||||
*/
|
||||
import { computed, inject, onMounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { Download, RefreshCw } from 'lucide-vue-next';
|
||||
import {
|
||||
listFailedReceiptRpaUnits, listWorkspaceReceiptReportFiles, receiptReportDownloadUrl,
|
||||
resendReceiptReportFile, retryReceiptRpaUnit, type ReceiptReportFile, type ReceiptRpaUnit,
|
||||
} from '../api/receipt-report.api';
|
||||
listFailedInboundRpaUnits, listWorkspaceInboundReportFiles, inboundReportDownloadUrl,
|
||||
resendInboundReportFile, retryInboundRpaUnit, type InboundReportFile, type InboundRpaUnit,
|
||||
} from '../api/inbound-report.api';
|
||||
import { WORKSPACE_KEY } from '../composables/workspace.context';
|
||||
import { isPlatformAdminUser } from '@/shared/utils/auth';
|
||||
|
||||
const files = ref<ReceiptReportFile[]>([]);
|
||||
const failedUnits = ref<ReceiptRpaUnit[]>([]);
|
||||
const files = ref<InboundReportFile[]>([]);
|
||||
const failedUnits = ref<InboundRpaUnit[]>([]);
|
||||
const loading = ref(false);
|
||||
const { t } = useI18n();
|
||||
const ws = inject(WORKSPACE_KEY);
|
||||
@@ -26,8 +26,8 @@ const isAdmin = computed(() => isPlatformAdminUser(ws?.currentUser));
|
||||
async function loadFiles(): Promise<void> {
|
||||
loading.value = true;
|
||||
try {
|
||||
files.value = (await listWorkspaceReceiptReportFiles()).items;
|
||||
failedUnits.value = isAdmin.value ? (await listFailedReceiptRpaUnits()).items : [];
|
||||
files.value = (await listWorkspaceInboundReportFiles()).items;
|
||||
failedUnits.value = isAdmin.value ? (await listFailedInboundRpaUnits()).items : [];
|
||||
} catch {
|
||||
files.value = [];
|
||||
} finally {
|
||||
@@ -43,21 +43,21 @@ function formatDate(value?: string | null): string {
|
||||
}
|
||||
|
||||
/** 统一从后端受控下载入口获取文件,下载时服务端会再次做权限审计。 */
|
||||
function downloadFile(file: ReceiptReportFile): void {
|
||||
window.location.assign(receiptReportDownloadUrl(file.id));
|
||||
function downloadFile(file: InboundReportFile): void {
|
||||
window.location.assign(inboundReportDownloadUrl(file.id));
|
||||
}
|
||||
|
||||
/** 管理员重发已归档文件,不触发任何新的 RPA 导出。 */
|
||||
async function resendFile(file: ReceiptReportFile): Promise<void> {
|
||||
await resendReceiptReportFile(file.id);
|
||||
async function resendFile(file: InboundReportFile): Promise<void> {
|
||||
await resendInboundReportFile(file.id);
|
||||
}
|
||||
|
||||
/** 管理员填写审计原因后才允许创建新的失败单元重试。 */
|
||||
async function retryUnit(unit: ReceiptRpaUnit): Promise<void> {
|
||||
async function retryUnit(unit: InboundRpaUnit): Promise<void> {
|
||||
const target = `${unit.source_code}${unit.warehouse_id ? ` / ${unit.warehouse_id}` : ''}`;
|
||||
const reason = window.prompt(t('workspace.receiptReports.retryReasonPrompt', { target }));
|
||||
const reason = window.prompt(t('workspace.inboundReports.retryReasonPrompt', { target }));
|
||||
if (!reason?.trim()) return;
|
||||
await retryReceiptRpaUnit(unit.id, reason.trim());
|
||||
await retryInboundRpaUnit(unit.id, reason.trim());
|
||||
await loadFiles();
|
||||
}
|
||||
|
||||
@@ -67,12 +67,12 @@ onMounted(() => { void loadFiles(); });
|
||||
<template>
|
||||
<section class="space-y-5 animate-fade-in-up">
|
||||
<header class="flex items-center justify-between gap-3">
|
||||
<div><h2 class="text-2xl font-bold text-primary">{{ $t('workspace.receiptReports.title') }}</h2><p class="mt-1 text-sm text-muted">{{ $t('workspace.receiptReports.hint') }}</p></div>
|
||||
<button type="button" class="inline-flex items-center gap-1.5 rounded-xl border border-default px-3 py-1.5 text-sm font-medium text-secondary hover:bg-surface-soft" :disabled="loading" @click="loadFiles"><RefreshCw class="h-3.5 w-3.5" />{{ $t('workspace.receiptReports.refresh') }}</button>
|
||||
<div><h2 class="text-2xl font-bold text-primary">{{ $t('workspace.inboundReports.title') }}</h2><p class="mt-1 text-sm text-muted">{{ $t('workspace.inboundReports.hint') }}</p></div>
|
||||
<button type="button" class="inline-flex items-center gap-1.5 rounded-xl border border-default px-3 py-1.5 text-sm font-medium text-secondary hover:bg-surface-soft" :disabled="loading" @click="loadFiles"><RefreshCw class="h-3.5 w-3.5" />{{ $t('workspace.inboundReports.refresh') }}</button>
|
||||
</header>
|
||||
<div v-if="loading" class="rounded-2xl border border-dashed border-default py-10 text-center text-sm text-muted">{{ $t('workspace.receiptReports.loading') }}</div>
|
||||
<div v-else-if="!files.length" class="rounded-2xl border border-dashed border-default py-10 text-center text-sm text-muted">{{ $t('workspace.receiptReports.empty') }}</div>
|
||||
<div v-else class="overflow-hidden rounded-2xl border border-default bg-surface"><div class="overflow-auto"><table class="w-full min-w-[860px] text-sm"><thead class="border-b border-subtle bg-surface-soft text-left text-secondary"><tr><th class="px-4 py-3">{{ $t('workspace.receiptReports.file') }}</th><th class="px-4 py-3">{{ $t('workspace.receiptReports.site') }}</th><th class="px-4 py-3">{{ $t('workspace.receiptReports.warehouse') }}</th><th class="px-4 py-3">{{ $t('workspace.receiptReports.createdAt') }}</th><th class="px-4 py-3">{{ $t('workspace.receiptReports.expiresAt') }}</th><th class="px-4 py-3">{{ $t('workspace.receiptReports.action') }}</th></tr></thead><tbody><tr v-for="file in files" :key="file.id" class="border-b border-subtle last:border-0"><td class="px-4 py-3 font-medium text-primary">{{ file.original_filename }}</td><td class="px-4 py-3 text-muted">{{ file.source_code || '-' }}</td><td class="px-4 py-3 text-muted">{{ file.warehouse_id || '-' }}</td><td class="px-4 py-3 text-muted">{{ formatDate(file.created_at) }}</td><td class="px-4 py-3 text-muted">{{ formatDate(file.archive_expires_at) }}</td><td class="px-4 py-3"><button type="button" class="inline-flex items-center gap-1 rounded-lg border border-default px-2 py-1 text-xs font-medium text-secondary hover:bg-surface-soft" @click="downloadFile(file)"><Download class="h-3 w-3" />{{ $t('workspace.receiptReports.download') }}</button><button v-if="isAdmin" type="button" class="ml-2 inline-flex rounded-lg border border-default px-2 py-1 text-xs font-medium text-secondary hover:bg-surface-soft" @click="resendFile(file)">{{ $t('workspace.receiptReports.resend') }}</button></td></tr></tbody></table></div></div>
|
||||
<section v-if="isAdmin && failedUnits.length" class="overflow-hidden rounded-2xl border border-amber-200 bg-amber-50/40"><header class="border-b border-amber-200 px-4 py-3 text-sm font-semibold text-primary">{{ $t('workspace.receiptReports.failedUnits') }}</header><div class="overflow-auto"><table class="w-full min-w-[720px] text-sm"><tbody><tr v-for="unit in failedUnits" :key="unit.id" class="border-b border-amber-100 last:border-0"><td class="px-4 py-3 font-medium">{{ unit.source_code }}<span v-if="unit.warehouse_id"> / {{ unit.warehouse_id }}</span></td><td class="px-4 py-3 text-muted">{{ unit.error_code || unit.error_message || '-' }}</td><td class="px-4 py-3"><button type="button" class="rounded-lg border border-amber-300 px-2 py-1 text-xs font-medium text-amber-800 hover:bg-amber-100" @click="retryUnit(unit)">{{ $t('workspace.receiptReports.retry') }}</button></td></tr></tbody></table></div></section>
|
||||
<div v-if="loading" class="rounded-2xl border border-dashed border-default py-10 text-center text-sm text-muted">{{ $t('workspace.inboundReports.loading') }}</div>
|
||||
<div v-else-if="!files.length" class="rounded-2xl border border-dashed border-default py-10 text-center text-sm text-muted">{{ $t('workspace.inboundReports.empty') }}</div>
|
||||
<div v-else class="overflow-hidden rounded-2xl border border-default bg-surface"><div class="overflow-auto"><table class="w-full min-w-[860px] text-sm"><thead class="border-b border-subtle bg-surface-soft text-left text-secondary"><tr><th class="px-4 py-3">{{ $t('workspace.inboundReports.file') }}</th><th class="px-4 py-3">{{ $t('workspace.inboundReports.site') }}</th><th class="px-4 py-3">{{ $t('workspace.inboundReports.warehouse') }}</th><th class="px-4 py-3">{{ $t('workspace.inboundReports.createdAt') }}</th><th class="px-4 py-3">{{ $t('workspace.inboundReports.expiresAt') }}</th><th class="px-4 py-3">{{ $t('workspace.inboundReports.action') }}</th></tr></thead><tbody><tr v-for="file in files" :key="file.id" class="border-b border-subtle last:border-0"><td class="px-4 py-3 font-medium text-primary">{{ file.original_filename }}</td><td class="px-4 py-3 text-muted">{{ file.source_code || '-' }}</td><td class="px-4 py-3 text-muted">{{ file.warehouse_id || '-' }}</td><td class="px-4 py-3 text-muted">{{ formatDate(file.created_at) }}</td><td class="px-4 py-3 text-muted">{{ formatDate(file.archive_expires_at) }}</td><td class="px-4 py-3"><button type="button" class="inline-flex items-center gap-1 rounded-lg border border-default px-2 py-1 text-xs font-medium text-secondary hover:bg-surface-soft" @click="downloadFile(file)"><Download class="h-3 w-3" />{{ $t('workspace.inboundReports.download') }}</button><button v-if="isAdmin" type="button" class="ml-2 inline-flex rounded-lg border border-default px-2 py-1 text-xs font-medium text-secondary hover:bg-surface-soft" @click="resendFile(file)">{{ $t('workspace.inboundReports.resend') }}</button></td></tr></tbody></table></div></div>
|
||||
<section v-if="isAdmin && failedUnits.length" class="overflow-hidden rounded-2xl border border-amber-200 bg-amber-50/40"><header class="border-b border-amber-200 px-4 py-3 text-sm font-semibold text-primary">{{ $t('workspace.inboundReports.failedUnits') }}</header><div class="overflow-auto"><table class="w-full min-w-[720px] text-sm"><tbody><tr v-for="unit in failedUnits" :key="unit.id" class="border-b border-amber-100 last:border-0"><td class="px-4 py-3 font-medium">{{ unit.source_code }}<span v-if="unit.warehouse_id"> / {{ unit.warehouse_id }}</span></td><td class="px-4 py-3 text-muted">{{ unit.error_code || unit.error_message || '-' }}</td><td class="px-4 py-3"><button type="button" class="rounded-lg border border-amber-300 px-2 py-1 text-xs font-medium text-amber-800 hover:bg-amber-100" @click="retryUnit(unit)">{{ $t('workspace.inboundReports.retry') }}</button></td></tr></tbody></table></div></section>
|
||||
</section>
|
||||
</template>
|
||||
+4
-4
@@ -77,7 +77,7 @@ function detail(): ShippingTaskDetail {
|
||||
summary: { title: 't', message: 'm' },
|
||||
actions: {
|
||||
primary: {
|
||||
code: 'retry_inventory_matching', kind: 'recovery', enabled: true,
|
||||
code: 'retry_onhand_matching', kind: 'recovery', enabled: true,
|
||||
label: '重新匹配', dispatch: 'mutation',
|
||||
requires_confirmation: false,
|
||||
},
|
||||
@@ -87,7 +87,7 @@ function detail(): ShippingTaskDetail {
|
||||
process_gate: {
|
||||
execution_no: 'SPE-1',
|
||||
current_blocking_gate: {
|
||||
gate_code: 'inventory_matching',
|
||||
gate_code: 'onhand_matching',
|
||||
evaluation_version: 3,
|
||||
},
|
||||
},
|
||||
@@ -137,9 +137,9 @@ describe('TaskTodoPanel actionsExecutable', () => {
|
||||
execution_no: 'SPE-1',
|
||||
technical_auto_only: true,
|
||||
current_blocking_gate: {
|
||||
gate_code: 'inventory_preparation',
|
||||
gate_code: 'onhand_preparation',
|
||||
evaluation_version: 3,
|
||||
next_action_code: 'poll_inventory_preparation',
|
||||
next_action_code: 'poll_onhand_preparation',
|
||||
},
|
||||
},
|
||||
} as ShippingTaskDetail['ui_state'];
|
||||
|
||||
Reference in new issue
Block a user