Merge branch 'dev' into order-delivery-reply
# Conflicts: # backend/app/__init__.py # backend/app/services/admin/permission_service.py # frontend/src/features/user/views/UserProfilePage.vue # frontend/src/locales/en/admin.json # frontend/src/locales/th/admin.json # frontend/src/locales/zh-CN/admin.json # frontend/src/locales/zh-TW/admin.json
This commit is contained in:
commit
42d8b70250
300 files changed
+32072
-6411
No files matched your search
+212
@@ -0,0 +1,212 @@
|
||||
/**
|
||||
* features/admin/modules/integration-connector/IntegrationCallLogsPanel.spec.ts
|
||||
* 用途:锁定集成调用日志面板行为——挂载即拉列表、筛选带参查询、行点击开抽屉呈现
|
||||
* wire 关键文本与步骤时间线、复制按钮按连接类型分流(soap=复制 curl,
|
||||
* database=复制 SQL 绑定内联)、wire_json 为 NULL 的历史行显示「无线级详情」。
|
||||
* 依赖:vi.mock(./api/integration-connector.api)、@vue/test-utils、i18n。
|
||||
* 逻辑:mock 列表固定返回 2 行(同 operation_id 两步),详情按用例切换 soap /
|
||||
* database / 无 wire 三种 wire_json 形态,断言渲染与复制链路。
|
||||
*/
|
||||
import { enableAutoUnmount, flushPromises, mount } from '@vue/test-utils';
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import i18n from '@/i18n';
|
||||
import IntegrationCallLogsPanel from './components/IntegrationCallLogsPanel.vue';
|
||||
import { getIntegrationCall, listIntegrationCalls } from './api/integration-connector.api';
|
||||
import type {
|
||||
IntegrationCallDetail,
|
||||
IntegrationCallLogRow,
|
||||
} from './types/integration-connector.types';
|
||||
|
||||
vi.mock('./api/integration-connector.api', () => ({
|
||||
listIntegrationCalls: vi.fn(),
|
||||
getIntegrationCall: vi.fn(),
|
||||
}));
|
||||
|
||||
const mockList = vi.mocked(listIntegrationCalls);
|
||||
const mockDetail = vi.mocked(getIntegrationCall);
|
||||
|
||||
// 列表 2 行:同一次能力调用的 step0(database 成功)+ step1(soap 失败)
|
||||
const rows: IntegrationCallLogRow[] = [
|
||||
{
|
||||
id: 261, created_at: '2026-09-27T00:29:22', capability: 'in_transit_transfer.create_transfer',
|
||||
operation_id: 'op-cbf5aaaa-1111', trace_id: 'ic-244fbbbb-2222', status: 'business_failed',
|
||||
elapsed_ms: 324, business_ref: 'TGHX1-OR-26092600002', client_code: 'tiptop-ws',
|
||||
interface_code: 'erp-ws-submit-transfer', connector_type: 'soap', step_index: 1, step_count: 2,
|
||||
},
|
||||
{
|
||||
id: 260, created_at: '2026-09-27T00:29:21', capability: 'in_transit_transfer.create_transfer',
|
||||
operation_id: 'op-cbf5aaaa-1111', trace_id: 'ic-244fbbbb-2222', status: 'success',
|
||||
elapsed_ms: 2366, business_ref: null, client_code: 'erp-db',
|
||||
interface_code: 'submit-stage-table', connector_type: 'database', step_index: 0, step_count: 2,
|
||||
},
|
||||
];
|
||||
|
||||
function makeDetail(call: Partial<IntegrationCallDetail['call']>, wireJson: IntegrationCallDetail['call']['wire_json']): IntegrationCallDetail {
|
||||
return {
|
||||
call: {
|
||||
id: 261, created_at: '2026-09-27T00:29:22', capability: 'in_transit_transfer.create_transfer',
|
||||
operation_id: 'op-cbf5aaaa-1111', trace_id: 'ic-244fbbbb-2222', status: 'business_failed',
|
||||
elapsed_ms: 324, business_ref: 'TGHX1-OR-26092600002',
|
||||
binding_snapshot_json: {}, request_summary_json: { doc_no: 'TGHX1-OR-26092600002' },
|
||||
response_summary_json: { code: 'HTTP_500' }, wire_json: wireJson,
|
||||
...call,
|
||||
},
|
||||
timeline: [
|
||||
{ id: 260, step_index: 0, step_count: 2, interface_code: 'submit-stage-table', status: 'success', elapsed_ms: 2366 },
|
||||
{ id: 261, step_index: 1, step_count: 2, interface_code: 'erp-ws-submit-transfer', status: 'business_failed', elapsed_ms: 324 },
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
const soapDetail = makeDetail({}, {
|
||||
kind: 'soap', method: 'POST', url: 'http://erp/WS?wsdl', soap_action: '"urn:CreateTransfer"',
|
||||
request_body: '<soapenv:Envelope><Body>demo</Body></soapenv:Envelope>',
|
||||
http_status: 500, response_body: '<soapenv:Envelope><Fault/></soapenv:Envelope>',
|
||||
});
|
||||
|
||||
const databaseDetail = makeDetail({ id: 260, status: 'success', elapsed_ms: 2366 }, {
|
||||
kind: 'database',
|
||||
statements: [{ phase: 'pre', sql: 'INSERT INTO t (batch) VALUES (:batch)', binds: { batch: 'B1' }, rowcount: 1, row_count: 1 }],
|
||||
rowcount: 1,
|
||||
});
|
||||
|
||||
const noWireDetail = makeDetail({}, null);
|
||||
|
||||
function mountPanel() {
|
||||
return mount(IntegrationCallLogsPanel, { global: { plugins: [i18n] } });
|
||||
}
|
||||
|
||||
enableAutoUnmount(afterEach);
|
||||
|
||||
describe('IntegrationCallLogsPanel', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
mockList.mockResolvedValue({ total: 2, page: 1, page_size: 20, items: rows });
|
||||
});
|
||||
|
||||
it('挂载即拉取列表并渲染 2 行:时间/单号(business_ref 与 operation_id 前 8 位兜底)/步骤', async () => {
|
||||
// [断言意图] 面板挂载必须自主触发列表查询,不依赖外部触发
|
||||
const wrapper = mountPanel();
|
||||
await flushPromises();
|
||||
expect(mockList).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.findAll('[data-testid="call-row"]')).toHaveLength(2);
|
||||
// 行 261 有 business_ref:单号列显示业务单号
|
||||
expect(wrapper.text()).toContain('TGHX1-OR-26092600002');
|
||||
// 行 260 无 business_ref:单号列回退 operation_id 前 8 位
|
||||
expect(wrapper.text()).toContain('op-cbf5a');
|
||||
// 步骤列 1-based 展示(step_index 0/1 → 1/2、2/2)、状态徽章含原始状态值、耗时带 ms 后缀
|
||||
expect(wrapper.text()).toContain('1/2');
|
||||
expect(wrapper.text()).toContain('2/2');
|
||||
expect(wrapper.text()).toContain('business_failed');
|
||||
expect(wrapper.text()).toContain('2366ms');
|
||||
});
|
||||
|
||||
it('填 interface_code 后点查询:带筛选参数且回第一页重新拉取', async () => {
|
||||
// [断言意图] 筛选值必须原样进入 listIntegrationCalls 入参(querystring 由 api 层拼装)
|
||||
const wrapper = mountPanel();
|
||||
await flushPromises();
|
||||
await wrapper.find('[data-testid="call-filter-interface"]').setValue('erp-ws-submit-transfer');
|
||||
await wrapper.find('[data-testid="call-filter-query"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(mockList).toHaveBeenCalledTimes(2);
|
||||
expect(mockList).toHaveBeenLastCalledWith(
|
||||
expect.objectContaining({ interface_code: 'erp-ws-submit-transfer', page: 1, page_size: 20 }),
|
||||
);
|
||||
});
|
||||
|
||||
it('点行开详情抽屉:呈现 soap wire 关键文本、两步时间线与复制 operation_id 按钮', async () => {
|
||||
// [断言意图] 抽屉必须展示线级事实原文(请求 body XML)与同 operation_id 的各步时间线
|
||||
mockDetail.mockResolvedValue(soapDetail);
|
||||
const wrapper = mountPanel();
|
||||
await flushPromises();
|
||||
await wrapper.findAll('[data-testid="call-row"]')[0].trigger('click');
|
||||
await flushPromises();
|
||||
expect(wrapper.find('[data-testid="call-detail-drawer"]').exists()).toBe(true);
|
||||
expect(wrapper.text()).toContain('<soapenv:Envelope><Body>demo</Body></soapenv:Envelope>');
|
||||
// 时间线两步均渲染(step1 / step2,1-based 展示),当前步高亮存在
|
||||
expect(wrapper.text()).toContain('step1');
|
||||
expect(wrapper.text()).toContain('step2');
|
||||
expect(wrapper.text()).not.toContain('step0');
|
||||
expect(wrapper.text()).toContain('submit-stage-table');
|
||||
expect(wrapper.text()).toContain('erp-ws-submit-transfer');
|
||||
expect(wrapper.find('[data-testid="call-copy-operation-id"]').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('soap wire 出现复制 curl,点击后写入的命令含 url 与 SOAPAction', async () => {
|
||||
// [断言意图] soap 连接类型只提供 curl 复现入口,命令由 buildCurl 生成(可直接粘贴 bash)
|
||||
const writeText = vi.fn().mockResolvedValue(undefined);
|
||||
Object.assign(navigator, { clipboard: { writeText } });
|
||||
mockDetail.mockResolvedValue(soapDetail);
|
||||
const wrapper = mountPanel();
|
||||
await flushPromises();
|
||||
await wrapper.findAll('[data-testid="call-row"]')[0].trigger('click');
|
||||
await flushPromises();
|
||||
const curlBtn = wrapper.find('[data-testid="call-copy-curl"]');
|
||||
expect(curlBtn.exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="call-copy-sql"]').exists()).toBe(false);
|
||||
await curlBtn.trigger('click');
|
||||
await flushPromises();
|
||||
expect(writeText).toHaveBeenCalledTimes(1);
|
||||
const cmd = String(writeText.mock.calls[0][0]);
|
||||
expect(cmd).toContain("curl -X POST 'http://erp/WS?wsdl'");
|
||||
expect(cmd).toContain('SOAPAction');
|
||||
});
|
||||
|
||||
it('database wire 出现复制 SQL(绑定已内联)且不出现复制 curl;写入类带环境警示', async () => {
|
||||
// [断言意图] database 连接类型只提供 SQL 复现入口,:batch 绑定必须内联为字面量
|
||||
const writeText = vi.fn().mockResolvedValue(undefined);
|
||||
Object.assign(navigator, { clipboard: { writeText } });
|
||||
mockDetail.mockResolvedValue(databaseDetail);
|
||||
const wrapper = mountPanel();
|
||||
await flushPromises();
|
||||
await wrapper.findAll('[data-testid="call-row"]')[1].trigger('click');
|
||||
await flushPromises();
|
||||
const sqlBtn = wrapper.find('[data-testid="call-copy-sql"]');
|
||||
expect(sqlBtn.exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="call-copy-curl"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="call-sql-write-warning"]').exists()).toBe(true);
|
||||
await sqlBtn.trigger('click');
|
||||
await flushPromises();
|
||||
expect(writeText).toHaveBeenCalledWith(expect.stringContaining("INSERT INTO t (batch) VALUES ('B1')"));
|
||||
});
|
||||
|
||||
it('wire_json 为 NULL 的历史行:抽屉显示「无线级详情(历史记录)」且无复制 body/raw 入口', async () => {
|
||||
// [断言意图] 历史存量不回填,前端必须如实显示无线级详情而非留白或报错
|
||||
mockDetail.mockResolvedValue(noWireDetail);
|
||||
const wrapper = mountPanel();
|
||||
await flushPromises();
|
||||
await wrapper.findAll('[data-testid="call-row"]')[0].trigger('click');
|
||||
await flushPromises();
|
||||
expect(wrapper.find('[data-testid="call-no-wire"]').exists()).toBe(true);
|
||||
expect(wrapper.text()).toContain('无线级详情(历史记录)');
|
||||
expect(wrapper.find('[data-testid="call-copy-body"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="call-copy-raw"]').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('状态下拉与后端 RESULT_STATUSES 七值对齐;duplicate_success 绿 / duplicate_unverified 红', async () => {
|
||||
// [断言意图] 幂等重放审计行落入 duplicate_* 状态,筛选下拉缺值会导致该类日志无法筛出
|
||||
mockList.mockResolvedValue({
|
||||
total: 2, page: 1, page_size: 20,
|
||||
items: [
|
||||
{ ...rows[0], id: 270, status: 'duplicate_success', business_ref: null, interface_code: 'if-dup-ok' },
|
||||
{ ...rows[0], id: 271, status: 'duplicate_unverified', business_ref: null, interface_code: 'if-dup-unverified' },
|
||||
],
|
||||
});
|
||||
const wrapper = mountPanel();
|
||||
await flushPromises();
|
||||
const options = wrapper.find('[data-testid="call-filter-status"]').findAll('option')
|
||||
.map((o) => o.element.value).filter((v) => v !== '');
|
||||
expect(options).toEqual([
|
||||
'success', 'duplicate_success', 'duplicate_unverified',
|
||||
'business_failed', 'technical_failed', 'timeout', 'result_unknown',
|
||||
]);
|
||||
// [断言意图] 成功族判定:duplicate_success(幂等重放命中,业务已成功)徽章走绿色成功侧
|
||||
const dupOkRow = wrapper.findAll('[data-testid="call-row"]')[0];
|
||||
expect(dupOkRow.text()).toContain('duplicate_success');
|
||||
expect(dupOkRow.find('span.bg-green-100').exists()).toBe(true);
|
||||
// [断言意图] duplicate_unverified(回执未核实)保守归非成功态,徽章保持红色 ✗
|
||||
const dupUnknownRow = wrapper.findAll('[data-testid="call-row"]')[1];
|
||||
expect(dupUnknownRow.text()).toContain('duplicate_unverified');
|
||||
expect(dupUnknownRow.find('span.bg-red-100').exists()).toBe(true);
|
||||
});
|
||||
});
|
||||
+51
-4
@@ -23,11 +23,15 @@ const mockState = vi.hoisted(() => {
|
||||
const bindings = [
|
||||
{
|
||||
id: 1, capability: 'in_transit_transfer.query_inventory', context_selector_json: {},
|
||||
client_instance_code: '1001', interface_definition_code: 'IF-A',
|
||||
client_instance_code: '1001', interface_definition_code: 'IF-A', steps_json: [],
|
||||
param_mapping_json: {},
|
||||
mapping_version: 1, priority: 0, environment: 'prod',
|
||||
effective_from: null, effective_to: null, status: 'published',
|
||||
},
|
||||
];
|
||||
const interfaces: Array<Record<string, unknown>> = [];
|
||||
const clients: Array<Record<string, unknown>> = [];
|
||||
let activeEntity = 'credential';
|
||||
const credentials = [
|
||||
{
|
||||
id: 1, code: 'tiptop-erp', secret_ref: 'db:tiptop-erp', secret_provider: 'db',
|
||||
@@ -41,14 +45,14 @@ const mockState = vi.hoisted(() => {
|
||||
},
|
||||
];
|
||||
const noop = () => vi.fn();
|
||||
return { credentials, capabilities, bindings };
|
||||
return { credentials, capabilities, bindings, interfaces, clients, get activeEntity() { return activeEntity; }, set activeEntity(v: string) { activeEntity = v; } };
|
||||
});
|
||||
|
||||
vi.mock('./composables/useIntegrationConnectorAdmin', () => ({
|
||||
useIntegrationConnectorAdmin: () => ({
|
||||
clients: ref([]), interfaces: ref([]), bindings: ref(mockState.bindings),
|
||||
clients: ref(mockState.clients), interfaces: ref(mockState.interfaces), bindings: ref(mockState.bindings),
|
||||
credentials: ref(mockState.credentials), capabilities: ref(mockState.capabilities), credentialTypes: ref([]),
|
||||
isLoading: ref(false), activeEntity: ref('credential'), showFormModal: ref(false), isSaving: ref(false),
|
||||
isLoading: ref(false), activeEntity: ref(mockState.activeEntity), showFormModal: ref(false), isSaving: ref(false),
|
||||
clientForm: ref(createEmptyClientInstanceForm()),
|
||||
interfaceForm: ref(createEmptyInterfaceDefinitionForm()),
|
||||
bindingForm: ref(createEmptyBindingForm()),
|
||||
@@ -133,4 +137,47 @@ describe('IntegrationConnectorPage credential list', () => {
|
||||
expect(text).toContain('在途库存查询');
|
||||
expect(text).toContain('in_transit_transfer.query_inventory');
|
||||
});
|
||||
|
||||
it('绑定列表按有序步骤渲染接口链与每步客户端;steps_json 为空的存量行走旧列兜底', async () => {
|
||||
const ifaceRow = (id: number, code: string, name: string, clientCode: string) => ({
|
||||
id, code, name, client_instance_code: clientCode, connector_type: 'rest', http_method: null,
|
||||
request_path: null, request_spec_json: {}, input_schema_json: {}, response_mapping_json: {},
|
||||
output_schema_json: {}, version: 1, status: 'published', enabled: true,
|
||||
});
|
||||
const clientRow = (id: number, code: string, name: string) => ({
|
||||
id, code, name, connector_type: 'rest', environment: 'prod', endpoint: null,
|
||||
timeout_seconds: null, config_json: {}, credential_ref_code: null, enabled: true,
|
||||
});
|
||||
mockState.interfaces = [ifaceRow(1, 'IF-A', '写入中间表', 'CLI-1'), ifaceRow(2, 'IF-B', '回读结果', 'CLI-2')] as never;
|
||||
mockState.clients = [clientRow(1, 'CLI-1', '生产库'), clientRow(2, 'CLI-2', '生产接口')] as never;
|
||||
mockState.bindings = [{
|
||||
id: 9, capability: 'cap.multi', context_selector_json: {},
|
||||
steps_json: [{ interface_code: 'IF-A', param_mapping_json: {} }, { interface_code: 'IF-B', param_mapping_json: {} }],
|
||||
param_mapping_json: {}, client_instance_code: 'CLI-1', interface_definition_code: 'IF-A',
|
||||
mapping_version: 1, priority: 0, environment: 'prod', effective_from: null, effective_to: null, status: 'published',
|
||||
}] as never;
|
||||
const wrapper = mountPage();
|
||||
const bindTab = wrapper.findAll('[role="tab"]').find((b) => b.text() === '绑定')!;
|
||||
await bindTab.trigger('click');
|
||||
const text = wrapper.text();
|
||||
// 两步全部渲染(编号 + 接口名),每步客户端与接口逐步对齐;列头为「接口步骤(有序)」
|
||||
expect(text).toContain('写入中间表');
|
||||
expect(text).toContain('回读结果');
|
||||
expect(text).toContain('生产库');
|
||||
expect(text).toContain('生产接口');
|
||||
expect(wrapper.findAll('th').some((th) => th.text().includes('接口步骤'))).toBe(true);
|
||||
|
||||
// 存量行兜底:steps_json 为空时由旧单步列合成一步
|
||||
mockState.bindings = [{
|
||||
id: 10, capability: 'cap.single', context_selector_json: {}, steps_json: [],
|
||||
param_mapping_json: {}, client_instance_code: 'CLI-1', interface_definition_code: 'IF-A',
|
||||
mapping_version: 1, priority: 0, environment: 'prod', effective_from: null, effective_to: null, status: 'draft',
|
||||
}] as never;
|
||||
const legacy = mountPage();
|
||||
const legacyTab = legacy.findAll('[role="tab"]').find((b) => b.text() === '绑定')!;
|
||||
await legacyTab.trigger('click');
|
||||
expect(legacy.text()).toContain('写入中间表');
|
||||
expect(legacy.text()).not.toContain('回读结果');
|
||||
mockState.bindings = [];
|
||||
});
|
||||
});
|
||||
+34
-11
@@ -1,7 +1,8 @@
|
||||
<!--
|
||||
features/admin/modules/integration-connector/IntegrationConnectorPage.vue
|
||||
用途:集成连接器管理页——四个配置实体(客户端实例/接口定义/绑定/凭据引用)tab 列表 +
|
||||
能力清单与手动调用测试;创建/编辑抽屉 + 行内连接测试。
|
||||
能力清单与手动调用测试;创建/编辑抽屉 + 行内连接测试;调用日志 tab
|
||||
承载筛选/分页列表/详情抽屉(能力无关通用口径)。
|
||||
依赖:useIntegrationConnectorAdmin、抽屉与调用测试弹窗组件、useI18n。
|
||||
逻辑:按 tab 展示列表与「新增」;客户端列表展示类型/环境徽章、行内启停开关与
|
||||
连接测试结果(徽章 + 可展开详情);接口定义与绑定列表均以状态徽章 + 生命周期行内
|
||||
@@ -19,8 +20,10 @@ import { useI18n } from 'vue-i18n';
|
||||
import { Plus, Edit, Trash2, Plug, PlayCircle } from 'lucide-vue-next';
|
||||
import IntegrationConnectorFormDrawer from './components/IntegrationConnectorFormDrawer.vue';
|
||||
import IntegrationCapabilityCallModal from './components/IntegrationCapabilityCallModal.vue';
|
||||
import IntegrationCallLogsPanel from './components/IntegrationCallLogsPanel.vue';
|
||||
import { CONNECTOR_TYPE_OPTIONS, ENVIRONMENT_OPTIONS } from './types/integration-connector.types';
|
||||
import { useIntegrationConnectorAdmin } from './composables/useIntegrationConnectorAdmin';
|
||||
import type { IntegrationBindingRow } from './types/integration-connector.types';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
@@ -38,16 +41,17 @@ const {
|
||||
|
||||
onMounted(() => { void loadAll(); });
|
||||
|
||||
type TabKey = 'client' | 'interface' | 'binding' | 'credential' | 'capability';
|
||||
type TabKey = 'client' | 'interface' | 'binding' | 'credential' | 'capability' | 'calls';
|
||||
const tabs: Array<{ key: TabKey; labelKey: string }> = [
|
||||
{ key: 'client', labelKey: 'admin.integrationConnector.tabs.client' },
|
||||
{ key: 'interface', labelKey: 'admin.integrationConnector.tabs.interface' },
|
||||
{ key: 'binding', labelKey: 'admin.integrationConnector.tabs.binding' },
|
||||
{ key: 'credential', labelKey: 'admin.integrationConnector.tabs.credential' },
|
||||
{ key: 'capability', labelKey: 'admin.integrationConnector.tabs.capability' },
|
||||
{ key: 'calls', labelKey: 'admin.integrationConnector.tabs.calls' },
|
||||
];
|
||||
// 当前激活 tab:页面本地状态(capability 为只读注册表 tab,不属于可编辑实体);
|
||||
// 初始取 activeEntity,保证携带实体态进入页面时列表与 tab 一致。
|
||||
// 当前激活 tab:页面本地状态(capability 为只读注册表 tab,calls 为只读调用日志 tab,
|
||||
// 均不属于可编辑实体);初始取 activeEntity,保证携带实体态进入页面时列表与 tab 一致。
|
||||
const activeTab = ref<TabKey>(activeEntity.value);
|
||||
|
||||
/** 客户端选项带 connector_type:接口表单联动展示连接器类型用。 */
|
||||
@@ -64,6 +68,18 @@ function clientNameOf(code: string) {
|
||||
function interfaceNameOf(code: string) {
|
||||
return interfaces.value.find((i) => i.code === code)?.name ?? '';
|
||||
}
|
||||
/** 绑定有序步骤视图:优先 steps_json;存量旧列行(P2 前镜像)兜底合成一步。
|
||||
* 每步客户端由接口归属自带,供客户端列按步骤对齐展示。
|
||||
*/
|
||||
function bindingStepsOf(row: IntegrationBindingRow): Array<{ interface_code: string; client_code: string }> {
|
||||
const steps = row.steps_json?.length
|
||||
? row.steps_json
|
||||
: [{ interface_code: row.interface_definition_code, param_mapping_json: row.param_mapping_json ?? {} }];
|
||||
return steps.map((step) => ({
|
||||
interface_code: step.interface_code,
|
||||
client_code: interfaces.value.find((iface) => iface.code === step.interface_code)?.client_instance_code ?? row.client_instance_code,
|
||||
}));
|
||||
}
|
||||
|
||||
/** 行内展开测试详情的客户端编码(同一时刻至多展开一行)。 */
|
||||
const expandedTestCode = ref('');
|
||||
@@ -148,8 +164,8 @@ function testDetailText(code: string) {
|
||||
|
||||
function selectTab(key: TabKey) {
|
||||
activeTab.value = key;
|
||||
// capability tab 只读展示注册表(无新增/表单入口),activeEntity 保持最后一个可编辑实体供抽屉复用。
|
||||
if (key !== 'capability') activeEntity.value = key;
|
||||
// capability/calls tab 只读展示(无新增/表单入口),activeEntity 保持最后一个可编辑实体供抽屉复用。
|
||||
if (key !== 'capability' && key !== 'calls') activeEntity.value = key;
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -161,7 +177,7 @@ function selectTab(key: TabKey) {
|
||||
<p class="section-desc mt-1">{{ t('admin.integrationConnector.subtitle') }}</p>
|
||||
</div>
|
||||
<button
|
||||
v-if="activeTab !== 'capability'"
|
||||
v-if="activeTab !== 'capability' && activeTab !== 'calls'"
|
||||
type="button"
|
||||
class="flex items-center gap-2 px-4 py-2 bg-brand-600 text-white rounded-xl hover:bg-brand-700 transition-all shadow-lg shadow-brand-200 active:scale-95 text-sm font-medium"
|
||||
@click="openCreateModal(activeEntity)"
|
||||
@@ -371,12 +387,16 @@ function selectTab(key: TabKey) {
|
||||
<p v-if="capabilityLabelOf(row.capability) !== row.capability" class="text-xs text-muted mono mt-0.5">{{ row.capability }}</p>
|
||||
</td>
|
||||
<td class="px-6 py-4">
|
||||
<p class="text-sm text-primary">{{ clientNameOf(row.client_instance_code) || row.client_instance_code }}</p>
|
||||
<p class="text-xs text-muted mono mt-0.5">{{ row.client_instance_code }}</p>
|
||||
<!-- 有序步骤:逐步渲染客户端(与接口步骤列对齐) -->
|
||||
<p v-for="(step, idx) in bindingStepsOf(row)" :key="`c-${step.interface_code}-${idx}`" class="text-sm text-primary">
|
||||
<span class="mr-1 text-xs text-muted">{{ idx + 1 }}.</span>{{ clientNameOf(step.client_code) || step.client_code }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="px-6 py-4">
|
||||
<p class="text-sm text-primary">{{ interfaceNameOf(row.interface_definition_code) || row.interface_definition_code }}</p>
|
||||
<p class="text-xs text-muted mono mt-0.5">{{ row.interface_definition_code }}</p>
|
||||
<!-- 有序步骤编排:编号 + 接口名,悬停显示接口编码;旧单步行兜底为一步 -->
|
||||
<p v-for="(step, idx) in bindingStepsOf(row)" :key="`i-${step.interface_code}-${idx}`" class="text-sm text-primary">
|
||||
<span class="mr-1 text-xs text-muted">{{ idx + 1 }}.</span><span :title="step.interface_code">{{ interfaceNameOf(step.interface_code) || step.interface_code }}</span>
|
||||
</p>
|
||||
</td>
|
||||
<td class="px-6 py-4">
|
||||
<span class="inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium" :class="statusBadgeClass(row.status)" data-testid="binding-status">{{ statusLabel(row.status) }}</span>
|
||||
@@ -478,6 +498,9 @@ function selectTab(key: TabKey) {
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- 调用日志:筛选 + 分页列表 + 详情抽屉(能力无关通用口径;只读 tab,无新增入口) -->
|
||||
<IntegrationCallLogsPanel v-else-if="activeTab === 'calls'" />
|
||||
|
||||
<!-- 能力清单 -->
|
||||
<div v-else class="admin-table-wrap">
|
||||
<table class="admin-table">
|
||||
|
||||
+32
-1
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* features/admin/modules/integration-connector/api/integration-connector.api.ts
|
||||
* 集成连接器管理 API 客户端:客户端实例/接口定义/绑定/凭据引用 CRUD + 能力清单 + 连接测试。
|
||||
* 集成连接器管理 API 客户端:客户端实例/接口定义/绑定/凭据引用 CRUD + 能力清单 + 连接测试 + 调用日志查询。
|
||||
* 依赖:@/shared/api/client(requestJson / BusinessError)、@/shared/utils/auth。
|
||||
* 逻辑:薄封装后端 /api/integration-connector/* 全部端点;JSON 写请求带 Content-Type。
|
||||
* 错误码(INTEGRATION.*)由 requestJson 解析到四语言文案。
|
||||
@@ -9,6 +9,9 @@ import { requestJson } from '@/shared/api/client';
|
||||
import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
import type {
|
||||
IntegrationBindingRow,
|
||||
IntegrationCallDetail,
|
||||
IntegrationCallFilters,
|
||||
IntegrationCallLogRow,
|
||||
IntegrationCallResultRow,
|
||||
IntegrationCapabilityRow,
|
||||
IntegrationClientInstanceRow,
|
||||
@@ -121,3 +124,31 @@ export const updateIntegrationCredentialReference = (code: string, payload: Reco
|
||||
requestJson<IntegrationCredentialReferenceRow>(`${BASE}/credential-references/${encodeURIComponent(code)}`, {
|
||||
method: 'PUT', ...jsonAuth(), body: JSON.stringify(payload),
|
||||
});
|
||||
|
||||
// ---- 调用日志 ----
|
||||
|
||||
/**
|
||||
* 把调用日志筛选对象序列化为 querystring。
|
||||
* 约束:过滤 undefined / null / 空串(空筛选拼出无参 URL);数字(page/page_size)转字符串。
|
||||
* 返回值:形如 `?a=1&b=2`(无有效参数时为空串),直接拼接在端点路径后。
|
||||
*/
|
||||
function buildCallLogQuery(filters: IntegrationCallFilters): string {
|
||||
const search = new URLSearchParams();
|
||||
Object.entries(filters).forEach(([key, value]) => {
|
||||
if (value === undefined || value === null || String(value).trim() === '') return;
|
||||
search.set(key, String(value));
|
||||
});
|
||||
const qs = search.toString();
|
||||
return qs ? `?${qs}` : '';
|
||||
}
|
||||
|
||||
/** 集成调用日志分页查询(能力无关;keyword 对请求摘要 JSON 模糊)。 */
|
||||
export const listIntegrationCalls = (filters: IntegrationCallFilters = {}) =>
|
||||
requestJson<{ total: number; page: number; page_size: number; items: IntegrationCallLogRow[] }>(
|
||||
`${BASE}/calls${buildCallLogQuery(filters)}`,
|
||||
auth(),
|
||||
);
|
||||
|
||||
/** 调用全量详情(含 wire_json 与同 operation_id 步骤时间线)。 */
|
||||
export const getIntegrationCall = (id: number) =>
|
||||
requestJson<IntegrationCallDetail>(`${BASE}/calls/${id}`, auth());
|
||||
+493
@@ -0,0 +1,493 @@
|
||||
<!--
|
||||
features/admin/modules/integration-connector/components/IntegrationCallLogsPanel.vue
|
||||
用途:集成调用日志面板——筛选条 + 分页列表 + 行点击详情抽屉(能力无关通用口径)。
|
||||
依赖:../api/integration-connector.api(listIntegrationCalls / getIntegrationCall)、
|
||||
../utils/integration-call-replay(buildCurl / buildSqlReplay)、
|
||||
useMessage、copyTextToClipboard、formatLocalDateTime、useI18n。
|
||||
逻辑:筛选(接口编码/客户端编码/连接类型/状态/operation_id/trace_id/业务单号/
|
||||
参数关键字/执行时间起止)回车或点「查询」生效(查询回第一页),「重置」清空;
|
||||
列表按 id 倒序分页,行点击拉取全量详情开右侧抽屉;抽屉含步骤时间线
|
||||
(同 operation_id 各步、当前步高亮)、线级请求与业务参数双栏、原始报文与
|
||||
归一化 JSON 双栏;复制按钮组按连接类型分流:soap/rest=复制 body / 复制 curl,
|
||||
database=复制 SQL(绑定已内联、写入类自动包事务并红字警示),
|
||||
另有复制原始报文 / 复制 JSON / 复制 operation_id / 复制 trace_id;
|
||||
wire_json 为 NULL(历史存量行)时如实显示「无线级详情(历史记录)」,不回填。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ChevronLeft, ChevronRight, X } from 'lucide-vue-next';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { copyTextToClipboard } from '@/shared/utils/clipboard';
|
||||
import { formatLocalDateTime } from '@/shared/utils/dateTime';
|
||||
import { getIntegrationCall, listIntegrationCalls } from '../api/integration-connector.api';
|
||||
import {
|
||||
CONNECTOR_TYPE_OPTIONS,
|
||||
type IntegrationCallDetail,
|
||||
type IntegrationCallFilters,
|
||||
type IntegrationCallLogRow,
|
||||
type IntegrationCallWire,
|
||||
} from '../types/integration-connector.types';
|
||||
import { buildCurl, buildSqlReplay } from '../utils/integration-call-replay';
|
||||
|
||||
/**
|
||||
* 调用状态固定枚举(与后端 RESULT_STATUSES 七值对齐,含幂等重放的
|
||||
* duplicate_success / duplicate_unverified 审计行;下拉直接用原始值,未注册翻译兜底)。
|
||||
*/
|
||||
const CALL_STATUS_OPTIONS = [
|
||||
'success', 'duplicate_success', 'duplicate_unverified', 'business_failed',
|
||||
'technical_failed', 'timeout', 'result_unknown',
|
||||
] as const;
|
||||
|
||||
const { t } = useI18n();
|
||||
const { error: notifyError, success: notifySuccess } = useMessage();
|
||||
|
||||
const filters = ref<IntegrationCallFilters>({});
|
||||
const items = ref<IntegrationCallLogRow[]>([]);
|
||||
const total = ref(0);
|
||||
const page = ref(1);
|
||||
const pageSize = 20;
|
||||
const loading = ref(false);
|
||||
const detail = ref<IntegrationCallDetail | null>(null);
|
||||
|
||||
const totalPages = computed(() => Math.max(1, Math.ceil(total.value / pageSize)));
|
||||
|
||||
/** 当前详情的线级事实(null = 历史存量行或未捕获场景,抽屉如实显示「无线级详情」)。 */
|
||||
const wire = computed<IntegrationCallWire | null>(() => detail.value?.call.wire_json ?? null);
|
||||
|
||||
/** soap/rest 的 wire 头部元信息(method/url/SOAPAction/headers)拼接为多行文本。 */
|
||||
const wireMetaText = computed(() => {
|
||||
const w = wire.value;
|
||||
if (!w || w.kind === 'database') return '';
|
||||
const lines = [`method: ${w.method ?? '-'}`, `url: ${w.url ?? '-'}`];
|
||||
if (w.soap_action !== undefined) lines.push(`SOAPAction: ${w.soap_action}`);
|
||||
if (w.headers) lines.push(`headers: ${w.headers}`);
|
||||
return lines.join('\n');
|
||||
});
|
||||
|
||||
/** database 的 SQL 复现文本(绑定已内联;写入类自动包 BEGIN…ROLLBACK 事务)。 */
|
||||
const sqlReplayText = computed(() =>
|
||||
wire.value && wire.value.kind === 'database' ? buildSqlReplay(wire.value) : '',
|
||||
);
|
||||
|
||||
/** database 写入类语句红字警示显隐(防复现时误写目标库)。 */
|
||||
const hasWriteStatement = computed(() =>
|
||||
(wire.value?.statements ?? []).some((s) => /^\s*(INSERT|UPDATE|DELETE|MERGE)/im.test(s.sql)),
|
||||
);
|
||||
|
||||
/** soap/rest 的 curl 复现命令(凭据位 ***REDACTED***,需手工替换)。 */
|
||||
const curlCommand = computed(() =>
|
||||
wire.value && wire.value.kind !== 'database' ? buildCurl(wire.value) : '',
|
||||
);
|
||||
|
||||
/** 响应区原始报文文本:soap/rest=HTTP 状态行 + 响应报文;database=查询行集(无线级时兜底行数)。 */
|
||||
const rawResponseText = computed(() => {
|
||||
const w = wire.value;
|
||||
if (!w) return '';
|
||||
if (w.kind === 'database') {
|
||||
return w.rows ? prettyJson(w.rows) : `rowcount: ${w.rowcount ?? '-'}`;
|
||||
}
|
||||
return `HTTP ${w.http_status ?? '-'}\n${w.response_body ?? ''}`;
|
||||
});
|
||||
|
||||
/** 拉取列表(当前筛选 + 当前页);失败经全局错误弹窗提示。 */
|
||||
async function load() {
|
||||
loading.value = true;
|
||||
try {
|
||||
const data = await listIntegrationCalls({ ...filters.value, page: page.value, page_size: pageSize });
|
||||
items.value = data.items;
|
||||
total.value = data.total;
|
||||
} catch (e) {
|
||||
notifyError(e instanceof Error ? e.message : String(e));
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/** 应用筛选并回第一页(回车或「查询」按钮触发)。 */
|
||||
function query() {
|
||||
page.value = 1;
|
||||
void load();
|
||||
}
|
||||
|
||||
/** 清空全部筛选项并回第一页重新拉取。 */
|
||||
function resetFilters() {
|
||||
filters.value = {};
|
||||
query();
|
||||
}
|
||||
|
||||
function goPrev() {
|
||||
if (page.value > 1) {
|
||||
page.value -= 1;
|
||||
void load();
|
||||
}
|
||||
}
|
||||
|
||||
function goNext() {
|
||||
if (page.value < totalPages.value) {
|
||||
page.value += 1;
|
||||
void load();
|
||||
}
|
||||
}
|
||||
|
||||
/** 点列表行拉全量详情(含 wire_json 与同 operation_id 时间线)并开抽屉。 */
|
||||
async function openDetail(row: IntegrationCallLogRow) {
|
||||
try {
|
||||
detail.value = await getIntegrationCall(row.id);
|
||||
} catch (e) {
|
||||
notifyError(e instanceof Error ? e.message : String(e));
|
||||
}
|
||||
}
|
||||
|
||||
function closeDetail() {
|
||||
detail.value = null;
|
||||
}
|
||||
|
||||
/** 抽屉打开时 Esc 关闭(与表单抽屉行为一致)。 */
|
||||
function onEscKey(e: KeyboardEvent) {
|
||||
if (e.key === 'Escape' && detail.value) closeDetail();
|
||||
}
|
||||
|
||||
/** 复制文本到剪贴板(带降级方案),成功后弹「已复制」提示。 */
|
||||
async function copy(text: string) {
|
||||
const ok = await copyTextToClipboard(text);
|
||||
if (ok) notifySuccess(t('admin.integrationConnector.callLogs.copied'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用成功族判定:success 与 duplicate_success(幂等重放命中,业务已成功)同属成功侧;
|
||||
* duplicate_unverified(重放命中但回执未核实)保守归非成功态展示。
|
||||
*/
|
||||
function isSuccess(status: string): boolean {
|
||||
return status === 'success' || status === 'duplicate_success';
|
||||
}
|
||||
|
||||
/** 状态徽标配色:成功绿 / 其余红。 */
|
||||
function statusBadgeClass(status: string): string {
|
||||
return isSuccess(status) ? 'bg-green-100 text-green-700' : 'bg-red-100 text-red-700';
|
||||
}
|
||||
|
||||
/** 状态图标:✓ 成功 / ✗ 失败。 */
|
||||
function statusIcon(status: string): string {
|
||||
return isSuccess(status) ? '✓' : '✗';
|
||||
}
|
||||
|
||||
/** 单号列文本:优先业务单号 business_ref,未透传时回退 operation_id 前 8 位。 */
|
||||
function refTextOf(row: IntegrationCallLogRow): string {
|
||||
return row.business_ref || row.operation_id.slice(0, 8);
|
||||
}
|
||||
|
||||
/** 步骤列文本:1-based 序号/总步数(对用户展示从 1 计;存储的 step_index 为 0-based 引擎下标;缺值显示 -)。 */
|
||||
function stepText(row: IntegrationCallLogRow): string {
|
||||
if (row.step_index === null || row.step_index === undefined) return '-/-';
|
||||
return `${row.step_index + 1}/${row.step_count ?? '?'}`;
|
||||
}
|
||||
|
||||
/** 时间线步骤标签:1-based 序号(与列表口径一致)。 */
|
||||
function stepLabel(entry: { step_index: number | null; step_count: number | null }, idx: number): string {
|
||||
const base = entry.step_index ?? idx;
|
||||
return `step${base + 1}`;
|
||||
}
|
||||
|
||||
/** 语句行数:rowcount / row_count 双字段名并存(实现版本差异),两者都读。 */
|
||||
function statementRowCount(s: { rowcount?: number; row_count?: number }): string {
|
||||
const n = s.rowcount ?? s.row_count;
|
||||
return n === undefined ? '' : String(n);
|
||||
}
|
||||
|
||||
/** 时间线条目是否为当前查看的调用(抽屉时间线高亮当前步)。 */
|
||||
function isCurrentStep(entry: IntegrationCallDetail['timeline'][number]): boolean {
|
||||
return detail.value != null && entry.id === detail.value.call.id;
|
||||
}
|
||||
|
||||
function prettyJson(value: unknown): string {
|
||||
return JSON.stringify(value, null, 2);
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
window.addEventListener('keydown', onEscKey);
|
||||
void load();
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener('keydown', onEscKey);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="space-y-4">
|
||||
<!-- 筛选条:全部可选,回车 / 点查询生效 -->
|
||||
<div class="rounded-xl border border-default bg-surface p-4 space-y-3">
|
||||
<div class="grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-5" @keyup.enter="query">
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.callLogs.filterInterface') }}</label>
|
||||
<input v-model="filters.interface_code" type="text" class="input-field text-sm font-mono" data-testid="call-filter-interface" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.callLogs.filterClient') }}</label>
|
||||
<input v-model="filters.client_code" type="text" class="input-field text-sm font-mono" data-testid="call-filter-client" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.callLogs.filterConnector') }}</label>
|
||||
<select v-model="filters.connector_type" class="input-field text-sm" data-testid="call-filter-connector">
|
||||
<option value="">—</option>
|
||||
<option v-for="opt in CONNECTOR_TYPE_OPTIONS" :key="opt.value" :value="opt.value">{{ t(opt.labelKey) }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.callLogs.filterStatus') }}</label>
|
||||
<select v-model="filters.status" class="input-field text-sm font-mono" data-testid="call-filter-status">
|
||||
<option value="">—</option>
|
||||
<option v-for="s in CALL_STATUS_OPTIONS" :key="s" :value="s">{{ s }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.callLogs.filterOperationId') }}</label>
|
||||
<input v-model="filters.operation_id" type="text" class="input-field text-sm font-mono" data-testid="call-filter-operation-id" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.callLogs.filterTraceId') }}</label>
|
||||
<input v-model="filters.trace_id" type="text" class="input-field text-sm font-mono" data-testid="call-filter-trace-id" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.callLogs.filterBusinessRef') }}</label>
|
||||
<input v-model="filters.business_ref" type="text" class="input-field text-sm font-mono" data-testid="call-filter-business-ref" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.callLogs.filterKeyword') }}</label>
|
||||
<input v-model="filters.keyword" type="text" class="input-field text-sm" data-testid="call-filter-keyword" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.callLogs.dateFrom') }}</label>
|
||||
<input v-model="filters.date_from" type="date" class="input-field text-sm" data-testid="call-filter-date-from" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.callLogs.dateTo') }}</label>
|
||||
<input v-model="filters.date_to" type="date" class="input-field text-sm" data-testid="call-filter-date-to" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<button type="button" class="btn-primary" data-testid="call-filter-query" @click="query">
|
||||
{{ t('admin.integrationConnector.callLogs.query') }}
|
||||
</button>
|
||||
<button type="button" class="btn-ghost" data-testid="call-filter-reset" @click="resetFilters">
|
||||
{{ t('admin.integrationConnector.callLogs.reset') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 调用记录列表(id 倒序;行点击开详情抽屉) -->
|
||||
<div class="admin-table-wrap" :class="loading ? 'opacity-60 pointer-events-none' : ''">
|
||||
<div class="px-4 py-3 flex items-center justify-between">
|
||||
<h4 class="text-sm font-bold text-primary">{{ t('admin.integrationConnector.callLogs.title') }}</h4>
|
||||
<span class="text-xs text-muted font-mono">({{ total }})</span>
|
||||
</div>
|
||||
<table class="admin-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="px-4 py-3 text-left text-xs w-16">#</th>
|
||||
<th class="px-4 py-3 text-left text-xs">{{ t('admin.integrationConnector.callLogs.colTime') }}</th>
|
||||
<th class="px-4 py-3 text-left text-xs">{{ t('admin.integrationConnector.callLogs.colCapability') }}</th>
|
||||
<th class="px-4 py-3 text-left text-xs">{{ t('admin.integrationConnector.callLogs.colInterface') }}</th>
|
||||
<th class="px-4 py-3 text-left text-xs">{{ t('admin.integrationConnector.callLogs.colRef') }}</th>
|
||||
<th class="px-4 py-3 text-left text-xs w-20">{{ t('admin.integrationConnector.callLogs.colStep') }}</th>
|
||||
<th class="px-4 py-3 text-left text-xs w-44">{{ t('admin.integrationConnector.callLogs.colStatus') }}</th>
|
||||
<th class="px-4 py-3 text-right text-xs w-24">{{ t('admin.integrationConnector.callLogs.colElapsed') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-if="items.length === 0">
|
||||
<td colspan="8" class="px-6 admin-table-empty">{{ t('admin.integrationConnector.empty') }}</td>
|
||||
</tr>
|
||||
<tr
|
||||
v-for="row in items"
|
||||
:key="row.id"
|
||||
data-testid="call-row"
|
||||
class="cursor-pointer hover:bg-surface-soft transition-colors"
|
||||
@click="openDetail(row)"
|
||||
>
|
||||
<td class="px-4 py-3 text-xs text-muted font-mono">{{ row.id }}</td>
|
||||
<td class="px-4 py-3 text-xs text-secondary font-mono whitespace-nowrap">{{ formatLocalDateTime(row.created_at) }}</td>
|
||||
<td class="px-4 py-3 text-xs font-mono text-secondary max-w-[220px]"><span class="block truncate" :title="row.capability">{{ row.capability }}</span></td>
|
||||
<td class="px-4 py-3 text-xs font-mono text-secondary max-w-[200px]"><span class="block truncate" :title="row.interface_code || ''">{{ row.interface_code || '—' }}</span></td>
|
||||
<td class="px-4 py-3 text-xs font-mono text-secondary" :title="row.business_ref || row.operation_id">{{ refTextOf(row) }}</td>
|
||||
<td class="px-4 py-3 text-xs text-secondary font-mono">{{ stepText(row) }}</td>
|
||||
<td class="px-4 py-3">
|
||||
<span class="inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium font-mono" :class="statusBadgeClass(row.status)">
|
||||
{{ statusIcon(row.status) }} {{ row.status }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-xs text-secondary font-mono text-right whitespace-nowrap">{{ row.elapsed_ms }}ms</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="flex items-center justify-end gap-3 px-4 py-3 text-xs text-secondary">
|
||||
<button
|
||||
type="button"
|
||||
class="p-1.5 rounded-lg text-muted hover:bg-surface-soft hover:text-secondary disabled:opacity-40 disabled:cursor-not-allowed"
|
||||
:title="t('admin.integrationConnector.callLogs.prevPage')"
|
||||
data-testid="call-prev-page"
|
||||
:disabled="page <= 1 || loading"
|
||||
@click="goPrev"
|
||||
>
|
||||
<ChevronLeft class="w-4 h-4" />
|
||||
</button>
|
||||
<span class="font-mono">{{ page }} / {{ totalPages }}</span>
|
||||
<button
|
||||
type="button"
|
||||
class="p-1.5 rounded-lg text-muted hover:bg-surface-soft hover:text-secondary disabled:opacity-40 disabled:cursor-not-allowed"
|
||||
:title="t('admin.integrationConnector.callLogs.nextPage')"
|
||||
data-testid="call-next-page"
|
||||
:disabled="page >= totalPages || loading"
|
||||
@click="goNext"
|
||||
>
|
||||
<ChevronRight class="w-4 h-4" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 详情抽屉:右侧滑出(步骤时间线 + 线级/归一化双栏 + 复现命令复制) -->
|
||||
<div
|
||||
v-if="detail"
|
||||
class="fixed inset-0 z-50 flex justify-end bg-overlay animate-fade-in"
|
||||
data-testid="call-detail-drawer"
|
||||
@click.self="closeDetail"
|
||||
>
|
||||
<aside role="dialog" aria-modal="true" :aria-label="t('admin.integrationConnector.callLogs.detailTitle')" class="h-full w-full max-w-4xl flex flex-col bg-surface shadow-2xl outline-none">
|
||||
<div class="px-5 sm:px-8 pt-5 sm:pt-6 pb-4 border-b border-default shrink-0 space-y-2">
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<h3 class="section-title">{{ t('admin.integrationConnector.callLogs.detailTitle') }} #{{ detail.call.id }}</h3>
|
||||
<button type="button" class="p-2 rounded-lg text-muted hover:bg-surface-soft hover:text-secondary" :aria-label="t('admin.cancel')" data-testid="call-detail-close" @click="closeDetail">
|
||||
<X class="w-4 h-4" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-x-6 gap-y-1 text-xs text-secondary">
|
||||
<span><span class="text-muted">{{ t('admin.integrationConnector.callLogs.colCapability') }}: </span><span class="font-mono">{{ detail.call.capability }}</span></span>
|
||||
<span>
|
||||
<span class="text-muted">{{ t('admin.integrationConnector.callLogs.colStatus') }}: </span>
|
||||
<span class="inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium font-mono" :class="statusBadgeClass(detail.call.status)">
|
||||
{{ statusIcon(detail.call.status) }} {{ detail.call.status }}
|
||||
</span>
|
||||
</span>
|
||||
<span><span class="text-muted">{{ t('admin.integrationConnector.callLogs.colElapsed') }}: </span><span class="font-mono">{{ detail.call.elapsed_ms }}ms</span></span>
|
||||
<span v-if="detail.call.business_ref">
|
||||
<span class="text-muted">{{ t('admin.integrationConnector.callLogs.filterBusinessRef') }}: </span><span class="font-mono">{{ detail.call.business_ref }}</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-x-6 gap-y-1 text-xs">
|
||||
<span class="flex items-center gap-1.5 min-w-0">
|
||||
<span class="text-muted font-mono shrink-0">operation:</span>
|
||||
<span class="font-mono text-secondary truncate max-w-[240px]" :title="detail.call.operation_id">{{ detail.call.operation_id }}</span>
|
||||
<button type="button" class="px-1.5 py-0.5 rounded-md text-xs font-medium text-brand-600 hover:bg-brand-50 shrink-0" data-testid="call-copy-operation-id" @click="copy(detail.call.operation_id)">
|
||||
{{ t('admin.integrationConnector.callLogs.copyOperationId') }}
|
||||
</button>
|
||||
</span>
|
||||
<span class="flex items-center gap-1.5 min-w-0">
|
||||
<span class="text-muted font-mono shrink-0">trace:</span>
|
||||
<span class="font-mono text-secondary truncate max-w-[240px]" :title="detail.call.trace_id">{{ detail.call.trace_id }}</span>
|
||||
<button type="button" class="px-1.5 py-0.5 rounded-md text-xs font-medium text-brand-600 hover:bg-brand-50 shrink-0" data-testid="call-copy-trace-id" @click="copy(detail.call.trace_id)">
|
||||
{{ t('admin.integrationConnector.callLogs.copyTraceId') }}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="px-5 sm:px-8 py-5 space-y-5 overflow-y-auto flex-1">
|
||||
<!-- 步骤时间线:同一次能力调用的 N 步(当前步高亮) -->
|
||||
<section class="space-y-2">
|
||||
<h4 class="text-xs font-bold uppercase tracking-wide text-muted">{{ t('admin.integrationConnector.callLogs.timeline') }}</h4>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<template v-for="(entry, idx) in detail.timeline" :key="entry.id">
|
||||
<div class="flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs" :class="isCurrentStep(entry) ? 'bg-brand-50 ring-1 ring-brand-300' : 'bg-surface-soft'">
|
||||
<span class="inline-block w-2 h-2 rounded-full shrink-0" :class="isSuccess(entry.status) ? 'bg-green-500' : 'bg-red-500'" />
|
||||
<span class="font-mono text-muted">{{ stepLabel(entry, idx) }}</span>
|
||||
<span class="text-secondary font-medium font-mono">{{ entry.interface_code || '—' }}</span>
|
||||
<span class="font-mono" :class="isSuccess(entry.status) ? 'text-green-600' : 'text-red-600'">{{ statusIcon(entry.status) }} {{ entry.status }}</span>
|
||||
<span class="text-muted font-mono">{{ entry.elapsed_ms }}ms</span>
|
||||
</div>
|
||||
<span v-if="idx < detail.timeline.length - 1" class="text-muted" aria-hidden="true">──</span>
|
||||
</template>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 请求:线级请求(wire)+ 业务参数(归一化)双栏 -->
|
||||
<section class="space-y-2">
|
||||
<h4 class="text-xs font-bold uppercase tracking-wide text-muted">{{ t('admin.integrationConnector.callLogs.request') }}</h4>
|
||||
<div class="grid grid-cols-1 gap-4 lg:grid-cols-2">
|
||||
<div class="rounded-xl border border-default p-3 space-y-2 min-w-0">
|
||||
<h5 class="text-xs font-bold text-primary">{{ t('admin.integrationConnector.callLogs.wire') }}</h5>
|
||||
<template v-if="wire">
|
||||
<!-- soap/rest:method/url/SOAPAction/headers + 完整请求 body XML -->
|
||||
<template v-if="wire.kind !== 'database'">
|
||||
<pre class="rounded-lg bg-surface-soft p-2.5 text-xs font-mono text-secondary whitespace-pre-wrap break-all">{{ wireMetaText }}</pre>
|
||||
<div class="text-xs text-muted font-mono">── request_body ──</div>
|
||||
<pre class="rounded-lg bg-surface-soft p-2.5 text-xs font-mono text-secondary whitespace-pre-wrap break-all max-h-72 overflow-y-auto">{{ wire.request_body }}</pre>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<button type="button" class="btn-ghost text-xs" data-testid="call-copy-body" @click="copy(wire.request_body || '')">
|
||||
{{ t('admin.integrationConnector.callLogs.copyBody') }}
|
||||
</button>
|
||||
<button type="button" class="btn-ghost text-xs" data-testid="call-copy-curl" @click="copy(curlCommand)">
|
||||
{{ t('admin.integrationConnector.callLogs.copyCurl') }}
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
<!-- database:pre/bulk/post 三段最终 SQL + 绑定首行 + 行数;写入类红字警示 -->
|
||||
<template v-else>
|
||||
<div v-for="(s, idx) in wire.statements || []" :key="idx" class="space-y-1">
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium bg-surface-soft text-secondary font-mono">{{ s.phase }}</span>
|
||||
<span v-if="statementRowCount(s)" class="text-xs text-muted font-mono">rows: {{ statementRowCount(s) }}</span>
|
||||
</div>
|
||||
<pre class="rounded-lg bg-surface-soft p-2.5 text-xs font-mono text-secondary whitespace-pre-wrap break-all">{{ s.sql }}</pre>
|
||||
<pre v-if="s.binds && Object.keys(s.binds).length > 0" class="rounded-lg bg-surface-soft p-2.5 text-xs font-mono text-muted whitespace-pre-wrap break-all">{{ prettyJson(s.binds) }}</pre>
|
||||
</div>
|
||||
<div v-if="wire.rowcount !== undefined" class="text-xs text-muted font-mono">rowcount: {{ wire.rowcount }}</div>
|
||||
<p v-if="hasWriteStatement" class="text-xs font-medium text-red-600" data-testid="call-sql-write-warning">
|
||||
{{ t('admin.integrationConnector.callLogs.sqlWriteWarning') }}
|
||||
</p>
|
||||
<button type="button" class="btn-ghost text-xs" data-testid="call-copy-sql" @click="copy(sqlReplayText)">
|
||||
{{ t('admin.integrationConnector.callLogs.copySql') }}
|
||||
</button>
|
||||
</template>
|
||||
</template>
|
||||
<!-- 历史存量行 / 未捕获场景:wire_json 为 NULL,如实展示不回填 -->
|
||||
<p v-else class="text-xs text-muted" data-testid="call-no-wire">
|
||||
{{ t('admin.integrationConnector.callLogs.noWire') }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="rounded-xl border border-default p-3 space-y-2 min-w-0">
|
||||
<h5 class="text-xs font-bold text-primary">{{ t('admin.integrationConnector.callLogs.normalized') }}</h5>
|
||||
<pre class="rounded-lg bg-surface-soft p-2.5 text-xs font-mono text-secondary whitespace-pre-wrap break-all max-h-72 overflow-y-auto">{{ prettyJson(detail.call.request_summary_json) }}</pre>
|
||||
<button type="button" class="btn-ghost text-xs" data-testid="call-copy-request-json" @click="copy(prettyJson(detail.call.request_summary_json))">
|
||||
{{ t('admin.integrationConnector.callLogs.copyJson') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 响应:原始报文 + 归一化 JSON 双栏 -->
|
||||
<section class="space-y-2">
|
||||
<h4 class="text-xs font-bold uppercase tracking-wide text-muted">{{ t('admin.integrationConnector.callLogs.response') }}</h4>
|
||||
<div class="grid grid-cols-1 gap-4 lg:grid-cols-2">
|
||||
<div class="rounded-xl border border-default p-3 space-y-2 min-w-0">
|
||||
<h5 class="text-xs font-bold text-primary">{{ t('admin.integrationConnector.callLogs.rawPayload') }}</h5>
|
||||
<pre v-if="wire" class="rounded-lg bg-surface-soft p-2.5 text-xs font-mono text-secondary whitespace-pre-wrap break-all max-h-72 overflow-y-auto">{{ rawResponseText }}</pre>
|
||||
<p v-else class="text-xs text-muted" data-testid="call-no-wire-response">{{ t('admin.integrationConnector.callLogs.noWire') }}</p>
|
||||
<button v-if="wire" type="button" class="btn-ghost text-xs" data-testid="call-copy-raw" @click="copy(rawResponseText)">
|
||||
{{ t('admin.integrationConnector.callLogs.copyRaw') }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="rounded-xl border border-default p-3 space-y-2 min-w-0">
|
||||
<h5 class="text-xs font-bold text-primary">{{ t('admin.integrationConnector.callLogs.normalizedJson') }}</h5>
|
||||
<pre class="rounded-lg bg-surface-soft p-2.5 text-xs font-mono text-secondary whitespace-pre-wrap break-all max-h-72 overflow-y-auto">{{ prettyJson(detail.call.response_summary_json) }}</pre>
|
||||
<button type="button" class="btn-ghost text-xs" data-testid="call-copy-response-json" @click="copy(prettyJson(detail.call.response_summary_json))">
|
||||
{{ t('admin.integrationConnector.callLogs.copyJson') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
+150
-10
@@ -1,8 +1,9 @@
|
||||
/**
|
||||
* features/admin/modules/integration-connector/components/IntegrationConnectorFormDrawer.spec.ts
|
||||
* 用途:锁定表单按连接器类型动态显示字段——REST 显示超时/HTTP方法/请求路径,
|
||||
* SOAP 显示 WSDL;以及抽屉化后的 JSON 编辑字段(格式化/失焦校验)、
|
||||
* 脏检查关闭确认与 Esc 关闭行为。
|
||||
* SOAP 显示 WSDL,database 显示 db_kind 专属下拉与数据库连接串 label;
|
||||
* 绑定表单的有序步骤编辑器(添加/删除/上移下移/每步独立参数映射);
|
||||
* 以及抽屉化后的 JSON 编辑字段(格式化/失焦校验)、脏检查关闭确认与 Esc 关闭行为。
|
||||
* 依赖:@vue/test-utils、vitest、i18n。
|
||||
* 逻辑:切换 connector_type 断言字段可见性;对 JsonTextareaField 断言格式化改写
|
||||
* 与非法 JSON 提示;mock window.confirm 断言脏表单关闭拦截与放行。
|
||||
@@ -13,11 +14,13 @@ import i18n from '@/i18n';
|
||||
import IntegrationConnectorFormDrawer from './IntegrationConnectorFormDrawer.vue';
|
||||
import JsonTextareaField from './JsonTextareaField.vue';
|
||||
import {
|
||||
bindingRowToForm,
|
||||
createEmptyClientInstanceForm,
|
||||
createEmptyInterfaceDefinitionForm,
|
||||
createEmptyBindingForm,
|
||||
createEmptyCredentialReferenceForm,
|
||||
type InterfaceDefinitionFormState,
|
||||
type IntegrationBindingRow,
|
||||
} from '../types/integration-connector.types';
|
||||
|
||||
enableAutoUnmount(afterEach);
|
||||
@@ -117,7 +120,7 @@ describe('IntegrationConnectorFormDrawer connector-type fields', () => {
|
||||
expect(chip.attributes('title')).toContain('发布');
|
||||
});
|
||||
|
||||
it('绑定:选定接口定义后客户端实例自动带出并锁定', async () => {
|
||||
it('绑定:添加步骤并选接口后,只读提示该步接口归属的客户端实例', async () => {
|
||||
const bindingForm = createEmptyBindingForm();
|
||||
const wrapper = mountDrawer({
|
||||
activeEntity: 'binding',
|
||||
@@ -128,12 +131,12 @@ describe('IntegrationConnectorFormDrawer connector-type fields', () => {
|
||||
],
|
||||
interfaceOptions: [{ code: '1001-iface', name: '接口A', client_instance_code: '1001' }],
|
||||
});
|
||||
// 未选接口定义前客户端实例可维护
|
||||
expect(wrapper.find('[data-testid="binding-client"]').attributes('disabled')).toBeUndefined();
|
||||
await wrapper.find('[data-testid="binding-interface"]').setValue('1001-iface');
|
||||
// 选定接口定义后:客户端实例按接口归属联动带出且锁定
|
||||
expect(bindingForm.client_instance_code).toBe('1001');
|
||||
expect(wrapper.find('[data-testid="binding-client"]').attributes('disabled')).toBeDefined();
|
||||
// 绑定表单不再单独维护客户端实例下拉(client 由各步接口归属自带)
|
||||
expect(wrapper.find('[data-testid="binding-client"]').exists()).toBe(false);
|
||||
// 添加一步并选择接口定义 → 只读提示其归属客户端实例
|
||||
await wrapper.find('[data-testid="binding-add-step"]').trigger('click');
|
||||
await wrapper.find('[data-testid="binding-step-interface-0"]').setValue('1001-iface');
|
||||
expect(wrapper.find('[data-testid="binding-step-client-0"]').text()).toContain('1001');
|
||||
});
|
||||
|
||||
it('绑定能力下拉选项本地化:有翻译显示「中文名(注册名)」,无翻译兜底注册名', () => {
|
||||
@@ -153,6 +156,143 @@ describe('IntegrationConnectorFormDrawer connector-type fields', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('IntegrationConnectorFormDrawer database connector type', () => {
|
||||
it('类型下拉含「数据库直连」;选中后显示 db_kind 四选一下拉、数据库连接串 label,超时照显', async () => {
|
||||
const wrapper = mountDrawer();
|
||||
const typeOptions = wrapper.find('[data-testid="client-connector-type"]').findAll('option');
|
||||
expect(typeOptions.map((o) => o.text())).toEqual(['REST API', 'SOAP 服务', '数据库直连']);
|
||||
// 非 database 类型不渲染 db_kind 下拉
|
||||
expect(wrapper.find('[data-testid="client-db-kind"]').exists()).toBe(false);
|
||||
await wrapper.find('[data-testid="client-connector-type"]').setValue('database');
|
||||
const dbKind = wrapper.find('[data-testid="client-db-kind"]');
|
||||
expect(dbKind.exists()).toBe(true);
|
||||
// db_kind 专属下拉四选一(含未选占位项),label 即库名
|
||||
expect(dbKind.findAll('option').map((o) => o.text())).toEqual(['—', 'MySQL', 'Oracle', 'SQL Server', 'PostgreSQL']);
|
||||
// endpoint label 切换为数据库连接串语义;超时字段照常显示
|
||||
const labels = wrapper.findAll('label').map((l) => l.text());
|
||||
expect(labels.some((t) => t.includes('数据库连接串'))).toBe(true);
|
||||
expect(wrapper.find('[data-testid="client-timeout"]').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('database 类型不显示 HTTP 方法/请求路径(接口表单随客户端联动 database 类型)', async () => {
|
||||
const interfaceForm = createEmptyInterfaceDefinitionForm();
|
||||
const wrapper = mountDrawer({
|
||||
activeEntity: 'interface',
|
||||
interfaceForm,
|
||||
clientOptions: [{ code: 'erp-db', name: 'ERP Oracle', connector_type: 'database' }],
|
||||
});
|
||||
await wrapper.find('[data-testid="interface-client"]').setValue('erp-db');
|
||||
// 接口类型随客户端联动为 database
|
||||
expect(interfaceForm.connector_type).toBe('database');
|
||||
const labels = wrapper.findAll('label').map((l) => l.text());
|
||||
expect(labels.some((t) => t.includes('HTTP 方法'))).toBe(false);
|
||||
expect(labels.some((t) => t.includes('请求路径'))).toBe(false);
|
||||
// 类型只读下拉显示本地化 database 文案
|
||||
expect(wrapper.find('[data-testid="interface-connector-type"]').text()).toContain('数据库直连');
|
||||
});
|
||||
|
||||
it('切回非 database 类型后 db_kind 下拉隐藏且残留值清空', async () => {
|
||||
const clientForm = createEmptyClientInstanceForm();
|
||||
const wrapper = mountDrawer({ clientForm });
|
||||
await wrapper.find('[data-testid="client-connector-type"]').setValue('database');
|
||||
await wrapper.find('[data-testid="client-db-kind"]').setValue('oracle');
|
||||
expect(clientForm.db_kind).toBe('oracle');
|
||||
await wrapper.find('[data-testid="client-connector-type"]').setValue('rest');
|
||||
expect(wrapper.find('[data-testid="client-db-kind"]').exists()).toBe(false);
|
||||
expect(clientForm.db_kind).toBe('');
|
||||
});
|
||||
|
||||
it('database 类型高级配置提示列出生效键 oracle_lib_dir', async () => {
|
||||
const wrapper = mountDrawer();
|
||||
await wrapper.find('[data-testid="client-connector-type"]').setValue('database');
|
||||
expect(wrapper.text()).toContain('"oracle_lib_dir"');
|
||||
});
|
||||
});
|
||||
|
||||
describe('IntegrationConnectorFormDrawer binding steps editor', () => {
|
||||
function mountBinding(overrides: Partial<Record<string, unknown>> = {}) {
|
||||
return mountDrawer({
|
||||
activeEntity: 'binding',
|
||||
clientOptions: [
|
||||
{ code: 'erp-db', name: 'ERP Oracle', connector_type: 'database' },
|
||||
{ code: 'tiptop-ws', name: '鼎捷WS', connector_type: 'soap' },
|
||||
],
|
||||
interfaceOptions: [
|
||||
{ code: 'IF-STAGE', name: '写中间表', client_instance_code: 'erp-db' },
|
||||
{ code: 'IF-SUBMIT', name: '触发WS', client_instance_code: 'tiptop-ws' },
|
||||
],
|
||||
...overrides,
|
||||
});
|
||||
}
|
||||
|
||||
it('接口从单选改为有序多选:添加两步,每步独立接口下拉与归属客户端只读提示', async () => {
|
||||
const bindingForm = createEmptyBindingForm();
|
||||
const wrapper = mountBinding({ bindingForm });
|
||||
// 空态无步骤行
|
||||
expect(wrapper.findAll('[data-testid="binding-step-row"]').length).toBe(0);
|
||||
// 添加两步
|
||||
await wrapper.find('[data-testid="binding-add-step"]').trigger('click');
|
||||
await wrapper.find('[data-testid="binding-add-step"]').trigger('click');
|
||||
expect(bindingForm.steps).toHaveLength(2);
|
||||
await wrapper.find('[data-testid="binding-step-interface-0"]').setValue('IF-STAGE');
|
||||
await wrapper.find('[data-testid="binding-step-interface-1"]').setValue('IF-SUBMIT');
|
||||
// 每步显示归属客户端只读提示(跨客户端步骤:database + soap)
|
||||
expect(wrapper.find('[data-testid="binding-step-client-0"]').text()).toContain('erp-db');
|
||||
expect(wrapper.find('[data-testid="binding-step-client-1"]').text()).toContain('tiptop-ws');
|
||||
});
|
||||
|
||||
it('上移/下移重排步骤顺序;首步无上移、末步无下移(禁用)', async () => {
|
||||
const bindingForm = createEmptyBindingForm();
|
||||
const wrapper = mountBinding({ bindingForm });
|
||||
await wrapper.find('[data-testid="binding-add-step"]').trigger('click');
|
||||
await wrapper.find('[data-testid="binding-add-step"]').trigger('click');
|
||||
await wrapper.find('[data-testid="binding-step-interface-0"]').setValue('IF-STAGE');
|
||||
await wrapper.find('[data-testid="binding-step-interface-1"]').setValue('IF-SUBMIT');
|
||||
expect(wrapper.find('[data-testid="binding-step-up-0"]').attributes('disabled')).toBeDefined();
|
||||
expect(wrapper.find('[data-testid="binding-step-down-1"]').attributes('disabled')).toBeDefined();
|
||||
// 下移首步 → 顺序翻转
|
||||
await wrapper.find('[data-testid="binding-step-down-0"]').trigger('click');
|
||||
expect(bindingForm.steps[0].interface_code).toBe('IF-SUBMIT');
|
||||
expect(bindingForm.steps[1].interface_code).toBe('IF-STAGE');
|
||||
// 再上移还原
|
||||
await wrapper.find('[data-testid="binding-step-up-1"]').trigger('click');
|
||||
expect(bindingForm.steps[0].interface_code).toBe('IF-STAGE');
|
||||
expect(bindingForm.steps[1].interface_code).toBe('IF-SUBMIT');
|
||||
});
|
||||
|
||||
it('删除步骤移除对应行;每步参数映射独立编辑写回对应步骤', async () => {
|
||||
const bindingForm = createEmptyBindingForm();
|
||||
const wrapper = mountBinding({ bindingForm });
|
||||
await wrapper.find('[data-testid="binding-add-step"]').trigger('click');
|
||||
await wrapper.find('[data-testid="binding-add-step"]').trigger('click');
|
||||
// 每步独立的 param_mapping JSON 编辑(沿用 JsonTextareaField 交互)
|
||||
const stepRows = wrapper.findAll('[data-testid="binding-step-row"]');
|
||||
await stepRows[0].findComponent(JsonTextareaField).find('[data-testid="json-textarea"]')
|
||||
.setValue('{"erp_org":{"expr":"external_org"}}');
|
||||
expect(bindingForm.steps[0].param_mapping_json).toBe('{"erp_org":{"expr":"external_org"}}');
|
||||
expect(bindingForm.steps[1].param_mapping_json).toBe('');
|
||||
// 删除首步 → 只剩原第二步
|
||||
await wrapper.find('[data-testid="binding-step-remove-0"]').trigger('click');
|
||||
expect(bindingForm.steps).toHaveLength(1);
|
||||
expect(wrapper.findAll('[data-testid="binding-step-row"]').length).toBe(1);
|
||||
});
|
||||
|
||||
it('既有单接口绑定编辑回归:steps_json 单步行回显为一步且接口预选', () => {
|
||||
const bindingForm = bindingRowToForm({
|
||||
id: 5, capability: 'in_transit_transfer.create_transfer', context_selector_json: {},
|
||||
steps_json: [{ interface_code: 'IF-STAGE', param_mapping_json: { erp_org: { expr: 'external_org' } } }],
|
||||
param_mapping_json: { erp_org: { expr: 'external_org' } },
|
||||
client_instance_code: 'erp-db', interface_definition_code: 'IF-STAGE',
|
||||
mapping_version: 1, priority: 0, environment: 'prod',
|
||||
effective_from: null, effective_to: null, status: 'draft',
|
||||
} as IntegrationBindingRow);
|
||||
const wrapper = mountBinding({ bindingForm });
|
||||
expect(wrapper.findAll('[data-testid="binding-step-row"]').length).toBe(1);
|
||||
expect((wrapper.find('[data-testid="binding-step-interface-0"]').element as HTMLSelectElement).value).toBe('IF-STAGE');
|
||||
expect(wrapper.find('[data-testid="binding-step-client-0"]').text()).toContain('erp-db');
|
||||
});
|
||||
});
|
||||
|
||||
describe('IntegrationConnectorFormDrawer JSON fields', () => {
|
||||
function findJsonField(wrapper: ReturnType<typeof mountDrawer>, labelPart: string) {
|
||||
const field = wrapper
|
||||
@@ -363,7 +503,7 @@ describe('IntegrationConnectorFormDrawer client form redesign', () => {
|
||||
const code = wrapper.find('[data-testid="client-code"]');
|
||||
expect((code.element as HTMLInputElement).disabled).toBe(true);
|
||||
const typeOptions = wrapper.find('[data-testid="client-connector-type"]').findAll('option');
|
||||
expect(typeOptions.map((o) => o.text())).toEqual(['REST API', 'SOAP 服务']);
|
||||
expect(typeOptions.map((o) => o.text())).toEqual(['REST API', 'SOAP 服务', '数据库直连']);
|
||||
const envOptions = wrapper.find('[data-testid="client-environment"]').findAll('option');
|
||||
expect(envOptions.map((o) => o.text())).toEqual(['开发', '测试', '生产']);
|
||||
});
|
||||
|
||||
+137
-34
@@ -7,10 +7,13 @@
|
||||
客户端编码留空时按名称自动建议、
|
||||
接口编码留空时按「客户端实例编码-名称」自动建议(均可手改,已填不覆盖,编辑态编码锁定);
|
||||
客户端实例的连接器类型/环境/凭据引用均为下拉(选项来自模块常量与凭据列表,未知值兜底);
|
||||
connector_type=database 时显示 db_kind 专属四选一下拉(必填校验在 composable 提交层),
|
||||
endpoint label 按类型切换(REST=接口地址 / SOAP=WSDL / database=数据库连接串),切离 database 清空 db_kind;
|
||||
接口定义的连接器类型随所选客户端实例联动只读展示(提交由后端以客户端为准推导);
|
||||
绑定的客户端实例随所选接口定义联动带出并锁定(接口归属即客户端归属);
|
||||
绑定的接口为有序步骤编辑器:添加/删除/上移下移,每步独立 param_mapping JSON,
|
||||
步骤归属客户端以只读提示展示(client 由各步接口自带,表单不再单独维护);
|
||||
绑定表单的能力下拉选项本地化为「中文名(注册名)」(未注册翻译兜底注册名);
|
||||
接口与绑定的状态均为只读徽章(发布/退役走列表生命周期按钮),四个 JSON 契约字段常显不折叠;
|
||||
接口与绑定的状态均为只读徽章(发布/退役走列表生命周期按钮),JSON 契约字段常显不折叠;
|
||||
凭据引用:状态不进表单(由列表生命周期按钮流转);编辑态以「基本信息」只读信息区
|
||||
展示编码/类型/来源/状态(label+值行,与接口定义只读字段同款式),新建态下拉选项
|
||||
文案本地化与列表一致;高级配置帮助文案按连接器类型的生效键动态切换。
|
||||
@@ -24,6 +27,7 @@ import JsonTextareaField from './JsonTextareaField.vue';
|
||||
import {
|
||||
CONNECTOR_CONFIG_KEYS,
|
||||
CONNECTOR_TYPE_OPTIONS,
|
||||
DB_KIND_OPTIONS,
|
||||
ENVIRONMENT_OPTIONS,
|
||||
suggestClientCode,
|
||||
suggestInterfaceCode,
|
||||
@@ -33,6 +37,7 @@ import type {
|
||||
ClientInstanceFormState,
|
||||
CredentialReferenceFormState,
|
||||
InterfaceDefinitionFormState,
|
||||
IntegrationConnectorType,
|
||||
} from '../types/integration-connector.types';
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -43,9 +48,9 @@ const props = defineProps<{
|
||||
bindingForm: BindingFormState;
|
||||
credentialForm: CredentialReferenceFormState;
|
||||
isSaving: boolean;
|
||||
/** 客户端实例选项:connector_type 供接口表单联动展示连接器类型。 */
|
||||
/** 客户端实例选项:connector_type 供接口表单联动展示连接器类型;name 供步骤 client 只读提示。 */
|
||||
clientOptions: Array<{ code: string; name: string; connector_type?: string }>;
|
||||
/** 接口定义选项:client_instance_code 供绑定表单联动带出客户端实例。 */
|
||||
/** 接口定义选项:client_instance_code 供绑定步骤的归属客户端只读提示。 */
|
||||
interfaceOptions: Array<{ code: string; name: string; client_instance_code?: string }>;
|
||||
capabilityOptions: Array<{ name: string }>;
|
||||
credentialTypeOptions: Array<{ type: string; fields: Array<{ key: string; secret: boolean; required: boolean }> }>;
|
||||
@@ -103,6 +108,30 @@ function capabilityOptionLabel(name: string) {
|
||||
return label === name ? name : `${label}(${name})`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换客户端实例的连接器类型:非 database 类型清空 db_kind 残留值,
|
||||
* 避免切走后旧值随保存提交(database 时 db_kind 必填,校验在 composable 提交层)。
|
||||
*/
|
||||
function onConnectorTypeChange() {
|
||||
if (props.clientForm.connector_type !== 'database') {
|
||||
props.clientForm.db_kind = '';
|
||||
}
|
||||
}
|
||||
|
||||
/** 连接地址 label 按类型切换:REST=接口地址 / SOAP=WSDL 地址 / database=数据库连接串。 */
|
||||
const endpointLabelKey = computed(() => {
|
||||
if (props.clientForm.connector_type === 'database') return 'admin.integrationConnector.endpointLabel.database';
|
||||
if (props.clientForm.connector_type === 'soap') return 'admin.integrationConnector.fields.wsdl';
|
||||
return 'admin.integrationConnector.fields.endpoint';
|
||||
});
|
||||
|
||||
/** 连接地址占位符随 label 同步切换(示例格式按类型区分)。 */
|
||||
const endpointPlaceholderKey = computed(() => {
|
||||
if (props.clientForm.connector_type === 'database') return 'admin.integrationConnector.placeholders.database';
|
||||
if (props.clientForm.connector_type === 'soap') return 'admin.integrationConnector.placeholders.wsdl';
|
||||
return 'admin.integrationConnector.placeholders.endpoint';
|
||||
});
|
||||
|
||||
/** 接口编码仍为空且已选客户端实例时,按「客户端编码-名称」补建议(已手填不覆盖)。 */
|
||||
function suggestInterfaceCodeIfEmpty() {
|
||||
const form = props.interfaceForm;
|
||||
@@ -119,21 +148,45 @@ function onInterfaceNameBlur() {
|
||||
/** 切换接口的客户端实例:联动展示其连接器类型(仅展示,提交由后端以客户端为准推导),并补编码建议。 */
|
||||
function onInterfaceClientChange() {
|
||||
const selected = props.clientOptions.find((item) => item.code === props.interfaceForm.client_instance_code);
|
||||
if (selected?.connector_type === 'rest' || selected?.connector_type === 'soap') {
|
||||
props.interfaceForm.connector_type = selected.connector_type;
|
||||
const type = selected?.connector_type as IntegrationConnectorType | undefined;
|
||||
if (type && CONNECTOR_TYPE_OPTIONS.some((opt) => opt.value === type)) {
|
||||
props.interfaceForm.connector_type = type;
|
||||
}
|
||||
suggestInterfaceCodeIfEmpty();
|
||||
}
|
||||
|
||||
// ---- 绑定有序步骤编辑器:接口从单选改为有序多选,client 由各步接口归属自带 ----
|
||||
|
||||
/** 添加步骤:追加到末尾(新步骤默认未选接口、空映射)。 */
|
||||
function addBindingStep() {
|
||||
props.bindingForm.steps.push({ interface_code: '', param_mapping_json: '' });
|
||||
}
|
||||
|
||||
/** 删除指定步骤(按索引,删除后后续步骤序号自动前移)。 */
|
||||
function removeBindingStep(index: number) {
|
||||
props.bindingForm.steps.splice(index, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换绑定的接口定义:联动带出其所属客户端实例并锁定(接口归属即客户端归属)。
|
||||
* 后端创建/更新仍做成对校验(INTEGRATION.BINDING_PAIR_MISMATCH)兜底直连 API 的场景。
|
||||
* 上移/下移指定步骤:delta=-1 上移、+1 下移;越界直接忽略(按钮层已禁用,双保险)。
|
||||
*/
|
||||
function onBindingInterfaceChange() {
|
||||
const selected = props.interfaceOptions.find((item) => item.code === props.bindingForm.interface_definition_code);
|
||||
if (selected?.client_instance_code) {
|
||||
props.bindingForm.client_instance_code = selected.client_instance_code;
|
||||
}
|
||||
function moveBindingStep(index: number, delta: number) {
|
||||
const target = index + delta;
|
||||
const steps = props.bindingForm.steps;
|
||||
if (target < 0 || target >= steps.length) return;
|
||||
const [moved] = steps.splice(index, 1);
|
||||
if (!moved) return;
|
||||
steps.splice(target, 0, moved);
|
||||
}
|
||||
|
||||
/** 步骤归属客户端只读提示:由接口定义归属唯一确定(跨步可不同客户端,如 database+soap)。 */
|
||||
function bindingStepClientHint(index: number): string {
|
||||
const step = props.bindingForm.steps[index];
|
||||
const iface = props.interfaceOptions.find((item) => item.code === step?.interface_code);
|
||||
if (!iface?.client_instance_code) return '';
|
||||
const client = props.clientOptions.find((item) => item.code === iface.client_instance_code);
|
||||
const clientLabel = client ? optionLabel(client.name, client.code) : iface.client_instance_code;
|
||||
return t('admin.integrationConnector.bindingSteps.clientHint', { client: clientLabel });
|
||||
}
|
||||
|
||||
/** 高级配置示例(JSON 属代码示例,不入 i18n——字面大括号会破坏 vue-i18n 消息编译)。 */
|
||||
@@ -269,10 +322,18 @@ onBeforeUnmount(() => document.removeEventListener('keydown', onKeydown));
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.connectorType') }}</label>
|
||||
<select v-model="clientForm.connector_type" class="input-field text-sm" data-testid="client-connector-type">
|
||||
<select v-model="clientForm.connector_type" class="input-field text-sm" data-testid="client-connector-type" @change="onConnectorTypeChange">
|
||||
<option v-for="opt in CONNECTOR_TYPE_OPTIONS" :key="opt.value" :value="opt.value">{{ t(opt.labelKey) }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div v-if="clientForm.connector_type === 'database'" class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.dbKind') }}</label>
|
||||
<!-- db_kind 专属四选一(D16):仅 database 类型显示;未选提交由 composable 校验拦截 -->
|
||||
<select v-model="clientForm.db_kind" class="input-field text-sm" data-testid="client-db-kind">
|
||||
<option value="">—</option>
|
||||
<option v-for="kind in DB_KIND_OPTIONS" :key="kind" :value="kind">{{ t(`admin.integrationConnector.connectorDbKind.${kind}`) }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.environment') }}</label>
|
||||
<select v-model="clientForm.environment" class="input-field text-sm" data-testid="client-environment">
|
||||
@@ -284,10 +345,10 @@ onBeforeUnmount(() => document.removeEventListener('keydown', onKeydown));
|
||||
|
||||
<div class="space-y-4">
|
||||
<h4 class="text-xs font-bold uppercase tracking-wide text-muted">{{ t('admin.integrationConnector.sections.connection') }}</h4>
|
||||
<!-- 连接地址:endpoint 合一字段;label 按连接器类型显示(REST=接口地址,SOAP=WSDL 地址) -->
|
||||
<!-- 连接地址:endpoint 合一字段;label 按连接器类型显示(REST=接口地址,SOAP=WSDL 地址,database=数据库连接串) -->
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ clientForm.connector_type === 'soap' ? t('admin.integrationConnector.fields.wsdl') : t('admin.integrationConnector.fields.endpoint') }}</label>
|
||||
<input v-model="clientForm.endpoint" type="text" class="input-field text-sm" :placeholder="t(clientForm.connector_type === 'soap' ? 'admin.integrationConnector.placeholders.wsdl' : 'admin.integrationConnector.placeholders.endpoint')" data-testid="client-endpoint" />
|
||||
<label class="label-field">{{ t(endpointLabelKey) }}</label>
|
||||
<input v-model="clientForm.endpoint" type="text" class="input-field text-sm" :placeholder="t(endpointPlaceholderKey)" data-testid="client-endpoint" />
|
||||
</div>
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<div class="space-y-1.5">
|
||||
@@ -377,7 +438,7 @@ onBeforeUnmount(() => document.removeEventListener('keydown', onKeydown));
|
||||
<!-- 状态不进表单正文:以底部操作条只读下拉展示(转移只经列表生命周期按钮) -->
|
||||
</template>
|
||||
|
||||
<!-- 绑定:客户端实例随接口定义联动锁定;状态为只读徽章(发布/退役走列表生命周期按钮) -->
|
||||
<!-- 绑定:接口为有序步骤编辑器(client 由各步接口归属自带);状态为只读徽章(发布/退役走列表生命周期按钮) -->
|
||||
<template v-else-if="activeEntity === 'binding'">
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<div class="space-y-1.5">
|
||||
@@ -392,20 +453,6 @@ onBeforeUnmount(() => document.removeEventListener('keydown', onKeydown));
|
||||
<option v-for="env in ENVIRONMENT_OPTIONS" :key="env" :value="env">{{ t(`admin.integrationConnector.envLabels.${env}`) }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.clientInstance') }}</label>
|
||||
<!-- 已选接口定义即锁定:客户端实例由接口定义归属唯一确定,不可单独维护 -->
|
||||
<select v-model="bindingForm.client_instance_code" class="input-field text-sm disabled:opacity-70" :disabled="Boolean(bindingForm.interface_definition_code)" data-testid="binding-client">
|
||||
<option v-for="opt in clientOptions" :key="opt.code" :value="opt.code">{{ optionLabel(opt.name, opt.code) }}</option>
|
||||
</select>
|
||||
<p class="text-xs text-muted">{{ t('admin.integrationConnector.fields.bindingClientHint') }}</p>
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.interfaceDef') }}</label>
|
||||
<select v-model="bindingForm.interface_definition_code" class="input-field text-sm" data-testid="binding-interface" @change="onBindingInterfaceChange">
|
||||
<option v-for="opt in interfaceOptions" :key="opt.code" :value="opt.code">{{ optionLabel(opt.name, opt.code) }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.mappingVersion') }}</label>
|
||||
<input v-model.number="bindingForm.mapping_version" type="number" class="input-field text-sm" />
|
||||
@@ -423,13 +470,69 @@ onBeforeUnmount(() => document.removeEventListener('keydown', onKeydown));
|
||||
<input v-model="bindingForm.effective_to" type="datetime-local" class="input-field text-sm" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- 有序步骤编辑器:提交时以 steps_json([{interface_code, param_mapping_json}])发送,
|
||||
调用期按数组顺序执行;client 由各步接口归属自带 → 每步只读提示,不再单独维护 -->
|
||||
<div class="space-y-3">
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<h4 class="text-xs font-bold uppercase tracking-wide text-muted">{{ t('admin.integrationConnector.bindingSteps.label') }}</h4>
|
||||
<button type="button" class="btn-ghost text-xs" data-testid="binding-add-step" @click="addBindingStep">
|
||||
+ {{ t('admin.integrationConnector.bindingSteps.add') }}
|
||||
</button>
|
||||
</div>
|
||||
<p class="text-xs text-muted">{{ t('admin.integrationConnector.bindingSteps.hint') }}</p>
|
||||
<div
|
||||
v-for="(step, index) in bindingForm.steps"
|
||||
:key="index"
|
||||
class="space-y-2 rounded-lg border border-slate-200 px-3 py-2.5"
|
||||
data-testid="binding-step-row"
|
||||
>
|
||||
<div class="flex items-end gap-2">
|
||||
<span class="pb-2 text-xs font-bold text-muted">{{ index + 1 }}</span>
|
||||
<div class="flex-1 space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.bindingSteps.interface') }}</label>
|
||||
<select v-model="step.interface_code" class="input-field text-sm" :data-testid="`binding-step-interface-${index}`">
|
||||
<option value="">—</option>
|
||||
<option v-for="opt in interfaceOptions" :key="opt.code" :value="opt.code">{{ optionLabel(opt.name, opt.code) }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-ghost text-xs"
|
||||
:disabled="index === 0"
|
||||
:title="t('admin.integrationConnector.bindingSteps.moveUp')"
|
||||
:data-testid="`binding-step-up-${index}`"
|
||||
@click="moveBindingStep(index, -1)"
|
||||
>↑</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-ghost text-xs"
|
||||
:disabled="index === bindingForm.steps.length - 1"
|
||||
:title="t('admin.integrationConnector.bindingSteps.moveDown')"
|
||||
:data-testid="`binding-step-down-${index}`"
|
||||
@click="moveBindingStep(index, 1)"
|
||||
>↓</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-ghost text-xs"
|
||||
:title="t('admin.integrationConnector.bindingSteps.remove')"
|
||||
:data-testid="`binding-step-remove-${index}`"
|
||||
@click="removeBindingStep(index)"
|
||||
>✕</button>
|
||||
</div>
|
||||
<p v-if="bindingStepClientHint(index)" class="text-xs text-muted" :data-testid="`binding-step-client-${index}`">
|
||||
{{ bindingStepClientHint(index) }}
|
||||
</p>
|
||||
<JsonTextareaField
|
||||
v-model="step.param_mapping_json"
|
||||
:label="t('admin.integrationConnector.bindingSteps.paramMapping', { index: index + 1 })"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<details class="rounded-lg border border-slate-200 px-3 py-2">
|
||||
<summary class="cursor-pointer text-xs font-bold text-secondary">{{ t('admin.integrationConnector.advancedConfig') }}</summary>
|
||||
<div class="mt-2 space-y-2">
|
||||
<JsonTextareaField v-model="bindingForm.context_selector_json" :label="t('admin.integrationConnector.fields.contextSelector')" />
|
||||
<p class="text-xs text-muted">{{ t('admin.integrationConnector.fields.contextSelectorHint') }}</p>
|
||||
<JsonTextareaField v-model="bindingForm.param_mapping_json" :label="t('admin.integrationConnector.fields.paramMapping')" />
|
||||
<p class="text-xs text-muted">{{ t('admin.integrationConnector.fields.paramMappingHint') }}</p>
|
||||
</div>
|
||||
</details>
|
||||
<!-- 状态不进表单正文:以底部操作条只读下拉展示(转移只经列表生命周期按钮) -->
|
||||
|
||||
+79
-11
@@ -76,7 +76,7 @@ describe('useIntegrationConnectorAdmin', () => {
|
||||
c.clientForm.value.config_json = '{"headers":{"X-Tenant":"A"}}';
|
||||
await c.saveActive();
|
||||
expect(api.createIntegrationClientInstance).toHaveBeenCalledWith({
|
||||
code: 'erp-x', name: 'ERP X', connector_type: 'rest', environment: 'prod',
|
||||
code: 'erp-x', name: 'ERP X', connector_type: 'rest', environment: 'prod', db_kind: null,
|
||||
endpoint: 'https://x.invalid', timeout_seconds: 90,
|
||||
config_json: { headers: { 'X-Tenant': 'A' } }, credential_ref_code: null, enabled: true,
|
||||
});
|
||||
@@ -85,7 +85,7 @@ describe('useIntegrationConnectorAdmin', () => {
|
||||
it('编辑客户端实例:有 id 走 PUT', async () => {
|
||||
const c = makeHarness();
|
||||
c.openEditModal('client', {
|
||||
id: 1, code: 'erp-x', name: 'old', connector_type: 'rest', environment: 'prod',
|
||||
id: 1, code: 'erp-x', name: 'old', connector_type: 'rest', environment: 'prod', db_kind: null,
|
||||
config_json: {}, credential_ref_code: null, enabled: true,
|
||||
});
|
||||
c.clientForm.value.name = 'new';
|
||||
@@ -93,6 +93,34 @@ describe('useIntegrationConnectorAdmin', () => {
|
||||
expect(api.updateIntegrationClientInstance).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('database 客户端:未选 db_kind 拦截不调 API;选择后 payload 携带 db_kind', async () => {
|
||||
const c = makeHarness();
|
||||
c.openCreateModal('client');
|
||||
c.clientForm.value.code = 'erp-db';
|
||||
c.clientForm.value.name = 'ERP Oracle';
|
||||
c.clientForm.value.connector_type = 'database';
|
||||
await c.saveActive();
|
||||
expect(api.createIntegrationClientInstance).not.toHaveBeenCalled();
|
||||
|
||||
c.clientForm.value.db_kind = 'oracle';
|
||||
c.clientForm.value.endpoint = '127.0.0.1:1521/ORCL';
|
||||
await c.saveActive();
|
||||
expect(api.createIntegrationClientInstance).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ connector_type: 'database', db_kind: 'oracle', endpoint: '127.0.0.1:1521/ORCL' }),
|
||||
);
|
||||
});
|
||||
|
||||
it('非 database 客户端 payload 的 db_kind 为 null(不输明文,凭据走引用)', async () => {
|
||||
const c = makeHarness();
|
||||
c.openCreateModal('client');
|
||||
c.clientForm.value.code = 'erp-x';
|
||||
c.clientForm.value.name = 'ERP X';
|
||||
await c.saveActive();
|
||||
expect(api.createIntegrationClientInstance).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ connector_type: 'rest', db_kind: null, credential_ref_code: null }),
|
||||
);
|
||||
});
|
||||
|
||||
it('非法 JSON 字段触发拦截且不调 API', async () => {
|
||||
const c = makeHarness();
|
||||
c.openCreateModal('client');
|
||||
@@ -130,24 +158,63 @@ describe('useIntegrationConnectorAdmin', () => {
|
||||
expect(api.createIntegrationClientInstance).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('绑定:必填校验与 POST payload(状态与来源快捷列不随表单提交)', async () => {
|
||||
it('绑定:有序多步 payload 用 steps_json,不再发送旧单步顶层字段', async () => {
|
||||
const c = makeHarness();
|
||||
c.openCreateModal('binding');
|
||||
c.bindingForm.value.capability = 'in_transit_transfer.query_inventory';
|
||||
c.bindingForm.value.client_instance_code = 'CLI-A';
|
||||
c.bindingForm.value.interface_definition_code = 'IF-A';
|
||||
c.bindingForm.value.capability = 'in_transit_transfer.create_transfer';
|
||||
c.bindingForm.value.steps = [
|
||||
{ interface_code: 'IF-STAGE', param_mapping_json: '{"erp_org":{"expr":"external_org"}}' },
|
||||
{ interface_code: 'IF-SUBMIT', param_mapping_json: '' },
|
||||
];
|
||||
await c.saveActive();
|
||||
expect(api.createIntegrationBinding).toHaveBeenCalledWith({
|
||||
capability: 'in_transit_transfer.query_inventory', context_selector_json: {},
|
||||
param_mapping_json: {},
|
||||
client_instance_code: 'CLI-A', interface_definition_code: 'IF-A',
|
||||
capability: 'in_transit_transfer.create_transfer', context_selector_json: {},
|
||||
steps_json: [
|
||||
{ interface_code: 'IF-STAGE', param_mapping_json: { erp_org: { expr: 'external_org' } } },
|
||||
{ interface_code: 'IF-SUBMIT', param_mapping_json: {} },
|
||||
],
|
||||
mapping_version: 1, priority: 0, environment: 'prod',
|
||||
effective_from: null, effective_to: null,
|
||||
});
|
||||
const payload = api.createIntegrationBinding.mock.calls[0][0] as Record<string, unknown>;
|
||||
// 状态走列表生命周期按钮;客户端实例随接口定义联动(仍随 payload 提交)
|
||||
// 客户端由各步接口归属自带,旧单步字段与状态均不随表单提交
|
||||
expect(payload).not.toHaveProperty('interface_definition_code');
|
||||
expect(payload).not.toHaveProperty('param_mapping_json');
|
||||
expect(payload).not.toHaveProperty('client_instance_code');
|
||||
expect(payload).not.toHaveProperty('status');
|
||||
expect(payload).not.toHaveProperty('context_source_code');
|
||||
});
|
||||
|
||||
it('绑定:步骤缺接口定义或步骤列表为空 → 拦截不调 API', async () => {
|
||||
const c = makeHarness();
|
||||
c.openCreateModal('binding');
|
||||
c.bindingForm.value.capability = 'in_transit_transfer.create_transfer';
|
||||
c.bindingForm.value.steps = [{ interface_code: '', param_mapping_json: '' }];
|
||||
await c.saveActive();
|
||||
expect(api.createIntegrationBinding).not.toHaveBeenCalled();
|
||||
c.bindingForm.value.steps = [];
|
||||
await c.saveActive();
|
||||
expect(api.createIntegrationBinding).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('编辑既有 steps_json 绑定:单步行回显为 steps 并仍以 steps_json 提交', async () => {
|
||||
const c = makeHarness();
|
||||
c.openEditModal('binding', {
|
||||
id: 7, capability: 'in_transit_transfer.create_transfer', context_selector_json: {},
|
||||
steps_json: [{ interface_code: 'IF-A', param_mapping_json: { org: { expr: 'external_org' } } }],
|
||||
param_mapping_json: { org: { expr: 'external_org' } },
|
||||
client_instance_code: 'CLI-A', interface_definition_code: 'IF-A',
|
||||
mapping_version: 1, priority: 0, environment: 'prod',
|
||||
effective_from: null, effective_to: null, status: 'draft',
|
||||
});
|
||||
expect(c.bindingForm.value.steps).toEqual([
|
||||
{ interface_code: 'IF-A', param_mapping_json: '{\n "org": {\n "expr": "external_org"\n }\n}' },
|
||||
]);
|
||||
await c.saveActive();
|
||||
expect(api.updateIntegrationBinding).toHaveBeenCalled();
|
||||
const payload = api.updateIntegrationBinding.mock.calls[0][1] as Record<string, unknown>;
|
||||
expect(Array.isArray(payload.steps_json)).toBe(true);
|
||||
expect(payload).not.toHaveProperty('interface_definition_code');
|
||||
expect(payload).not.toHaveProperty('param_mapping_json');
|
||||
});
|
||||
|
||||
it('绑定生命周期:publish 调动作端点并刷新绑定列表', async () => {
|
||||
@@ -156,6 +223,7 @@ describe('useIntegrationConnectorAdmin', () => {
|
||||
api.listIntegrationBindings.mockResolvedValue([]);
|
||||
c.bindings.value = [{
|
||||
id: 7, capability: 'in_transit_transfer.query_inventory', context_selector_json: {},
|
||||
steps_json: [{ interface_code: 'IF-A', param_mapping_json: {} }],
|
||||
client_instance_code: 'CLI-A', interface_definition_code: 'IF-A',
|
||||
mapping_version: 1, priority: 0, environment: 'prod',
|
||||
effective_from: null, effective_to: null, status: 'draft',
|
||||
|
||||
+29
-6
@@ -5,8 +5,10 @@
|
||||
* 依赖:integration-connector.api、types、useMessage、useI18n。
|
||||
* 逻辑:各列表独立 loadAll;新增/编辑共用表单弹窗态(form.id 区分);客户端编码
|
||||
* 可手改、留空按名称自动生成,接口定义编码留空按「客户端编码-名称」自动建议;
|
||||
* 接口与绑定状态只经 change*Lifecycle 按钮流转(表单内只读徽章);绑定表单的
|
||||
* 客户端实例随所选接口定义联动带出并锁定(接口归属即客户端归属);
|
||||
* database 类型 db_kind 必填四选一(未选提交在前端拦截),非 database 恒为 null;
|
||||
* 接口与绑定状态只经 change*Lifecycle 按钮流转(表单内只读徽章);绑定表单为
|
||||
* 有序步骤编辑器(steps 数组),提交 payload 用 steps_json(每步 interface_code +
|
||||
* param_mapping_json),client 由各步接口归属自带、不再发送旧单步顶层字段;
|
||||
* 凭据状态只经列表行内开关流转(启用↔停用,表单不维护状态);
|
||||
* 全部行内状态操作经 lifecycleBusy 互斥(进行中忽略新触发);接口/绑定退役
|
||||
* 接近终态需 window.confirm 二次确认,可逆转移直达;
|
||||
@@ -46,6 +48,7 @@ import {
|
||||
createEmptyCredentialReferenceForm,
|
||||
createEmptyInterfaceDefinitionForm,
|
||||
credentialReferenceRowToForm,
|
||||
DB_KIND_OPTIONS,
|
||||
interfaceDefinitionRowToForm,
|
||||
normalizeConnectionTestResponse,
|
||||
suggestClientCode,
|
||||
@@ -64,6 +67,9 @@ import {
|
||||
type InterfaceDefinitionFormState,
|
||||
} from '../types/integration-connector.types';
|
||||
|
||||
/** db_kind 四库枚举(D16);仅用于 DB_KIND_OPTIONS.includes 的类型收窄。 */
|
||||
type DbKind = (typeof DB_KIND_OPTIONS)[number];
|
||||
|
||||
type EditableEntity = 'client' | 'interface' | 'binding' | 'credential';
|
||||
|
||||
/** 接口定义/绑定生命周期动作(与后端 CONFIG_STATUS_TRANSITIONS 一一对应)。 */
|
||||
@@ -203,9 +209,15 @@ export function useIntegrationConnectorAdmin() {
|
||||
msg.warning(t('admin.integrationConnector.msg.codeInvalid'));
|
||||
return;
|
||||
}
|
||||
// database 类型 db_kind 必填(D16 四选一):未选在前端拦截,不发请求。
|
||||
if (form.connector_type === 'database' && !DB_KIND_OPTIONS.includes(form.db_kind as DbKind)) {
|
||||
msg.warning(t('admin.integrationConnector.msg.fillDbKind'));
|
||||
return;
|
||||
}
|
||||
const configJson = parseJsonField(form.config_json, 'config_json');
|
||||
const payload = {
|
||||
code, name: form.name.trim(), connector_type: form.connector_type,
|
||||
db_kind: form.connector_type === 'database' ? form.db_kind : null,
|
||||
environment: form.environment,
|
||||
endpoint: form.endpoint.trim() || null,
|
||||
timeout_seconds: form.timeout_seconds.trim() ? Number(form.timeout_seconds) : null,
|
||||
@@ -237,16 +249,27 @@ export function useIntegrationConnectorAdmin() {
|
||||
else await createIntegrationInterfaceDefinition(payload);
|
||||
} else if (activeEntity.value === 'binding') {
|
||||
const form = bindingForm.value;
|
||||
if (!form.capability.trim() || !form.client_instance_code.trim() || !form.interface_definition_code.trim()) {
|
||||
// 有序多步:至少一步且每步必选接口;client 由各步接口归属自带(后端按接口推导),
|
||||
// 不再发送旧单步顶层字段(interface_definition_code/param_mapping_json)。
|
||||
if (!form.capability.trim() || form.steps.length === 0) {
|
||||
msg.warning(t('admin.integrationConnector.msg.fillBinding'));
|
||||
return;
|
||||
}
|
||||
// 客户端实例随所选接口定义联动带出(接口归属即客户端归属);
|
||||
const steps: Array<{ interface_code: string; param_mapping_json: Record<string, unknown> }> = [];
|
||||
for (const [index, step] of form.steps.entries()) {
|
||||
if (!step.interface_code.trim()) {
|
||||
msg.warning(t('admin.integrationConnector.msg.fillBinding'));
|
||||
return;
|
||||
}
|
||||
steps.push({
|
||||
interface_code: step.interface_code.trim(),
|
||||
param_mapping_json: parseJsonField(step.param_mapping_json, `steps_json[${index}].param_mapping_json`),
|
||||
});
|
||||
}
|
||||
// 状态不随表单提交:新建固定 draft,发布/退役走列表生命周期按钮。
|
||||
const payload = {
|
||||
capability: form.capability.trim(), context_selector_json: parseJsonField(form.context_selector_json, 'context_selector_json'),
|
||||
param_mapping_json: parseJsonField(form.param_mapping_json, 'param_mapping_json'),
|
||||
client_instance_code: form.client_instance_code.trim(), interface_definition_code: form.interface_definition_code.trim(),
|
||||
steps_json: steps,
|
||||
mapping_version: Number(form.mapping_version || 1), priority: Number(form.priority || 0),
|
||||
environment: form.environment, effective_from: form.effective_from || null, effective_to: form.effective_to || null,
|
||||
};
|
||||
|
||||
+116
-16
@@ -7,14 +7,18 @@
|
||||
*/
|
||||
|
||||
/** 连接器类型:与后端 CONNECTOR_TYPES 对齐。 */
|
||||
export type IntegrationConnectorType = 'rest' | 'soap';
|
||||
export type IntegrationConnectorType = 'rest' | 'soap' | 'database';
|
||||
|
||||
/** 连接器类型选项(labelKey 为 i18n 键;新增类型在此追加一行并补四语言文案)。 */
|
||||
export const CONNECTOR_TYPE_OPTIONS: ReadonlyArray<{ value: IntegrationConnectorType; labelKey: string }> = [
|
||||
{ value: 'rest', labelKey: 'admin.integrationConnector.connectorTypes.rest' },
|
||||
{ value: 'soap', labelKey: 'admin.integrationConnector.connectorTypes.soap' },
|
||||
{ value: 'database', labelKey: 'admin.integrationConnector.connectorTypes.database' },
|
||||
];
|
||||
|
||||
/** database 类型 db_kind 选项(与后端 D16 四库驱动注册表对齐;label 键 connectorDbKind.*)。 */
|
||||
export const DB_KIND_OPTIONS = ['mysql', 'oracle', 'sqlserver', 'postgresql'] as const;
|
||||
|
||||
/** 环境选项(与发布流程 dev→test→prod 对齐;新增环境在此追加并补四语言文案)。 */
|
||||
export const ENVIRONMENT_OPTIONS = ['dev', 'test', 'prod'] as const;
|
||||
|
||||
@@ -22,6 +26,7 @@ export const ENVIRONMENT_OPTIONS = ['dev', 'test', 'prod'] as const;
|
||||
export const CONNECTOR_CONFIG_KEYS: Readonly<Record<string, ReadonlyArray<string>>> = {
|
||||
rest: ['headers'],
|
||||
soap: [],
|
||||
database: ['oracle_lib_dir'],
|
||||
};
|
||||
|
||||
/** 客户端编码规则:小写字母/数字开头,仅小写字母、数字、连字符(保存后不可改)。 */
|
||||
@@ -135,6 +140,8 @@ export interface IntegrationClientInstanceRow {
|
||||
environment: string;
|
||||
endpoint: string | null;
|
||||
timeout_seconds: number | null;
|
||||
/** database 类型专列(D16 四库);rest/soap 为 null。 */
|
||||
db_kind: string | null;
|
||||
config_json: Record<string, unknown>;
|
||||
credential_ref_code: string | null;
|
||||
enabled: boolean;
|
||||
@@ -158,11 +165,18 @@ export interface IntegrationInterfaceDefinitionRow {
|
||||
enabled: boolean;
|
||||
}
|
||||
|
||||
/** 绑定(能力 → 客户端 + 接口 + 映射版本)。 */
|
||||
/** 绑定有序步骤(调用期按序执行;客户端实例由步骤接口归属自带)。 */
|
||||
export interface IntegrationBindingStep {
|
||||
interface_code: string;
|
||||
param_mapping_json: Record<string, unknown>;
|
||||
}
|
||||
|
||||
/** 绑定(能力 → 有序多步接口配方 + 映射版本;旧单步列为 P2 删前镜像,仅回显兜底)。 */
|
||||
export interface IntegrationBindingRow {
|
||||
id: number;
|
||||
capability: string;
|
||||
context_selector_json: Record<string, unknown>;
|
||||
steps_json: IntegrationBindingStep[];
|
||||
param_mapping_json: Record<string, unknown>;
|
||||
client_instance_code: string;
|
||||
interface_definition_code: string;
|
||||
@@ -195,6 +209,8 @@ export interface ClientInstanceFormState {
|
||||
code: string;
|
||||
name: string;
|
||||
connector_type: IntegrationConnectorType;
|
||||
/** database 类型专属四选一(mysql/oracle/sqlserver/postgresql);非 database 恒为空串。 */
|
||||
db_kind: string;
|
||||
environment: string;
|
||||
endpoint: string;
|
||||
timeout_seconds: string;
|
||||
@@ -224,17 +240,24 @@ export interface InterfaceDefinitionFormState {
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定表单(JSON 字段以文本承载,提交时解析)。
|
||||
* client_instance_code 随所选接口定义联动带出并锁定(接口归属即客户端归属),仍随表单提交;
|
||||
* status 仅作徽章展示:新建固定 draft,发布/退役经列表生命周期按钮流转,均不随表单提交。
|
||||
* 绑定表单步骤(JSON 映射以文本承载,提交时解析;每步独立编辑)。
|
||||
*/
|
||||
export interface BindingStepFormState {
|
||||
interface_code: string;
|
||||
param_mapping_json: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定表单(接口为有序多步,client 由各步接口归属自带 → 不再单独维护)。
|
||||
* JSON 字段以文本承载,提交时解析;status 仅作徽章展示:新建固定 draft,
|
||||
* 发布/退役经列表生命周期按钮流转,均不随表单提交。
|
||||
*/
|
||||
export interface BindingFormState {
|
||||
id: number | null;
|
||||
capability: string;
|
||||
context_selector_json: string;
|
||||
param_mapping_json: string;
|
||||
client_instance_code: string;
|
||||
interface_definition_code: string;
|
||||
/** 有序步骤(调用期按数组顺序执行;至少一步且每步必选接口才能提交)。 */
|
||||
steps: BindingStepFormState[];
|
||||
mapping_version: number;
|
||||
priority: number;
|
||||
environment: string;
|
||||
@@ -266,6 +289,7 @@ export function createEmptyClientInstanceForm(): ClientInstanceFormState {
|
||||
code: '',
|
||||
name: '',
|
||||
connector_type: 'rest',
|
||||
db_kind: '',
|
||||
environment: 'prod',
|
||||
endpoint: '',
|
||||
timeout_seconds: '60',
|
||||
@@ -282,6 +306,7 @@ export function clientInstanceRowToForm(row: IntegrationClientInstanceRow): Clie
|
||||
code: row.code,
|
||||
name: row.name,
|
||||
connector_type: row.connector_type,
|
||||
db_kind: row.db_kind ?? '',
|
||||
environment: row.environment,
|
||||
endpoint: row.endpoint ?? '',
|
||||
timeout_seconds: String(row.timeout_seconds ?? ''),
|
||||
@@ -327,15 +352,13 @@ export function interfaceDefinitionRowToForm(row: IntegrationInterfaceDefinition
|
||||
};
|
||||
}
|
||||
|
||||
/** 创建空的绑定表单。 */
|
||||
/** 创建空的绑定表单(空步骤列表,用户经「添加步骤」构建有序配方)。 */
|
||||
export function createEmptyBindingForm(): BindingFormState {
|
||||
return {
|
||||
id: null,
|
||||
capability: '',
|
||||
context_selector_json: '',
|
||||
param_mapping_json: '',
|
||||
client_instance_code: '',
|
||||
interface_definition_code: '',
|
||||
steps: [],
|
||||
mapping_version: 1,
|
||||
priority: 0,
|
||||
environment: 'prod',
|
||||
@@ -345,15 +368,24 @@ export function createEmptyBindingForm(): BindingFormState {
|
||||
};
|
||||
}
|
||||
|
||||
/** 列表行回填为绑定编辑表单(status 仅回显,不随保存提交)。 */
|
||||
/**
|
||||
* 列表行回填为绑定编辑表单(status 仅回显,不随保存提交)。
|
||||
* 步骤优先读 steps_json;steps_json 为空(P2 前的存量旧列行)时由旧单步列合成一步兜底。
|
||||
*/
|
||||
export function bindingRowToForm(row: IntegrationBindingRow): BindingFormState {
|
||||
const rawSteps = row.steps_json?.length
|
||||
? row.steps_json
|
||||
: [{ interface_code: row.interface_definition_code, param_mapping_json: row.param_mapping_json || {} }];
|
||||
return {
|
||||
id: row.id,
|
||||
capability: row.capability,
|
||||
context_selector_json: toJsonText(row.context_selector_json),
|
||||
param_mapping_json: toJsonText(row.param_mapping_json),
|
||||
client_instance_code: row.client_instance_code,
|
||||
interface_definition_code: row.interface_definition_code,
|
||||
steps: rawSteps
|
||||
.filter((step) => step.interface_code)
|
||||
.map((step) => ({
|
||||
interface_code: step.interface_code,
|
||||
param_mapping_json: toJsonText(step.param_mapping_json),
|
||||
})),
|
||||
mapping_version: Number(row.mapping_version || 1),
|
||||
priority: Number(row.priority || 0),
|
||||
environment: row.environment,
|
||||
@@ -388,3 +420,71 @@ export function credentialReferenceRowToForm(row: IntegrationCredentialReference
|
||||
status: row.status,
|
||||
};
|
||||
}
|
||||
|
||||
/** 集成调用日志行(GET /calls 列表项;字段全部能力无关通用口径)。 */
|
||||
export interface IntegrationCallLogRow {
|
||||
id: number;
|
||||
created_at: string | null;
|
||||
capability: string;
|
||||
operation_id: string;
|
||||
trace_id: string;
|
||||
status: string;
|
||||
elapsed_ms: number;
|
||||
business_ref: string | null;
|
||||
client_code: string | null;
|
||||
interface_code: string | null;
|
||||
connector_type: string | null;
|
||||
step_index: number | null;
|
||||
step_count: number | null;
|
||||
}
|
||||
|
||||
/** 线级事实(按连接类型二选一;database=SQL/绑定/行数,soap/rest=HTTP 往返)。 */
|
||||
export interface IntegrationCallWire {
|
||||
kind: 'database' | 'soap' | 'rest';
|
||||
statements?: { phase: string; sql: string; binds: Record<string, unknown>; rowcount?: number; row_count?: number }[];
|
||||
rowcount?: number;
|
||||
rows?: unknown[];
|
||||
method?: string;
|
||||
url?: string;
|
||||
soap_action?: string;
|
||||
headers?: string;
|
||||
request_body?: string;
|
||||
http_status?: number;
|
||||
response_body?: string;
|
||||
}
|
||||
|
||||
/** 调用全量详情(GET /calls/{id};含同 operation_id 步骤时间线)。 */
|
||||
export interface IntegrationCallDetail {
|
||||
call: {
|
||||
id: number;
|
||||
created_at: string | null;
|
||||
capability: string;
|
||||
operation_id: string;
|
||||
trace_id: string;
|
||||
status: string;
|
||||
elapsed_ms: number;
|
||||
business_ref: string | null;
|
||||
binding_snapshot_json: Record<string, unknown>;
|
||||
request_summary_json: Record<string, unknown>;
|
||||
response_summary_json: Record<string, unknown>;
|
||||
wire_json: IntegrationCallWire | null;
|
||||
};
|
||||
timeline: { id: number; step_index: number | null; step_count: number | null; interface_code: string | null; status: string; elapsed_ms: number }[];
|
||||
}
|
||||
|
||||
/** 列表查询条件(全部可选;后端缺省口径 page=1/page_size=20)。 */
|
||||
export interface IntegrationCallFilters {
|
||||
capability?: string;
|
||||
interface_code?: string;
|
||||
client_code?: string;
|
||||
connector_type?: string;
|
||||
status?: string;
|
||||
operation_id?: string;
|
||||
trace_id?: string;
|
||||
keyword?: string;
|
||||
business_ref?: string;
|
||||
date_from?: string;
|
||||
date_to?: string;
|
||||
page?: number;
|
||||
page_size?: number;
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
/**
|
||||
* features/admin/modules/integration-connector/utils/integration-call-replay.spec.ts
|
||||
* 验证调用复现命令生成:soap/rest curl 组装(SOAPAction 引号、headers 展开、凭据脱敏)、
|
||||
* inlineBinds 具名绑定内联(单引号转义)、buildSqlReplay 写入类自动包事务 + ROLLBACK 警示。
|
||||
*/
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { buildCurl, buildSqlReplay, inlineBinds } from './integration-call-replay';
|
||||
import type { IntegrationCallWire } from '../types/integration-connector.types';
|
||||
|
||||
describe('buildCurl(soap)', () => {
|
||||
it('含 Content-Type、SOAPAction(保留双引号)与 --data-binary 完整 body', () => {
|
||||
// [断言意图] SOAPAction 值按真实 ERP 口径自带双引号,生成命令必须原样保留且整体 shell 安全包裹
|
||||
const wire: IntegrationCallWire = {
|
||||
kind: 'soap',
|
||||
method: 'POST',
|
||||
url: 'http://erp.example/TopGP.asmx',
|
||||
soap_action: '"urn:CreateTransfer"',
|
||||
request_body: '<soapenv:Envelope>…</soapenv:Envelope>',
|
||||
};
|
||||
const cmd = buildCurl(wire);
|
||||
expect(cmd).toContain('curl -X POST');
|
||||
expect(cmd).toContain("-H 'SOAPAction: \"urn:CreateTransfer\"'");
|
||||
expect(cmd).toContain("-H 'Content-Type: text/xml; charset=utf-8'");
|
||||
expect(cmd).toContain('--data-binary');
|
||||
expect(cmd).toContain('<soapenv:Envelope>…</soapenv:Envelope>');
|
||||
// [断言意图] 末行不得以续行符 \ 结尾,否则粘贴进 bash 会进入 PS2 续行等待
|
||||
expect(cmd.endsWith('\\')).toBe(false);
|
||||
});
|
||||
|
||||
it('soap_action 缺省时回退空双引号', () => {
|
||||
const cmd = buildCurl({ kind: 'soap', url: 'http://erp.example/svc' });
|
||||
expect(cmd).toContain('SOAPAction: ""');
|
||||
expect(cmd.endsWith('\\')).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('buildCurl(rest)', () => {
|
||||
it('headers JSON 逐个展开为 -H,凭据位 *** 替换为 ***REDACTED***', () => {
|
||||
// [断言意图] 脱敏口径:wire 中凭据位只存 '***',复现命令不得还原真实凭据
|
||||
const wire: IntegrationCallWire = {
|
||||
kind: 'rest',
|
||||
method: 'POST',
|
||||
url: 'https://api.example/v1/orders',
|
||||
headers: JSON.stringify({ 'Content-Type': 'application/json', Authorization: '***', 'X-App-Id': 'demo' }),
|
||||
request_body: '{"doc_no":"TGHX1-OR-00001"}',
|
||||
};
|
||||
const cmd = buildCurl(wire);
|
||||
expect(cmd).toContain("-H 'Content-Type: application/json'");
|
||||
expect(cmd).toContain("-H 'Authorization: ***REDACTED***'");
|
||||
expect(cmd).toContain("-H 'X-App-Id: demo'");
|
||||
expect(cmd).toContain('-d');
|
||||
expect(cmd).toContain('{"doc_no":"TGHX1-OR-00001"}');
|
||||
// [断言意图] 末行不得以续行符 \ 结尾(修复前 -d 段恒带尾随 \,bash 粘贴会挂起)
|
||||
expect(cmd.endsWith('\\')).toBe(false);
|
||||
});
|
||||
|
||||
it('无 headers 无 body 时为单行命令且不以续行符收尾', () => {
|
||||
// [断言意图] 回归:修复前即使裸命令也以 \ 收尾(filter 后末段仍是带 \ 的首行)
|
||||
const cmd = buildCurl({ kind: 'rest', method: 'GET', url: 'https://api.example/ping' });
|
||||
expect(cmd).toContain("curl -X GET 'https://api.example/ping'");
|
||||
expect(cmd.endsWith('\\')).toBe(false);
|
||||
expect(cmd.split('\n')).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('inlineBinds', () => {
|
||||
it("字符串绑定单引号转义(it doesn't → doesn''t),数字原样,未知占位符保留", () => {
|
||||
// [断言意图] 单引号必须转义为 '',否则复现 SQL 直接语法报错
|
||||
const sql = "UPDATE t SET note = :note, qty = :qty WHERE id = :id";
|
||||
const out = inlineBinds(sql, { note: "it doesn't", qty: 3, id: 7 });
|
||||
expect(out).toContain("'it doesn''t'");
|
||||
expect(out).toContain('qty = 3');
|
||||
expect(out).toContain('id = 7');
|
||||
|
||||
const unknown = inlineBinds('SELECT :missing FROM dual', {});
|
||||
expect(unknown).toContain(':missing');
|
||||
});
|
||||
});
|
||||
|
||||
describe('buildSqlReplay(写入类)', () => {
|
||||
it('INSERT 语句包 BEGIN; … ROLLBACK; 事务并带环境确认警示;bulk 段注释取首行口径', () => {
|
||||
// [断言意图] 写入类复现默认 ROLLBACK 兜底,防止误写目标库;确认后人工改 COMMIT
|
||||
const wire: IntegrationCallWire = {
|
||||
kind: 'database',
|
||||
statements: [
|
||||
{ phase: 'pre', sql: "INSERT INTO t (a) VALUES (:a)", binds: { a: "O'Brien" } },
|
||||
{ phase: 'bulk', sql: 'UPDATE t SET b = :b', binds: { b: 'x' } },
|
||||
],
|
||||
};
|
||||
const out = buildSqlReplay(wire);
|
||||
expect(out).toContain('⚠ 写入语句');
|
||||
expect(out).toContain('BEGIN;');
|
||||
expect(out).toContain('ROLLBACK');
|
||||
expect(out).toContain("O''Brien");
|
||||
expect(out).toContain('-- bulk(绑定取首行;全量行由应用逐行 executemany)');
|
||||
});
|
||||
|
||||
it('只读 SELECT 不包事务,直接以分号收尾', () => {
|
||||
const out = buildSqlReplay({
|
||||
kind: 'database',
|
||||
statements: [{ phase: 'read', sql: 'SELECT * FROM t WHERE id = :id', binds: { id: 1 } }],
|
||||
});
|
||||
expect(out).not.toContain('BEGIN;');
|
||||
expect(out).not.toContain('ROLLBACK');
|
||||
expect(out).toContain('id = 1');
|
||||
});
|
||||
});
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
/**
|
||||
* features/admin/modules/integration-connector/utils/integration-call-replay.ts
|
||||
* 集成调用复现命令生成(wire → 外部工具可直接执行的文本)。
|
||||
* 依赖:../types/integration-connector.types(IntegrationCallWire 线级事实类型)。
|
||||
* 逻辑:soap/rest 生成 curl(凭据位为 ***REDACTED***,需手工替换);
|
||||
* database 生成绑定已内联的 SQL(写入类包事务并标注警示)。
|
||||
* 供 IntegrationCallLogsPanel 抽屉「复制 curl / 复制 SQL」按钮消费。
|
||||
*/
|
||||
import type { IntegrationCallWire } from '../types/integration-connector.types';
|
||||
|
||||
const REDACTED = '***REDACTED***';
|
||||
|
||||
/** shell 单引号安全包裹(' → '\'' ),保证含单引号的 body/URL 可原样粘贴执行。 */
|
||||
function shellQuote(value: string): string {
|
||||
return `'${value.replace(/'/g, `'\\''`)}'`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼接 curl 多行命令并剥离末段尾随续行符。
|
||||
* 约束:末行若以 `\` 结尾,粘贴进 bash 会进入 PS2 续行等待,破坏「可直接执行」承诺;
|
||||
* 末段内容本身恒以引号收尾,结尾的 ` \` 只可能是我们追加的续行符,不会误伤。
|
||||
*/
|
||||
function joinCurlCommand(lines: string[]): string {
|
||||
return lines.filter(Boolean).join('\n').replace(/ \\$/, '');
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成 HTTP 调用的 curl 复现命令。
|
||||
* soap 固定 text/xml + SOAPAction 头(值为空时回退 '""');rest 展开 headers JSON
|
||||
* (值为 '***' 的凭据位替换为 ***REDACTED*** 提示手工替换)。
|
||||
* @param wire - 调用详情 wire_json(kind 必须为 soap/rest,database 走 buildSqlReplay)
|
||||
* @returns 多行 curl 命令文本(\ 续行,可直接粘贴 bash,末行不以 \ 结尾)
|
||||
*/
|
||||
export function buildCurl(wire: IntegrationCallWire): string {
|
||||
if (wire.kind === 'soap') {
|
||||
return joinCurlCommand([
|
||||
`curl -X ${wire.method || 'POST'} ${shellQuote(wire.url || '')} \\`,
|
||||
` -H 'Content-Type: text/xml; charset=utf-8' \\`,
|
||||
` -H ${shellQuote(`SOAPAction: ${wire.soap_action || '""'}`)} \\`,
|
||||
` --data-binary ${shellQuote(wire.request_body || '')}`,
|
||||
]);
|
||||
}
|
||||
const headers = wire.headers
|
||||
? (JSON.parse(wire.headers) as Record<string, string>)
|
||||
: {};
|
||||
const headerLines = Object.entries(headers)
|
||||
.map(([k, v]) => ` -H ${shellQuote(`${k}: ${v === '***' ? REDACTED : v}`)} \\`)
|
||||
.join('\n');
|
||||
const bodyPart = wire.request_body
|
||||
? ` -d ${shellQuote(wire.request_body)} \\`
|
||||
: '';
|
||||
return joinCurlCommand([
|
||||
`curl -X ${wire.method || 'GET'} ${shellQuote(wire.url || '')} \\`,
|
||||
headerLines,
|
||||
bodyPart,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* SQL 字面量引价:null/undefined → NULL,数字原样,字符串单引号包裹且内部 ' 转义为 ''。
|
||||
* @param value - 绑定值(来自 wire statements[].binds,任意 JSON 类型)
|
||||
*/
|
||||
function quoteLiteral(value: unknown): string {
|
||||
if (value === null || value === undefined) return 'NULL';
|
||||
if (typeof value === 'number') return String(value);
|
||||
return `'${String(value).replace(/'/g, "''")}'`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 把具名绑定(:name)内联为 SQL 字面量,生成绑定已内联的可执行版 SQL。
|
||||
* @param sql - 含 :name 占位符的原始 SQL(无对应绑定的占位符原样保留,不静默改写)
|
||||
* @param binds - 绑定字典(可为空对象)
|
||||
*/
|
||||
export function inlineBinds(sql: string, binds: Record<string, unknown>): string {
|
||||
return sql.replace(/:([A-Za-z_][A-Za-z0-9_]*)/g, (raw, name: string) =>
|
||||
name in binds ? quoteLiteral(binds[name]) : raw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成 database 类型调用的 SQL 复现文本。
|
||||
* bulk 段绑定取首行并注明全量行由应用 executemany;任一语句为写入类
|
||||
* (INSERT/UPDATE/DELETE/MERGE,大小写不敏感)时包 BEGIN; ... ROLLBACK; 事务并加红字警示,
|
||||
* 防止复现时误写目标库。
|
||||
* @param wire - 调用详情 wire_json(kind 必须为 database)
|
||||
* @returns 可执行 SQL 文本(写入类默认 ROLLBACK,确认后手工改 COMMIT)
|
||||
*/
|
||||
export function buildSqlReplay(wire: IntegrationCallWire): string {
|
||||
const statements = (wire.statements || [])
|
||||
.map((s) => (s.phase === 'bulk'
|
||||
? `-- bulk(绑定取首行;全量行由应用逐行 executemany)\n${inlineBinds(s.sql, s.binds || {})}`
|
||||
: inlineBinds(s.sql, s.binds || {})));
|
||||
const isWrite = statements.some((s) => /^\s*(INSERT|UPDATE|DELETE|MERGE)/im.test(s));
|
||||
const body = statements.join(';\n\n');
|
||||
return isWrite ? `-- ⚠ 写入语句:请确认目标环境后再执行\nBEGIN;\n${body};\nROLLBACK; -- 确认后改为 COMMIT` : `${body};`;
|
||||
}
|
||||
@@ -1,12 +1,16 @@
|
||||
/**
|
||||
* features/chat/api/transfer.api.spec.ts
|
||||
* 用途:锁定在途仓自动调拨 JSON POST 请求头契约——必须携带 Content-Type: application/json,
|
||||
* 否则后端 Flask request.get_json 解析不到 body,导致默认 source_codes=[] 返回 400。
|
||||
* 否则后端 Flask request.get_json 解析不到 body,导致默认 source_codes=[] 返回 400;
|
||||
* 另锁定 D8 异步 202 契约(requestJson 对 200/202 均透传 envelope.data)与
|
||||
* D9 调拨单清单(GET /runs/{run_no} 返回体 orders 数组透传)。
|
||||
* 依赖:Vitest、vi.mock(@/shared/api/client)、transfer.api、getAuthHeaders。
|
||||
* 逻辑:POST(create/execute/cancel/retry/manual-close)断言 headers 含 application/json,
|
||||
* 且 body 序列化正确;GET/blob 端点不强制 Content-Type。
|
||||
* 且 body 序列化正确;GET/blob 端点不强制 Content-Type;
|
||||
* 202 契约用例用 vi.importActual 取真实 requestJson(stub fetch)验证 200/202 同口径。
|
||||
*/
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { afterEach, beforeAll, beforeEach, describe, expect, expectTypeOf, it, vi } from 'vitest';
|
||||
import type { TransferRunResult, TransferOrder } from '../types/transfer.types';
|
||||
|
||||
const requestJson = vi.hoisted(() => vi.fn());
|
||||
const requestBlob = vi.hoisted(() => vi.fn());
|
||||
@@ -23,10 +27,10 @@ vi.mock('@/shared/utils/auth', () => ({
|
||||
|
||||
import {
|
||||
cancelTransferRun,
|
||||
createTransferPrecheck,
|
||||
executeTransferPrecheck,
|
||||
createTransferMatching,
|
||||
executeTransferItems,
|
||||
getTransferBacklogSummary,
|
||||
getTransferPrecheck,
|
||||
getTransferMatching,
|
||||
getTransferRun,
|
||||
listTransferSources,
|
||||
manualCloseTransferItem,
|
||||
@@ -39,21 +43,24 @@ describe('transfer.api JSON request contract', () => {
|
||||
requestBlob.mockReset();
|
||||
});
|
||||
|
||||
it('创建预检 POST 带 Content-Type: application/json 与序列化 source_codes', () => {
|
||||
createTransferPrecheck({ source_codes: ['DBS-AWSBI'], business_date: '2026-08-18' });
|
||||
it('创建匹配 POST 带 Content-Type: application/json 与序列化 source_codes', () => {
|
||||
createTransferMatching({ source_codes: ['DBS-AWSBI'], business_date: '2026-08-18' });
|
||||
const [url, init] = requestJson.mock.calls[0] as [string, RequestInit];
|
||||
expect(url).toBe('/api/in-transit-transfer/prechecks');
|
||||
expect(url).toBe('/api/in-transit-transfer/matchings');
|
||||
expect(init.method).toBe('POST');
|
||||
expect((init.headers as Record<string, string>)['Content-Type']).toBe('application/json');
|
||||
expect(init.body).toBe(JSON.stringify({ source_codes: ['DBS-AWSBI'], business_date: '2026-08-18' }));
|
||||
});
|
||||
|
||||
it('直接生成调拨单 POST 带 application/json', () => {
|
||||
executeTransferPrecheck('TPC-1', ['INV-001']);
|
||||
const [, init] = requestJson.mock.calls[0] as [string, RequestInit];
|
||||
it('按明细行执行调拨 POST /items/execute 带 application/json 与 item_ids 契约', () => {
|
||||
// [断言意图] 行式执行(2026-09-23 item-centric 重构):执行不再挂在旧匹配详情端点下,
|
||||
// 改为独立 items/execute,body 键从 invoice_nos 改为 item_ids;JSON 头契约不变。
|
||||
executeTransferItems([101, 102]);
|
||||
const [url, init] = requestJson.mock.calls[0] as [string, RequestInit];
|
||||
expect(url).toBe('/api/in-transit-transfer/items/execute');
|
||||
expect(init.method).toBe('POST');
|
||||
expect((init.headers as Record<string, string>)['Content-Type']).toBe('application/json');
|
||||
expect(init.body).toBe(JSON.stringify({ invoice_nos: ['INV-001'] }));
|
||||
expect(init.body).toBe(JSON.stringify({ item_ids: [101, 102] }));
|
||||
});
|
||||
|
||||
it('重试/关闭/取消 POST 带 application/json', () => {
|
||||
@@ -67,7 +74,7 @@ describe('transfer.api JSON request contract', () => {
|
||||
});
|
||||
|
||||
it('GET 端点只需鉴权头,不需要强制 Content-Type', () => {
|
||||
getTransferPrecheck('TPC-1');
|
||||
getTransferMatching('MTG-1');
|
||||
getTransferRun('RUN-1');
|
||||
getTransferBacklogSummary();
|
||||
listTransferSources();
|
||||
@@ -75,4 +82,96 @@ describe('transfer.api JSON request contract', () => {
|
||||
expect(init.headers).toBeDefined();
|
||||
}
|
||||
});
|
||||
|
||||
it('getTransferRun 返回体 orders 调拨单清单逐键透传(D9 融合卡数据源)', async () => {
|
||||
// [断言意图] D9:调拨单清单=进度=结果,orders 逐键结构与后端 serialize_run_orders
|
||||
// (Task 11)一致,前端只透传不加工;类型层 TransferRunResult 必含 orders: TransferOrder[]。
|
||||
const order: TransferOrder = {
|
||||
doc_no: 'HTT-OR-26092300001',
|
||||
receipt_date: '2026-09-23',
|
||||
from_warehouse: 'HTT-B25',
|
||||
to_warehouse: 'HTT-B02',
|
||||
status: 'success',
|
||||
erp_document_no: '1401-2609230007',
|
||||
error_message: null,
|
||||
lines: [{ material_no: 'M001', material_name: '材料甲', lot_no: 'VCCN001', quantity: '100.000000', unit: 'KG' }],
|
||||
};
|
||||
requestJson.mockResolvedValue({
|
||||
run_no: 'RUN-T1',
|
||||
status: 'executing',
|
||||
result: { external_documents: [], exceptions: [] },
|
||||
orders: [order],
|
||||
});
|
||||
const run = await getTransferRun('RUN-T1');
|
||||
expect(requestJson).toHaveBeenCalledWith('/api/in-transit-transfer/runs/RUN-T1', { headers: { Authorization: 'Bearer TEST-TOKEN' } });
|
||||
expect(run.orders).toEqual([order]);
|
||||
// 类型补齐锁定(spec 不进 vue-tsc,此处为文档化断言)
|
||||
expectTypeOf<TransferRunResult['orders']>().toEqualTypeOf<TransferOrder[]>();
|
||||
});
|
||||
});
|
||||
|
||||
describe('transfer.api D8 异步 202 契约(真实 requestJson:200/202 均透传 envelope.data)', () => {
|
||||
// importActual 绕开本文件的 client mock 取真实 requestJson(不 resetModules,
|
||||
// 避免全量套件下动态重载的 worker 状态干扰);requestJson 仅按 res.ok(2xx)判成功,
|
||||
// 202 与 200 同口径——前端 API 层零特判、不改 client。
|
||||
let realRequestJson: typeof import('@/shared/api/client').requestJson;
|
||||
|
||||
beforeAll(async () => {
|
||||
({ requestJson: realRequestJson } = await vi.importActual('@/shared/api/client'));
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
// 防其他文件泄漏的 fake timers 卡住 fetch/Response 的微任务与流式读取
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.unstubAllGlobals();
|
||||
});
|
||||
|
||||
it('HTTP 202 envelope data 原样透传(data = {run_no,status:"queued"})', async () => {
|
||||
const fetchMock = vi.fn();
|
||||
vi.stubGlobal('fetch', fetchMock);
|
||||
fetchMock.mockResolvedValue(new Response(
|
||||
JSON.stringify({ success: true, data: { run_no: 'RUN-202-1', status: 'queued' }, request_id: 'req-1' }),
|
||||
{ status: 202, headers: { 'Content-Type': 'application/json' } },
|
||||
));
|
||||
const data = await realRequestJson<{ run_no: string; status: string }>('/api/in-transit-transfer/items/execute', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json', Authorization: 'Bearer TEST-TOKEN' },
|
||||
body: JSON.stringify({ item_ids: [1, 2] }),
|
||||
});
|
||||
const [url, init] = fetchMock.mock.calls[0] as [string, RequestInit];
|
||||
expect(url).toBe('/api/in-transit-transfer/items/execute');
|
||||
expect(init.method).toBe('POST');
|
||||
expect((init.headers as Headers).get('Content-Type')).toBe('application/json');
|
||||
expect(data).toEqual({ run_no: 'RUN-202-1', status: 'queued' });
|
||||
});
|
||||
|
||||
it('HTTP 200 同口径:run 返回体含 orders 数组并逐键透传', async () => {
|
||||
const fetchMock = vi.fn();
|
||||
vi.stubGlobal('fetch', fetchMock);
|
||||
const order: TransferOrder = {
|
||||
doc_no: 'HTT-OR-26092300002',
|
||||
receipt_date: '2026-09-23',
|
||||
from_warehouse: 'HTT-B25',
|
||||
to_warehouse: 'HTT-B02',
|
||||
status: 'executing',
|
||||
erp_document_no: null,
|
||||
error_message: null,
|
||||
lines: [],
|
||||
};
|
||||
fetchMock.mockResolvedValue(new Response(
|
||||
JSON.stringify({
|
||||
success: true,
|
||||
data: { run_no: 'RUN-202-2', status: 'executing', result: { external_documents: [], exceptions: [] }, orders: [order] },
|
||||
}),
|
||||
{ status: 200, headers: { 'Content-Type': 'application/json' } },
|
||||
));
|
||||
const run = await realRequestJson<TransferRunResult>('/api/in-transit-transfer/runs/RUN-202-2', {
|
||||
headers: { Authorization: 'Bearer TEST-TOKEN' },
|
||||
});
|
||||
expect(fetchMock.mock.calls[0][0]).toBe('/api/in-transit-transfer/runs/RUN-202-2');
|
||||
expect(run.orders).toEqual([order]);
|
||||
});
|
||||
});
|
||||
@@ -8,11 +8,15 @@ import { requestBlob, requestJson } from '@/shared/api/client';
|
||||
import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
import type {
|
||||
TransferActionResult,
|
||||
TransferDocumentRetryResult,
|
||||
TransferBacklogItem,
|
||||
TransferBacklogSummary,
|
||||
TransferBatchResult,
|
||||
TransferExecutedOrdersPage,
|
||||
TransferExecuteResponse,
|
||||
TransferPrecheckDetail,
|
||||
TransferPrecheckSummary,
|
||||
TransferMatchingDetail,
|
||||
TransferMatchingItem,
|
||||
TransferMatchingSummary,
|
||||
TransferRunResult,
|
||||
TransferSourceFileStatus,
|
||||
TransferSourceOption,
|
||||
@@ -24,7 +28,7 @@ const BASE = '/api/in-transit-transfer';
|
||||
/** JSON 请求头:除鉴权外必须带 Content-Type: application/json,否则 Flask request.get_json 解析不到 body。 */
|
||||
const jsonHeaders = () => ({ 'Content-Type': 'application/json', ...getAuthHeaders() });
|
||||
|
||||
export interface CreatePrecheckPayload {
|
||||
export interface CreateMatchingPayload {
|
||||
source_codes: string[];
|
||||
business_date?: string;
|
||||
receipt_date_from?: string;
|
||||
@@ -33,34 +37,111 @@ export interface CreatePrecheckPayload {
|
||||
transfer_type?: TransferType;
|
||||
}
|
||||
|
||||
/** 创建预检(只读) */
|
||||
export const createTransferPrecheck = (payload: CreatePrecheckPayload) =>
|
||||
requestJson<TransferPrecheckSummary>(BASE + '/prechecks', {
|
||||
/** 创建匹配(只读) */
|
||||
export const createTransferMatching = (payload: CreateMatchingPayload) =>
|
||||
requestJson<TransferMatchingSummary>(BASE + '/matchings', {
|
||||
method: 'POST',
|
||||
headers: jsonHeaders(),
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
|
||||
/** 恢复预检进度与明细 */
|
||||
export const getTransferPrecheck = (precheckId: string) =>
|
||||
requestJson<TransferPrecheckDetail>(`${BASE}/prechecks/${precheckId}`, {
|
||||
/** 恢复匹配进度与明细 */
|
||||
export const getTransferMatching = (matchingId: string) =>
|
||||
requestJson<TransferMatchingDetail>(`${BASE}/matchings/${matchingId}`, {
|
||||
headers: getAuthHeaders(),
|
||||
});
|
||||
|
||||
/** 确认选择范围并直接生成执行 Run */
|
||||
export const executeTransferPrecheck = (precheckId: string, invoiceNos: string[]) =>
|
||||
requestJson<TransferExecuteResponse>(`${BASE}/prechecks/${precheckId}/execute`, {
|
||||
/** 可调拨明细:全局可执行行队列(勾选后 executeTransferItems 按行生成调拨单) */
|
||||
export const listExecutableTransferItems = () =>
|
||||
requestJson<{ items: TransferMatchingItem[]; counts: { executable_count: number } }>(
|
||||
`${BASE}/items/executable`,
|
||||
{ headers: getAuthHeaders() },
|
||||
);
|
||||
|
||||
/**
|
||||
* 按明细行执行调拨(item-centric:body {item_ids};三层门禁在后端,失败抛 BusinessError)。
|
||||
* D8 异步契约:后端只做门禁+建 Run+建单+入队,返回 202 envelope,
|
||||
* data = { run_no, status: 'queued' };202 在 requestJson 内按 2xx 与 200 同口径透传,
|
||||
* 本层零特判。进度/结果由 getTransferRun 轮询获取(D9 调拨单清单)。
|
||||
*/
|
||||
export const executeTransferItems = (itemIds: number[]) =>
|
||||
requestJson<TransferExecuteResponse>(`${BASE}/items/execute`, {
|
||||
method: 'POST',
|
||||
headers: jsonHeaders(),
|
||||
body: JSON.stringify({ invoice_nos: invoiceNos }),
|
||||
body: JSON.stringify({ item_ids: itemIds }),
|
||||
});
|
||||
|
||||
/** 恢复 Run 最终结果 */
|
||||
/**
|
||||
* 恢复 Run 结果与调拨单清单(D9 融合卡数据源:调拨单清单=进度=结果)。
|
||||
* 返回体 = result(单号聚合 + exceptions 既有口径)+ orders(TransferOrder[] 逐键,
|
||||
* 对应后端 serialize_run_orders);终态 Run 亦同口径投影,供刷新/重进页面恢复。
|
||||
*/
|
||||
export const getTransferRun = (runNo: string) =>
|
||||
requestJson<TransferRunResult>(`${BASE}/runs/${runNo}`, {
|
||||
headers: getAuthHeaders(),
|
||||
});
|
||||
|
||||
/**
|
||||
* 人工重新触发 result_unknown 单(D11 SOP 唯一出口,202 异步)。
|
||||
* 契约(计划 Task 10):POST /runs/{run_no}/documents/{doc_no}/retrigger → 202,
|
||||
* data = { run_no, doc_no, status: 'queued' };复用原单 doc_no/submit_timestamp,
|
||||
* 只触发末步(幂等,不重插)。非 result_unknown 单 → 400(TRANSFER.RETRIGGER_NOT_ALLOWED)。
|
||||
*/
|
||||
export const retriggerTransferDocument = (runNo: string, docNo: string) =>
|
||||
requestJson<{ run_no: string; doc_no: string; status: string }>(
|
||||
`${BASE}/runs/${encodeURIComponent(runNo)}/documents/${encodeURIComponent(docNo)}/retrigger`,
|
||||
{ method: 'POST', headers: jsonHeaders() },
|
||||
);
|
||||
|
||||
/**
|
||||
* 人工关闭失败单(D18:语义=A 废单不废行;契约取自计划 Task 17)。
|
||||
* POST /documents/{doc_no}/close,body { reason }(必填);仅 business_failed/
|
||||
* technical_failed 可关——单 cancelled、单内行脱离回 ready_to_execute(可重组新单);
|
||||
* result_unknown → 400(提示走重新触发,D11);pending/executing → 400(在飞)。
|
||||
*/
|
||||
export const closeTransferDocument = (docNo: string, reason: string) =>
|
||||
requestJson<TransferActionResult>(`${BASE}/documents/${encodeURIComponent(docNo)}/close`, {
|
||||
method: 'POST',
|
||||
headers: jsonHeaders(),
|
||||
body: JSON.stringify({ reason }),
|
||||
});
|
||||
|
||||
/**
|
||||
* 调拨单级重试(失败单一键恢复主路径):POST /documents/{doc_no}/retry。
|
||||
* 后端按单圈行逐行重查;全部 ready 自动建新 Run 重跑(复用原单号),
|
||||
* 任一行仍阻断则不重跑,返回 {doc_no, rerun, run_no, ready, blocked, total}。
|
||||
*/
|
||||
export const retryTransferOrder = (docNo: string) =>
|
||||
requestJson<TransferDocumentRetryResult>(`${BASE}/documents/${encodeURIComponent(docNo)}/retry`, {
|
||||
method: 'POST',
|
||||
headers: jsonHeaders(),
|
||||
});
|
||||
|
||||
/**
|
||||
* 已执行单分页查询(首页「已执行」区块数据源;计划 Task 17)。
|
||||
* GET /documents?status_group=&date_from=&date_to=&page=&page_size=;
|
||||
* 返回体 groups(计数恒全量,不受筛选影响)+ orders(TransferExecutedOrder 逐键)。
|
||||
* 缺省参数不下发(后端按缺省口径:全部分组、不限时间、page=1、page_size=20)。
|
||||
*/
|
||||
export const fetchExecutedOrders = (params: {
|
||||
statusGroup?: string;
|
||||
dateFrom?: string;
|
||||
dateTo?: string;
|
||||
page?: number;
|
||||
pageSize?: number;
|
||||
}) => {
|
||||
const query = new URLSearchParams();
|
||||
if (params.statusGroup) query.set('status_group', params.statusGroup);
|
||||
if (params.dateFrom) query.set('date_from', params.dateFrom);
|
||||
if (params.dateTo) query.set('date_to', params.dateTo);
|
||||
if (params.page != null) query.set('page', String(params.page));
|
||||
if (params.pageSize != null) query.set('page_size', String(params.pageSize));
|
||||
const qs = query.toString();
|
||||
return requestJson<TransferExecutedOrdersPage>(`${BASE}/documents${qs ? `?${qs}` : ''}`, {
|
||||
headers: getAuthHeaders(),
|
||||
});
|
||||
};
|
||||
|
||||
/** 请求停止剩余任务 */
|
||||
export const cancelTransferRun = (runNo: string, reason: string) =>
|
||||
requestJson<TransferActionResult>(`${BASE}/runs/${runNo}/cancel`, {
|
||||
@@ -89,7 +170,7 @@ export const manualCloseTransferItem = (itemId: number, reason: string) =>
|
||||
export const downloadTransferReceiptFiles = (runNo: string) =>
|
||||
requestBlob(`${BASE}/runs/${runNo}/receipt-files`, { headers: getAuthHeaders() });
|
||||
|
||||
/** 下载预检冻结的 ERP 库存表(csv) */
|
||||
/** 下载匹配冻结的 ERP 库存表(csv) */
|
||||
export const downloadTransferErpInventory = (runNo: string) =>
|
||||
requestBlob(`${BASE}/runs/${runNo}/external-inventory`, { headers: getAuthHeaders() });
|
||||
|
||||
@@ -97,10 +178,26 @@ export const downloadTransferErpInventory = (runNo: string) =>
|
||||
export const downloadTransferExceptions = (runNo: string) =>
|
||||
requestBlob(`${BASE}/runs/${runNo}/exceptions.xlsx`, { headers: getAuthHeaders() });
|
||||
|
||||
/** 批量重查库存(待处理池多选;单行隔离,按明细 id 直取;恢复处理=重查的唯一后端) */
|
||||
export const batchRequeryTransferItems = (itemIds: number[]) =>
|
||||
requestJson<TransferBatchResult>(`${BASE}/items/batch-requery`, {
|
||||
method: 'POST',
|
||||
headers: jsonHeaders(),
|
||||
body: JSON.stringify({ item_ids: itemIds }),
|
||||
});
|
||||
|
||||
/** 批量人工关闭异常项(原因整批共用;单行隔离) */
|
||||
export const batchManualCloseTransferItems = (itemIds: number[], reason: string) =>
|
||||
requestJson<TransferBatchResult>(`${BASE}/items/batch-manual-close`, {
|
||||
method: 'POST',
|
||||
headers: jsonHeaders(),
|
||||
body: JSON.stringify({ item_ids: itemIds, reason }),
|
||||
});
|
||||
|
||||
/** 批量重查 ERP 库存(可恢复阻断行;invoice_nos 缺省 = 全部阻断行) */
|
||||
export const requeryTransferItems = (precheckNo: string, invoiceNos?: string[]) =>
|
||||
requestJson<{ precheck_no: string; total: number; results: Array<Record<string, unknown>> }>(
|
||||
`${BASE}/prechecks/${precheckNo}/items/requery`,
|
||||
export const requeryTransferMatchingItems = (matchingNo: string, invoiceNos?: string[]) =>
|
||||
requestJson<{ matching_no: string; total: number; results: Array<Record<string, unknown>> }>(
|
||||
`${BASE}/matchings/${matchingNo}/items/requery`,
|
||||
{ method: 'POST', body: JSON.stringify(invoiceNos ? { invoice_nos: invoiceNos } : {}), headers: { ...getAuthHeaders(), 'Content-Type': 'application/json' } },
|
||||
);
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
* 依赖:ChatSidebar、ChatMessageList、ChatInputBar、ShippingWorkflowTimeline、ContractPaymentChatPanel、VoucherCheckChatPanel、chunkLoadRecovery、chat.context。
|
||||
|
||||
* 逻辑:本文件只做页面结构编排;货代 Chat 仅上传/进度通知,履约写操作不在本页;
|
||||
* 货代会话主区域:有会话即全屏批次进度中心(常驻),无会话为欢迎页+输入框;会话标题取自侧栏历史并传给中心;
|
||||
* 右侧「本次处理」由 conversationId 驱动 Workflow projection,extractionRunNo 仅作进度装饰;
|
||||
* 订单复核工作台异步分包,避免普通对话首屏拉取 PDF.js;合同付款预警、立账凭证 Agent 用 Tab 作业面替换消息列表与输入框;
|
||||
* 货代会话主区域:有会话即全屏批次进度中心(常驻),无会话为欢迎页+输入框,会话标题取自侧栏历史并传给中心。
|
||||
* 订单复核工作台异步分包,避免普通对话首屏拉取 PDF.js;合同付款预警、立账凭证 Agent 用 Tab 作业面替换消息列表与输入框。
|
||||
|
||||
*/
|
||||
|
||||
|
||||
@@ -99,11 +99,11 @@ const RESTRICTED_INLINE_DOWNLOAD_FILE_NAME = '资产明细全量导出表.csv';
|
||||
const isContractReviewMessage = computed(() => message.type === 'procurement-contract-review');
|
||||
const isTransferMessage = computed(
|
||||
() =>
|
||||
message.type === 'transfer-precheck'
|
||||
message.type === 'transfer-match'
|
||||
|| message.type === 'transfer-progress'
|
||||
|| message.type === 'transfer-result',
|
||||
);
|
||||
/** 调拨消息带宽表格(预检明细 10+ 列),放宽气泡宽度上限避免横向挤压成局部布局。 */
|
||||
/** 调拨消息带宽表格(匹配明细 10+ 列),放宽气泡宽度上限避免横向挤压成局部布局。 */
|
||||
const wideMessage = computed(() => isTransferMessage.value || isContractReviewMessage.value);
|
||||
|
||||
const isLeaveMessage = computed(() =>
|
||||
|
||||
@@ -1,22 +1,103 @@
|
||||
<!--
|
||||
features/chat/components/messages/TransferBacklogSummaryCard.vue
|
||||
用途:待处理异常卡(可恢复/已关闭/结果未知三组)+ 人工重试/人工关闭入口。
|
||||
依赖:props.items、i18n chat.transfer.*。
|
||||
逻辑:result_unknown 只读(无重试/关闭按钮);人工关闭由父组件弹窗处理。
|
||||
用途:待处理异常卡(可恢复/已关闭/结果未知三组)——列与匹配窗口一致,
|
||||
支持关键字/结果筛选、多选批量操作(重查/恢复处理/标记无需处理)与行级快捷操作。
|
||||
依赖:props.items、i18n chat.transfer.*、transferBatch.deriveBatchNo。
|
||||
逻辑:仅 blocked_recoverable 可勾选与操作;result_unknown / manually_closed 只读;
|
||||
可恢复行按 result_code 细分徽标(blocked_file_removed=文件已移除);
|
||||
blocked_file_removed 行行内仅留「标记无需继续处理」(重查不可恢复——消失证据
|
||||
无法由重查翻回,唯一出口=人工关闭或等文件重新同步);
|
||||
勾选集合为卡片本地态,操作经 emit 交父组件调用批量端点并刷新。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import { deriveBatchNo } from './transferBatch';
|
||||
import type { TransferBacklogItem } from '../../types/transfer.types';
|
||||
|
||||
defineProps<{
|
||||
const props = defineProps<{
|
||||
items: TransferBacklogItem[];
|
||||
busy?: boolean;
|
||||
/** 初始结果筛选(首页计数卡切片进入:closed 卡落「已关闭」切片等)。 */
|
||||
initialFilter?: 'all' | 'recoverable' | 'closed' | 'unknown';
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
retry: [itemId: number];
|
||||
close: [item: TransferBacklogItem];
|
||||
refresh: [];
|
||||
retry: [itemId: number];
|
||||
resume: [itemIds: number[]];
|
||||
requery: [itemIds: number[]];
|
||||
close: [item: TransferBacklogItem];
|
||||
batchClose: [itemIds: number[]];
|
||||
}>();
|
||||
|
||||
/** 勾选集合(本地视图态;仅可恢复行可勾选)。 */
|
||||
const selectedIds = ref<Set<number>>(new Set());
|
||||
const keyword = ref('');
|
||||
const resultFilter = ref<'all' | 'recoverable' | 'closed' | 'unknown'>(props.initialFilter ?? 'all');
|
||||
|
||||
function isActionable(item: TransferBacklogItem): boolean {
|
||||
return item.status === 'blocked_recoverable';
|
||||
}
|
||||
|
||||
/**
|
||||
* 失效行(文件已移除)判定:行内只留「标记无需继续处理」出口。
|
||||
* @param item 待处理池行;result_code=blocked_file_removed 为失效行
|
||||
*/
|
||||
function isFileRemoved(item: TransferBacklogItem): boolean {
|
||||
return item.result_code === 'blocked_file_removed';
|
||||
}
|
||||
|
||||
const filtered = computed(() =>
|
||||
props.items.filter((item) => {
|
||||
const kw = keyword.value.trim().toLowerCase();
|
||||
if (kw) {
|
||||
const haystack = [item.invoice_no, item.material_no, item.material_name, item.source_code]
|
||||
.map((value) => String(value ?? '').toLowerCase());
|
||||
if (!haystack.some((value) => value.includes(kw))) return false;
|
||||
}
|
||||
if (resultFilter.value === 'recoverable' && item.status !== 'blocked_recoverable') return false;
|
||||
if (resultFilter.value === 'closed' && item.status !== 'manually_closed') return false;
|
||||
if (resultFilter.value === 'unknown' && item.status !== 'result_unknown') return false;
|
||||
return true;
|
||||
}),
|
||||
);
|
||||
|
||||
const selectedActionableIds = computed(() =>
|
||||
filtered.value.filter((item) => isActionable(item) && selectedIds.value.has(item.item_id)).map((item) => item.item_id),
|
||||
);
|
||||
|
||||
const allFilteredSelected = computed(() => {
|
||||
const actionable = filtered.value.filter(isActionable);
|
||||
return actionable.length > 0 && actionable.every((item) => selectedIds.value.has(item.item_id));
|
||||
});
|
||||
|
||||
function toggleRow(item: TransferBacklogItem, checked: boolean) {
|
||||
const next = new Set(selectedIds.value);
|
||||
if (checked) next.add(item.item_id);
|
||||
else next.delete(item.item_id);
|
||||
selectedIds.value = next;
|
||||
}
|
||||
|
||||
function toggleAll(checked: boolean) {
|
||||
const next = new Set(selectedIds.value);
|
||||
for (const item of filtered.value.filter(isActionable)) {
|
||||
if (checked) next.add(item.item_id);
|
||||
else next.delete(item.item_id);
|
||||
}
|
||||
selectedIds.value = next;
|
||||
}
|
||||
|
||||
function clearSelection() {
|
||||
selectedIds.value = new Set();
|
||||
}
|
||||
|
||||
/** 行操作后/刷新后清理已消失行的勾选残留。 */
|
||||
function pruneSelection() {
|
||||
const alive = new Set(props.items.map((item) => item.item_id));
|
||||
selectedIds.value = new Set([...selectedIds.value].filter((id) => alive.has(id)));
|
||||
}
|
||||
defineExpose({ pruneSelection });
|
||||
|
||||
function agingLabel(level: string): string {
|
||||
const map: Record<string, string> = {
|
||||
warn_3d: 'chat.transfer.agingWarn',
|
||||
@@ -27,6 +108,19 @@ function agingLabel(level: string): string {
|
||||
};
|
||||
return map[level] ?? 'chat.transfer.agingNormal';
|
||||
}
|
||||
|
||||
function rowKey(item: TransferBacklogItem): string {
|
||||
return `${item.item_id}|${item.invoice_no}`;
|
||||
}
|
||||
|
||||
/** 结果徽标文案键:可恢复行按 result_code 细分(blocked_file_removed=文件已移除),其余按状态。 */
|
||||
function resultLabelKey(item: TransferBacklogItem): string {
|
||||
if (item.status === 'result_unknown') return 'chat.transfer.resultUnknown';
|
||||
if (item.status === 'manually_closed') return 'chat.transfer.statusClosed';
|
||||
return item.result_code === 'blocked_file_removed'
|
||||
? 'chat.transfer.resultFileRemoved'
|
||||
: 'chat.transfer.resultBlocked';
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -42,47 +136,181 @@ function agingLabel(level: string): string {
|
||||
{{ $t('chat.transfer.refreshProgress') }}
|
||||
</button>
|
||||
</div>
|
||||
<ul v-if="items.length" class="flex flex-col gap-1.5">
|
||||
<li
|
||||
v-for="item in items"
|
||||
:key="item.item_id"
|
||||
class="flex items-center justify-between gap-2 rounded-lg border border-subtle px-3 py-2 text-xs"
|
||||
:data-testid="`transfer-backlog-${item.invoice_no}`"
|
||||
|
||||
<!-- 批量操作条:勾选 ≥1 行时原位替换筛选区 -->
|
||||
<div v-if="selectedActionableIds.length" class="mb-2 flex flex-wrap items-center gap-2">
|
||||
<span class="text-xs font-bold text-secondary" data-testid="transfer-backlog-selected-count">
|
||||
{{ $t('chat.transfer.selectedRows', { count: selectedActionableIds.length }) }}
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-brand-200 bg-brand-50 px-3 py-1 text-xs font-bold text-brand-700 transition hover:bg-brand-100 disabled:cursor-not-allowed disabled:opacity-40"
|
||||
data-testid="transfer-backlog-batch-requery"
|
||||
:disabled="busy"
|
||||
@click="emit('requery', selectedActionableIds)"
|
||||
>
|
||||
<div class="min-w-0">
|
||||
<div class="font-semibold text-secondary">
|
||||
{{ item.invoice_no }}
|
||||
<span class="ml-1 text-muted">{{ item.source_code }}</span>
|
||||
</div>
|
||||
<div class="text-[11px] text-muted">
|
||||
{{ item.reason }} · {{ $t(agingLabel(item.aging_level)) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex shrink-0 gap-1.5">
|
||||
<template v-if="item.status === 'blocked_recoverable'">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-brand-200 px-2 py-1 font-bold text-brand-700 hover:bg-brand-50"
|
||||
data-testid="transfer-backlog-retry"
|
||||
@click="emit('retry', item.item_id)"
|
||||
>
|
||||
{{ $t('chat.transfer.retryErp') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-red-200 px-2 py-1 font-bold text-red-600 hover:bg-red-50"
|
||||
data-testid="transfer-backlog-close"
|
||||
@click="emit('close', item)"
|
||||
>
|
||||
{{ $t('chat.transfer.manualClose') }}
|
||||
</button>
|
||||
</template>
|
||||
<span v-else-if="item.status === 'result_unknown'" class="text-[11px] text-muted">
|
||||
{{ $t('chat.transfer.resultUnknownReadonly') }}
|
||||
</span>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
{{ $t('chat.transfer.requeryRow') }}({{ selectedActionableIds.length }})
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-brand-200 bg-brand-50 px-3 py-1 text-xs font-bold text-brand-700 transition hover:bg-brand-100 disabled:cursor-not-allowed disabled:opacity-40"
|
||||
data-testid="transfer-backlog-batch-resume"
|
||||
:disabled="busy"
|
||||
@click="emit('resume', selectedActionableIds)"
|
||||
>
|
||||
{{ $t('chat.transfer.resumeAction') }}({{ selectedActionableIds.length }})
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-red-200 bg-red-50 px-3 py-1 text-xs font-bold text-red-600 transition hover:bg-red-100 disabled:cursor-not-allowed disabled:opacity-40"
|
||||
data-testid="transfer-backlog-batch-close"
|
||||
:disabled="busy"
|
||||
@click="emit('batchClose', selectedActionableIds)"
|
||||
>
|
||||
{{ $t('chat.transfer.manualClose') }}({{ selectedActionableIds.length }})
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-default px-2 py-1 text-xs text-secondary hover-surface-soft"
|
||||
data-testid="transfer-backlog-clear-selection"
|
||||
@click="clearSelection"
|
||||
>
|
||||
{{ $t('chat.transfer.clearSelection') }}
|
||||
</button>
|
||||
</div>
|
||||
<div v-else class="mb-2 flex flex-wrap items-center gap-2">
|
||||
<input
|
||||
v-model="keyword"
|
||||
type="text"
|
||||
class="w-56 rounded-lg border border-default bg-surface px-2 py-1 text-xs text-primary"
|
||||
:placeholder="$t('chat.transfer.filterPlaceholder')"
|
||||
data-testid="transfer-backlog-filter"
|
||||
/>
|
||||
<select
|
||||
v-model="resultFilter"
|
||||
class="rounded-lg border border-default bg-surface px-2 py-1 text-xs text-primary"
|
||||
data-testid="transfer-backlog-result-filter"
|
||||
>
|
||||
<option value="all">{{ $t('chat.transfer.filterAll') }}</option>
|
||||
<option value="recoverable">{{ $t('chat.transfer.homeRecoverable') }}</option>
|
||||
<option value="closed">{{ $t('chat.transfer.homeClosed') }}</option>
|
||||
<option value="unknown">{{ $t('chat.transfer.homeUnknown') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div v-if="filtered.length" class="overflow-x-auto">
|
||||
<table class="w-full min-w-[1180px] text-xs" data-testid="transfer-backlog-table">
|
||||
<thead>
|
||||
<tr class="border-b border-default bg-surface-soft text-left text-[11px] text-muted">
|
||||
<th class="p-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="allFilteredSelected"
|
||||
data-testid="transfer-backlog-select-all"
|
||||
@change="toggleAll(($event.target as HTMLInputElement).checked)"
|
||||
/>
|
||||
</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colSource') }}</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colInvoice') }}</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colReceiptDate') }}</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colMaterial') }}</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colName') }}</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colFromWarehouse') }}</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colFromBatch') }}</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colFromQty') }}</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colToWarehouse') }}</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colToQty') }}</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colResult') }}</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colAging') }}</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colAction') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="item in filtered"
|
||||
:key="rowKey(item)"
|
||||
class="border-b border-subtle"
|
||||
:class="{ 'bg-surface-soft text-muted': !isActionable(item) }"
|
||||
:data-testid="`transfer-backlog-${item.invoice_no}`"
|
||||
>
|
||||
<td class="p-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="selectedIds.has(item.item_id)"
|
||||
:disabled="!isActionable(item) || busy"
|
||||
:data-testid="`transfer-backlog-check-${item.invoice_no}`"
|
||||
@change="toggleRow(item, ($event.target as HTMLInputElement).checked)"
|
||||
/>
|
||||
</td>
|
||||
<td class="p-2">{{ item.source_code }}</td>
|
||||
<td class="p-2 font-semibold">{{ item.invoice_no }}</td>
|
||||
<td class="p-2">{{ item.receipt_date || '—' }}</td>
|
||||
<td class="p-2">{{ item.material_no }}</td>
|
||||
<td class="p-2">{{ item.material_name || '—' }}</td>
|
||||
<td class="p-2">{{ item.from_warehouse || '—' }}</td>
|
||||
<td class="p-2">{{ deriveBatchNo(item.lot_no ?? '') || '—' }}</td>
|
||||
<td class="p-2">{{ item.external_quantity ?? '—' }}</td>
|
||||
<td class="p-2">{{ item.to_warehouse || '—' }}</td>
|
||||
<td class="p-2">{{ item.receipt_quantity ?? '—' }}</td>
|
||||
<td class="p-2">
|
||||
<span
|
||||
class="rounded-full px-2 py-0.5 font-bold"
|
||||
:class="{
|
||||
'bg-red-50 text-red-700': item.status === 'blocked_recoverable',
|
||||
'bg-amber-50 text-amber-700': item.status === 'result_unknown',
|
||||
'bg-surface-soft text-muted': item.status === 'manually_closed',
|
||||
}"
|
||||
:title="item.reason || undefined"
|
||||
data-testid="transfer-backlog-result"
|
||||
>
|
||||
{{
|
||||
$t(resultLabelKey(item))
|
||||
}}
|
||||
</span>
|
||||
</td>
|
||||
<td class="p-2">{{ $t(agingLabel(item.aging_level)) }}</td>
|
||||
<td class="p-2">
|
||||
<template v-if="isActionable(item)">
|
||||
<!-- 失效行(文件已移除)隐藏重查/恢复处理:重查会被后端拒绝
|
||||
(TRANSFER.RETRY_NOT_ALLOWED),恢复处理也无济于事,只留关闭出口 -->
|
||||
<button
|
||||
v-if="!isFileRemoved(item)"
|
||||
type="button"
|
||||
class="mr-1 rounded border border-brand-200 px-1 py-0.5 text-[10px] font-bold text-brand-700 transition hover:bg-brand-50 disabled:opacity-40"
|
||||
:data-testid="`transfer-backlog-requery-${item.invoice_no}`"
|
||||
:disabled="busy"
|
||||
@click="emit('retry', item.item_id)"
|
||||
>
|
||||
{{ $t('chat.transfer.requeryRow') }}
|
||||
</button>
|
||||
<button
|
||||
v-if="!isFileRemoved(item)"
|
||||
type="button"
|
||||
class="mr-1 rounded border border-brand-200 px-1 py-0.5 text-[10px] font-bold text-brand-700 transition hover:bg-brand-50 disabled:opacity-40"
|
||||
:data-testid="`transfer-backlog-resume-${item.invoice_no}`"
|
||||
:disabled="busy"
|
||||
@click="emit('resume', [item.item_id])"
|
||||
>
|
||||
{{ $t('chat.transfer.resumeAction') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded border border-red-200 px-1 py-0.5 text-[10px] font-bold text-red-600 transition hover:bg-red-50 disabled:opacity-40"
|
||||
:data-testid="`transfer-backlog-close-${item.invoice_no}`"
|
||||
:disabled="busy"
|
||||
@click="emit('close', item)"
|
||||
>
|
||||
{{ $t('chat.transfer.manualClose') }}
|
||||
</button>
|
||||
</template>
|
||||
<span v-else-if="item.status === 'result_unknown'" class="text-[11px] text-muted">
|
||||
{{ $t('chat.transfer.resultUnknownReadonly') }}
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div v-else class="rounded-lg bg-surface-soft p-3 text-xs text-muted">
|
||||
{{ $t('chat.transfer.noBacklog') }}
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,212 @@
|
||||
<!--
|
||||
features/chat/components/messages/TransferExecutableCard.vue
|
||||
用途:可调拨明细卡——全局可执行行队列(跨匹配范围):勾选明细行后按行生成调拨单。
|
||||
依赖:props.items、i18n chat.transfer.*、transferBatch.deriveBatchNo。
|
||||
逻辑:行由后端按业务稳定键排序(收料日期→Invoice→创建时间);勾选为卡片本地态;
|
||||
stale/file_current 行置灰提示(执行门禁在后端,失败经 BusinessError 展示);
|
||||
无 item_id 的历史回放行禁选。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import { deriveBatchNo } from './transferBatch';
|
||||
import type { TransferMatchingItem } from '../../types/transfer.types';
|
||||
|
||||
const props = defineProps<{
|
||||
items: TransferMatchingItem[];
|
||||
busy?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
refresh: [];
|
||||
execute: [itemIds: number[]];
|
||||
requery: [itemIds: number[]];
|
||||
}>();
|
||||
|
||||
/** 勾选集合(本地视图态,按明细行 item_id)。 */
|
||||
const selectedIds = ref<Set<number>>(new Set());
|
||||
const keyword = ref('');
|
||||
|
||||
const filtered = computed(() =>
|
||||
props.items.filter((item) => {
|
||||
const kw = keyword.value.trim().toLowerCase();
|
||||
if (!kw) return true;
|
||||
const haystack = [item.invoice_no, item.material_no, item.material_name, item.source_code, item.lot_no]
|
||||
.map((value) => String(value ?? '').toLowerCase());
|
||||
return haystack.some((value) => value.includes(kw));
|
||||
}),
|
||||
);
|
||||
|
||||
const checked = computed(() =>
|
||||
filtered.value.filter((item) => item.item_id != null && selectedIds.value.has(item.item_id)),
|
||||
);
|
||||
|
||||
const allFilteredSelected = computed(() =>
|
||||
filtered.value.length > 0 && filtered.value.every((item) => item.item_id != null && selectedIds.value.has(item.item_id)),
|
||||
);
|
||||
|
||||
function toggleRow(item: TransferMatchingItem, checkedBox: boolean) {
|
||||
if (item.item_id == null) return;
|
||||
const next = new Set(selectedIds.value);
|
||||
if (checkedBox) next.add(item.item_id);
|
||||
else next.delete(item.item_id);
|
||||
selectedIds.value = next;
|
||||
}
|
||||
|
||||
function toggleAll(checkedBox: boolean) {
|
||||
const next = new Set(selectedIds.value);
|
||||
for (const item of filtered.value) {
|
||||
if (item.item_id == null) continue;
|
||||
if (checkedBox) next.add(item.item_id);
|
||||
else next.delete(item.item_id);
|
||||
}
|
||||
selectedIds.value = next;
|
||||
}
|
||||
|
||||
function clearSelection() {
|
||||
selectedIds.value = new Set();
|
||||
}
|
||||
|
||||
function rowKey(item: TransferMatchingItem): string {
|
||||
return `${item.item_id ?? 'na'}|${item.invoice_no}`;
|
||||
}
|
||||
|
||||
/** 查询时刻展示(HH:mm);无 checked_at 不渲染。 */
|
||||
function checkedTime(item: TransferMatchingItem): string {
|
||||
if (!item.checked_at) return '';
|
||||
const date = new Date(item.checked_at);
|
||||
return Number.isNaN(date.getTime()) ? '' : date.toTimeString().slice(0, 5);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="my-2 rounded-2xl border border-brand-100 bg-surface p-4 shadow-sm" data-testid="transfer-executable-card">
|
||||
<div class="mb-2 flex items-center justify-between">
|
||||
<h3 class="text-sm font-bold text-primary">{{ $t('chat.transfer.executableTitle') }}</h3>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-default px-2 py-1 text-xs text-secondary hover-surface-soft"
|
||||
data-testid="transfer-executable-refresh"
|
||||
@click="emit('refresh')"
|
||||
>
|
||||
{{ $t('chat.transfer.refreshProgress') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="mb-2 flex flex-wrap items-center gap-2">
|
||||
<input
|
||||
v-model="keyword"
|
||||
type="text"
|
||||
class="w-56 rounded-lg border border-default bg-surface px-2 py-1 text-xs text-primary"
|
||||
:placeholder="$t('chat.transfer.filterPlaceholder')"
|
||||
data-testid="transfer-executable-filter"
|
||||
/>
|
||||
<span v-if="checked.length" class="text-xs font-bold text-secondary" data-testid="transfer-executable-selected-count">
|
||||
{{ $t('chat.transfer.selectedRows', { count: checked.length }) }}
|
||||
</span>
|
||||
<button
|
||||
v-if="checked.length"
|
||||
type="button"
|
||||
class="rounded-lg border border-default px-2 py-1 text-xs text-secondary hover-surface-soft"
|
||||
data-testid="transfer-executable-clear-selection"
|
||||
@click="clearSelection"
|
||||
>
|
||||
{{ $t('chat.transfer.clearSelection') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-if="filtered.length" class="overflow-x-auto">
|
||||
<table class="w-full min-w-[1100px] text-xs" data-testid="transfer-executable-table">
|
||||
<thead>
|
||||
<tr class="border-b border-default bg-surface-soft text-left text-[11px] text-muted">
|
||||
<th class="p-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="allFilteredSelected"
|
||||
data-testid="transfer-executable-select-all"
|
||||
@change="toggleAll(($event.target as HTMLInputElement).checked)"
|
||||
/>
|
||||
</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colSource') }}</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colInvoice') }}</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colReceiptDate') }}</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colMaterial') }}</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colName') }}</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colFromWarehouse') }}</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colFromBatch') }}</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colFromQty') }}</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colToWarehouse') }}</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colToQty') }}</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colResult') }}</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colAction') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="item in filtered"
|
||||
:key="rowKey(item)"
|
||||
class="border-b border-subtle"
|
||||
:class="{ 'bg-surface-soft text-muted': item.stale || item.file_current === false }"
|
||||
:data-testid="`transfer-executable-${item.invoice_no}`"
|
||||
>
|
||||
<td class="p-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="item.item_id != null && selectedIds.has(item.item_id)"
|
||||
:disabled="item.item_id == null || busy"
|
||||
:data-testid="`transfer-executable-check-${item.invoice_no}`"
|
||||
@change="toggleRow(item, ($event.target as HTMLInputElement).checked)"
|
||||
/>
|
||||
</td>
|
||||
<td class="p-2">{{ item.source_code }}</td>
|
||||
<td class="p-2 font-semibold">{{ item.invoice_no }}</td>
|
||||
<td class="p-2">{{ item.receipt_date || '—' }}</td>
|
||||
<td class="p-2">{{ item.material_no }}</td>
|
||||
<td class="p-2">{{ item.material_name }}</td>
|
||||
<td class="p-2">{{ item.from_warehouse }}</td>
|
||||
<td class="p-2">{{ deriveBatchNo(item.lot_no ?? '') || '—' }}</td>
|
||||
<td class="p-2">
|
||||
{{ item.from_quantity ?? '—' }}
|
||||
<div v-if="checkedTime(item)" class="text-[10px] text-muted">{{ checkedTime(item) }}</div>
|
||||
</td>
|
||||
<td class="p-2">{{ item.to_warehouse }}</td>
|
||||
<td class="p-2">{{ item.to_quantity }}</td>
|
||||
<td class="p-2">
|
||||
<span class="rounded-full bg-emerald-50 px-2 py-0.5 font-bold text-emerald-700" data-testid="transfer-executable-result">
|
||||
{{ $t('chat.transfer.resultExecutable') }}
|
||||
</span>
|
||||
<div v-if="item.stale" class="mt-0.5 text-[10px] text-amber-600">{{ $t('chat.transfer.staleRow') }}</div>
|
||||
<div v-else-if="item.file_current === false" class="mt-0.5 text-[10px] text-amber-600">{{ $t('chat.transfer.fileChangedRow') }}</div>
|
||||
</td>
|
||||
<td class="p-2">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded border border-brand-200 px-1 py-0.5 text-[10px] font-bold text-brand-700 transition hover:bg-brand-50 disabled:opacity-40"
|
||||
:data-testid="`transfer-executable-requery-${item.invoice_no}`"
|
||||
:disabled="busy || item.item_id == null"
|
||||
@click="item.item_id != null && emit('requery', [item.item_id])"
|
||||
>
|
||||
{{ $t('chat.transfer.requeryRow') }}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div v-else class="rounded-lg bg-surface-soft p-3 text-xs text-muted" data-testid="transfer-executable-empty">
|
||||
{{ $t('chat.transfer.executableEmpty') }}
|
||||
</div>
|
||||
|
||||
<div class="mt-3 flex items-center justify-end gap-3 border-t border-subtle pt-3">
|
||||
<span class="text-xs text-muted">{{ $t('chat.transfer.executableSelectedCount', { count: checked.length }) }}</span>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg bg-brand-600 px-4 py-1.5 text-sm font-bold text-white hover:bg-brand-700 disabled:cursor-not-allowed disabled:opacity-40"
|
||||
:disabled="busy || checked.length === 0"
|
||||
data-testid="transfer-executable-generate"
|
||||
@click="emit('execute', checked.map((item) => item.item_id as number))"
|
||||
>
|
||||
{{ $t('chat.transfer.generateTransfer') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* features/chat/components/messages/TransferExecutedCards.spec.ts
|
||||
* 用途:验证已执行统计卡片入口——四卡渲染(计数对齐分组)/ 点击 emit open(group)。
|
||||
* 依赖:vi.mock(transfer.api)、@vue/test-utils、i18n。
|
||||
*/
|
||||
import { mount, flushPromises } from '@vue/test-utils';
|
||||
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
||||
import i18n from '@/i18n';
|
||||
|
||||
const api = vi.hoisted(() => ({ fetchExecutedOrders: vi.fn() }));
|
||||
vi.mock('@/features/chat/api/transfer.api', () => api);
|
||||
|
||||
import TransferExecutedCards from './TransferExecutedCards.vue';
|
||||
|
||||
const GROUPS = { success: 3, failed: 2, executing: 1, result_unknown: 1 };
|
||||
|
||||
function mountCards() {
|
||||
return mount(TransferExecutedCards, { global: { plugins: [i18n] } });
|
||||
}
|
||||
|
||||
describe('TransferExecutedCards 已执行统计卡片入口', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
api.fetchExecutedOrders.mockResolvedValue({
|
||||
groups: GROUPS, orders: [], total: 0, page: 1, page_size: 1,
|
||||
});
|
||||
});
|
||||
|
||||
it('挂载拉取分组计数(pageSize=1)并渲染四张卡片,数字对齐分组', async () => {
|
||||
const wrapper = mountCards();
|
||||
await flushPromises();
|
||||
// [断言意图] 只为取分组计数,列表不消费(pageSize=1 最小请求)。
|
||||
expect(api.fetchExecutedOrders).toHaveBeenCalledWith(expect.objectContaining({ page: 1, pageSize: 1 }));
|
||||
for (const key of ['success', 'failed', 'executing', 'resultUnknown']) {
|
||||
expect(wrapper.find(`[data-testid="transfer-executed-card-${key}"]`).exists()).toBe(true);
|
||||
}
|
||||
// [断言意图] 数字对齐分组计数(恒全量口径)。
|
||||
expect(wrapper.find('[data-testid="transfer-executed-card-success"]').text()).toContain('3');
|
||||
expect(wrapper.find('[data-testid="transfer-executed-card-failed"]').text()).toContain('2');
|
||||
});
|
||||
|
||||
it('卡片点击 emit open(group)', async () => {
|
||||
const wrapper = mountCards();
|
||||
await flushPromises();
|
||||
await wrapper.find('[data-testid="transfer-executed-card-failed"]').trigger('click');
|
||||
// [断言意图] 卡片=入口:只 emit,不做任何路由/加载。
|
||||
expect(wrapper.emitted('open')).toEqual([['failed']]);
|
||||
await wrapper.find('[data-testid="transfer-executed-card-resultUnknown"]').trigger('click');
|
||||
expect(wrapper.emitted('open')![1]).toEqual(['result_unknown']);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,62 @@
|
||||
<!--
|
||||
features/chat/components/messages/TransferExecutedCards.vue
|
||||
|
||||
用途:首页「已执行调拨单」统计卡片入口——四张数字卡片(风格对齐待办看板),
|
||||
点击 emit('open', group) 由首页面板跳转明细列表子视图。
|
||||
依赖:fetchExecutedOrders(transfer.api)、vue-i18n。
|
||||
逻辑:挂载拉取分组计数(pageSize=1,列表不消费);计数恒全量由后端保证;
|
||||
纯入口组件,不含列表/动作。
|
||||
-->
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { fetchExecutedOrders } from '@/features/chat/api/transfer.api';
|
||||
|
||||
type TransferOrderGroups = Record<'success' | 'failed' | 'executing' | 'result_unknown', number>;
|
||||
|
||||
const emit = defineEmits<{ (e: 'open', group: 'success' | 'failed' | 'executing' | 'result_unknown'): void }>();
|
||||
|
||||
const groups = ref<TransferOrderGroups>({ success: 0, failed: 0, executing: 0, result_unknown: 0 });
|
||||
|
||||
/** 统计卡片定义(键对齐 i18n homeExecuted.group.* 与 groupHint.*;配色对齐待办看板与行级徽标)。 */
|
||||
const GROUP_CARDS: Array<{ key: string; group: keyof TransferOrderGroups; cls: string; numCls: string }> = [
|
||||
{ key: 'success', group: 'success', cls: 'border-emerald-200 bg-emerald-50 hover:bg-emerald-100', numCls: 'text-emerald-600' },
|
||||
{ key: 'failed', group: 'failed', cls: 'border-red-200 bg-red-50 hover:bg-red-100', numCls: 'text-red-600' },
|
||||
{ key: 'executing', group: 'executing', cls: 'border-brand-200 bg-brand-50 hover:bg-brand-100', numCls: 'text-brand-600' },
|
||||
{ key: 'resultUnknown', group: 'result_unknown', cls: 'border-amber-200 bg-amber-50 hover:bg-amber-100', numCls: 'text-amber-600' },
|
||||
];
|
||||
|
||||
/**
|
||||
* 拉取分组计数(pageSize=1 最小请求;计数恒全量由后端保证)。
|
||||
* 失败静默:不抛错不打断首页,计数保持初始 0,由用户刷新/下次进入兜底重拉
|
||||
* (纯入口组件无加载态 UI,loading 已随 P2-5 移除)。
|
||||
*/
|
||||
async function load() {
|
||||
try {
|
||||
const data = await fetchExecutedOrders({ page: 1, pageSize: 1 });
|
||||
groups.value = data.groups;
|
||||
} catch {
|
||||
// 静默保持 0,刷新/重进兜底(失败不打断首页)。
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => { void load(); });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="grid grid-cols-2 gap-3 lg:grid-cols-4">
|
||||
<button
|
||||
v-for="card in GROUP_CARDS"
|
||||
:key="card.key"
|
||||
type="button"
|
||||
class="rounded-2xl border p-4 text-left transition-colors"
|
||||
:class="card.cls"
|
||||
:data-testid="`transfer-executed-card-${card.key}`"
|
||||
@click="emit('open', card.group)"
|
||||
>
|
||||
<b class="block text-2xl leading-none tabular-nums" :class="card.numCls">{{ groups[card.group] }}</b>
|
||||
<b class="mt-2 block text-sm font-bold text-primary">{{ $t(`chat.transfer.homeExecuted.group.${card.key}`) }}</b>
|
||||
<span class="mt-1 block text-xs text-secondary">{{ $t(`chat.transfer.homeExecuted.groupHint.${card.key}`) }}</span>
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,223 @@
|
||||
/**
|
||||
* features/chat/components/messages/TransferExecutedOrders.spec.ts
|
||||
* 用途:验证已执行明细列表子视图——initialGroup 初始筛选 / 返回 emit /
|
||||
* 全部与日期筛选 / 分页 / failed 单动作(重试+关闭调拨单)/ result_unknown 仅重新触发。
|
||||
* 依赖:vi.mock(transfer.api)、@vue/test-utils、i18n。
|
||||
* 逻辑:Mock API 断言带参重拉与关闭链路(D18 原因必填、成功后刷新列表)。
|
||||
*/
|
||||
import { mount, flushPromises } from '@vue/test-utils';
|
||||
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
||||
import i18n from '@/i18n';
|
||||
|
||||
const api = vi.hoisted(() => ({
|
||||
fetchExecutedOrders: vi.fn(),
|
||||
closeTransferDocument: vi.fn(),
|
||||
retryTransferOrder: vi.fn(),
|
||||
retriggerTransferDocument: vi.fn(),
|
||||
listExecutableTransferItems: vi.fn(),
|
||||
batchRequeryTransferItems: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('@/features/chat/api/transfer.api', () => api);
|
||||
|
||||
import TransferExecutedOrders from './TransferExecutedOrders.vue';
|
||||
|
||||
const GROUPS = { success: 3, failed: 2, executing: 1, result_unknown: 1 };
|
||||
|
||||
const FAILED_TICKET = {
|
||||
doc_no: 'D-FAIL-1',
|
||||
submit_timestamp: '2026-08-06 09:00:00',
|
||||
status: 'business_failed',
|
||||
status_group: 'failed',
|
||||
receipt_date: '2026-08-05',
|
||||
from_warehouse: 'DBS-TRANSIT',
|
||||
to_warehouse: 'HUB-CN01',
|
||||
erp_document_no: null,
|
||||
error_message: null,
|
||||
created_at: '2026-09-20T08:00:00',
|
||||
run_no: 'RUN-1',
|
||||
items: [
|
||||
{ invoice_no: 'INV-A', material_no: 'MAT-A', material_name: '物料A', lot_no: 'LOT-A', quantity: '500', unit: '个' },
|
||||
{ invoice_no: 'INV-B', material_no: 'MAT-B', material_name: '物料B', lot_no: 'LOT-B', quantity: '300', unit: 'PCS' },
|
||||
],
|
||||
};
|
||||
|
||||
const UNKNOWN_TICKET = {
|
||||
doc_no: 'D-UNK-1',
|
||||
submit_timestamp: '2026-08-06 10:00:00',
|
||||
status: 'result_unknown',
|
||||
status_group: 'result_unknown',
|
||||
receipt_date: '2026-08-05',
|
||||
from_warehouse: 'DBS-TRANSIT',
|
||||
to_warehouse: 'HUB-CN02',
|
||||
erp_document_no: null,
|
||||
error_message: null,
|
||||
created_at: '2026-09-21T08:00:00',
|
||||
run_no: 'RUN-1',
|
||||
items: [
|
||||
{ invoice_no: 'INV-C', material_no: 'MAT-C', material_name: '物料C', lot_no: 'LOT-C', quantity: '100', unit: 'PCS' },
|
||||
],
|
||||
};
|
||||
|
||||
function mountList(initialGroup = 'failed') {
|
||||
return mount(TransferExecutedOrders, {
|
||||
props: { initialGroup },
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
}
|
||||
|
||||
function pagePayload(overrides: Record<string, unknown> = {}) {
|
||||
return {
|
||||
groups: GROUPS,
|
||||
total: 2,
|
||||
page: 1,
|
||||
page_size: 20,
|
||||
orders: [FAILED_TICKET, UNKNOWN_TICKET],
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
describe('TransferExecutedOrders 已执行明细列表子视图', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
api.fetchExecutedOrders.mockResolvedValue(pagePayload());
|
||||
api.closeTransferDocument.mockResolvedValue({ doc_no: 'D-FAIL-1', status: 'cancelled' });
|
||||
api.retriggerTransferDocument.mockResolvedValue({ run_no: 'RUN-1', doc_no: 'D-UNK-1', status: 'queued' });
|
||||
api.listExecutableTransferItems.mockResolvedValue({ items: [], counts: { executable_count: 0 } });
|
||||
api.batchRequeryTransferItems.mockResolvedValue({ total: 0, results: [] });
|
||||
});
|
||||
|
||||
it('挂载拉取并渲染单列表(缺省参数 page=1)', async () => {
|
||||
const wrapper = mountList();
|
||||
await flushPromises();
|
||||
expect(api.fetchExecutedOrders).toHaveBeenCalledTimes(1);
|
||||
expect(api.fetchExecutedOrders).toHaveBeenLastCalledWith(
|
||||
expect.objectContaining({ page: 1, pageSize: 20 }),
|
||||
);
|
||||
// [断言意图] 单行渲染存在性(排序为后端 created_at 倒序契约)。
|
||||
expect(wrapper.find('[data-testid="transfer-executed-order-D-FAIL-1"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="transfer-executed-order-D-UNK-1"]').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('initialGroup 初始筛选 + [全部] 清筛选重拉 + [返回] emit back', async () => {
|
||||
const wrapper = mountList('failed');
|
||||
await flushPromises();
|
||||
// [断言意图] 初始筛选生效:首拉带 statusGroup=failed。
|
||||
expect(api.fetchExecutedOrders).toHaveBeenLastCalledWith(
|
||||
expect.objectContaining({ statusGroup: 'failed', page: 1 }),
|
||||
);
|
||||
// [断言意图] 全部 chip 清筛选并重拉。
|
||||
await wrapper.find('[data-testid="transfer-executed-all"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(api.fetchExecutedOrders).toHaveBeenLastCalledWith(
|
||||
expect.objectContaining({ statusGroup: undefined, page: 1 }),
|
||||
);
|
||||
// [断言意图] 返回=emit('back'),由首页面板切回卡片视图。
|
||||
await wrapper.find('[data-testid="transfer-executed-back"]').trigger('click');
|
||||
expect(wrapper.emitted('back')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('日期范围变更带参重拉(dateFrom/dateTo + page=1;仅筛列表,计数恒全量由后端保证)', async () => {
|
||||
const wrapper = mountList();
|
||||
await flushPromises();
|
||||
await wrapper.find('[data-testid="transfer-executed-date-from"]').setValue('2026-09-01');
|
||||
await flushPromises();
|
||||
expect(api.fetchExecutedOrders).toHaveBeenLastCalledWith(
|
||||
expect.objectContaining({ dateFrom: '2026-09-01', page: 1 }),
|
||||
);
|
||||
await wrapper.find('[data-testid="transfer-executed-date-to"]').setValue('2026-09-30');
|
||||
await flushPromises();
|
||||
expect(api.fetchExecutedOrders).toHaveBeenLastCalledWith(
|
||||
expect.objectContaining({ dateFrom: '2026-09-01', dateTo: '2026-09-30', page: 1 }),
|
||||
);
|
||||
});
|
||||
|
||||
it('分页:下一页带 page=2 重拉,首页时上一页禁用', async () => {
|
||||
// 后端契约:page 请求参数原样回显(response.page=请求页),mock 同口径。
|
||||
api.fetchExecutedOrders.mockImplementation((params: { page?: number } | undefined) =>
|
||||
Promise.resolve(pagePayload({
|
||||
total: 45,
|
||||
page: params?.page ?? 1,
|
||||
orders: [FAILED_TICKET, UNKNOWN_TICKET],
|
||||
})),
|
||||
);
|
||||
const wrapper = mountList();
|
||||
await flushPromises();
|
||||
expect((wrapper.find('[data-testid="transfer-executed-prev"]').element as HTMLButtonElement).disabled).toBe(true);
|
||||
await wrapper.find('[data-testid="transfer-executed-next"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(api.fetchExecutedOrders).toHaveBeenLastCalledWith(expect.objectContaining({ page: 2 }));
|
||||
expect((wrapper.find('[data-testid="transfer-executed-prev"]').element as HTMLButtonElement).disabled).toBe(false);
|
||||
});
|
||||
|
||||
it('failed 单行点击展开 invoice 粒度明细,且动作区含 [重试] 与 [关闭调拨单]', async () => {
|
||||
const wrapper = mountList();
|
||||
await flushPromises();
|
||||
expect(wrapper.find('[data-testid="transfer-executed-items-D-FAIL-1"]').exists()).toBe(false);
|
||||
await wrapper.find('[data-testid="transfer-executed-order-D-FAIL-1"]').trigger('click');
|
||||
await flushPromises();
|
||||
const items = wrapper.find('[data-testid="transfer-executed-items-D-FAIL-1"]');
|
||||
expect(items.exists()).toBe(true);
|
||||
// [断言意图] 展开=invoice 粒度行明细(逐 Invoice 行可见)。
|
||||
expect(items.text()).toContain('INV-A');
|
||||
expect(items.text()).toContain('INV-B');
|
||||
expect(wrapper.find('[data-testid="transfer-executed-retry-D-FAIL-1"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="transfer-executed-close-D-FAIL-1"]').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('failed 单 [重试]:调用单级重试端点,rerun 成功后重拉列表', async () => {
|
||||
const wrapper = mountList();
|
||||
await flushPromises();
|
||||
api.retryTransferOrder.mockResolvedValueOnce({
|
||||
doc_no: 'D-FAIL-1', rerun: true, run_no: 'RUN-2', ready: 2, blocked: [], total: 2,
|
||||
});
|
||||
await wrapper.find('[data-testid="transfer-executed-retry-D-FAIL-1"]').trigger('click');
|
||||
await flushPromises();
|
||||
// [断言意图] 一键恢复主路径:重试直调 POST /documents/{doc_no}/retry。
|
||||
expect(api.retryTransferOrder).toHaveBeenCalledWith('D-FAIL-1');
|
||||
expect(api.fetchExecutedOrders.mock.calls.length).toBeGreaterThanOrEqual(2);
|
||||
});
|
||||
|
||||
it('关闭单:原因必填(空禁用确认),填写后确认调用 close 并刷新列表', async () => {
|
||||
const wrapper = mountList();
|
||||
await flushPromises();
|
||||
await wrapper.find('[data-testid="transfer-executed-close-D-FAIL-1"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(wrapper.find('[data-testid="transfer-executed-close-dialog"]').exists()).toBe(true);
|
||||
const confirm = wrapper.find('[data-testid="transfer-executed-close-confirm"]');
|
||||
// [断言意图] D18 原因必填:空原因确认钮禁用(后端同样兜底 400)。
|
||||
expect((confirm.element as HTMLButtonElement).disabled).toBe(true);
|
||||
await wrapper.find('[data-testid="transfer-executed-close-reason"]').setValue('ERP 查无此单');
|
||||
expect((confirm.element as HTMLButtonElement).disabled).toBe(false);
|
||||
await confirm.trigger('click');
|
||||
await flushPromises();
|
||||
expect(api.closeTransferDocument).toHaveBeenCalledTimes(1);
|
||||
expect(api.closeTransferDocument).toHaveBeenCalledWith('D-FAIL-1', 'ERP 查无此单');
|
||||
// [断言意图] 关闭成功后重拉列表(行脱离回待执行池,单面需同步)。
|
||||
expect(api.fetchExecutedOrders.mock.calls.length).toBeGreaterThanOrEqual(2);
|
||||
expect(wrapper.find('[data-testid="transfer-executed-close-dialog"]').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('result_unknown 单仅 [重新触发]:无关闭入口、无重试(D11 红线)', async () => {
|
||||
const wrapper = mountList();
|
||||
await flushPromises();
|
||||
expect(wrapper.find('[data-testid="transfer-executed-retrigger-D-UNK-1"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="transfer-executed-close-D-UNK-1"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="transfer-executed-retry-D-UNK-1"]').exists()).toBe(false);
|
||||
|
||||
await wrapper.find('[data-testid="transfer-executed-retrigger-D-UNK-1"]').trigger('click');
|
||||
await flushPromises();
|
||||
// [断言意图] 重新触发复用 T10 封装(run_no+doc_no),成功后重拉列表。
|
||||
expect(api.retriggerTransferDocument).toHaveBeenCalledWith('RUN-1', 'D-UNK-1');
|
||||
expect(api.fetchExecutedOrders.mock.calls.length).toBeGreaterThanOrEqual(2);
|
||||
});
|
||||
|
||||
it('[刷新] 按钮重拉列表', async () => {
|
||||
const wrapper = mountList();
|
||||
await flushPromises();
|
||||
const before = api.fetchExecutedOrders.mock.calls.length;
|
||||
await wrapper.find('[data-testid="transfer-executed-refresh"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(api.fetchExecutedOrders.mock.calls.length).toBe(before + 1);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,417 @@
|
||||
<!--
|
||||
features/chat/components/messages/TransferExecutedOrders.vue
|
||||
用途:「已执行调拨单」明细列表子视图(首页统计卡片下钻目标,与待办/可调拨
|
||||
子视图同模式)——工具栏(← 返回 + 全部 + 日期范围 + 刷新)+ 单分组列表
|
||||
(单行点击展开 invoice 粒度明细;failed 行 [重查]+单据级 [关闭单];
|
||||
result_unknown 行仅 [重新触发],D11 无关闭入口)+ 上一页/下一页分页;
|
||||
无自动轮询(进入拉一次 + 手动刷新)。
|
||||
依赖:transfer.api(fetchExecutedOrders/closeTransferDocument/retriggerTransferDocument)、
|
||||
useMessage、i18n chat.transfer.homeExecuted.*。
|
||||
逻辑:props.initialGroup(首页卡片点击带入的初始分组,''=全部)→ mounted→load;
|
||||
[全部] 点击→清 statusGroup+page=1;日期范围变更→page=1+load;[返回]→
|
||||
emit('back') 由首页面板切回卡片视图;关闭单走 D18 原因必填弹窗(同单行
|
||||
影响面 + 「关闭调拨单≠ERP 无单」红线)→close→load。行为与融合卡
|
||||
(TransferResultCard)一致。分组计数恒全量由后端保证,本视图不消费计数
|
||||
(计数展示在首页 TransferExecutedCards)。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import {
|
||||
closeTransferDocument,
|
||||
fetchExecutedOrders,
|
||||
retryTransferOrder,
|
||||
retriggerTransferDocument,
|
||||
} from '../../api/transfer.api';
|
||||
import type {
|
||||
TransferExecutedOrder,
|
||||
} from '../../types/transfer.types';
|
||||
|
||||
/** 每页条数(与后端默认 page_size=20 同口径;上限 100 由后端收口)。 */
|
||||
const PAGE_SIZE = 20;
|
||||
|
||||
const { t } = useI18n();
|
||||
const { error: notifyError, success: notifySuccess } = useMessage();
|
||||
|
||||
// props:进入子视图时的初始分组(首页卡片点击带入);''=全部。
|
||||
const props = defineProps<{ initialGroup?: string }>();
|
||||
const emit = defineEmits<{ (e: 'back'): void }>();
|
||||
|
||||
const orders = ref<TransferExecutedOrder[]>([]);
|
||||
const total = ref(0);
|
||||
const page = ref(1);
|
||||
/** 当前单分组筛选(''=全部;首页卡片带入,[全部] 清回)。 */
|
||||
const statusGroup = ref(props.initialGroup || '');
|
||||
const dateFrom = ref('');
|
||||
const dateTo = ref('');
|
||||
const loading = ref(false);
|
||||
/** 展开行明细的单(doc_no;单行点击切换,invoice 粒度)。 */
|
||||
const expandedDocNo = ref('');
|
||||
/** 待关闭单弹窗(D18:docNo + 原因必填)。 */
|
||||
const closeDialog = ref<{ docNo: string; reason: string }>({ docNo: '', reason: '' });
|
||||
|
||||
const actionBusy = ref(false);
|
||||
|
||||
const hasNext = computed(() => page.value * PAGE_SIZE < total.value);
|
||||
const hasPrev = computed(() => page.value > 1);
|
||||
|
||||
/** 关闭弹窗目标单(按 doc_no 回查,渲染同单行影响面清单)。 */
|
||||
const closeTarget = computed<TransferExecutedOrder | null>(
|
||||
() => orders.value.find((order) => order.doc_no === closeDialog.value.docNo) ?? null,
|
||||
);
|
||||
|
||||
/** 拉取已执行单(status_group/时间窗仅筛列表;分组计数恒全量由后端保证)。 */
|
||||
async function load() {
|
||||
loading.value = true;
|
||||
try {
|
||||
const data = await fetchExecutedOrders({
|
||||
statusGroup: statusGroup.value || undefined,
|
||||
dateFrom: dateFrom.value || undefined,
|
||||
dateTo: dateTo.value || undefined,
|
||||
page: page.value,
|
||||
pageSize: PAGE_SIZE,
|
||||
});
|
||||
orders.value = data.orders;
|
||||
total.value = data.total;
|
||||
page.value = data.page;
|
||||
} catch (e) {
|
||||
// 单次失败保留旧值(子视图入口口径:手动刷新兜底,不做自动轮询)
|
||||
notifyError(e instanceof Error ? e.message : String(e));
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/** [全部] 点击:清分组筛选并回第一页重拉(与日期变更同口径)。 */
|
||||
async function clearGroup() {
|
||||
statusGroup.value = '';
|
||||
page.value = 1;
|
||||
await load();
|
||||
}
|
||||
|
||||
/** 日期范围变更:仅筛列表(计数恒全量),回第一页。 */
|
||||
async function onDateChange() {
|
||||
page.value = 1;
|
||||
await load();
|
||||
}
|
||||
|
||||
async function goToPage(next: number) {
|
||||
page.value = next;
|
||||
await load();
|
||||
}
|
||||
|
||||
/** 单行点击:展开/收起 invoice 粒度行明细。 */
|
||||
function toggleExpand(docNo: string) {
|
||||
expandedDocNo.value = expandedDocNo.value === docNo ? '' : docNo;
|
||||
}
|
||||
|
||||
function isFailedOrder(order: TransferExecutedOrder): boolean {
|
||||
return order.status === 'business_failed' || order.status === 'technical_failed';
|
||||
}
|
||||
|
||||
/** 单状态徽标文案(成功族亮 ERP 单号,无单号回退状态文案;禁 undefined/null 上屏)。 */
|
||||
function orderBadgeText(order: TransferExecutedOrder): string {
|
||||
switch (order.status) {
|
||||
case 'success':
|
||||
case 'duplicate_success':
|
||||
return order.erp_document_no || t('chat.transfer.orderStatus.success');
|
||||
case 'pending':
|
||||
return t('chat.transfer.orderStatus.pending');
|
||||
case 'executing':
|
||||
return t('chat.transfer.orderStatus.executing');
|
||||
case 'business_failed':
|
||||
case 'technical_failed':
|
||||
// 用户口径:失败统一展示(原因走行级明细),不再区分业务/技术。
|
||||
return t('chat.transfer.orderStatus.failed');
|
||||
case 'result_unknown':
|
||||
return t('chat.transfer.orderStatus.resultUnknown');
|
||||
default:
|
||||
return order.status;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* failed 单 [重试](一键恢复主路径):调 POST /documents/{doc_no}/retry——
|
||||
* 后端按单圈行逐行重查,全部 ready 自动建新 Run 重跑(复用原单号,分支②);
|
||||
* 部分行仍阻断则不重跑(单是原子单位),阻断明细以 toast 摘要提示、行留恢复池。
|
||||
*/
|
||||
async function onRetry(order: TransferExecutedOrder) {
|
||||
actionBusy.value = true;
|
||||
try {
|
||||
const result = await retryTransferOrder(order.doc_no);
|
||||
if (result.rerun) {
|
||||
notifySuccess(t('chat.transfer.orderAction.retryAccepted', { docNo: order.doc_no }));
|
||||
} else {
|
||||
notifyError(t('chat.transfer.orderAction.retryPartial', {
|
||||
ready: result.ready,
|
||||
blocked: result.blocked.length,
|
||||
}));
|
||||
}
|
||||
await load();
|
||||
} catch (e) {
|
||||
notifyError(e instanceof Error ? e.message : String(e));
|
||||
} finally {
|
||||
actionBusy.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* result_unknown 行 [重新触发](D11 唯一出口):复用 T13 封装
|
||||
* (run_no + doc_no → POST /runs/{run_no}/documents/{doc_no}/retrigger),成功后重拉。
|
||||
*/
|
||||
async function onRetrigger(order: TransferExecutedOrder) {
|
||||
if (!order.run_no || actionBusy.value) return;
|
||||
actionBusy.value = true;
|
||||
try {
|
||||
await retriggerTransferDocument(order.run_no, order.doc_no);
|
||||
notifySuccess(t('chat.transfer.toastRetriggerAccepted'));
|
||||
await load();
|
||||
} catch (e) {
|
||||
notifyError(e instanceof Error ? e.message : String(e));
|
||||
} finally {
|
||||
actionBusy.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function openCloseDialog(order: TransferExecutedOrder) {
|
||||
closeDialog.value = { docNo: order.doc_no, reason: '' };
|
||||
}
|
||||
|
||||
/** [关闭单] 确认(D18:原因必填;仅失败单可关):close 后单 cancelled、行脱离回
|
||||
* ready_to_execute;成功后重拉列表(统计/列表同步,组锁释放可另开新单)。 */
|
||||
async function confirmCloseOrder() {
|
||||
const reason = closeDialog.value.reason.trim();
|
||||
if (!closeDialog.value.docNo || !reason || actionBusy.value) return;
|
||||
actionBusy.value = true;
|
||||
try {
|
||||
await closeTransferDocument(closeDialog.value.docNo, reason);
|
||||
closeDialog.value = { docNo: '', reason: '' };
|
||||
notifySuccess(t('chat.transfer.toastOrderClosed'));
|
||||
await load();
|
||||
} catch (e) {
|
||||
notifyError(e instanceof Error ? e.message : String(e));
|
||||
} finally {
|
||||
actionBusy.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => { void load(); });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section :aria-label="$t('chat.transfer.homeExecuted.title')" data-testid="transfer-executed" class="rounded-2xl border border-default bg-surface p-4">
|
||||
<!-- 工具栏:返回(emit back 由首页切视图)+ 全部/日期筛选 + 刷新 -->
|
||||
<div class="mb-3 flex flex-wrap items-center gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg px-2 py-1 text-sm font-bold text-brand-600 transition-colors hover:bg-brand-50"
|
||||
data-testid="transfer-executed-back"
|
||||
@click="emit('back')"
|
||||
>
|
||||
← {{ $t('chat.transfer.homeExecuted.back') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-full border px-3 py-1 text-xs font-bold transition-colors"
|
||||
:class="statusGroup === ''
|
||||
? 'border-brand-500 bg-brand-600 text-white'
|
||||
: 'border-default bg-surface-soft text-secondary hover:bg-brand-50'"
|
||||
data-testid="transfer-executed-all"
|
||||
@click="clearGroup"
|
||||
>
|
||||
{{ $t('chat.transfer.homeExecuted.all') }}
|
||||
</button>
|
||||
<span class="ml-auto flex items-center gap-2">
|
||||
<input v-model="dateFrom" type="date" class="rounded-lg border border-default px-2 py-1 text-xs"
|
||||
:aria-label="$t('chat.transfer.homeExecuted.dateFrom')" data-testid="transfer-executed-date-from" @change="onDateChange">
|
||||
<span class="text-xs text-muted">→</span>
|
||||
<input v-model="dateTo" type="date" class="rounded-lg border border-default px-2 py-1 text-xs"
|
||||
:aria-label="$t('chat.transfer.homeExecuted.dateTo')" data-testid="transfer-executed-date-to" @change="onDateChange">
|
||||
<button type="button"
|
||||
class="rounded-lg border border-default px-3 py-1 text-xs font-bold text-secondary hover-surface-soft disabled:opacity-40"
|
||||
data-testid="transfer-executed-refresh" :disabled="loading" @click="load">
|
||||
{{ $t('chat.transfer.homeExecuted.refresh') }}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- 空态 -->
|
||||
<div v-if="!orders.length" class="rounded-lg bg-surface-soft p-3 text-xs text-muted" data-testid="transfer-executed-empty">
|
||||
{{ $t('chat.transfer.homeExecuted.empty') }}
|
||||
</div>
|
||||
|
||||
<!-- 单列表:单行点击展开 invoice 粒度明细;动作按 D11/D18 守卫 -->
|
||||
<ul v-else class="flex flex-col gap-2">
|
||||
<li
|
||||
v-for="order in orders"
|
||||
:key="order.doc_no"
|
||||
class="cursor-pointer rounded-lg border border-default"
|
||||
:data-testid="`transfer-executed-order-${order.doc_no}`"
|
||||
@click="toggleExpand(order.doc_no)"
|
||||
>
|
||||
<div class="flex flex-wrap items-center justify-between gap-2 px-3 py-2 text-xs">
|
||||
<span class="font-semibold text-secondary">
|
||||
{{ order.receipt_date || '—' }} · {{ order.from_warehouse }}→{{ order.to_warehouse }}
|
||||
· {{ $t('chat.transfer.materialCount', { count: order.items.length }) }}
|
||||
</span>
|
||||
<span
|
||||
class="rounded-full px-2 py-0.5 font-bold"
|
||||
:class="{
|
||||
'bg-emerald-50 text-emerald-700': order.status_group === 'success',
|
||||
'bg-sky-50 text-sky-700': order.status_group === 'executing',
|
||||
'bg-red-50 text-red-700': order.status_group === 'failed',
|
||||
'bg-amber-50 text-amber-700': order.status_group === 'result_unknown',
|
||||
}"
|
||||
:data-testid="`transfer-executed-status-${order.doc_no}`"
|
||||
>
|
||||
{{ orderBadgeText(order) }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- 单据级行内动作(D11/D18:result_unknown 仅重新触发;failed 行重查 + 单据级关闭单) -->
|
||||
<div
|
||||
v-if="order.status === 'result_unknown' || isFailedOrder(order)"
|
||||
class="flex flex-wrap gap-2 px-3 pb-2"
|
||||
>
|
||||
<button
|
||||
v-if="order.status === 'result_unknown'"
|
||||
type="button"
|
||||
class="rounded border border-amber-300 px-2 py-0.5 text-[11px] font-bold text-amber-700 transition hover:bg-amber-50 disabled:opacity-40"
|
||||
:data-testid="`transfer-executed-retrigger-${order.doc_no}`"
|
||||
:disabled="actionBusy"
|
||||
@click.stop="onRetrigger(order)"
|
||||
>
|
||||
{{ $t('chat.transfer.orderAction.retrigger') }}
|
||||
</button>
|
||||
<template v-if="isFailedOrder(order)">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded border border-brand-200 px-2 py-0.5 text-[11px] font-bold text-brand-700 transition hover:bg-brand-50 disabled:opacity-40"
|
||||
:data-testid="`transfer-executed-retry-${order.doc_no}`"
|
||||
:disabled="actionBusy"
|
||||
@click.stop="onRetry(order)"
|
||||
>
|
||||
{{ $t('chat.transfer.orderAction.retry') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded border border-red-200 px-2 py-0.5 text-[11px] font-bold text-red-700 transition hover:bg-red-50 disabled:opacity-40"
|
||||
:data-testid="`transfer-executed-close-${order.doc_no}`"
|
||||
:disabled="actionBusy"
|
||||
@click.stop="openCloseDialog(order)"
|
||||
>
|
||||
{{ $t('chat.transfer.orderAction.closeOrder') }}
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<!-- 展开明细(invoice 粒度行集) -->
|
||||
<div
|
||||
v-if="expandedDocNo === order.doc_no"
|
||||
class="border-t border-subtle px-3 py-2"
|
||||
:data-testid="`transfer-executed-items-${order.doc_no}`"
|
||||
>
|
||||
<table class="w-full text-xs">
|
||||
<thead>
|
||||
<tr class="text-left text-[11px] text-muted">
|
||||
<th class="p-1">{{ $t('chat.transfer.colInvoice') }}</th>
|
||||
<th class="p-1">{{ $t('chat.transfer.colMaterial') }}</th>
|
||||
<th class="p-1">{{ $t('chat.transfer.colName') }}</th>
|
||||
<th class="p-1">{{ $t('chat.transfer.colFromBatch') }}</th>
|
||||
<th class="p-1">{{ $t('chat.transfer.colToQty') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="item in order.items" :key="`${order.doc_no}|${item.invoice_no}|${item.material_no}`" class="border-t border-subtle">
|
||||
<td class="p-1">{{ item.invoice_no }}</td>
|
||||
<td class="p-1">{{ item.material_no }}</td>
|
||||
<td class="p-1">{{ item.material_name }}</td>
|
||||
<td class="p-1">{{ item.lot_no || '—' }}</td>
|
||||
<td class="p-1">{{ item.quantity }}<template v-if="item.unit"> {{ item.unit }}</template></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- 分页:上一页/下一页(无自动轮询,手动翻页) -->
|
||||
<div class="mt-3 flex items-center justify-end gap-2 border-t border-subtle pt-3 text-xs">
|
||||
<span class="text-muted" data-testid="transfer-executed-pageinfo">
|
||||
{{ $t('chat.transfer.homeExecuted.pageInfo', { page, total }) }}
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-default px-3 py-1 font-bold text-secondary hover-surface-soft disabled:opacity-40"
|
||||
data-testid="transfer-executed-prev"
|
||||
:disabled="!hasPrev || loading"
|
||||
@click="goToPage(page - 1)"
|
||||
>
|
||||
←
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-default px-3 py-1 font-bold text-secondary hover-surface-soft disabled:opacity-40"
|
||||
data-testid="transfer-executed-next"
|
||||
:disabled="!hasNext || loading"
|
||||
@click="goToPage(page + 1)"
|
||||
>
|
||||
→
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- 关闭单确认弹层(D18:原因必填 + 同单行影响面 + 「关闭调拨单≠ERP 无单」红线) -->
|
||||
<div
|
||||
v-if="closeTarget"
|
||||
class="fixed inset-0 z-50 flex items-center justify-center bg-slate-900/40 p-4"
|
||||
data-testid="transfer-executed-close-dialog"
|
||||
>
|
||||
<div class="w-full max-w-md rounded-2xl bg-surface p-5 shadow-xl">
|
||||
<h3 class="text-base font-bold text-primary">
|
||||
{{ $t('chat.transfer.homeExecuted.closeDialog.title', { docNo: closeTarget.doc_no }) }}
|
||||
</h3>
|
||||
<p class="mt-1 text-xs text-muted">
|
||||
{{ $t('chat.transfer.homeExecuted.closeDialog.redlineReopen') }}
|
||||
</p>
|
||||
<ul class="mt-2 max-h-32 overflow-y-auto rounded-lg bg-surface-soft p-2 text-[11px] text-secondary">
|
||||
<li v-for="item in closeTarget.items" :key="`${item.invoice_no}|${item.material_no}`">
|
||||
{{ item.invoice_no }} · {{ item.material_no }} {{ item.material_name }} ·
|
||||
{{ item.quantity }}<template v-if="item.unit"> {{ item.unit }}</template>
|
||||
</li>
|
||||
</ul>
|
||||
<ul class="mt-2 list-disc pl-4 text-xs font-bold text-red-600">
|
||||
<li>{{ $t('chat.transfer.homeExecuted.closeDialog.redlineWhole') }}</li>
|
||||
<li>{{ $t('chat.transfer.homeExecuted.closeDialog.redlineResidue') }}</li>
|
||||
<li>{{ $t('chat.transfer.homeExecuted.closeDialog.redlineErpCheck') }}</li>
|
||||
</ul>
|
||||
<textarea
|
||||
v-model="closeDialog.reason"
|
||||
rows="3"
|
||||
class="mt-3 w-full rounded-lg border border-default p-2 text-sm"
|
||||
:placeholder="$t('chat.transfer.homeExecuted.closeDialog.reasonRequired')"
|
||||
data-testid="transfer-executed-close-reason"
|
||||
/>
|
||||
<div class="mt-4 flex justify-end gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-default px-4 py-1.5 text-sm text-secondary hover-surface-soft"
|
||||
data-testid="transfer-executed-close-dismiss"
|
||||
@click="closeDialog = { docNo: '', reason: '' }"
|
||||
>
|
||||
{{ $t('chat.transfer.orderClose.dismiss') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg bg-red-600 px-4 py-1.5 text-sm font-bold text-white hover:bg-red-700 disabled:cursor-not-allowed disabled:opacity-40"
|
||||
data-testid="transfer-executed-close-confirm"
|
||||
:disabled="!closeDialog.reason.trim() || actionBusy"
|
||||
@click="confirmCloseOrder"
|
||||
>
|
||||
{{ $t('chat.transfer.homeExecuted.closeDialog.confirm') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
@@ -1,8 +1,9 @@
|
||||
/**
|
||||
* features/chat/components/messages/TransferHomePanel.spec.ts
|
||||
* 用途:验证在途仓自动调拨 Agent 的 Chat 首页入口区——
|
||||
* home 视图渲染“今日待办 + 历史待办”计数卡;点击入口独立触发
|
||||
* source-select / backlog 卡片(复用自驱动的 TransferMessageView,不注入消息流)。
|
||||
* home 视图渲染“今日待办 + 历史待办”计数卡与「已执行」统计卡片入口;
|
||||
* 点击入口独立触发 source-select / backlog 卡片(复用自驱动的
|
||||
* TransferMessageView,不注入消息流)与已执行明细列表子视图。
|
||||
* 依赖:vi.mock(transfer.api)、@vue/test-utils、i18n。
|
||||
* 逻辑:Mock API 断言入口切换与计数展示;对应后端 backlog/summary 契约面。
|
||||
*/
|
||||
@@ -11,9 +12,9 @@ import { describe, expect, it, vi, beforeEach } from 'vitest';
|
||||
import i18n from '@/i18n';
|
||||
|
||||
const api = vi.hoisted(() => ({
|
||||
createTransferPrecheck: vi.fn(),
|
||||
getTransferPrecheck: vi.fn(),
|
||||
executeTransferPrecheck: vi.fn(),
|
||||
createTransferMatching: vi.fn(),
|
||||
getTransferMatching: vi.fn(),
|
||||
executeTransferItems: vi.fn(),
|
||||
getTransferRun: vi.fn(),
|
||||
retryTransferItem: vi.fn(),
|
||||
manualCloseTransferItem: vi.fn(),
|
||||
@@ -23,6 +24,8 @@ const api = vi.hoisted(() => ({
|
||||
listTransferBacklog: vi.fn(),
|
||||
getTransferBacklogSummary: vi.fn(),
|
||||
listTransferSources: vi.fn(),
|
||||
listExecutableTransferItems: vi.fn(),
|
||||
fetchExecutedOrders: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('@/features/chat/api/transfer.api', () => api);
|
||||
@@ -43,9 +46,15 @@ describe('TransferHomePanel chat home entry', () => {
|
||||
recoverable: 6, closed: 2, unknown: 1, aging: { warn_3d: 3, escalate_5d: 2, critical_7d: 1 },
|
||||
});
|
||||
api.listTransferBacklog.mockResolvedValue([]);
|
||||
api.listExecutableTransferItems.mockResolvedValue({ items: [], counts: { executable_count: 0 } });
|
||||
api.listTransferSources.mockResolvedValue([
|
||||
{ source_code: 'DBS-AWSBI', display_name: 'AWSBI', platform: 'dbs', enabled: true, has_ready_file: true, file_status: 'ready' },
|
||||
]);
|
||||
// 已执行卡片入口挂载拉分组计数(pageSize=1);不 mock 会因组件静默失败成为未处理 rejection。
|
||||
api.fetchExecutedOrders.mockResolvedValue({
|
||||
groups: { success: 0, failed: 0, executing: 0, result_unknown: 0 },
|
||||
orders: [], total: 0, page: 1, page_size: 1,
|
||||
});
|
||||
});
|
||||
|
||||
it('home 视图渲染标题、今日待办入口与三张历史待办计数卡', async () => {
|
||||
@@ -59,19 +68,19 @@ describe('TransferHomePanel chat home entry', () => {
|
||||
expect(api.getTransferBacklogSummary).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('点击“发起今日调拨预检”独立触发来源选择卡(复用 TransferMessageView)', async () => {
|
||||
api.createTransferPrecheck.mockResolvedValue({
|
||||
precheck_id: 'TPC-1', status: 'ready_to_execute', business_date: '2026-08-06',
|
||||
it('点击“匹配可调拨库存”今日待办入口独立触发来源选择卡(复用 TransferMessageView)', async () => {
|
||||
api.createTransferMatching.mockResolvedValue({
|
||||
matching_id: 'MTG-1', status: 'ready_to_execute', business_date: '2026-08-06',
|
||||
eligible_receipt_date_to: '2026-08-05', expires_at: '',
|
||||
counts: { file_invoice_count: 1, not_matured_count: 0, prechecked_count: 1, executable_count: 1, blocked_count: 0 },
|
||||
estimated_transfer_quantity: '1200', estimated_external_write_count: 1, precheck_hash: 'sha256:x',
|
||||
counts: { file_invoice_count: 1, not_matured_count: 0, matched_count: 1, executable_count: 1, blocked_count: 0 },
|
||||
estimated_transfer_quantity: '1200', estimated_external_write_count: 1, matching_hash: 'sha256:x',
|
||||
});
|
||||
api.getTransferPrecheck.mockResolvedValue({
|
||||
api.getTransferMatching.mockResolvedValue({
|
||||
summary: {
|
||||
precheck_id: 'TPC-1', status: 'ready_to_execute', business_date: '2026-08-06',
|
||||
matching_id: 'MTG-1', status: 'ready_to_execute', business_date: '2026-08-06',
|
||||
eligible_receipt_date_to: '2026-08-05', expires_at: '',
|
||||
counts: { file_invoice_count: 1, not_matured_count: 0, prechecked_count: 1, executable_count: 1, blocked_count: 0 },
|
||||
estimated_transfer_quantity: '1200', estimated_external_write_count: 1, precheck_hash: 'sha256:x',
|
||||
counts: { file_invoice_count: 1, not_matured_count: 0, matched_count: 1, executable_count: 1, blocked_count: 0 },
|
||||
estimated_transfer_quantity: '1200', estimated_external_write_count: 1, matching_hash: 'sha256:x',
|
||||
},
|
||||
items: [{
|
||||
source_code: 'DBS-AWSBI', material_no: 'MAT-1', material_name: '连接器组件', specification: 'A',
|
||||
@@ -89,18 +98,65 @@ describe('TransferHomePanel chat home entry', () => {
|
||||
expect(api.listTransferSources).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('点击历史待办计数卡独立触发 backlog 卡片', async () => {
|
||||
it('点击历史待办计数卡独立触发 backlog 卡片,并按计数卡切片初始筛选', async () => {
|
||||
// [断言意图] 三张计数卡不再落入同一份全量列表:可恢复/已关闭/结果未知
|
||||
// 各自带对应 resultFilter 打开待处理池(否则 0 行的已关闭/结果未知被 50 行可恢复淹没)。
|
||||
api.listTransferBacklog.mockResolvedValue([
|
||||
{ item_id: 7, source_code: 'DBS-AWSBI', invoice_no: 'INV-001', material_no: 'MAT-1',
|
||||
status: 'blocked_recoverable', reason: '收料 1200 / ERP 1000', age_days: 1, aging_level: 'normal' },
|
||||
{ item_id: 8, source_code: 'DBS-AWSBI', invoice_no: 'INV-002', material_no: 'MAT-2',
|
||||
status: 'manually_closed', reason: '线下处理', age_days: 2, aging_level: 'closed' },
|
||||
{ item_id: 9, source_code: 'DBS-AWSBI', invoice_no: 'INV-003', material_no: 'MAT-3',
|
||||
status: 'result_unknown', reason: '待人工核实', age_days: 3, aging_level: 'result_unknown' },
|
||||
]);
|
||||
|
||||
const wrapper = mountHome();
|
||||
await flushPromises();
|
||||
|
||||
await wrapper.find('[data-testid="transfer-home-recoverable"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(wrapper.find('[data-testid="transfer-backlog-card"]').exists()).toBe(true);
|
||||
expect(api.listTransferBacklog).toHaveBeenCalled();
|
||||
expect((wrapper.find('[data-testid="transfer-backlog-result-filter"]').element as HTMLSelectElement).value).toBe('recoverable');
|
||||
// 切片后仅可见对应状态行。
|
||||
expect(wrapper.text()).toContain('INV-001');
|
||||
expect(wrapper.text()).not.toContain('INV-002');
|
||||
|
||||
await wrapper.find('[data-testid="transfer-home-back"]').trigger('click');
|
||||
await flushPromises();
|
||||
await wrapper.find('[data-testid="transfer-home-closed"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect((wrapper.find('[data-testid="transfer-backlog-result-filter"]').element as HTMLSelectElement).value).toBe('closed');
|
||||
expect(wrapper.text()).toContain('INV-002');
|
||||
expect(wrapper.text()).not.toContain('INV-001');
|
||||
|
||||
await wrapper.find('[data-testid="transfer-home-back"]').trigger('click');
|
||||
await flushPromises();
|
||||
await wrapper.find('[data-testid="transfer-home-unknown"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect((wrapper.find('[data-testid="transfer-backlog-result-filter"]').element as HTMLSelectElement).value).toBe('unknown');
|
||||
expect(wrapper.text()).toContain('INV-003');
|
||||
});
|
||||
|
||||
it('点击已执行统计卡片进入明细列表子视图:initial-group 透传且 flow-active=true', async () => {
|
||||
// 卡片分组计数非零(入口可见);列表 mock 返回空单(本例只验证接线,不验证行渲染)。
|
||||
api.fetchExecutedOrders.mockResolvedValue({
|
||||
groups: { success: 3, failed: 2, executing: 1, result_unknown: 1 },
|
||||
orders: [], total: 0, page: 1, page_size: 20,
|
||||
});
|
||||
|
||||
const wrapper = mountHome();
|
||||
await flushPromises();
|
||||
await wrapper.find('[data-testid="transfer-executed-card-failed"]').trigger('click');
|
||||
await flushPromises();
|
||||
// [断言意图] 卡片=入口:HomePanel 切到 executed 子视图并挂载列表组件。
|
||||
expect(wrapper.find('[data-testid="transfer-executed"]').exists()).toBe(true);
|
||||
// [断言意图] initial-group 透传:列表首拉带 statusGroup=failed(卡片点击带入的初始分组)。
|
||||
expect(api.fetchExecutedOrders).toHaveBeenLastCalledWith(
|
||||
expect.objectContaining({ statusGroup: 'failed', page: 1 }),
|
||||
);
|
||||
// [断言意图] 子视图=业务流激活(父级据此隐藏聊天输入框)。
|
||||
expect(wrapper.emitted('flow-active')?.at(-1)?.[0]).toBe(true);
|
||||
});
|
||||
|
||||
it('子视图提供“返回首页”并切回 home', async () => {
|
||||
|
||||
@@ -1,14 +1,20 @@
|
||||
<!--
|
||||
features/chat/components/messages/TransferHomePanel.vue
|
||||
用途:在途仓自动调拨 Agent 的 Chat 首页入口区——home 视图展示标题、今日待办
|
||||
入口与三张历史待办计数卡;点击入口独立触发 source-select / backlog 卡片。
|
||||
依赖:TransferMessageView(复用自驱动卡片)、useChatTransfer、i18n chat.transfer.*。
|
||||
逻辑:home 时只消费 backlogSummary 计数;非 home 时渲染 TransferMessageView。
|
||||
卡片不注入消息流,因此无需后端 ChatLog 消息(决策:补首页入口 A 方案)。
|
||||
用途:在途仓自动调拨 Agent 的 Chat 首页入口区——上区「库存匹配」动作入口,
|
||||
中区「待办看板」四队列(可调拨明细/待恢复异常/已人工关闭/结果未知),
|
||||
下区「已执行」统计卡片入口(四张分组计数卡,点击跳转明细列表子视图),
|
||||
点击进入对应处理视图(复用自驱动的 TransferMessageView / TransferExecutedOrders)。
|
||||
依赖:TransferMessageView(复用自驱动卡片)、TransferExecutedCards(已执行卡片入口)、
|
||||
TransferExecutedOrders(已执行明细列表子视图)、useChatTransfer、i18n chat.transfer.*。
|
||||
逻辑:home 时拉取待办汇总与可调拨明细计数并挂载已执行卡片;'executed' 子视图由
|
||||
openExecuted(group) 进入(卡片带入初始分组)并挂载列表组件;其余非 home 视图
|
||||
渲染 TransferMessageView。卡片不注入消息流,因此无需后端 ChatLog 消息。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import TransferMessageView from './TransferMessageView.vue';
|
||||
import TransferExecutedCards from './TransferExecutedCards.vue';
|
||||
import TransferExecutedOrders from './TransferExecutedOrders.vue';
|
||||
import { useChatTransfer } from '../../composables/useChatTransfer';
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -20,31 +26,52 @@ const emit = defineEmits<{
|
||||
'flow-active': [active: boolean];
|
||||
}>();
|
||||
|
||||
type HomeView = 'home' | 'source-select' | 'backlog';
|
||||
type HomeView = 'home' | 'source-select' | 'backlog' | 'executable' | 'executed';
|
||||
/** 待处理池结果筛选(与 TransferBacklogSummaryCard 的筛选选项一致)。 */
|
||||
type BacklogFilter = 'all' | 'recoverable' | 'closed' | 'unknown';
|
||||
|
||||
const transfer = useChatTransfer();
|
||||
const view = ref<HomeView>('home');
|
||||
/** 历史待办计数卡对应的初始筛选:点击哪张卡就落到哪个切片。 */
|
||||
const backlogFilter = ref<BacklogFilter>('all');
|
||||
/** 已执行卡片带入的初始分组(''=全部)。 */
|
||||
const executedGroup = ref<'success' | 'failed' | 'executing' | 'result_unknown' | ''>('');
|
||||
|
||||
/** 进入非 home 时通知父级隐藏聊天输入框(决策:来源选择为业务页,无对话输入区)。 */
|
||||
watch(view, (value) => emit('flow-active', value !== 'home'), { immediate: true });
|
||||
/** 打开待处理池并按计数卡切片(recoverable/closed/unknown)。 */
|
||||
function openBacklog(filter: BacklogFilter) {
|
||||
backlogFilter.value = filter;
|
||||
view.value = 'backlog';
|
||||
}
|
||||
|
||||
/** home 视图仅需要待办汇总;进入时拉取计数。 */
|
||||
/** 打开已执行明细列表子视图(卡片入口,与 openBacklog 同模式)。 */
|
||||
function openExecuted(group: 'success' | 'failed' | 'executing' | 'result_unknown') {
|
||||
executedGroup.value = group;
|
||||
view.value = 'executed';
|
||||
}
|
||||
|
||||
/** home 视图需要待办汇总与可调拨明细计数;进入时拉取。 */
|
||||
async function loadHomeSummary() {
|
||||
if (view.value !== 'home') return;
|
||||
await transfer.loadBacklog();
|
||||
await Promise.all([
|
||||
transfer.loadBacklog().catch(() => undefined),
|
||||
transfer.loadExecutableItems().catch(() => undefined),
|
||||
]);
|
||||
}
|
||||
|
||||
onMounted(() => { void loadHomeSummary(); });
|
||||
watch(view, () => { void loadHomeSummary(); });
|
||||
|
||||
/** 进入非 home 时通知父级隐藏聊天输入框(来源选择/待办为业务页,无对话输入区)。 */
|
||||
watch(view, (value) => emit('flow-active', value !== 'home'), { immediate: true });
|
||||
|
||||
const displayAgentName = computed(() => props.agentName || '在途仓自动调拨');
|
||||
|
||||
/** 非 home 视图把当前入口透传给自驱动的 TransferMessageView(决定 source-select 或 backlog)。 */
|
||||
const childPayload = computed(() => (
|
||||
view.value === 'source-select'
|
||||
? { kind: 'source-select' }
|
||||
: { kind: 'backlog' }
|
||||
));
|
||||
/** 非 home 视图把当前入口透传给自驱动的 TransferMessageView。 */
|
||||
const childPayload = computed(() => {
|
||||
if (view.value === 'source-select') return { kind: 'source-select' };
|
||||
if (view.value === 'executable') return { kind: 'executable' };
|
||||
return { kind: 'backlog', filter: backlogFilter.value };
|
||||
});
|
||||
|
||||
function goBack() {
|
||||
view.value = 'home';
|
||||
@@ -53,7 +80,7 @@ function goBack() {
|
||||
|
||||
<template>
|
||||
<div class="flex w-full flex-col items-center px-4 pb-2 pt-6 md:pb-4">
|
||||
<!-- home:标题 + 今日/历史待办入口 -->
|
||||
<!-- home:库存匹配 + 待办看板 -->
|
||||
<template v-if="view === 'home'">
|
||||
<h2 data-testid="transfer-home" class="mb-8 mt-6 shrink-0 text-center text-2xl font-bold text-primary md:mt-10 md:text-3xl">
|
||||
{{ $t('chat.transfer.homeWelcome') }}
|
||||
@@ -61,9 +88,9 @@ function goBack() {
|
||||
</h2>
|
||||
|
||||
<div class="w-full max-w-3xl space-y-4">
|
||||
<!-- 今日待办 -->
|
||||
<section aria-label="今日待办">
|
||||
<p class="mb-2 text-sm font-bold text-secondary">{{ $t('chat.transfer.homeTodayLabel') }}</p>
|
||||
<!-- 库存匹配 -->
|
||||
<section aria-label="库存匹配">
|
||||
<p class="mb-2 text-sm font-bold text-secondary">{{ $t('chat.transfer.homeMatchLabel') }}</p>
|
||||
<button
|
||||
type="button"
|
||||
data-testid="transfer-home-today"
|
||||
@@ -79,15 +106,25 @@ function goBack() {
|
||||
</button>
|
||||
</section>
|
||||
|
||||
<!-- 历史待办 -->
|
||||
<section aria-label="历史待办">
|
||||
<p class="mb-2 text-sm font-bold text-secondary">{{ $t('chat.transfer.homeHistoryLabel') }}</p>
|
||||
<div class="grid grid-cols-1 gap-3 sm:grid-cols-3">
|
||||
<!-- 待办看板 -->
|
||||
<section aria-label="待办看板">
|
||||
<p class="mb-2 text-sm font-bold text-secondary">{{ $t('chat.transfer.homeBoardLabel') }}</p>
|
||||
<div class="grid grid-cols-2 gap-3 lg:grid-cols-4">
|
||||
<button
|
||||
type="button"
|
||||
data-testid="transfer-home-executable"
|
||||
class="rounded-2xl border border-emerald-200 bg-emerald-50 p-4 text-left transition-colors hover:bg-emerald-100"
|
||||
@click="view = 'executable'"
|
||||
>
|
||||
<b class="block text-2xl leading-none text-emerald-600">{{ transfer.executableItems.value.length }}</b>
|
||||
<b class="mt-2 block text-sm font-bold text-primary">{{ $t('chat.transfer.homeExecutable') }}</b>
|
||||
<span class="mt-1 block text-xs text-secondary">{{ $t('chat.transfer.homeExecutableHint') }}</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
data-testid="transfer-home-recoverable"
|
||||
class="rounded-2xl border border-brand-200 bg-brand-50 p-4 text-left transition-colors hover:bg-brand-100"
|
||||
@click="view = 'backlog'"
|
||||
@click="openBacklog('recoverable')"
|
||||
>
|
||||
<b class="block text-2xl leading-none text-brand-600">{{ transfer.backlogSummary.value?.recoverable ?? 0 }}</b>
|
||||
<b class="mt-2 block text-sm font-bold text-primary">{{ $t('chat.transfer.homeRecoverable') }}</b>
|
||||
@@ -97,7 +134,7 @@ function goBack() {
|
||||
type="button"
|
||||
data-testid="transfer-home-closed"
|
||||
class="rounded-2xl border border-default bg-surface p-4 text-left transition-colors hover:border-brand-200 hover:bg-brand-50"
|
||||
@click="view = 'backlog'"
|
||||
@click="openBacklog('closed')"
|
||||
>
|
||||
<b class="block text-2xl leading-none text-secondary">{{ transfer.backlogSummary.value?.closed ?? 0 }}</b>
|
||||
<b class="mt-2 block text-sm font-bold text-primary">{{ $t('chat.transfer.homeClosed') }}</b>
|
||||
@@ -107,7 +144,7 @@ function goBack() {
|
||||
type="button"
|
||||
data-testid="transfer-home-unknown"
|
||||
class="rounded-2xl border border-amber-200 bg-amber-50 p-4 text-left transition-colors hover:bg-amber-100"
|
||||
@click="view = 'backlog'"
|
||||
@click="openBacklog('unknown')"
|
||||
>
|
||||
<b class="block text-2xl leading-none text-amber-600">{{ transfer.backlogSummary.value?.unknown ?? 0 }}</b>
|
||||
<b class="mt-2 block text-sm font-bold text-primary">{{ $t('chat.transfer.homeUnknown') }}</b>
|
||||
@@ -115,10 +152,21 @@ function goBack() {
|
||||
</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 已执行调拨单:统计卡片入口(点击跳转明细列表子视图) -->
|
||||
<section :aria-label="$t('chat.transfer.homeExecuted.title')">
|
||||
<p class="mb-2 text-sm font-bold text-secondary">{{ $t('chat.transfer.homeExecuted.title') }}</p>
|
||||
<TransferExecutedCards @open="openExecuted" />
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 子流程:复用自驱动的 TransferMessageView(预检宽表格需要全宽,上限对齐消息气泡宽布局) -->
|
||||
<!-- 已执行明细列表子视图(卡片下钻目标;返回回首页) -->
|
||||
<div v-else-if="view === 'executed'" class="w-full max-w-[min(96vw,1500px)] pr-2">
|
||||
<TransferExecutedOrders :initial-group="executedGroup" @back="goBack" />
|
||||
</div>
|
||||
|
||||
<!-- 子流程:复用自驱动的 TransferMessageView(宽表格需要全宽,上限对齐消息气泡宽布局) -->
|
||||
<div v-else class="w-full max-w-[min(96vw,1500px)] pr-2">
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!--
|
||||
features/chat/components/messages/TransferManualCloseDialog.vue
|
||||
用途:人工关闭弹窗(原因必填;关闭后永久排除,历史保留)。
|
||||
依赖:props(open/invoiceNo)、i18n chat.transfer.*。
|
||||
用途:人工关闭弹窗(原因必填;关闭后永久排除,历史保留);count>1 时按批量文案展示。
|
||||
依赖:props(open/invoiceNo/count)、i18n chat.transfer.*。
|
||||
逻辑:原因为空时确认按钮禁用;确认时 emit confirm(reason)。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
@@ -10,6 +10,8 @@ import { ref, watch } from 'vue';
|
||||
const props = defineProps<{
|
||||
open: boolean;
|
||||
invoiceNo: string;
|
||||
/** 批量关闭的行数;>1 时忽略 invoiceNo,标题/提示切换为批量文案。 */
|
||||
count?: number;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
@@ -34,8 +36,13 @@ watch(
|
||||
data-testid="transfer-manual-close-dialog"
|
||||
>
|
||||
<div class="w-full max-w-md rounded-2xl bg-surface p-5 shadow-xl">
|
||||
<h3 class="text-base font-bold text-primary">{{ $t('chat.transfer.manualCloseTitle') }}</h3>
|
||||
<p class="mt-1 text-xs text-muted">{{ invoiceNo }} · {{ $t('chat.transfer.manualCloseHint') }}</p>
|
||||
<h3 class="text-base font-bold text-primary">
|
||||
{{ $t(count && count > 1 ? 'chat.transfer.batchCloseTitle' : 'chat.transfer.manualCloseTitle', count && count > 1 ? { count } : {}) }}
|
||||
</h3>
|
||||
<p class="mt-1 text-xs text-muted">
|
||||
<template v-if="count && count > 1">{{ $t('chat.transfer.manualCloseHint') }}</template>
|
||||
<template v-else>{{ invoiceNo }} · {{ $t('chat.transfer.manualCloseHint') }}</template>
|
||||
</p>
|
||||
<textarea
|
||||
v-model="reason"
|
||||
rows="3"
|
||||
|
||||
+136
-44
@@ -1,38 +1,52 @@
|
||||
<!--
|
||||
features/chat/components/messages/TransferPrecheckCard.vue
|
||||
用途:预检卡——计数 + 来源失败提示 + 调拨明细表(含筛选)+ 勾选 + “直接生成调拨单”按钮。
|
||||
features/chat/components/messages/TransferMatchCard.vue
|
||||
用途:匹配卡——计数 + 来源失败提示 + 调拨明细表(含筛选)+ 勾选 + “直接生成调拨单”按钮。
|
||||
依赖:props(summary/items/sources/selected/busy)、i18n chat.transfer.*。
|
||||
逻辑:明细表渲染 filtered(关键字/结果筛选生效);阻断/未成熟项 checkbox 禁用;
|
||||
重查范围含可恢复阻断与可执行行;阻断原因经结果徽标 title 悬浮透出不占行高;
|
||||
无选择或 busy 时生成按钮禁用;emit execute(invoiceNos)(决策 4/5:无独立确认页);
|
||||
来源级解析/文件失败经 sources.error_code 透出(防"安静全 0")。
|
||||
勾选键 = 明细行 item_id(历史回放行无 item_id 禁用防误选);
|
||||
库存数量下方小字透出查询时刻(checked_at);stale 行置灰 + 重查提示;
|
||||
file_current=false 行提示文件已更新(自动对齐语义);blocked_file_removed
|
||||
徽标独立文案;pending_stock_check 行徽标「待查库存」(amber 与未成熟同色系);
|
||||
计数卡透出待查库存(pending_stock_check_count)/已失效(invalid_count),
|
||||
历史回放缺省按 0 展示;blocked_file_removed 行退出主视图(表格不渲染),
|
||||
表格下方折叠提示去待处理异常池处理——重查救不了已消失的行,主清单只留
|
||||
可行动项;重查范围含可恢复阻断与可执行行(重查仍按 invoice_no 提交);
|
||||
阻断原因经结果徽标 title 悬浮透出不占行高;无选择或 busy 时生成按钮禁用;
|
||||
emit execute(itemIds);来源级解析/文件失败经 sources.error_code 透出
|
||||
(防"安静全 0")。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { deriveBatchNo } from './transferBatch';
|
||||
import type { TransferPrecheckItem, TransferPrecheckSummary, TransferSourceProgress } from '../../types/transfer.types';
|
||||
import type { TransferMatchingItem, TransferMatchingSummary, TransferSourceProgress } from '../../types/transfer.types';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const props = defineProps<{
|
||||
summary: TransferPrecheckSummary;
|
||||
items: TransferPrecheckItem[];
|
||||
summary: TransferMatchingSummary;
|
||||
items: TransferMatchingItem[];
|
||||
sources?: TransferSourceProgress[];
|
||||
selected: Set<string>;
|
||||
/** 勾选集合(明细行 item_id);历史回放行无 item_id 不可选 */
|
||||
selected: Set<number>;
|
||||
busy?: boolean;
|
||||
requeryBusy?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
toggle: [invoiceNo: string, checked: boolean];
|
||||
'toggle-all': [invoiceNos: string[], checked: boolean];
|
||||
execute: [invoiceNos: string[]];
|
||||
toggle: [itemId: number, checked: boolean];
|
||||
'toggle-all': [itemIds: number[], checked: boolean];
|
||||
execute: [itemIds: number[]];
|
||||
requery: [invoiceNos: string[]];
|
||||
}>();
|
||||
|
||||
/** 勾选可用范围:有 item_id 且(可执行或可恢复阻断);无 item_id 的历史行禁用防误选。 */
|
||||
function hasSelectionKey(item: TransferMatchingItem): boolean {
|
||||
return item.item_id != null;
|
||||
}
|
||||
|
||||
const selectedCount = computed(() =>
|
||||
props.items.filter((item) => item.result === 'executable' && props.selected.has(item.invoice_no)).length,
|
||||
props.items.filter((item) => item.result === 'executable' && isChecked(item)).length,
|
||||
);
|
||||
const executeDisabled = computed(() => props.busy || selectedCount.value === 0);
|
||||
|
||||
@@ -45,26 +59,35 @@ const failedSources = computed(() =>
|
||||
const keyword = ref('');
|
||||
const resultFilter = ref<'all' | 'executable' | 'blocked' | 'not_matured'>('all');
|
||||
|
||||
function isBlocked(item: TransferPrecheckItem): boolean {
|
||||
function isBlocked(item: TransferMatchingItem): boolean {
|
||||
return String(item.result).startsWith('blocked_');
|
||||
}
|
||||
|
||||
/** 文件已移除的行:证据已失效,重查/重新匹配都救不了,退出主视图进待处理池。 */
|
||||
function isFileRemoved(item: TransferMatchingItem): boolean {
|
||||
return item.result === 'blocked_file_removed';
|
||||
}
|
||||
|
||||
/** 勾选可用范围:可执行(可生成调拨)或可恢复阻断(可重查 ERP)。 */
|
||||
function isSelectable(item: TransferPrecheckItem): boolean {
|
||||
function isSelectable(item: TransferMatchingItem): boolean {
|
||||
return item.result === 'executable';
|
||||
}
|
||||
|
||||
function isCheckable(item: TransferPrecheckItem): boolean {
|
||||
return isSelectable(item) || isBlocked(item);
|
||||
function isCheckable(item: TransferMatchingItem): boolean {
|
||||
return hasSelectionKey(item) && (isSelectable(item) || isBlocked(item));
|
||||
}
|
||||
|
||||
/** 可重查行:可恢复阻断 + 可执行(已可执行也允许重查核对最新库存)。 */
|
||||
function isRequeryable(item: TransferPrecheckItem): boolean {
|
||||
return isBlocked(item) || item.result === 'executable';
|
||||
/** 可重查行:可恢复阻断 + 可执行(文件已移除行除外——重查救不了已消失的行)。 */
|
||||
function isRequeryable(item: TransferMatchingItem): boolean {
|
||||
return (isBlocked(item) || item.result === 'executable') && !isFileRemoved(item);
|
||||
}
|
||||
|
||||
/** 已失效行(文件移除):主视图隐藏,仅以计数提示承载(去待处理池处理)。 */
|
||||
const removedRows = computed(() => props.items.filter(isFileRemoved));
|
||||
|
||||
const filtered = computed(() =>
|
||||
props.items.filter((item) => {
|
||||
if (isFileRemoved(item)) return false;
|
||||
const kw = keyword.value.trim().toLowerCase();
|
||||
if (kw) {
|
||||
const haystack = [item.material_no, item.material_name, item.invoice_no, item.lot_no]
|
||||
@@ -78,36 +101,59 @@ const filtered = computed(() =>
|
||||
}),
|
||||
);
|
||||
|
||||
const filteredInvoiceNos = computed(() => filtered.value.map((item) => item.invoice_no));
|
||||
/** 全选/批量提交范围:仅含拥有 item_id 的行(历史回放行无键不可参与)。 */
|
||||
const filteredItemIds = computed(() =>
|
||||
filtered.value.filter(hasSelectionKey).map((item) => item.item_id as number),
|
||||
);
|
||||
const allFilteredSelected = computed(() =>
|
||||
filteredInvoiceNos.value.length > 0 && filteredInvoiceNos.value.every((no) => props.selected.has(no)),
|
||||
filteredItemIds.value.length > 0 && filteredItemIds.value.every((id) => props.selected.has(id)),
|
||||
);
|
||||
const selectedRequeryableCount = computed(() =>
|
||||
filtered.value.filter((item) => isRequeryable(item) && props.selected.has(item.invoice_no)).length,
|
||||
filtered.value.filter((item) => isRequeryable(item) && isChecked(item)).length,
|
||||
);
|
||||
|
||||
function toggleAll(): void {
|
||||
emit('toggle-all', filteredInvoiceNos.value, !allFilteredSelected.value);
|
||||
emit('toggle-all', filteredItemIds.value, !allFilteredSelected.value);
|
||||
}
|
||||
|
||||
function requerySelected(): void {
|
||||
const nos = filtered.value
|
||||
.filter((item) => isRequeryable(item) && props.selected.has(item.invoice_no))
|
||||
.filter((item) => isRequeryable(item) && isChecked(item))
|
||||
.map((item) => item.invoice_no);
|
||||
if (nos.length) emit('requery', nos);
|
||||
}
|
||||
|
||||
function isChecked(item: TransferPrecheckItem): boolean {
|
||||
return props.selected.has(item.invoice_no);
|
||||
function isChecked(item: TransferMatchingItem): boolean {
|
||||
return item.item_id != null && props.selected.has(item.item_id);
|
||||
}
|
||||
|
||||
/** 生成调拨单提交范围:可执行且被勾选的明细行 id。 */
|
||||
const executableCheckedItemIds = computed(() =>
|
||||
props.items.filter((item) => isSelectable(item) && isChecked(item)).map((item) => item.item_id as number),
|
||||
);
|
||||
|
||||
/**
|
||||
* 库存查询时刻小字(HH:mm);无效/缺省 checked_at 返回 null 不渲染。
|
||||
* @param item 匹配明细行;checked_at 为后端 ISO 时间
|
||||
*/
|
||||
function checkedAtLabel(item: TransferMatchingItem): string | null {
|
||||
if (!item.checked_at) return null;
|
||||
const date = new Date(item.checked_at);
|
||||
if (Number.isNaN(date.getTime())) return null;
|
||||
const hh = String(date.getHours()).padStart(2, '0');
|
||||
const mm = String(date.getMinutes()).padStart(2, '0');
|
||||
return `${hh}:${mm}`;
|
||||
}
|
||||
|
||||
function resultLabel(result: string): string {
|
||||
const map: Record<string, string> = {
|
||||
executable: 'chat.transfer.resultExecutable',
|
||||
not_matured: 'chat.transfer.resultNotMatured',
|
||||
pending_stock_check: 'chat.transfer.resultPendingStockCheck',
|
||||
blocked_quantity_mismatch: 'chat.transfer.resultBlocked',
|
||||
blocked_inventory_not_found: 'chat.transfer.resultBlocked',
|
||||
blocked_future_date: 'chat.transfer.resultBlocked',
|
||||
blocked_file_removed: 'chat.transfer.resultFileRemoved',
|
||||
external_query_timeout: 'chat.transfer.resultUnknown',
|
||||
result_unknown: 'chat.transfer.resultUnknown',
|
||||
};
|
||||
@@ -122,7 +168,7 @@ const REASON_I18N_KEYS: Record<string, string> = {
|
||||
blocked_future_date: 'chat.transfer.reasonFutureDate',
|
||||
};
|
||||
|
||||
function reasonTitle(item: TransferPrecheckItem): string | undefined {
|
||||
function reasonTitle(item: TransferMatchingItem): string | undefined {
|
||||
if (!isBlocked(item) || !item.reason) return undefined;
|
||||
const key = REASON_I18N_KEYS[item.result];
|
||||
if (!key) return item.reason;
|
||||
@@ -136,13 +182,13 @@ function reasonTitle(item: TransferPrecheckItem): string | undefined {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="my-2 rounded-2xl border border-brand-100 bg-surface p-4 shadow-sm" data-testid="transfer-precheck-card">
|
||||
<div class="my-2 rounded-2xl border border-brand-100 bg-surface p-4 shadow-sm" data-testid="transfer-match-card">
|
||||
<div class="mb-3 flex flex-wrap items-center justify-between gap-3">
|
||||
<h3 class="text-sm font-bold text-primary">{{ $t('chat.transfer.precheckTitle') }}</h3>
|
||||
<h3 class="text-sm font-bold text-primary">{{ $t('chat.transfer.matchTitle') }}</h3>
|
||||
<span class="text-xs text-muted">{{ $t('chat.transfer.businessDate') }}:{{ summary.business_date }}</span>
|
||||
</div>
|
||||
|
||||
<div class="mb-3 grid grid-cols-2 gap-2 sm:grid-cols-5" data-testid="transfer-precheck-counts">
|
||||
<div class="mb-3 grid grid-cols-2 gap-2 sm:grid-cols-7" data-testid="transfer-match-counts">
|
||||
<div class="rounded-lg bg-surface-soft p-2 text-center">
|
||||
<div class="text-lg font-black text-brand-600">{{ summary.counts.executable_count }}</div>
|
||||
<div class="text-[11px] text-muted">{{ $t('chat.transfer.executableCount') }}</div>
|
||||
@@ -163,12 +209,22 @@ function reasonTitle(item: TransferPrecheckItem): string | undefined {
|
||||
<div class="text-lg font-black text-brand-600">{{ summary.estimated_external_write_count }}</div>
|
||||
<div class="text-[11px] text-muted">{{ $t('chat.transfer.estimatedExternalWrites') }}</div>
|
||||
</div>
|
||||
<!-- 待查库存:文件已落地、尚未查过 ERP 库存的行数(历史回放缺省 0) -->
|
||||
<div class="rounded-lg bg-surface-soft p-2 text-center">
|
||||
<div class="text-lg font-black text-secondary">{{ summary.counts.pending_stock_check_count ?? 0 }}</div>
|
||||
<div class="text-[11px] text-muted">{{ $t('chat.transfer.pendingStockCheckCount') }}</div>
|
||||
</div>
|
||||
<!-- 已失效:文件消失已出清的行数(不进默认视图,处理入口在待处理异常池) -->
|
||||
<div class="rounded-lg bg-surface-soft p-2 text-center">
|
||||
<div class="text-lg font-black text-muted">{{ summary.counts.invalid_count ?? 0 }}</div>
|
||||
<div class="text-[11px] text-muted">{{ $t('chat.transfer.invalidRowCount', { count: summary.counts.invalid_count ?? 0 }) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="failedSources.length"
|
||||
class="mb-3 rounded-lg border border-red-200 bg-red-50 p-3 text-xs text-red-700"
|
||||
data-testid="transfer-precheck-source-errors"
|
||||
data-testid="transfer-match-source-errors"
|
||||
>
|
||||
<div class="mb-1 font-bold">{{ $t('chat.transfer.sourceErrorTitle') }}</div>
|
||||
<div v-for="source in failedSources" :key="source.source_code" class="leading-5">
|
||||
@@ -182,9 +238,9 @@ function reasonTitle(item: TransferPrecheckItem): string | undefined {
|
||||
type="text"
|
||||
class="w-56 rounded-lg border border-default bg-surface px-2 py-1 text-xs text-primary"
|
||||
:placeholder="$t('chat.transfer.filterPlaceholder')"
|
||||
data-testid="transfer-precheck-filter"
|
||||
data-testid="transfer-match-filter"
|
||||
/>
|
||||
<select v-model="resultFilter" class="rounded-lg border border-default bg-surface px-2 py-1 text-xs text-primary" data-testid="transfer-precheck-result-filter">
|
||||
<select v-model="resultFilter" class="rounded-lg border border-default bg-surface px-2 py-1 text-xs text-primary" data-testid="transfer-match-result-filter">
|
||||
<option value="all">{{ $t('chat.transfer.filterAll') }}</option>
|
||||
<option value="executable">{{ $t('chat.transfer.resultExecutable') }}</option>
|
||||
<option value="blocked">{{ $t('chat.transfer.resultBlocked') }}</option>
|
||||
@@ -194,21 +250,21 @@ function reasonTitle(item: TransferPrecheckItem): string | undefined {
|
||||
type="button"
|
||||
class="rounded-lg border border-brand-200 bg-brand-50 px-3 py-1 text-xs font-bold text-brand-700 transition hover:bg-brand-100 disabled:cursor-not-allowed disabled:opacity-40"
|
||||
:disabled="props.requeryBusy || selectedRequeryableCount === 0"
|
||||
data-testid="transfer-precheck-requery-selected"
|
||||
data-testid="transfer-match-requery-selected"
|
||||
@click="requerySelected"
|
||||
>
|
||||
{{ $t('chat.transfer.requerySelected') }}{{ selectedRequeryableCount ? `(${selectedRequeryableCount})` : '' }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="overflow-x-auto">
|
||||
<table class="w-full min-w-[1100px] text-xs" data-testid="transfer-precheck-table">
|
||||
<table class="w-full min-w-[1100px] text-xs" data-testid="transfer-match-table">
|
||||
<thead>
|
||||
<tr class="border-b border-default bg-surface-soft text-left text-[11px] text-muted">
|
||||
<th class="p-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="allFilteredSelected"
|
||||
data-testid="transfer-precheck-select-all"
|
||||
data-testid="transfer-match-select-all"
|
||||
@change="toggleAll"
|
||||
/>
|
||||
</th>
|
||||
@@ -230,7 +286,7 @@ function reasonTitle(item: TransferPrecheckItem): string | undefined {
|
||||
v-for="item in filtered"
|
||||
:key="`${item.source_code}|${item.invoice_no}|${item.material_no}|${item.receipt_date ?? ''}`"
|
||||
class="border-b border-subtle"
|
||||
:class="{ 'bg-surface-soft text-muted': !isSelectable(item) }"
|
||||
:class="{ 'bg-surface-soft text-muted': !isSelectable(item), 'opacity-60': item.stale === true }"
|
||||
:data-testid="`transfer-item-${item.invoice_no}`"
|
||||
>
|
||||
<td class="p-2">
|
||||
@@ -239,7 +295,7 @@ function reasonTitle(item: TransferPrecheckItem): string | undefined {
|
||||
:checked="isChecked(item)"
|
||||
:disabled="!isCheckable(item) || busy"
|
||||
:data-testid="`transfer-check-${item.invoice_no}`"
|
||||
@change="emit('toggle', item.invoice_no, ($event.target as HTMLInputElement).checked)"
|
||||
@change="emit('toggle', item.item_id as number, ($event.target as HTMLInputElement).checked)"
|
||||
/>
|
||||
</td>
|
||||
<td class="p-2">{{ item.source_code }}</td>
|
||||
@@ -249,24 +305,50 @@ function reasonTitle(item: TransferPrecheckItem): string | undefined {
|
||||
<td class="p-2">{{ item.material_name }}</td>
|
||||
<td class="p-2">{{ item.from_warehouse }}</td>
|
||||
<td class="p-2">{{ deriveBatchNo(item.lot_no) }}</td>
|
||||
<td class="p-2">{{ item.from_quantity ?? '—' }}</td>
|
||||
<td class="p-2">
|
||||
<div>{{ item.from_quantity ?? '—' }}</div>
|
||||
<!-- 库存查询时刻小字:数据新鲜度溯源(stale 门禁的可见依据) -->
|
||||
<div
|
||||
v-if="checkedAtLabel(item)"
|
||||
class="text-[10px] text-muted"
|
||||
:title="$t('chat.transfer.stockCheckedAtTitle', { time: checkedAtLabel(item) })"
|
||||
:data-testid="`transfer-checked-at-${item.invoice_no}`"
|
||||
>
|
||||
{{ checkedAtLabel(item) }}
|
||||
</div>
|
||||
</td>
|
||||
<td class="p-2">{{ item.to_warehouse }}</td>
|
||||
<td class="p-2">{{ item.to_quantity }}</td>
|
||||
<td class="p-2">
|
||||
<div class="flex items-center gap-1">
|
||||
<div class="flex flex-wrap items-center gap-1">
|
||||
<!-- 阻断原因经悬浮提示(title)透出:不占行高;可执行行也提供重查入口 -->
|
||||
<span
|
||||
class="rounded-full px-2 py-0.5 font-bold"
|
||||
:class="{
|
||||
'bg-emerald-50 text-emerald-700': item.result === 'executable',
|
||||
'bg-amber-50 text-amber-700': item.result === 'not_matured',
|
||||
'bg-red-50 text-red-700': !isSelectable(item) && item.result !== 'not_matured',
|
||||
'bg-amber-50 text-amber-700': item.result === 'not_matured' || item.result === 'pending_stock_check',
|
||||
'bg-red-50 text-red-700': !isSelectable(item) && item.result !== 'not_matured' && item.result !== 'pending_stock_check',
|
||||
}"
|
||||
:title="reasonTitle(item)"
|
||||
data-testid="transfer-item-result"
|
||||
>
|
||||
{{ $t(resultLabel(item.result)) }}
|
||||
</span>
|
||||
<!-- 行级警示小标:stale(仅展示提示,不拦截执行——2026-09-25 TTL 退役)/ 文件版本已过期 -->
|
||||
<span
|
||||
v-if="item.stale === true"
|
||||
class="rounded border border-amber-300 px-1 py-0.5 text-[10px] text-amber-700"
|
||||
data-testid="transfer-item-stale"
|
||||
>
|
||||
{{ $t('chat.transfer.staleRow') }}
|
||||
</span>
|
||||
<span
|
||||
v-if="item.file_current === false"
|
||||
class="rounded border border-amber-300 px-1 py-0.5 text-[10px] text-amber-700"
|
||||
data-testid="transfer-item-file-changed"
|
||||
>
|
||||
{{ $t('chat.transfer.fileChangedRow') }}
|
||||
</span>
|
||||
<button
|
||||
v-if="isRequeryable(item)"
|
||||
type="button"
|
||||
@@ -284,6 +366,16 @@ function reasonTitle(item: TransferPrecheckItem): string | undefined {
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- 已失效行折叠提示:文件移除的行退出主视图(证据已失效不可行动),
|
||||
引导去待处理异常池处理(可「标记无需继续处理」),不在主清单占位。 -->
|
||||
<div
|
||||
v-if="removedRows.length"
|
||||
class="mt-2 rounded-lg bg-surface-soft px-3 py-2 text-[11px] text-muted"
|
||||
data-testid="transfer-file-removed-hint"
|
||||
>
|
||||
{{ $t('chat.transfer.fileRemovedQuarantined', { count: removedRows.length }) }}
|
||||
</div>
|
||||
|
||||
<div class="mt-3 flex items-center justify-end gap-3 border-t border-subtle pt-3">
|
||||
<span class="text-xs text-muted">
|
||||
{{ $t('chat.transfer.selectedCount', { count: selectedCount }) }} ·
|
||||
@@ -294,7 +386,7 @@ function reasonTitle(item: TransferPrecheckItem): string | undefined {
|
||||
class="rounded-lg bg-brand-600 px-4 py-1.5 text-sm font-bold text-white hover:bg-brand-700 disabled:cursor-not-allowed disabled:opacity-40"
|
||||
:disabled="executeDisabled"
|
||||
:data-testid="'transfer-generate-button'"
|
||||
@click="emit('execute', items.filter(isSelectable).filter(isChecked).map((item) => item.invoice_no))"
|
||||
@click="emit('execute', executableCheckedItemIds)"
|
||||
>
|
||||
{{ $t('chat.transfer.generateTransfer') }}
|
||||
</button>
|
||||
@@ -1,8 +1,9 @@
|
||||
/**
|
||||
* features/chat/components/messages/TransferMessageView.spec.ts
|
||||
* 用途:验证卡片自驱动接线——预检卡渲染、点“直接生成调拨单”真实调 API 并切换结果卡、
|
||||
* 用途:验证卡片自驱动接线——匹配卡渲染(勾选键 = 明细 item_id)、点“生成调拨单”
|
||||
* 真实调 /items/execute 并切换结果卡、恢复处理 = 批量重查(不跳匹配卡)、
|
||||
* 下载按钮调 requestBlob 封装、结果页无审计入口。
|
||||
* 依赖:vi.mock(transfer.api)、@vue/test-utils、i18n。
|
||||
* 依赖:vi.mock(transfer.api)、vi.mock(useMessage)、@vue/test-utils、i18n。
|
||||
* 逻辑:Mock API 断言调用参数与状态切换(对应后端 197 项测试的契约面)。
|
||||
*/
|
||||
import { mount, flushPromises } from '@vue/test-utils';
|
||||
@@ -10,40 +11,59 @@ import { describe, expect, it, vi, beforeEach } from 'vitest';
|
||||
import i18n from '@/i18n';
|
||||
|
||||
const api = vi.hoisted(() => ({
|
||||
createTransferPrecheck: vi.fn(),
|
||||
getTransferPrecheck: vi.fn(),
|
||||
executeTransferPrecheck: vi.fn(),
|
||||
createTransferMatching: vi.fn(),
|
||||
getTransferMatching: vi.fn(),
|
||||
listExecutableTransferItems: vi.fn(),
|
||||
executeTransferItems: vi.fn(),
|
||||
getTransferRun: vi.fn(),
|
||||
retryTransferOrder: vi.fn(),
|
||||
retryTransferItem: vi.fn(),
|
||||
manualCloseTransferItem: vi.fn(),
|
||||
batchRequeryTransferItems: vi.fn(),
|
||||
batchManualCloseTransferItems: vi.fn(),
|
||||
downloadTransferReceiptFiles: vi.fn(),
|
||||
downloadTransferErpInventory: vi.fn(),
|
||||
downloadTransferExceptions: vi.fn(),
|
||||
listTransferBacklog: vi.fn(),
|
||||
getTransferBacklogSummary: vi.fn(),
|
||||
listTransferSources: vi.fn(),
|
||||
retriggerTransferDocument: vi.fn(),
|
||||
closeTransferDocument: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('@/features/chat/api/transfer.api', () => api);
|
||||
|
||||
const messageMocks = vi.hoisted(() => ({
|
||||
success: vi.fn(),
|
||||
error: vi.fn(),
|
||||
warning: vi.fn(),
|
||||
info: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('@/shared/composables/useMessage', () => ({
|
||||
useMessage: () => messageMocks,
|
||||
}));
|
||||
|
||||
import TransferMessageView from './TransferMessageView.vue';
|
||||
import { eligibleReceiptDateTo } from './transferDate';
|
||||
|
||||
const payload = {
|
||||
kind: 'precheck',
|
||||
kind: 'match',
|
||||
summary: {
|
||||
precheck_id: 'TPC-1',
|
||||
matching_id: 'MTG-1',
|
||||
status: 'ready_to_execute',
|
||||
business_date: '2026-08-06',
|
||||
eligible_receipt_date_to: '2026-08-05',
|
||||
expires_at: '',
|
||||
counts: { file_invoice_count: 1, not_matured_count: 0, prechecked_count: 1, executable_count: 1, blocked_count: 0 },
|
||||
counts: { file_invoice_count: 1, not_matured_count: 0, matched_count: 1, executable_count: 1, blocked_count: 0 },
|
||||
estimated_transfer_quantity: '1200',
|
||||
estimated_external_write_count: 1,
|
||||
precheck_hash: 'sha256:x',
|
||||
matching_hash: 'sha256:x',
|
||||
},
|
||||
items: [{
|
||||
item_id: 101,
|
||||
source_code: 'DBS-AWSBI', material_no: 'MAT-1', material_name: '连接器组件', specification: 'A',
|
||||
invoice_no: 'INV-001', from_warehouse: 'DBS-TRANSIT', from_quantity: '1200',
|
||||
invoice_no: 'INV-001', receipt_date: '2026-08-05', from_warehouse: 'DBS-TRANSIT', from_quantity: '1200',
|
||||
to_warehouse: 'HUB-CN01', to_quantity: '1200', result: 'executable',
|
||||
}],
|
||||
sources: [{ source_code: 'DBS-AWSBI', stage: 'file_ready', file_no: 'REC-1' }],
|
||||
@@ -70,29 +90,29 @@ const runPayload = {
|
||||
describe('TransferMessageView self-driving wiring', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
api.executeTransferPrecheck.mockResolvedValue({ run_no: 'RUN-1', status: 'success' });
|
||||
api.executeTransferItems.mockResolvedValue({ run_no: 'RUN-1', status: 'success' });
|
||||
api.getTransferRun.mockResolvedValue(runPayload.run);
|
||||
api.downloadTransferReceiptFiles.mockResolvedValue({ blob: new Blob(['z']), filename: 'r.zip' });
|
||||
api.downloadTransferErpInventory.mockResolvedValue({ blob: new Blob(['c']), filename: 'e.csv' });
|
||||
});
|
||||
|
||||
it('预检 payload 渲染预检卡,且默认勾选可执行项', () => {
|
||||
it('匹配 payload 渲染匹配卡,且默认按 item_id 勾选可执行行', () => {
|
||||
const wrapper = mount(TransferMessageView, {
|
||||
props: { payload },
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
expect(wrapper.find('[data-testid="transfer-precheck-card"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="transfer-match-card"]').exists()).toBe(true);
|
||||
expect((wrapper.find('[data-testid="transfer-check-INV-001"]').element as HTMLInputElement).checked).toBe(true);
|
||||
});
|
||||
|
||||
it('点击“直接生成调拨单”调用 execute API 并切换为结果卡', async () => {
|
||||
it('点击“生成调拨单”按明细行 id 调 /items/execute 并切换为结果卡', async () => {
|
||||
const wrapper = mount(TransferMessageView, {
|
||||
props: { payload },
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
await wrapper.find('[data-testid="transfer-generate-button"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(api.executeTransferPrecheck).toHaveBeenCalledWith('TPC-1', ['INV-001']);
|
||||
expect(api.executeTransferItems).toHaveBeenCalledWith([101]);
|
||||
expect(wrapper.find('[data-testid="transfer-result-card"]').exists()).toBe(true);
|
||||
});
|
||||
|
||||
@@ -116,10 +136,12 @@ describe('TransferMessageView self-driving wiring', () => {
|
||||
expect(wrapper.text()).not.toContain('审计');
|
||||
});
|
||||
|
||||
it('backlog 视图拉取待处理列表,重试/关闭调用对应 API', async () => {
|
||||
it('backlog 视图拉取待处理列表,行级重查/关闭调用对应 API', async () => {
|
||||
api.listTransferBacklog.mockResolvedValue([{
|
||||
item_id: 7, source_code: 'DBS-AWSBI', invoice_no: 'INV-001', material_no: 'MAT-1',
|
||||
status: 'blocked_recoverable', reason: '收料 1200 / ERP 1000', age_days: 1, aging_level: 'normal',
|
||||
receipt_date: '2026-08-05', material_name: '连接器组件', from_warehouse: 'DBS-TRANSIT',
|
||||
to_warehouse: 'HUB-CN01', lot_no: 'LOT-10', receipt_quantity: '1200', external_quantity: '1000',
|
||||
}]);
|
||||
api.getTransferBacklogSummary.mockResolvedValue({
|
||||
recoverable: 1, closed: 0, unknown: 0, aging: { warn_3d: 0, escalate_5d: 0, critical_7d: 0 },
|
||||
@@ -135,23 +157,156 @@ describe('TransferMessageView self-driving wiring', () => {
|
||||
expect(wrapper.find('[data-testid="transfer-backlog-card"]').exists()).toBe(true);
|
||||
expect(wrapper.text()).toContain('INV-001');
|
||||
|
||||
await wrapper.find('[data-testid="transfer-backlog-retry"]').trigger('click');
|
||||
// 行级重查(原「重新查询 ERP」改名「重查」,复用单行端点)。
|
||||
await wrapper.find('[data-testid="transfer-backlog-requery-INV-001"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(api.retryTransferItem).toHaveBeenCalledWith(7);
|
||||
|
||||
await wrapper.find('[data-testid="transfer-backlog-close"]').trigger('click');
|
||||
// 行级关闭:弹窗原因必填后提交。
|
||||
await wrapper.find('[data-testid="transfer-backlog-close-INV-001"]').trigger('click');
|
||||
await wrapper.find('[data-testid="transfer-close-reason"]').setValue('线下已处理');
|
||||
await wrapper.find('[data-testid="transfer-close-confirm"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(api.manualCloseTransferItem).toHaveBeenCalledWith(7, '线下已处理');
|
||||
});
|
||||
|
||||
it('来源实例选择:加载列表 → 确认范围 → 创建预检并切换预检卡', async () => {
|
||||
it('backlog 批量:勾选后操作条出现,重查/恢复/批量关闭调用对应端点', async () => {
|
||||
api.listTransferBacklog.mockResolvedValue([
|
||||
{ item_id: 7, source_code: 'DBS-AWSBI', invoice_no: 'INV-001', material_no: 'MAT-1', status: 'blocked_recoverable', reason: '', age_days: 0, aging_level: 'normal' },
|
||||
{ item_id: 8, source_code: 'DBS-AWSBI', invoice_no: 'INV-002', material_no: 'MAT-2', status: 'result_unknown', reason: '', age_days: 2, aging_level: 'result_unknown' },
|
||||
]);
|
||||
api.getTransferBacklogSummary.mockResolvedValue({
|
||||
recoverable: 1, closed: 0, unknown: 1, aging: { warn_3d: 0, escalate_5d: 0, critical_7d: 0 },
|
||||
});
|
||||
api.batchRequeryTransferItems.mockResolvedValue({ total: 1, results: [{ item_id: 7, ok: true, status: 'ready_to_execute' }] });
|
||||
api.batchManualCloseTransferItems.mockResolvedValue({ total: 1, results: [{ item_id: 7, ok: true, status: 'manually_closed' }] });
|
||||
|
||||
const wrapper = mount(TransferMessageView, {
|
||||
props: { payload: { kind: 'backlog' } },
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
await flushPromises();
|
||||
|
||||
// result_unknown 行 checkbox 禁用(只读隔离)。
|
||||
expect((wrapper.find('[data-testid="transfer-backlog-check-INV-002"]').element as HTMLInputElement).disabled).toBe(true);
|
||||
// 未勾选时批量操作条不存在。
|
||||
expect(wrapper.find('[data-testid="transfer-backlog-batch-requery"]').exists()).toBe(false);
|
||||
|
||||
await wrapper.find('[data-testid="transfer-backlog-check-INV-001"]').setValue(true);
|
||||
expect(wrapper.find('[data-testid="transfer-backlog-batch-requery"]').exists()).toBe(true);
|
||||
|
||||
await wrapper.find('[data-testid="transfer-backlog-batch-requery"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(api.batchRequeryTransferItems).toHaveBeenCalledWith([7]);
|
||||
|
||||
// 恢复处理(批量)= 同一批量重查端点(恢复的唯一后端)。
|
||||
await wrapper.find('[data-testid="transfer-backlog-check-INV-001"]').setValue(true);
|
||||
await wrapper.find('[data-testid="transfer-backlog-batch-resume"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(api.batchRequeryTransferItems).toHaveBeenCalledWith([7]);
|
||||
|
||||
await wrapper.find('[data-testid="transfer-backlog-check-INV-001"]').setValue(true);
|
||||
await wrapper.find('[data-testid="transfer-backlog-batch-close"]').trigger('click');
|
||||
await wrapper.find('[data-testid="transfer-close-reason"]').setValue('整批线下处理');
|
||||
await wrapper.find('[data-testid="transfer-close-confirm"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(api.batchManualCloseTransferItems).toHaveBeenCalledWith([7], '整批线下处理');
|
||||
});
|
||||
|
||||
it('backlog 结果徽标:blocked_file_removed 行显示「文件已移除」,普通阻断仍为「已阻断」', async () => {
|
||||
// [断言意图] F1(2026-09-23 评审修复):backlog 行带 result_code 后,
|
||||
// 收料行已从最新文件移除(blocked_file_removed)的行必须与普通数量阻断区分展示。
|
||||
api.listTransferBacklog.mockResolvedValue([
|
||||
{ item_id: 9, source_code: 'DBS-AWSBI', invoice_no: 'INV-009', material_no: 'MAT-9', status: 'blocked_recoverable', result_code: 'blocked_file_removed', reason: '收料行已从最新文件移除', age_days: 0, aging_level: 'normal' },
|
||||
{ item_id: 10, source_code: 'DBS-AWSBI', invoice_no: 'INV-010', material_no: 'MAT-10', status: 'blocked_recoverable', result_code: 'blocked_quantity_mismatch', reason: '收料 300 / ERP 280', age_days: 0, aging_level: 'normal' },
|
||||
]);
|
||||
api.getTransferBacklogSummary.mockResolvedValue({
|
||||
recoverable: 2, closed: 0, unknown: 0, aging: { warn_3d: 0, escalate_5d: 0, critical_7d: 0 },
|
||||
});
|
||||
|
||||
const wrapper = mount(TransferMessageView, {
|
||||
props: { payload: { kind: 'backlog' } },
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
await flushPromises();
|
||||
const removedBadge = wrapper.find('[data-testid="transfer-backlog-INV-009"] [data-testid="transfer-backlog-result"]');
|
||||
const normalBadge = wrapper.find('[data-testid="transfer-backlog-INV-010"] [data-testid="transfer-backlog-result"]');
|
||||
expect(removedBadge.text()).toContain('文件已移除');
|
||||
expect(normalBadge.text()).toContain('已阻断');
|
||||
expect(normalBadge.text()).not.toContain('文件已移除');
|
||||
});
|
||||
|
||||
it('可调拨明细视图:加载全局可执行行,勾选后按行生成调拨单', async () => {
|
||||
// [断言意图] 行归属解耦后的执行入口:executable 视图聚合全部可执行行,
|
||||
// 勾选(item_id)→ /items/execute → 结果卡,恢复后的行在此闭环。
|
||||
api.listExecutableTransferItems.mockResolvedValue({ items: [{
|
||||
item_id: 77, source_code: 'DBS-AWSBI', material_no: 'MAT-1', material_name: '连接器组件', specification: 'A',
|
||||
invoice_no: 'INV-001', from_warehouse: 'DBS-TRANSIT', from_quantity: '1200',
|
||||
to_warehouse: 'HUB-CN01', to_quantity: '1200', result: 'executable',
|
||||
checked_at: '2026-09-23T10:21:00', stale: false, file_current: true,
|
||||
}], counts: { executable_count: 1 } });
|
||||
api.executeTransferItems.mockResolvedValue({ run_no: 'RUN-9', status: 'success' });
|
||||
api.getTransferRun.mockResolvedValue(runPayload.run);
|
||||
|
||||
const wrapper = mount(TransferMessageView, {
|
||||
props: { payload: { kind: 'executable' } },
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
await flushPromises();
|
||||
expect(api.listExecutableTransferItems).toHaveBeenCalled();
|
||||
expect(wrapper.find('[data-testid="transfer-executable-card"]').exists()).toBe(true);
|
||||
|
||||
await wrapper.find('[data-testid="transfer-executable-check-INV-001"]').setValue(true);
|
||||
await wrapper.find('[data-testid="transfer-executable-generate"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(api.executeTransferItems).toHaveBeenCalledWith([77]);
|
||||
expect(wrapper.find('[data-testid="transfer-result-card"]').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('恢复处理(恢复=重查):按明细 id 调 batch-requery,留在待处理池并统计提示', async () => {
|
||||
// [断言意图] 行式执行重构(2026-09-23):恢复处理不再重建/打开匹配卡,
|
||||
// 语义收敛为按明细 id 重查库存;结果按 status 统计(ready_to_execute=已恢复),
|
||||
// 完成后留在待处理池(fail-closed),toast 汇总 recovered/blocked。
|
||||
api.listTransferBacklog.mockResolvedValue([
|
||||
{ item_id: 7, source_code: 'DBS-AWSBI', invoice_no: 'INV-001', material_no: 'MAT-1', status: 'blocked_recoverable', reason: '', age_days: 0, aging_level: 'normal' },
|
||||
{ item_id: 8, source_code: 'DBS-AWSBI', invoice_no: 'INV-002', material_no: 'MAT-2', status: 'blocked_recoverable', reason: '', age_days: 1, aging_level: 'normal' },
|
||||
]);
|
||||
api.getTransferBacklogSummary.mockResolvedValue({
|
||||
recoverable: 2, closed: 0, unknown: 0, aging: { warn_3d: 0, escalate_5d: 0, critical_7d: 0 },
|
||||
});
|
||||
api.batchRequeryTransferItems.mockResolvedValue({
|
||||
total: 2,
|
||||
results: [
|
||||
{ item_id: 7, invoice_no: 'INV-001', ok: true, status: 'ready_to_execute' },
|
||||
{ item_id: 8, invoice_no: 'INV-002', ok: true, status: 'blocked_recoverable' },
|
||||
],
|
||||
});
|
||||
|
||||
const wrapper = mount(TransferMessageView, {
|
||||
props: { payload: { kind: 'backlog' } },
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
await flushPromises();
|
||||
await wrapper.find('[data-testid="transfer-backlog-check-INV-001"]').setValue(true);
|
||||
await wrapper.find('[data-testid="transfer-backlog-batch-resume"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(api.batchRequeryTransferItems).toHaveBeenCalledWith([7]);
|
||||
expect(api.getTransferMatching).not.toHaveBeenCalled();
|
||||
expect(wrapper.find('[data-testid="transfer-match-card"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="transfer-backlog-card"]').exists()).toBe(true);
|
||||
// 恢复统计 toast:1 笔已可执行 · 1 笔仍阻断。
|
||||
expect(messageMocks.success).toHaveBeenCalledTimes(1);
|
||||
const toastText = String(messageMocks.success.mock.calls[0][0]);
|
||||
expect(toastText).toContain('可执行');
|
||||
expect(toastText).toContain('仍阻断');
|
||||
});
|
||||
|
||||
it('来源实例选择:加载列表 → 确认范围 → 创建匹配并切换匹配卡(默认携带 D+1 日期范围)', async () => {
|
||||
api.listTransferSources.mockResolvedValue([
|
||||
{ source_code: 'DBS-AWSBI', display_name: 'AWSBI', platform: 'dbs', enabled: true, has_ready_file: true, file_status: 'ready' },
|
||||
]);
|
||||
api.createTransferPrecheck.mockResolvedValue(payload.summary);
|
||||
api.getTransferPrecheck.mockResolvedValue({
|
||||
api.createTransferMatching.mockResolvedValue(payload.summary);
|
||||
api.getTransferMatching.mockResolvedValue({
|
||||
summary: payload.summary,
|
||||
items: payload.items,
|
||||
sources: payload.sources,
|
||||
@@ -167,7 +322,263 @@ describe('TransferMessageView self-driving wiring', () => {
|
||||
await wrapper.find('[data-testid="transfer-source-option-DBS-AWSBI"] input').setValue(true);
|
||||
await wrapper.find('[data-testid="transfer-source-confirm"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(api.createTransferPrecheck).toHaveBeenCalledWith({ source_codes: ['DBS-AWSBI'], transfer_type: 'in_transit_to_hub' });
|
||||
expect(wrapper.find('[data-testid="transfer-precheck-card"]').exists()).toBe(true);
|
||||
const cutoff = eligibleReceiptDateTo();
|
||||
expect(api.createTransferMatching).toHaveBeenCalledWith({
|
||||
source_codes: ['DBS-AWSBI'], business_date: undefined,
|
||||
receipt_date_from: cutoff, receipt_date_to: cutoff,
|
||||
transfer_type: 'in_transit_to_hub',
|
||||
});
|
||||
expect(wrapper.find('[data-testid="transfer-match-card"]').exists()).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Task 13 融合卡(D9:调拨单清单=进度=结果):T0 全待处理 / T1 逐单徽标+轮询 /
|
||||
// T2 终态动作 / result_unknown 重新触发(D11)/ 失败行关闭单(D18)/ 重查库存 /
|
||||
// 门禁 4xx 行内报错 / 无取消执行入口。
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
const t13Line = (materialNo: string, name: string, lot: string, qty: string, reason?: string) => ({
|
||||
material_no: materialNo, material_name: name, lot_no: lot, quantity: qty, unit: 'KG',
|
||||
// [P2-3 契约扩充] 后端失败/未知单行带行级 reason(= 行级 result_message);缺省=无行级原因态
|
||||
...(reason ? { reason } : {}),
|
||||
});
|
||||
|
||||
function t13Run(status: string, orders: Array<Record<string, unknown>>) {
|
||||
return {
|
||||
run_no: 'RUN-T13', status,
|
||||
result: { external_documents: [], exceptions: [] },
|
||||
orders,
|
||||
};
|
||||
}
|
||||
|
||||
/** T0:提交后立即(单已建好,全部待处理)。 */
|
||||
const t13Pending = t13Run('queued', [
|
||||
{
|
||||
doc_no: 'HTT-OR-1', receipt_date: '2026-09-23', from_warehouse: 'B25', to_warehouse: 'B02',
|
||||
status: 'pending', erp_document_no: null, error_message: null,
|
||||
lines: [t13Line('M001', '材料甲', 'V1', '100.000000'), t13Line('M002', '材料乙', 'V2', '500.000000')],
|
||||
},
|
||||
{
|
||||
doc_no: 'HTT-OR-2', receipt_date: '2026-09-19', from_warehouse: 'B25', to_warehouse: 'B02',
|
||||
status: 'pending', erp_document_no: null, error_message: null,
|
||||
lines: [t13Line('M003', '材料丙', 'V3', '55.000000')],
|
||||
},
|
||||
]);
|
||||
|
||||
/** T1:执行中(轮询刷新,逐单亮结果)。 */
|
||||
const t13Executing = t13Run('executing', [
|
||||
{
|
||||
doc_no: 'D-EXE', receipt_date: '2026-09-23', from_warehouse: 'B25', to_warehouse: 'B02',
|
||||
status: 'executing', erp_document_no: null, error_message: null,
|
||||
lines: [t13Line('M001', '材料甲', 'V1', '100.000000')],
|
||||
},
|
||||
{
|
||||
doc_no: 'D-OK', receipt_date: '2026-09-19', from_warehouse: 'B25', to_warehouse: 'B02',
|
||||
status: 'success', erp_document_no: '1401-2609230008', error_message: null, lines: [],
|
||||
},
|
||||
{
|
||||
doc_no: 'D-BUS', receipt_date: '2026-09-21', from_warehouse: 'B25', to_warehouse: 'B02',
|
||||
status: 'business_failed', erp_document_no: null, error_message: null,
|
||||
lines: [t13Line('M003', '材料丙', 'V3', '55.000000')],
|
||||
},
|
||||
]);
|
||||
|
||||
/** T2:终态部分失败(成功 + 结果未知 + 业务失败)。 */
|
||||
const t13Partial = t13Run('partial_failed', [
|
||||
{
|
||||
doc_no: 'D-OK', receipt_date: '2026-09-23', from_warehouse: 'B25', to_warehouse: 'B02',
|
||||
status: 'success', erp_document_no: '1401-2609230007', error_message: null,
|
||||
lines: [t13Line('M001', '材料甲', 'V1', '100.000000')],
|
||||
},
|
||||
{
|
||||
doc_no: 'D-UNK', receipt_date: '2026-09-20', from_warehouse: 'B25', to_warehouse: 'B02',
|
||||
status: 'result_unknown', erp_document_no: null, error_message: null,
|
||||
lines: [t13Line('M002', '材料乙', 'V2', '500.000000')],
|
||||
},
|
||||
{
|
||||
doc_no: 'D-FAIL', receipt_date: '2026-09-21', from_warehouse: 'B25', to_warehouse: 'B02',
|
||||
status: 'business_failed', erp_document_no: null, error_message: null,
|
||||
lines: [t13Line('MAT-1', '连接器组件', 'LOT-10', '1200.000000', '料号无有效成本')],
|
||||
},
|
||||
]);
|
||||
|
||||
function mountRunView() {
|
||||
return mount(TransferMessageView, {
|
||||
props: { payload: { kind: 'run', run_no: 'RUN-T13' } },
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
}
|
||||
|
||||
describe('融合卡(Task 13):调拨单清单=进度=结果', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
api.executeTransferItems.mockResolvedValue({ run_no: 'RUN-T13', status: 'queued' });
|
||||
api.retriggerTransferDocument.mockResolvedValue({ run_no: 'RUN-T13', doc_no: 'D-UNK', status: 'queued' });
|
||||
api.closeTransferDocument.mockResolvedValue({ status: 'cancelled' });
|
||||
api.batchRequeryTransferItems.mockResolvedValue({
|
||||
total: 1, results: [{ item_id: 101, ok: true, status: 'ready_to_execute' }],
|
||||
});
|
||||
});
|
||||
|
||||
it('T0 全待处理:卡顶「排队中」,单行=收料日期·仓库·物料数·合计+待处理徽标,行明细常驻展开,非终态无下载区', async () => {
|
||||
api.getTransferRun.mockResolvedValue(t13Pending);
|
||||
const wrapper = mountRunView();
|
||||
await flushPromises();
|
||||
expect(wrapper.find('[data-testid="transfer-result-card"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="transfer-run-badge"]').text()).toContain('排队中');
|
||||
const summary = wrapper.find('[data-testid="transfer-order-summary-HTT-OR-1"]');
|
||||
expect(summary.exists()).toBe(true);
|
||||
expect(summary.text()).toContain('2026-09-23');
|
||||
expect(summary.text()).toContain('B25');
|
||||
expect(summary.text()).toContain('B02');
|
||||
expect(summary.text()).toContain('2 项物料');
|
||||
expect(summary.text()).toContain('600');
|
||||
expect(wrapper.find('[data-testid="transfer-order-status-HTT-OR-1"]').text()).toContain('待处理');
|
||||
// 行明细常驻展开:不做任何点击即可见物料行
|
||||
const row = wrapper.find('[data-testid="transfer-order-HTT-OR-1"]');
|
||||
expect(row.text()).toContain('材料甲');
|
||||
expect(row.text()).toContain('材料乙');
|
||||
// 非终态不出现下载动作区
|
||||
expect(wrapper.find('[data-testid="transfer-result-downloads"]').exists()).toBe(false);
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
it('T1 执行中:4s 轮询逐单亮徽标(单号/执行中/失败),卡顶汇总「执行中」;单次失败保留旧值并显示连接中', async () => {
|
||||
vi.useFakeTimers();
|
||||
try {
|
||||
api.getTransferRun.mockResolvedValueOnce(t13Pending).mockResolvedValueOnce(t13Executing);
|
||||
const wrapper = mountRunView();
|
||||
await vi.advanceTimersByTimeAsync(0); // 初始帧:全待处理
|
||||
expect(wrapper.find('[data-testid="transfer-run-badge"]').text()).toContain('排队中');
|
||||
await vi.advanceTimersByTimeAsync(4000); // 4s 轮询帧:逐单亮结果
|
||||
expect(wrapper.find('[data-testid="transfer-run-badge"]').text()).toContain('执行中');
|
||||
expect(wrapper.find('[data-testid="transfer-order-status-D-OK"]').text()).toContain('1401-2609230008');
|
||||
expect(wrapper.find('[data-testid="transfer-order-status-D-EXE"]').text()).toContain('执行中');
|
||||
expect(wrapper.find('[data-testid="transfer-order-status-D-BUS"]').text()).toContain('失败');
|
||||
// 单次轮询失败:显示「连接中」,旧单面保留不清空
|
||||
api.getTransferRun.mockRejectedValueOnce(new Error('network down'));
|
||||
await vi.advanceTimersByTimeAsync(4000);
|
||||
expect(wrapper.find('[data-testid="transfer-poll-connecting"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="transfer-order-status-D-OK"]').exists()).toBe(true);
|
||||
wrapper.unmount();
|
||||
} finally {
|
||||
vi.useRealTimers();
|
||||
}
|
||||
});
|
||||
|
||||
it('T2 终态:卡顶「部分失败」+下载区;失败行有重查+关闭单;result_unknown 行仅有重新触发(D11 无关闭入口);无取消执行入口', async () => {
|
||||
api.getTransferRun.mockResolvedValue(t13Partial);
|
||||
const wrapper = mountRunView();
|
||||
await flushPromises();
|
||||
expect(wrapper.find('[data-testid="transfer-run-badge"]').text()).toContain('部分失败');
|
||||
expect(wrapper.find('[data-testid="transfer-result-downloads"]').exists()).toBe(true);
|
||||
// result_unknown 行:仅 [重新触发],无 [关闭单](D11 禁闭)
|
||||
expect(wrapper.find('[data-testid="transfer-order-retrigger-D-UNK"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="transfer-order-close-D-UNK"]').exists()).toBe(false);
|
||||
// business_failed 行:[重试] + [关闭调拨单],无 [重新触发]
|
||||
expect(wrapper.find('[data-testid="transfer-order-retry-D-FAIL"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="transfer-order-close-D-FAIL"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="transfer-order-retrigger-D-FAIL"]').exists()).toBe(false);
|
||||
// [P2-3] 行级 reason 有/无两态:失败行(带 reason)显示「原因:…」;无行级原因的未知行不渲染原因行
|
||||
const failReason = wrapper.find('[data-testid="transfer-order-reason-D-FAIL"]');
|
||||
expect(failReason.exists()).toBe(true);
|
||||
expect(failReason.text()).toContain('原因:');
|
||||
expect(failReason.text()).toContain('料号无有效成本');
|
||||
expect(wrapper.find('[data-testid="transfer-order-reason-D-UNK"]').exists()).toBe(false);
|
||||
// 成功单无动作按钮
|
||||
expect(wrapper.find('[data-testid="transfer-order-recheck-D-OK"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="transfer-order-close-D-OK"]').exists()).toBe(false);
|
||||
// 无取消执行入口(D9:无取消执行)
|
||||
expect(wrapper.text()).not.toContain('取消执行');
|
||||
expect(wrapper.find('[data-testid="transfer-run-cancel"]').exists()).toBe(false);
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
it('result_unknown 行「重新触发」:确认弹层(D11 幂等语义)后调 retrigger 端点(202)', async () => {
|
||||
api.getTransferRun.mockResolvedValue(t13Partial);
|
||||
const wrapper = mountRunView();
|
||||
await flushPromises();
|
||||
await wrapper.find('[data-testid="transfer-order-retrigger-D-UNK"]').trigger('click');
|
||||
const dialog = wrapper.find('[data-testid="transfer-retrigger-dialog"]');
|
||||
expect(dialog.exists()).toBe(true);
|
||||
expect(dialog.text()).toContain('幂等');
|
||||
await wrapper.find('[data-testid="transfer-retrigger-confirm"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(api.retriggerTransferDocument).toHaveBeenCalledWith('RUN-T13', 'D-UNK');
|
||||
expect(wrapper.find('[data-testid="transfer-retrigger-dialog"]').exists()).toBe(false);
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
it('失败行「关闭单」:弹层列同单行影响面+ERP 红线;原因必填(空则确认禁用);确认后调 close 端点并上抛刷新', async () => {
|
||||
api.getTransferRun.mockResolvedValue(t13Partial);
|
||||
const wrapper = mountRunView();
|
||||
await flushPromises();
|
||||
const fetchesBefore = api.getTransferRun.mock.calls.length;
|
||||
await wrapper.find('[data-testid="transfer-order-close-D-FAIL"]').trigger('click');
|
||||
const dialog = wrapper.find('[data-testid="transfer-order-close-dialog"]');
|
||||
expect(dialog.exists()).toBe(true);
|
||||
expect(dialog.text()).toContain('D-FAIL');
|
||||
expect(dialog.text()).toContain('连接器组件'); // 同单行影响面
|
||||
expect(dialog.text()).toContain('ERP'); // 红线:关闭调拨单≠ERP 无单,关前须人工确认
|
||||
const confirm = wrapper.find('[data-testid="transfer-order-close-confirm"]');
|
||||
expect((confirm.element as HTMLButtonElement).disabled).toBe(true); // 原因必填
|
||||
await wrapper.find('[data-testid="transfer-order-close-reason"]').setValue('ERP 查无此单');
|
||||
await wrapper.find('[data-testid="transfer-order-close-confirm"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(api.closeTransferDocument).toHaveBeenCalledWith('D-FAIL', 'ERP 查无此单');
|
||||
// emit 上抛 → 父级刷新(run 调拨单清单重拉)
|
||||
expect(api.getTransferRun.mock.calls.length).toBeGreaterThan(fetchesBefore);
|
||||
expect(wrapper.find('[data-testid="transfer-order-close-dialog"]').exists()).toBe(false);
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
it('失败行「重试」:调单级重试端点;预检卡提交 202 后切融合卡', async () => {
|
||||
// [断言意图] 202 只拿 run_no 即切融合卡(D8);失败单一键重试直调
|
||||
// POST /documents/{doc_no}/retry(按单圈行重查+自动重跑)。
|
||||
api.getTransferRun.mockResolvedValue(t13Run('failed', [
|
||||
{
|
||||
doc_no: 'D-FAIL', receipt_date: '2026-08-05', from_warehouse: 'DBS-TRANSIT', to_warehouse: 'HUB-CN01',
|
||||
status: 'business_failed', erp_document_no: null, error_message: null,
|
||||
lines: [t13Line('MAT-1', '连接器组件', '', '1200.000000')],
|
||||
},
|
||||
]));
|
||||
const wrapper = mount(TransferMessageView, {
|
||||
props: { payload },
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
await flushPromises();
|
||||
await wrapper.find('[data-testid="transfer-generate-button"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(api.executeTransferItems).toHaveBeenCalledWith([101]);
|
||||
expect(wrapper.find('[data-testid="transfer-result-card"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="transfer-run-badge"]').exists()).toBe(true);
|
||||
// [P2-3 无行级原因态] 失败行 reason 缺失时不渲染原因行(状态文案兜底)
|
||||
expect(wrapper.find('[data-testid="transfer-order-reason-D-FAIL"]').exists()).toBe(false);
|
||||
// [一键恢复] 失败行重试直调单级端点(rerun=true 自动重跑)
|
||||
api.retryTransferOrder.mockResolvedValueOnce({
|
||||
doc_no: 'D-FAIL', rerun: true, run_no: 'RUN-9', ready: 1, blocked: [], total: 1,
|
||||
});
|
||||
await wrapper.find('[data-testid="transfer-order-retry-D-FAIL"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(api.retryTransferOrder).toHaveBeenCalledWith('D-FAIL');
|
||||
wrapper.unmount();
|
||||
});
|
||||
|
||||
it('门禁 4xx:useMessage 行内报错,留在预检卡并刷新状态(重拉匹配详情)', async () => {
|
||||
api.executeTransferItems.mockRejectedValueOnce(new Error('部分明细行匹配结果已过期,请重新匹配'));
|
||||
api.getTransferMatching.mockResolvedValue({ summary: payload.summary, items: payload.items, sources: payload.sources });
|
||||
const wrapper = mount(TransferMessageView, {
|
||||
props: { payload },
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
await flushPromises();
|
||||
await wrapper.find('[data-testid="transfer-generate-button"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(messageMocks.error).toHaveBeenCalled();
|
||||
expect(wrapper.find('[data-testid="transfer-match-card"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="transfer-result-card"]').exists()).toBe(false);
|
||||
expect(api.getTransferMatching).toHaveBeenCalledWith('MTG-1');
|
||||
wrapper.unmount();
|
||||
});
|
||||
});
|
||||
@@ -1,30 +1,41 @@
|
||||
<!--
|
||||
features/chat/components/messages/TransferMessageView.vue
|
||||
用途:在途调拨消息卡片的自驱动挂载视图——按 payload 形态渲染卡片,并把卡片按钮
|
||||
(直接生成调拨单 / 下载 / 重试 / 关闭)经 useChatTransfer 真实调用 API。
|
||||
(生成调拨单 / 下载 / 重查 / 恢复处理 / 关闭 / 重新触发 / 关闭单)经 useChatTransfer 真实调用 API。
|
||||
依赖:Transfer*Card、useChatTransfer、i18n chat.transfer.*。
|
||||
逻辑:payload 作为初始状态(ChatLog 回放);执行后切换为结果卡;下载走 requestBlob;
|
||||
不展示执行审计入口(决策 19)。
|
||||
逻辑:payload 作为初始状态(ChatLog 回放;历史行无 item_id 仅展示不可选);仅携带
|
||||
matching_id 时按 ID 恢复匹配卡(最近匹配入口);勾选/执行按明细 item_id;
|
||||
来源选择卡重试收料 RPA 为 202 异步——存在抓取中来源时组合式函数自动轮询
|
||||
GET /sources,RPA 回调收口后状态自动刷新,离开来源卡即停轮询;
|
||||
恢复处理 = 按明细 id 重查库存(batch-requery 唯一后端),完成后刷新待处理池并
|
||||
统计提示,不再跳转匹配卡;预检卡提交 202(D8)→ 切融合卡 kind='run'(run_no 传卡,
|
||||
轮询由融合卡自驱动,父级停自身轮询),门禁 4xx → useMessage 行内报错 + 预检状态刷新;
|
||||
融合卡失败单「重查库存」复用 batch-requery(会话明细行关联 item_id)、「关闭单」
|
||||
上抛 closed 事件后刷新 run 调拨单清单与可执行池(D18 行脱离回 ready_to_execute);
|
||||
下载走 requestBlob;不展示执行审计入口(决策 19);全程无取消执行入口(D9)。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import TransferPrecheckCard from './TransferPrecheckCard.vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import TransferMatchCard from './TransferMatchCard.vue';
|
||||
import TransferFileProgressCard from './TransferFileProgressCard.vue';
|
||||
import TransferProgressCard from './TransferProgressCard.vue';
|
||||
import TransferResultCard from './TransferResultCard.vue';
|
||||
import TransferBacklogSummaryCard from './TransferBacklogSummaryCard.vue';
|
||||
import TransferExecutableCard from './TransferExecutableCard.vue';
|
||||
import TransferManualCloseDialog from './TransferManualCloseDialog.vue';
|
||||
import TransferSourceSelectCard from './TransferSourceSelectCard.vue';
|
||||
import { useChatTransfer } from '../../composables/useChatTransfer';
|
||||
import { downloadTransferSourceFiles, getTransferPrecheck, requeryTransferItems } from '../../api/transfer.api';
|
||||
import { downloadTransferSourceFiles, getTransferMatching, retryTransferOrder, requeryTransferMatchingItems } from '../../api/transfer.api';
|
||||
import { triggerBlobDownload } from '@/shared/utils/download';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import type {
|
||||
TransferBacklogItem,
|
||||
TransferPrecheckItem,
|
||||
TransferPrecheckSummary,
|
||||
TransferMatchingItem,
|
||||
TransferMatchingSummary,
|
||||
TransferRunResult,
|
||||
TransferSourceProgress,
|
||||
TransferOrder,
|
||||
TransferType,
|
||||
} from '../../types/transfer.types';
|
||||
|
||||
@@ -32,24 +43,35 @@ const props = defineProps<{
|
||||
payload?: Record<string, unknown> | null;
|
||||
}>();
|
||||
|
||||
const { error: notifyError } = useMessage();
|
||||
const { t } = useI18n();
|
||||
const { error: notifyError, success: notifySuccess } = useMessage();
|
||||
|
||||
/** 统一错误提示:BusinessError 带本地化 message,其余回退到 String(e)。 */
|
||||
function reportError(e: unknown) {
|
||||
notifyError(e instanceof Error ? e.message : String(e));
|
||||
}
|
||||
|
||||
const kind = computed(() => String(props.payload?.kind ?? 'precheck'));
|
||||
const kind = computed(() => String(props.payload?.kind ?? 'match'));
|
||||
const mode = ref(kind.value);
|
||||
const summaryRef = ref<TransferPrecheckSummary | null>((props.payload?.summary as TransferPrecheckSummary) ?? null);
|
||||
const items = ref<TransferPrecheckItem[]>((props.payload?.items as TransferPrecheckItem[]) ?? []);
|
||||
/** backlog 初始筛选(首页计数卡切片进入:recoverable/closed/unknown;白名单外回落 all)。 */
|
||||
const backlogInitialFilter = computed<'all' | 'recoverable' | 'closed' | 'unknown'>(() => {
|
||||
const value = String(props.payload?.filter ?? 'all');
|
||||
const allowed = ['all', 'recoverable', 'closed', 'unknown'] as const;
|
||||
return (allowed as readonly string[]).includes(value) ? (value as (typeof allowed)[number]) : 'all';
|
||||
});
|
||||
const summaryRef = ref<TransferMatchingSummary | null>((props.payload?.summary as TransferMatchingSummary) ?? null);
|
||||
const items = ref<TransferMatchingItem[]>((props.payload?.items as TransferMatchingItem[]) ?? []);
|
||||
const runNo = ref(String(props.payload?.run_no ?? ''));
|
||||
const status = ref(String(props.payload?.status ?? 'executing'));
|
||||
const run = ref<TransferRunResult | null>((props.payload?.run as TransferRunResult) ?? null);
|
||||
const busy = ref(false);
|
||||
const closeTarget = ref<TransferBacklogItem | null>(null);
|
||||
/** 批量标记无需处理的明细 id 集合(与单行关闭共用同一弹窗)。 */
|
||||
const batchCloseIds = ref<number[]>([]);
|
||||
/** 正在重试收料 RPA 的来源编码集合(按来源独立展示重试中)。 */
|
||||
const retryingSource = ref<Set<string>>(new Set());
|
||||
/** 上次提交执行的明细行快照(失败单「重查库存」按物料/收料日期关联 item_id 用)。 */
|
||||
const lastExecutedItems = ref<TransferMatchingItem[]>([]);
|
||||
|
||||
const transfer = useChatTransfer();
|
||||
|
||||
@@ -61,24 +83,28 @@ onMounted(() => {
|
||||
if (kind.value === 'source-select') {
|
||||
void transfer.loadSources();
|
||||
}
|
||||
if (kind.value === 'executable') {
|
||||
void transfer.loadExecutableItems();
|
||||
}
|
||||
});
|
||||
|
||||
/** payload 更新时重置本地状态(历史回放/刷新);初始化组合式函数上下文 */
|
||||
function applyPayload(payload?: Record<string, unknown> | null) {
|
||||
if (!payload) return;
|
||||
mode.value = String(payload.kind ?? 'precheck');
|
||||
summaryRef.value = (payload.summary as TransferPrecheckSummary) ?? null;
|
||||
items.value = (payload.items as TransferPrecheckItem[]) ?? [];
|
||||
mode.value = String(payload.kind ?? 'match');
|
||||
summaryRef.value = (payload.summary as TransferMatchingSummary) ?? null;
|
||||
items.value = (payload.items as TransferMatchingItem[]) ?? [];
|
||||
runNo.value = String(payload.run_no ?? '');
|
||||
status.value = String(payload.status ?? 'executing');
|
||||
run.value = (payload.run as TransferRunResult) ?? null;
|
||||
const summaryValue = (payload.summary as TransferPrecheckSummary) ?? null;
|
||||
const summaryValue = (payload.summary as TransferMatchingSummary) ?? null;
|
||||
if (summaryValue) {
|
||||
transfer.precheckId.value = summaryValue.precheck_id;
|
||||
transfer.matchingId.value = summaryValue.matching_id;
|
||||
// 默认勾选可执行明细行(按 item_id);历史回放行无 item_id 不参与勾选
|
||||
transfer.selected.value = new Set(
|
||||
(payload.items as TransferPrecheckItem[] ?? [])
|
||||
.filter((item) => item.result === 'executable')
|
||||
.map((item) => item.invoice_no),
|
||||
((payload.items as TransferMatchingItem[]) ?? [])
|
||||
.filter((item) => item.result === 'executable' && item.item_id != null)
|
||||
.map((item) => item.item_id as number),
|
||||
);
|
||||
}
|
||||
if (runNo.value) {
|
||||
@@ -89,6 +115,12 @@ function applyPayload(payload?: Record<string, unknown> | null) {
|
||||
applyPayload(props.payload);
|
||||
watch(() => props.payload, applyPayload);
|
||||
|
||||
// 离开来源选择卡即停来源轮询(确认匹配切匹配卡/回放替换 payload 后,
|
||||
// 来源抓取状态与本卡无关;轮询实例由 useChatTransfer 作用域销毁兜底清理)
|
||||
watch(mode, (value) => {
|
||||
if (value !== 'source-select') transfer.stopSourcePolling();
|
||||
});
|
||||
|
||||
/** 打包下载选中来源的最新归档收料文件 */
|
||||
async function onDownloadSources(sourceCodes: string[]) {
|
||||
if (!sourceCodes.length) return;
|
||||
@@ -105,17 +137,21 @@ async function onDownloadSources(sourceCodes: string[]) {
|
||||
|
||||
/** 重新获取 ERP 库存:批量重查后用服务端明细原位刷新(保留勾选中仍阻断的行) */
|
||||
async function onRequery(invoiceNos: string[]) {
|
||||
if (!invoiceNos.length || !transfer.precheckId.value) return;
|
||||
if (!invoiceNos.length || !transfer.matchingId.value) return;
|
||||
busy.value = true;
|
||||
try {
|
||||
await requeryTransferItems(transfer.precheckId.value, invoiceNos);
|
||||
const detail = await getTransferPrecheck(transfer.precheckId.value);
|
||||
await requeryTransferMatchingItems(transfer.matchingId.value, invoiceNos);
|
||||
const detail = await getTransferMatching(transfer.matchingId.value);
|
||||
items.value = detail.items;
|
||||
if (detail.summary) summaryRef.value = detail.summary;
|
||||
const stillBlocked = new Set(
|
||||
items.value.filter((item) => String(item.result).startsWith('blocked_')).map((item) => item.invoice_no),
|
||||
const stillBlockedIds = new Set(
|
||||
items.value
|
||||
.filter((item) => String(item.result).startsWith('blocked_') && item.item_id != null)
|
||||
.map((item) => item.item_id as number),
|
||||
);
|
||||
transfer.selected.value = new Set(
|
||||
[...transfer.selected.value].filter((id) => stillBlockedIds.has(id)),
|
||||
);
|
||||
transfer.selected.value = new Set([...transfer.selected.value].filter((no) => stillBlocked.has(no)));
|
||||
} catch (e) {
|
||||
reportError(e);
|
||||
} finally {
|
||||
@@ -123,18 +159,14 @@ async function onRequery(invoiceNos: string[]) {
|
||||
}
|
||||
}
|
||||
|
||||
/** 直接生成调拨单(决策 4/5:无独立确认页) */
|
||||
async function onExecute(invoiceNos: string[]) {
|
||||
/** 可调拨明细行重查:逐行核对最新库存后刷新队列(行级 retry 不依赖匹配) */
|
||||
async function onExecutableRequery(itemIds: number[]) {
|
||||
busy.value = true;
|
||||
try {
|
||||
transfer.selected.value = new Set(invoiceNos);
|
||||
const outcome = await transfer.execute();
|
||||
if (outcome) {
|
||||
mode.value = 'result';
|
||||
runNo.value = outcome.run_no;
|
||||
status.value = outcome.status;
|
||||
run.value = transfer.run.value;
|
||||
for (const itemId of itemIds) {
|
||||
await transfer.retry(itemId);
|
||||
}
|
||||
await transfer.loadExecutableItems();
|
||||
} catch (e) {
|
||||
reportError(e);
|
||||
} finally {
|
||||
@@ -142,6 +174,89 @@ async function onExecute(invoiceNos: string[]) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 预检卡提交(匹配卡/可执行卡点「生成调拨单」):门禁在后端,失败抛 BusinessError。
|
||||
* D8 异步 202:只拿 {run_no, status:'queued'} 即切融合卡(kind='run')——
|
||||
* 融合卡自驱动轮询接管进度/结果,父级停掉本实例轮询防双打点;提交受理 toast 反馈。
|
||||
* 门禁 4xx:useMessage 行内报错 + 预检状态刷新(匹配详情/可执行池可能已变化)。
|
||||
*/
|
||||
async function onExecute(itemIds: number[]) {
|
||||
busy.value = true;
|
||||
try {
|
||||
transfer.selected.value = new Set(itemIds);
|
||||
// 快照本次执行明细行(融合卡失败单「重查库存」关联 item_id 的数据源之一):
|
||||
// 本地 items(匹配卡回放)/ composable 匹配与可执行池三处都可能持有行记录
|
||||
const executedSet = new Set(itemIds);
|
||||
lastExecutedItems.value = [...items.value, ...transfer.items.value, ...transfer.executableItems.value]
|
||||
.filter((item) => item.item_id != null && executedSet.has(item.item_id));
|
||||
const outcome = await transfer.execute();
|
||||
if (outcome) {
|
||||
transfer.stopRunPolling(); // 融合卡(自驱动轮询)接管,父级轮询停止
|
||||
mode.value = 'run';
|
||||
runNo.value = outcome.run_no;
|
||||
status.value = outcome.status;
|
||||
run.value = transfer.run.value;
|
||||
notifySuccess(t('chat.transfer.execute.accepted'));
|
||||
}
|
||||
} catch (e) {
|
||||
reportError(e);
|
||||
await refreshPrecheckState();
|
||||
} finally {
|
||||
busy.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/** 门禁失败后的预检状态刷新(best-effort:匹配视图重拉详情、可执行池重拉队列,不掩盖原错误)。 */
|
||||
async function refreshPrecheckState() {
|
||||
try {
|
||||
if (mode.value === 'match' && transfer.matchingId.value) {
|
||||
await transfer.refreshMatching();
|
||||
} else if (mode.value === 'executable') {
|
||||
await transfer.loadExecutableItems();
|
||||
}
|
||||
} catch {
|
||||
// 刷新失败静默:原门禁错误已经 useMessage 提示
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 融合卡失败单「重试」(一键恢复主路径):POST /documents/{doc_no}/retry——
|
||||
* 后端按单圈行逐行重查,全部 ready 自动建新 Run 重跑(复用原单号,分支②);
|
||||
* 部分行仍阻断则不重跑,阻断明细以 toast 摘要提示、行留恢复池。
|
||||
*/
|
||||
async function onOrderRetry(order: TransferOrder) {
|
||||
busy.value = true;
|
||||
try {
|
||||
const result = await retryTransferOrder(order.doc_no);
|
||||
if (result.rerun) {
|
||||
notifySuccess(t('chat.transfer.orderAction.retryAccepted', { docNo: order.doc_no }));
|
||||
} else {
|
||||
notifyError(t('chat.transfer.orderAction.retryPartial', {
|
||||
ready: result.ready,
|
||||
blocked: result.blocked.length,
|
||||
}));
|
||||
}
|
||||
await refreshPrecheckState();
|
||||
} catch (e) {
|
||||
reportError(e);
|
||||
} finally {
|
||||
busy.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 融合卡关闭单完成(D18 上抛事件):行脱离单回 ready_to_execute——
|
||||
* 父级刷新 run 调拨单清单与可执行池(best-effort,失败经 useMessage 提示)。
|
||||
*/
|
||||
async function onOrderClosed() {
|
||||
try {
|
||||
await transfer.refreshRun();
|
||||
await transfer.loadExecutableItems();
|
||||
} catch (e) {
|
||||
reportError(e);
|
||||
}
|
||||
}
|
||||
|
||||
async function onDownloadReceipt() {
|
||||
try {
|
||||
await transfer.downloadReceiptFiles();
|
||||
@@ -178,16 +293,13 @@ async function onBacklogRetry(itemId: number) {
|
||||
}
|
||||
}
|
||||
|
||||
function onBacklogClose(item: TransferBacklogItem) {
|
||||
closeTarget.value = item;
|
||||
}
|
||||
|
||||
async function onCloseConfirm(reason: string) {
|
||||
if (!closeTarget.value) return;
|
||||
/** 批量重查(待处理池多选):逐行隔离,完成后刷新列表并弹汇总。 */
|
||||
async function onBacklogRequery(itemIds: number[]) {
|
||||
busy.value = true;
|
||||
try {
|
||||
await transfer.manualClose(closeTarget.value.item_id, reason);
|
||||
closeTarget.value = null;
|
||||
const result = await transfer.batchRequery(itemIds);
|
||||
const ok = result.results.filter((entry) => entry.ok).length;
|
||||
notifySuccess(t('chat.transfer.toastRequeryDone', { ok, failed: result.total - ok }));
|
||||
await transfer.loadBacklog();
|
||||
} catch (e) {
|
||||
reportError(e);
|
||||
@@ -196,7 +308,59 @@ async function onCloseConfirm(reason: string) {
|
||||
}
|
||||
}
|
||||
|
||||
/** 来源实例选择确认 → 创建预检并切换预检卡(决策 4:两步第一步;收料日期范围为查询范围;调拨类型决定数据范围) */
|
||||
/** 恢复处理(行级/多选):恢复语义 = 按明细 id 重查库存(batch-requery 唯一后端);
|
||||
* 完成后刷新待处理池,并按结果统计提示(ready_to_execute 计为已可执行,其余仍阻断);
|
||||
* 不再跳转匹配卡(行式执行重构后恢复与匹配卡解耦)。 */
|
||||
async function onBacklogResume(itemIds: number[]) {
|
||||
busy.value = true;
|
||||
try {
|
||||
const result = await transfer.resume(itemIds);
|
||||
await transfer.loadBacklog();
|
||||
const recovered = result.results.filter((entry) => entry.status === 'ready_to_execute').length;
|
||||
const still = result.total - recovered;
|
||||
notifySuccess(t('chat.transfer.toastRequeryRecovered', { recovered, blocked: still }));
|
||||
} catch (e) {
|
||||
reportError(e);
|
||||
} finally {
|
||||
busy.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function onBacklogClose(item: TransferBacklogItem) {
|
||||
closeTarget.value = item;
|
||||
}
|
||||
|
||||
/** 批量标记无需处理:复用关闭弹窗(批量文案)。 */
|
||||
function onBacklogBatchClose(itemIds: number[]) {
|
||||
batchCloseIds.value = itemIds;
|
||||
}
|
||||
|
||||
function onCancelClose() {
|
||||
closeTarget.value = null;
|
||||
batchCloseIds.value = [];
|
||||
}
|
||||
|
||||
async function onCloseConfirm(reason: string) {
|
||||
busy.value = true;
|
||||
try {
|
||||
if (batchCloseIds.value.length) {
|
||||
const result = await transfer.batchManualClose(batchCloseIds.value, reason);
|
||||
const ok = result.results.filter((entry) => entry.ok).length;
|
||||
notifySuccess(t('chat.transfer.toastCloseDone', { ok, failed: result.total - ok }));
|
||||
batchCloseIds.value = [];
|
||||
} else if (closeTarget.value) {
|
||||
await transfer.manualClose(closeTarget.value.item_id, reason);
|
||||
closeTarget.value = null;
|
||||
}
|
||||
await transfer.loadBacklog();
|
||||
} catch (e) {
|
||||
reportError(e);
|
||||
} finally {
|
||||
busy.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/** 来源实例选择确认 → 创建匹配并切换匹配卡(决策 4:两步第一步;收料日期范围为查询范围;调拨类型决定数据范围) */
|
||||
async function onSourceConfirm(
|
||||
sourceCodes: string[],
|
||||
dateRange?: { from?: string; to?: string },
|
||||
@@ -204,9 +368,9 @@ async function onSourceConfirm(
|
||||
) {
|
||||
busy.value = true;
|
||||
try {
|
||||
await transfer.createPrecheck(sourceCodes, undefined, dateRange, transferType);
|
||||
mode.value = 'precheck';
|
||||
summaryRef.value = transfer.precheck.value;
|
||||
await transfer.createMatching(sourceCodes, undefined, dateRange, transferType);
|
||||
mode.value = 'match';
|
||||
summaryRef.value = transfer.matching.value;
|
||||
items.value = transfer.items.value;
|
||||
run.value = null;
|
||||
} catch (e) {
|
||||
@@ -250,40 +414,58 @@ async function onSourceRetry(sourceCodes: string[]) {
|
||||
@download="onDownloadSources"
|
||||
@retry="onSourceRetry"
|
||||
/>
|
||||
<TransferPrecheckCard
|
||||
v-else-if="mode === 'precheck' && summaryRef"
|
||||
<TransferMatchCard
|
||||
v-else-if="mode === 'match' && summaryRef"
|
||||
:summary="summaryRef"
|
||||
:items="items"
|
||||
:sources="transfer.sources.value"
|
||||
:selected="transfer.selected.value"
|
||||
:requery-busy="busy"
|
||||
:busy="busy"
|
||||
@toggle="(invoiceNo, checked) => transfer.toggleSelect(invoiceNo, checked)"
|
||||
@toggle-all="(invoiceNos, checked) => invoiceNos.forEach((no) => transfer.toggleSelect(no, checked))"
|
||||
@toggle="(itemId, checked) => transfer.toggleSelect(itemId, checked)"
|
||||
@toggle-all="(itemIds, checked) => itemIds.forEach((id) => transfer.toggleSelect(id, checked))"
|
||||
@requery="onRequery"
|
||||
@execute="onExecute"
|
||||
/>
|
||||
<TransferExecutableCard
|
||||
v-else-if="mode === 'executable'"
|
||||
:items="transfer.executableItems.value"
|
||||
:busy="busy"
|
||||
@refresh="() => transfer.loadExecutableItems()"
|
||||
@requery="onExecutableRequery"
|
||||
@execute="onExecute"
|
||||
/>
|
||||
<TransferProgressCard v-else-if="mode === 'progress'" :run-no="runNo" :status="status" :busy="busy" />
|
||||
<!-- 融合卡(D9:调拨单清单=进度=结果):run_no 自驱动轮询;kind='run' 为 202 新流程,'result' 兼容历史回放 -->
|
||||
<TransferResultCard
|
||||
v-else-if="mode === 'result' && run"
|
||||
:run="run"
|
||||
v-else-if="(mode === 'run' || mode === 'result') && (runNo || run?.run_no)"
|
||||
:run-no="runNo || String(run?.run_no ?? '')"
|
||||
:initial-run="run"
|
||||
@download-receipt="onDownloadReceipt"
|
||||
@download-erp="onDownloadErp"
|
||||
@download-exceptions="onDownloadExceptions"
|
||||
@retry="onOrderRetry"
|
||||
@closed="onOrderClosed"
|
||||
/>
|
||||
<TransferBacklogSummaryCard
|
||||
v-else-if="mode === 'backlog'"
|
||||
:items="transfer.backlog.value"
|
||||
:busy="busy"
|
||||
:initial-filter="backlogInitialFilter"
|
||||
@retry="onBacklogRetry"
|
||||
@requery="onBacklogRequery"
|
||||
@resume="onBacklogResume"
|
||||
@close="onBacklogClose"
|
||||
@batch-close="onBacklogBatchClose"
|
||||
@refresh="() => transfer.loadBacklog()"
|
||||
/>
|
||||
<TransferManualCloseDialog
|
||||
v-if="closeTarget"
|
||||
:open="Boolean(closeTarget)"
|
||||
:invoice-no="closeTarget.invoice_no"
|
||||
v-if="closeTarget || batchCloseIds.length"
|
||||
:open="Boolean(closeTarget || batchCloseIds.length)"
|
||||
:invoice-no="closeTarget?.invoice_no ?? ''"
|
||||
:count="batchCloseIds.length"
|
||||
@confirm="onCloseConfirm"
|
||||
@cancel="closeTarget = null"
|
||||
@cancel="onCancelClose"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,107 +1,428 @@
|
||||
<!--
|
||||
features/chat/components/messages/TransferResultCard.vue
|
||||
用途:结果卡——按 ERP 单号聚合(决策 20)、可展开物料明细、未生成单据异常区、
|
||||
下载收料来源文件 / ERP 库存表(决策 21)。不展示执行审计入口(决策 19)。
|
||||
依赖:props.run、i18n chat.transfer.*。
|
||||
逻辑:<details> 展开/收起物料行;异常单独分区;两个下载按钮 + 异常 Excel。
|
||||
用途:融合卡(D9:调拨单清单=进度=结果)——props { run_no } 自驱动轮询 GET /runs/{run_no},
|
||||
逐单展示「收料日期 · 拨出→拨入 · N 物料 · 合计」与状态徽标(待处理/执行中/ERP 单号/失败),
|
||||
行明细常驻展开;result_unknown 行 [重新触发](D11 唯一出口,幂等只触发末步);
|
||||
失败行 [重查库存](emit 上抛,复用既有 batch-requery)+ [关闭单](D18:原因必填 +
|
||||
同单行影响面 + 「关闭调拨单≠ERP 无单」红线确认);终态出下载区。无取消执行入口(D9)。
|
||||
依赖:props.runNo/initialRun、useChatTransfer(自有实例轮询:startRunPolling/refreshRun)、
|
||||
transfer.api(retriggerTransferDocument/closeTransferDocument)、useMessage、i18n chat.transfer.*。
|
||||
逻辑:挂载即拉取打底一帧并按 4s 轮询直至 run 终态(onUnmounted 停止);单次失败保留旧值并显示
|
||||
「连接中…」;卡顶徽标按单汇总(全成功→成功/混合→部分失败/全失败→失败/全待处理→排队中/其余→执行中);
|
||||
历史回放旧 payload(无 orders)把 result.external_documents 投影为成功单兼容展示。
|
||||
失败/未知单的单据级 error_message 恒 null(T11 评审移交 + P2-3 契约扩充:后端失败/未知单行带
|
||||
行级 reason=result_message):❌ 原因行级优先、无则仅展示状态文案,禁止渲染 undefined/null 字样。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import type { TransferRunResult } from '../../types/transfer.types';
|
||||
import { computed, onMounted, onUnmounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { isTerminalRunStatus, useChatTransfer } from '../../composables/useChatTransfer';
|
||||
import { closeTransferDocument, retriggerTransferDocument } from '../../api/transfer.api';
|
||||
import type { TransferRunResult, TransferOrder, TransferOrderLine } from '../../types/transfer.types';
|
||||
|
||||
defineProps<{
|
||||
run: TransferRunResult;
|
||||
const props = defineProps<{
|
||||
/** Run 编号(必传):自驱动轮询与重新触发的目标 Run。 */
|
||||
runNo: string;
|
||||
/** 初始 run 投影(历史回放/提交流程已拉取时打底;缺省由卡片自行拉取)。 */
|
||||
initialRun?: TransferRunResult | null;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
downloadReceipt: [];
|
||||
downloadErp: [];
|
||||
downloadExceptions: [];
|
||||
/** 失败单 [重试]:上抛父级调 POST /documents/{doc_no}/retry(一键重查+自动重跑)。 */
|
||||
retry: [order: TransferOrder];
|
||||
/** 关闭单完成:上抛父级刷新(D18 行脱离回 ready_to_execute,可执行池/调拨单清单需同步)。 */
|
||||
closed: [docNo: string];
|
||||
}>();
|
||||
|
||||
function reasonLabel(reason: string): string {
|
||||
const { t } = useI18n();
|
||||
const { error: notifyError, success: notifySuccess } = useMessage();
|
||||
|
||||
/** 卡片自有组合式实例:轮询/拉取与父级实例互不串扰(父级在切换后停掉自己的轮询)。 */
|
||||
const transfer = useChatTransfer();
|
||||
const { pollConnecting } = transfer;
|
||||
|
||||
const run = ref<TransferRunResult | null>(props.initialRun ?? null);
|
||||
const actionBusy = ref(false);
|
||||
/** 待关闭单(D18 弹层目标)。 */
|
||||
const closeTarget = ref<TransferOrder | null>(null);
|
||||
const closeReason = ref('');
|
||||
/** 待重新触发单(D11 弹层目标)。 */
|
||||
const retriggerTarget = ref<TransferOrder | null>(null);
|
||||
|
||||
/** 是否终态:终态停止轮询并展示下载动作区(交互细则:终态即停)。 */
|
||||
const terminal = computed(() => isTerminalRunStatus(run.value?.status));
|
||||
|
||||
/** 调拨单清单:优先服务端 orders;历史回放旧 payload 投影 external_documents 为成功单。 */
|
||||
const orders = computed<TransferOrder[]>(() => {
|
||||
const data = run.value;
|
||||
if (!data) return [];
|
||||
if (Array.isArray(data.orders) && data.orders.length) return data.orders;
|
||||
return (data.result?.external_documents ?? []).map((doc) => ({
|
||||
doc_no: doc.document_no,
|
||||
receipt_date: '',
|
||||
from_warehouse: doc.from_warehouse,
|
||||
to_warehouse: doc.to_warehouse,
|
||||
status: 'success' as const,
|
||||
erp_document_no: doc.document_no,
|
||||
error_message: null,
|
||||
lines: (doc.lines ?? []).map((line) => ({
|
||||
material_no: line.material_no,
|
||||
material_name: line.material_name,
|
||||
lot_no: '',
|
||||
quantity: line.quantity,
|
||||
unit: '',
|
||||
})),
|
||||
}));
|
||||
});
|
||||
|
||||
/** 卡顶徽标(按单汇总):全成功族→成功;全失败族→失败;全待处理→排队中;
|
||||
* 仍有在飞单→执行中;其余混合→部分失败。
|
||||
* [P2-5 计划字面偏差说明] 全 result_unknown 均质单组归「部分失败」而非计划字面的
|
||||
* 「其余→执行中」:finalize_run 语义下 result_unknown 属「未成单」,该单组的 run 终态
|
||||
* 只会落 partial_failed/failed(口径见 useChatTransfer.TERMINAL_RUN_STATUSES 注释),
|
||||
* 徽标跟随 run 级收尾口径,避免把已成定局的未成单组误标为仍在执行。 */
|
||||
const runBadge = computed<{ key: string; cls: string }>(() => {
|
||||
const list = orders.value;
|
||||
const successFamily = (s: string) => s === 'success' || s === 'duplicate_success';
|
||||
const failedFamily = (s: string) => s === 'business_failed' || s === 'technical_failed';
|
||||
if (!list.length || list.every((item) => item.status === 'pending')) {
|
||||
return { key: 'chat.transfer.runBadge.queued', cls: 'bg-slate-100 text-slate-600' };
|
||||
}
|
||||
if (list.every((item) => successFamily(item.status))) {
|
||||
return { key: 'chat.transfer.runBadge.success', cls: 'bg-emerald-50 text-emerald-700' };
|
||||
}
|
||||
if (list.every((item) => failedFamily(item.status))) {
|
||||
return { key: 'chat.transfer.runBadge.failed', cls: 'bg-red-50 text-red-700' };
|
||||
}
|
||||
if (list.some((item) => item.status === 'pending' || item.status === 'executing')) {
|
||||
return { key: 'chat.transfer.runBadge.executing', cls: 'bg-sky-50 text-sky-700' };
|
||||
}
|
||||
return { key: 'chat.transfer.runBadge.partialFailed', cls: 'bg-amber-50 text-amber-700' };
|
||||
});
|
||||
|
||||
/** 单据级状态徽标(成功族亮 ERP 单号;无单号回退状态文案,禁止出现 undefined/null)。 */
|
||||
function orderBadgeText(order: TransferOrder): string {
|
||||
switch (order.status) {
|
||||
case 'pending':
|
||||
return t('chat.transfer.orderStatus.pending');
|
||||
case 'executing':
|
||||
return t('chat.transfer.orderStatus.executing');
|
||||
case 'success':
|
||||
case 'duplicate_success':
|
||||
return order.erp_document_no || t('chat.transfer.orderStatus.success');
|
||||
case 'business_failed':
|
||||
case 'technical_failed':
|
||||
// 用户口径:失败统一展示(原因走行级 reason/result_message),不再区分业务/技术。
|
||||
return t('chat.transfer.orderStatus.failed');
|
||||
case 'result_unknown':
|
||||
return t('chat.transfer.orderStatus.resultUnknown');
|
||||
case 'cancelled':
|
||||
return t('chat.transfer.orderStatus.cancelled');
|
||||
default:
|
||||
return order.status;
|
||||
}
|
||||
}
|
||||
|
||||
function orderBadgeCls(order: TransferOrder): string {
|
||||
switch (order.status) {
|
||||
case 'success':
|
||||
case 'duplicate_success':
|
||||
return 'bg-emerald-50 text-emerald-700';
|
||||
case 'executing':
|
||||
return 'bg-sky-50 text-sky-700';
|
||||
case 'business_failed':
|
||||
case 'technical_failed':
|
||||
return 'bg-red-50 text-red-700';
|
||||
case 'result_unknown':
|
||||
return 'bg-amber-50 text-amber-700';
|
||||
default:
|
||||
return 'bg-slate-100 text-slate-600';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败/未知单原因文案(T11 精度约定 + P2-3 契约扩充):单据级 error_message 恒 null——
|
||||
* 后端在失败/未知单行集带行级 `reason`(= 行级 result_message),取首个非空行级原因
|
||||
* (兼容历史 result_message 键);无行级原因返回空串,徽标状态文案兜底
|
||||
* (模板仅在非空时渲染「原因:…」行,杜绝 undefined/null 字样上屏)。
|
||||
*/
|
||||
function orderReason(order: TransferOrder): string {
|
||||
for (const line of order.lines ?? []) {
|
||||
const record = line as unknown as Record<string, unknown>;
|
||||
const reason = record.reason ?? record.result_message;
|
||||
if (typeof reason === 'string' && reason.trim()) return reason.trim();
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/** 单行合计数量(6 位小数聚合串相加后去尾零展示,如 600)。 */
|
||||
function orderTotalQuantity(order: TransferOrder): string {
|
||||
let sum = 0;
|
||||
for (const line of order.lines ?? []) {
|
||||
const quantity = Number(line.quantity);
|
||||
if (Number.isFinite(quantity)) sum += quantity;
|
||||
}
|
||||
return String(Number(sum.toFixed(6)));
|
||||
}
|
||||
|
||||
/** 单行数量单位(取首行原值;无行不展示)。 */
|
||||
function orderUnit(order: TransferOrder): string {
|
||||
return order.lines?.[0]?.unit ?? '';
|
||||
}
|
||||
|
||||
function isFailedOrder(order: TransferOrder): boolean {
|
||||
return order.status === 'business_failed' || order.status === 'technical_failed';
|
||||
}
|
||||
|
||||
/** 行明细键(同单内物料+批号唯一)。 */
|
||||
function lineKey(order: TransferOrder, line: TransferOrderLine, index: number): string {
|
||||
return `${order.doc_no}|${line.material_no}|${line.lot_no}|${index}`;
|
||||
}
|
||||
|
||||
/** 未入单异常行文案映射(口径不变:blocked/business/technical/unknown/matching_expired)。 */
|
||||
function exceptionReasonLabel(reason: string): string {
|
||||
const map: Record<string, string> = {
|
||||
blocked_quantity_mismatch: 'chat.transfer.resultBlocked',
|
||||
blocked_inventory_not_found: 'chat.transfer.resultBlocked',
|
||||
business_failed: 'chat.transfer.exceptionBusinessFailed',
|
||||
technical_failed: 'chat.transfer.exceptionTechnicalFailed',
|
||||
result_unknown: 'chat.transfer.resultUnknown',
|
||||
precheck_expired: 'chat.transfer.exceptionPrecheckExpired',
|
||||
result_unknown: 'chat.transfer.orderStatus.resultUnknown',
|
||||
matching_expired: 'chat.transfer.exceptionMatchExpired',
|
||||
};
|
||||
return map[reason] ?? 'chat.transfer.resultBlocked';
|
||||
}
|
||||
|
||||
/** [STEP 1] 挂载:终态原位恢复不轮询;否则拉取打底一帧 + 启动 4s 轮询(D8:提交只拿 run_no)。 */
|
||||
onMounted(async () => {
|
||||
if (!props.runNo || isTerminalRunStatus(run.value?.status)) return;
|
||||
if (!run.value) {
|
||||
try {
|
||||
run.value = await transfer.refreshRun(props.runNo);
|
||||
} catch {
|
||||
// 打底一帧失败:保留空态,由轮询兜底(单帧失败不清画面)
|
||||
}
|
||||
}
|
||||
if (!isTerminalRunStatus(run.value?.status)) {
|
||||
transfer.startRunPolling(props.runNo, (latest) => {
|
||||
run.value = latest;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/** 卸载停止轮询(幂等;组合式实例的 onScopeDispose 兜底)。 */
|
||||
onUnmounted(() => {
|
||||
transfer.stopRunPolling();
|
||||
});
|
||||
|
||||
/** [重新触发] 确认(D11):复用原单 doc_no/submit_timestamp 只触发末步(幂等);
|
||||
* [P1 双保险·前端半] 成功后先立即 refreshRun 打一帧(后端受理时已同步 run.status='executing',
|
||||
* 消除 worker 领取前首帧陈旧终态的窗口),再进入 4s 间隔轮询直至新终态
|
||||
* (终态误停窗口由后端同步置 executing 保证关闭,见 useChatTransfer 轮询终态判定处注释)。 */
|
||||
async function confirmRetrigger() {
|
||||
const target = retriggerTarget.value;
|
||||
if (!target || actionBusy.value) return;
|
||||
actionBusy.value = true;
|
||||
try {
|
||||
await retriggerTransferDocument(props.runNo, target.doc_no);
|
||||
retriggerTarget.value = null;
|
||||
notifySuccess(t('chat.transfer.toastRetriggerAccepted'));
|
||||
try {
|
||||
run.value = await transfer.refreshRun(props.runNo);
|
||||
} catch {
|
||||
// 首帧失败保留旧单面,由间隔轮询兜底(单帧失败不清画面)
|
||||
}
|
||||
transfer.startRunPolling(props.runNo, (latest) => {
|
||||
run.value = latest;
|
||||
});
|
||||
} catch (e) {
|
||||
notifyError(e instanceof Error ? e.message : String(e));
|
||||
} finally {
|
||||
actionBusy.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function openCloseDialog(order: TransferOrder) {
|
||||
closeTarget.value = order;
|
||||
closeReason.value = '';
|
||||
}
|
||||
|
||||
/** [关闭单] 确认(D18:原因必填;仅失败单可关):close 后单 cancelled、行脱离回
|
||||
* ready_to_execute;本卡重拉调拨单清单 + emit 上抛父级刷新(可执行池/待处理池)。 */
|
||||
async function confirmCloseOrder() {
|
||||
const target = closeTarget.value;
|
||||
const reason = closeReason.value.trim();
|
||||
if (!target || !reason || actionBusy.value) return;
|
||||
actionBusy.value = true;
|
||||
try {
|
||||
await closeTransferDocument(target.doc_no, reason);
|
||||
closeTarget.value = null;
|
||||
notifySuccess(t('chat.transfer.toastOrderClosed'));
|
||||
emit('closed', target.doc_no);
|
||||
try {
|
||||
run.value = await transfer.refreshRun(props.runNo);
|
||||
} catch {
|
||||
// 刷新失败保留旧单面(关闭调拨单结果已上抛父级刷新)
|
||||
}
|
||||
} catch (e) {
|
||||
notifyError(e instanceof Error ? e.message : String(e));
|
||||
} finally {
|
||||
actionBusy.value = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="my-2 rounded-2xl border border-brand-100 bg-surface p-4 shadow-sm" data-testid="transfer-result-card">
|
||||
<div class="mb-3 flex items-center justify-between">
|
||||
<h3 class="text-sm font-bold text-primary">{{ $t('chat.transfer.resultTitle') }}</h3>
|
||||
<span class="text-xs text-muted">{{ run.run_no }}</span>
|
||||
<div class="mb-3 flex flex-wrap items-center justify-between gap-2">
|
||||
<h3 class="text-sm font-bold text-primary">
|
||||
{{ $t('chat.transfer.runTitle') }}
|
||||
<span class="ml-1 text-xs text-muted">{{ runNo }}</span>
|
||||
</h3>
|
||||
<div class="flex items-center gap-2">
|
||||
<span
|
||||
v-if="pollConnecting"
|
||||
class="rounded-full bg-slate-100 px-2 py-0.5 text-[11px] text-slate-500"
|
||||
data-testid="transfer-poll-connecting"
|
||||
>
|
||||
{{ $t('chat.transfer.poll.connecting') }}
|
||||
</span>
|
||||
<span class="rounded-full px-2 py-0.5 text-xs font-bold" :class="runBadge.cls" data-testid="transfer-run-badge">
|
||||
{{ $t(runBadge.key) }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 已生成 ERP 单据:按单号聚合 + 可展开物料明细 -->
|
||||
<div v-if="run.result.external_documents.length" class="flex flex-col gap-2">
|
||||
<details
|
||||
v-for="doc in run.result.external_documents"
|
||||
:key="doc.document_no"
|
||||
<div v-if="!orders.length" class="rounded-lg bg-surface-soft p-3 text-xs text-muted">
|
||||
{{ $t('chat.transfer.runBadge.queued') }}
|
||||
</div>
|
||||
|
||||
<!-- 调拨单清单(D9:调拨单清单=进度=结果):行明细常驻展开,无取消执行入口 -->
|
||||
<ul v-else class="flex flex-col gap-2">
|
||||
<li
|
||||
v-for="order in orders"
|
||||
:key="order.doc_no"
|
||||
class="rounded-lg border border-default"
|
||||
data-testid="transfer-erp-document"
|
||||
:data-testid="`transfer-order-${order.doc_no}`"
|
||||
>
|
||||
<summary class="flex cursor-pointer flex-wrap items-center justify-between gap-2 px-3 py-2 text-xs">
|
||||
<span class="font-bold text-brand-700">{{ doc.document_no }}</span>
|
||||
<span class="text-secondary">{{ doc.from_warehouse }} → {{ doc.to_warehouse }}</span>
|
||||
<span class="text-muted">{{ $t('chat.transfer.materialCount', { count: doc.material_count }) }}</span>
|
||||
<span class="font-bold text-secondary">{{ doc.total_quantity }}</span>
|
||||
<span class="rounded-full bg-emerald-50 px-2 py-0.5 font-bold text-emerald-700">
|
||||
{{ $t('chat.transfer.posted') }}
|
||||
<div class="flex flex-wrap items-center justify-between gap-2 px-3 py-2 text-xs">
|
||||
<span class="font-semibold text-secondary" :data-testid="`transfer-order-summary-${order.doc_no}`">
|
||||
{{ order.receipt_date || '—' }} · {{ order.from_warehouse }}→{{ order.to_warehouse }}
|
||||
· {{ $t('chat.transfer.materialCount', { count: order.lines.length }) }}
|
||||
<template v-if="order.lines.length"> · {{ orderTotalQuantity(order) }} {{ orderUnit(order) }}</template>
|
||||
</span>
|
||||
</summary>
|
||||
<div class="border-t border-subtle px-3 py-2">
|
||||
<table class="w-full text-xs" data-testid="transfer-erp-document-lines">
|
||||
<span
|
||||
class="rounded-full px-2 py-0.5 font-bold"
|
||||
:class="orderBadgeCls(order)"
|
||||
:data-testid="`transfer-order-status-${order.doc_no}`"
|
||||
>
|
||||
{{ orderBadgeText(order) }}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- 失败/未知单原因([P2-3 契约扩充] 行级 reason 优先;无则不渲染——状态文案兜底,禁 undefined/null) -->
|
||||
<div
|
||||
v-if="orderReason(order)"
|
||||
class="px-3 pb-1 text-[11px] text-red-500"
|
||||
:data-testid="`transfer-order-reason-${order.doc_no}`"
|
||||
>
|
||||
{{ $t('chat.transfer.orderReasonPrefix', { reason: orderReason(order) }) }}
|
||||
</div>
|
||||
|
||||
<!-- 单据级行内动作(D11/D18:result_unknown 仅重新触发;失败行重查+关闭单) -->
|
||||
<div
|
||||
v-if="order.status === 'result_unknown' || isFailedOrder(order)"
|
||||
class="flex flex-wrap gap-2 px-3 pb-2"
|
||||
>
|
||||
<button
|
||||
v-if="order.status === 'result_unknown'"
|
||||
type="button"
|
||||
class="rounded border border-amber-300 px-2 py-0.5 text-[11px] font-bold text-amber-700 transition hover:bg-amber-50 disabled:opacity-40"
|
||||
:data-testid="`transfer-order-retrigger-${order.doc_no}`"
|
||||
:disabled="actionBusy"
|
||||
@click="retriggerTarget = order"
|
||||
>
|
||||
{{ $t('chat.transfer.orderAction.retrigger') }}
|
||||
</button>
|
||||
<template v-if="isFailedOrder(order)">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded border border-brand-200 px-2 py-0.5 text-[11px] font-bold text-brand-700 transition hover:bg-brand-50 disabled:opacity-40"
|
||||
:data-testid="`transfer-order-retry-${order.doc_no}`"
|
||||
:disabled="actionBusy"
|
||||
@click="emit('retry', order)"
|
||||
>
|
||||
{{ $t('chat.transfer.orderAction.retry') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded border border-red-200 px-2 py-0.5 text-[11px] font-bold text-red-700 transition hover:bg-red-50 disabled:opacity-40"
|
||||
:data-testid="`transfer-order-close-${order.doc_no}`"
|
||||
:disabled="actionBusy"
|
||||
@click="openCloseDialog(order)"
|
||||
>
|
||||
{{ $t('chat.transfer.orderAction.closeOrder') }}
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<!-- 行明细常驻展开(物料 × 批号聚合行) -->
|
||||
<div class="border-t border-subtle px-3 py-2" :data-testid="`transfer-order-lines-${order.doc_no}`">
|
||||
<table class="w-full text-xs">
|
||||
<thead>
|
||||
<tr class="text-left text-[11px] text-muted">
|
||||
<th class="p-1">{{ $t('chat.transfer.colMaterial') }}</th>
|
||||
<th class="p-1">{{ $t('chat.transfer.colName') }}</th>
|
||||
<th class="p-1">{{ $t('chat.transfer.colSpec') }}</th>
|
||||
<th class="p-1">{{ $t('chat.transfer.colInvoice') }}</th>
|
||||
<th class="p-1">{{ $t('chat.transfer.colFromBatch') }}</th>
|
||||
<th class="p-1">{{ $t('chat.transfer.colToQty') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="line in doc.lines" :key="line.invoice_no" class="border-t border-subtle">
|
||||
<tr v-for="(line, index) in order.lines" :key="lineKey(order, line, index)" class="border-t border-subtle">
|
||||
<td class="p-1">{{ line.material_no }}</td>
|
||||
<td class="p-1">{{ line.material_name }}</td>
|
||||
<td class="p-1">{{ line.specification }}</td>
|
||||
<td class="p-1">{{ line.invoice_no }}</td>
|
||||
<td class="p-1">{{ line.quantity }}</td>
|
||||
<td class="p-1">{{ line.lot_no || '—' }}</td>
|
||||
<td class="p-1">{{ line.quantity }}<template v-if="line.unit"> {{ line.unit }}</template></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
<div v-else class="mb-3 rounded-lg bg-surface-soft p-3 text-xs text-muted">
|
||||
{{ $t('chat.transfer.noDocuments') }}
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<!-- 未生成 ERP 单据的异常区(决策 20 单独展示) -->
|
||||
<div v-if="run.result.exceptions.length" class="mt-3" data-testid="transfer-exceptions-area">
|
||||
<!-- 未入单异常区(口径不变):早于建单被阻断的行不落在任何单内,fail-closed 单独展示 -->
|
||||
<div
|
||||
v-if="(run?.result?.exceptions?.length ?? 0) > 0"
|
||||
class="mt-3"
|
||||
data-testid="transfer-exceptions-area"
|
||||
>
|
||||
<h4 class="mb-1 text-xs font-bold text-secondary">{{ $t('chat.transfer.exceptionsTitle') }}</h4>
|
||||
<ul class="flex flex-col gap-1">
|
||||
<li
|
||||
v-for="exc in run.result.exceptions"
|
||||
v-for="exc in run?.result?.exceptions"
|
||||
:key="exc.invoice_no"
|
||||
class="rounded-lg bg-red-50 px-3 py-1.5 text-xs text-red-700"
|
||||
data-testid="transfer-exception-item"
|
||||
>
|
||||
<span class="font-bold">{{ exc.invoice_no }}</span>
|
||||
<span class="mx-1 text-red-400">·</span>{{ exc.source_code }} · {{ $t(reasonLabel(exc.reason)) }}
|
||||
<span class="mx-1 text-red-400">·</span>{{ exc.source_code }} · {{ $t(exceptionReasonLabel(exc.reason)) }}
|
||||
<div class="text-[11px] text-red-500">{{ exc.facts }}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<!-- 下载:收料来源文件 + ERP 库存表(决策 21);无审计入口(决策 19) -->
|
||||
<div class="mt-3 flex flex-wrap gap-2 border-t border-subtle pt-3" data-testid="transfer-result-downloads">
|
||||
<!-- 终态动作:下载异常清单 / 收料文件 / ERP 库存表(父级经 useChatTransfer 真实下载) -->
|
||||
<div v-if="terminal" class="mt-3 flex flex-wrap gap-2 border-t border-subtle pt-3" data-testid="transfer-result-downloads">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-default px-3 py-1.5 text-xs font-bold text-secondary hover-surface-soft"
|
||||
data-testid="transfer-download-exceptions"
|
||||
@click="emit('downloadExceptions')"
|
||||
>
|
||||
{{ $t('chat.transfer.downloadExceptions') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-brand-200 px-3 py-1.5 text-xs font-bold text-brand-700 hover:bg-brand-50"
|
||||
@@ -118,14 +439,87 @@ function reasonLabel(reason: string): string {
|
||||
>
|
||||
{{ $t('chat.transfer.downloadErpInventory') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-default px-3 py-1.5 text-xs font-bold text-secondary hover-surface-soft"
|
||||
data-testid="transfer-download-exceptions"
|
||||
@click="emit('downloadExceptions')"
|
||||
>
|
||||
{{ $t('chat.transfer.downloadExceptions') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- 重新触发确认弹层(D11:说明幂等复用原单只触发末步;无取消执行语义) -->
|
||||
<div
|
||||
v-if="retriggerTarget"
|
||||
class="fixed inset-0 z-50 flex items-center justify-center bg-slate-900/40 p-4"
|
||||
data-testid="transfer-retrigger-dialog"
|
||||
>
|
||||
<div class="w-full max-w-md rounded-2xl bg-surface p-5 shadow-xl">
|
||||
<h3 class="text-base font-bold text-primary">
|
||||
{{ $t('chat.transfer.retriggerDialog.title', { docNo: retriggerTarget.doc_no }) }}
|
||||
</h3>
|
||||
<p class="mt-2 text-xs text-secondary">{{ $t('chat.transfer.retriggerDialog.body') }}</p>
|
||||
<div class="mt-4 flex justify-end gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-default px-4 py-1.5 text-sm text-secondary hover-surface-soft"
|
||||
data-testid="transfer-retrigger-dismiss"
|
||||
@click="retriggerTarget = null"
|
||||
>
|
||||
{{ $t('chat.transfer.retriggerDialog.dismiss') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg bg-brand-600 px-4 py-1.5 text-sm font-bold text-white hover:bg-brand-700 disabled:cursor-not-allowed disabled:opacity-40"
|
||||
data-testid="transfer-retrigger-confirm"
|
||||
:disabled="actionBusy"
|
||||
@click="confirmRetrigger"
|
||||
>
|
||||
{{ $t('chat.transfer.retriggerDialog.confirm') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 关闭单确认弹层(D18:原因必填 + 同单行影响面 + 「关闭调拨单≠ERP 无单」红线) -->
|
||||
<div
|
||||
v-if="closeTarget"
|
||||
class="fixed inset-0 z-50 flex items-center justify-center bg-slate-900/40 p-4"
|
||||
data-testid="transfer-order-close-dialog"
|
||||
>
|
||||
<div class="w-full max-w-md rounded-2xl bg-surface p-5 shadow-xl">
|
||||
<h3 class="text-base font-bold text-primary">
|
||||
{{ $t('chat.transfer.orderClose.title', { docNo: closeTarget.doc_no }) }}
|
||||
</h3>
|
||||
<p class="mt-1 text-xs text-muted">
|
||||
{{ $t('chat.transfer.orderClose.impactHint', { count: closeTarget.lines.length }) }}
|
||||
</p>
|
||||
<ul class="mt-2 max-h-32 overflow-y-auto rounded-lg bg-surface-soft p-2 text-[11px] text-secondary">
|
||||
<li v-for="(line, index) in closeTarget.lines" :key="`${line.material_no}|${line.lot_no}|${index}`">
|
||||
{{ line.material_no }} {{ line.material_name }} · {{ line.quantity }}<template v-if="line.unit"> {{ line.unit }}</template>
|
||||
</li>
|
||||
</ul>
|
||||
<p class="mt-2 text-xs font-bold text-red-600">{{ $t('chat.transfer.orderClose.redline') }}</p>
|
||||
<textarea
|
||||
v-model="closeReason"
|
||||
rows="3"
|
||||
class="mt-3 w-full rounded-lg border border-default p-2 text-sm"
|
||||
:placeholder="$t('chat.transfer.orderClose.reasonPlaceholder')"
|
||||
data-testid="transfer-order-close-reason"
|
||||
/>
|
||||
<div class="mt-4 flex justify-end gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-default px-4 py-1.5 text-sm text-secondary hover-surface-soft"
|
||||
data-testid="transfer-order-close-dismiss"
|
||||
@click="closeTarget = null"
|
||||
>
|
||||
{{ $t('chat.transfer.orderClose.dismiss') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg bg-red-600 px-4 py-1.5 text-sm font-bold text-white hover:bg-red-700 disabled:cursor-not-allowed disabled:opacity-40"
|
||||
data-testid="transfer-order-close-confirm"
|
||||
:disabled="!closeReason.trim() || actionBusy"
|
||||
@click="confirmCloseOrder"
|
||||
>
|
||||
{{ $t('chat.transfer.orderClose.confirm') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -4,12 +4,13 @@
|
||||
* 确认提交、重试收料 RPA。
|
||||
* 依赖:@vue/test-utils、i18n。
|
||||
* 逻辑:平台 DBS/Crane 仅分组;实例为选择与执行边界(决策 2/3/4);
|
||||
* 所选来源需至少一个 has_ready_file 才能确认预检(决策:无 ready 文件禁止确认)。
|
||||
* 所选来源需至少一个 has_ready_file 才能确认匹配(决策:无 ready 文件禁止确认)。
|
||||
*/
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import i18n from '@/i18n';
|
||||
import TransferSourceSelectCard from './TransferSourceSelectCard.vue';
|
||||
import { eligibleReceiptDateTo } from './transferDate';
|
||||
|
||||
const readySources = [
|
||||
{ source_code: 'DBS-AWSBI', display_name: 'AWSBI 在途仓', platform: 'dbs', enabled: true, has_ready_file: true, file_status: 'ready' },
|
||||
@@ -85,7 +86,33 @@ describe('TransferSourceSelectCard', () => {
|
||||
it('D+1 规则提示收进 ⓘ 悬浮(title),不再平铺占宽', () => {
|
||||
// [断言意图] 长规则文案通过原生 title 渐进披露,紧凑日期行不换行错位。
|
||||
const wrapper = mountCard();
|
||||
expect(wrapper.find('[data-testid="transfer-source-date-hint"]').attributes('title')).toBe('截止不超出 D+1 规则(业务日期前一天)');
|
||||
const title = wrapper.find('[data-testid="transfer-source-date-hint"]').attributes('title') ?? '';
|
||||
expect(title).toContain('D+1 规则');
|
||||
expect(title).toContain('业务日期前一天');
|
||||
});
|
||||
|
||||
it('收料日期默认为 D+1 规则日期(T-1)且上限锁定(输入期限制)', () => {
|
||||
// [断言意图] 默认值与 max 均为上海口径 T-1,未来日期在选择器层面不可选。
|
||||
const wrapper = mountCard();
|
||||
const from = wrapper.find('[data-testid="transfer-source-date-from"]').element as HTMLInputElement;
|
||||
const to = wrapper.find('[data-testid="transfer-source-date-to"]').element as HTMLInputElement;
|
||||
const cutoff = eligibleReceiptDateTo();
|
||||
expect(from.value).toBe(cutoff);
|
||||
expect(to.value).toBe(cutoff);
|
||||
expect(from.max).toBe(cutoff);
|
||||
expect(to.max).toBe(cutoff);
|
||||
});
|
||||
|
||||
it('起始晚于截止时行内提示并禁用确认(不等提交报错)', async () => {
|
||||
// [断言意图] 日期维护期即时卡控:非法区间直接禁用确认并显示行内红字。
|
||||
const wrapper = mountCard();
|
||||
await wrapper.find('[data-testid="transfer-source-option-DBS-AWSBI"] input').setValue(true);
|
||||
await wrapper.find('[data-testid="transfer-source-date-from"]').setValue('2026-09-20');
|
||||
await wrapper.find('[data-testid="transfer-source-date-to"]').setValue('2026-09-10');
|
||||
expect(wrapper.find('[data-testid="transfer-source-date-invalid"]').exists()).toBe(true);
|
||||
expect((wrapper.find('[data-testid="transfer-source-confirm"]').element as HTMLButtonElement).disabled).toBe(true);
|
||||
await wrapper.find('[data-testid="transfer-source-date-to"]').setValue('2026-09-22');
|
||||
expect(wrapper.find('[data-testid="transfer-source-date-invalid"]').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('“只选可重试”勾选无文件/失败来源', async () => {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<!--
|
||||
features/chat/components/messages/TransferSourceSelectCard.vue
|
||||
用途:来源实例选择卡(决策 2/3/4:手工两步第一步)——按平台 DBS/Crane 分组勾选实例,
|
||||
选择调拨类型后“确认范围并预检”发起预检。
|
||||
选择调拨类型后“确认范围并匹配”发起匹配。
|
||||
依赖:props.sources、i18n chat.transfer.*。
|
||||
逻辑:预检参数区(调拨类型 + 收料日期,确认时一并提交)→ 选择辅助/上下文操作条
|
||||
逻辑:匹配参数区(调拨类型 + 收料日期,确认时一并提交)→ 选择辅助/上下文操作条
|
||||
(有选中时原位替换辅助区,承载批量重试/下载/清空选择)→ 平台分组来源列表
|
||||
(平台仅分组不可直接执行)→ 底部唯一实心主按钮「确认范围并预检」(未选禁用);
|
||||
(平台仅分组不可直接执行)→ 底部唯一实心主按钮「确认范围并匹配」(未选禁用);
|
||||
调拨类型决定收料数据范围(类型 1 仅纳入 INVOICE 前缀 HOM/HOX/WTP),
|
||||
类型 2/3 一期占位(禁用,后端同样 fail-closed)。
|
||||
-->
|
||||
@@ -13,6 +13,7 @@
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { eligibleReceiptDateTo } from './transferDate';
|
||||
import type { TransferSourceOption, TransferType } from '../../types/transfer.types';
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -33,10 +34,19 @@ const { warning: notifyWarning } = useMessage();
|
||||
const { t } = useI18n();
|
||||
|
||||
const selected = ref<Set<string>>(new Set());
|
||||
/** 收料日期范围(预检查询范围);截止不得超出 D+1 规则(后端卡控)。 */
|
||||
const dateFrom = ref('');
|
||||
const dateTo = ref('');
|
||||
/** 调拨业务类型:决定本次预检纳入哪些收料数据;一期仅类型 1 开放。 */
|
||||
/** 收料日期范围(匹配查询范围):默认 D+1 规则日期(T-1),上限同(输入期限制,
|
||||
* 不等提交报错);后端 RECEIPT_DATE_RANGE_INVALID 卡控保留为双保险。 */
|
||||
const maxReceiptDate = eligibleReceiptDateTo();
|
||||
const dateFrom = ref(maxReceiptDate);
|
||||
const dateTo = ref(maxReceiptDate);
|
||||
|
||||
/** 起始不得晚于截止(清空视为不限,提交 undefined)。 */
|
||||
const dateRangeInvalid = computed(() => {
|
||||
const from = dateFrom.value || null;
|
||||
const to = dateTo.value || null;
|
||||
return from !== null && to !== null && from > to;
|
||||
});
|
||||
/** 调拨业务类型:决定本次匹配纳入哪些收料数据;一期仅类型 1 开放。 */
|
||||
const transferType = ref<TransferType>('in_transit_to_hub');
|
||||
|
||||
/** 类型选项元数据;enabled=false 为占位类型(UI 禁用 + 后端 fail-closed 双保险)。 */
|
||||
@@ -66,11 +76,13 @@ const selectedRetryableCount = computed(() =>
|
||||
);
|
||||
const batchRetryDisabled = computed(() => props.busy || selectedRetryableCount.value === 0);
|
||||
|
||||
/** 已选来源中是否有具备 ready 文件的(门禁:都无 ready 文件则禁止确认预检)。 */
|
||||
/** 已选来源中是否有具备 ready 文件的(门禁:都无 ready 文件则禁止确认匹配)。 */
|
||||
const selectedHasReadyFile = computed(() =>
|
||||
[...selected.value].some((code) => props.sources.find((s) => s.source_code === code)?.has_ready_file),
|
||||
);
|
||||
const confirmDisabled = computed(() => props.busy || selectedCount.value === 0 || !selectedHasReadyFile.value);
|
||||
const confirmDisabled = computed(() =>
|
||||
props.busy || selectedCount.value === 0 || !selectedHasReadyFile.value || dateRangeInvalid.value,
|
||||
);
|
||||
const downloadDisabled = computed(() => props.busy || !selectedHasReadyFile.value);
|
||||
|
||||
function toggle(sourceCode: string, checked: boolean) {
|
||||
@@ -143,9 +155,9 @@ function confirm() {
|
||||
<h3 class="mb-1 text-sm font-bold text-primary">{{ $t('chat.transfer.sourceSelectTitle') }}</h3>
|
||||
<p class="mb-3 text-xs text-muted">{{ $t('chat.transfer.sourceSelectHint') }}</p>
|
||||
|
||||
<!-- [ZONE 1] 预检参数区:调拨类型 + 收料日期同组(确认预检时一并提交,参数先行定范围)。 -->
|
||||
<!-- [ZONE 1] 匹配参数区:调拨类型 + 收料日期同组(确认匹配时一并提交,参数先行定范围)。 -->
|
||||
<div class="mb-3 rounded-lg border border-subtle p-3" data-testid="transfer-source-params">
|
||||
<p class="mb-2 text-[11px] font-bold text-muted">{{ $t('chat.transfer.precheckParams') }}</p>
|
||||
<p class="mb-2 text-[11px] font-bold text-muted">{{ $t('chat.transfer.matchParams') }}</p>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<span class="text-xs font-bold text-secondary">{{ $t('chat.transfer.transferTypeLabel') }}</span>
|
||||
<button
|
||||
@@ -170,6 +182,7 @@ function confirm() {
|
||||
<input
|
||||
v-model="dateFrom"
|
||||
type="date"
|
||||
:max="maxReceiptDate"
|
||||
class="rounded-lg border border-default bg-surface px-2 py-1 text-xs text-primary"
|
||||
data-testid="transfer-source-date-from"
|
||||
/>
|
||||
@@ -177,6 +190,8 @@ function confirm() {
|
||||
<input
|
||||
v-model="dateTo"
|
||||
type="date"
|
||||
:max="maxReceiptDate"
|
||||
:min="dateFrom || undefined"
|
||||
class="rounded-lg border border-default bg-surface px-2 py-1 text-xs text-primary"
|
||||
data-testid="transfer-source-date-to"
|
||||
/>
|
||||
@@ -186,6 +201,10 @@ function confirm() {
|
||||
:title="$t('chat.transfer.receiptDateHint')"
|
||||
data-testid="transfer-source-date-hint"
|
||||
>ⓘ</span>
|
||||
<!-- 输入期校验:起始晚于截止时行内提示并禁用确认(不等提交报错)。 -->
|
||||
<span v-if="dateRangeInvalid" class="text-xs font-bold text-red-600" data-testid="transfer-source-date-invalid">
|
||||
{{ $t('chat.transfer.receiptDateInvalid') }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -338,7 +357,7 @@ function confirm() {
|
||||
data-testid="transfer-source-confirm"
|
||||
@click="confirm"
|
||||
>
|
||||
{{ $t('chat.transfer.confirmScopeAndPrecheck') }}
|
||||
{{ $t('chat.transfer.confirmScopeAndMatch') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* 用途:在途调拨批号转换规则(拨出/拨入批号展示)。
|
||||
* 依赖:无。
|
||||
* 逻辑:原批号以 WTP 开头时替换前缀为 HOW 获得真实批号;其余规则不变、原样展示。
|
||||
* 本函数是后端 movement_contract.external_lot_no(库存查询/建单下传侧唯一实现)
|
||||
* 的展示侧镜像,两侧行为须逐字节一致,改动必须双侧同步。
|
||||
*/
|
||||
|
||||
/** 原批号(如 WMS 的 WTP26082728)→ 真实批号(HOW26082728);空值/非 WTP 原样返回。 */
|
||||
|
||||
@@ -1,35 +1,37 @@
|
||||
/**
|
||||
* features/chat/components/messages/transferCards.spec.ts
|
||||
* 用途:验证在途调拨三张核心卡片(文件进度/预检/结果)+ 关闭弹窗的交互与禁用语义。
|
||||
* 用途:验证在途调拨核心卡片(文件进度/匹配/融合结果卡)+ 关闭弹窗的交互与禁用语义。
|
||||
* 依赖:@vue/test-utils、i18n、transfer.types。
|
||||
* 逻辑:断言按钮禁用、勾选禁用、ERP 单号展开/收起、异常展示、下载按钮与
|
||||
* 结果页不出现“查看执行审计”入口(决策 19)。
|
||||
* 逻辑:断言按钮禁用、勾选禁用、融合卡单行常驻展开(历史回放旧 result 投影兼容)、
|
||||
* 异常展示、下载按钮与结果页不出现“查看执行审计”入口(决策 19);
|
||||
* 计数卡新字段(待查库存/已失效,历史缺省按 0)与 pending 徽标
|
||||
* (evidence-sync,2026-09-25)。
|
||||
*/
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import i18n from '@/i18n';
|
||||
import TransferFileProgressCard from './TransferFileProgressCard.vue';
|
||||
import TransferPrecheckCard from './TransferPrecheckCard.vue';
|
||||
import TransferMatchCard from './TransferMatchCard.vue';
|
||||
import TransferResultCard from './TransferResultCard.vue';
|
||||
import TransferManualCloseDialog from './TransferManualCloseDialog.vue';
|
||||
|
||||
const mountOptions = { global: { plugins: [i18n] } };
|
||||
|
||||
const summary = {
|
||||
precheck_id: 'TPC-1',
|
||||
matching_id: 'MTG-1',
|
||||
status: 'ready_to_execute',
|
||||
business_date: '2026-08-06',
|
||||
eligible_receipt_date_to: '2026-08-05',
|
||||
expires_at: '',
|
||||
counts: { file_invoice_count: 3, not_matured_count: 1, prechecked_count: 2, executable_count: 2, blocked_count: 0 },
|
||||
counts: { file_invoice_count: 3, not_matured_count: 1, matched_count: 2, executable_count: 2, blocked_count: 0 },
|
||||
estimated_transfer_quantity: '2400',
|
||||
estimated_external_write_count: 2,
|
||||
precheck_hash: 'sha256:x',
|
||||
matching_hash: 'sha256:x',
|
||||
};
|
||||
|
||||
const items = [
|
||||
{ source_code: 'DBS-AWSBI', material_no: 'MAT-1', material_name: '连接器', specification: 'A', invoice_no: 'INV-001', from_warehouse: 'DBS-TRANSIT', from_quantity: '1200', to_warehouse: 'HUB-CN01', to_quantity: '1200', result: 'executable' },
|
||||
{ source_code: 'DBS-AWSBI', material_no: 'MAT-2', material_name: '控制器', specification: 'B', invoice_no: 'INV-041', from_warehouse: '', from_quantity: null, to_warehouse: '', to_quantity: '400', result: 'not_matured' },
|
||||
{ item_id: 101, source_code: 'DBS-AWSBI', material_no: 'MAT-1', material_name: '连接器', specification: 'A', invoice_no: 'INV-001', from_warehouse: 'DBS-TRANSIT', from_quantity: '1200', to_warehouse: 'HUB-CN01', to_quantity: '1200', result: 'executable', checked_at: '2026-09-23T09:05:00+08:00' },
|
||||
{ item_id: 102, source_code: 'DBS-AWSBI', material_no: 'MAT-2', material_name: '控制器', specification: 'B', invoice_no: 'INV-041', from_warehouse: '', from_quantity: null, to_warehouse: '', to_quantity: '400', result: 'not_matured' },
|
||||
];
|
||||
|
||||
describe('TransferFileProgressCard', () => {
|
||||
@@ -46,66 +48,175 @@ describe('TransferFileProgressCard', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('TransferPrecheckCard', () => {
|
||||
it('阻断/未成熟项 checkbox 禁用;可执行项可选', () => {
|
||||
const wrapper = mount(TransferPrecheckCard, {
|
||||
props: { summary, items, selected: new Set(['INV-001']) },
|
||||
describe('TransferMatchCard', () => {
|
||||
it('勾选键为明细行 item_id:阻断/未成熟项 checkbox 禁用,可执行项可选', () => {
|
||||
const wrapper = mount(TransferMatchCard, {
|
||||
props: { summary, items, selected: new Set<number>([101]) },
|
||||
...mountOptions,
|
||||
});
|
||||
const executableCheck = wrapper.find('[data-testid="transfer-check-INV-001"]');
|
||||
const maturedCheck = wrapper.find('[data-testid="transfer-check-INV-041"]');
|
||||
expect((executableCheck.element as HTMLInputElement).disabled).toBe(false);
|
||||
expect((executableCheck.element as HTMLInputElement).checked).toBe(true);
|
||||
expect((maturedCheck.element as HTMLInputElement).disabled).toBe(true);
|
||||
});
|
||||
|
||||
it('历史回放行(无 item_id)checkbox 禁用,防误选', () => {
|
||||
// [断言意图] 行式执行重构(2026-09-23):chat 消息流回放的旧 payload 行没有
|
||||
// item_id,不能作为执行勾选键;这类行必须禁选(防误选后 400)。
|
||||
const legacyItems = [{ ...items[0], item_id: undefined }];
|
||||
const wrapper = mount(TransferMatchCard, {
|
||||
props: { summary, items: legacyItems, selected: new Set<number>() },
|
||||
...mountOptions,
|
||||
});
|
||||
expect((wrapper.find('[data-testid="transfer-check-INV-001"]').element as HTMLInputElement).disabled).toBe(true);
|
||||
expect((wrapper.find('[data-testid="transfer-generate-button"]').element as HTMLButtonElement).disabled).toBe(true);
|
||||
});
|
||||
|
||||
it('未选择任何项时生成按钮禁用', () => {
|
||||
const wrapper = mount(TransferPrecheckCard, {
|
||||
props: { summary, items, selected: new Set() },
|
||||
const wrapper = mount(TransferMatchCard, {
|
||||
props: { summary, items, selected: new Set<number>() },
|
||||
...mountOptions,
|
||||
});
|
||||
expect((wrapper.find('[data-testid="transfer-generate-button"]').element as HTMLButtonElement).disabled).toBe(true);
|
||||
});
|
||||
|
||||
it('busy 时生成按钮禁用', () => {
|
||||
const wrapper = mount(TransferPrecheckCard, {
|
||||
props: { summary, items, selected: new Set(['INV-001']), busy: true },
|
||||
const wrapper = mount(TransferMatchCard, {
|
||||
props: { summary, items, selected: new Set<number>([101]), busy: true },
|
||||
...mountOptions,
|
||||
});
|
||||
expect((wrapper.find('[data-testid="transfer-generate-button"]').element as HTMLButtonElement).disabled).toBe(true);
|
||||
});
|
||||
|
||||
it('点击生成按钮仅提交可执行勾选项', async () => {
|
||||
const wrapper = mount(TransferPrecheckCard, {
|
||||
props: { summary, items, selected: new Set(['INV-001']) },
|
||||
it('点击生成按钮提交可执行勾选行的 item_id 数组', async () => {
|
||||
const wrapper = mount(TransferMatchCard, {
|
||||
props: { summary, items, selected: new Set<number>([101]) },
|
||||
...mountOptions,
|
||||
});
|
||||
await wrapper.find('[data-testid="transfer-generate-button"]').trigger('click');
|
||||
expect(wrapper.emitted('execute')?.[0][0]).toEqual(['INV-001']);
|
||||
expect(wrapper.emitted('execute')?.[0][0]).toEqual([101]);
|
||||
});
|
||||
|
||||
it('同 Invoice 跨收料日期拆票(重复 invoice_no)时,筛选后仅渲染匹配行', async () => {
|
||||
// [断言意图] 回归防线(2026-09-21):拆票设计下 invoice_no 不再唯一,
|
||||
it('库存数量下方小字展示查询时刻(HH:mm)', () => {
|
||||
const wrapper = mount(TransferMatchCard, {
|
||||
props: { summary, items, selected: new Set<number>() },
|
||||
...mountOptions,
|
||||
});
|
||||
const cell = wrapper.find('[data-testid="transfer-checked-at-INV-001"]');
|
||||
expect(cell.exists()).toBe(true);
|
||||
expect(cell.text()).toMatch(/^\d{2}:\d{2}$/);
|
||||
expect(wrapper.find('[data-testid="transfer-checked-at-INV-041"]').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('stale 行置灰 + 重查小标;file_current=false 行展示文件更新小标', () => {
|
||||
const flaggedItems = [
|
||||
{ ...items[0], stale: true, file_current: false },
|
||||
];
|
||||
const wrapper = mount(TransferMatchCard, {
|
||||
props: { summary, items: flaggedItems, selected: new Set<number>() },
|
||||
...mountOptions,
|
||||
});
|
||||
const row = wrapper.find('[data-testid="transfer-item-INV-001"]');
|
||||
expect(row.classes()).toContain('opacity-60');
|
||||
expect(wrapper.find('[data-testid="transfer-item-stale"]').text()).toContain('重查');
|
||||
expect(wrapper.find('[data-testid="transfer-item-file-changed"]').text()).toContain('自动对齐');
|
||||
});
|
||||
|
||||
it('计数卡透出待查库存/已失效计数;历史 payload 缺省按 0 展示', () => {
|
||||
// [断言意图] evidence-sync(2026-09-25):后端 counts 新增 pending_stock_check_count /
|
||||
// invalid_count(历史数据可缺省);卡片须原样透出数值,缺省回退 0,
|
||||
// 已失效标签经 {count} 插值渲染(「已失效 N 行」)。
|
||||
const summaryWithNewCounts = {
|
||||
...summary,
|
||||
counts: { ...summary.counts, pending_stock_check_count: 5, invalid_count: 2 },
|
||||
};
|
||||
const wrapper = mount(TransferMatchCard, {
|
||||
props: { summary: summaryWithNewCounts, items, selected: new Set<number>() },
|
||||
...mountOptions,
|
||||
});
|
||||
const counts = wrapper.find('[data-testid="transfer-match-counts"]');
|
||||
expect(counts.text()).toContain('待查库存');
|
||||
expect(counts.text()).toContain('已失效 2 行');
|
||||
const legacyWrapper = mount(TransferMatchCard, {
|
||||
props: { summary, items, selected: new Set<number>() },
|
||||
...mountOptions,
|
||||
});
|
||||
expect(legacyWrapper.find('[data-testid="transfer-match-counts"]').text()).toContain('已失效 0 行');
|
||||
});
|
||||
|
||||
it('pending_stock_check 行徽标展示「待查库存」(amber 同未成熟色系)', () => {
|
||||
// [断言意图] evidence-sync(2026-09-25):文件已落地未查 ERP 的行为
|
||||
// pending_stock_check,徽标须用独立文案且为 amber 族(非阻断红)。
|
||||
const pendingItems = [{ ...items[0], result: 'pending_stock_check' }];
|
||||
const wrapper = mount(TransferMatchCard, {
|
||||
props: { summary, items: pendingItems, selected: new Set<number>() },
|
||||
...mountOptions,
|
||||
});
|
||||
const badge = wrapper.find('[data-testid="transfer-item-result"]');
|
||||
expect(badge.text()).toContain('待查库存');
|
||||
expect(badge.classes()).toContain('bg-amber-50');
|
||||
});
|
||||
|
||||
it('blocked_file_removed 行退出主视图:表格不渲染,仅折叠提示计数并引导去待处理池', () => {
|
||||
// [断言意图] 回归防线(2026-09-24):文件移除的行证据已失效,重查/重新匹配
|
||||
// 都救不了——留驻主清单只会提示做不到的动作(死锁观感)。主视图只渲染
|
||||
// 可行动行;失效行以折叠提示计数承载,处理入口在待处理异常池。
|
||||
const mixedItems = [
|
||||
{ ...items[0] },
|
||||
{ item_id: 103, source_code: 'DBS-AWSBI', material_no: 'MAT-3', material_name: '线缆', specification: 'C', invoice_no: 'INV-077', from_warehouse: 'DBS-TRANSIT', from_quantity: '50', to_warehouse: 'HUB-CN01', to_quantity: '50', result: 'blocked_file_removed' },
|
||||
];
|
||||
const wrapper = mount(TransferMatchCard, {
|
||||
props: { summary, items: mixedItems, selected: new Set<number>() },
|
||||
...mountOptions,
|
||||
});
|
||||
// 失效行不出现在表格(含其重查按钮/勾选框),可行动行照常渲染。
|
||||
expect(wrapper.find('[data-testid="transfer-item-INV-077"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="transfer-executable-check-INV-077"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="transfer-item-INV-001"]').exists()).toBe(true);
|
||||
// 折叠提示透出失效行数与去处理池的引导。
|
||||
const hint = wrapper.find('[data-testid="transfer-file-removed-hint"]');
|
||||
expect(hint.exists()).toBe(true);
|
||||
expect(hint.text()).toContain('1');
|
||||
expect(hint.text()).toContain('待处理异常');
|
||||
});
|
||||
|
||||
it('全部行均文件移除时表格为空,仅剩折叠提示', () => {
|
||||
const removedOnly = [
|
||||
{ item_id: 103, source_code: 'DBS-AWSBI', material_no: 'MAT-3', material_name: '线缆', specification: 'C', invoice_no: 'INV-077', from_warehouse: 'DBS-TRANSIT', from_quantity: '50', to_warehouse: 'HUB-CN01', to_quantity: '50', result: 'blocked_file_removed' },
|
||||
];
|
||||
const wrapper = mount(TransferMatchCard, {
|
||||
props: { summary, items: removedOnly, selected: new Set<number>() },
|
||||
...mountOptions,
|
||||
});
|
||||
expect(wrapper.find('tbody tr').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="transfer-file-removed-hint"]').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('同 Invoice 跨收料日期拆单(重复 invoice_no)时,筛选后仅渲染匹配行', async () => {
|
||||
// [断言意图] 回归防线(2026-09-21):拆单设计下 invoice_no 不再唯一,
|
||||
// 行 key 若仍用 invoice_no 会出现重复 key,Vue 列表 diff 错乱导致
|
||||
// 筛选后不匹配行残留/克隆(用户输入 HOX 仍见 SLC2PHX 行)。
|
||||
// 行身份 = (来源, Invoice, 料号, 收料日期),key 必须用同一粒度。
|
||||
const dupItems = [
|
||||
{ source_code: 'CRANE', material_no: 'M-1', material_name: '机框', specification: '', invoice_no: 'HOX-1', receipt_date: '2026-09-11', from_warehouse: 'HTP-D43', from_quantity: null, to_warehouse: 'HTP-D49', to_quantity: '36', result: 'blocked_quantity_mismatch' },
|
||||
{ source_code: 'CRANE', material_no: 'M-2', material_name: '护罩', specification: '', invoice_no: 'DUP-1', receipt_date: '2026-09-03', from_warehouse: 'HTP-D43', from_quantity: null, to_warehouse: 'HTP-D49', to_quantity: '36', result: 'blocked_quantity_mismatch' },
|
||||
{ source_code: 'CRANE', material_no: 'M-2', material_name: '护罩', specification: '', invoice_no: 'DUP-1', receipt_date: '2026-09-04', from_warehouse: 'HTP-D43', from_quantity: null, to_warehouse: 'HTP-D49', to_quantity: '36', result: 'blocked_quantity_mismatch' },
|
||||
{ item_id: 201, source_code: 'CRANE', material_no: 'M-1', material_name: '机框', specification: '', invoice_no: 'HOX-1', receipt_date: '2026-09-11', from_warehouse: 'HTP-D43', from_quantity: null, to_warehouse: 'HTP-D49', to_quantity: '36', result: 'blocked_quantity_mismatch' },
|
||||
{ item_id: 202, source_code: 'CRANE', material_no: 'M-2', material_name: '护罩', specification: '', invoice_no: 'DUP-1', receipt_date: '2026-09-03', from_warehouse: 'HTP-D43', from_quantity: null, to_warehouse: 'HTP-D49', to_quantity: '36', result: 'blocked_quantity_mismatch' },
|
||||
{ item_id: 203, source_code: 'CRANE', material_no: 'M-2', material_name: '护罩', specification: '', invoice_no: 'DUP-1', receipt_date: '2026-09-04', from_warehouse: 'HTP-D43', from_quantity: null, to_warehouse: 'HTP-D49', to_quantity: '36', result: 'blocked_quantity_mismatch' },
|
||||
];
|
||||
const wrapper = mount(TransferPrecheckCard, {
|
||||
props: { summary, items: dupItems, selected: new Set() },
|
||||
const wrapper = mount(TransferMatchCard, {
|
||||
props: { summary, items: dupItems, selected: new Set<number>() },
|
||||
...mountOptions,
|
||||
});
|
||||
expect(wrapper.findAll('tbody tr').length).toBe(3);
|
||||
await wrapper.find('[data-testid="transfer-precheck-filter"]').setValue('HOX');
|
||||
await wrapper.find('[data-testid="transfer-match-filter"]').setValue('HOX');
|
||||
const rows = wrapper.findAll('tbody tr');
|
||||
expect(rows.length).toBe(1);
|
||||
expect(rows[0].text()).toContain('HOX-1');
|
||||
});
|
||||
});
|
||||
|
||||
describe('TransferResultCard', () => {
|
||||
describe('TransferResultCard(Task 13 融合卡)', () => {
|
||||
// 历史回放旧 payload(无 orders,仅 result.external_documents)——融合卡投影为成功单展示
|
||||
const run = {
|
||||
run_no: 'RUN-1',
|
||||
status: 'partial_failed',
|
||||
@@ -122,32 +233,37 @@ describe('TransferResultCard', () => {
|
||||
exceptions: [{ source_code: 'DBS-AWSBI', invoice_no: 'INV-999', material_no: 'MAT-9', reason: 'business_failed', facts: '收料 300 / ERP 280' }],
|
||||
},
|
||||
};
|
||||
const mountCard = () => mount(TransferResultCard, { props: { runNo: 'RUN-1', initialRun: run }, ...mountOptions });
|
||||
|
||||
it('按 ERP 单号聚合展示,物料明细可展开/收起', async () => {
|
||||
const wrapper = mount(TransferResultCard, { props: { run }, ...mountOptions });
|
||||
const doc = wrapper.find('[data-testid="transfer-erp-document"]');
|
||||
expect(doc.text()).toContain('TRF-10001');
|
||||
expect(doc.attributes('open')).toBeUndefined();
|
||||
await doc.find('summary').trigger('click');
|
||||
expect(doc.attributes('open')).toBeDefined();
|
||||
expect(wrapper.find('[data-testid="transfer-erp-document-lines"]').text()).toContain('INV-001');
|
||||
it('历史回放(旧 result 投影):按单号展示单行,行明细常驻展开无需点击', async () => {
|
||||
const wrapper = mountCard();
|
||||
const order = wrapper.find('[data-testid="transfer-order-TRF-10001"]');
|
||||
expect(order.exists()).toBe(true);
|
||||
expect(order.text()).toContain('TRF-10001');
|
||||
// 常驻展开:物料行直接可见(旧 <details> 交互移除,D9 调拨单清单=进度=结果)
|
||||
expect(wrapper.find('[data-testid="transfer-order-lines-TRF-10001"]').text()).toContain('MAT-1');
|
||||
expect(wrapper.find('[data-testid="transfer-order-lines-TRF-10001"]').text()).toContain('连接器');
|
||||
// 终态出下载区
|
||||
expect(wrapper.find('[data-testid="transfer-result-downloads"]').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('未生成单据异常单独展示', () => {
|
||||
const wrapper = mount(TransferResultCard, { props: { run }, ...mountOptions });
|
||||
it('未入单异常单独展示(口径不变)', () => {
|
||||
const wrapper = mountCard();
|
||||
expect(wrapper.find('[data-testid="transfer-exceptions-area"]').text()).toContain('INV-999');
|
||||
});
|
||||
|
||||
it('提供两个下载按钮(收料来源文件 + ERP 库存表)', async () => {
|
||||
const wrapper = mount(TransferResultCard, { props: { run }, ...mountOptions });
|
||||
it('提供下载按钮(收料来源文件 + ERP 库存表 + 异常清单)', async () => {
|
||||
const wrapper = mountCard();
|
||||
await wrapper.find('[data-testid="transfer-download-receipt"]').trigger('click');
|
||||
await wrapper.find('[data-testid="transfer-download-erp"]').trigger('click');
|
||||
await wrapper.find('[data-testid="transfer-download-exceptions"]').trigger('click');
|
||||
expect(wrapper.emitted('downloadReceipt')).toBeTruthy();
|
||||
expect(wrapper.emitted('downloadErp')).toBeTruthy();
|
||||
expect(wrapper.emitted('downloadExceptions')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('结果页不出现“查看执行审计”入口(决策 19)', () => {
|
||||
const wrapper = mount(TransferResultCard, { props: { run }, ...mountOptions });
|
||||
const wrapper = mountCard();
|
||||
expect(wrapper.text()).not.toContain('审计');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* features/chat/components/messages/transferDate.ts
|
||||
* 用途:在途调拨业务日期工具——按 Asia/Shanghai 计算业务日期(T)与
|
||||
* D+1 成熟规则的可匹配截止日(T-1),与后端 date_policy 完全同口径。
|
||||
* 依赖:无(纯函数,便于单测)。
|
||||
* 逻辑:浏览器本地时区不可靠(部署/用户时区任意),必须固定上海时区口径,
|
||||
* 否则前端日期上限与后端 TRANSFER.RECEIPT_DATE_RANGE_INVALID 卡控会漂移。
|
||||
*/
|
||||
|
||||
/** Asia/Shanghai 当前业务日期(YYYY-MM-DD)。 */
|
||||
export function shanghaiBusinessDate(now: Date = new Date()): string {
|
||||
// en-CA 输出恰为 ISO YYYY-MM-DD(locale 无关的稳定格式技巧)。
|
||||
return new Intl.DateTimeFormat('en-CA', {
|
||||
timeZone: 'Asia/Shanghai',
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
}).format(now);
|
||||
}
|
||||
|
||||
/** D+1 规则可匹配截止日(业务日期 T - 1 天,YYYY-MM-DD)。 */
|
||||
export function eligibleReceiptDateTo(now: Date = new Date()): string {
|
||||
const business = new Date(`${shanghaiBusinessDate(now)}T00:00:00Z`);
|
||||
business.setUTCDate(business.getUTCDate() - 1);
|
||||
return business.toISOString().slice(0, 10);
|
||||
}
|
||||
@@ -1,22 +1,28 @@
|
||||
/**
|
||||
* features/chat/composables/useChatTransfer.spec.ts
|
||||
* 用途:验证预检创建/恢复、选择范围、直接生成执行 Run、结果恢复与防重复。
|
||||
* 用途:验证匹配创建/恢复、选择范围、直接生成执行 Run、结果恢复与防重复;
|
||||
* 另验证 D8 异步 202 提交后的 Run 轮询(4s 间隔、终态停止、单次失败保留旧值、清理)。
|
||||
* 依赖:vi.mock(transfer.api)、useChatTransfer。
|
||||
* 逻辑:用 Mock API 驱动组合式函数,断言状态流转与调用参数。
|
||||
* 逻辑:用 Mock API 驱动组合式函数,断言状态流转与调用参数;
|
||||
* 轮询用例用 fake timers 推进 4s 周期并断言终态/失败/清理分支。
|
||||
*/
|
||||
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
||||
import { afterEach, describe, expect, it, vi, beforeEach } from 'vitest';
|
||||
import { effectScope } from 'vue';
|
||||
|
||||
const api = vi.hoisted(() => ({
|
||||
createTransferPrecheck: vi.fn(),
|
||||
getTransferPrecheck: vi.fn(),
|
||||
executeTransferPrecheck: vi.fn(),
|
||||
createTransferMatching: vi.fn(),
|
||||
getTransferMatching: vi.fn(),
|
||||
executeTransferItems: vi.fn(),
|
||||
getTransferRun: vi.fn(),
|
||||
cancelTransferRun: vi.fn(),
|
||||
retryTransferItem: vi.fn(),
|
||||
manualCloseTransferItem: vi.fn(),
|
||||
batchRequeryTransferItems: vi.fn(),
|
||||
downloadTransferReceiptFiles: vi.fn(),
|
||||
downloadTransferErpInventory: vi.fn(),
|
||||
downloadTransferExceptions: vi.fn(),
|
||||
listTransferSources: vi.fn(),
|
||||
retryTransferSourceRpa: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('../api/transfer.api', () => api);
|
||||
@@ -24,33 +30,33 @@ vi.mock('../api/transfer.api', () => api);
|
||||
import { useChatTransfer } from './useChatTransfer';
|
||||
|
||||
const summary = {
|
||||
precheck_id: 'TPC-20260806-001',
|
||||
matching_id: 'MTG-20260806-001',
|
||||
status: 'ready_to_execute',
|
||||
business_date: '2026-08-06',
|
||||
eligible_receipt_date_to: '2026-08-05',
|
||||
expires_at: '',
|
||||
counts: { file_invoice_count: 2, not_matured_count: 0, prechecked_count: 2, executable_count: 2, blocked_count: 0 },
|
||||
counts: { file_invoice_count: 2, not_matured_count: 0, matched_count: 2, executable_count: 2, blocked_count: 0 },
|
||||
estimated_transfer_quantity: '2400',
|
||||
estimated_external_write_count: 2,
|
||||
precheck_hash: 'sha256:abc',
|
||||
matching_hash: 'sha256:abc',
|
||||
};
|
||||
|
||||
const detail = {
|
||||
summary,
|
||||
sources: [{ source_code: 'DBS-AWSBI', stage: 'file_ready', file_no: 'REC-1' }],
|
||||
items: [
|
||||
{ source_code: 'DBS-AWSBI', material_no: 'MAT-1', material_name: 'x', specification: 'y', invoice_no: 'INV-001', from_warehouse: 'DBS-TRANSIT', from_quantity: '1200', to_warehouse: 'HUB-CN01', to_quantity: '1200', result: 'executable' },
|
||||
{ source_code: 'DBS-AWSBI', material_no: 'MAT-2', material_name: 'x', specification: 'y', invoice_no: 'INV-002', from_warehouse: 'DBS-TRANSIT', from_quantity: '1200', to_warehouse: 'HUB-CN01', to_quantity: '1200', result: 'executable' },
|
||||
{ source_code: 'DBS-AWSBI', material_no: 'MAT-3', material_name: 'x', specification: 'y', invoice_no: 'INV-041', from_warehouse: '', from_quantity: null, to_warehouse: '', to_quantity: '400', result: 'not_matured' },
|
||||
{ item_id: 11, source_code: 'DBS-AWSBI', material_no: 'MAT-1', material_name: 'x', specification: 'y', invoice_no: 'INV-001', from_warehouse: 'DBS-TRANSIT', from_quantity: '1200', to_warehouse: 'HUB-CN01', to_quantity: '1200', result: 'executable' },
|
||||
{ item_id: 12, source_code: 'DBS-AWSBI', material_no: 'MAT-2', material_name: 'x', specification: 'y', invoice_no: 'INV-002', from_warehouse: 'DBS-TRANSIT', from_quantity: '1200', to_warehouse: 'HUB-CN01', to_quantity: '1200', result: 'executable' },
|
||||
{ item_id: 13, source_code: 'DBS-AWSBI', material_no: 'MAT-3', material_name: 'x', specification: 'y', invoice_no: 'INV-041', from_warehouse: '', from_quantity: null, to_warehouse: '', to_quantity: '400', result: 'not_matured' },
|
||||
],
|
||||
};
|
||||
|
||||
describe('useChatTransfer', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
api.createTransferPrecheck.mockResolvedValue(summary);
|
||||
api.getTransferPrecheck.mockResolvedValue(detail);
|
||||
api.executeTransferPrecheck.mockResolvedValue({ run_no: 'RUN-20260806-1', status: 'success' });
|
||||
api.createTransferMatching.mockResolvedValue(summary);
|
||||
api.getTransferMatching.mockResolvedValue(detail);
|
||||
api.executeTransferItems.mockResolvedValue({ run_no: 'RUN-20260806-1', status: 'success' });
|
||||
api.getTransferRun.mockResolvedValue({
|
||||
run_no: 'RUN-20260806-1',
|
||||
status: 'success',
|
||||
@@ -58,56 +64,316 @@ describe('useChatTransfer', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('创建预检后默认勾选全部可执行项,未成熟项不可勾选', async () => {
|
||||
it('创建匹配后默认按 item_id 勾选全部可执行行,未成熟项不可勾选', async () => {
|
||||
const transfer = useChatTransfer();
|
||||
await transfer.createPrecheck(['DBS-AWSBI'], '2026-08-06');
|
||||
expect(transfer.precheckId.value).toBe('TPC-20260806-001');
|
||||
expect(transfer.executableInvoices.value).toEqual(['INV-001', 'INV-002']);
|
||||
expect(transfer.selected.value.has('INV-001')).toBe(true);
|
||||
expect(transfer.selected.value.has('INV-041')).toBe(false);
|
||||
await transfer.createMatching(['DBS-AWSBI'], '2026-08-06');
|
||||
expect(transfer.matchingId.value).toBe('MTG-20260806-001');
|
||||
expect(transfer.executableItemIds.value).toEqual([11, 12]);
|
||||
expect(transfer.selected.value.has(11)).toBe(true);
|
||||
expect(transfer.selected.value.has(13)).toBe(false);
|
||||
});
|
||||
|
||||
it('执行时提交勾选范围并恢复 Run', async () => {
|
||||
it('执行时按明细行 id 提交勾选范围并恢复 Run', async () => {
|
||||
const transfer = useChatTransfer();
|
||||
await transfer.createPrecheck(['DBS-AWSBI']);
|
||||
transfer.toggleSelect('INV-001', false);
|
||||
await transfer.createMatching(['DBS-AWSBI']);
|
||||
transfer.toggleSelect(11, false);
|
||||
await transfer.execute();
|
||||
expect(api.executeTransferPrecheck).toHaveBeenCalledWith('TPC-20260806-001', ['INV-002']);
|
||||
expect(api.executeTransferItems).toHaveBeenCalledWith([12]);
|
||||
expect(transfer.runNo.value).toBe('RUN-20260806-1');
|
||||
expect(api.getTransferRun).toHaveBeenCalledWith('RUN-20260806-1');
|
||||
});
|
||||
|
||||
it('无选择时执行被拦截(不调用 API)', async () => {
|
||||
const transfer = useChatTransfer();
|
||||
await transfer.createPrecheck(['DBS-AWSBI']);
|
||||
await transfer.createMatching(['DBS-AWSBI']);
|
||||
transfer.selected.value = new Set();
|
||||
const result = await transfer.execute().catch(() => null);
|
||||
expect(result).toBeNull();
|
||||
expect(api.executeTransferPrecheck).not.toHaveBeenCalled();
|
||||
expect(api.executeTransferItems).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('resume 是批量重查的语义别名:按明细 id 直调 batch-requery', async () => {
|
||||
// [断言意图] 行式执行重构(2026-09-23):恢复处理不再重建匹配,
|
||||
// 前端 resume 与 batchRequery 同源(batch-requery 是恢复的唯一后端)。
|
||||
api.batchRequeryTransferItems.mockResolvedValue({
|
||||
total: 2,
|
||||
results: [
|
||||
{ item_id: 7, ok: true, status: 'ready_to_execute' },
|
||||
{ item_id: 8, ok: false, error: 'blocked' },
|
||||
],
|
||||
});
|
||||
const transfer = useChatTransfer();
|
||||
const result = await transfer.resume([7, 8]);
|
||||
expect(api.batchRequeryTransferItems).toHaveBeenCalledWith([7, 8]);
|
||||
expect(result.results.filter((entry) => entry.status === 'ready_to_execute')).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('busy 在请求期间置位,完成后复位(防重复点击)', async () => {
|
||||
let resolvePrecheck!: (value: unknown) => void;
|
||||
api.getTransferPrecheck.mockImplementation(
|
||||
() => new Promise((resolve) => { resolvePrecheck = resolve; }),
|
||||
let resolveMatching!: (value: unknown) => void;
|
||||
api.getTransferMatching.mockImplementation(
|
||||
() => new Promise((resolve) => { resolveMatching = resolve; }),
|
||||
);
|
||||
const transfer = useChatTransfer();
|
||||
const promise = transfer.createPrecheck(['DBS-AWSBI']);
|
||||
// 推进微任务链:createTransferPrecheck → getTransferPrecheck(mock 已执行)
|
||||
const promise = transfer.createMatching(['DBS-AWSBI']);
|
||||
// 推进微任务链:createTransferMatching → getTransferMatching(mock 已执行)
|
||||
await Promise.resolve();
|
||||
await Promise.resolve();
|
||||
expect(transfer.busy.value).toBe(true);
|
||||
resolvePrecheck(detail);
|
||||
resolveMatching(detail);
|
||||
await promise;
|
||||
expect(transfer.busy.value).toBe(false);
|
||||
});
|
||||
|
||||
it('reset 清空全部状态', async () => {
|
||||
const transfer = useChatTransfer();
|
||||
await transfer.createPrecheck(['DBS-AWSBI']);
|
||||
await transfer.createMatching(['DBS-AWSBI']);
|
||||
transfer.reset();
|
||||
expect(transfer.precheckId.value).toBeNull();
|
||||
expect(transfer.matchingId.value).toBeNull();
|
||||
expect(transfer.items.value).toHaveLength(0);
|
||||
expect(transfer.run.value).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('useChatTransfer Run 轮询(D8 异步 202 / D9 融合卡数据源)', () => {
|
||||
/** 轮询用例的标准 Run 载荷(status 可变,用于驱动终态/继续分支) */
|
||||
const polledRun = (status = 'executing') => ({
|
||||
run_no: 'RUN-POLL-1',
|
||||
status,
|
||||
result: { external_documents: [], exceptions: [] },
|
||||
orders: [],
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
vi.useFakeTimers();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
it('每 4s 轮询一次 getTransferRun:起始不立即打点,成功覆盖 run 并回吐 onUpdate', async () => {
|
||||
// [断言意图] 轮询是纯间隔制:提交流程已 refreshRun 一次,startRunPolling 起始不再重复打点;
|
||||
// 每轮成功才覆盖 run 旧值(失败轮不清屏),并把最新 Run 回吐给 onUpdate(融合卡渲染源)。
|
||||
const payload = polledRun();
|
||||
api.getTransferRun.mockResolvedValue(payload);
|
||||
const transfer = useChatTransfer();
|
||||
const onUpdate = vi.fn();
|
||||
transfer.startRunPolling('RUN-POLL-1', onUpdate);
|
||||
expect(api.getTransferRun).not.toHaveBeenCalled();
|
||||
await vi.advanceTimersByTimeAsync(4000);
|
||||
expect(api.getTransferRun).toHaveBeenCalledTimes(1);
|
||||
expect(api.getTransferRun).toHaveBeenCalledWith('RUN-POLL-1');
|
||||
expect(transfer.run.value).toEqual(payload);
|
||||
expect(onUpdate).toHaveBeenCalledWith(payload);
|
||||
await vi.advanceTimersByTimeAsync(4000);
|
||||
expect(api.getTransferRun).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
it('run.status 落入终态集合(success/partial_failed/failed)即停止轮询', async () => {
|
||||
// [断言意图] 终态判定只看 run.status(口径对齐后端 RUN_TRANSITIONS 收尾);
|
||||
// 终态后不再排下一轮定时器——即使再推进 20s 也不产生新请求。
|
||||
api.getTransferRun
|
||||
.mockResolvedValueOnce(polledRun('executing'))
|
||||
.mockResolvedValue(polledRun('success'));
|
||||
const transfer = useChatTransfer();
|
||||
transfer.startRunPolling('RUN-POLL-1', () => {});
|
||||
await vi.advanceTimersByTimeAsync(4000);
|
||||
expect(api.getTransferRun).toHaveBeenCalledTimes(1);
|
||||
await vi.advanceTimersByTimeAsync(4000);
|
||||
expect(api.getTransferRun).toHaveBeenCalledTimes(2);
|
||||
expect(transfer.run.value?.status).toBe('success');
|
||||
await vi.advanceTimersByTimeAsync(20000);
|
||||
expect(api.getTransferRun).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
it('run.status=cancelled(人工停止)驱动终态即停止轮询', async () => {
|
||||
// [断言意图] cancelled 是严格终态(后端人工停止、无出边):终态集合四态
|
||||
// success/partial_failed/failed/cancelled 中本用例单独锁定 cancelled 分支,
|
||||
// 取消后轮询必须停止——即使再推进 20s 也不产生新请求(防取消后空转)。
|
||||
api.getTransferRun
|
||||
.mockResolvedValueOnce(polledRun('executing'))
|
||||
.mockResolvedValue(polledRun('cancelled'));
|
||||
const transfer = useChatTransfer();
|
||||
transfer.startRunPolling('RUN-POLL-1', () => {});
|
||||
await vi.advanceTimersByTimeAsync(4000);
|
||||
expect(api.getTransferRun).toHaveBeenCalledTimes(1);
|
||||
await vi.advanceTimersByTimeAsync(4000);
|
||||
expect(api.getTransferRun).toHaveBeenCalledTimes(2);
|
||||
expect(transfer.run.value?.status).toBe('cancelled');
|
||||
await vi.advanceTimersByTimeAsync(20000);
|
||||
expect(api.getTransferRun).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
it('单次失败保留旧值并继续下一轮', async () => {
|
||||
// [断言意图] 网络抖动不清空已展示数据:失败轮 run 保持上一轮成功值;
|
||||
// 连续失败计数被成功拉取清零,下一轮照常执行。
|
||||
const first = polledRun();
|
||||
api.getTransferRun
|
||||
.mockResolvedValueOnce(first)
|
||||
.mockRejectedValueOnce(new Error('network down'))
|
||||
.mockResolvedValue(polledRun('success'));
|
||||
const transfer = useChatTransfer();
|
||||
transfer.startRunPolling('RUN-POLL-1', () => {});
|
||||
await vi.advanceTimersByTimeAsync(4000);
|
||||
expect(transfer.run.value).toEqual(first);
|
||||
await vi.advanceTimersByTimeAsync(4000);
|
||||
expect(transfer.run.value).toEqual(first);
|
||||
await vi.advanceTimersByTimeAsync(4000);
|
||||
expect(api.getTransferRun).toHaveBeenCalledTimes(3);
|
||||
expect(transfer.run.value?.status).toBe('success');
|
||||
});
|
||||
|
||||
it('连续失败达上限(3 次)后停止轮询并落 error', async () => {
|
||||
// [断言意图] 连续失败上限是防无限空转的兜底:达上限即停止并按既有模式落 error.value;
|
||||
// 单次失败不落 error(只有达上限这一刻才置位)。
|
||||
api.getTransferRun.mockRejectedValue(new Error('backend down'));
|
||||
const transfer = useChatTransfer();
|
||||
transfer.startRunPolling('RUN-POLL-1', () => {});
|
||||
await vi.advanceTimersByTimeAsync(12000);
|
||||
expect(api.getTransferRun).toHaveBeenCalledTimes(3);
|
||||
expect(transfer.error.value).not.toBe('');
|
||||
await vi.advanceTimersByTimeAsync(12000);
|
||||
expect(api.getTransferRun).toHaveBeenCalledTimes(3);
|
||||
});
|
||||
|
||||
it('手动 stop 句柄与作用域销毁均停止轮询', async () => {
|
||||
// [断言意图] 组件卸载/作用域销毁必须清理定时器(onScopeDispose),防止离屏后继续请求。
|
||||
api.getTransferRun.mockResolvedValue(polledRun());
|
||||
const scope = effectScope();
|
||||
let transfer!: ReturnType<typeof useChatTransfer>;
|
||||
scope.run(() => {
|
||||
transfer = useChatTransfer();
|
||||
});
|
||||
const stop = transfer.startRunPolling('RUN-POLL-1', () => {});
|
||||
stop();
|
||||
await vi.advanceTimersByTimeAsync(8000);
|
||||
expect(api.getTransferRun).not.toHaveBeenCalled();
|
||||
|
||||
api.getTransferRun.mockClear();
|
||||
transfer.startRunPolling('RUN-POLL-1', () => {});
|
||||
scope.stop();
|
||||
await vi.advanceTimersByTimeAsync(8000);
|
||||
expect(api.getTransferRun).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('execute 提交拿到 run_no 后自动开始轮询并随终态停止', async () => {
|
||||
// [断言意图] D8 提交只拿 {run_no,status:'queued'}:既有 refreshRun 打第 1 点,
|
||||
// 随后轮询自动接管(第 2/3 点),全单终态(run → success)后停止。
|
||||
api.createTransferMatching.mockResolvedValue(summary);
|
||||
api.getTransferMatching.mockResolvedValue(detail);
|
||||
api.executeTransferItems.mockResolvedValue({ run_no: 'RUN-AUTO-1', status: 'queued' });
|
||||
api.getTransferRun
|
||||
.mockResolvedValueOnce(polledRun())
|
||||
.mockResolvedValueOnce(polledRun())
|
||||
.mockResolvedValue({ ...polledRun('success'), run_no: 'RUN-AUTO-1' });
|
||||
const transfer = useChatTransfer();
|
||||
await transfer.createMatching(['DBS-AWSBI']);
|
||||
await transfer.execute();
|
||||
expect(api.getTransferRun).toHaveBeenCalledTimes(1);
|
||||
await vi.advanceTimersByTimeAsync(4000);
|
||||
expect(api.getTransferRun).toHaveBeenCalledTimes(2);
|
||||
await vi.advanceTimersByTimeAsync(4000);
|
||||
expect(api.getTransferRun).toHaveBeenCalledTimes(3);
|
||||
await vi.advanceTimersByTimeAsync(20000);
|
||||
expect(api.getTransferRun).toHaveBeenCalledTimes(3);
|
||||
});
|
||||
});
|
||||
|
||||
describe('useChatTransfer 来源状态轮询(收料 RPA 202 异步收口)', () => {
|
||||
/** 来源选择卡轮询用例的标准来源载荷(file_status 可变,驱动 fetching→终态分支) */
|
||||
const sourceOptionsWith = (file_status: string) => [
|
||||
{
|
||||
source_code: 'CRANE-FP',
|
||||
display_name: 'Crane FootPrint',
|
||||
platform: 'CRANE',
|
||||
enabled: true,
|
||||
file_status,
|
||||
has_ready_file: file_status === 'ready',
|
||||
},
|
||||
];
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
vi.useFakeTimers();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
it('重试收料 RPA 后来源处于抓取中即自动轮询,收口(ready)后停止', async () => {
|
||||
// [断言意图] 重试 202 返回后 loadSources 首帧仍是 fetching(RPA 回调未到),
|
||||
// 轮询必须自动接管:收口帧把 抓取中→ready 投影进 sourceOptions(修复状态卡死),
|
||||
// 全部来源脱离 fetching 即停——再推进 20s 也不产生新请求。
|
||||
api.retryTransferSourceRpa.mockResolvedValue({ source_code: 'CRANE-FP', ok: true, file_status: 'fetching' });
|
||||
api.listTransferSources
|
||||
.mockResolvedValueOnce(sourceOptionsWith('fetching'))
|
||||
.mockResolvedValue(sourceOptionsWith('ready'));
|
||||
const transfer = useChatTransfer();
|
||||
await transfer.retrySourceRpa('CRANE-FP');
|
||||
expect(transfer.sourceOptions.value[0].file_status).toBe('fetching');
|
||||
await vi.advanceTimersByTimeAsync(4000);
|
||||
expect(api.listTransferSources).toHaveBeenCalledTimes(2);
|
||||
expect(transfer.sourceOptions.value[0].file_status).toBe('ready');
|
||||
await vi.advanceTimersByTimeAsync(20000);
|
||||
expect(api.listTransferSources).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
it('loadSources 观察到抓取中来源(页面刷新/会话恢复)同样自动启动轮询', async () => {
|
||||
// [断言意图] 轮询挂在 loadSources 快照同步上而非只挂重试入口:进入卡片时
|
||||
// 已有 fetching 来源(上次触发后刷新页面)也必须继续跟踪到收口。
|
||||
api.listTransferSources
|
||||
.mockResolvedValueOnce(sourceOptionsWith('fetching'))
|
||||
.mockResolvedValue(sourceOptionsWith('failed'));
|
||||
const transfer = useChatTransfer();
|
||||
await transfer.loadSources();
|
||||
await vi.advanceTimersByTimeAsync(4000);
|
||||
expect(api.listTransferSources).toHaveBeenCalledTimes(2);
|
||||
expect(transfer.sourceOptions.value[0].file_status).toBe('failed');
|
||||
});
|
||||
|
||||
it('来源均非抓取中时不启动轮询', async () => {
|
||||
// [断言意图] 无 fetching 来源不产生任何后台请求(轮询只为收口跟踪而存在)。
|
||||
api.listTransferSources.mockResolvedValue(sourceOptionsWith('ready'));
|
||||
const transfer = useChatTransfer();
|
||||
await transfer.loadSources();
|
||||
await vi.advanceTimersByTimeAsync(12000);
|
||||
expect(api.listTransferSources).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('来源轮询连续失败达上限(3 次)后停止且不落 error', async () => {
|
||||
// [断言意图] 连续失败上限与 Run 轮询同口径(防无限空转);差异点:来源轮询
|
||||
// 不落 error.value(卡片有手动重试/确认门禁兜底,失败噪声不上抛主流程)。
|
||||
api.retryTransferSourceRpa.mockResolvedValue({ source_code: 'CRANE-FP', ok: true, file_status: 'fetching' });
|
||||
api.listTransferSources
|
||||
.mockResolvedValueOnce(sourceOptionsWith('fetching'))
|
||||
.mockRejectedValue(new Error('backend down'));
|
||||
const transfer = useChatTransfer();
|
||||
await transfer.retrySourceRpa('CRANE-FP');
|
||||
await vi.advanceTimersByTimeAsync(12000);
|
||||
expect(api.listTransferSources).toHaveBeenCalledTimes(4); // 首帧 1 + 轮询 3
|
||||
expect(transfer.error.value).toBe('');
|
||||
await vi.advanceTimersByTimeAsync(12000);
|
||||
expect(api.listTransferSources).toHaveBeenCalledTimes(4);
|
||||
});
|
||||
|
||||
it('reset 与作用域销毁均停止来源轮询', async () => {
|
||||
// [断言意图] 离开卡片(reset/卸载)必须清理来源轮询定时器,防离屏后继续请求。
|
||||
api.listTransferSources.mockResolvedValue(sourceOptionsWith('fetching'));
|
||||
const scope = effectScope();
|
||||
let transfer!: ReturnType<typeof useChatTransfer>;
|
||||
scope.run(() => {
|
||||
transfer = useChatTransfer();
|
||||
});
|
||||
await transfer.loadSources();
|
||||
transfer.reset();
|
||||
await vi.advanceTimersByTimeAsync(12000);
|
||||
expect(api.listTransferSources).toHaveBeenCalledTimes(1);
|
||||
|
||||
await transfer.loadSources();
|
||||
scope.stop();
|
||||
await vi.advanceTimersByTimeAsync(12000);
|
||||
expect(api.listTransferSources).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
});
|
||||
@@ -1,23 +1,33 @@
|
||||
/**
|
||||
* features/chat/composables/useChatTransfer.ts
|
||||
* 用途:在途仓自动调拨聊天编排入口——预检创建/恢复、选择范围、直接生成执行 Run、
|
||||
* Run 进度与结果恢复、人工重试/关闭、下载。
|
||||
* 依赖:transfer.api、transfer.types、useMessage、Vue refs/computed。
|
||||
* 逻辑:前端只消费稳定 DTO;Run 是异步真相源,刷新/重进由 GET 恢复;
|
||||
* 用途:在途仓自动调拨聊天编排入口——匹配创建/恢复、选择范围(按明细 item_id)、
|
||||
* 按行直接生成执行 Run(D8 异步 202)、Run 轮询与结果恢复(D9 调拨单清单)、
|
||||
* 人工重试/关闭、恢复处理(重查)、下载。
|
||||
* 依赖:transfer.api、transfer.types、useMessage、Vue refs/computed/effect scope。
|
||||
* 逻辑:前端只消费稳定 DTO;Run 是异步真相源——提交只拿 {run_no,status:'queued'},
|
||||
* 进度/结果由 4s 轮询 getTransferRun 获取,终态(run.status)即停,刷新/重进由 GET 恢复;
|
||||
* 来源收料 RPA 同为异步收口——重试 202 后投影 fetching,存在 fetching 来源时
|
||||
* 4s 轮询 GET /sources 直至全部脱离 fetching(ready/failed/expired/none);
|
||||
* 勾选集合以明细行 item_id 为键(历史回放行无 item_id 不可选);
|
||||
* 恢复处理 = 按明细 id 重查库存(batch-requery 是唯一后端);
|
||||
* 防重复点击(busy);错误统一 useMessage 展示 BusinessError。
|
||||
*/
|
||||
import { computed, ref, type Ref } from 'vue';
|
||||
import { computed, getCurrentScope, onScopeDispose, ref, type Ref } from 'vue';
|
||||
import i18n from '@/i18n';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import {
|
||||
batchManualCloseTransferItems,
|
||||
batchRequeryTransferItems,
|
||||
cancelTransferRun,
|
||||
createTransferPrecheck,
|
||||
createTransferMatching,
|
||||
downloadTransferErpInventory,
|
||||
downloadTransferExceptions,
|
||||
downloadTransferReceiptFiles,
|
||||
executeTransferPrecheck,
|
||||
executeTransferItems,
|
||||
getTransferBacklogSummary,
|
||||
getTransferPrecheck,
|
||||
getTransferMatching,
|
||||
getTransferRun,
|
||||
listExecutableTransferItems,
|
||||
listTransferBacklog,
|
||||
listTransferSources,
|
||||
manualCloseTransferItem,
|
||||
@@ -27,41 +37,93 @@ import {
|
||||
import type {
|
||||
TransferBacklogItem,
|
||||
TransferBacklogSummary,
|
||||
TransferPrecheckDetail,
|
||||
TransferPrecheckItem,
|
||||
TransferPrecheckSummary,
|
||||
TransferBatchResult,
|
||||
TransferMatchingDetail,
|
||||
TransferMatchingItem,
|
||||
TransferMatchingSummary,
|
||||
TransferRunResult,
|
||||
TransferSourceOption,
|
||||
TransferSourceProgress,
|
||||
TransferType,
|
||||
} from '../types/transfer.types';
|
||||
|
||||
/** Run 轮询间隔(ms):D9 融合卡「调拨单清单=进度=结果」按 4s 定时拉取 GET /runs/{run_no} */
|
||||
const RUN_POLL_INTERVAL_MS = 4000;
|
||||
|
||||
/** 轮询连续失败停止上限:防后端持续不可用时无限空转;单次失败保留旧值继续下一轮 */
|
||||
const RUN_POLL_MAX_CONSECUTIVE_FAILURES = 3;
|
||||
|
||||
/** 来源状态轮询间隔(ms):来源选择卡存在抓取中来源时按 4s 重拉 GET /sources(与 Run 轮询同节奏) */
|
||||
const SOURCE_POLL_INTERVAL_MS = 4000;
|
||||
|
||||
/** 来源轮询连续失败停止上限(口径同 Run 轮询):防后端持续不可用时无限空转 */
|
||||
const SOURCE_POLL_MAX_CONSECUTIVE_FAILURES = 3;
|
||||
|
||||
/**
|
||||
* Run 轮询终态集合(口径对齐后端 status.py RUN_TRANSITIONS 收尾):
|
||||
* executing 只流向 success / partial_failed / failed / cancelled——
|
||||
* success=全单成功族;partial_failed/failed=存在未成单(唯一出边=人工 retrigger,
|
||||
* 由重触发流程重新发起轮询,不作为轮询继续条件);cancelled=人工停止的严格终态
|
||||
* (防止取消后轮询空转)。「单全终态」由后端 finalize_run 汇总进 run.status,
|
||||
* 前端只判 run.status,无需逐单推断。
|
||||
*/
|
||||
const TERMINAL_RUN_STATUSES: ReadonlySet<string> = new Set([
|
||||
'success',
|
||||
'partial_failed',
|
||||
'failed',
|
||||
'cancelled',
|
||||
]);
|
||||
|
||||
/**
|
||||
* Run 是否已处终态(轮询停止判据,口径同 TERMINAL_RUN_STATUSES)。
|
||||
* 融合卡/视图在挂载与恢复场景用其决定「原位渲染」还是「继续轮询」。
|
||||
*/
|
||||
export function isTerminalRunStatus(status: string | null | undefined): boolean {
|
||||
return typeof status === 'string' && TERMINAL_RUN_STATUSES.has(status);
|
||||
}
|
||||
|
||||
export function useChatTransfer() {
|
||||
const { error: notifyError } = useMessage();
|
||||
|
||||
const precheckId = ref<string | null>(null);
|
||||
const precheck = ref<TransferPrecheckSummary | null>(null);
|
||||
const items = ref<TransferPrecheckItem[]>([]);
|
||||
const matchingId = ref<string | null>(null);
|
||||
const matching = ref<TransferMatchingSummary | null>(null);
|
||||
const items = ref<TransferMatchingItem[]>([]);
|
||||
const sources = ref<TransferSourceProgress[]>([]);
|
||||
const runNo = ref<string | null>(null);
|
||||
const run = ref<TransferRunResult | null>(null);
|
||||
const backlog = ref<TransferBacklogItem[]>([]);
|
||||
const backlogSummary = ref<TransferBacklogSummary | null>(null);
|
||||
const executableItems = ref<TransferMatchingItem[]>([]);
|
||||
const sourceOptions = ref<TransferSourceOption[]>([]);
|
||||
const selected = ref<Set<string>>(new Set());
|
||||
const selected = ref<Set<number>>(new Set());
|
||||
const busy = ref(false);
|
||||
const error = ref('');
|
||||
|
||||
/** 全部可执行 Invoice(阻断/未成熟不可勾选) */
|
||||
const executableInvoices = computed(() =>
|
||||
items.value.filter((item) => item.result === 'executable').map((item) => item.invoice_no),
|
||||
// Run 轮询状态(实例级闭包):generation 使被停止/替换轮次的在途回调失效,防止僵尸轮询复活
|
||||
let pollTimer: ReturnType<typeof setTimeout> | null = null;
|
||||
let pollGeneration = 0;
|
||||
let pollConsecutiveFailures = 0;
|
||||
// 轮询连接状态(交互细则 #2:单次失败保留旧值继续轮询,连续失败显示「连接中…」不清空画面)
|
||||
const pollConnecting = ref(false);
|
||||
// 来源状态轮询状态(实例级闭包,generation 语义同 Run 轮询):
|
||||
// 收料 RPA 是异步回调收口(重试 202 后状态先投影 fetching,终态靠后端回调落库),
|
||||
// 前端必须轮询 GET /sources 才能把 抓取中→ready/failed 反映到来源选择卡
|
||||
let sourcePollTimer: ReturnType<typeof setTimeout> | null = null;
|
||||
let sourcePollGeneration = 0;
|
||||
let sourcePollConsecutiveFailures = 0;
|
||||
|
||||
/** 全部可执行明细行 id(阻断/未成熟/无 item_id 的历史行不可勾选) */
|
||||
const executableItemIds = computed(() =>
|
||||
items.value
|
||||
.filter((item) => item.result === 'executable' && item.item_id != null)
|
||||
.map((item) => item.item_id as number),
|
||||
);
|
||||
|
||||
const selectedCount = computed(() => selected.value.size);
|
||||
const estimatedQuantity = computed(() => precheck.value?.estimated_transfer_quantity ?? '0');
|
||||
const estimatedQuantity = computed(() => matching.value?.estimated_transfer_quantity ?? '0');
|
||||
|
||||
/** 创建预检(缺文件时来源级阶段展示等待/失败);transferType 决定收料数据范围,缺省在途仓至HUB仓 */
|
||||
async function createPrecheck(
|
||||
/** 创建匹配(缺文件时来源级阶段展示等待/失败);transferType 决定收料数据范围,缺省在途仓至HUB仓 */
|
||||
async function createMatching(
|
||||
sourceCodes: string[],
|
||||
businessDate?: string,
|
||||
dateRange?: { from?: string; to?: string },
|
||||
@@ -70,15 +132,15 @@ export function useChatTransfer() {
|
||||
busy.value = true;
|
||||
error.value = '';
|
||||
try {
|
||||
const summary = await createTransferPrecheck({
|
||||
const summary = await createTransferMatching({
|
||||
source_codes: sourceCodes,
|
||||
business_date: businessDate,
|
||||
receipt_date_from: dateRange?.from,
|
||||
receipt_date_to: dateRange?.to,
|
||||
transfer_type: transferType,
|
||||
});
|
||||
precheckId.value = summary.precheck_id;
|
||||
await refreshPrecheck();
|
||||
matchingId.value = summary.matching_id;
|
||||
await refreshMatching();
|
||||
return summary;
|
||||
} catch (e) {
|
||||
error.value = String(e);
|
||||
@@ -88,44 +150,52 @@ export function useChatTransfer() {
|
||||
}
|
||||
}
|
||||
|
||||
/** 恢复预检进度(页面刷新/会话恢复) */
|
||||
async function refreshPrecheck() {
|
||||
if (!precheckId.value) return null;
|
||||
const detail = await getTransferPrecheck(precheckId.value);
|
||||
/** 恢复匹配进度(页面刷新/会话恢复) */
|
||||
async function refreshMatching() {
|
||||
if (!matchingId.value) return null;
|
||||
const detail = await getTransferMatching(matchingId.value);
|
||||
applyDetail(detail);
|
||||
return detail;
|
||||
}
|
||||
|
||||
function applyDetail(detail: TransferPrecheckDetail) {
|
||||
precheck.value = detail.summary;
|
||||
function applyDetail(detail: TransferMatchingDetail) {
|
||||
matching.value = detail.summary;
|
||||
items.value = detail.items;
|
||||
sources.value = detail.sources;
|
||||
// 默认勾选全部可执行项;阻断/未成熟不可选
|
||||
// 默认勾选全部可执行明细行(按 item_id);阻断/未成熟/无 item_id 不可选
|
||||
selected.value = new Set(
|
||||
detail.items.filter((item) => item.result === 'executable').map((item) => item.invoice_no),
|
||||
detail.items
|
||||
.filter((item) => item.result === 'executable' && item.item_id != null)
|
||||
.map((item) => item.item_id as number),
|
||||
);
|
||||
}
|
||||
|
||||
function toggleSelect(invoiceNo: string, checked: boolean) {
|
||||
function toggleSelect(itemId: number, checked: boolean) {
|
||||
const next = new Set(selected.value);
|
||||
if (checked) next.add(invoiceNo);
|
||||
else next.delete(invoiceNo);
|
||||
if (checked) next.add(itemId);
|
||||
else next.delete(itemId);
|
||||
selected.value = next;
|
||||
}
|
||||
|
||||
/** 直接生成调拨单(决策 4/5:无独立确认页) */
|
||||
/**
|
||||
* 按勾选明细行直接生成调拨单(item-centric:门禁在后端,失败抛 BusinessError)。
|
||||
* D8 异步 202:提交只拿 { run_no, status: 'queued' }——先 refreshRun 打底一帧,
|
||||
* 随后自动开始 4s 轮询接管进度/结果,直至 run.status 落入终态集合。
|
||||
*/
|
||||
async function execute() {
|
||||
if (!precheckId.value) throw new Error('precheck not created');
|
||||
if (selected.value.size === 0) {
|
||||
notifyError('请至少选择一个可执行 Invoice');
|
||||
// [P2-2] 组合式函数可能运行在组件 setup 之外(单测直调),经 i18n.global 取四语言文案
|
||||
notifyError(i18n.global.t('chat.transfer.execute.noSelection'));
|
||||
return null;
|
||||
}
|
||||
busy.value = true;
|
||||
error.value = '';
|
||||
try {
|
||||
const result = await executeTransferPrecheck(precheckId.value, [...selected.value]);
|
||||
const result = await executeTransferItems([...selected.value]);
|
||||
runNo.value = result.run_no;
|
||||
await refreshRun();
|
||||
// 提交成功即自动轮询(沿既有交互流:busy 复位后卡片可直接消费 run 更新)
|
||||
startRunPolling(result.run_no, () => {});
|
||||
return result;
|
||||
} catch (e) {
|
||||
error.value = String(e);
|
||||
@@ -135,33 +205,123 @@ export function useChatTransfer() {
|
||||
}
|
||||
}
|
||||
|
||||
/** 恢复 Run 最终结果 */
|
||||
async function refreshRun() {
|
||||
if (!runNo.value) return null;
|
||||
const data = await getTransferRun(runNo.value);
|
||||
/** 恢复 Run 结果与调拨单清单(D9:run 含 orders 调拨单清单,终态 Run 亦同口径投影)。
|
||||
* @param runNoArg 显式 run_no(融合卡自驱动轮询用自有实例按卡内 run_no 拉取);
|
||||
* 缺省沿用实例 runNo(既有提交/恢复路径不变)。 */
|
||||
async function refreshRun(runNoArg?: string) {
|
||||
const target = runNoArg ?? runNo.value;
|
||||
if (!target) return null;
|
||||
const data = await getTransferRun(target);
|
||||
run.value = data;
|
||||
return data;
|
||||
}
|
||||
|
||||
/** 请求停止剩余任务 */
|
||||
/**
|
||||
* 停止当前 Run 轮询(幂等,即 startRunPolling 返回的手动句柄)。
|
||||
* 核心逻辑:递增 generation 使在途请求的回调失效(防止僵尸轮询复活),
|
||||
* 并清掉尚未触发的定时器;重复调用安全。
|
||||
*/
|
||||
function stopRunPolling() {
|
||||
pollGeneration += 1;
|
||||
if (pollTimer !== null) {
|
||||
clearTimeout(pollTimer);
|
||||
pollTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动 Run 轮询(D8 异步 202:提交只拿 run_no,进度/结果靠轮询调拨单清单直至终态)。
|
||||
*
|
||||
* 【AI 触发时机】:execute 提交拿到 run_no 后自动调用;或页面刷新/会话恢复
|
||||
* 拿到未终态 run_no 时由调用方手动调用——融合卡靠 onUpdate 逐单亮状态与 ERP 单号。
|
||||
*
|
||||
* 核心逻辑:[STEP 1] 停掉本实例既有轮询(单实例单轮询,重复调用先停旧轮);
|
||||
* [STEP 2] 间隔制 4s 定时 GET getTransferRun——起始不立即打点(提交流程已 refreshRun);
|
||||
* [STEP 3] 成功才覆盖 run 旧值并回吐 onUpdate;run.status 落入 TERMINAL_RUN_STATUSES 即停;
|
||||
* [STEP 4] 单次失败保留旧值(不清 run、不置 error)继续下一轮;连续失败达
|
||||
* RUN_POLL_MAX_CONSECUTIVE_FAILURES 上限才停止并按既有模式落 error.value。
|
||||
* 清理:作用域销毁自动停止(onScopeDispose 在组合式函数创建时注册——
|
||||
* execute/手动调用都发生在 setup 之后的无作用域上下文,不能在此刻注册);返回手动 stop 句柄。
|
||||
*
|
||||
* @param pollRunNo - Run 编号(必传;来自 execute 响应或回放 payload 的 run_no;
|
||||
* 参数名带 poll 前缀避免遮蔽外层同名 runNo ref)
|
||||
* @param onUpdate - 每轮成功拉取的回调(参数为最新 TransferRunResult,含 orders;
|
||||
* 业务约束:禁止在该回调内再次调用 startRunPolling,避免同实例轮询互相顶替)
|
||||
* @returns stop 手动停止句柄(幂等,可重复调用)
|
||||
*/
|
||||
function startRunPolling(pollRunNo: string, onUpdate: (run: TransferRunResult) => void): () => void {
|
||||
stopRunPolling();
|
||||
const generation = ++pollGeneration;
|
||||
pollConsecutiveFailures = 0;
|
||||
pollConnecting.value = false; // 新轮询起点:连接视为正常,失败帧再置位
|
||||
|
||||
const scheduleNext = () => {
|
||||
if (generation !== pollGeneration) return;
|
||||
pollTimer = setTimeout(() => { void pollOnce(); }, RUN_POLL_INTERVAL_MS);
|
||||
};
|
||||
|
||||
const pollOnce = async () => {
|
||||
if (generation !== pollGeneration) return;
|
||||
try {
|
||||
const data = await getTransferRun(pollRunNo);
|
||||
if (generation !== pollGeneration) return;
|
||||
pollConsecutiveFailures = 0;
|
||||
pollConnecting.value = false; // 成功帧恢复连接态(保留旧值→新值,画面不清空)
|
||||
run.value = data;
|
||||
onUpdate(data);
|
||||
if (TERMINAL_RUN_STATUSES.has(data.status)) {
|
||||
// [P1 双保险] retrigger 窗口不误停:人工重新触发(result_unknown 单)受理时,
|
||||
// 后端已同步把 run.status 置回 executing(T10 同步段),故「retrigger 已受理但
|
||||
// worker 未领取」的瞬态不会以陈旧终态落入本判定而提前停轮;
|
||||
// 前端半(融合卡 confirmRetrigger)在进入本间隔轮询前先 refreshRun 打一帧兜底。
|
||||
stopRunPolling();
|
||||
return; // 终态:不再排下一轮
|
||||
}
|
||||
} catch (e) {
|
||||
if (generation !== pollGeneration) return;
|
||||
pollConsecutiveFailures += 1;
|
||||
pollConnecting.value = true; // 连续失败显示「连接中…」;终限停止后保留该提示
|
||||
if (pollConsecutiveFailures >= RUN_POLL_MAX_CONSECUTIVE_FAILURES) {
|
||||
error.value = String(e);
|
||||
stopRunPolling();
|
||||
return;
|
||||
}
|
||||
// 单次失败:保留旧值,静默进入下一轮
|
||||
}
|
||||
scheduleNext();
|
||||
};
|
||||
|
||||
scheduleNext();
|
||||
return stopRunPolling;
|
||||
}
|
||||
|
||||
// 卸载/作用域销毁清理:必须在组合式函数创建时(setup 作用域内)注册;
|
||||
// stopRunPolling/stopSourcePolling 均幂等,轮询未启动/已停止时调用为空操作。
|
||||
if (getCurrentScope()) onScopeDispose(() => {
|
||||
stopRunPolling();
|
||||
stopSourcePolling();
|
||||
});
|
||||
|
||||
/** 请求停止剩余任务(run → cancelled 后本轮轮询一并停止,避免空转) */
|
||||
async function cancelRun(reason: string) {
|
||||
if (!runNo.value) return null;
|
||||
const result = await cancelTransferRun(runNo.value, reason);
|
||||
await refreshRun();
|
||||
stopRunPolling();
|
||||
return result;
|
||||
}
|
||||
|
||||
/** 人工重试异常项 */
|
||||
async function retry(itemId: number) {
|
||||
const result = await retryTransferItem(itemId);
|
||||
await refreshPrecheck();
|
||||
await refreshMatching();
|
||||
return result;
|
||||
}
|
||||
|
||||
/** 人工关闭异常项 */
|
||||
async function manualClose(itemId: number, reason: string) {
|
||||
const result = await manualCloseTransferItem(itemId, reason);
|
||||
await refreshPrecheck();
|
||||
await refreshMatching();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -173,7 +333,7 @@ export function useChatTransfer() {
|
||||
return result;
|
||||
}
|
||||
|
||||
/** 下载预检冻结的 ERP 库存表(csv) */
|
||||
/** 下载匹配冻结的 ERP 库存表(csv) */
|
||||
async function downloadErpInventory() {
|
||||
if (!runNo.value) return null;
|
||||
const result = await downloadTransferErpInventory(runNo.value);
|
||||
@@ -189,13 +349,83 @@ export function useChatTransfer() {
|
||||
return result;
|
||||
}
|
||||
|
||||
/** 加载来源实例列表(决策 3:平台仅分组,每来源附收料文件状态) */
|
||||
/** 加载来源实例列表(决策 3:平台仅分组,每来源附收料文件状态);
|
||||
* 载入后按快照同步来源轮询:存在 fetching 来源即自动接管(触发重试后 RPA 异步收口,
|
||||
* 终态 ready/failed 只有重拉 /sources 才可见——否则来源卡永远停在「抓取中」)。 */
|
||||
async function loadSources() {
|
||||
sourceOptions.value = await listTransferSources();
|
||||
syncSourcePolling();
|
||||
return sourceOptions.value;
|
||||
}
|
||||
|
||||
/** 对指定来源重新触发收料 RPA 抓取,并刷新来源状态 */
|
||||
/**
|
||||
* 停止来源状态轮询(幂等):递增 generation 使在途回调失效并清掉未触发定时器。
|
||||
* 【AI 触发时机】:离开来源选择卡(确认匹配切匹配卡/回放替换 payload)与
|
||||
* 作用域销毁/reset 时由调用方调用,防止离屏后继续请求。
|
||||
*/
|
||||
function stopSourcePolling() {
|
||||
sourcePollGeneration += 1;
|
||||
if (sourcePollTimer !== null) {
|
||||
clearTimeout(sourcePollTimer);
|
||||
sourcePollTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 启动来源状态轮询(4s 间隔制,语义对齐 Run 轮询):按 interval 重拉 GET /sources,
|
||||
* 成功才覆盖 sourceOptions;全部来源脱离 fetching(ready/failed/expired/none 投影)
|
||||
* 即停止;单次失败保留旧值继续下一轮,连续失败达上限才停止(不落 error——来源卡
|
||||
* 有手动重试/刷新兜底,避免轮询失败噪声打断主流程)。
|
||||
* 起始不立即打点:两条进入路径(loadSources 挂载恢复 / retrySourceRpa 触发后)都已有新鲜一帧。
|
||||
*/
|
||||
function startSourcePolling() {
|
||||
stopSourcePolling();
|
||||
const generation = ++sourcePollGeneration;
|
||||
sourcePollConsecutiveFailures = 0;
|
||||
|
||||
const scheduleNext = () => {
|
||||
if (generation !== sourcePollGeneration) return;
|
||||
sourcePollTimer = setTimeout(() => { void pollOnce(); }, SOURCE_POLL_INTERVAL_MS);
|
||||
};
|
||||
|
||||
const pollOnce = async () => {
|
||||
if (generation !== sourcePollGeneration) return;
|
||||
try {
|
||||
const options = await listTransferSources();
|
||||
if (generation !== sourcePollGeneration) return;
|
||||
sourcePollConsecutiveFailures = 0;
|
||||
sourceOptions.value = options;
|
||||
// 直接判服务端快照(不经 syncSourcePolling,防与既有轮询互相顶替)
|
||||
if (!options.some((source) => source.file_status === 'fetching')) {
|
||||
stopSourcePolling();
|
||||
return;
|
||||
}
|
||||
} catch {
|
||||
if (generation !== sourcePollGeneration) return;
|
||||
sourcePollConsecutiveFailures += 1;
|
||||
if (sourcePollConsecutiveFailures >= SOURCE_POLL_MAX_CONSECUTIVE_FAILURES) {
|
||||
stopSourcePolling();
|
||||
return;
|
||||
}
|
||||
// 单次失败:保留旧值,静默进入下一轮
|
||||
}
|
||||
scheduleNext();
|
||||
};
|
||||
|
||||
scheduleNext();
|
||||
}
|
||||
|
||||
/** 按当前来源快照同步轮询启停:有抓取中来源→启动(重复调用先停旧轮),无→停止。 */
|
||||
function syncSourcePolling() {
|
||||
if (sourceOptions.value.some((source) => source.file_status === 'fetching')) {
|
||||
startSourcePolling();
|
||||
} else {
|
||||
stopSourcePolling();
|
||||
}
|
||||
}
|
||||
|
||||
/** 对指定来源重新触发收料 RPA 抓取,并刷新来源状态(触发后 202 + fetching,
|
||||
* loadSources 观察到 fetching 即自动开始来源轮询,RPA 回调收口后状态自动刷新) */
|
||||
async function retrySourceRpa(sourceCode: string) {
|
||||
const status = await retryTransferSourceRpa(sourceCode);
|
||||
await loadSources();
|
||||
@@ -210,6 +440,29 @@ export function useChatTransfer() {
|
||||
return { items, summary };
|
||||
}
|
||||
|
||||
/** 加载可调拨明细(全局可执行行队列;恢复后的行会出现在这里) */
|
||||
async function loadExecutableItems() {
|
||||
const payload = await listExecutableTransferItems();
|
||||
executableItems.value = payload.items;
|
||||
return executableItems.value;
|
||||
}
|
||||
|
||||
/** 批量重查库存(单行隔离,结果由调用方刷新列表后展示) */
|
||||
async function batchRequery(itemIds: number[]): Promise<TransferBatchResult> {
|
||||
return batchRequeryTransferItems(itemIds);
|
||||
}
|
||||
|
||||
/** 恢复处理(行级/多选):恢复语义 = 按明细 id 重查库存(batch-requery 唯一后端);
|
||||
* 返回批量结果,由视图统计 recovered(status=ready_to_execute)与仍阻断数。 */
|
||||
async function resume(itemIds: number[]): Promise<TransferBatchResult> {
|
||||
return batchRequeryTransferItems(itemIds);
|
||||
}
|
||||
|
||||
/** 批量人工关闭(原因整批共用;单行隔离) */
|
||||
async function batchManualClose(itemIds: number[], reason: string): Promise<TransferBatchResult> {
|
||||
return batchManualCloseTransferItems(itemIds, reason);
|
||||
}
|
||||
|
||||
function saveBlob(blob: Blob, filename: string) {
|
||||
const url = URL.createObjectURL(blob);
|
||||
const link = document.createElement('a');
|
||||
@@ -220,46 +473,59 @@ export function useChatTransfer() {
|
||||
}
|
||||
|
||||
function reset() {
|
||||
precheckId.value = null;
|
||||
precheck.value = null;
|
||||
stopRunPolling();
|
||||
stopSourcePolling();
|
||||
matchingId.value = null;
|
||||
matching.value = null;
|
||||
items.value = [];
|
||||
sources.value = [];
|
||||
runNo.value = null;
|
||||
run.value = null;
|
||||
backlog.value = [];
|
||||
backlogSummary.value = null;
|
||||
executableItems.value = [];
|
||||
sourceOptions.value = [];
|
||||
selected.value = new Set();
|
||||
error.value = '';
|
||||
}
|
||||
|
||||
return {
|
||||
precheckId,
|
||||
precheck,
|
||||
matchingId,
|
||||
matching,
|
||||
items,
|
||||
sources,
|
||||
runNo,
|
||||
run,
|
||||
pollConnecting,
|
||||
backlog,
|
||||
backlogSummary,
|
||||
executableItems,
|
||||
sourceOptions,
|
||||
selected,
|
||||
selectedCount,
|
||||
executableInvoices,
|
||||
executableItemIds,
|
||||
estimatedQuantity,
|
||||
busy,
|
||||
error,
|
||||
createPrecheck,
|
||||
refreshPrecheck,
|
||||
createMatching,
|
||||
refreshMatching,
|
||||
toggleSelect,
|
||||
execute,
|
||||
refreshRun,
|
||||
startRunPolling,
|
||||
stopRunPolling,
|
||||
startSourcePolling,
|
||||
stopSourcePolling,
|
||||
cancelRun,
|
||||
retry,
|
||||
manualClose,
|
||||
loadSources,
|
||||
retrySourceRpa,
|
||||
loadBacklog,
|
||||
loadExecutableItems,
|
||||
batchRequery,
|
||||
resume,
|
||||
batchManualClose,
|
||||
downloadReceiptFiles,
|
||||
downloadErpInventory,
|
||||
downloadExceptions,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* features/chat/e2e/in-transit-transfer.spec.ts
|
||||
* 用途:在途仓自动调拨全链路契约冒烟(对应 TDD §10 主路径)——
|
||||
* 预检 → 选择子集 → 直接生成调拨单 → Run 恢复 → 下载留底。
|
||||
* 匹配 → 选择子集 → 生成调拨单 → Run 恢复 → 下载留底。
|
||||
* 依赖:Vitest、vi.mock(transfer.api)、useChatTransfer。
|
||||
* 逻辑:不启浏览器;用组合式函数 + Mock API 断言产品契约,避免 e2e 环境依赖
|
||||
* (与仓库 shipping e2e 约定一致)。
|
||||
@@ -9,9 +9,9 @@
|
||||
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
||||
|
||||
const api = vi.hoisted(() => ({
|
||||
createTransferPrecheck: vi.fn(),
|
||||
getTransferPrecheck: vi.fn(),
|
||||
executeTransferPrecheck: vi.fn(),
|
||||
createTransferMatching: vi.fn(),
|
||||
getTransferMatching: vi.fn(),
|
||||
executeTransferItems: vi.fn(),
|
||||
getTransferRun: vi.fn(),
|
||||
retryTransferItem: vi.fn(),
|
||||
manualCloseTransferItem: vi.fn(),
|
||||
@@ -23,25 +23,25 @@ const api = vi.hoisted(() => ({
|
||||
vi.mock('@/features/chat/api/transfer.api', () => api);
|
||||
|
||||
import { useChatTransfer } from '@/features/chat/composables/useChatTransfer';
|
||||
import type { TransferPrecheckDetail } from '@/features/chat/types/transfer.types';
|
||||
import type { TransferMatchingDetail } from '@/features/chat/types/transfer.types';
|
||||
|
||||
const detail: TransferPrecheckDetail = {
|
||||
const detail: TransferMatchingDetail = {
|
||||
summary: {
|
||||
precheck_id: 'TPC-20260806-001',
|
||||
matching_id: 'MTG-20260806-001',
|
||||
status: 'ready_to_execute',
|
||||
business_date: '2026-08-06',
|
||||
eligible_receipt_date_to: '2026-08-05',
|
||||
expires_at: '',
|
||||
counts: { file_invoice_count: 3, not_matured_count: 1, prechecked_count: 2, executable_count: 2, blocked_count: 0 },
|
||||
counts: { file_invoice_count: 3, not_matured_count: 1, matched_count: 2, executable_count: 2, blocked_count: 0 },
|
||||
estimated_transfer_quantity: '2400',
|
||||
estimated_external_write_count: 2,
|
||||
precheck_hash: 'sha256:abc',
|
||||
matching_hash: 'sha256:abc',
|
||||
},
|
||||
sources: [{ source_code: 'DBS-AWSBI', stage: 'file_ready', file_no: 'REC-1', file_version: 'v3' }],
|
||||
items: [
|
||||
{ source_code: 'DBS-AWSBI', material_no: 'MAT-1', material_name: '连接器组件', specification: 'A', invoice_no: 'INV-001', from_warehouse: 'DBS-TRANSIT', from_quantity: '1200', to_warehouse: 'HUB-CN01', to_quantity: '1200', result: 'executable' },
|
||||
{ source_code: 'DBS-AWSBI', material_no: 'MAT-2', material_name: '控制器组件', specification: 'B', invoice_no: 'INV-002', from_warehouse: 'DBS-TRANSIT', from_quantity: '1200', to_warehouse: 'HUB-CN01', to_quantity: '1200', result: 'executable' },
|
||||
{ source_code: 'DBS-AWSSG', material_no: 'MAT-41', material_name: '连接器', specification: 'C', invoice_no: 'INV-041', from_warehouse: '', from_quantity: null, to_warehouse: '', to_quantity: '400', result: 'not_matured' },
|
||||
{ item_id: 11, source_code: 'DBS-AWSBI', material_no: 'MAT-1', material_name: '连接器组件', specification: 'A', invoice_no: 'INV-001', from_warehouse: 'DBS-TRANSIT', from_quantity: '1200', to_warehouse: 'HUB-CN01', to_quantity: '1200', result: 'executable' },
|
||||
{ item_id: 12, source_code: 'DBS-AWSBI', material_no: 'MAT-2', material_name: '控制器组件', specification: 'B', invoice_no: 'INV-002', from_warehouse: 'DBS-TRANSIT', from_quantity: '1200', to_warehouse: 'HUB-CN01', to_quantity: '1200', result: 'executable' },
|
||||
{ item_id: 13, source_code: 'DBS-AWSSG', material_no: 'MAT-41', material_name: '连接器', specification: 'C', invoice_no: 'INV-041', from_warehouse: '', from_quantity: null, to_warehouse: '', to_quantity: '400', result: 'not_matured' },
|
||||
],
|
||||
};
|
||||
|
||||
@@ -68,23 +68,23 @@ const runResult = {
|
||||
describe('in-transit-transfer e2e contract', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
api.createTransferPrecheck.mockResolvedValue(detail.summary);
|
||||
api.getTransferPrecheck.mockResolvedValue(detail);
|
||||
api.executeTransferPrecheck.mockResolvedValue({ run_no: 'RUN-20260806-001', status: 'success' });
|
||||
api.createTransferMatching.mockResolvedValue(detail.summary);
|
||||
api.getTransferMatching.mockResolvedValue(detail);
|
||||
api.executeTransferItems.mockResolvedValue({ run_no: 'RUN-20260806-001', status: 'success' });
|
||||
api.getTransferRun.mockResolvedValue(runResult);
|
||||
api.downloadTransferReceiptFiles.mockResolvedValue({ blob: new Blob(['zip']), filename: 'receipt-files.zip' });
|
||||
api.downloadTransferErpInventory.mockResolvedValue({ blob: new Blob(['csv']), filename: 'erp.csv' });
|
||||
});
|
||||
|
||||
it('主路径:预检 → 只选 INV-001 → 生成调拨单 → 结果按 ERP 单号聚合', async () => {
|
||||
it('主路径:匹配 → 只选 item 11 → 按明细行生成调拨单 → 结果按 ERP 单号聚合', async () => {
|
||||
const transfer = useChatTransfer();
|
||||
await transfer.createPrecheck(['DBS-AWSBI', 'DBS-AWSSG'], '2026-08-06');
|
||||
await transfer.createMatching(['DBS-AWSBI', 'DBS-AWSSG'], '2026-08-06');
|
||||
// 未成熟项默认不勾选
|
||||
expect(transfer.selected.value.has('INV-041')).toBe(false);
|
||||
// 取消 INV-002,只执行 INV-001
|
||||
transfer.toggleSelect('INV-002', false);
|
||||
expect(transfer.selected.value.has(13)).toBe(false);
|
||||
// 取消 item 12,只执行 item 11
|
||||
transfer.toggleSelect(12, false);
|
||||
await transfer.execute();
|
||||
expect(api.executeTransferPrecheck).toHaveBeenCalledWith('TPC-20260806-001', ['INV-001']);
|
||||
expect(api.executeTransferItems).toHaveBeenCalledWith([11]);
|
||||
expect(transfer.run.value?.result.external_documents[0].document_no).toBe('TRF-10001');
|
||||
});
|
||||
|
||||
|
||||
@@ -234,7 +234,7 @@ export interface ChatMessage {
|
||||
content: string;
|
||||
/** 用户提交时固化的附件展示快照;助手消息不使用此字段。 */
|
||||
attachments?: ChatMessageAttachment[];
|
||||
type?: 'text' | 'leave-form' | 'leave-confirmation' | 'leave-result' | 'shipping-inventory-mapping' | 'shipping-parse-review' | 'shipping-match-result' | 'maintenance-device-result' | 'procurement-contract-review' | 'transfer-precheck' | 'transfer-progress' | 'transfer-result';
|
||||
type?: 'text' | 'leave-form' | 'leave-confirmation' | 'leave-result' | 'shipping-inventory-mapping' | 'shipping-parse-review' | 'shipping-match-result' | 'maintenance-device-result' | 'procurement-contract-review' | 'transfer-match' | 'transfer-progress' | 'transfer-result';
|
||||
retriever_resources?: RetrieverResource[];
|
||||
attribution_parts?: string[];
|
||||
chat_log_id?: number;
|
||||
|
||||
@@ -2,19 +2,24 @@
|
||||
* features/chat/types/transfer.types.ts
|
||||
* 用途:在途仓自动调拨前端 DTO 类型(与后端 /api/in-transit-transfer 契约一致)。
|
||||
* 依赖:无。
|
||||
* 逻辑:卡片/组合式函数只消费这些稳定类型;状态与后端 13 状态集对齐。
|
||||
* 逻辑:卡片/组合式函数只消费这些稳定类型;行状态与后端 13 状态集对齐,
|
||||
* 单(TransferDocument)状态八态与 Run 调拨单清单(orders)对齐后端 Task 11 序列化。
|
||||
*/
|
||||
|
||||
/** 调拨业务类型(与后端 TransferType 枚举一致;类型 2/3 一期占位未开放) */
|
||||
export type TransferType = 'in_transit_to_hub' | 'hub_repair_out' | 'hub_to_hub';
|
||||
|
||||
/** 预检计数 */
|
||||
export interface TransferPrecheckCounts {
|
||||
/** 匹配计数 */
|
||||
export interface TransferMatchingCounts {
|
||||
file_invoice_count: number;
|
||||
not_matured_count: number;
|
||||
prechecked_count: number;
|
||||
matched_count: number;
|
||||
executable_count: number;
|
||||
blocked_count: number;
|
||||
/** 文件已落地、尚未查 ERP 库存的待查行数 */
|
||||
pending_stock_check_count?: number;
|
||||
/** 文件消失已出清的失效行数(不进默认视图) */
|
||||
invalid_count?: number;
|
||||
}
|
||||
|
||||
/** 原始文件行追溯 */
|
||||
@@ -24,21 +29,23 @@ export interface TransferRawLine {
|
||||
file_version: string;
|
||||
}
|
||||
|
||||
/** 预检摘要 */
|
||||
export interface TransferPrecheckSummary {
|
||||
precheck_id: string;
|
||||
/** 匹配摘要 */
|
||||
export interface TransferMatchingSummary {
|
||||
matching_id: string;
|
||||
status: string;
|
||||
business_date: string;
|
||||
eligible_receipt_date_to: string;
|
||||
expires_at: string;
|
||||
counts: TransferPrecheckCounts;
|
||||
counts: TransferMatchingCounts;
|
||||
estimated_transfer_quantity: string;
|
||||
estimated_external_write_count: number;
|
||||
precheck_hash: string;
|
||||
matching_hash: string;
|
||||
}
|
||||
|
||||
/** 预检明细项(决策 6:十列字段) */
|
||||
export interface TransferPrecheckItem {
|
||||
/** 匹配明细项(决策 6:十列字段 + 行装饰字段;item_id 为勾选/执行主键) */
|
||||
export interface TransferMatchingItem {
|
||||
/** 明细行 id(执行/重查的勾选键);历史回放 payload 可能缺省(缺省行禁选) */
|
||||
item_id?: number;
|
||||
source_code: string;
|
||||
material_no: string;
|
||||
material_name: string;
|
||||
@@ -54,6 +61,12 @@ export interface TransferPrecheckItem {
|
||||
erp_document_no?: string | null;
|
||||
raw_lines?: TransferRawLine[];
|
||||
lot_no?: string;
|
||||
/** 库存查询时刻(行评估时间,ISO);缺省为旧 payload */
|
||||
checked_at?: string | null;
|
||||
/** 匹配新鲜度:超过 TTL(10 分钟)为 true,执行门禁会拦截 */
|
||||
stale?: boolean;
|
||||
/** 行评估所用收料文件版本与来源最新可用文件是否一致;false = 文件已更新需重新匹配 */
|
||||
file_current?: boolean;
|
||||
}
|
||||
|
||||
/** 来源实例级进度(决策 18:来源隔离展示) */
|
||||
@@ -67,10 +80,10 @@ export interface TransferSourceProgress {
|
||||
error_message?: string | null;
|
||||
}
|
||||
|
||||
/** 预检恢复响应 */
|
||||
export interface TransferPrecheckDetail {
|
||||
summary: TransferPrecheckSummary;
|
||||
items: TransferPrecheckItem[];
|
||||
/** 匹配恢复响应 */
|
||||
export interface TransferMatchingDetail {
|
||||
summary: TransferMatchingSummary;
|
||||
items: TransferMatchingItem[];
|
||||
sources: TransferSourceProgress[];
|
||||
}
|
||||
|
||||
@@ -103,7 +116,41 @@ export interface TransferExceptionItem {
|
||||
facts: string;
|
||||
}
|
||||
|
||||
/** Run 结果投影 */
|
||||
/**
|
||||
* 调拨单(TransferDocument)状态八态,与后端单状态机一致(status.py / execution_service):
|
||||
* pending(待执行)→ executing(执行中)→ success / duplicate_success(成功族,带 ERP 单号)/
|
||||
* business_failed / technical_failed(失败族,error_message 带原因)/ result_unknown(结果未知,
|
||||
* 唯一出边=人工 retrigger)/ cancelled(人工关闭单)。
|
||||
*/
|
||||
export type TransferOrderStatus = 'pending' | 'executing' | 'success' | 'duplicate_success'
|
||||
| 'business_failed' | 'technical_failed' | 'result_unknown' | 'cancelled';
|
||||
|
||||
/** 单内行(ERP 写入行粒度聚合:物料+批号;quantity 为 6 位小数字符串,与 D14 快照口径一致) */
|
||||
export interface TransferOrderLine {
|
||||
material_no: string;
|
||||
material_name: string;
|
||||
lot_no: string;
|
||||
quantity: string;
|
||||
unit: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 调拨单(D9 融合卡数据源:调拨单清单=进度=结果)。
|
||||
* 与后端 GET /runs/{run_no} 返回体 orders 数组逐键对应(serialize_run_orders);
|
||||
* erp_document_no / error_message 二态互斥(成功族带单号,失败族带原因,其余为 null)。
|
||||
*/
|
||||
export interface TransferOrder {
|
||||
doc_no: string;
|
||||
receipt_date: string;
|
||||
from_warehouse: string;
|
||||
to_warehouse: string;
|
||||
status: TransferOrderStatus;
|
||||
erp_document_no: string | null;
|
||||
error_message: string | null;
|
||||
lines: TransferOrderLine[];
|
||||
}
|
||||
|
||||
/** Run 结果投影(result 单号聚合 + orders 调拨单清单:D9 融合卡数据源) */
|
||||
export interface TransferRunResult {
|
||||
run_no: string;
|
||||
status: string;
|
||||
@@ -111,16 +158,22 @@ export interface TransferRunResult {
|
||||
external_documents: ErpDocument[];
|
||||
exceptions: TransferExceptionItem[];
|
||||
};
|
||||
/** 调拨单清单(后端 Task 11 序列化逐键;终态 Run 亦同口径投影) */
|
||||
orders: TransferOrder[];
|
||||
}
|
||||
|
||||
/** 执行响应 */
|
||||
/**
|
||||
* 执行响应(D8 异步 202:POST /items/execute 只做门禁+建 Run+建单+入队,
|
||||
* data = { run_no, status: 'queued' };进度/结果由前端轮询 GET /runs/{run_no} 获取)。
|
||||
* result 为同步执行时代的旧口径,202 后不再返回,保留可选兼容历史回放 payload。
|
||||
*/
|
||||
export interface TransferExecuteResponse {
|
||||
run_no: string;
|
||||
status: string;
|
||||
result?: TransferRunResult['result'];
|
||||
}
|
||||
|
||||
/** 待处理池项 */
|
||||
/** 待处理池项(明细字段与匹配窗口列一致) */
|
||||
export interface TransferBacklogItem {
|
||||
item_id: number;
|
||||
source_code: string;
|
||||
@@ -128,9 +181,24 @@ export interface TransferBacklogItem {
|
||||
material_no: string;
|
||||
status: string;
|
||||
reason: string;
|
||||
/** 最近一次结果码(如 blocked_file_removed=收料行已从最新文件移除);缺省为普通阻断 */
|
||||
result_code?: string | null;
|
||||
age_days: number;
|
||||
aging_level: string;
|
||||
last_attempt_at?: string | null;
|
||||
receipt_date?: string | null;
|
||||
material_name?: string | null;
|
||||
from_warehouse?: string | null;
|
||||
to_warehouse?: string | null;
|
||||
lot_no?: string | null;
|
||||
receipt_quantity?: string | null;
|
||||
external_quantity?: string | null;
|
||||
}
|
||||
|
||||
/** 批量操作结果(单行隔离:ok 行带 status,失败行带 error) */
|
||||
export interface TransferBatchResult {
|
||||
total: number;
|
||||
results: Array<{ item_id: number; invoice_no?: string; ok: boolean; status?: string; error?: string }>;
|
||||
}
|
||||
|
||||
/** 操作结果(重试/关闭/取消) */
|
||||
@@ -142,6 +210,16 @@ export interface TransferActionResult {
|
||||
cancelled_count?: number;
|
||||
}
|
||||
|
||||
|
||||
/** 调拨单级重试响应(retry_document:全部 ready 自动重跑,部分阻断留恢复池) */
|
||||
export interface TransferDocumentRetryResult {
|
||||
doc_no: string;
|
||||
rerun: boolean;
|
||||
run_no: string | null;
|
||||
ready: number;
|
||||
blocked: { invoice_no: string; item_id: number; reason: string }[];
|
||||
total: number;
|
||||
}
|
||||
/** 待处理池汇总 */
|
||||
export interface TransferBacklogSummary {
|
||||
recoverable: number;
|
||||
@@ -162,7 +240,7 @@ export interface TransferSourceOption {
|
||||
enabled: boolean;
|
||||
/** 收料文件状态:ready / fetching / failed / expired / none(只读投影货代收料事实) */
|
||||
file_status?: 'ready' | 'fetching' | 'failed' | 'expired' | 'none';
|
||||
/** 是否已有当前可用的收料文件(门禁:无 ready 文件禁止确认预检) */
|
||||
/** 是否已有当前可用的收料文件(门禁:无 ready 文件禁止确认匹配) */
|
||||
has_ready_file?: boolean;
|
||||
file_no?: string | null;
|
||||
file_sha256?: string | null;
|
||||
@@ -176,3 +254,53 @@ export interface TransferSourceFileStatus {
|
||||
file_no?: string | null;
|
||||
file_sha256?: string | null;
|
||||
}
|
||||
|
||||
/** 已执行单统计分组(首页区块 chip;计数恒全量,不受筛选影响——后端口径) */
|
||||
export interface TransferOrderGroups {
|
||||
success: number;
|
||||
failed: number;
|
||||
executing: number;
|
||||
result_unknown: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 已执行单行明细(invoice 粒度;GET /documents orders[].items,
|
||||
* 与融合卡的聚合 lines 不同——本视图逐 Invoice 行展示,供展开明细与关闭影响面核对)。
|
||||
*/
|
||||
export interface TransferExecutedOrderItem {
|
||||
invoice_no: string;
|
||||
material_no: string;
|
||||
material_name: string;
|
||||
lot_no: string;
|
||||
quantity: string;
|
||||
unit: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 已执行单(首页「已执行」区块;与后端 GET /documents 返回体 orders 逐键对应)。
|
||||
* run_no 为重新触发(D11)所需——result_unknown 行持它调
|
||||
* POST /runs/{run_no}/documents/{doc_no}/retrigger(T13 封装 retriggerTransferDocument)。
|
||||
*/
|
||||
export interface TransferExecutedOrder {
|
||||
doc_no: string;
|
||||
submit_timestamp: string;
|
||||
status: TransferOrderStatus;
|
||||
status_group: keyof TransferOrderGroups;
|
||||
receipt_date: string;
|
||||
from_warehouse: string;
|
||||
to_warehouse: string;
|
||||
erp_document_no: string | null;
|
||||
error_message: string | null;
|
||||
created_at: string;
|
||||
run_no: string | null;
|
||||
items: TransferExecutedOrderItem[];
|
||||
}
|
||||
|
||||
/** 已执行单分页查询响应(GET /documents;groups 计数恒全量,total 为筛选后分页总数) */
|
||||
export interface TransferExecutedOrdersPage {
|
||||
groups: TransferOrderGroups;
|
||||
total: number;
|
||||
page: number;
|
||||
page_size: number;
|
||||
orders: TransferExecutedOrder[];
|
||||
}
|
||||
@@ -1,13 +1,29 @@
|
||||
/**
|
||||
* 合同付款预警 API 类型与请求封装。
|
||||
* 依赖:统一 requestJson;后端 /api/contract-payment。
|
||||
* 逻辑:台账/合同详情查询、汇总卡统计、待发送摘要、每日扫描入队、周五汇总入队及批次附件下载。
|
||||
* 逻辑:台账/合同详情查询、汇总卡统计、待发送摘要、每日扫描入队、周五汇总入队、批次附件下载、失败原因及后台任务状态。
|
||||
* 待确认合同的人工复核提交到 manual-review,通过后合同进入台账。
|
||||
* 带 JSON body 的 POST 必须声明 Content-Type: application/json,否则 Flask 拒绝解析。
|
||||
*/
|
||||
import { requestBlob, requestJson } from '@/shared/api/client';
|
||||
|
||||
/**
|
||||
* 组装带 JSON 正文的 POST。
|
||||
* 核心逻辑:Flask 的 request.get_json 只在 Content-Type 为 application/json 时读取 body。
|
||||
* @param body - 将序列化为 JSON 的请求体。
|
||||
* @returns fetch 的 method、headers 与 body。
|
||||
*/
|
||||
function jsonPost(body: unknown): RequestInit {
|
||||
return {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(body),
|
||||
};
|
||||
}
|
||||
|
||||
export interface PaymentNode {
|
||||
id: number; node_code: string; node_type: string; amount?: string | null; percentage?: string | null;
|
||||
anchor_type?: string | null; anchor_date?: string | null; due_date?: string | null; paid_at?: string | null; status: string;
|
||||
anchor_type?: string | null; anchor_date?: string | null; due_date?: string | null; paid_at?: string | null; paid_source?: string | null; status: string;
|
||||
}
|
||||
export interface PaymentAlert { id: number; node_id: number; alert_round: number; scheduled_at?: string | null; sent_at?: string | null; recipient_user_id?: number | null; status: string; }
|
||||
export interface ContractAttachment {
|
||||
@@ -16,7 +32,8 @@ export interface ContractAttachment {
|
||||
}
|
||||
export interface ContractPaymentContract {
|
||||
id: number; contract_no?: string | null; workflow_no?: string | null; purchase_order_no?: string | null;
|
||||
supplier_name?: string | null; total_amount?: string | null; currency?: string | null; applicant_name?: string | null;
|
||||
supplier_name?: string | null; company_name?: string | null; erp_schema?: string | null;
|
||||
total_amount?: string | null; currency?: string | null; applicant_name?: string | null;
|
||||
effective_date?: string | null; delivery_due_date?: string | null; oa_archive_at?: string | null;
|
||||
status: string; parse_status: string; plan_status: string; parse_issues?: string[]; nodes: PaymentNode[]; alerts?: PaymentAlert[]; attachments?: ContractAttachment[];
|
||||
}
|
||||
@@ -28,7 +45,8 @@ export interface LedgerSummary {
|
||||
active: number;
|
||||
due_this_month: number;
|
||||
}
|
||||
export interface AlertBatch { id: number; batch_no: string; week_key: string; status: string; summary?: { total?: number; stages?: Record<string, number> }; excel_file_name?: string | null; excel_file_size?: number | null; sent_at?: string | null; }
|
||||
export interface AlertBatchFailureReason { code: string; detail?: string | null; }
|
||||
export interface AlertBatch { id: number; batch_no: string; week_key: string; status: string; summary?: { total?: number; stages?: Record<string, number> }; excel_file_name?: string | null; excel_file_size?: number | null; sent_at?: string | null; created_at?: string | null; failure_reasons?: AlertBatchFailureReason[]; }
|
||||
export interface AlertSummary { pending_count: number; next_send_at?: string | null; timezone?: string | null; }
|
||||
|
||||
/**
|
||||
@@ -37,7 +55,7 @@ export interface AlertSummary { pending_count: number; next_send_at?: string | n
|
||||
* @param params.keyword - 模糊检索词,可为空。
|
||||
* @param params.parse_status - 解析状态精确筛选。
|
||||
* @param params.reviewOnly - 为 true 时只查 needs_review。
|
||||
* @param params.focus - 汇总卡口径:即将到期 / 逾期未付 / 进行中 / 本月应付。
|
||||
* @param params.focus - 汇总卡口径:即将到期 / 逾期未付 / 未到期 / 本月应付。
|
||||
* @returns 分页后的合同列表。
|
||||
*/
|
||||
export const listContractPaymentContracts = (params?: { keyword?: string; parse_status?: string; reviewOnly?: boolean; focus?: LedgerFocus; page?: number; pageSize?: number }) => {
|
||||
@@ -48,14 +66,56 @@ export const listContractPaymentContracts = (params?: { keyword?: string; parse_
|
||||
export const getContractPaymentContract = (contractId: number) => requestJson<ContractPaymentContract>(`/api/contract-payment/contracts/${contractId}`);
|
||||
/** 用已归档的盖章合同原文重新解析,并返回覆盖后的合同详情。 */
|
||||
export const reparseContractPaymentContract = (contractId: number) => requestJson<{ contract: ContractPaymentContract; parse_result: { status: string }; attachment_name: string }>(`/api/contract-payment/contracts/${contractId}/reparse`, { method: 'POST' });
|
||||
|
||||
export interface ManualReviewStageInput {
|
||||
node_type: string;
|
||||
skipped: boolean;
|
||||
percentage: string;
|
||||
amount: string;
|
||||
basis_date: string;
|
||||
}
|
||||
export interface ManualReviewInput {
|
||||
purchase_order_no: string;
|
||||
contract_no: string;
|
||||
total_amount: string;
|
||||
archive_date: string;
|
||||
stages: ManualReviewStageInput[];
|
||||
}
|
||||
/**
|
||||
* 提交待确认合同的人工复核。
|
||||
* 核心逻辑:后端校验比例合计、金额和必填日期;通过后合同 parse_status 变为 parsed。
|
||||
* @param contractId - 合同台账主键。
|
||||
* @param payload - 采购单号、合同金额和四个付款阶段。
|
||||
* @returns 复核后的合同详情。
|
||||
*/
|
||||
/**
|
||||
* 把未付的预付款或出货款标为已付。
|
||||
* 核心逻辑:只提交这一阶段的付款日期和可选说明;后端关闭尚未发送的预警。
|
||||
* @param contractId - 合同台账主键。
|
||||
* @param nodeId - 付款节点主键。
|
||||
* @param payload.paidDate - 付款日期,YYYY-MM-DD。
|
||||
* @param payload.remark - 可选说明。
|
||||
* @returns 更新后的合同详情。
|
||||
*/
|
||||
export const markContractPaymentNodePaid = (contractId: number, nodeId: number, payload: { paidDate: string; remark?: string }) => requestJson<{ contract: ContractPaymentContract }>(`/api/contract-payment/contracts/${contractId}/nodes/${nodeId}/mark-paid`, jsonPost({ paid_date: payload.paidDate, remark: payload.remark || '' }));
|
||||
export const submitContractPaymentManualReview = (contractId: number, payload: ManualReviewInput) => requestJson<{ contract: ContractPaymentContract }>(`/api/contract-payment/contracts/${contractId}/manual-review`, jsonPost(payload));
|
||||
/** 下载当前登录用户有权限访问的合同原文附件。 */
|
||||
export const downloadContractPaymentAttachment = (contractId: number, attachmentId: number) => requestBlob(`/api/contract-payment/contracts/${contractId}/attachments/${attachmentId}/download`);
|
||||
/** 提交 OA 合同同步;force 为 true 时由后端显式覆盖本次 OA 返回的非空主表字段。 */
|
||||
export const enqueueContractPaymentSync = (force = false) => requestJson<{ job_id: string }>('/api/contract-payment/sync', { method: 'POST', body: JSON.stringify({ force }) });
|
||||
export const enqueueContractPaymentSync = (force = false) => requestJson<{ job_id: string }>('/api/contract-payment/sync', jsonPost({ force }));
|
||||
/** 提交存量合同批量重解析,直接使用已归档附件刷新历史解析结果。 */
|
||||
export const enqueueContractPaymentReparse = () => requestJson<{ job_id: string }>('/api/contract-payment/sync', { method: 'POST', body: JSON.stringify({ reparse_existing: true }) });
|
||||
export const enqueueContractPaymentReparse = () => requestJson<{ job_id: string }>('/api/contract-payment/sync', jsonPost({ reparse_existing: true }));
|
||||
export const enqueueContractPaymentAlertScan = () => requestJson<{ job_id: string }>('/api/contract-payment/alerts/run', { method: 'POST' });
|
||||
export const enqueueContractPaymentWeeklyAlert = () => requestJson<{ job_id: string }>('/api/contract-payment/alerts/weekly-run', { method: 'POST' });
|
||||
export const enqueueContractPaymentWeeklyAlert = () => requestJson<{ job_id: number }>('/api/contract-payment/alerts/weekly-run', { method: 'POST' });
|
||||
export interface ContractPaymentJobResult { batches?: number; sent?: number; failed?: number; alerts?: number; }
|
||||
export interface ContractPaymentJob { id: number; status: string; message?: string | null; result?: ContractPaymentJobResult | null; }
|
||||
/**
|
||||
* 查询当前管理员刚提交的合同付款后台任务。
|
||||
* 核心逻辑:发送预警只是入队,页面需轮询本接口直到 success / failed,再刷新周汇总列表。
|
||||
* @param jobId - 入队接口返回的任务主键。
|
||||
* @returns 任务状态与发送计数。
|
||||
*/
|
||||
export const getContractPaymentJob = (jobId: number) => requestJson<ContractPaymentJob>(`/api/contract-payment/jobs/${jobId}`);
|
||||
/** 查询本周待发送笔数和下一次周五汇总发送时间。 */
|
||||
export const getContractPaymentAlertSummary = () => requestJson<AlertSummary>('/api/contract-payment/alerts/summary');
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,9 @@
|
||||
逻辑:由 ChatViewContent 在 agent_code=contract_payment 时替换消息列表与输入框;
|
||||
view / contractId 写入 /chat/:agentId 查询参数,旧工作台地址重定向后仍可深链打开。
|
||||
列表 Tab 内容区 overflow-hidden,把纵向滚动交给子页表格区域;Chat 顶栏仅保留标题。
|
||||
管理员顶栏顺序:同步 OA → 发送预警 → 更多;前两者常显,低频操作收进「更多」以节省小屏高度。
|
||||
管理员顶栏顺序:同步 OA → 发送预警 → 更多;前两者常显,低频操作收进「更多」以节省小屏高度。这些操作确认后才入队。
|
||||
发送预警结束后重新拉取周汇总批次,避免列表停在点击前的失败记录。
|
||||
待确认与台账点进合同都打开原来的详情。待复核详情上的人工复核确认后回到合同台账并刷新角标。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, onUnmounted, ref, watch } from 'vue';
|
||||
@@ -37,15 +39,24 @@ const reviewCount = ref(0);
|
||||
const moreMenuOpen = ref(false);
|
||||
const moreMenuRef = ref<HTMLElement | null>(null);
|
||||
|
||||
const batchesPage = ref<{ reload: () => Promise<void> } | null>(null);
|
||||
|
||||
/**
|
||||
* 周汇总发送结束后刷新当前批次表。
|
||||
* 核心逻辑:只有停在周汇总 Tab 时组件才挂载;其它 Tab 下次进入会自行加载。
|
||||
*/
|
||||
async function reloadWeeklyBatches(): Promise<void> {
|
||||
await batchesPage.value?.reload();
|
||||
}
|
||||
|
||||
const {
|
||||
isAdmin,
|
||||
actionLoading,
|
||||
showForceSyncConfirm,
|
||||
showReparseExistingConfirm,
|
||||
showActionConfirm,
|
||||
confirmCopy,
|
||||
run,
|
||||
confirmForceSync,
|
||||
confirmReparseExisting,
|
||||
} = useContractPaymentAdminActions();
|
||||
confirmPendingAction,
|
||||
} = useContractPaymentAdminActions(reloadWeeklyBatches);
|
||||
|
||||
const tabs = computed(() => ([
|
||||
{ key: 'ledger' as const, label: t('admin.contractPayment.ledger') },
|
||||
@@ -82,12 +93,21 @@ function openDetail(contractId: number): void {
|
||||
}
|
||||
|
||||
/**
|
||||
* 从详情返回当前 Tab 列表。
|
||||
* 从详情或复核返回当前 Tab 列表。
|
||||
*/
|
||||
function closeDetail(): void {
|
||||
void syncQuery(activeView.value, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 人工复核通过后回到合同台账,并刷新待确认角标。
|
||||
* 核心逻辑:合同已离开 needs_review,停在待确认会看到空行;台账才是复核结果的落点。
|
||||
*/
|
||||
async function onReviewConfirmed(): Promise<void> {
|
||||
await syncQuery('ledger', null);
|
||||
await loadReviewCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取待确认合同数量,供 Tab 角标展示。
|
||||
* 核心逻辑:只取 total,不拉列表正文,失败时角标归零不打断主区。
|
||||
@@ -243,6 +263,7 @@ watch(
|
||||
:contract-id="detailId"
|
||||
embedded
|
||||
@close="closeDetail"
|
||||
@reviewed="onReviewConfirmed"
|
||||
/>
|
||||
<ContractPaymentPage
|
||||
v-else-if="activeView === 'ledger'"
|
||||
@@ -258,6 +279,7 @@ watch(
|
||||
/>
|
||||
<ContractPaymentWeeklyBatchesPage
|
||||
v-else
|
||||
ref="batchesPage"
|
||||
class="h-full min-h-0 flex-1"
|
||||
embedded
|
||||
/>
|
||||
@@ -265,19 +287,11 @@ watch(
|
||||
|
||||
<DeleteConfirmDialog
|
||||
v-if="isAdmin"
|
||||
v-model="showForceSyncConfirm"
|
||||
:title="t('admin.contractPayment.forceSync')"
|
||||
:message="t('admin.contractPayment.forceSyncConfirm')"
|
||||
v-model="showActionConfirm"
|
||||
:title="confirmCopy.title"
|
||||
:message="confirmCopy.message"
|
||||
confirm-tone="primary"
|
||||
@confirm="confirmForceSync"
|
||||
/>
|
||||
<DeleteConfirmDialog
|
||||
v-if="isAdmin"
|
||||
v-model="showReparseExistingConfirm"
|
||||
:title="t('admin.contractPayment.reparseExisting')"
|
||||
:message="t('admin.contractPayment.reparseExistingConfirm')"
|
||||
confirm-tone="primary"
|
||||
@confirm="confirmReparseExisting"
|
||||
@confirm="confirmPendingAction"
|
||||
/>
|
||||
</section>
|
||||
</template>
|
||||
+113
-26
@@ -2,7 +2,8 @@
|
||||
* features/contract-payment/composables/useContractPaymentAdminActions.ts
|
||||
* 用途:合同付款预警管理员异步任务(同步 / 重解析 / 扫描 / 发送)共用入口。
|
||||
* 依赖:contract-payment.api、useAuthStore、useMessage、i18n。
|
||||
* 逻辑:Chat 顶栏与旧台账页共用;非管理员直接忽略,强制覆盖和存量重解析先走确认框。
|
||||
* 逻辑:Chat 顶栏与旧台账页共用;非管理员直接忽略。同步、强制覆盖、存量重解析、扫描和发送预警都先走确认框。
|
||||
* 发送预警会等到后台任务结束,再按 sent/failed 提示,并回调刷新周汇总列表。
|
||||
*/
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
@@ -14,14 +15,37 @@ import {
|
||||
enqueueContractPaymentReparse,
|
||||
enqueueContractPaymentSync,
|
||||
enqueueContractPaymentWeeklyAlert,
|
||||
getContractPaymentJob,
|
||||
type ContractPaymentJob,
|
||||
} from '../api/contract-payment.api';
|
||||
|
||||
export type ContractPaymentAdminAction = 'sync' | 'force-sync' | 'reparse-existing' | 'scan' | 'weekly';
|
||||
|
||||
const WEEKLY_JOB_POLL_MS = 1000;
|
||||
const WEEKLY_JOB_TIMEOUT_MS = 90_000;
|
||||
const WEEKLY_JOB_DONE = new Set(['success', 'failed', 'dead', 'cancelled']);
|
||||
|
||||
/**
|
||||
* 轮询周汇总发送任务,直到进入终态或超时。
|
||||
* 核心逻辑:入队接口立即返回,真正的企微发送在 Worker 里;页面不能把「已提交」当成发送完成。
|
||||
* @param jobId - 刚入队的任务主键。
|
||||
* @returns 终态任务;超时返回 null。
|
||||
*/
|
||||
async function waitForWeeklyJob(jobId: number): Promise<ContractPaymentJob | null> {
|
||||
const deadline = Date.now() + WEEKLY_JOB_TIMEOUT_MS;
|
||||
while (Date.now() < deadline) {
|
||||
const job = await getContractPaymentJob(jobId);
|
||||
if (WEEKLY_JOB_DONE.has(job.status)) return job;
|
||||
await new Promise((resolve) => window.setTimeout(resolve, WEEKLY_JOB_POLL_MS));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提供合同付款预警管理员操作状态与提交函数。
|
||||
* 核心逻辑:仅 role=admin 可提交;入队成功只提示任务已提交,不阻塞等待 Worker。
|
||||
* @param onAfterScanOrWeekly - 扫描或发送后刷新本周待发送摘要的回调
|
||||
* 核心逻辑:仅 role=admin 可提交。同步、强制覆盖、重解析、扫描和发送都先确认再入队。
|
||||
* 发送预警会等到 Worker 结束,先刷新列表,再按 sent/failed 提示。
|
||||
* @param onAfterScanOrWeekly - 扫描提交后或周汇总发送结束后刷新列表的回调
|
||||
*/
|
||||
export function useContractPaymentAdminActions(onAfterScanOrWeekly?: () => Promise<void> | void) {
|
||||
const { t } = useI18n();
|
||||
@@ -29,12 +53,39 @@ export function useContractPaymentAdminActions(onAfterScanOrWeekly?: () => Promi
|
||||
const msg = useMessage();
|
||||
const isAdmin = computed(() => auth.isAdmin);
|
||||
const actionLoading = ref(false);
|
||||
const showForceSyncConfirm = ref(false);
|
||||
const showReparseExistingConfirm = ref(false);
|
||||
/** 等待用户确认的管理操作;为空时确认框关闭。 */
|
||||
const confirmAction = ref<ContractPaymentAdminAction | null>(null);
|
||||
|
||||
/**
|
||||
* 按周汇总任务的 sent/failed 给出结果,避免把入队成功说成已经发出。
|
||||
* 核心逻辑:全部失败用错误提示,部分失败用警告,没有待发送记录时说明列表不会变化。
|
||||
* @param job - 已结束的任务;null 表示轮询超时。
|
||||
*/
|
||||
function reportWeeklyJob(job: ContractPaymentJob | null): void {
|
||||
if (!job) {
|
||||
msg.warning(t('admin.contractPayment.weeklyJobTimeout'));
|
||||
return;
|
||||
}
|
||||
if (job.status !== 'success') {
|
||||
msg.error(job.message || t('admin.contractPayment.weeklyJobError'));
|
||||
return;
|
||||
}
|
||||
const sent = Number(job.result?.sent || 0);
|
||||
const failed = Number(job.result?.failed || 0);
|
||||
if (sent > 0 && failed > 0) {
|
||||
msg.warning(t('admin.contractPayment.weeklyJobPartial', { sent, failed }));
|
||||
} else if (failed > 0) {
|
||||
msg.error(t('admin.contractPayment.weeklyJobFailed', { failed }));
|
||||
} else if (sent > 0) {
|
||||
msg.success(t('admin.contractPayment.weeklyJobSent', { sent }));
|
||||
} else {
|
||||
msg.info(t('admin.contractPayment.weeklyJobEmpty'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交合同付款预警后台任务。
|
||||
* 核心逻辑:按操作类型调用相应异步接口;扫描和发送成功后刷新摘要。
|
||||
* 核心逻辑:同步、重解析、扫描入队后立即提示。发送预警先等到 Worker 结束,刷新批次列表,再按发送计数提示。
|
||||
*/
|
||||
async function submitAction(action: ContractPaymentAdminAction): Promise<void> {
|
||||
if (!isAdmin.value) return;
|
||||
@@ -42,16 +93,19 @@ export function useContractPaymentAdminActions(onAfterScanOrWeekly?: () => Promi
|
||||
try {
|
||||
if (action === 'sync' || action === 'force-sync') {
|
||||
await enqueueContractPaymentSync(action === 'force-sync');
|
||||
msg.success(t('admin.contractPayment.jobSubmitted'));
|
||||
} else if (action === 'reparse-existing') {
|
||||
await enqueueContractPaymentReparse();
|
||||
msg.success(t('admin.contractPayment.jobSubmitted'));
|
||||
} else if (action === 'scan') {
|
||||
await enqueueContractPaymentAlertScan();
|
||||
msg.success(t('admin.contractPayment.jobSubmitted'));
|
||||
if (onAfterScanOrWeekly) await onAfterScanOrWeekly();
|
||||
} else {
|
||||
await enqueueContractPaymentWeeklyAlert();
|
||||
}
|
||||
msg.success(t('admin.contractPayment.jobSubmitted'));
|
||||
if ((action === 'scan' || action === 'weekly') && onAfterScanOrWeekly) {
|
||||
await onAfterScanOrWeekly();
|
||||
const queued = await enqueueContractPaymentWeeklyAlert();
|
||||
const job = await waitForWeeklyJob(Number(queued.job_id));
|
||||
if (onAfterScanOrWeekly) await onAfterScanOrWeekly();
|
||||
reportWeeklyJob(job);
|
||||
}
|
||||
} catch (error) {
|
||||
msg.error(error instanceof BusinessError ? error.message : t('admin.contractPayment.actionFailed'));
|
||||
@@ -61,28 +115,61 @@ export function useContractPaymentAdminActions(onAfterScanOrWeekly?: () => Promi
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发任务入口;强制覆盖和存量重解析先弹出确认框。
|
||||
* 返回当前待确认操作的标题和说明。
|
||||
* 核心逻辑:五种管理操作共用一个确认框,文案按操作切换。
|
||||
*/
|
||||
const confirmCopy = computed(() => {
|
||||
switch (confirmAction.value) {
|
||||
case 'sync':
|
||||
return { title: t('admin.contractPayment.sync'), message: t('admin.contractPayment.syncConfirm') };
|
||||
case 'force-sync':
|
||||
return { title: t('admin.contractPayment.forceSync'), message: t('admin.contractPayment.forceSyncConfirm') };
|
||||
case 'reparse-existing':
|
||||
return { title: t('admin.contractPayment.reparseExisting'), message: t('admin.contractPayment.reparseExistingConfirm') };
|
||||
case 'scan':
|
||||
return { title: t('admin.contractPayment.scanAlerts'), message: t('admin.contractPayment.scanAlertsConfirm') };
|
||||
case 'weekly':
|
||||
return { title: t('admin.contractPayment.weeklySend'), message: t('admin.contractPayment.weeklySendConfirm') };
|
||||
default:
|
||||
return { title: '', message: '' };
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 确认框显隐。关闭时清掉待确认操作,避免下次打开仍执行上一次动作。
|
||||
*/
|
||||
const showActionConfirm = computed({
|
||||
get: () => confirmAction.value !== null,
|
||||
set: (open: boolean) => {
|
||||
if (!open) confirmAction.value = null;
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* 触发任务入口。所有管理操作都先弹出确认框,确认后才入队。
|
||||
* @param action - sync / force-sync / reparse-existing / scan / weekly
|
||||
*/
|
||||
function run(action: ContractPaymentAdminAction): void {
|
||||
if (!isAdmin.value) return;
|
||||
if (action === 'force-sync') {
|
||||
showForceSyncConfirm.value = true;
|
||||
return;
|
||||
}
|
||||
if (action === 'reparse-existing') {
|
||||
showReparseExistingConfirm.value = true;
|
||||
return;
|
||||
}
|
||||
void submitAction(action);
|
||||
if (!isAdmin.value || actionLoading.value) return;
|
||||
confirmAction.value = action;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户确认后提交当前操作。
|
||||
* 核心逻辑:先取出动作再清空,避免弹窗关闭时把待提交动作清掉。
|
||||
*/
|
||||
function confirmPendingAction(): void {
|
||||
const action = confirmAction.value;
|
||||
confirmAction.value = null;
|
||||
if (action) void submitAction(action);
|
||||
}
|
||||
|
||||
return {
|
||||
isAdmin,
|
||||
actionLoading,
|
||||
showForceSyncConfirm,
|
||||
showReparseExistingConfirm,
|
||||
showActionConfirm,
|
||||
confirmCopy,
|
||||
run,
|
||||
confirmForceSync: () => void submitAction('force-sync'),
|
||||
confirmReparseExisting: () => void submitAction('reparse-existing'),
|
||||
confirmPendingAction,
|
||||
};
|
||||
}
|
||||
@@ -48,13 +48,13 @@ export function nodeDueReference(node: Pick<PaymentNode, 'due_date' | 'anchor_da
|
||||
return node.due_date || node.anchor_date || null;
|
||||
}
|
||||
|
||||
/** 台账级付款状态编码:进行中 / 即将到期 / 已逾期 / 已完成 / 待补充。 */
|
||||
/** 台账级付款状态编码:未到期 / 即将到期 / 已逾期 / 已完成 / 待补充。 */
|
||||
export type ContractNodeStatusCode = 'active' | 'due' | 'overdue' | 'completed' | 'needs_completion';
|
||||
|
||||
/**
|
||||
* 按付款节点聚合出合同台账的进度/逾期状态。
|
||||
* 核心逻辑:先在合同层排除「待补充」(非激活或解析待确认);否则若存在未付且已过 due_date 的
|
||||
* 节点 → 已逾期;存在 7 天内到期 → 即将到期;仍有未付节点 → 进行中;全部节点已付 → 已完成。
|
||||
* 节点 → 已逾期;存在 7 天内到期 → 即将到期;仍有未付且付款日在 7 日外 → 未到期;全部节点已付 → 已完成。
|
||||
* @param nodes - 合同的付款节点列表。
|
||||
* @returns 台账状态编码。
|
||||
*/
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
features/contract-payment/views/ContractPaymentDetailPage.vue
|
||||
用途:展示单份采购合同的概览、原文附件、付款计划及企业微信预警审计。
|
||||
依赖:contract-payment.api、统一消息提示;由 Chat 台账/待确认行点击在当前 Tab 内下钻。
|
||||
逻辑:以合同 ID 调用已有详情接口,所有付款任务按付款节点和预警轮次聚合呈现。
|
||||
逻辑:以合同 ID 调用已有详情接口,付款任务按节点和预警轮次聚合;原文附件可在线预览 PDF/图片,或继续下载。
|
||||
待复核合同时,解析提示右侧用主按钮放「人工复核」,弹窗里填写阶段后再进入台账。合同概览和页头其余内容保持原样。
|
||||
未付的预付款、出货款可在卡片上标为已付,只改这一阶段。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import { ArrowLeft, CircleHelp, Download, FileText, RefreshCw } from 'lucide-vue-next';
|
||||
import { computed, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
||||
import { ArrowLeft, CircleHelp, Download, Eye, FileText, RefreshCw } from 'lucide-vue-next';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import { formatLocalDateTime, formatNaiveDate, formatNaiveDateTime } from '@/shared/utils/dateTime';
|
||||
@@ -14,6 +16,7 @@ import { useMessage } from '@/shared/composables/useMessage';
|
||||
import {
|
||||
downloadContractPaymentAttachment,
|
||||
getContractPaymentContract,
|
||||
markContractPaymentNodePaid,
|
||||
reparseContractPaymentContract,
|
||||
type ContractAttachment,
|
||||
type ContractPaymentContract,
|
||||
@@ -21,6 +24,7 @@ import {
|
||||
} from '../api/contract-payment.api';
|
||||
import { displayCurrency } from '../utils/currency';
|
||||
import { isNodeNearDue, isNodeOverdue, nodeDueReference } from '../utils/paymentStatus';
|
||||
import ContractPaymentManualReviewPage from './ContractPaymentManualReviewPage.vue';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
contractId: number;
|
||||
@@ -29,6 +33,7 @@ const props = withDefaults(defineProps<{
|
||||
|
||||
const emit = defineEmits<{
|
||||
close: [];
|
||||
reviewed: [];
|
||||
}>();
|
||||
|
||||
const { t, te } = useI18n();
|
||||
@@ -36,7 +41,17 @@ const msg = useMessage();
|
||||
const contract = ref<ContractPaymentContract | null>(null);
|
||||
const loading = ref(false);
|
||||
const downloadingId = ref<number | null>(null);
|
||||
const previewingId = ref<number | null>(null);
|
||||
const previewOpen = ref(false);
|
||||
const previewName = ref('');
|
||||
const previewUrl = ref('');
|
||||
const previewKind = ref<'pdf' | 'image' | 'unsupported' | ''>('');
|
||||
const reparsing = ref(false);
|
||||
const reviewOpen = ref(false);
|
||||
const markPaidNode = ref<PaymentNode | null>(null);
|
||||
const markPaidDate = ref('');
|
||||
const markPaidRemark = ref('');
|
||||
const markPaidSaving = ref(false);
|
||||
const activeTab = ref<'plan' | 'attachments' | 'alerts'>('plan');
|
||||
const contractId = computed(() => Number(props.contractId));
|
||||
const orderedNodes = computed(() => {
|
||||
@@ -89,9 +104,10 @@ function displaySentAt(iso?: string | null): string {
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回合同解析/计划状态的本地化文本。
|
||||
* 返回合同计划状态的本地化文本。
|
||||
* 核心逻辑:将后端编码(parsed / needs_review / pending / active)映射到 i18n;未知编码回退原值,便于排障。
|
||||
* @param state - 后端返回的解析状态或计划状态编码。
|
||||
* 解析状态暂不在概览中展示,本函数目前只用于计划状态。
|
||||
* @param state - 后端返回的计划状态编码。
|
||||
* @returns 本地化状态文本;空值时返回 '—'。
|
||||
*/
|
||||
function displayContractState(state?: string | null): string {
|
||||
@@ -137,7 +153,7 @@ const currentActiveNodeId = computed(() => {
|
||||
|
||||
/**
|
||||
* 推导付款节点的展示状态与时间线色调。
|
||||
* 核心逻辑:已付/待复核沿用后端明确状态;未完成时按“无到期事实→待起算、临近到期→即将到期、
|
||||
* 核心逻辑:已付/待复核/无此阶段沿用后端明确状态;未完成时按“无到期事实→待起算、临近到期→即将到期、
|
||||
* 当前阶段→进行中、其余→待处理”分层,避免同页多阶段都误标为进行中。
|
||||
* @param node - 当前付款节点。
|
||||
* @returns 用户可见的状态文本与对应色调。
|
||||
@@ -145,6 +161,7 @@ const currentActiveNodeId = computed(() => {
|
||||
function nodeStatusInfo(node: PaymentNode): { label: string; tone: 'paid' | 'current' | 'due' | 'overdue' | 'pending' | 'review' } {
|
||||
const state = String(node.status || '').trim().toLowerCase();
|
||||
if (state === 'paid') return { label: t('admin.contractPayment.nodeStatus.paid'), tone: 'paid' };
|
||||
if (state === 'not_applicable') return { label: t('admin.contractPayment.nodeStatus.notApplicable'), tone: 'pending' };
|
||||
if (state === 'needs_review') return { label: t('admin.contractPayment.nodeStatus.review'), tone: 'review' };
|
||||
const isCurrent = node.id === currentActiveNodeId.value;
|
||||
if (!node.due_date && !node.anchor_date) return { label: t('admin.contractPayment.nodeStatus.notStarted'), tone: 'pending' };
|
||||
@@ -171,6 +188,52 @@ function nodePayDateText(node: PaymentNode): string {
|
||||
return '—';
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断这一阶段能否手动标为已付。
|
||||
* 核心逻辑:只有未付的预付款、出货款出现按钮;验收款、质保款和已付阶段不出现。
|
||||
* @param node - 当前付款节点。
|
||||
* @returns 是否显示「标为已付」。
|
||||
*/
|
||||
function canMarkPaid(node: PaymentNode): boolean {
|
||||
const type = String(node.node_type || '').toLowerCase();
|
||||
const state = String(node.status || '').toLowerCase();
|
||||
return (type === 'prepayment' || type === 'shipment') && state === 'active';
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开手动标为已付弹窗,付款日期默认留空,由用户填写。
|
||||
* @param node - 要标记的预付款或出货款。
|
||||
*/
|
||||
function openMarkPaid(node: PaymentNode): void {
|
||||
markPaidNode.value = node;
|
||||
markPaidDate.value = '';
|
||||
markPaidRemark.value = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交手动已付。
|
||||
* 核心逻辑:只提交当前阶段的付款日期和可选说明,成功后重新加载详情。
|
||||
* @returns 完成后关闭弹窗。
|
||||
*/
|
||||
async function confirmMarkPaid(): Promise<void> {
|
||||
const node = markPaidNode.value;
|
||||
if (!node || !markPaidDate.value || markPaidSaving.value) return;
|
||||
markPaidSaving.value = true;
|
||||
try {
|
||||
await markContractPaymentNodePaid(contractId.value, node.id, {
|
||||
paidDate: markPaidDate.value,
|
||||
remark: markPaidRemark.value,
|
||||
});
|
||||
markPaidNode.value = null;
|
||||
msg.success(t('admin.contractPayment.markPaidSuccess'));
|
||||
await load();
|
||||
} catch (error) {
|
||||
msg.error(error instanceof BusinessError ? error.message : t('admin.contractPayment.markPaidFailed'));
|
||||
} finally {
|
||||
markPaidSaving.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 映射单条预警的发送状态。
|
||||
* 核心逻辑:与批次审计状态复用同一组 i18n 键,未知状态保留后端文本以支持排障。
|
||||
@@ -213,6 +276,65 @@ async function load(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断附件能否在页面内预览。
|
||||
* 核心逻辑:PDF 用内嵌框,常见图片用 img;其余格式只提示下载,避免浏览器把未知二进制当成下载。
|
||||
* @param attachment - 当前合同附件。
|
||||
* @param blob - 已拉取的文件内容,mime 缺失时用来补判断。
|
||||
* @returns pdf、image 或 unsupported。
|
||||
*/
|
||||
function attachmentPreviewKind(attachment: ContractAttachment, blob: Blob): 'pdf' | 'image' | 'unsupported' {
|
||||
const mime = `${attachment.mime_type || ''} ${blob.type || ''}`.toLowerCase();
|
||||
const name = (attachment.file_name || '').toLowerCase();
|
||||
if (mime.includes('pdf') || name.endsWith('.pdf')) return 'pdf';
|
||||
if (mime.includes('image/') || /\.(png|jpe?g|gif|webp|bmp)$/.test(name)) return 'image';
|
||||
return 'unsupported';
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭附件预览并释放临时地址。
|
||||
* 核心逻辑:blob URL 不随弹窗卸载自动回收,关闭、切换合同和离开页面时都要 revoke。
|
||||
*/
|
||||
function closeAttachmentPreview(): void {
|
||||
if (previewUrl.value) URL.revokeObjectURL(previewUrl.value);
|
||||
previewUrl.value = '';
|
||||
previewOpen.value = false;
|
||||
previewKind.value = '';
|
||||
previewName.value = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* 在弹窗中预览合同原文附件。
|
||||
* 核心逻辑:复用受控下载接口取 Blob,PDF/图片转成临时地址展示;不支持的格式仍打开弹窗并提示下载。
|
||||
* @param attachment - 当前合同的附件记录。
|
||||
* @returns 预览打开后结束;失败时保留原页面并提示原因。
|
||||
*/
|
||||
async function previewAttachment(attachment: ContractAttachment): Promise<void> {
|
||||
if (!contract.value || previewingId.value) return;
|
||||
previewingId.value = attachment.id;
|
||||
try {
|
||||
const { blob, filename } = await downloadContractPaymentAttachment(contract.value.id, attachment.id);
|
||||
const kind = attachmentPreviewKind(attachment, blob);
|
||||
if (previewUrl.value) URL.revokeObjectURL(previewUrl.value);
|
||||
previewName.value = filename || attachment.file_name;
|
||||
previewKind.value = kind;
|
||||
if (kind === 'pdf') {
|
||||
const typed = blob.type.toLowerCase().includes('pdf') ? blob : new Blob([blob], { type: 'application/pdf' });
|
||||
previewUrl.value = URL.createObjectURL(typed);
|
||||
} else if (kind === 'image') {
|
||||
const typed = blob.type.toLowerCase().startsWith('image/') ? blob : new Blob([blob], { type: attachment.mime_type || 'image/png' });
|
||||
previewUrl.value = URL.createObjectURL(typed);
|
||||
} else {
|
||||
previewUrl.value = '';
|
||||
}
|
||||
previewOpen.value = true;
|
||||
} catch (error) {
|
||||
msg.error(error instanceof BusinessError ? error.message : t('admin.contractPayment.attachmentPreviewFailed'));
|
||||
} finally {
|
||||
previewingId.value = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载合同详情中的原文附件。
|
||||
* 核心逻辑:经合同附件专用受控接口取 Blob,再由浏览器保存,避免直接暴露存储地址。
|
||||
@@ -266,19 +388,31 @@ function backToLedger(): void {
|
||||
emit('close');
|
||||
}
|
||||
|
||||
/**
|
||||
* 人工复核通过后关掉弹窗,并交给 Chat 父级切到合同台账。
|
||||
* 核心逻辑:详情页本身不改成表单;确认成功后合同已离开待确认。
|
||||
*/
|
||||
function onReviewConfirmed(): void {
|
||||
reviewOpen.value = false;
|
||||
emit('reviewed');
|
||||
}
|
||||
|
||||
watch(contractId, () => {
|
||||
closeAttachmentPreview();
|
||||
reviewOpen.value = false;
|
||||
void load();
|
||||
});
|
||||
|
||||
onMounted(() => void load());
|
||||
onBeforeUnmount(() => closeAttachmentPreview());
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="section-gap animate-fade-in-up">
|
||||
<section class="section-gap contract-detail animate-fade-in-up">
|
||||
<header class="mb-5 flex items-start justify-between gap-3">
|
||||
<div v-if="contract" class="min-w-0">
|
||||
<h2 class="text-2xl font-bold text-primary">{{ contract.contract_no || t('admin.contractPayment.contractNoPending') }}</h2>
|
||||
<p class="mt-1 text-sm text-muted">{{ contract.supplier_name || '—' }}<span v-if="contract.purchase_order_no"> · {{ contract.purchase_order_no }}</span></p>
|
||||
<p class="mt-1 text-sm text-muted">{{ contract.supplier_name || '—' }}</p>
|
||||
</div>
|
||||
<div class="flex shrink-0 gap-2"><button class="btn-secondary-ds" :disabled="reparsing" @click="reparseContract"><RefreshCw class="h-4 w-4" :class="{ 'animate-spin': reparsing }" />{{ t('admin.contractPaymentReparse.action') }}</button><button class="btn-secondary-ds" @click="backToLedger"><ArrowLeft class="h-4 w-4" />{{ t('admin.contractPayment.backToLedger') }}</button></div>
|
||||
</header>
|
||||
@@ -296,14 +430,17 @@ onMounted(() => void load());
|
||||
<section class="detail-panel mt-4">
|
||||
<h3>{{ t('admin.contractPayment.detailOverview') }}</h3>
|
||||
<dl class="detail-description-list">
|
||||
<div><dt>{{ t('admin.contractPayment.parseStatus') }}</dt><dd>{{ displayContractState(contract.parse_status) }}</dd></div>
|
||||
<div><dt>{{ t('admin.contractPayment.planStatus') }}</dt><dd>{{ displayContractState(contract.plan_status) }}</dd></div>
|
||||
<div><dt><span class="help-label" :data-help="t('admin.contractPayment.archiveDateHint')">{{ t('admin.contractPayment.archiveDate') }}<CircleHelp class="ml-1 inline h-3.5 w-3.5 align-middle" /></span></dt><dd>{{ contract.oa_archive_at ? formatNaiveDate(contract.oa_archive_at) : '—' }}</dd></div>
|
||||
<div><dt>{{ t('admin.contractPayment.deliveryDate') }}</dt><dd>{{ contract.delivery_due_date || '—' }}</dd></div>
|
||||
<div><dt>{{ t('admin.contractPayment.company') }}</dt><dd class="detail-wrap">{{ contract.company_name || '—' }}</dd></div>
|
||||
</dl>
|
||||
<div v-if="contract.parse_issues?.length" class="detail-parse-issues">
|
||||
<strong>{{ t('admin.contractPayment.parseIssueTitle') }}</strong>
|
||||
<ul><li v-for="issue in contract.parse_issues" :key="issue">{{ issue }}</li></ul>
|
||||
<div v-if="contract.parse_issues?.length || contract.parse_status === 'needs_review'" class="detail-parse-issues">
|
||||
<div class="min-w-0">
|
||||
<strong>{{ t('admin.contractPayment.parseIssueTitle') }}</strong>
|
||||
<ul v-if="contract.parse_issues?.length"><li v-for="issue in contract.parse_issues" :key="issue">{{ issue }}</li></ul>
|
||||
</div>
|
||||
<button v-if="contract.parse_status === 'needs_review'" class="btn-primary detail-parse-review" type="button" @click="reviewOpen = true">{{ t('admin.contractPaymentReview.manualAction') }}</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -319,19 +456,24 @@ onMounted(() => void load());
|
||||
<div v-for="attachment in contract.attachments" :key="attachment.id" class="attachment-row">
|
||||
<FileText class="h-5 w-5 text-blue-500" />
|
||||
<div class="min-w-0 flex-1"><strong class="block truncate">{{ attachment.file_name }}</strong></div>
|
||||
<button class="btn-secondary-ds" :disabled="previewingId === attachment.id || !attachment.asset_no" @click="previewAttachment(attachment)"><Eye class="h-4 w-4" />{{ t('admin.contractPayment.previewAttachment') }}</button>
|
||||
<button class="btn-secondary-ds" :disabled="downloadingId === attachment.id || !attachment.asset_no" @click="downloadAttachment(attachment)"><Download class="h-4 w-4" />{{ t('admin.contractPayment.downloadAttachment') }}</button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section v-else-if="activeTab === 'plan'" class="detail-panel mt-4">
|
||||
<h3>{{ t('admin.contractPayment.detailPaymentPlan') }}</h3>
|
||||
<h3>
|
||||
<span class="help-label help-wide" :data-help="t('admin.contractPayment.alertRuleHint')">{{ t('admin.contractPayment.detailPaymentPlan') }}<CircleHelp class="ml-1 inline h-3.5 w-3.5 align-middle" /></span>
|
||||
</h3>
|
||||
<div v-if="!orderedNodes.length" class="detail-empty">{{ t('admin.contractPayment.paymentPlanEmpty') }}</div>
|
||||
<div v-for="node in orderedNodes" :key="node.id" class="payment-node-row">
|
||||
<span class="timeline-dot" :class="`dot-${nodeStatusInfo(node).tone}`"></span>
|
||||
<div class="payment-node-card">
|
||||
<div class="flex flex-wrap items-center justify-between gap-2"><strong>{{ displayNodeType(node.node_type) }} · {{ node.amount || '—' }} / {{ displayPercentage(node.percentage) }}%</strong><span class="node-status" :class="`status-${nodeStatusInfo(node).tone}`">{{ nodeStatusInfo(node).label }}</span></div>
|
||||
<div class="flex flex-wrap items-center justify-between gap-2"><strong>{{ displayNodeType(node.node_type) }} · <template v-if="String(node.status || '').toLowerCase() === 'not_applicable'">—</template><template v-else>{{ node.amount || '—' }} / {{ displayPercentage(node.percentage) }}%</template></strong><span class="node-status" :class="`status-${nodeStatusInfo(node).tone}`">{{ nodeStatusInfo(node).label }}</span></div>
|
||||
<p class="payment-node-pay-line">{{ t('admin.contractPayment.payDate') }}:{{ nodePayDateText(node) }}</p>
|
||||
<p v-if="node.paid_source === 'manual'" class="payment-node-pay-line text-emerald-700">{{ t('admin.contractPayment.markPaidSource') }}</p>
|
||||
<p>{{ t('admin.contractPayment.anchorDate') }}:{{ node.anchor_date || '—' }} · {{ t('admin.contractPayment.alertDate') }}:{{ displayAlertDate(node) }}</p>
|
||||
<button v-if="canMarkPaid(node)" class="mt-2 text-sm font-bold text-[#2875d5]" type="button" @click="openMarkPaid(node)">{{ t('admin.contractPayment.markPaid') }}</button>
|
||||
<div v-if="alertsForNode(node).length" class="node-alert-list"><span v-for="alert in alertsForNode(node)" :key="alert.id">{{ t('admin.contractPayment.alertRound', { round: alert.alert_round }) }} · {{ displayScheduledAt(alert.scheduled_at) }} · {{ displayAlertStatus(alert.status) }}</span></div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -349,11 +491,59 @@ onMounted(() => void load());
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
<Teleport to="body">
|
||||
<div v-if="markPaidNode" class="dialog-overlay z-[160] items-center" @click.self="markPaidNode = null">
|
||||
<div class="dialog-panel max-w-md" role="dialog" aria-modal="true">
|
||||
<div class="dialog-header dialog-header--compact">
|
||||
<h3>{{ t('admin.contractPayment.markPaidTitle') }}</h3>
|
||||
</div>
|
||||
<div class="dialog-body space-y-3">
|
||||
<p class="text-sm text-[#58749f]">{{ t('admin.contractPayment.markPaidHint', { stage: displayNodeType(markPaidNode.node_type), amount: markPaidNode.amount || '—', percent: displayPercentage(markPaidNode.percentage) }) }}</p>
|
||||
<label class="block text-sm text-[#58749f]">{{ t('admin.contractPayment.markPaidDate') }}
|
||||
<input v-model="markPaidDate" class="mt-1 w-full rounded-lg border border-[#d7e1ef] px-3 py-2 text-[#102d59]" type="date" />
|
||||
</label>
|
||||
<label class="block text-sm text-[#58749f]">{{ t('admin.contractPayment.markPaidRemark') }}
|
||||
<textarea v-model="markPaidRemark" class="mt-1 w-full rounded-lg border border-[#d7e1ef] px-3 py-2 text-[#102d59]" rows="3" :placeholder="t('admin.contractPayment.markPaidRemarkPlaceholder')"></textarea>
|
||||
</label>
|
||||
</div>
|
||||
<div class="dialog-footer">
|
||||
<button class="btn-secondary-ds" type="button" @click="markPaidNode = null">{{ t('common.cancel') }}</button>
|
||||
<button class="btn-primary" type="button" :disabled="!markPaidDate || markPaidSaving" @click="confirmMarkPaid">{{ t('admin.contractPayment.markPaidConfirm') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
<ContractPaymentManualReviewPage
|
||||
v-if="reviewOpen && contract"
|
||||
:contract-id="contract.id"
|
||||
@close="reviewOpen = false"
|
||||
@confirmed="onReviewConfirmed"
|
||||
/>
|
||||
<Teleport to="body">
|
||||
<div v-if="previewOpen" class="dialog-overlay z-[160] items-center" @click.self="closeAttachmentPreview">
|
||||
<div class="dialog-panel max-w-5xl h-[85vh] overflow-hidden" role="dialog" aria-modal="true">
|
||||
<div class="dialog-header dialog-header--compact">
|
||||
<div class="min-w-0">
|
||||
<div class="text-sm font-medium text-slate-500">{{ t('filePreview.title') }}</div>
|
||||
<div class="mt-1 font-semibold text-slate-900 break-words">{{ previewName }}</div>
|
||||
</div>
|
||||
<button type="button" class="btn-secondary shrink-0" @click="closeAttachmentPreview">{{ t('common.close') }}</button>
|
||||
</div>
|
||||
<div class="dialog-preview-body attachment-preview-body">
|
||||
<iframe v-if="previewKind === 'pdf' && previewUrl" class="attachment-preview-frame" :src="previewUrl" :title="previewName"></iframe>
|
||||
<img v-else-if="previewKind === 'image' && previewUrl" class="attachment-preview-image" :src="previewUrl" :alt="previewName" />
|
||||
<div v-else class="detail-empty">{{ t('admin.contractPayment.attachmentPreviewUnsupported') }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.detail-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; }.detail-summary-card { min-height: 82px; padding: 14px; border: 1px solid #d7e1ef; border-radius: 12px; background: #f8fbff; }.detail-summary-card span { display: block; color: #58749f; font-size: 12px; }.detail-summary-card strong { display: block; margin-top: 6px; color: #102d59; font-size: 14px; word-break: break-word; }.detail-tabs { display: flex; width: fit-content; max-width: 100%; overflow-x: auto; border: 1px solid #d7e1ef; border-radius: 999px; background: #f1f5fb; padding: 4px; }.detail-tabs button { flex: none; border-radius: 999px; padding: 8px 14px; color: #58749f; font-size: 13px; font-weight: 700; }.detail-tabs button.active { background: #fff; color: #2875d5; box-shadow: 0 1px 3px rgba(35, 68, 113, .12); }.detail-panel { border: 1px dashed #b9cbe2; border-radius: 12px; background: #fff; padding: 18px; }.detail-panel h3 { margin-bottom: 14px; color: #102d59; font-size: 16px; font-weight: 750; }.detail-description-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 28px; }.detail-description-list div { display: flex; gap: 8px; }.detail-description-list dt { color: #58749f; }.detail-description-list dd { color: #102d59; font-weight: 650; }.detail-note { margin-top: 16px; border-radius: 8px; background: #f7faff; padding: 10px 12px; color: #58749f; font-size: 13px; }.attachment-row { display: flex; align-items: center; gap: 12px; border-top: 1px solid #e4ecf6; padding: 13px 0; }.attachment-row:first-of-type { border-top: 0; }.attachment-row span { color: #58749f; font-size: 12px; }.payment-node-row { position: relative; display: flex; gap: 14px; padding: 0 0 18px 6px; }.payment-node-row::before { position: absolute; top: 18px; bottom: -2px; left: 12px; width: 2px; background: #d7e1ef; content: ''; }.payment-node-row:last-child::before { display: none; }.timeline-dot { z-index: 1; width: 14px; height: 14px; margin-top: 8px; flex: none; border-radius: 999px; background: #fff; border: 2px solid #3b82e5; }.payment-node-card { flex: 1; border: 1px solid #d7e1ef; border-radius: 12px; padding: 13px 15px; }.payment-node-card strong { color: #102d59; }.payment-node-card p { margin-top: 5px; color: #58749f; font-size: 13px; }.node-status { display: inline-flex; min-height: 22px; align-items: center; border-radius: 999px; background: #edf5ff; padding: 2px 8px; color: #2563eb; font-size: 12px; font-weight: 700; }.node-alert-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }.node-alert-list span { border-radius: 6px; background: #f7faff; padding: 4px 7px; color: #58749f; font-size: 12px; }.alert-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; border-top: 1px solid #e4ecf6; padding: 12px 0; color: #58749f; font-size: 13px; }.alert-row:first-of-type { border-top: 0; }.alert-row strong { color: #102d59; }.detail-empty { padding: 38px; color: var(--text-muted); text-align: center; } @media (max-width: 1280px) { .detail-summary-grid { grid-template-columns: repeat(3, minmax(160px, 1fr)); } } @media (max-width: 640px) { .detail-summary-grid, .detail-description-list { grid-template-columns: 1fr; }.attachment-row { align-items: flex-start; flex-wrap: wrap; }.attachment-row button { margin-left: 32px; } }
|
||||
.help-label { position: relative; cursor: help; }.help-label::after { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: max-content; max-width: min(280px, 70vw); padding: 7px 9px; border-radius: 6px; background: #334155; color: #fff; content: attr(data-help); font-size: 11px; font-weight: 400; line-height: 1.45; opacity: 0; pointer-events: none; transition: opacity .15s ease; white-space: normal; }.help-label:hover::after { opacity: 1; }.detail-parse-issues { margin-top: 14px; border-radius: 8px; background: #fff7ed; padding: 10px 12px; color: #9a3412; font-size: 13px; }.detail-parse-issues strong { display: block; margin-bottom: 4px; font-weight: 700; }.detail-parse-issues ul { margin: 0; padding-left: 16px; }.detail-parse-issues li { line-height: 1.6; }
|
||||
/* 四张概要卡按详情区域宽度排:够宽时一行,窄于 640px 再折成两行。 */
|
||||
.contract-detail { container-type: inline-size; }.detail-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }.detail-summary-card { min-width: 0; min-height: 82px; padding: 14px; border: 1px solid #d7e1ef; border-radius: 12px; background: #f8fbff; }.detail-summary-card span { display: block; color: #58749f; font-size: 12px; }.detail-summary-card strong { display: block; margin-top: 6px; color: #102d59; font-size: 14px; word-break: break-word; }.detail-tabs { display: flex; width: fit-content; max-width: 100%; overflow-x: auto; border: 1px solid #d7e1ef; border-radius: 999px; background: #f1f5fb; padding: 4px; }.detail-tabs button { flex: none; border-radius: 999px; padding: 8px 14px; color: #58749f; font-size: 13px; font-weight: 700; }.detail-tabs button.active { background: #fff; color: #2875d5; box-shadow: 0 1px 3px rgba(35, 68, 113, .12); }.detail-panel { border: 1px dashed #b9cbe2; border-radius: 12px; background: #fff; padding: 18px; }.detail-panel h3 { margin-bottom: 14px; color: #102d59; font-size: 16px; font-weight: 750; }.detail-description-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 28px; font-size: 13px; }.detail-description-list div { display: flex; gap: 8px; min-width: 0; }.detail-description-list dt { flex: none; color: #58749f; }.detail-description-list dd { min-width: 0; color: #102d59; font-weight: 650; white-space: nowrap; }.detail-description-list dd.detail-wrap { white-space: normal; word-break: break-all; }.detail-note { margin-top: 16px; border-radius: 8px; background: #f7faff; padding: 10px 12px; color: #58749f; font-size: 13px; }.attachment-row { display: flex; align-items: center; gap: 12px; border-top: 1px solid #e4ecf6; padding: 13px 0; }.attachment-row:first-of-type { border-top: 0; }.attachment-row span { color: #58749f; font-size: 12px; }.payment-node-row { position: relative; display: flex; gap: 14px; padding: 0 0 18px 6px; }.payment-node-row::before { position: absolute; top: 18px; bottom: -2px; left: 12px; width: 2px; background: #d7e1ef; content: ''; }.payment-node-row:last-child::before { display: none; }.timeline-dot { z-index: 1; width: 14px; height: 14px; margin-top: 8px; flex: none; border-radius: 999px; background: #fff; border: 2px solid #3b82e5; }.payment-node-card { flex: 1; border: 1px solid #d7e1ef; border-radius: 12px; padding: 13px 15px; }.payment-node-card strong { color: #102d59; }.payment-node-card p { margin-top: 5px; color: #58749f; font-size: 13px; }.node-status { display: inline-flex; min-height: 22px; align-items: center; border-radius: 999px; background: #edf5ff; padding: 2px 8px; color: #2563eb; font-size: 12px; font-weight: 700; }.node-alert-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }.node-alert-list span { border-radius: 6px; background: #f7faff; padding: 4px 7px; color: #58749f; font-size: 12px; }.alert-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; border-top: 1px solid #e4ecf6; padding: 12px 0; color: #58749f; font-size: 13px; }.alert-row:first-of-type { border-top: 0; }.alert-row strong { color: #102d59; }.detail-empty { padding: 38px; color: var(--text-muted); text-align: center; } @container (max-width: 640px) { .detail-summary-grid, .detail-description-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } } @media (max-width: 640px) { .detail-description-list { grid-template-columns: 1fr; }.attachment-row { align-items: flex-start; flex-wrap: wrap; }.attachment-row button { margin-left: 32px; } }
|
||||
.help-label { position: relative; cursor: help; }.help-label::after { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: max-content; max-width: min(280px, 70vw); padding: 7px 9px; border-radius: 6px; background: #334155; color: #fff; content: attr(data-help); font-size: 11px; font-weight: 400; line-height: 1.45; opacity: 0; pointer-events: none; transition: opacity .15s ease; white-space: normal; }.help-label.help-wide::after { max-width: min(420px, 78vw); white-space: pre-line; }.help-label:hover::after { opacity: 1; }.detail-parse-issues { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; border-radius: 8px; background: #fff7ed; padding: 10px 12px; color: #9a3412; font-size: 13px; }.detail-parse-issues strong { display: block; margin-bottom: 4px; font-weight: 700; }.detail-parse-review { flex: none; height: 34px; padding: 0 16px; }.detail-parse-issues ul { margin: 0; padding-left: 16px; }.detail-parse-issues li { line-height: 1.6; }
|
||||
.attachment-preview-body { position: relative; min-height: 0; padding: 0; }.attachment-preview-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }.attachment-preview-image { display: block; max-width: 100%; max-height: 100%; margin: 0 auto; object-fit: contain; }
|
||||
.timeline-dot.dot-paid, .timeline-dot.dot-current { background: #16a34a; border-color: #16a34a; }.timeline-dot.dot-due { background: #ea580c; border-color: #ea580c; }.timeline-dot.dot-overdue { background: #dc2626; border-color: #dc2626; }.timeline-dot.dot-pending { background: #fff; border-color: #93a7c8; }.timeline-dot.dot-review { background: #f59e0b; border-color: #f59e0b; }.node-status.status-paid { background: #e8f7ee; color: #16a34a; }.node-status.status-current { background: #e8f7ee; color: #16a34a; }.node-status.status-due { background: #fff4e8; color: #ea580c; }.node-status.status-overdue { background: #fee2e2; color: #dc2626; }.node-status.status-pending { background: #eef3fa; color: #5c76a0; }.node-status.status-review { background: #fff7ed; color: #c2410c; }.payment-node-pay-line { margin-top: 6px; color: #102d59; font-weight: 650; }
|
||||
</style>
|
||||
@@ -0,0 +1,349 @@
|
||||
<!--
|
||||
features/contract-payment/views/ContractPaymentManualReviewPage.vue
|
||||
用途:待确认合同的人工复核弹窗。补齐阶段金额、比例和日期依据后进入合同台账。
|
||||
依赖:contract-payment.api、统一消息提示、admin.contractPaymentReview 文案。
|
||||
逻辑:由合同详情页的「人工复核」按钮打开。合同详情本身不改;已识别阶段预填。
|
||||
勾选无此阶段则该阶段按 0 且不预警。底部四条是填写提示。确认按钮在规则满足前不可点,后端仍是最终校验。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import {
|
||||
getContractPaymentContract,
|
||||
submitContractPaymentManualReview,
|
||||
type ContractPaymentContract,
|
||||
} from '../api/contract-payment.api';
|
||||
|
||||
const props = defineProps<{
|
||||
contractId: number;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
close: [];
|
||||
confirmed: [];
|
||||
}>();
|
||||
|
||||
const STAGE_TYPES = ['prepayment', 'shipment', 'acceptance', 'warranty'] as const;
|
||||
type StageType = typeof STAGE_TYPES[number];
|
||||
|
||||
interface StageForm {
|
||||
nodeType: StageType;
|
||||
skipped: boolean;
|
||||
percent: string;
|
||||
amount: string;
|
||||
basisDate: string;
|
||||
}
|
||||
|
||||
const { t } = useI18n();
|
||||
const msg = useMessage();
|
||||
const loading = ref(false);
|
||||
const submitting = ref(false);
|
||||
const contract = ref<ContractPaymentContract | null>(null);
|
||||
const totalAmount = ref('');
|
||||
const purchaseOrderNo = ref('');
|
||||
const contractNo = ref('');
|
||||
const archiveDate = ref('');
|
||||
const stages = ref<StageForm[]>([]);
|
||||
const contractId = computed(() => Number(props.contractId));
|
||||
|
||||
/**
|
||||
* 按合同金额和比例计算阶段金额,四舍五入到分。
|
||||
* 核心逻辑:与后端 Decimal 半分向上的结果对齐,差额在 0.02 以内才允许确认。
|
||||
* @param percentRaw - 当前阶段比例文本。
|
||||
* @returns 金额;合同金额或比例还不是数字时返回 null。
|
||||
*/
|
||||
function expectedAmount(percentRaw: string): number | null {
|
||||
const total = Number(totalAmount.value);
|
||||
const percent = Number(percentRaw);
|
||||
if (!Number.isFinite(total) || !Number.isFinite(percent) || percentRaw.trim() === '') return null;
|
||||
return Math.round(total * percent) / 100;
|
||||
}
|
||||
|
||||
/**
|
||||
* 把金额格式化成两位小数,供输入框展示。
|
||||
* @param value - 已算出的金额。
|
||||
* @returns 固定两位小数字符串。
|
||||
*/
|
||||
function formatAmount(value: number): string {
|
||||
return value.toFixed(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用合同详情预填复核表单。
|
||||
* 核心逻辑:已有节点带出比例、金额和日期依据;没有节点的阶段留空,不能把空比例当成 0。
|
||||
* 预付款没有日期时用合同归档日,因为预付款的日期依据就是归档日。
|
||||
* @param row - 合同详情。
|
||||
*/
|
||||
function prefill(row: ContractPaymentContract): void {
|
||||
totalAmount.value = row.total_amount || '';
|
||||
purchaseOrderNo.value = row.purchase_order_no || '';
|
||||
contractNo.value = row.contract_no || '';
|
||||
archiveDate.value = (row.oa_archive_at || '').slice(0, 10);
|
||||
stages.value = STAGE_TYPES.map((nodeType) => {
|
||||
const node = (row.nodes || []).find((item) => item.node_type === nodeType);
|
||||
const skipped = String(node?.status || '').trim().toLowerCase() === 'not_applicable';
|
||||
const percentValue = Number(node?.percentage);
|
||||
const percent = node?.percentage != null && node.percentage !== '' && Number.isFinite(percentValue) ? String(percentValue) : '';
|
||||
const basisDate = node?.due_date || node?.anchor_date || (nodeType === 'prepayment' ? archiveDate.value : '');
|
||||
const amount = percent === '' ? '' : (node?.amount || '');
|
||||
return {
|
||||
nodeType,
|
||||
skipped,
|
||||
percent: skipped ? '0' : percent,
|
||||
amount: skipped ? '0' : amount,
|
||||
basisDate: skipped ? '' : basisDate,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载待复核合同。
|
||||
* 核心逻辑:失败时保留空表单并提示,避免把上一份合同的数字提交到新主键。
|
||||
*/
|
||||
async function load(): Promise<void> {
|
||||
loading.value = true;
|
||||
contract.value = null;
|
||||
try {
|
||||
const row = await getContractPaymentContract(contractId.value);
|
||||
contract.value = row;
|
||||
prefill(row);
|
||||
} catch (error) {
|
||||
msg.error(error instanceof BusinessError ? error.message : t('admin.contractPaymentReview.formLoadFailed'));
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 比例变化时按合同金额重算该阶段金额。
|
||||
* @param stage - 正在编辑的阶段。
|
||||
*/
|
||||
function onPercentInput(stage: StageForm): void {
|
||||
if (stage.skipped) return;
|
||||
const expected = expectedAmount(stage.percent);
|
||||
stage.amount = expected == null ? '' : formatAmount(expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* 合同金额变化时重算所有未跳过且已填比例的阶段金额。
|
||||
*/
|
||||
function onTotalInput(): void {
|
||||
stages.value.forEach((stage) => {
|
||||
if (stage.skipped || stage.percent.trim() === '') return;
|
||||
const expected = expectedAmount(stage.percent);
|
||||
if (expected != null) stage.amount = formatAmount(expected);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 归档日仍空着预付款日期时,把归档日带入预付款。
|
||||
* 核心逻辑:预付款日期依据就是合同归档日;用户已经手改过预付款日期时不覆盖。
|
||||
*/
|
||||
function onArchiveInput(): void {
|
||||
const prepayment = stages.value.find((stage) => stage.nodeType === 'prepayment');
|
||||
if (prepayment && !prepayment.skipped && !prepayment.basisDate) prepayment.basisDate = archiveDate.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换无此阶段。勾选后比例和金额记 0 并停用输入。
|
||||
* @param stage - 被勾选的阶段。
|
||||
*/
|
||||
function onSkipChange(stage: StageForm): void {
|
||||
if (!stage.skipped) return;
|
||||
stage.percent = '0';
|
||||
stage.amount = '0';
|
||||
stage.basisDate = '';
|
||||
}
|
||||
|
||||
const enabledStages = computed(() => stages.value.filter((stage) => !stage.skipped));
|
||||
|
||||
const rules = computed(() => {
|
||||
const total = Number(totalAmount.value);
|
||||
const poOk = purchaseOrderNo.value.trim().length > 0 && Number.isFinite(total) && total > 0;
|
||||
const percentOk = enabledStages.value.length > 0 && enabledStages.value.every((stage) => {
|
||||
const value = Number(stage.percent);
|
||||
return stage.percent.trim() !== '' && Number.isFinite(value) && value >= 0;
|
||||
}) && Math.abs(enabledStages.value.reduce((sum, stage) => sum + Number(stage.percent), 0) - 100) < 0.001;
|
||||
const amountOk = percentOk && enabledStages.value.every((stage) => {
|
||||
const expected = expectedAmount(stage.percent);
|
||||
const input = Number(stage.amount);
|
||||
return expected != null && Number.isFinite(input) && Math.abs(input - expected) < 0.02;
|
||||
});
|
||||
const dateOk = enabledStages.value
|
||||
.filter((stage) => stage.nodeType === 'prepayment' || stage.nodeType === 'shipment')
|
||||
.every((stage) => !!stage.basisDate);
|
||||
return [
|
||||
{ ok: poOk, text: t('admin.contractPaymentReview.ruleIdentity') },
|
||||
{ ok: percentOk, text: t('admin.contractPaymentReview.rulePercent') },
|
||||
{ ok: amountOk, text: t('admin.contractPaymentReview.ruleAmount') },
|
||||
{ ok: dateOk, text: t('admin.contractPaymentReview.ruleDate') },
|
||||
];
|
||||
});
|
||||
|
||||
const canSubmit = computed(() => !loading.value && !submitting.value && rules.value.every((rule) => rule.ok));
|
||||
|
||||
const fillHints = computed(() => [
|
||||
t('admin.contractPaymentReview.ruleIdentity'),
|
||||
t('admin.contractPaymentReview.rulePercent'),
|
||||
t('admin.contractPaymentReview.ruleAmount'),
|
||||
t('admin.contractPaymentReview.ruleDate'),
|
||||
]);
|
||||
|
||||
/**
|
||||
* 返回阶段输入框下的说明。
|
||||
* @param nodeType - 付款阶段。
|
||||
* @returns 该阶段日期依据的含义。
|
||||
*/
|
||||
function stageHint(nodeType: StageType): string {
|
||||
const key = {
|
||||
prepayment: 'hintPrepayment',
|
||||
shipment: 'hintShipment',
|
||||
acceptance: 'hintAcceptance',
|
||||
warranty: 'hintWarranty',
|
||||
}[nodeType];
|
||||
return t(`admin.contractPaymentReview.${key}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交复核。通过后通知父级切到合同台账。
|
||||
* 核心逻辑:请求体带上四个阶段;无此阶段仍传 skipped,由后端写成不预警。
|
||||
*/
|
||||
async function submitReview(): Promise<void> {
|
||||
if (!canSubmit.value || !contract.value) return;
|
||||
submitting.value = true;
|
||||
try {
|
||||
await submitContractPaymentManualReview(contract.value.id, {
|
||||
purchase_order_no: purchaseOrderNo.value.trim(),
|
||||
contract_no: contractNo.value.trim(),
|
||||
total_amount: totalAmount.value.trim(),
|
||||
archive_date: archiveDate.value,
|
||||
stages: stages.value.map((stage) => ({
|
||||
node_type: stage.nodeType,
|
||||
skipped: stage.skipped,
|
||||
percentage: stage.skipped ? '0' : stage.percent.trim(),
|
||||
amount: stage.skipped ? '0' : stage.amount.trim(),
|
||||
basis_date: stage.skipped ? '' : stage.basisDate,
|
||||
})),
|
||||
});
|
||||
msg.success(t('admin.contractPaymentReview.confirmSuccess'));
|
||||
emit('confirmed');
|
||||
} catch (error) {
|
||||
msg.error(error instanceof BusinessError ? error.message : t('admin.contractPaymentReview.submitFailed'));
|
||||
} finally {
|
||||
submitting.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
watch(contractId, () => void load());
|
||||
onMounted(() => void load());
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<div class="dialog-overlay z-[160] items-center" @click.self="emit('close')">
|
||||
<div class="dialog-panel review-dialog" role="dialog" aria-modal="true" :aria-label="t('admin.contractPaymentReview.manualAction')">
|
||||
<div class="dialog-header dialog-header--compact">
|
||||
<div class="min-w-0">
|
||||
<div class="text-base font-semibold text-slate-900">{{ t('admin.contractPaymentReview.manualAction') }}</div>
|
||||
<p v-if="contract" class="mt-1 text-sm text-muted">{{ t('admin.contractPaymentReview.manualSubtitle', { supplier: contract.supplier_name || '—', purchaseOrder: contract.purchase_order_no || '—' }) }}</p>
|
||||
</div>
|
||||
<button type="button" class="btn-secondary shrink-0" @click="emit('close')">{{ t('common.close') }}</button>
|
||||
</div>
|
||||
<div class="dialog-body">
|
||||
<p v-if="loading && !contract" class="review-empty">{{ t('admin.contractPayment.detailLoading') }}</p>
|
||||
<template v-else-if="contract">
|
||||
<div class="review-cards">
|
||||
<label>
|
||||
<span>{{ t('admin.contractPayment.amount') }}</span>
|
||||
<input v-model="totalAmount" type="number" min="0" step="0.01" @input="onTotalInput" />
|
||||
</label>
|
||||
<label>
|
||||
<span>{{ t('admin.contractPayment.purchaseOrder') }}</span>
|
||||
<input v-model="purchaseOrderNo" type="text" />
|
||||
</label>
|
||||
<label>
|
||||
<span>{{ t('admin.contractPaymentReview.contractNoOptional') }}</span>
|
||||
<input v-model="contractNo" type="text" :placeholder="t('admin.contractPaymentReview.contractNoPlaceholder')" />
|
||||
</label>
|
||||
<label>
|
||||
<span>{{ t('admin.contractPayment.archiveDate') }}</span>
|
||||
<input v-model="archiveDate" type="date" @input="onArchiveInput" />
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="review-stage">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ t('admin.contractPayment.detailPaymentPlan') }}</th>
|
||||
<th>{{ t('admin.contractPaymentReview.percentage') }}</th>
|
||||
<th>{{ t('admin.contractPaymentReview.stageAmount') }}</th>
|
||||
<th>{{ t('admin.contractPaymentReview.basisDate') }}</th>
|
||||
<th>{{ t('admin.contractPaymentReview.noStage') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="stage in stages" :key="stage.nodeType">
|
||||
<td>
|
||||
<strong>{{ t(`admin.contractPayment.nodeType.${stage.nodeType}`) }}</strong>
|
||||
<span>{{ stageHint(stage.nodeType) }}</span>
|
||||
</td>
|
||||
<td><input v-model="stage.percent" type="number" min="0" max="100" step="0.01" :disabled="stage.skipped" @input="onPercentInput(stage)" /></td>
|
||||
<td><input v-model="stage.amount" type="number" min="0" step="0.01" :disabled="stage.skipped" /></td>
|
||||
<td><input v-model="stage.basisDate" type="date" :disabled="stage.skipped" /></td>
|
||||
<td>
|
||||
<label class="review-check">
|
||||
<input v-model="stage.skipped" type="checkbox" @change="onSkipChange(stage)" />
|
||||
{{ t('admin.contractPaymentReview.noStage') }}
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="review-hint">
|
||||
<strong>{{ t('admin.contractPaymentReview.fillHintTitle') }}</strong>
|
||||
<p v-for="hint in fillHints" :key="hint">{{ hint }}</p>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class="dialog-footer">
|
||||
<button type="button" class="btn-secondary" @click="emit('close')">{{ t('common.cancel') }}</button>
|
||||
<button type="button" class="btn-primary" :disabled="!canSubmit" @click="submitReview">
|
||||
{{ t('admin.contractPaymentReview.confirmLedger') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.review-dialog { width: min(1080px, 100%); max-height: min(85vh, 900px); }
|
||||
.review-empty { padding: 28px 0; color: #58749f; }
|
||||
.review-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
|
||||
.review-cards label, .review-stage { border: 1px solid #d7e1ef; border-radius: 12px; background: #fff; }
|
||||
.review-cards label { display: block; padding: 12px; background: #f8fbff; }
|
||||
.review-cards span, .review-stage th { color: #58749f; font-size: 12px; }
|
||||
.review-cards input, .review-stage input[type="number"], .review-stage input[type="text"], .review-stage input[type="date"] {
|
||||
width: 100%; height: 32px; margin-top: 6px; border: 1px solid #d7e1ef; border-radius: 8px; padding: 0 8px; background: #fff; color: #102d59; font-weight: 650;
|
||||
}
|
||||
.review-cards input { border: 0; background: transparent; padding: 0; font-size: 15px; }
|
||||
.review-cards input:focus { background: #fff; }
|
||||
.review-stage { overflow: auto; }
|
||||
.review-stage table { width: 100%; border-collapse: collapse; }
|
||||
.review-stage th, .review-stage td { padding: 12px 14px; text-align: left; border-bottom: 1px solid #e4ecf6; vertical-align: top; }
|
||||
.review-stage th { background: #f7faff; }
|
||||
.review-stage td span { display: block; margin-top: 4px; color: #58749f; font-size: 12px; }
|
||||
.review-stage input:disabled { background: #f3f6fb; color: #8aa0bd; }
|
||||
.review-check { display: flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
|
||||
.review-hint { margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: #f7faff; color: #58749f; }
|
||||
.review-hint strong { display: block; margin-bottom: 4px; color: #426493; font-size: 13px; }
|
||||
.review-hint p { margin: 0; font-size: 13px; line-height: 1.6; }
|
||||
@media (max-width: 900px) {
|
||||
.review-cards { grid-template-columns: 1fr 1fr; }
|
||||
}
|
||||
</style>
|
||||
@@ -3,6 +3,7 @@
|
||||
用途:合同付款预警台账列表、汇总卡与本周待发送摘要。
|
||||
依赖:contract-payment.api、PaginationBar、统一消息提示。
|
||||
逻辑:Chat Tab 以 embedded 嵌入时隐藏页头;点行通过 open-detail 交给父级下钻详情;关键词可搜合同号、流程号、采购单号、供应商和申请人。
|
||||
四阶段列只显示阶段名。预付款、出货款按 ERP 付款事实标已付或逾期/即将到期/未到期;验收款、质保款只展示金额比例和日期依据。
|
||||
嵌入布局为上半汇总卡/搜索与底部分页固定,仅表格区域双向滚动;汇总卡采用紧凑尺寸以留出小屏列表高度。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
@@ -22,7 +23,7 @@ import {
|
||||
type LedgerSummary,
|
||||
} from '../api/contract-payment.api';
|
||||
import { displayCurrency } from '../utils/currency';
|
||||
import { aggregateContractNodeStatus, type ContractNodeStatusCode } from '../utils/paymentStatus';
|
||||
import { aggregateContractNodeStatus, isNodeNearDue, isNodeOverdue, nodeDueReference, type ContractNodeStatusCode } from '../utils/paymentStatus';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
embedded?: boolean;
|
||||
@@ -42,7 +43,7 @@ const page = ref(1); const pageSize = ref(20); const total = ref(0); const pages
|
||||
const ledgerFocusCards = computed(() => ([
|
||||
{ key: 'due' as const, label: t('admin.contractPayment.ledgerFocus.due'), hint: t('admin.contractPayment.ledgerFocus.dueHint'), value: ledgerSummary.value.due, tone: 'due' },
|
||||
{ key: 'overdue' as const, label: t('admin.contractPayment.ledgerFocus.overdue'), hint: '', value: ledgerSummary.value.overdue, tone: 'overdue' },
|
||||
{ key: 'active' as const, label: t('admin.contractPayment.ledgerFocus.active'), hint: '', value: ledgerSummary.value.active, tone: 'in-progress' },
|
||||
{ key: 'active' as const, label: t('admin.contractPayment.ledgerFocus.active'), hint: t('admin.contractPayment.ledgerFocus.activeHint'), value: ledgerSummary.value.active, tone: 'in-progress' },
|
||||
{ key: 'due_this_month' as const, label: t('admin.contractPayment.ledgerFocus.dueThisMonth'), hint: t('admin.contractPayment.ledgerFocus.dueThisMonthHint'), value: ledgerSummary.value.due_this_month, tone: 'month' },
|
||||
]));
|
||||
const stage = (item: ContractPaymentContract, name: string) => item.nodes.find((node) => node.node_type === name);
|
||||
@@ -57,22 +58,50 @@ const displayPercentage = (percentage?: string | null): string => {
|
||||
const value = Number(percentage);
|
||||
return Number.isFinite(value) ? String(Math.round(value)) : String(percentage);
|
||||
};
|
||||
const stageTypes = ['prepayment', 'shipment', 'acceptance', 'warranty'] as const;
|
||||
type StagePayTone = '' | 'paid' | 'overdue' | 'due' | 'normal';
|
||||
/**
|
||||
* 将付款节点拆为原型表格需要的金额比例行和日期行。
|
||||
* 核心逻辑:节点不存在时显示短横线;存在但日期未明确时仅显示“待补充日期”,避免把锚点日期误当付款日期。
|
||||
* 组装一个付款阶段格子:金额比例、日期,以及预付款/出货款的付款状态。
|
||||
* 核心逻辑:预付款、出货款有 ERP 付款事实。已付显示付款日;未付按日期依据标已逾期、即将到期或未到期,日期仍是依据日。
|
||||
* 验收款、质保款没有付款回写,不标已付或未付。没有日期依据时显示待补充日期。
|
||||
* 人工复核标成无此阶段,或比例和金额都是 0 的阶段,显示为横线,不参与这一格的状态。
|
||||
* @param item - 合同台账行。
|
||||
* @param name - 付款节点类型。
|
||||
* @returns 表格单元格展示所需的金额比例、日期及是否为待补充状态。
|
||||
* @returns 金额比例、日期文本、是否待补充,以及状态标签和色调。
|
||||
*/
|
||||
const paymentCell = (item: ContractPaymentContract, name: string) => {
|
||||
const node = stage(item, name);
|
||||
if (!node) return { amountRatio: '—', date: '', missingDate: false };
|
||||
const empty = { amountRatio: '—', dateText: '', missingDate: false, payLabel: '', payTone: '' as StagePayTone };
|
||||
if (!node) return empty;
|
||||
const status = String(node.status || '').trim().toLowerCase();
|
||||
const percentValue = Number(node.percentage);
|
||||
const amountValue = Number(node.amount);
|
||||
const absent = status === 'not_applicable' || (
|
||||
status !== 'paid'
|
||||
&& Number.isFinite(percentValue)
|
||||
&& percentValue === 0
|
||||
&& (node.amount == null || node.amount === '' || amountValue === 0)
|
||||
);
|
||||
if (absent) return empty;
|
||||
const amountRatio = node.amount || node.percentage ? `${node.amount || '—'} / ${displayPercentage(node.percentage)}%` : '—';
|
||||
const date = node.due_date || node.anchor_date || '';
|
||||
return { amountRatio, date, missingDate: !date };
|
||||
const basis = nodeDueReference(node) || '';
|
||||
const payable = name === 'prepayment' || name === 'shipment';
|
||||
const paid = String(node.status || '').trim().toLowerCase() === 'paid';
|
||||
if (payable && paid) {
|
||||
return { amountRatio, dateText: node.paid_at || '—', missingDate: false, payLabel: t('admin.contractPayment.stagePaid'), payTone: 'paid' as StagePayTone };
|
||||
}
|
||||
if (!basis) return { amountRatio, dateText: '', missingDate: true, payLabel: '', payTone: '' as StagePayTone };
|
||||
if (!payable) return { amountRatio, dateText: basis, missingDate: false, payLabel: '', payTone: '' as StagePayTone };
|
||||
if (isNodeOverdue(basis)) {
|
||||
return { amountRatio, dateText: basis, missingDate: false, payLabel: t('admin.contractPayment.statusOverdue'), payTone: 'overdue' as StagePayTone };
|
||||
}
|
||||
if (isNodeNearDue(basis)) {
|
||||
return { amountRatio, dateText: basis, missingDate: false, payLabel: t('admin.contractPayment.statusUpcoming'), payTone: 'due' as StagePayTone };
|
||||
}
|
||||
return { amountRatio, dateText: basis, missingDate: false, payLabel: t('admin.contractPayment.statusActive'), payTone: 'normal' as StagePayTone };
|
||||
};
|
||||
/**
|
||||
* 按付款节点聚合台账状态:进行中 / 即将到期 / 已逾期 / 已完成 / 待补充。
|
||||
* 按付款节点聚合台账状态:未到期 / 即将到期 / 已逾期 / 已完成 / 待补充。
|
||||
* 核心逻辑:合同层先排除「待补充」(非激活或解析待确认);否则按节点到期/逾期状态取最高优先级展示,
|
||||
* 让台账行一眼看出是否有逾期款。 @param item - 合同台账行。 @returns 状态标签和对应的视觉色调。
|
||||
*/
|
||||
@@ -231,14 +260,14 @@ onMounted(() => void load());
|
||||
<table class="contract-ledger-table text-sm">
|
||||
<thead><tr>
|
||||
<th>{{ t('admin.contractPayment.contractSupplier') }}</th><th>{{ t('admin.contractPayment.amount') }}</th>
|
||||
<th v-for="nodeType in ['prepayment', 'shipment', 'acceptance', 'warranty']" :key="nodeType"><span>{{ t(`admin.contractPayment.nodeType.${nodeType}`) }}</span><small>{{ t('admin.contractPayment.amountRatioDate') }}</small></th>
|
||||
<th v-for="nodeType in stageTypes" :key="nodeType">{{ t(`admin.contractPayment.nodeType.${nodeType}`) }}</th>
|
||||
<th>{{ t('admin.contractPayment.applicant') }}</th><th>{{ t('admin.contractPayment.statusLabel') }}</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr v-for="item in contracts" :key="item.id" class="contract-ledger-row" @click="openContractDetail(item.id)">
|
||||
<td class="contract-identify"><strong>{{ t('admin.contractPayment.contractPrefix') }}:{{ item.contract_no || t('admin.contractPayment.contractNoPending') }}</strong><span>{{ t('admin.contractPayment.workflowNo') }}:{{ item.workflow_no || '—' }}</span><span>{{ t('admin.contractPayment.purchaseOrder') }}:{{ item.purchase_order_no || '—' }}</span><span>{{ item.supplier_name || '—' }}</span></td>
|
||||
<td class="contract-identify"><strong>{{ t('admin.contractPayment.contractPrefix') }}:{{ item.contract_no || t('admin.contractPayment.contractNoPending') }}</strong><span>{{ t('admin.contractPayment.purchaseOrder') }}:{{ item.purchase_order_no || '—' }}</span><span>{{ item.supplier_name || '—' }}</span></td>
|
||||
<td class="contract-money">{{ item.total_amount || '—' }}<span v-if="displayCurrency(item.currency)"> {{ displayCurrency(item.currency) }}</span></td>
|
||||
<td v-for="nodeType in ['prepayment', 'shipment', 'acceptance', 'warranty']" :key="nodeType" class="contract-payment-cell"><template v-if="paymentCell(item, nodeType).amountRatio !== '—'"><strong>{{ paymentCell(item, nodeType).amountRatio }}</strong><span :class="{ 'contract-date-pending': paymentCell(item, nodeType).missingDate }">{{ paymentCell(item, nodeType).date || t('admin.contractPayment.datePending') }}</span></template><span v-else>—</span></td>
|
||||
<td v-for="nodeType in stageTypes" :key="nodeType" class="contract-payment-cell"><template v-if="paymentCell(item, nodeType).amountRatio !== '—'"><strong>{{ paymentCell(item, nodeType).amountRatio }}</strong><span :class="{ 'contract-date-pending': paymentCell(item, nodeType).missingDate }">{{ paymentCell(item, nodeType).dateText || t('admin.contractPayment.datePending') }}</span><span v-if="paymentCell(item, nodeType).payLabel" class="stage-pay-tag" :class="paymentCell(item, nodeType).payTone">{{ paymentCell(item, nodeType).payLabel }}</span></template><span v-else>—</span></td>
|
||||
<td class="contract-applicant">{{ item.applicant_name || '—' }}</td>
|
||||
<td><span class="contract-status" :class="displayStatus(item).tone">{{ displayStatus(item).label }}</span></td>
|
||||
</tr>
|
||||
@@ -344,11 +373,10 @@ onMounted(() => void load());
|
||||
.contract-scroll-panel::-webkit-scrollbar-thumb { background: #9eb1c9; border-radius: 8px; border: 2px solid #e8eef6; }
|
||||
.contract-scroll-panel::-webkit-scrollbar-thumb:hover { background: #7c93b0; }
|
||||
.contract-ledger-table { width: 100%; min-width: 1260px; border-collapse: separate; border-spacing: 0; color: #183c72; }
|
||||
.contract-ledger-table th { position: sticky; top: 0; z-index: 2; height: 59px; padding: 11px 12px; background: #f7faff; border-bottom: 1px solid #d7e1ef; color: #426493; font-size: 13px; font-weight: 700; line-height: 1.35; text-align: left; vertical-align: top; white-space: nowrap; }
|
||||
.contract-ledger-table th small { display: block; margin-top: 2px; font-size: 12px; font-weight: 600; }
|
||||
.contract-ledger-table th { position: sticky; top: 0; z-index: 2; height: auto; padding: 10px 12px; background: #f7faff; border-bottom: 1px solid #d7e1ef; color: #426493; font-size: 13px; font-weight: 700; line-height: 1.35; text-align: left; vertical-align: middle; white-space: nowrap; }
|
||||
.contract-ledger-table td { padding: 12px; border-bottom: 1px solid #d7e1ef; vertical-align: top; line-height: 1.5; }
|
||||
.contract-ledger-table tbody tr:last-child td { border-bottom: 0; }
|
||||
.contract-ledger-table tbody tr:hover { background: #fbfdff; }.contract-ledger-row { cursor: pointer; }
|
||||
.contract-ledger-table th:nth-child(1) { width: 22%; }.contract-ledger-table th:nth-child(2) { width: 8.5%; }.contract-ledger-table th:nth-child(n+3):nth-child(-n+6) { width: 13.5%; }.contract-ledger-table th:nth-child(7) { width: 7.5%; }.contract-ledger-table th:nth-child(8) { width: 7%; }
|
||||
.contract-identify strong, .contract-payment-cell strong { display: block; color: #102d59; font-weight: 750; }.contract-identify span, .contract-payment-cell span { display: block; margin-top: 3px; color: #58749f; }.contract-identify strong { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }.contract-money { color: #102d59; white-space: nowrap; }.contract-payment-cell { color: #102d59; }.contract-date-pending { color: #5c76a0; }.contract-applicant { white-space: nowrap; color: #102d59; }.contract-status { display: inline-flex; align-items: center; min-height: 23px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }.contract-status.normal { color: #2563eb; background: #edf5ff; }.contract-status.due { color: #ea580c; background: #fff4e8; }.contract-status.overdue { color: #dc2626; background: #fee2e2; }.contract-status.completed { color: #16a34a; background: #e8f7ee; }.contract-status.needs-completion { color: #c2410c; background: #fff4e8; }.contract-empty { padding: 34px !important; color: var(--text-muted); text-align: center; }
|
||||
.contract-identify strong, .contract-payment-cell strong { display: block; color: #102d59; font-weight: 750; }.contract-identify span, .contract-payment-cell span { display: block; margin-top: 3px; color: #58749f; }.contract-payment-cell .stage-pay-tag { display: inline-flex; align-items: center; margin-top: 6px; margin-bottom: 0; min-height: 20px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }.contract-payment-cell .stage-pay-tag.paid { color: #16a34a; background: #e8f7ee; }.contract-payment-cell .stage-pay-tag.due { color: #ea580c; background: #fff4e8; }.contract-payment-cell .stage-pay-tag.overdue { color: #dc2626; background: #fee2e2; }.contract-payment-cell .stage-pay-tag.normal { color: #2563eb; background: #edf5ff; }.contract-identify strong { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }.contract-money { color: #102d59; white-space: nowrap; }.contract-payment-cell { color: #102d59; }.contract-date-pending { color: #5c76a0; }.contract-applicant { white-space: nowrap; color: #102d59; }.contract-status { display: inline-flex; align-items: center; min-height: 23px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }.contract-status.normal { color: #2563eb; background: #edf5ff; }.contract-status.due { color: #ea580c; background: #fff4e8; }.contract-status.overdue { color: #dc2626; background: #fee2e2; }.contract-status.completed { color: #16a34a; background: #e8f7ee; }.contract-status.needs-completion { color: #c2410c; background: #fff4e8; }.contract-empty { padding: 34px !important; color: var(--text-muted); text-align: center; }
|
||||
</style>
|
||||
@@ -2,7 +2,7 @@
|
||||
features/contract-payment/views/ContractPaymentReviewPage.vue
|
||||
用途:集中展示关键解析事实缺失或冲突的合同,供管理员下载原文并人工确认。
|
||||
依赖:contract-payment.api、PaginationBar、统一消息提示。
|
||||
逻辑:后端以 review_only 过滤 needs_review 合同;关键词可搜合同号、采购单号、供应商和申请人;Chat 父级通过 open-detail 下钻详情。
|
||||
逻辑:后端以 review_only 过滤 needs_review 合同;关键词可搜合同号、采购单号、供应商和申请人;点行打开原来的合同详情,人工复核在详情页按钮里弹出。
|
||||
嵌入布局为搜索栏与底部分页固定,仅表格区域滚动,表头 sticky。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
@@ -56,8 +56,8 @@ async function load(resetPage = false): Promise<void> {
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开待确认合同详情,以便查看解析问题并下载原文人工核验。
|
||||
* 核心逻辑:仍复用现有合同详情页,避免新页面复制附件权限与下载逻辑。
|
||||
* 打开待确认合同的原详情。
|
||||
* 核心逻辑:把合同主键交给 Chat 父级,仍进入合同详情;人工复核从表单按钮弹出,不替换详情。
|
||||
* @param contractId - 合同付款台账主键。
|
||||
* @returns 路由跳转完成。
|
||||
*/
|
||||
|
||||
+132
-13
@@ -1,13 +1,13 @@
|
||||
<!--
|
||||
features/contract-payment/views/ContractPaymentWeeklyBatchesPage.vue
|
||||
用途:独立展示合同付款预警的周汇总批次及其企业微信发送审计摘要,并下载 Excel 明细。
|
||||
依赖:contract-payment.api、统一消息提示。
|
||||
逻辑:后端扫描产生的批次在此集中查看;Excel 经受控接口下载;Chat 顶栏共用发送入口,本页 embedded 时隐藏页头与发送按钮。
|
||||
嵌入布局仅表格区域滚动,表头 sticky,滚动条常显。
|
||||
依赖:contract-payment.api、统一消息提示、lucide 图标。
|
||||
逻辑:后端扫描产生的批次在此集中查看;Excel 经受控接口下载;发送失败时点击图标查看原因。
|
||||
Chat 顶栏共用发送入口,本页 embedded 时隐藏页头与发送按钮。嵌入布局仅表格区域滚动,表头 sticky,滚动条常显。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { CalendarClock, Download } from 'lucide-vue-next';
|
||||
import { onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
||||
import { CalendarClock, CircleAlert, Download, X } from 'lucide-vue-next';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import { formatLocalDateTime } from '@/shared/utils/dateTime';
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
downloadContractPaymentAlertBatchExcel,
|
||||
listContractPaymentAlertBatches,
|
||||
type AlertBatch,
|
||||
type AlertBatchFailureReason,
|
||||
} from '../api/contract-payment.api';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
@@ -27,6 +28,7 @@ const msg = useMessage();
|
||||
const batches = ref<AlertBatch[]>([]);
|
||||
const loading = ref(false);
|
||||
const downloadingId = ref<number | null>(null);
|
||||
const failureBatch = ref<AlertBatch | null>(null);
|
||||
|
||||
/**
|
||||
* 加载合同付款周汇总批次列表。
|
||||
@@ -94,16 +96,81 @@ function displayStatus(status?: string | null): string {
|
||||
|
||||
/**
|
||||
* 格式化批次发送时间为用户本地时间的 YYYY-MM-DD HH:mm:ss。
|
||||
* 核心逻辑:发送时间由后端以 UTC 存储(datetime.utcnow),需换算到浏览器时区展示;
|
||||
* 空值回退 '—',非法日期回退原值以便排障。
|
||||
* @param iso - 后端返回的 ISO 发送时间字符串。
|
||||
* @returns 本地时间文本。
|
||||
* 核心逻辑:成功与失败都展示最近一次尝试时间。历史失败批次没有 sent_at 时,回退到批次创建时间。
|
||||
* @param batch - 周汇总批次。
|
||||
* @returns 本地时间文本;两边都空时返回 '—'。
|
||||
*/
|
||||
function displaySentAt(iso?: string | null): string {
|
||||
return iso ? formatLocalDateTime(iso) : '—';
|
||||
function displaySentAt(batch: AlertBatch): string {
|
||||
const iso = batch.sent_at || batch.created_at;
|
||||
if (!iso) return '—';
|
||||
const text = formatLocalDateTime(iso);
|
||||
return text === '-' ? '—' : text;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断批次是否为发送失败,用于展示失败原因图标。
|
||||
* 核心逻辑:只认后端 status=failed,大小写不敏感。
|
||||
* @param status - 批次发送状态。
|
||||
* @returns 是否展示失败原因入口。
|
||||
*/
|
||||
function isFailed(status?: string | null): boolean {
|
||||
return String(status || '').trim().toLowerCase() === 'failed';
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开指定失败批次的原因弹层。
|
||||
* 核心逻辑:原因来自列表接口的 failure_reasons,点击图标时不再额外请求。
|
||||
* @param batch - 当前失败批次。
|
||||
*/
|
||||
function openFailureReason(batch: AlertBatch): void {
|
||||
failureBatch.value = batch;
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭失败原因弹层。
|
||||
* 核心逻辑:清空当前批次即可卸下弹层与 Esc 监听。
|
||||
*/
|
||||
function closeFailureReason(): void {
|
||||
failureBatch.value = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 把失败原因编码翻译成当前语言的多行文本。
|
||||
* 核心逻辑:已知 code 走 i18n;有 detail 时拼到标签后;没有任何原因时展示空态文案。
|
||||
* @param batch - 当前失败批次。
|
||||
* @returns 弹层正文。
|
||||
*/
|
||||
function failureReasonText(batch: AlertBatch): string {
|
||||
const reasons = (batch.failure_reasons || []).filter((item): item is AlertBatchFailureReason => Boolean(item?.code || item?.detail));
|
||||
if (!reasons.length) return t('admin.contractPayment.batchFailureReasonEmpty');
|
||||
return reasons.map((item) => {
|
||||
const code = String(item.code || 'unknown').trim() || 'unknown';
|
||||
const key = `admin.contractPayment.batchFailureReasonCode.${code}`;
|
||||
const label = te(key) ? t(key) : t('admin.contractPayment.batchFailureReasonCode.unknown');
|
||||
const detail = String(item.detail || '').trim();
|
||||
return detail ? t('admin.contractPayment.batchFailureReasonLine', { reason: label, detail }) : label;
|
||||
}).join('\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* 失败原因弹层打开时按 Esc 关闭。
|
||||
* 核心逻辑:只处理 Escape,避免拦截弹层外的其它按键。
|
||||
* @param event - 窗口键盘事件。
|
||||
*/
|
||||
function onFailureKeydown(event: KeyboardEvent): void {
|
||||
if (event.key === 'Escape') closeFailureReason();
|
||||
}
|
||||
|
||||
watch(failureBatch, (batch) => {
|
||||
if (batch) window.addEventListener('keydown', onFailureKeydown);
|
||||
else window.removeEventListener('keydown', onFailureKeydown);
|
||||
});
|
||||
|
||||
onMounted(() => void load());
|
||||
onBeforeUnmount(() => window.removeEventListener('keydown', onFailureKeydown));
|
||||
|
||||
/** 供发送预警完成后重新拉取批次,避免列表停在点击前的状态。 */
|
||||
defineExpose({ reload: load });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -129,7 +196,21 @@ onMounted(() => void load());
|
||||
<tr v-for="batch in batches" :key="batch.id">
|
||||
<td class="font-mono font-semibold text-primary">{{ batch.batch_no || '—' }}</td>
|
||||
<td>{{ batch.week_key || '—' }}</td>
|
||||
<td><span class="batch-status">{{ displayStatus(batch.status) }}</span></td>
|
||||
<td>
|
||||
<span class="batch-status-wrap">
|
||||
<span class="batch-status" :class="{ 'is-failed': isFailed(batch.status) }">{{ displayStatus(batch.status) }}</span>
|
||||
<button
|
||||
v-if="isFailed(batch.status)"
|
||||
class="failure-reason-btn"
|
||||
type="button"
|
||||
:aria-label="t('admin.contractPayment.batchFailureReasonAria')"
|
||||
:title="t('admin.contractPayment.batchFailureReason')"
|
||||
@click.stop="openFailureReason(batch)"
|
||||
>
|
||||
<CircleAlert class="h-4 w-4" />
|
||||
</button>
|
||||
</span>
|
||||
</td>
|
||||
<td>{{ batch.summary?.total || 0 }}</td>
|
||||
<td>
|
||||
<button
|
||||
@@ -145,7 +226,7 @@ onMounted(() => void load());
|
||||
</button>
|
||||
<span v-else class="text-muted">—</span>
|
||||
</td>
|
||||
<td>{{ displaySentAt(batch.sent_at) }}</td>
|
||||
<td>{{ displaySentAt(batch) }}</td>
|
||||
</tr>
|
||||
<tr v-if="!loading && !batches.length">
|
||||
<td colspan="6" class="weekly-batch-empty">
|
||||
@@ -156,6 +237,40 @@ onMounted(() => void load());
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<Teleport to="body">
|
||||
<div
|
||||
v-if="failureBatch"
|
||||
class="fixed inset-0 z-[80] flex items-center justify-center bg-slate-900/30 p-6"
|
||||
@click.self="closeFailureReason"
|
||||
>
|
||||
<div
|
||||
class="w-full max-w-[420px] rounded-2xl bg-white p-4 text-[#183c72] shadow-[0_18px_50px_rgba(15,23,42,0.18)]"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
:aria-label="t('admin.contractPayment.batchFailureReason')"
|
||||
>
|
||||
<div class="flex items-start gap-2.5">
|
||||
<CircleAlert class="mt-0.5 h-5 w-5 shrink-0 text-rose-600" />
|
||||
<div class="min-w-0 flex-1">
|
||||
<h3 class="text-[15px] font-bold leading-snug">{{ t('admin.contractPayment.batchFailureReason') }}</h3>
|
||||
<p class="mt-0.5 break-all font-mono text-xs text-slate-500">{{ failureBatch.batch_no || '—' }}</p>
|
||||
</div>
|
||||
<button
|
||||
class="inline-flex h-7 w-7 items-center justify-center rounded-lg text-slate-500 hover:bg-slate-100 hover:text-slate-900"
|
||||
type="button"
|
||||
:aria-label="t('common.close')"
|
||||
@click="closeFailureReason"
|
||||
>
|
||||
<X class="h-4 w-4" />
|
||||
</button>
|
||||
</div>
|
||||
<p class="mt-3.5 max-h-60 overflow-auto whitespace-pre-wrap break-words rounded-xl bg-rose-50 px-3.5 py-3 text-[13px] leading-relaxed text-rose-800">
|
||||
{{ failureReasonText(failureBatch) }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
@@ -179,6 +294,10 @@ onMounted(() => void load());
|
||||
.weekly-batch-table tbody tr:last-child td { border-bottom: 0; }
|
||||
.weekly-batch-table tbody tr:hover { background: #fbfdff; }
|
||||
.batch-status { display: inline-flex; min-height: 24px; align-items: center; border-radius: 999px; background: #edf5ff; padding: 2px 9px; color: #2563eb; font-size: 12px; font-weight: 700; }
|
||||
.batch-status.is-failed { background: #fff1f2; color: #e11d48; }
|
||||
.batch-status-wrap { display: inline-flex; align-items: center; gap: 6px; }
|
||||
.failure-reason-btn { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin: 0; border: 0; border-radius: 999px; background: transparent; padding: 0; color: #e11d48; cursor: pointer; }
|
||||
.failure-reason-btn:hover { background: #fff1f2; }
|
||||
.excel-download { display: inline-flex; max-width: 360px; align-items: center; gap: 6px; color: #2563eb; font-weight: 650; }
|
||||
.excel-download:disabled { opacity: .55; }
|
||||
.weekly-batch-empty { padding: 36px !important; color: var(--text-muted); text-align: center; }
|
||||
|
||||
@@ -702,7 +702,7 @@
|
||||
"movementStandardField": "Standard Movement Field",
|
||||
"movementBindingLabel": "Movement Parsing Rule",
|
||||
"movementBindingNone": "Not bound",
|
||||
"movementBindingHint": "With a published movement rule bound, precheck reuses archived receipt files; when unbound, precheck will not trigger a fetch (fail-closed).",
|
||||
"movementBindingHint": "With a published movement rule bound, matching reuses archived receipt files; when unbound, matching will not trigger a fetch (fail-closed).",
|
||||
"movementFields": {
|
||||
"doc_no": "Doc No.", "line_no": "Line No.", "in_out_flag": "In/Out Flag", "material_code": "Material Code",
|
||||
"material_name": "Material Name", "warehouse_code": "Warehouse", "storage_code": "Storage Bin", "lot_no": "Lot No.",
|
||||
@@ -2581,7 +2581,7 @@
|
||||
"platformJobAccountingVoucherPoPrint": "Accounting voucher PO print",
|
||||
"accountingVoucherPoPrintHint": "Every Tuesday at 05:00, fetch last month's invoices from ERP, generate purchase-order PDFs, and upload them to the PO-order folder—before the 06:00 check. Skip same names.",
|
||||
"platformJobAccountingVoucherOaSalesRelease": "Accounting voucher sales-release fetch",
|
||||
"accountingVoucherOaSalesReleaseHint": "Every Tuesday at 05:30, query last month's archived E10 sales-release forms, download their PDFs, and upload them to the sales-order folder—before the 06:00 check. Skip same names.",
|
||||
"accountingVoucherOaSalesReleaseHint": "Every Tuesday at 05:30, query last month's archived E10 sales-release forms, download their PDFs, and upload them to the sales-release application folder—before the 06:00 check. Skip same names.",
|
||||
"voucherCheckScope": "Ledger scope",
|
||||
"voucherCheckProfile": "Business profile",
|
||||
"voucherCheckNotifyMissing": "Notify on missing materials",
|
||||
@@ -5019,191 +5019,11 @@
|
||||
}
|
||||
},
|
||||
"contractPayment": {
|
||||
"title": "Contract Payment Alerts",
|
||||
"subtitle": "Sync OA contract, acceptance, and vendor prepayment requests; notify procurement roles through three escalation rounds.",
|
||||
"sync": "Sync OA data",
|
||||
"forceSync": "Force overwrite OA fields",
|
||||
"forceSyncConfirm": "This will overwrite existing OA data with non-empty fields returned this time and record an audit trail. Continue?",
|
||||
"reparseExisting": "Reparse existing contracts",
|
||||
"reparseExistingConfirm": "This will refresh all existing contract parsing results from archived attachments using the current rules. OA fields will not be synced or overwritten. Continue?",
|
||||
"scanAlerts": "Scan to generate alerts",
|
||||
"jobSubmitted": "Job submitted",
|
||||
"actionFailed": "Action failed",
|
||||
"loadFailed": "Failed to load contracts",
|
||||
"searchPlaceholder": "Search contract number, purchase order, supplier, or applicant",
|
||||
"allStatus": "All",
|
||||
"search": "Search",
|
||||
"ledger": "Contract ledger",
|
||||
"items": "items",
|
||||
"empty": "No contract data",
|
||||
"purchaseOrder": "Purchase order",
|
||||
"supplier": "Supplier",
|
||||
"amount": "Contract amount",
|
||||
"deliveryDate": "Delivery due date",
|
||||
"timeline": "Payment plan timeline",
|
||||
"notAvailable": "—",
|
||||
"stats": {
|
||||
"contracts": "Contracts",
|
||||
"pendingParse": "Pending contracts",
|
||||
"readyPlans": "Plans ready",
|
||||
"alerts": "Alert nodes"
|
||||
},
|
||||
"ledgerFocus": {
|
||||
"due": "Due soon",
|
||||
"dueHint": "within 7 days",
|
||||
"overdue": "Overdue unpaid",
|
||||
"needsCompletion": "Needs completion",
|
||||
"dueThisMonth": "Due this month",
|
||||
"dueThisMonthHint": "this calendar month",
|
||||
"active": "In progress"
|
||||
},
|
||||
"status": {
|
||||
"completed": "Completed",
|
||||
"needs_review": "Needs review",
|
||||
"pending": "Pending parse"
|
||||
},
|
||||
"stateLabel": {
|
||||
"parsed": "Parsed",
|
||||
"needs_review": "Needs review",
|
||||
"pending": "Pending parse",
|
||||
"active": "Active"
|
||||
},
|
||||
"nodeType": {
|
||||
"prepayment": "Prepayment",
|
||||
"shipment": "Shipment payment",
|
||||
"acceptance": "Acceptance payment",
|
||||
"warranty": "Warranty payment"
|
||||
},
|
||||
"ruleConfirmed": "Confirmed",
|
||||
"prepaymentRule": "Alerts at 7/14/21 days after contract archival; request status comes from OA vendor prepayment requests.",
|
||||
"shipmentRule": "Alerts 7 days before delivery, on the due date, and 14 days after; request status comes from OA vendor prepayment requests.",
|
||||
"acceptanceRule": "Alerts at 30/40/60 days after acceptance archival; warranty alerts are 7 days before, on, and 14 days after maturity.",
|
||||
"pendingAlerts": "Pending alerts",
|
||||
"processing": "Payment initiated",
|
||||
"dataPending": "Data pending",
|
||||
"paid": "Paid",
|
||||
"amountRatioDate": "Amount / ratio · date",
|
||||
"applicant": "Applicant",
|
||||
"statusLabel": "Status",
|
||||
"contractPrefix": "Contract",
|
||||
"datePending": "Date pending",
|
||||
"statusNormal": "Normal",
|
||||
"statusNeedsCompletion": "Needs completion",
|
||||
"statusOverdue": "Overdue",
|
||||
"statusUpcoming": "Due soon",
|
||||
"statusActive": "In progress",
|
||||
"statusCompleted": "Completed",
|
||||
"totalPrefix": "Total",
|
||||
"contractSupplier": "Contract / supplier",
|
||||
"nextAlert": "Next alert",
|
||||
"triggerBasis": "Trigger basis",
|
||||
"alertDate": "Alert date",
|
||||
"alertFirstRound": "Round 1",
|
||||
"payDate": "Payment date",
|
||||
"processStatus": "Status",
|
||||
"owner": "Procurement owner",
|
||||
"oaData": "OA data",
|
||||
"contractRule": "Contract rule",
|
||||
"ownerDefault": "Procurement owner",
|
||||
"workflowNo": "Workflow number",
|
||||
"contractNoPending": "Contract number pending attachment parsing",
|
||||
"synced": "Synced",
|
||||
"detailSubtitle": "OA data, payment nodes, and WeCom alert records",
|
||||
"backToOverview": "Back to overview",
|
||||
"contractInfo": "OA contract details",
|
||||
"alertHistory": "Alert history",
|
||||
"alertRound": "Alert round {round}",
|
||||
"alertAudit": "Alert delivery record",
|
||||
"alertAuditEmpty": "No alert records",
|
||||
"alertNode": "Payment stage",
|
||||
"alertScheduledAt": "Scheduled date",
|
||||
"alertSentAt": "Sent at",
|
||||
"alertStatus": {
|
||||
"pending": "Pending",
|
||||
"sent": "Sent",
|
||||
"failed": "Failed"
|
||||
},
|
||||
"roundValue": "Round {round}",
|
||||
"weeklyBatchesTitle": "Weekly Summary Batches",
|
||||
"weeklyBatchesSubtitle": "Review recipient-level payment-alert summaries, Excel attachments, and delivery records.",
|
||||
"weeklySend": "Send alerts",
|
||||
"weeklyBatchSubmitted": "Send alert job submitted",
|
||||
"weeklyBatchesLoadFailed": "Failed to load weekly summary batches",
|
||||
"batchNo": "Batch no.",
|
||||
"weekKey": "Week",
|
||||
"batchStatusLabel": "Delivery status",
|
||||
"batchTotal": "Summary count",
|
||||
"batchExcel": "Excel attachment",
|
||||
"batchSentAt": "Sent at",
|
||||
"weeklyBatchesEmpty": "No weekly summary batches",
|
||||
"weeklyPendingSummary": "{count} pending this week · next send {datetime}",
|
||||
"weeklyPendingCountOnly": "{count} pending this week",
|
||||
"downloadExcel": "Download Excel",
|
||||
"excelDownloadFailed": "Failed to download the alert attachment",
|
||||
"batchStatus": {
|
||||
"pending": "Pending",
|
||||
"sent": "Sent",
|
||||
"failed": "Failed",
|
||||
"processing": "Processing",
|
||||
"resolved": "Alerts stopped"
|
||||
},
|
||||
"backToLedger": "Back",
|
||||
"detailLoadFailed": "Failed to load contract details",
|
||||
"detailLoading": "Loading contract details…",
|
||||
"detailOverview": "Contract Overview",
|
||||
"detailAttachments": "Original Attachments",
|
||||
"detailPaymentPlan": "Payment Plan",
|
||||
"detailAlertHistory": "Alert History",
|
||||
"archiveDate": "Contract archive date",
|
||||
"archiveDateHint": "This date is when the contract application form was archived",
|
||||
"parseStatus": "Parsing status",
|
||||
"parseIssueTitle": "Parse issues",
|
||||
"planStatus": "Plan status",
|
||||
"attachmentsEmpty": "No archived original contract attachments",
|
||||
"downloadAttachment": "Download",
|
||||
"attachmentDownloadFailed": "Failed to download contract attachment",
|
||||
"paymentPlanEmpty": "No payment plan to display",
|
||||
"anchorDate": "Date basis",
|
||||
"nodeStatus": {
|
||||
"pending": "Pending",
|
||||
"active": "Active",
|
||||
"paid": "Paid",
|
||||
"processing": "Processing",
|
||||
"resolved": "Alerts stopped",
|
||||
"upcoming": "Due soon",
|
||||
"notStarted": "Not started",
|
||||
"overdue": "Overdue",
|
||||
"review": "Needs review"
|
||||
},
|
||||
"sessionHint": "Chat and history are hidden in this phase. Use the tabs above to open the ledger.",
|
||||
"moreActions": "More",
|
||||
"reparse": "Reparse contract original",
|
||||
"reparseSuccess": "Reparsed with attachment \"{attachment}\"",
|
||||
"reparseFailed": "Failed to reparse contract",
|
||||
"reviewTitle": "Contracts Pending Confirmation",
|
||||
"reviewSubtitle": "Contracts without matching title groups, failed payment-ratio validation, or key field conflicts will not enter payment alerts; download the original for review.",
|
||||
"reviewSearchPlaceholder": "Contract no., purchase order no., or supplier",
|
||||
"reviewLoadFailed": "Failed to load pending-confirmation contracts",
|
||||
"reviewContractWorkflow": "Contract No. / Workflow No.",
|
||||
"reviewReason": "Pending-confirmation reason",
|
||||
"reviewFallbackIssue": "Parse result requires manual confirmation",
|
||||
"reviewEmpty": "No contracts pending confirmation"
|
||||
},
|
||||
"contractPaymentReview": {
|
||||
"title": "Contracts for Confirmation",
|
||||
"subtitle": "Contracts that do not match the equipment procurement synonym title groups, fail payment-ratio validation, or conflict with OA fields are excluded from payment alerts. Download the original contract to verify it.",
|
||||
"searchPlaceholder": "Contract number, purchase order, or supplier",
|
||||
"loadFailed": "Failed to load contracts for confirmation",
|
||||
"contractWorkflow": "Contract / workflow number",
|
||||
"reason": "Reason for confirmation",
|
||||
"fallbackIssue": "Parsing result requires manual confirmation",
|
||||
"empty": "No contracts need confirmation"
|
||||
},
|
||||
"contractPaymentReparse": {
|
||||
"action": "Reparse contract original",
|
||||
"success": "Reparsed with attachment “{attachment}”",
|
||||
"failed": "Failed to reparse contract"
|
||||
},
|
||||
"title": "Contract Payment Alerts", "subtitle": "Sync OA contract, acceptance, and vendor prepayment requests; notify procurement roles through three escalation rounds.", "sessionHint": "Chat and history are hidden in this phase. Use the tabs above to open the ledger.", "sync": "Sync OA data", "moreActions": "More", "forceSync": "Force overwrite OA fields", "forceSyncConfirm": "This will overwrite existing OA data with non-empty fields returned this time and record an audit trail. Continue?", "reparseExisting": "Reparse existing contracts", "reparseExistingConfirm": "This will refresh all existing contract parsing results from archived attachments using the current rules. OA fields will not be synced or overwritten. Continue?", "scanAlerts": "Scan to generate alerts", "jobSubmitted": "Job submitted", "actionFailed": "Action failed", "loadFailed": "Failed to load contracts", "searchPlaceholder": "Search contract number, purchase order, supplier, or applicant", "allStatus": "All", "search": "Search", "ledger": "Contract ledger", "items": "items", "empty": "No contract data", "purchaseOrder": "Purchase order", "supplier": "Supplier", "amount": "Contract amount", "deliveryDate": "Delivery due date", "timeline": "Payment plan timeline", "notAvailable": "—", "stats": {"contracts": "Contracts", "pendingParse": "Pending contracts", "readyPlans": "Plans ready", "alerts": "Alert nodes"}, "ledgerFocus": {"due": "Due soon", "dueHint": "within 7 days", "overdue": "Overdue unpaid", "active": "Not yet due", "activeHint": "beyond 7 days", "dueThisMonth": "Due this month", "dueThisMonthHint": "this calendar month"}, "status": {"completed": "Completed", "needs_review": "Needs review", "pending": "Pending parse"}, "stateLabel": {"parsed": "Parsed", "needs_review": "Needs review", "pending": "Pending parse", "active": "Active"}, "nodeType": {"prepayment": "Prepayment", "shipment": "Shipment payment", "acceptance": "Acceptance payment", "warranty": "Warranty payment"}, "ruleConfirmed": "Confirmed", "prepaymentRule": "Alerts at 7/14/21 days after contract archival; request status comes from OA vendor prepayment requests.", "shipmentRule": "Alerts 7 days before delivery, on the due date, and 14 days after; request status comes from OA vendor prepayment requests.", "acceptanceRule": "Alerts at 30/40/60 days after acceptance archival; warranty alerts are 7 days before, on, and 14 days after maturity.", "pendingAlerts": "Pending alerts", "processing": "Payment initiated", "dataPending": "Data pending", "paid": "Paid", "stagePaid": "Paid", "amountRatioDate": "Amount / ratio · date", "applicant": "Applicant", "company": "Company", "erpSchema": "Payment ledger", "statusLabel": "Status", "contractPrefix": "Contract", "datePending": "Date pending", "statusNormal": "Normal", "statusNeedsCompletion": "Needs completion", "statusOverdue": "Overdue", "statusUpcoming": "Due soon", "statusActive": "Not yet due", "statusCompleted": "Completed", "totalPrefix": "Total", "contractSupplier": "Contract / supplier", "nextAlert": "Next alert", "triggerBasis": "Trigger basis", "alertDate": "Alert date", "alertRuleHint": "Each stage has three reminders on calendar days. Due items go out in the next Friday 18:00 digest. If the date is missing, no reminder is sent.\nPrepayment: day 7, 14, and 21 after contract archive (the page shows the first round)\nShipment payment: 7 days before the delivery date, on that date, and 14 days after\nAcceptance payment: day 30, 40, and 60 after the acceptance is archived\nWarranty payment: 7 days before warranty expiry, on that date, and 14 days after", "alertFirstRound": "Round 1", "payDate": "Payment date", "markPaid": "Mark as paid", "markPaidTitle": "Mark as paid", "markPaidHint": "{stage} · {amount} / {percent}%. Only this stage is updated. Unsent alerts are closed; sent records stay.", "markPaidDate": "Payment date", "markPaidRemark": "Note (optional)", "markPaidRemarkPlaceholder": "For example: finance confirmed payment, ERP number did not match", "markPaidConfirm": "Confirm paid", "markPaidSource": "Source: marked manually", "markPaidSuccess": "Marked as paid", "markPaidFailed": "Could not mark as paid", "processStatus": "Status", "owner": "Procurement owner", "oaData": "OA data", "contractRule": "Contract rule", "ownerDefault": "Procurement owner", "workflowNo": "Contract application workflow number", "contractNoPending": "Contract number pending attachment parsing", "synced": "Synced", "detailSubtitle": "OA data, payment nodes, and WeCom alert records", "backToOverview": "Back to overview", "contractInfo": "OA contract details", "alertHistory": "Alert history", "alertRound": "Alert round {round}", "alertAudit": "Alert delivery record", "alertAuditEmpty": "No alert records", "alertNode": "Payment stage", "alertScheduledAt": "Scheduled date", "alertSentAt": "Sent at", "alertStatus": {"pending": "Pending", "sent": "Sent", "failed": "Failed"}, "roundValue": "Round {round}", "weeklyBatchesTitle": "Weekly SummLine truncated
|
||||
, "syncConfirm": "This syncs OA contract and acceptance data and only fills empty ledger fields. Existing values stay as they are. Continue?", "weeklySendConfirm": "This sends this week's pending payment-alert digest to recipients. Continue?", "scanAlertsConfirm": "This scans the current payment plan and creates pending alerts. It does not send them yet. Continue?"},
|
||||
"contractPaymentReview": {"title": "Contracts for Confirmation", "subtitle": "Contracts that do not match the equipment procurement synonym title groups, fail payment-ratio validation, or conflict with OA fields are excluded from payment alerts. Download the original contract to verify it.", "searchPlaceholder": "Contract number, purchase order, supplier, or applicant", "loadFailed": "Failed to load contracts for confirmation", "contractWorkflow": "Contract / application workflow number", "reason": "Reason for confirmation", "fallbackIssue": "Parsing result requires manual confirmation", "empty": "No contracts need confirmation", "manualTitle": "Review payment stages", "manualSubtitle": "{supplier} · PO {purchaseOrder}. Recognized stages are filled in and can be edited.", "backToReview": "Back to pending", "confirmLedger": "Add to ledger", "confirmSuccess": "Added to the contract ledger", "issueTitle": "Parse notes", "contractNoOptional": "Contract number (optional)", "contractNoPlaceholder": "Not found in the attachment", "percentage": "Percent %", "stageAmount": "Amount", "basisDate": "Date basis", "noStage": "No such stage", "ruleIdentity": "Purchase order and contract amount are valid", "rulePercent": "Enabled percentages total 100%. A blank percentage is not zero", "ruleAmount": "Each enabled amount equals the contract amount times its percentage", "ruleDate": "Prepayment and shipment payment need a date basis", "hintPrepayment": "Date basis is the contract archive date. Enter the deposit or prepayment percentage from the contract.", "hintShipment": "Date basis is the delivery date. If the contract only says “N days after the deposit”, enter a calendar date.", "hintAcceptance": "Date basis is the acceptance archive date. Leave it empty if acceptance is not archived yet.", "hintWarranty": "Check “No such stage” when there is no warranty payment share. A warranty period is not a percentage.", "formLoadFailed": "Failed to load the review form", "submitFailed": "Failed to submit the review", "manualAction": "Manual review", "fillHintTitle": "How to fill in"},
|
||||
"contractPaymentReparse": {"action": "Reparse contract original", "success": "Reparsed with attachment “{attachment}”", "failed": "Failed to reparse contract"},
|
||||
"contractPaymentReview": {"title": "Contracts for Confirmation", "subtitle": "Contracts that do not match the equipment procurement synonym title groups, fail payment-ratio validation, or conflict with OA fields are excluded from payment alerts. Download the original contract to verify it.", "searchPlaceholder": "Contract number, purchase order, supplier, or applicant", "loadFailed": "Failed to load contracts for confirmation", "contractWorkflow": "Contract / application workflow number", "reason": "Reason for confirmation", "fallbackIssue": "Parsing result requires manual confirmation", "empty": "No contracts need confirmation", "manualTitle": "Review payment stages", "manualSubtitle": "{supplier} · PO {purchaseOrder}. Recognized stages are filled in and can be edited.", "backToReview": "Back to pending", "confirmLedger": "Add to ledger", "confirmSuccess": "Added to the contract ledger", "issueTitle": "Parse notes", "contractNoOptional": "Contract number (optional)", "contractNoPlaceholder": "Not found in the attachment", "percentage": "Percent %", "stageAmount": "Amount", "basisDate": "Date basis", "noStage": "No such stage", "ruleIdentity": "Purchase order and contract amount are valid", "rulePercent": "Enabled percentages total 100%. A blank percentage is not zero", "ruleAmount": "Each enabled amount equals the contract amount times its percentage", "ruleDate": "Prepayment and shipment payment need a date basis", "hintPrepayment": "Date basis is the contract archive date. Enter the deposit or prepayment percentage from the contract.", "hintShipment": "Date basis is the delivery date. If the contract only says “N days after the deposit”, enter a calendar date.", "hintAcceptance": "Date basis is the acceptance archive date. Leave it empty if acceptance is not archived yet.", "hintWarranty": "Check “No such stage” when there is no warranty payment share. A warranty period is not a percentage.", "formLoadFailed": "Failed to load the review form", "submitFailed": "Failed to submit the review", "manualAction": "Manual review", "fillHintTitle": "How to fill in"},
|
||||
"procurementContract": {
|
||||
"title": "Procurement Contract Review",
|
||||
"subtitle": "Manage templates, risk red-line rules, and review history",
|
||||
@@ -5564,7 +5384,8 @@
|
||||
"interface": "Interface Definitions",
|
||||
"binding": "Bindings",
|
||||
"credential": "Credential References",
|
||||
"capability": "Capabilities"
|
||||
"capability": "Capabilities",
|
||||
"calls": "Call logs"
|
||||
},
|
||||
"statusLabels": {
|
||||
"draft": "Draft",
|
||||
@@ -5615,7 +5436,7 @@
|
||||
"environment": "Environment",
|
||||
"status": "Status",
|
||||
"clientInstance": "Client Instance",
|
||||
"interfaceDef": "Interface",
|
||||
"interfaceDef": "Interface Steps (ordered)",
|
||||
"secretRef": "Secret Reference",
|
||||
"secretProvider": "Source",
|
||||
"account": "Account",
|
||||
@@ -5630,6 +5451,7 @@
|
||||
"code": "Code",
|
||||
"name": "Name",
|
||||
"connectorType": "Connector Type",
|
||||
"dbKind": "Database kind (db_kind)",
|
||||
"environment": "Environment",
|
||||
"credentialRef": "Credential Reference Code",
|
||||
"configJson": "Connection Config JSON (endpoint / timeout / default org, etc.)",
|
||||
@@ -5651,9 +5473,6 @@
|
||||
"effectiveTo": "Effective To",
|
||||
"contextSelector": "Advanced Routing Conditions JSON",
|
||||
"contextSelectorHint": "All key-value pairs must be contained in the call context to match; callers currently send no routing context, so leave it empty for the default binding.",
|
||||
"paramMapping": "Parameter Mapping JSON",
|
||||
"paramMappingHint": "Translation rules from domain params to interface params (e.g. erp_org to organization, condition template); leave empty for same-name passthrough.",
|
||||
"bindingClientHint": "Derived and locked from the selected interface definition; not editable separately.",
|
||||
"secretRef": "Secret Reference Key",
|
||||
"secretProvider": "Secret Source",
|
||||
"credentialType": "Credential Type",
|
||||
@@ -5681,7 +5500,8 @@
|
||||
"msg": {
|
||||
"fillClient": "Please fill in the name",
|
||||
"fillInterface": "Please select a client instance (the code can be auto-generated)",
|
||||
"fillBinding": "Please fill in the capability, client instance and interface definition",
|
||||
"fillBinding": "Please fill in the capability and add at least one step (choose an interface per step)",
|
||||
"fillDbKind": "Please choose a database kind (MySQL / Oracle / SQL Server / PostgreSQL)",
|
||||
"fillCredential": "Please fill in the code and the secret reference",
|
||||
"fillCredentialDb": "Please fill in the code and the required credential fields: {fields}",
|
||||
"credentialTypeMissing": "Credential type list not loaded, please refresh and retry",
|
||||
@@ -5716,7 +5536,8 @@
|
||||
"endpoint": "https://erp-api.example.com/ws",
|
||||
"wsdl": "https://erp-api.example.com/wsdl",
|
||||
"requestPath": "Path supports placeholders, e.g. /transfer/xxx",
|
||||
"passwordKeep": "Leave blank to keep the current password"
|
||||
"passwordKeep": "Leave blank to keep the current password",
|
||||
"database": "erp-host:1521/ORCL or 127.0.0.1:3306/dbname"
|
||||
},
|
||||
"advancedConfig": "Advanced Config (JSON)",
|
||||
"formatJson": "Format",
|
||||
@@ -5737,7 +5558,70 @@
|
||||
},
|
||||
"connectorTypes": {
|
||||
"rest": "REST API",
|
||||
"soap": "SOAP Service"
|
||||
"soap": "SOAP Service",
|
||||
"database": "Database (Direct)"
|
||||
},
|
||||
"connectorDbKind": {
|
||||
"mysql": "MySQL",
|
||||
"oracle": "Oracle",
|
||||
"sqlserver": "SQL Server",
|
||||
"postgresql": "PostgreSQL"
|
||||
},
|
||||
"endpointLabel": {
|
||||
"database": "Database connection string (host:port/service or /database)"
|
||||
},
|
||||
"bindingSteps": {
|
||||
"label": "Execution Steps (ordered)",
|
||||
"add": "Add Step",
|
||||
"remove": "Remove Step",
|
||||
"moveUp": "Move Up",
|
||||
"moveDown": "Move Down",
|
||||
"interface": "Interface Definition",
|
||||
"paramMapping": "Step {index} Parameter Mapping JSON",
|
||||
"clientHint": "Client instance is derived from this step's interface: {client}",
|
||||
"hint": "Steps run in array order; each step has its own parameter mapping, and the client instance comes with each step's interface."
|
||||
},
|
||||
"callLogs": {
|
||||
"title": "Call records",
|
||||
"filterInterface": "Interface",
|
||||
"filterClient": "Client code",
|
||||
"filterConnector": "Connector type",
|
||||
"filterStatus": "Status",
|
||||
"filterOperationId": "Operation ID",
|
||||
"filterTraceId": "Trace ID",
|
||||
"filterBusinessRef": "Business ref",
|
||||
"filterKeyword": "Keyword in request",
|
||||
"dateFrom": "Time from",
|
||||
"dateTo": "Time to",
|
||||
"query": "Query",
|
||||
"reset": "Reset",
|
||||
"colTime": "Time",
|
||||
"colCapability": "Capability",
|
||||
"colInterface": "Interface",
|
||||
"colRef": "Ref",
|
||||
"colStep": "Step",
|
||||
"colStatus": "Status",
|
||||
"colElapsed": "Elapsed",
|
||||
"detailTitle": "Call detail",
|
||||
"timeline": "Step timeline",
|
||||
"request": "Request",
|
||||
"response": "Response",
|
||||
"wire": "Wire-level request",
|
||||
"rawPayload": "Raw payload",
|
||||
"normalized": "Business params (normalized)",
|
||||
"normalizedJson": "Normalized JSON",
|
||||
"copyBody": "Copy body",
|
||||
"copyCurl": "Copy curl",
|
||||
"copySql": "Copy SQL",
|
||||
"copyRaw": "Copy raw payload",
|
||||
"copyJson": "Copy JSON",
|
||||
"copyOperationId": "Copy operation_id",
|
||||
"copyTraceId": "Copy trace_id",
|
||||
"copied": "Copied",
|
||||
"noWire": "No wire details (historical record)",
|
||||
"sqlWriteWarning": "⚠ Write statements: confirm target environment before executing",
|
||||
"prevPage": "Previous page",
|
||||
"nextPage": "Next page"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3778,19 +3778,21 @@
|
||||
"stageFileReady": "File ready",
|
||||
"stageWaitingRpa": "RPA fetching",
|
||||
"stageFailed": "Failed",
|
||||
"precheckTitle": "Transfer precheck",
|
||||
"matchTitle": "Transferable stock list",
|
||||
"businessDate": "Business date",
|
||||
"executableCount": "Executable",
|
||||
"notMaturedCount": "Same-day receipt",
|
||||
"blockedCount": "Blocked",
|
||||
"estimatedQuantity": "Est. transfer qty",
|
||||
"estimatedExternalWrites": "Est. ERP documents",
|
||||
"pendingStockCheckCount": "Pending stock check",
|
||||
"invalidRowCount": "{count} invalid rows",
|
||||
"reasonQuantityMismatch": "ERP book stock quantity does not match the received quantity",
|
||||
"reasonInventoryNotFound": "No ERP stock record for this lot; stock is shown as 0",
|
||||
"reasonExternalQueryFailed": "External system query failed",
|
||||
"reasonFutureDate": "Receipt date is after the business date",
|
||||
"selectedCount": "{count} selected",
|
||||
"generateTransfer": "Generate transfer order",
|
||||
"generateTransfer": "Generate transfer orders",
|
||||
"colSource": "Source",
|
||||
"colMaterial": "Material",
|
||||
"colName": "Name",
|
||||
@@ -3799,14 +3801,15 @@
|
||||
"colReceiptDate": "Receipt Date",
|
||||
"colFromWarehouse": "From warehouse",
|
||||
"colFromQty": "Stock qty",
|
||||
"stockCheckedAtTitle": "Stock checked at {time}",
|
||||
"colToWarehouse": "To warehouse",
|
||||
"colFromBatch": "Outbound Batch",
|
||||
"filterPlaceholder": "Filter by material / name / Invoice / batch",
|
||||
"filterAll": "All results",
|
||||
"requerySelected": "Requery selected ERP stock",
|
||||
"requerySelected": "Requery selected",
|
||||
"receiptDateLabel": "Receipt date",
|
||||
"receiptDateTo": "Receipt date to",
|
||||
"receiptDateHint": "End cannot exceed the D+1 rule (day before business date)",
|
||||
"receiptDateTo": "Receipt date end",
|
||||
"receiptDateHint": "Defaults to the D+1 rule date (day before business date, the matching cutoff); end cannot exceed it and start cannot be after end",
|
||||
"requeryRow": "Requery",
|
||||
"colToQty": "To qty",
|
||||
"colResult": "Result",
|
||||
@@ -3814,6 +3817,11 @@
|
||||
"resultNotMatured": "Same-day receipt",
|
||||
"resultBlocked": "Blocked",
|
||||
"resultUnknown": "Result unknown",
|
||||
"resultFileRemoved": "Removed from file",
|
||||
"resultPendingStockCheck": "Pending stock check",
|
||||
"staleRow": "Stale — requery",
|
||||
"fileChangedRow": "File updated; data will realign",
|
||||
"fileRemovedQuarantined": "{count} more rows were invalidated (removed from the receipt file) and are hidden from this list; handle them under Pending Exceptions (mark as no further action).",
|
||||
"runProgress": "Transfer run progress",
|
||||
"runExecuting": "Executing",
|
||||
"runSuccess": "Completed",
|
||||
@@ -3828,12 +3836,22 @@
|
||||
"exceptionsTitle": "No ERP document generated",
|
||||
"exceptionBusinessFailed": "Business failed",
|
||||
"exceptionTechnicalFailed": "Technical failed",
|
||||
"exceptionPrecheckExpired": "Precheck expired",
|
||||
"exceptionMatchExpired": "Matching expired",
|
||||
"downloadReceiptFiles": "Download receipt files",
|
||||
"downloadErpInventory": "Download ERP inventory",
|
||||
"downloadExceptions": "Download exceptions Excel",
|
||||
"backlogTitle": "Backlog exceptions",
|
||||
"retryErp": "Re-query ERP",
|
||||
"resumeAction": "Resume",
|
||||
"colAging": "Aging",
|
||||
"colAction": "Actions",
|
||||
"selectedRows": "{count} selected",
|
||||
"clearSelection": "Clear selection",
|
||||
"receiptDateInvalid": "Start date cannot be after end date",
|
||||
"toastRequeryDone": "Requery done: {ok} rows updated, {failed} failed",
|
||||
"toastRequeryRecovered": "Resume done: {recovered} executable · {blocked} still blocked",
|
||||
"toastExecuteFileChanged": "{count} rows with file updated — re-match",
|
||||
"toastCloseDone": "Closed: {ok} succeeded, {failed} failed",
|
||||
"batchCloseTitle": "Mark as no further action ({count} items)",
|
||||
"manualClose": "Mark as no further action",
|
||||
"manualCloseTitle": "Mark as no further action",
|
||||
"manualCloseHint": "Auto schedule will skip it; history and audit are kept permanently.",
|
||||
@@ -3856,20 +3874,20 @@
|
||||
"hub_to_hub": "HUB to HUB"
|
||||
},
|
||||
"transferTypeComingSoon": "Coming soon",
|
||||
"precheckParams": "Precheck parameters",
|
||||
"matchParams": "Matching parameters",
|
||||
"selectAll": "Select all in group",
|
||||
"selectEnabledAll": "Select all enabled",
|
||||
"clearSources": "Clear selection",
|
||||
"selectedSourceCount": "Selected {count} source instances",
|
||||
"needSelectSource": "Select at least one enabled source instance",
|
||||
"confirmScopeAndPrecheck": "Confirm scope & precheck",
|
||||
"confirmScopeAndMatch": "Confirm scope & match",
|
||||
"homeWelcome": "Hello, you are in",
|
||||
"homeTodayLabel": "Today's tasks",
|
||||
"homeTodayAction": "Start today's transfer precheck",
|
||||
"homeTodayAction": "Match transferable stock",
|
||||
"homeTodayHint": "After selecting source instances, the system uses yesterday as the business date by default.",
|
||||
"homeHistoryLabel": "Pending tasks",
|
||||
"homeRecoverable": "Recoverable exceptions",
|
||||
"homeRecoverableHint": "Re-query ERP stock before continuing",
|
||||
"homeRecoverable": "Pending recovery",
|
||||
"homeRecoverableHint": "Requery stock or resume in one click",
|
||||
"homeClosed": "Manually closed",
|
||||
"homeClosedHint": "View reason and restore processing",
|
||||
"homeUnknown": "Unknown result",
|
||||
@@ -3889,6 +3907,91 @@
|
||||
"batchRetry": "Batch retry RPA",
|
||||
"downloadFiles": "Download receipt files",
|
||||
"selectedRetryableCount": "{count} retryable",
|
||||
"noRetryable": "No selected source needs retry (already ready or fetching)"
|
||||
"noRetryable": "No selected source needs retry (already ready or fetching)",
|
||||
"homeMatchLabel": "Stock matching",
|
||||
"homeBoardLabel": "To-do board",
|
||||
"homeExecutable": "Executable items",
|
||||
"homeExecutableHint": "Select rows and generate transfer orders",
|
||||
"executableTitle": "Executable items",
|
||||
"executableEmpty": "No executable items",
|
||||
"executableSelectedCount": "{count} executable rows selected",
|
||||
"runTitle": "Generate transfer orders",
|
||||
"runBadge": {
|
||||
"queued": "Queued",
|
||||
"executing": "Executing",
|
||||
"success": "Success",
|
||||
"partialFailed": "Partially failed",
|
||||
"failed": "Failed"
|
||||
},
|
||||
"orderStatus": {
|
||||
"pending": "Pending",
|
||||
"executing": "Executing",
|
||||
"success": "Success",
|
||||
"resultUnknown": "Result unknown",
|
||||
"failed": "Failed",
|
||||
"cancelled": "Closed"
|
||||
},
|
||||
"orderAction": {
|
||||
"retrigger": "Retrigger",
|
||||
"retry": "Retry",
|
||||
"retryAccepted": "Order {docNo} has been resubmitted; progress will refresh automatically.",
|
||||
"retryPartial": "Recheck finished: {ready} line(s) executable, {blocked} still blocked and kept in the recovery pool.",
|
||||
"closeOrder": "Close order"
|
||||
},
|
||||
"orderReasonPrefix": "Reason: {reason}",
|
||||
"poll": {
|
||||
"connecting": "Connecting…"
|
||||
},
|
||||
"execute": {
|
||||
"accepted": "Submitted. Execution is queued; progress will update below.",
|
||||
"noSelection": "Select at least one executable row"
|
||||
},
|
||||
"retriggerDialog": {
|
||||
"title": "Retrigger {docNo}",
|
||||
"body": "Reuses this order's original document no. and submit timestamp and retriggers only the final step (idempotent and safe; no duplicate document will be created).",
|
||||
"confirm": "Confirm retrigger",
|
||||
"dismiss": "Back"
|
||||
},
|
||||
"orderClose": {
|
||||
"title": "Close order {docNo}",
|
||||
"impactHint": "The {count} line(s) of this order will be detached and returned to the pending pool (they can be re-selected into a new order):",
|
||||
"redline": "Closing an order does not mean no ERP document exists: manually confirm in ERP before closing.",
|
||||
"reasonPlaceholder": "Reason (required)",
|
||||
"confirm": "Confirm close",
|
||||
"dismiss": "Back"
|
||||
},
|
||||
"toastOrderClosed": "Order closed; its rows returned to the pending pool",
|
||||
"toastRetriggerAccepted": "Retriggered; the final step is queued",
|
||||
"homeExecuted": {
|
||||
"title": "Executed transfer orders",
|
||||
"refresh": "Refresh",
|
||||
"empty": "No executed orders yet",
|
||||
"pageInfo": "{total} orders · page {page}",
|
||||
"back": "Back",
|
||||
"all": "All",
|
||||
"groupHint": {
|
||||
"success": "ERP number written back, view details",
|
||||
"failed": "Recheck stock or close the order",
|
||||
"executing": "Writing stage table / triggering ERP",
|
||||
"resultUnknown": "Read-only, verify with ERP offline"
|
||||
},
|
||||
"dateFrom": "Date from",
|
||||
"dateTo": "Date to",
|
||||
"group": {
|
||||
"success": "Success",
|
||||
"failed": "Failed",
|
||||
"executing": "Executing",
|
||||
"resultUnknown": "Unknown result"
|
||||
},
|
||||
"closeDialog": {
|
||||
"title": "Close order {docNo}",
|
||||
"reasonRequired": "Close reason (required)",
|
||||
"redlineWhole": "Closing voids the whole order (including unposted rows) and cannot be undone.",
|
||||
"redlineResidue": "Rows already written to ERP are not deleted automatically; verify residuals manually per the SOP.",
|
||||
"redlineReopen": "All rows will leave this order and return to the ready-to-execute pool for re-grouping.",
|
||||
"redlineErpCheck": "Closing an order does not mean no ERP document exists: confirm in ERP that no matching document exists before closing.",
|
||||
"confirm": "Confirm close"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,6 +150,7 @@
|
||||
"CHAT.USER_ATTACHMENTS_LIMIT_EXCEEDED": "Too many attachments (maximum 200). Remove some and try again.",
|
||||
"CONTRACT_PAYMENT_FORBIDDEN": "You do not have access to contract payment alerts.",
|
||||
"CONTRACT_PAYMENT_ADMIN_REQUIRED": "Only administrators can sync, scan, or send contract payment alerts.",
|
||||
"CONTRACT_PAYMENT_ATTACHMENT_UNAVAILABLE": "The contract file was removed and could not be downloaded again from the source system. Sync OA data and try again.",
|
||||
"VOUCHER_CHECK_FORBIDDEN": "You do not have access to accounting voucher check.",
|
||||
"VOUCHER_CHECK_ADMIN_REQUIRED": "Only administrators can force a voucher recheck or change missing-file notification recipients.",
|
||||
"SHIPPING_TASK_SELECTION_INVALID": "Select between 1 and 100 shipping tasks.",
|
||||
@@ -559,8 +560,8 @@
|
||||
"TRANSFER_INVOICE_CONFLICT": "Invoice conflict (multiple materials or dates).",
|
||||
"TRANSFER_QUANTITY_MISMATCH": "Receipt quantity does not equal ERP inventory; blocked.",
|
||||
"TRANSFER_ERP_INVENTORY_NOT_FOUND": "ERP inventory not found for this invoice.",
|
||||
"TRANSFER_PRECHECK_EXPIRED": "Precheck expired or snapshot changed; re-run precheck.",
|
||||
"TRANSFER_CONFIRMATION_REQUIRED": "Precheck is not ready for execution.",
|
||||
"TRANSFER_MATCH_EXPIRED": "Matching expired or snapshot changed; re-run matching.",
|
||||
"TRANSFER_CONFIRMATION_REQUIRED": "Matching is not ready for execution.",
|
||||
"TRANSFER_DUPLICATE_NOT_VERIFIED": "Duplicate invoice cannot be verified as posted.",
|
||||
"TRANSFER_RESULT_UNKNOWN": "ERP result unknown; read-only, verify per SOP.",
|
||||
"TRANSFER_MANUAL_CLOSE_REASON_REQUIRED": "Manual close requires a reason.",
|
||||
@@ -570,8 +571,19 @@
|
||||
"TRANSFER.ROUTE_NOT_RESOLVED": "Route mapping is not configured for this source.",
|
||||
"TRANSFER.EXTERNAL_NOT_FROZEN": "External system contract is not frozen; call forbidden.",
|
||||
"TRANSFER.EXTERNAL_QUERY_TIMEOUT": "External system query timed out; retry.",
|
||||
"TRANSFER.PRECHECK_ALREADY_EXECUTED": "This precheck was already executed.",
|
||||
"TRANSFER.SELECTION_INVALID": "Selection contains non-executable invoices.",
|
||||
"TRANSFER.INVALID_STATE_TRANSITION": "Invalid state transition."
|
||||
"TRANSFER.INVALID_STATE_TRANSITION": "Invalid state transition.",
|
||||
"TRANSFER.BATCH_ITEMS_REQUIRED": "Item ids are required.",
|
||||
"TRANSFER.EXECUTE_ITEMS_INVALID": "Some rows do not exist or are not executable; refresh and retry.",
|
||||
"TRANSFER.ITEMS_STALE": "Some rows were evaluated too long ago; re-run the matching.",
|
||||
"TRANSFER.FILE_CHANGED": "The receipt file has changed; re-run the matching before executing.",
|
||||
"TRANSFER.ORG_REQUIRED": "External organization code is required.",
|
||||
"TRANSFER.RETRIGGER_NOT_ALLOWED": "Only result_unknown tickets can be retriggered; closing and recreating is forbidden.",
|
||||
"TRANSFER.RETRY_NOT_ALLOWED": "This row was removed along with the file and cannot be requeried; mark it as no further action or wait for the file to re-sync.",
|
||||
"TRANSFER.DOCUMENT_CLOSE_NOT_ALLOWED": "Only failed tickets (business/technical) can be closed; use \"Retrigger\" for result_unknown tickets, in-flight tickets cannot be closed.",
|
||||
"TRANSFER.DOCUMENT_NOT_FOUND": "Transfer ticket not found.",
|
||||
"INTEGRATION.BINDING_LEGACY_PUT_REJECTED": "Legacy single-step fields would truncate this binding's multi-step recipe; submit ordered steps via steps_json instead.",
|
||||
"INTEGRATION.CALL_NOT_FOUND": "Integration call not found.",
|
||||
"INTEGRATION.BINDING_STEPS_INVALID": "Binding steps invalid: steps_json is required, must be a non-empty array of objects."
|
||||
}
|
||||
}
|
||||
@@ -702,7 +702,7 @@
|
||||
"movementStandardField": "ฟิลด์มาตรฐานการเคลื่อนไหว",
|
||||
"movementBindingLabel": "กฎการแยกวิเคราะห์การเคลื่อนไหว",
|
||||
"movementBindingNone": "ยังไม่ผูก",
|
||||
"movementBindingHint": "เมื่อผูกกฎที่เผยแพร่แล้ว การตรวจก่อนจะใช้ไฟล์ที่เก็บถาวรซ้ำ หากไม่ผูก การตรวจก่อนจะไม่เรียกดึงข้อมูล (fail-closed)",
|
||||
"movementBindingHint": "เมื่อผูกกฎที่เผยแพร่แล้ว การจับคู่จะใช้ไฟล์ที่เก็บถาวรซ้ำ หากไม่ผูก การจับคู่จะไม่เรียกดึงข้อมูล (fail-closed)",
|
||||
"movementFields": {
|
||||
"doc_no": "เลขที่เอกสาร", "line_no": "ลำดับรายการ", "in_out_flag": "เข้า/ออก", "material_code": "รหัสวัสดุ",
|
||||
"material_name": "ชื่อวัสดุ", "warehouse_code": "คลังสินค้า", "storage_code": "ตำแหน่งจัดเก็บ", "lot_no": "เลขล็อต",
|
||||
@@ -2476,7 +2476,7 @@
|
||||
"platformJobAccountingVoucherPoPrint": "สร้างใบสั่งซื้อ PO สำหรับเอกสารบัญชี",
|
||||
"accountingVoucherPoPrintHint": "ทุกวันอังคาร 05:00 ดึงใบแจ้งหนี้เดือนก่อนจาก ERP สร้าง PDF ใบสั่งซื้อมาตรฐาน แล้วอัปโหลดไปยังโฟลเดอร์ PO — ก่อนงานตรวจ 06:00 ข้ามชื่อซ้ำ",
|
||||
"platformJobAccountingVoucherOaSalesRelease": "ดึงใบอนุญาตปล่อยสินค้าสำหรับเอกสารบัญชี",
|
||||
"accountingVoucherOaSalesReleaseHint": "ทุกวันอังคาร 05:30 ค้นฟอร์มปล่อยสินค้าที่เก็บแล้วของเดือนก่อนจาก E10 ดาวน์โหลด PDF แล้วอัปโหลดไปยังโฟลเดอร์ใบส่งสินค้า — ก่อนงานตรวจ 06:00 ข้ามชื่อซ้ำ",
|
||||
"accountingVoucherOaSalesReleaseHint": "ทุกวันอังคาร 05:30 ค้นฟอร์มปล่อยสินค้าที่เก็บแล้วของเดือนก่อนจาก E10 ดาวน์โหลด PDF แล้วอัปโหลดไปยังโฟลเดอร์คำขอปล่อยสินค้า — ก่อนงานตรวจ 06:00 ข้ามชื่อซ้ำ",
|
||||
"voucherCheckScope": "ชุดบัญชี",
|
||||
"voucherCheckProfile": "โปรไฟล์ฝ่ายธุรกิจ",
|
||||
"voucherCheckNotifyMissing": "แจ้งเตือนเมื่อขาดเอกสาร",
|
||||
@@ -5019,191 +5019,11 @@
|
||||
}
|
||||
},
|
||||
"contractPayment": {
|
||||
"title": "แจ้งเตือนการชำระเงินตามสัญญา",
|
||||
"subtitle": "ซิงก์สัญญา OA การรับมอบ และคำขอเบิกเงินล่วงหน้าของผู้ขาย พร้อมแจ้งเตือน 3 ระดับ",
|
||||
"sync": "ซิงก์ข้อมูล OA",
|
||||
"forceSync": "เขียนทับฟิลด์ OA แบบบังคับ",
|
||||
"forceSyncConfirm": "ระบบจะเขียนทับข้อมูล OA เดิมด้วยฟิลด์ที่ไม่ว่างจาก OA ครั้งนี้และบันทึกการตรวจสอบ ต้องการดำเนินการต่อหรือไม่?",
|
||||
"reparseExisting": "แยกวิเคราะห์สัญญาเดิมทั้งหมดใหม่",
|
||||
"reparseExistingConfirm": "ระบบจะรีเฟรชผลการแยกข้อมูลของสัญญาเดิมทั้งหมดจากไฟล์แนบที่จัดเก็บตามกฎปัจจุบัน โดยจะไม่ซิงก์หรือเขียนทับฟิลด์ OA ต้องการดำเนินการต่อหรือไม่?",
|
||||
"scanAlerts": "สแกนเพื่อสร้างแจ้งเตือน",
|
||||
"jobSubmitted": "ส่งงานแล้ว",
|
||||
"actionFailed": "ดำเนินการไม่สำเร็จ",
|
||||
"loadFailed": "โหลดสัญญาไม่สำเร็จ",
|
||||
"searchPlaceholder": "ค้นหาเลขที่สัญญา ใบสั่งซื้อ ผู้ขาย หรือผู้ขอ",
|
||||
"allStatus": "ทั้งหมด",
|
||||
"search": "ค้นหา",
|
||||
"ledger": "ทะเบียนสัญญา",
|
||||
"items": "รายการ",
|
||||
"empty": "ไม่มีข้อมูลสัญญา",
|
||||
"purchaseOrder": "ใบสั่งซื้อ",
|
||||
"supplier": "ผู้ขาย",
|
||||
"amount": "มูลค่าสัญญา",
|
||||
"deliveryDate": "กำหนดส่งมอบ",
|
||||
"timeline": "ไทม์ไลน์แผนการชำระเงิน",
|
||||
"notAvailable": "—",
|
||||
"stats": {
|
||||
"contracts": "สัญญา",
|
||||
"pendingParse": "สัญญาที่รอดำเนินการ",
|
||||
"readyPlans": "แผนพร้อมใช้",
|
||||
"alerts": "จุดแจ้งเตือน"
|
||||
},
|
||||
"ledgerFocus": {
|
||||
"due": "ใกล้ครบกำหนด",
|
||||
"dueHint": "ใน 7 วัน",
|
||||
"overdue": "ค้างชำระเกินกำหนด",
|
||||
"needsCompletion": "รอข้อมูลเพิ่ม",
|
||||
"dueThisMonth": "ถึงกำหนดเดือนนี้",
|
||||
"dueThisMonthHint": "เดือนปฏิทินนี้",
|
||||
"active": "กำลังดำเนินการ"
|
||||
},
|
||||
"status": {
|
||||
"completed": "เสร็จสิ้น",
|
||||
"needs_review": "ต้องตรวจสอบ",
|
||||
"pending": "รอแยกข้อมูล"
|
||||
},
|
||||
"stateLabel": {
|
||||
"parsed": "แยกข้อมูลแล้ว",
|
||||
"needs_review": "ต้องตรวจสอบ",
|
||||
"pending": "รอแยกข้อมูล",
|
||||
"active": "ใช้งานอยู่"
|
||||
},
|
||||
"nodeType": {
|
||||
"prepayment": "เงินล่วงหน้า",
|
||||
"shipment": "เงินก่อนส่ง",
|
||||
"acceptance": "เงินรับมอบ",
|
||||
"warranty": "เงินประกัน"
|
||||
},
|
||||
"ruleConfirmed": "ยืนยันแล้ว",
|
||||
"prepaymentRule": "แจ้งเตือนวันที่ 7/14/21 หลังจัดเก็บสัญญา; สถานะคำขออ้างอิง OA.",
|
||||
"shipmentRule": "แจ้งเตือนก่อนกำหนดส่ง 7 วัน วันครบกำหนด และหลังครบกำหนด 14 วัน; สถานะคำขออ้างอิง OA.",
|
||||
"acceptanceRule": "แจ้งเตือนวันที่ 30/40/60 หลังจัดเก็บใบรับมอบ; เงินประกันแจ้งก่อนครบกำหนด 7 วัน วันครบกำหนด และหลังครบกำหนด 14 วัน.",
|
||||
"pendingAlerts": "แจ้งเตือนที่รอดำเนินการ",
|
||||
"processing": "เริ่มชำระแล้ว",
|
||||
"dataPending": "รอข้อมูล",
|
||||
"paid": "ชำระแล้ว",
|
||||
"amountRatioDate": "จำนวนเงิน / สัดส่วน · วันที่",
|
||||
"applicant": "ผู้ขอ",
|
||||
"statusLabel": "สถานะ",
|
||||
"contractPrefix": "สัญญา",
|
||||
"datePending": "รอระบุวันที่",
|
||||
"statusNormal": "ปกติ",
|
||||
"statusNeedsCompletion": "ต้องเติมข้อมูล",
|
||||
"statusOverdue": "เกินกำหนดชำระ",
|
||||
"statusUpcoming": "ใกล้ถึงกำหนด",
|
||||
"statusActive": "กำลังดำเนินการ",
|
||||
"statusCompleted": "เสร็จสิ้น",
|
||||
"totalPrefix": "รวม",
|
||||
"contractSupplier": "สัญญา / ผู้ขาย",
|
||||
"nextAlert": "แจ้งเตือนถัดไป",
|
||||
"triggerBasis": "เกณฑ์เริ่ม",
|
||||
"alertDate": "วันที่แจ้งเตือน",
|
||||
"alertFirstRound": "รอบ 1",
|
||||
"payDate": "วันที่ชำระเงิน",
|
||||
"processStatus": "สถานะ",
|
||||
"owner": "ผู้รับผิดชอบจัดซื้อ",
|
||||
"oaData": "ข้อมูล OA",
|
||||
"contractRule": "กฎสัญญา",
|
||||
"ownerDefault": "ผู้รับผิดชอบจัดซื้อ",
|
||||
"workflowNo": "เลขที่เวิร์กโฟลว์",
|
||||
"contractNoPending": "รอแยกเลขที่สัญญาจากไฟล์แนบ",
|
||||
"synced": "ซิงก์แล้ว",
|
||||
"detailSubtitle": "ข้อมูล OA จุดชำระเงิน และประวัติแจ้งเตือน WeCom",
|
||||
"backToOverview": "กลับภาพรวม",
|
||||
"contractInfo": "ข้อมูลสัญญา OA",
|
||||
"alertHistory": "ประวัติแจ้งเตือน",
|
||||
"alertRound": "รอบแจ้งเตือน {round}",
|
||||
"alertAudit": "บันทึกการส่งแจ้งเตือน",
|
||||
"alertAuditEmpty": "ยังไม่มีบันทึกการแจ้งเตือน",
|
||||
"alertNode": "ขั้นตอนการชำระเงิน",
|
||||
"alertScheduledAt": "วันที่กำหนดส่ง",
|
||||
"alertSentAt": "เวลาที่ส่ง",
|
||||
"alertStatus": {
|
||||
"pending": "รอส่ง",
|
||||
"sent": "ส่งแล้ว",
|
||||
"failed": "ส่งไม่สำเร็จ"
|
||||
},
|
||||
"roundValue": "ครั้งที่ {round}",
|
||||
"weeklyBatchesTitle": "ชุดสรุปรายสัปดาห์",
|
||||
"weeklyBatchesSubtitle": "ดูสรุปการแจ้งเตือนการชำระเงินตามผู้รับ ไฟล์ Excel และบันทึกการส่ง",
|
||||
"weeklySend": "ส่งแจ้งเตือน",
|
||||
"weeklyBatchSubmitted": "ส่งงานส่งแจ้งเตือนแล้ว",
|
||||
"weeklyBatchesLoadFailed": "โหลดชุดสรุปรายสัปดาห์ไม่สำเร็จ",
|
||||
"batchNo": "หมายเลขชุด",
|
||||
"weekKey": "สัปดาห์",
|
||||
"batchStatusLabel": "สถานะการส่ง",
|
||||
"batchTotal": "จำนวนสรุป",
|
||||
"batchExcel": "ไฟล์แนบ Excel",
|
||||
"batchSentAt": "เวลาที่ส่ง",
|
||||
"weeklyBatchesEmpty": "ยังไม่มีชุดสรุปรายสัปดาห์",
|
||||
"weeklyPendingSummary": "รอส่ง {count} รายการในสัปดาห์นี้ · ส่งครั้งถัดไป {datetime}",
|
||||
"weeklyPendingCountOnly": "รอส่ง {count} รายการในสัปดาห์นี้",
|
||||
"downloadExcel": "ดาวน์โหลด Excel",
|
||||
"excelDownloadFailed": "ดาวน์โหลดไฟล์แนบการแจ้งเตือนไม่สำเร็จ",
|
||||
"batchStatus": {
|
||||
"pending": "รอส่ง",
|
||||
"sent": "ส่งแล้ว",
|
||||
"failed": "ส่งไม่สำเร็จ",
|
||||
"processing": "กำลังดำเนินการ",
|
||||
"resolved": "หยุดการแจ้งเตือนแล้ว"
|
||||
},
|
||||
"backToLedger": "กลับ",
|
||||
"detailLoadFailed": "โหลดรายละเอียดสัญญาไม่สำเร็จ",
|
||||
"detailLoading": "กำลังโหลดรายละเอียดสัญญา…",
|
||||
"detailOverview": "ภาพรวมสัญญา",
|
||||
"detailAttachments": "ไฟล์แนบต้นฉบับ",
|
||||
"detailPaymentPlan": "แผนการชำระเงิน",
|
||||
"detailAlertHistory": "ประวัติการแจ้งเตือน",
|
||||
"archiveDate": "วันที่จัดเก็บสัญญา",
|
||||
"archiveDateHint": "วันที่นี้คือวันที่เก็บถาวรของแบบฟอร์มคำขอสัญญา",
|
||||
"parseStatus": "สถานะการแยกข้อมูล",
|
||||
"parseIssueTitle": "ปัญหาการแยกข้อมูล",
|
||||
"planStatus": "สถานะแผน",
|
||||
"attachmentsEmpty": "ยังไม่มีไฟล์สัญญาต้นฉบับที่จัดเก็บ",
|
||||
"downloadAttachment": "ดาวน์โหลด",
|
||||
"attachmentDownloadFailed": "ดาวน์โหลดไฟล์แนบสัญญาไม่สำเร็จ",
|
||||
"paymentPlanEmpty": "ไม่มีแผนการชำระเงินที่แสดงได้",
|
||||
"anchorDate": "เกณฑ์วันที่",
|
||||
"nodeStatus": {
|
||||
"pending": "รอดำเนินการ",
|
||||
"active": "กำลังดำเนินการ",
|
||||
"paid": "ชำระแล้ว",
|
||||
"processing": "กำลังประมวลผล",
|
||||
"resolved": "หยุดการแจ้งเตือนแล้ว",
|
||||
"upcoming": "ใกล้ถึงกำหนด",
|
||||
"notStarted": "รอเริ่ม",
|
||||
"overdue": "เกินกำหนดชำระ",
|
||||
"review": "ต้องตรวจสอบ"
|
||||
},
|
||||
"sessionHint": "ระยะนี้ยังไม่ใช้แชทและประวัติการสนทนา เปิดบัญชีจากแท็บด้านบน",
|
||||
"moreActions": "เพิ่มเติม",
|
||||
"reparse": "重新解析合同原文",
|
||||
"reparseSuccess": "已使用附件“{attachment}”重新解析",
|
||||
"reparseFailed": "重新解析合同失败",
|
||||
"reviewTitle": "待确认合同",
|
||||
"reviewSubtitle": "未匹配设备采购合同同义标题组、付款比例校验失败或关键字段冲突的合同不会进入付款预警,请下载原文核对。",
|
||||
"reviewSearchPlaceholder": "合同编号、采购编号或供应商",
|
||||
"reviewLoadFailed": "待确认合同加载失败",
|
||||
"reviewContractWorkflow": "合同号 / 流程编号",
|
||||
"reviewReason": "待确认原因",
|
||||
"reviewFallbackIssue": "解析结果待人工确认",
|
||||
"reviewEmpty": "暂无待确认合同"
|
||||
},
|
||||
"contractPaymentReview": {
|
||||
"title": "สัญญาที่รอยืนยัน",
|
||||
"subtitle": "สัญญาที่ไม่ตรงกับกลุ่มหัวข้อคำพ้องของสัญญาจัดซื้ออุปกรณ์ ตรวจสอบสัดส่วนการชำระเงินไม่ผ่าน หรือขัดแย้งกับฟิลด์ OA จะไม่เข้าสู่การแจ้งเตือนการชำระเงิน โปรดดาวน์โหลดต้นฉบับเพื่อตรวจสอบ",
|
||||
"searchPlaceholder": "เลขที่สัญญา ใบสั่งซื้อ หรือผู้ขาย",
|
||||
"loadFailed": "โหลดสัญญาที่รอยืนยันไม่สำเร็จ",
|
||||
"contractWorkflow": "เลขที่สัญญา / เวิร์กโฟลว์",
|
||||
"reason": "เหตุผลที่ต้องยืนยัน",
|
||||
"fallbackIssue": "ผลการแยกข้อมูลต้องยืนยันโดยผู้ใช้",
|
||||
"empty": "ไม่มีสัญญาที่รอยืนยัน"
|
||||
},
|
||||
"contractPaymentReparse": {
|
||||
"action": "แยกข้อมูลจากต้นฉบับอีกครั้ง",
|
||||
"success": "แยกข้อมูลใหม่ด้วยไฟล์แนบ “{attachment}” แล้ว",
|
||||
"failed": "แยกข้อมูลสัญญาใหม่ไม่สำเร็จ"
|
||||
},
|
||||
"title": "แจ้งเตือนการชำระเงินตามสัญญา", "subtitle": "ซิงก์สัญญา OA การรับมอบ และคำขอเบิกเงินล่วงหน้าของผู้ขาย พร้อมแจ้งเตือน 3 ระดับ", "sessionHint": "ระยะนี้ยังไม่ใช้แชทและประวัติการสนทนา เปิดบัญชีจากแท็บด้านบน", "sync": "ซิงก์ข้อมูล OA", "moreActions": "เพิ่มเติม", "forceSync": "เขียนทับฟิลด์ OA แบบบังคับ", "forceSyncConfirm": "ระบบจะเขียนทับข้อมูล OA เดิมด้วยฟิลด์ที่ไม่ว่างจาก OA ครั้งนี้และบันทึกการตรวจสอบ ต้องการดำเนินการต่อหรือไม่?", "reparseExisting": "แยกวิเคราะห์สัญญาเดิมทั้งหมดใหม่", "reparseExistingConfirm": "ระบบจะรีเฟรชผลการแยกข้อมูลของสัญญาเดิมทั้งหมดจากไฟล์แนบที่จัดเก็บตามกฎปัจจุบัน โดยจะไม่ซิงก์หรือเขียนทับฟิลด์ OA ต้องการดำเนินการต่อหรือไม่?", "scanAlerts": "สแกนเพื่อสร้างแจ้งเตือน", "jobSubmitted": "ส่งงานแล้ว", "actionFailed": "ดำเนินการไม่สำเร็จ", "loadFailed": "โหลดสัญญาไม่สำเร็จ", "searchPlaceholder": "ค้นหาเลขที่สัญญา ใบสั่งซื้อ ผู้ขาย หรือผู้ขอ", "allStatus": "ทั้งหมด", "search": "ค้นหา", "ledger": "ทะเบียนสัญญา", "items": "รายการ", "empty": "ไม่มีข้อมูลสัญญา", "purchaseOrder": "ใบสั่งซื้อ", "supplier": "ผู้ขาย", "amount": "มูลค่าสัญญา", "deliveryDate": "กำหนดส่งมอบ", "timeline": "ไทม์ไลน์แผนการชำระเงิน", "notAvailable": "—", "stats": {"contracts": "สัญญา", "pendingParse": "สัญญาที่รอดำเนินการ", "readyPlans": "แผนพร้อมใช้", "alerts": "จุดแจ้งเตือน"}, "ledgerFocus": {"due": "ใกล้ครบกำหนด", "dueHint": "ใน 7 วัน", "overdue": "ค้างชำระเกินกำหนด", "active": "ยังไม่ถึงกำหนด", "activeHint": "เกิน 7 วัน", "dueThisMonth": "ถึงกำหนดเดือนนี้", "dueThisMonthHint": "เดือนปฏิทินนี้"}, "status": {"completed": "เสร็จสิ้น", "needs_review": "ต้องตรวจสอบ", "pending": "รอแยกข้อมูล"}, "stateLabel": {"parsed": "แยกข้อมูลแล้ว", "needs_review": "ต้องตรวจสอบ", "pending": "รอแยกข้อมูล", "active": "ใช้งานอยู่"}, "nodeType": {"prepayment": "เงินล่วงหน้า", "shipment": "เงินก่อนส่ง", "acceptance": "เงินรับมอบ", "warranty": "เงินประกัน"}, "ruleConfirmed": "ยืนยันแล้ว", "prepaymentRule": "แจ้งเตือนวันที่ 7/14/21 หลังจัดเก็บสัญญา; สถานะคำขออ้างอิง OA.", "shipmentRule": "แจ้งเตือนก่อนกำหนดส่ง 7 วัน วันครบกำหนด และหลังครบกำหนด 14 วัน; สถานะคำขออ้างอิง OA.", "acceptanceRule": "แจ้งเตือนวันที่ 30/40/60 หลังจัดเก็บใบรับมอบ; เงินประกันแจ้งก่อนครบกำหนด 7 วัน วันครบกำหนด และหลังครบกำหนด 14 วัน.", "pendingAlerts": "แจ้งเตือนที่รอดำเนินการ", "processing": "เริ่มชำระแล้ว", "dataPending": "รอข้อมูล", "paid": "ชำระแล้ว", "stagePaid": "ชำระแล้ว", "amountRatioDate": "จำนวนเงิน / สัดส่วน · วันที่", "applicant": "ผู้ขอ", "company": "บริษัท", "erpSchema": "ชุดบัญชี", "statuLine truncated
|
||||
, "syncConfirm": "ระบบจะซิงก์ข้อมูลสัญญาและการรับมอบจาก OA และเติมเฉพาะช่องที่ว่างในบัญชี โดยไม่เขียนทับข้อมูลที่มีอยู่ ต้องการดำเนินการต่อหรือไม่?", "weeklySendConfirm": "ระบบจะส่งสรุปการแจ้งเตือนการชำระที่รอส่งของสัปดาห์นี้ให้ผู้รับ ต้องการดำเนินการต่อหรือไม่?", "scanAlertsConfirm": "ระบบจะสแกนแผนการชำระปัจจุบันและสร้างรายการแจ้งเตือนที่รอส่ง โดยยังไม่ส่งทันที ต้องการดำเนินการต่อหรือไม่?"},
|
||||
"contractPaymentReview": {"title": "สัญญาที่รอยืนยัน", "subtitle": "สัญญาที่ไม่ตรงกับกลุ่มหัวข้อคำพ้องของสัญญาจัดซื้ออุปกรณ์ ตรวจสอบสัดส่วนการชำระเงินไม่ผ่าน หรือขัดแย้งกับฟิลด์ OA จะไม่เข้าสู่การแจ้งเตือนการชำระเงิน โปรดดาวน์โหลดต้นฉบับเพื่อตรวจสอบ", "searchPlaceholder": "เลขที่สัญญา ใบสั่งซื้อ ผู้ขาย หรือผู้ขอ", "loadFailed": "โหลดสัญญาที่รอยืนยันไม่สำเร็จ", "contractWorkflow": "เลขที่สัญญา / เวิร์กโฟลว์ใบสมัคร", "reason": "เหตุผลที่ต้องยืนยัน", "fallbackIssue": "ผลการแยกข้อมูลต้องยืนยันโดยผู้ใช้", "empty": "ไม่มีสัญญาที่รอยืนยัน", "manualTitle": "ตรวจสอบงวดชำระ", "manualSubtitle": "{supplier} · ใบสั่งซื้อ {purchaseOrder} งวดที่ระบบอ่านได้ถูกเติมไว้แล้วและแก้ไขได้", "backToReview": "กลับไปรายการรอยืนยัน", "confirmLedger": "บันทึกเข้าบัญชีสัญญา", "confirmSuccess": "เข้าบัญชีสัญญาแล้ว", "issueTitle": "หมายเหตุจากการอ่านสัญญา", "contractNoOptional": "เลขที่สัญญา (ไม่บังคับ)", "contractNoPlaceholder": "ไม่พบเลขที่สัญญาในไฟล์แนบ", "percentage": "สัดส่วน %", "stageAmount": "จำนวนเงิน", "basisDate": "วันที่อ้างอิง", "noStage": "ไม่มีงวดนี้", "ruleIdentity": "เลขที่ใบสั่งซื้อและยอดสัญญาถูกต้อง", "rulePercent": "สัดส่วนของงวดที่เปิดใช้รวมกันต้องเป็น 100% ช่องว่างไม่นับเป็น 0", "ruleAmount": "จำนวนเงินของแต่ละงวดเท่ากับยอดสัญญาคูณสัดส่วน", "ruleDate": "เงินมัดจำและเงินค่าสินค้าต้องระบุวันที่อ้างอิง", "hintPrepayment": "วันที่อ้างอิงคือวันจัดเก็บสัญญา หากสัญญาระบุสัดส่วนเงินมัดจำ ให้กรอกที่นี่", "hintShipment": "วันที่อ้างอิงคือกำหนดส่งมอบ หากสัญญาเขียนเพียง “หลังรับเงินมัดจำ N วัน” ให้กรอกวันที่จริง", "hintAcceptance": "วันที่อ้างอิงคือวันจัดเก็บใบตรวจรับ ถ้ายังไม่จัดเก็บให้เว้นว่าง", "hintWarranty": "หากไม่มีสัดส่วนเงินประกันผลงาน ให้เลือกไม่มีงวดนี้ ระยะประกันไม่ใช่สัดส่วนการชำระ", "formLoadFailed": "เปิดแบบฟอร์มตรวจสอบไม่สำเร็จ", "submitFailed": "ส่งผลการตรวจสอบไม่สำเร็จ", "manualAction": "ตรวจสอบด้วยตนเอง", "fillHintTitle": "วิธีกรอก"},
|
||||
"contractPaymentReparse": {"action": "แยกข้อมูลจากต้นฉบับอีกครั้ง", "success": "แยกข้อมูลใหม่ด้วยไฟล์แนบ “{attachment}” แล้ว", "failed": "แยกข้อมูลสัญญาใหม่ไม่สำเร็จ"},
|
||||
"contractPaymentReview": {"title": "สัญญาที่รอยืนยัน", "subtitle": "สัญญาที่ไม่ตรงกับกลุ่มหัวข้อคำพ้องของสัญญาจัดซื้ออุปกรณ์ ตรวจสอบสัดส่วนการชำระเงินไม่ผ่าน หรือขัดแย้งกับฟิลด์ OA จะไม่เข้าสู่การแจ้งเตือนการชำระเงิน โปรดดาวน์โหลดต้นฉบับเพื่อตรวจสอบ", "searchPlaceholder": "เลขที่สัญญา ใบสั่งซื้อ ผู้ขาย หรือผู้ขอ", "loadFailed": "โหลดสัญญาที่รอยืนยันไม่สำเร็จ", "contractWorkflow": "เลขที่สัญญา / เวิร์กโฟลว์ใบสมัคร", "reason": "เหตุผลที่ต้องยืนยัน", "fallbackIssue": "ผลการแยกข้อมูลต้องยืนยันโดยผู้ใช้", "empty": "ไม่มีสัญญาที่รอยืนยัน", "manualTitle": "ตรวจสอบงวดชำระ", "manualSubtitle": "{supplier} · ใบสั่งซื้อ {purchaseOrder} งวดที่ระบบอ่านได้ถูกเติมไว้แล้วและแก้ไขได้", "backToReview": "กลับไปรายการรอยืนยัน", "confirmLedger": "บันทึกเข้าบัญชีสัญญา", "confirmSuccess": "เข้าบัญชีสัญญาแล้ว", "issueTitle": "หมายเหตุจากการอ่านสัญญา", "contractNoOptional": "เลขที่สัญญา (ไม่บังคับ)", "contractNoPlaceholder": "ไม่พบเลขที่สัญญาในไฟล์แนบ", "percentage": "สัดส่วน %", "stageAmount": "จำนวนเงิน", "basisDate": "วันที่อ้างอิง", "noStage": "ไม่มีงวดนี้", "ruleIdentity": "เลขที่ใบสั่งซื้อและยอดสัญญาถูกต้อง", "rulePercent": "สัดส่วนของงวดที่เปิดใช้รวมกันต้องเป็น 100% ช่องว่างไม่นับเป็น 0", "ruleAmount": "จำนวนเงินของแต่ละงวดเท่ากับยอดสัญญาคูณสัดส่วน", "ruleDate": "เงินมัดจำและเงินค่าสินค้าต้องระบุวันที่อ้างอิง", "hintPrepayment": "วันที่อ้างอิงคือวันจัดเก็บสัญญา หากสัญญาระบุสัดส่วนเงินมัดจำ ให้กรอกที่นี่", "hintShipment": "วันที่อ้างอิงคือกำหนดส่งมอบ หากสัญญาเขียนเพียง “หลังรับเงินมัดจำ N วัน” ให้กรอกวันที่จริง", "hintAcceptance": "วันที่อ้างอิงคือวันจัดเก็บใบตรวจรับ ถ้ายังไม่จัดเก็บให้เว้นว่าง", "hintWarranty": "หากไม่มีสัดส่วนเงินประกันผลงาน ให้เลือกไม่มีงวดนี้ ระยะประกันไม่ใช่สัดส่วนการชำระ", "formLoadFailed": "เปิดแบบฟอร์มตรวจสอบไม่สำเร็จ", "submitFailed": "ส่งผลการตรวจสอบไม่สำเร็จ", "manualAction": "ตรวจสอบด้วยตนเอง", "fillHintTitle": "วิธีกรอก"},
|
||||
"procurementContract": {
|
||||
"title": "ตรวจสอบสัญญาจัดซื้อ",
|
||||
"subtitle": "จัดการเทมเพลต กฎเส้นแดงความเสี่ยง และประวัติการตรวจสอบ",
|
||||
@@ -5564,7 +5384,8 @@
|
||||
"interface": "นิยามอินเทอร์เฟซ",
|
||||
"binding": "การผูก",
|
||||
"credential": "การอ้างอิงข้อมูลรับรอง",
|
||||
"capability": "รายการความสามารถ"
|
||||
"capability": "รายการความสามารถ",
|
||||
"calls": "ประวัติการเรียกใช้"
|
||||
},
|
||||
"statusLabels": {
|
||||
"draft": "ฉบับร่าง",
|
||||
@@ -5615,7 +5436,7 @@
|
||||
"environment": "สภาพแวดล้อม",
|
||||
"status": "สถานะ",
|
||||
"clientInstance": "อินสแตนซ์ไคลเอ็นต์",
|
||||
"interfaceDef": "อินเทอร์เฟซ",
|
||||
"interfaceDef": "ขั้นตอนอินเทอร์เฟซ (เรียงลำดับ)",
|
||||
"secretRef": "การอ้างอิง Secret",
|
||||
"secretProvider": "แหล่งที่มา",
|
||||
"account": "บัญชี",
|
||||
@@ -5630,6 +5451,7 @@
|
||||
"code": "รหัส",
|
||||
"name": "ชื่อ",
|
||||
"connectorType": "ประเภทตัวเชื่อมต่อ",
|
||||
"dbKind": "ชนิดฐานข้อมูล (db_kind)",
|
||||
"environment": "สภาพแวดล้อม",
|
||||
"credentialRef": "รหัสการอ้างอิงข้อมูลรับรอง",
|
||||
"configJson": "JSON การตั้งค่าการเชื่อมต่อ (ที่อยู่/หมดเวลา/org เริ่มต้น ฯลฯ)",
|
||||
@@ -5651,9 +5473,6 @@
|
||||
"effectiveTo": "มีผลถึง",
|
||||
"contextSelector": "JSON เงื่อนไขการกำหนดเส้นทางขั้นสูง",
|
||||
"contextSelectorHint": "คู่คีย์-ค่าทั้งหมดต้องอยู่ในบริบทการเรียกจึงจะจับคู่ได้ โดยเวอร์ชันปัจจุบันผู้เรียกไม่ส่งบริบทการกำหนดเส้นทาง ปล่อยว่างไว้จะเป็นการผูกค่าเริ่มต้น",
|
||||
"paramMapping": "JSON การแมปพารามิเตอร์",
|
||||
"paramMappingHint": "กฎการแปลพารามิเตอร์โดเมนเป็นพารามิเตอร์อินเทอร์เฟซ (เช่น erp_org เป็น organization, เทมเพลต condition) หากว่างจะส่งต่อชื่อเดียวกัน",
|
||||
"bindingClientHint": "ดึงและล็อกโดยอัตโนมัติตามคำนิยามอินเทอร์เฟซที่เลือก แก้ไขเองไม่ได้",
|
||||
"secretRef": "คีย์อ้างอิง Secret",
|
||||
"secretProvider": "แหล่ง Secret",
|
||||
"credentialType": "ประเภทข้อมูลรับรอง",
|
||||
@@ -5681,7 +5500,8 @@
|
||||
"msg": {
|
||||
"fillClient": "กรุณากรอกชื่อ",
|
||||
"fillInterface": "กรุณาเลือกอินสแตนซ์ไคลเอ็นต์ (รหัสสร้างอัตโนมัติได้)",
|
||||
"fillBinding": "กรุณากรอกความสามารถ อินสแตนซ์ไคลเอ็นต์ และนิยามอินเทอร์เฟซ",
|
||||
"fillBinding": "กรุณากรอกความสามารถ และเพิ่มขั้นตอนอย่างน้อยหนึ่งขั้น (เลือกอินเทอร์เฟซของแต่ละขั้น)",
|
||||
"fillDbKind": "กรุณาเลือกชนิดฐานข้อมูล (MySQL / Oracle / SQL Server / PostgreSQL)",
|
||||
"fillCredential": "กรุณากรอกรหัสและการอ้างอิง Secret",
|
||||
"fillCredentialDb": "กรุณากรอกรหัส และฟิลด์ข้อมูลประจำตัวที่จำเป็น: {fields}",
|
||||
"credentialTypeMissing": "รายการประเภทข้อมูลประจำตัวยังไม่โหลด โปรดรีเฟรชแล้วลองใหม่",
|
||||
@@ -5716,7 +5536,8 @@
|
||||
"endpoint": "https://erp-api.example.com/ws",
|
||||
"wsdl": "https://erp-api.example.com/wsdl",
|
||||
"requestPath": "เส้นทางรองรับตัวยึดตำแหน่ง เช่น /transfer/xxx",
|
||||
"passwordKeep": "ปล่อยว่างไว้เพื่อคงรหัสผ่านเดิม"
|
||||
"passwordKeep": "ปล่อยว่างไว้เพื่อคงรหัสผ่านเดิม",
|
||||
"database": "erp-host:1521/ORCL หรือ 127.0.0.1:3306/dbname"
|
||||
},
|
||||
"advancedConfig": "การตั้งค่าขั้นสูง (JSON)",
|
||||
"formatJson": "จัดรูปแบบ",
|
||||
@@ -5737,7 +5558,70 @@
|
||||
},
|
||||
"connectorTypes": {
|
||||
"rest": "REST API",
|
||||
"soap": "บริการ SOAP"
|
||||
"soap": "บริการ SOAP",
|
||||
"database": "ฐานข้อมูล (เชื่อมตรง)"
|
||||
},
|
||||
"connectorDbKind": {
|
||||
"mysql": "MySQL",
|
||||
"oracle": "Oracle",
|
||||
"sqlserver": "SQL Server",
|
||||
"postgresql": "PostgreSQL"
|
||||
},
|
||||
"endpointLabel": {
|
||||
"database": "สตริงการเชื่อมต่อฐานข้อมูล (host:port/service หรือ /database)"
|
||||
},
|
||||
"bindingSteps": {
|
||||
"label": "ขั้นตอนการทำงาน (ตามลำดับ)",
|
||||
"add": "เพิ่มขั้นตอน",
|
||||
"remove": "ลบขั้นตอน",
|
||||
"moveUp": "ย้ายขึ้น",
|
||||
"moveDown": "ย้ายลง",
|
||||
"interface": "นิยามอินเทอร์เฟซ",
|
||||
"paramMapping": "JSON การแมปพารามิเตอร์ของขั้นตอนที่ {index}",
|
||||
"clientHint": "อินสแตนซ์ไคลเอ็นต์กำหนดอัตโนมัติจากอินเทอร์เฟซของขั้นตอนนี้: {client}",
|
||||
"hint": "ขั้นตอนจะทำงานตามลำดับในอาร์เรย์ แต่ละขั้นตอนมีการแมปพารามิเตอร์ของตัวเอง และอินสแตนซ์ไคลเอ็นต์มาพร้อมกับอินเทอร์เฟซของแต่ละขั้นตอน"
|
||||
},
|
||||
"callLogs": {
|
||||
"title": "บันทึกการเรียกใช้",
|
||||
"filterInterface": "รหัสอินเทอร์เฟซ",
|
||||
"filterClient": "รหัสไคลเอ็นต์",
|
||||
"filterConnector": "ประเภทตัวเชื่อมต่อ",
|
||||
"filterStatus": "สถานะ",
|
||||
"filterOperationId": "operation_id",
|
||||
"filterTraceId": "trace_id",
|
||||
"filterBusinessRef": "เลขที่เอกสารธุรกิจ",
|
||||
"filterKeyword": "คำสำคัญในคำขอ",
|
||||
"dateFrom": "เวลาเริ่มต้น",
|
||||
"dateTo": "เวลาสิ้นสุด",
|
||||
"query": "ค้นหา",
|
||||
"reset": "รีเซ็ต",
|
||||
"colTime": "เวลา",
|
||||
"colCapability": "ความสามารถ",
|
||||
"colInterface": "อินเทอร์เฟซ",
|
||||
"colRef": "เลขที่อ้างอิง",
|
||||
"colStep": "ขั้นตอน",
|
||||
"colStatus": "สถานะ",
|
||||
"colElapsed": "เวลาที่ใช้",
|
||||
"detailTitle": "รายละเอียดการเรียกใช้",
|
||||
"timeline": "ไทม์ไลน์ขั้นตอน",
|
||||
"request": "คำขอ",
|
||||
"response": "การตอบกลับ",
|
||||
"wire": "คำขอระดับ wire",
|
||||
"rawPayload": "ข้อความดิบ",
|
||||
"normalized": "พารามิเตอร์ธุรกิจ (มาตรฐาน)",
|
||||
"normalizedJson": "JSON มาตรฐาน",
|
||||
"copyBody": "คัดลอก body",
|
||||
"copyCurl": "คัดลอก curl",
|
||||
"copySql": "คัดลอก SQL",
|
||||
"copyRaw": "คัดลอกข้อความดิบ",
|
||||
"copyJson": "คัดลอก JSON",
|
||||
"copyOperationId": "คัดลอก operation_id",
|
||||
"copyTraceId": "คัดลอก trace_id",
|
||||
"copied": "คัดลอกแล้ว",
|
||||
"noWire": "ไม่มีรายละเอียดระดับ wire (ระเบียนเก่า)",
|
||||
"sqlWriteWarning": "⚠ คำสั่งเขียน: โปรดยืนยันสภาพแวดล้อมเป้าหมายก่อนดำเนินการ",
|
||||
"prevPage": "หน้าก่อนหน้า",
|
||||
"nextPage": "หน้าถัดไป"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3778,19 +3778,21 @@
|
||||
"stageFileReady": "ไฟล์พร้อม",
|
||||
"stageWaitingRpa": "RPA กำลังดึงข้อมูล",
|
||||
"stageFailed": "ล้มเหลว",
|
||||
"precheckTitle": "ตรวจสอบก่อนโอน",
|
||||
"matchTitle": "รายการสต็อกที่โอนได้",
|
||||
"businessDate": "วันที่ธุรกิจ",
|
||||
"executableCount": "ดำเนินการได้",
|
||||
"notMaturedCount": "รับของวันนี้",
|
||||
"blockedCount": "ถูกบล็อก",
|
||||
"estimatedQuantity": "จำนวนโอนโดยประมาณ",
|
||||
"estimatedExternalWrites": "เอกสาร ERP โดยประมาณ",
|
||||
"pendingStockCheckCount": "รอตรวจสอบสต๊อก",
|
||||
"invalidRowCount": "{count} แถวหมดอายุ",
|
||||
"reasonQuantityMismatch": "ปริมาณสต๊อกตามบัญชี ERP ไม่ตรงกับปริมาณที่รับสินค้า",
|
||||
"reasonInventoryNotFound": "ไม่มีระเบียนสต๊อก ERP สำหรับล็อตนี้ แสดงสต๊อกเป็น 0",
|
||||
"reasonExternalQueryFailed": "การสอบถามระบบภายนอกล้มเหลว",
|
||||
"reasonFutureDate": "วันที่รับสินค้าหลังวันที่ทำธุรกรรม",
|
||||
"selectedCount": "เลือก {count} รายการ",
|
||||
"generateTransfer": "สร้างใบโอนทันที",
|
||||
"generateTransfer": "สร้างใบโอน",
|
||||
"colSource": "แหล่งรับของ",
|
||||
"colMaterial": "รหัสวัสดุ",
|
||||
"colName": "ชื่อ",
|
||||
@@ -3799,21 +3801,27 @@
|
||||
"colReceiptDate": "วันที่รับสินค้า",
|
||||
"colFromWarehouse": "คลังต้นทาง",
|
||||
"colFromQty": "จำนวนสต๊อก",
|
||||
"stockCheckedAtTitle": "เวลาตรวจสอบสต๊อก: {time}",
|
||||
"colToWarehouse": "คลังปลายทาง",
|
||||
"colFromBatch": "ล็อตต้นทาง",
|
||||
"filterPlaceholder": "กรองตามรหัสวัสดุ / ชื่อ / Invoice / ล็อต",
|
||||
"filterAll": "ทุกผลลัพธ์",
|
||||
"requerySelected": "ตรวจซ้ำ ERP ที่เลือก",
|
||||
"requerySelected": "ตรวจซ้ำที่เลือก",
|
||||
"receiptDateLabel": "วันที่รับสินค้า",
|
||||
"receiptDateTo": "วันที่รับสินค้าถึง",
|
||||
"receiptDateHint": "วันสิ้นสุดต้องไม่เกินกฎ D+1 (วันก่อนวันทำการ)",
|
||||
"receiptDateTo": "วันที่รับสินค้าสิ้นสุด",
|
||||
"receiptDateHint": "ค่าเริ่มต้นเป็นวันตามกฎ D+1 (วันก่อนวันทำการ ซึ่งเป็นเส้นตายการจับคู่); วันสิ้นสุดต้องไม่เกินวันนี้และวันเริ่มต้นต้องไม่ช้ากว่าวันสิ้นสุด",
|
||||
"requeryRow": "ตรวจซ้ำ",
|
||||
"colToQty": "จำนวนปลายทาง",
|
||||
"colResult": "ผลตรวจ",
|
||||
"colResult": "ผลการจับคู่",
|
||||
"resultExecutable": "ดำเนินการได้",
|
||||
"resultNotMatured": "รับของวันนี้",
|
||||
"resultBlocked": "ถูกบล็อก",
|
||||
"resultUnknown": "ผลไม่ทราบ",
|
||||
"resultFileRemoved": "ถูกลบออกจากไฟล์",
|
||||
"resultPendingStockCheck": "รอตรวจสอบสต๊อก",
|
||||
"staleRow": "ข้อมูลหมดอายุ กรุณาตรวจซ้ำ",
|
||||
"fileChangedRow": "ไฟล์อัปเดตแล้ว ข้อมูลจะจัดตำแหน่งใหม่อัตโนมัติ",
|
||||
"fileRemovedQuarantined": "อีก {count} รายการถือเป็นยกเลิกเนื่องจากถูกลบออกจากไฟล์รับของ และถูกซ่อนจากรายการนี้ โปรดดำเนินการใน「ข้อยกเว้นที่รอดำเนินการ」โดยสามารถทำเครื่องหมายว่าไม่จำเป็นต้องดำเนินการต่อ",
|
||||
"runProgress": "ความคืบหน้าการโอน",
|
||||
"runExecuting": "กำลังดำเนินการ",
|
||||
"runSuccess": "เสร็จสิ้น",
|
||||
@@ -3828,12 +3836,22 @@
|
||||
"exceptionsTitle": "ไม่มีการสร้างเอกสาร ERP",
|
||||
"exceptionBusinessFailed": "ธุรกิจล้มเหลว",
|
||||
"exceptionTechnicalFailed": "เทคนิคล้มเหลว",
|
||||
"exceptionPrecheckExpired": "ตรวจสอบหมดอายุ",
|
||||
"exceptionMatchExpired": "การจับคู่หมดอายุ",
|
||||
"downloadReceiptFiles": "ดาวน์โหลดไฟล์รับของ",
|
||||
"downloadErpInventory": "ดาวน์โหลดสต็อก ERP",
|
||||
"downloadExceptions": "ดาวน์โหลด Excel ข้อผิดพลาด",
|
||||
"backlogTitle": "รายการค้างดำเนินการ",
|
||||
"retryErp": "สอบถาม ERP อีกครั้ง",
|
||||
"resumeAction": "ดำเนินการต่อ",
|
||||
"colAging": "ความเก่า",
|
||||
"colAction": "การดำเนินการ",
|
||||
"selectedRows": "เลือกแล้ว {count} แถว",
|
||||
"clearSelection": "ล้างการเลือก",
|
||||
"receiptDateInvalid": "วันเริ่มต้นต้องไม่ช้ากว่าวันสิ้นสุด",
|
||||
"toastRequeryDone": "ตรวจซ้ำเสร็จ: อัปเดตแล้ว {ok} แถว ล้มเหลว {failed} แถว",
|
||||
"toastRequeryRecovered": "กู้คืนเสร็จสิ้น: {recovered} รายการดำเนินการได้ · {blocked} รายการยังถูกบล็อก",
|
||||
"toastExecuteFileChanged": "{count} รายการไฟล์มีการเปลี่ยนแปลง กรุณาจับคู่ใหม่",
|
||||
"toastCloseDone": "ปิดแล้ว: สำเร็จ {ok} รายการ ล้มเหลว {failed} รายการ",
|
||||
"batchCloseTitle": "ทำเครื่องหมายไม่ต้องดำเนินการต่อ ({count} รายการ)",
|
||||
"manualClose": "ทำเครื่องหมายไม่ต้องดำเนินการ",
|
||||
"manualCloseTitle": "ทำเครื่องหมายไม่ต้องดำเนินการ",
|
||||
"manualCloseHint": "หลังปิดระบบอัตโนมัติจะไม่ประมวลผลอีก ประวัติและการตรวจสอบคงอยู่ถาวร",
|
||||
@@ -3856,20 +3874,20 @@
|
||||
"hub_to_hub": "โอนระหว่าง HUB"
|
||||
},
|
||||
"transferTypeComingSoon": "เร็ว ๆ นี้",
|
||||
"precheckParams": "พารามิเตอร์ตรวจสอบก่อน",
|
||||
"matchParams": "พารามิเตอร์การจับคู่",
|
||||
"selectAll": "เลือกทั้งกลุ่ม",
|
||||
"selectEnabledAll": "เลือกที่เปิดใช้งานทั้งหมด",
|
||||
"clearSources": "ล้างการเลือก",
|
||||
"selectedSourceCount": "เลือกแล้ว {count} แหล่งรับ",
|
||||
"needSelectSource": "กรุณาเลือกแหล่งรับที่เปิดใช้งานอย่างน้อยหนึ่งรายการ",
|
||||
"confirmScopeAndPrecheck": "ยืนยันขอบเขตและตรวจสอบ",
|
||||
"confirmScopeAndMatch": "ยืนยันขอบเขตและจับคู่",
|
||||
"homeWelcome": "สวัสดี คุณได้เข้าสู่",
|
||||
"homeTodayLabel": "งานวันนี้",
|
||||
"homeTodayAction": "เริ่มการตรวจสอบการโอนย้ายวันนี้",
|
||||
"homeTodayAction": "จับคู่สต็อกที่โอนได้",
|
||||
"homeTodayHint": "หลังจากเลือกแหล่งรับ ระบบจะใช้เมื่อวานเป็นวันที่ทำรายการโดยค่าเริ่มต้น",
|
||||
"homeHistoryLabel": "งานค้าง",
|
||||
"homeRecoverable": "รายการผิดปกติที่กู้คืนได้",
|
||||
"homeRecoverableHint": "สามารถสอบถามสต็อก ERP ใหม่ก่อนดำเนินการต่อ",
|
||||
"homeRecoverable": "รายการผิดปกติรอกู้คืน",
|
||||
"homeRecoverableHint": "ตรวจซ้ำสต็อกหรือดำเนินการต่อได้ทันที",
|
||||
"homeClosed": "ปิดด้วยตนเองแล้ว",
|
||||
"homeClosedHint": "สามารถดูสาเหตุและกู้คืนการดำเนินการได้",
|
||||
"homeUnknown": "ผลลัพธ์ไม่ทราบ",
|
||||
@@ -3889,6 +3907,91 @@
|
||||
"batchRetry": "ลองใหม่เป็นชุด",
|
||||
"downloadFiles": "ดาวน์โหลดไฟล์การรับสินค้า",
|
||||
"selectedRetryableCount": "ลองใหม่ได้ {count} รายการ",
|
||||
"noRetryable": "ไม่มีแหล่งที่เลือกต้องลองใหม่ (พร้อมแล้วหรือกำลังดึง)"
|
||||
"noRetryable": "ไม่มีแหล่งที่เลือกต้องลองใหม่ (พร้อมแล้วหรือกำลังดึง)",
|
||||
"homeMatchLabel": "จับคู่สต็อก",
|
||||
"homeBoardLabel": "บอร์ดงานที่ต้องดำเนินการ",
|
||||
"homeExecutable": "รายการที่โอนได้",
|
||||
"homeExecutableHint": "เลือกแถวเพื่อสร้างใบโอน",
|
||||
"executableTitle": "รายการที่โอนได้",
|
||||
"executableEmpty": "ไม่มีรายการที่โอนได้",
|
||||
"executableSelectedCount": "เลือกแล้ว {count} รายการ",
|
||||
"runTitle": "สร้างใบโอน",
|
||||
"runBadge": {
|
||||
"queued": "อยู่ในคิว",
|
||||
"executing": "กำลังดำเนินการ",
|
||||
"success": "สำเร็จ",
|
||||
"partialFailed": "ล้มเหลวบางส่วน",
|
||||
"failed": "ล้มเหลว"
|
||||
},
|
||||
"orderStatus": {
|
||||
"pending": "รอดำเนินการ",
|
||||
"executing": "กำลังดำเนินการ",
|
||||
"success": "สำเร็จ",
|
||||
"resultUnknown": "ผลลัพธ์ไม่ทราบแน่ชัด",
|
||||
"failed": "ล้มเหลว",
|
||||
"cancelled": "ปิดไปแล้ว"
|
||||
},
|
||||
"orderAction": {
|
||||
"retrigger": "ทริกเกอร์ใหม่",
|
||||
"retry": "ลองใหม่",
|
||||
"retryAccepted": "ส่งใบโอนย้าย {docNo} เข้าคิวดำเนินการใหม่แล้ว ความคืบหน้าจะรีเฟรชอัตโนมัติ",
|
||||
"retryPartial": "ตรวจสอบซ้ำเสร็จ: {ready} รายการพร้อมดำเนินการ {blocked} รายการยังถูกบล็อกและอยู่ในคลังรอกู้คืน",
|
||||
"closeOrder": "ปิดใบโอนย้าย"
|
||||
},
|
||||
"orderReasonPrefix": "เหตุผล: {reason}",
|
||||
"poll": {
|
||||
"connecting": "กำลังเชื่อมต่อ…"
|
||||
},
|
||||
"execute": {
|
||||
"accepted": "ส่งคำขอแล้ว งานอยู่ในคิว ความคืบหน้าจะแสดงด้านล่าง",
|
||||
"noSelection": "กรุณาเลือกรายการที่ดำเนินการได้อย่างน้อยหนึ่งรายการ"
|
||||
},
|
||||
"retriggerDialog": {
|
||||
"title": "ทริกเกอร์ใหม่ {docNo}",
|
||||
"body": "จะใช้หมายเลขเอกสารและเวลาส่งเดิมของใบโอนย้ายนี้ และทริกเกอร์เฉพาะขั้นตอนสุดท้าย (idempotent ปลอดภัย จะไม่สร้างเอกสารซ้ำ)",
|
||||
"confirm": "ยืนยันการทริกเกอร์ใหม่",
|
||||
"dismiss": "กลับ"
|
||||
},
|
||||
"orderClose": {
|
||||
"title": "ปิดใบโอนย้าย {docNo}",
|
||||
"impactHint": "รายการ {count} รายการของใบโอนย้ายนี้จะถูกแยกออกและกลับไปยังคลังรอดำเนินการ (เลือกจัดใหม่ได้):",
|
||||
"redline": "การปิดใบโอนย้ายไม่ได้แปลว่าไม่มีเอกสารใน ERP: ต้องยืนยันใน ERP ด้วยตนเองก่อนปิด",
|
||||
"reasonPlaceholder": "เหตุผล (จำเป็น)",
|
||||
"confirm": "ยืนยันการปิด",
|
||||
"dismiss": "กลับ"
|
||||
},
|
||||
"toastOrderClosed": "ปิดใบโอนย้ายแล้ว รายการกลับไปยังคลังรอดำเนินการ",
|
||||
"toastRetriggerAccepted": "ทริกเกอร์ใหม่แล้ว ขั้นตอนสุดท้ายอยู่ในคิว",
|
||||
"homeExecuted": {
|
||||
"title": "ใบโอนย้ายที่ดำเนินการแล้ว",
|
||||
"refresh": "รีเฟรช",
|
||||
"empty": "ยังไม่มีใบโอนย้ายที่ดำเนินการแล้ว",
|
||||
"pageInfo": "ทั้งหมด {total} ใบ · หน้า {page}",
|
||||
"back": "ย้อนกลับ",
|
||||
"all": "ทั้งหมด",
|
||||
"groupHint": {
|
||||
"success": "เลขที่ ERP อัปเดตกลับแล้ว ดูรายละเอียดได้",
|
||||
"failed": "ตรวจสอบสต็อกซ้ำหรือปิดใบโอนได้",
|
||||
"executing": "กำลังเขียนตารางงาน/เรียก ERP สร้างใบโอน",
|
||||
"resultUnknown": "อ่านอย่างเดียว ต้องตรวจสอบกับ ERP"
|
||||
},
|
||||
"dateFrom": "วันที่เริ่มต้น",
|
||||
"dateTo": "วันที่สิ้นสุด",
|
||||
"group": {
|
||||
"success": "สำเร็จ",
|
||||
"failed": "ล้มเหลว",
|
||||
"executing": "กำลังดำเนินการ",
|
||||
"resultUnknown": "ผลลัพธ์ไม่ทราบแน่ชัด"
|
||||
},
|
||||
"closeDialog": {
|
||||
"title": "ปิดใบโอนย้าย {docNo}",
|
||||
"reasonRequired": "เหตุผลในการปิด (จำเป็น)",
|
||||
"redlineWhole": "การปิดจะยกเลิกใบโอนย้ายทั้งใบ (รวมถึงแถวที่ยังไม่ได้บันทึก) และไม่สามารถย้อนกลับได้",
|
||||
"redlineResidue": "แถวที่บันทึกลง ERP แล้วจะไม่ถูกลบโดยอัตโนมัติ ต้องตรวจสอบแถวค้างด้วยตนเองตาม SOP",
|
||||
"redlineReopen": "รายละเอียดทั้งหมดในใบโอนย้ายจะแยกออกจากใบนี้และกลับไปที่คิวรอดำเนินการ เพื่อจัดใหม่ได้",
|
||||
"redlineErpCheck": "การปิดใบโอนย้ายไม่ได้แปลว่าไม่มีเอกสารใน ERP: ต้องยืนยันด้วยตนเองใน ERP ว่าไม่มีเอกสารที่เกี่ยวข้องก่อนปิด",
|
||||
"confirm": "ยืนยันการปิด"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,6 +150,7 @@
|
||||
"CHAT.USER_ATTACHMENTS_LIMIT_EXCEEDED": "ไฟล์แนบเกินจำนวนที่อนุญาต (สูงสุด 200 ไฟล์) โปรดลดจำนวนแล้วลองใหม่",
|
||||
"CONTRACT_PAYMENT_FORBIDDEN": "คุณไม่มีสิทธิ์เข้าถึงการแจ้งเตือนการชำระเงินตามสัญญา",
|
||||
"CONTRACT_PAYMENT_ADMIN_REQUIRED": "เฉพาะผู้ดูแลระบบเท่านั้นที่ซิงก์ สแกน หรือส่งการแจ้งเตือนการชำระเงินตามสัญญาได้",
|
||||
"CONTRACT_PAYMENT_ATTACHMENT_UNAVAILABLE": "ไฟล์ต้นฉบับของสัญญาถูกลบไปแล้ว และไม่สามารถดาวน์โหลดใหม่จากระบบต้นทางได้ โปรดซิงก์ข้อมูล OA แล้วลองอีกครั้ง",
|
||||
"VOUCHER_CHECK_FORBIDDEN": "คุณไม่มีสิทธิ์เข้าถึงการตรวจเอกสารบัญชี",
|
||||
"VOUCHER_CHECK_ADMIN_REQUIRED": "เฉพาะผู้ดูแลระบบเท่านั้นที่บังคับตรวจเอกสารบัญชีใหม่ หรือแก้ผู้รับการแจ้งเตือนไฟล์ขาดได้",
|
||||
"SHIPPING_TASK_SELECTION_INVALID": "เลือกงานจัดส่งได้ 1 ถึง 100 งาน",
|
||||
@@ -559,8 +560,8 @@
|
||||
"TRANSFER_INVOICE_CONFLICT": "Invoice ขัดแย้ง (หลายรหัสวัสดุหรือหลายวันที่)",
|
||||
"TRANSFER_QUANTITY_MISMATCH": "จำนวนรับของไม่เท่ากับสต็อก ERP ถูกบล็อก",
|
||||
"TRANSFER_ERP_INVENTORY_NOT_FOUND": "ไม่พบสต็อก ERP สำหรับ Invoice นี้",
|
||||
"TRANSFER_PRECHECK_EXPIRED": "การตรวจสอบหมดอายุหรือข้อมูลเปลี่ยน กรุณาตรวจใหม่",
|
||||
"TRANSFER_CONFIRMATION_REQUIRED": "การตรวจสอบยังไม่พร้อมดำเนินการ",
|
||||
"TRANSFER_MATCH_EXPIRED": "การจับคู่หมดอายุหรือข้อมูลเปลี่ยน กรุณาจับคู่ใหม่",
|
||||
"TRANSFER_CONFIRMATION_REQUIRED": "การจับคู่ยังไม่พร้อมดำเนินการ",
|
||||
"TRANSFER_DUPLICATE_NOT_VERIFIED": "ไม่สามารถยืนยันว่า Invoice ซ้ำผ่านรายการแล้ว",
|
||||
"TRANSFER_RESULT_UNKNOWN": "ผล ERP ไม่ทราบ อ่านอย่างเดียว ตรวจตาม SOP",
|
||||
"TRANSFER_MANUAL_CLOSE_REASON_REQUIRED": "การปิดด้วยมือต้องกรอกเหตุผล",
|
||||
@@ -570,8 +571,19 @@
|
||||
"TRANSFER.ROUTE_NOT_RESOLVED": "ยังไม่กำหนดเส้นทางสำหรับแหล่งนี้",
|
||||
"TRANSFER.EXTERNAL_NOT_FROZEN": "สัญญาภายนอกยังไม่ถูกกำหนด ห้ามเรียก",
|
||||
"TRANSFER.EXTERNAL_QUERY_TIMEOUT": "สอบถามระบบภายนอกหมดเวลา กรุณาลองใหม่",
|
||||
"TRANSFER.PRECHECK_ALREADY_EXECUTED": "การตรวจสอบนี้ดำเนินการแล้ว",
|
||||
"TRANSFER.SELECTION_INVALID": "รายการที่เลือกมี Invoice ที่ดำเนินการไม่ได้",
|
||||
"TRANSFER.INVALID_STATE_TRANSITION": "การเปลี่ยนสถานะไม่ถูกต้อง"
|
||||
"TRANSFER.INVALID_STATE_TRANSITION": "การเปลี่ยนสถานะไม่ถูกต้อง",
|
||||
"TRANSFER.BATCH_ITEMS_REQUIRED": "กรุณาระบุรายการที่ต้องการดำเนินการ",
|
||||
"TRANSFER.EXECUTE_ITEMS_INVALID": "บางรายการไม่มีอยู่หรือดำเนินการไม่ได้ กรุณารีเฟรชแล้วลองใหม่",
|
||||
"TRANSFER.ITEMS_STALE": "ผลการจับคู่ของบางรายการหมดอายุแล้ว กรุณาจับคู่ใหม่",
|
||||
"TRANSFER.FILE_CHANGED": "ไฟล์รับสินค้ามีการเปลี่ยนแปลง กรุณาจับคู่ใหม่ก่อนดำเนินการ",
|
||||
"TRANSFER.ORG_REQUIRED": "กรุณาระบุรหัสองค์กรภายนอก",
|
||||
"TRANSFER.RETRIGGER_NOT_ALLOWED": "เฉพาะตั๋วที่ผลลัพธ์ไม่ทราบแน่ชัด (result_unknown) เท่านั้นที่ทริกเกอร์ซ้ำได้ ห้ามปิดแล้วสร้างใหม่",
|
||||
"TRANSFER.RETRY_NOT_ALLOWED": "แถวนี้ถูกลบออกไปพร้อมกับไฟล์และตรวจซ้ำไม่ได้ โปรดทำเครื่องหมายว่าไม่จำเป็นต้องดำเนินการต่อ หรือรอให้ไฟล์ซิงก์ใหม่",
|
||||
"TRANSFER.DOCUMENT_CLOSE_NOT_ALLOWED": "ปิดได้เฉพาะตั๋วที่ล้มเหลว (ถูกปฏิเสธทางธุรกิจ/ล้มเหลวทางเทคนิค) สำหรับตั๋วที่ผลลัพธ์ไม่ทราบแน่ชัดโปรดใช้ \"ทริกเกอร์ใหม่\" และตั๋วที่กำลังดำเนินการปิดไม่ได้",
|
||||
"TRANSFER.DOCUMENT_NOT_FOUND": "ไม่พบตั๋วโอนย้าย",
|
||||
"INTEGRATION.BINDING_LEGACY_PUT_REJECTED": "ฟิลด์ขั้นตอนเดียวแบบเดิมจะตัดทอนสูตรหลายขั้นตอนของการผูกนี้ โปรดส่งขั้นตอนตามลำดับด้วย steps_json แทน",
|
||||
"INTEGRATION.CALL_NOT_FOUND": "ไม่พบระเบียนการเรียกใช้งานการผสานรวม",
|
||||
"INTEGRATION.BINDING_STEPS_INVALID": "การกำหนดค่าขั้นตอนการเชื่อมโยงไม่ถูกต้อง: steps_json จำเป็นต้องมีและเป็นอาร์เรย์ที่ไม่ว่าง โดยแต่ละรายการต้องเป็นออบเจกต์"
|
||||
}
|
||||
}
|
||||
@@ -177,7 +177,7 @@
|
||||
"identity_rule_set": "客户识别规则集",
|
||||
"identity_rule": "客户识别规则"
|
||||
}
|
||||
},
|
||||
, "syncConfirm": "将从 OA 同步合同与验收数据,只补全台账中的空字段,不会覆盖已有内容。是否继续?", "weeklySendConfirm": "将把本周待发送的付款预警汇总发给收件人。是否继续?", "scanAlertsConfirm": "将按当前付款计划扫描并生成待发送预警,不会立即发送。是否继续?"},
|
||||
"shippingOrderExtractionRuns": {
|
||||
"eyebrow": "只读运行诊断",
|
||||
"title": "识别任务",
|
||||
@@ -830,7 +830,7 @@
|
||||
"movementStandardField": "标准异动字段",
|
||||
"movementBindingLabel": "异动解析规则",
|
||||
"movementBindingNone": "未绑定",
|
||||
"movementBindingHint": "绑定已发布异动规则后,预检将复用已归档收料文件;未绑定时预检不会触发抓取(fail-closed)。",
|
||||
"movementBindingHint": "绑定已发布异动规则后,匹配将复用已归档收料文件;未绑定时匹配不会触发抓取(fail-closed)。",
|
||||
"movementFields": {
|
||||
"doc_no": "单号", "line_no": "项次", "in_out_flag": "进出库别", "material_code": "料号",
|
||||
"material_name": "品名", "warehouse_code": "仓库", "storage_code": "储位", "lot_no": "批号",
|
||||
@@ -2709,7 +2709,7 @@
|
||||
"platformJobAccountingVoucherPoPrint": "立账凭证 PO 订单生成",
|
||||
"accountingVoucherPoPrintHint": "每周二 05:00 按上月发票从 ERP 取数,生成制式采购单 PDF 并上传到「PO订单」目录;早于 06:00 检核周批。同名跳过。",
|
||||
"platformJobAccountingVoucherOaSalesRelease": "立账凭证销货放行单拉取",
|
||||
"accountingVoucherOaSalesReleaseHint": "每周二 05:30 从 E10 筛上月已归档销货放行单,下载表单 PDF 并上传到「销货单」目录;早于 06:00 检核周批。同名跳过。",
|
||||
"accountingVoucherOaSalesReleaseHint": "每周二 05:30 从 E10 筛上月已归档销货放行单,下载表单 PDF 并上传到「销货放行申请单」目录;早于 06:00 检核周批。同名跳过。",
|
||||
"voucherCheckScope": "账套",
|
||||
"voucherCheckProfile": "业务方 Profile",
|
||||
"voucherCheckNotifyMissing": "缺资料通知",
|
||||
@@ -5044,166 +5044,19 @@
|
||||
"deliveryDate": "交货期限",
|
||||
"timeline": "付款计划时间线",
|
||||
"notAvailable": "—",
|
||||
"stats": {
|
||||
"contracts": "合同总数",
|
||||
"pendingParse": "待处理合同",
|
||||
"readyPlans": "计划已生成",
|
||||
"alerts": "待预警节点"
|
||||
},
|
||||
"ledgerFocus": {
|
||||
"due": "即将到期",
|
||||
"dueHint": "7日内",
|
||||
"overdue": "逾期未付",
|
||||
"active": "进行中",
|
||||
"dueThisMonth": "本月应付",
|
||||
"dueThisMonthHint": "本自然月",
|
||||
"needsCompletion": "待补充"
|
||||
},
|
||||
"status": {
|
||||
"completed": "已完成",
|
||||
"needs_review": "待复核",
|
||||
"pending": "待解析"
|
||||
},
|
||||
"stateLabel": {
|
||||
"parsed": "已解析",
|
||||
"needs_review": "待复核",
|
||||
"pending": "待解析",
|
||||
"active": "已生效"
|
||||
},
|
||||
"nodeType": {
|
||||
"prepayment": "预付款",
|
||||
"shipment": "出货款",
|
||||
"acceptance": "验收款",
|
||||
"warranty": "质保款"
|
||||
},
|
||||
"stats": {"contracts": "合同总数", "pendingParse": "待处理合同", "readyPlans": "计划已生成", "alerts": "待预警节点"},
|
||||
"ledgerFocus": {"due": "即将到期", "dueHint": "7日内", "overdue": "逾期未付", "active": "未到期", "activeHint": "7日外", "dueThisMonth": "本月应付", "dueThisMonthHint": "本自然月"},
|
||||
"status": {"completed": "已完成", "needs_review": "待复核", "pending": "待解析"}, "stateLabel": {"parsed": "已解析", "needs_review": "待复核", "pending": "待解析", "active": "已生效"},
|
||||
"nodeType": {"prepayment": "预付款", "shipment": "出货款", "acceptance": "验收款", "warranty": "质保款"},
|
||||
"ruleConfirmed": "已确定",
|
||||
"prepaymentRule": "合同归档后第 7/14/21 天预警;请款以 OA 厂商预付款请款作业为准。",
|
||||
"shipmentRule": "交货期限前 7 天、到期日、到期后 14 天预警;请款以 OA 厂商预付款请款作业为准。",
|
||||
"acceptanceRule": "验收归档后第 30/40/60 天预警;质保款在质保到期前 7 天、到期日、到期后 14 天预警。",
|
||||
"pendingAlerts": "待处理预警",
|
||||
"processing": "已发起付款",
|
||||
"dataPending": "数据待确认",
|
||||
"paid": "已付款",
|
||||
"amountRatioDate": "金额 / 比例 · 日期",
|
||||
"applicant": "申请人",
|
||||
"statusLabel": "状态",
|
||||
"contractPrefix": "合同",
|
||||
"datePending": "待补充日期",
|
||||
"statusNormal": "正常",
|
||||
"statusNeedsCompletion": "待补充",
|
||||
"statusOverdue": "已逾期",
|
||||
"statusUpcoming": "即将到期",
|
||||
"statusActive": "进行中",
|
||||
"statusCompleted": "已完成",
|
||||
"totalPrefix": "共",
|
||||
"contractSupplier": "合同号 / 供应商",
|
||||
"nextAlert": "下一预警",
|
||||
"triggerBasis": "触发依据",
|
||||
"alertDate": "预警日期",
|
||||
"alertFirstRound": "首轮",
|
||||
"payDate": "付款日期",
|
||||
"processStatus": "处理状态",
|
||||
"owner": "采购负责人",
|
||||
"oaData": "OA 数据",
|
||||
"contractRule": "合同规则",
|
||||
"ownerDefault": "采购负责人",
|
||||
"workflowNo": "流程编号",
|
||||
"contractNoPending": "合同号待从附件解析",
|
||||
"synced": "已同步",
|
||||
"detailSubtitle": "OA 数据、付款节点与企业微信提醒记录",
|
||||
"backToOverview": "返回总览",
|
||||
"contractInfo": "OA 合同信息",
|
||||
"alertHistory": "预警记录",
|
||||
"alertRound": "第 {round} 次预警",
|
||||
"alertAudit": "预警发送记录",
|
||||
"alertAuditEmpty": "暂无预警记录",
|
||||
"alertNode": "付款节点",
|
||||
"alertScheduledAt": "计划日期",
|
||||
"alertSentAt": "发送时间",
|
||||
"alertStatus": {
|
||||
"pending": "待发送",
|
||||
"sent": "已发送",
|
||||
"failed": "发送失败"
|
||||
},
|
||||
"roundValue": "第 {round} 次",
|
||||
"weeklyBatchesTitle": "周汇总批次",
|
||||
"weeklyBatchesSubtitle": "查看按收件人生成的付款预警周汇总、Excel 附件及发送记录。",
|
||||
"weeklySend": "发送预警",
|
||||
"weeklyBatchSubmitted": "发送预警任务已提交",
|
||||
"weeklyBatchesLoadFailed": "加载周汇总批次失败",
|
||||
"batchNo": "批次号",
|
||||
"weekKey": "周次",
|
||||
"batchStatusLabel": "发送状态",
|
||||
"batchTotal": "汇总笔数",
|
||||
"batchExcel": "Excel 附件",
|
||||
"batchSentAt": "发送时间",
|
||||
"weeklyBatchesEmpty": "暂无周汇总批次",
|
||||
"weeklyPendingSummary": "本周待发送 {count} 笔 · 下次发送 {datetime}",
|
||||
"weeklyPendingCountOnly": "本周待发送 {count} 笔",
|
||||
"downloadExcel": "下载 Excel",
|
||||
"excelDownloadFailed": "下载预警附件失败",
|
||||
"batchStatus": {
|
||||
"pending": "待发送",
|
||||
"sent": "已发送",
|
||||
"failed": "发送失败",
|
||||
"processing": "处理中",
|
||||
"resolved": "已停止提醒"
|
||||
},
|
||||
"backToLedger": "返回",
|
||||
"detailLoadFailed": "加载合同详情失败",
|
||||
"detailLoading": "正在加载合同详情…",
|
||||
"detailOverview": "合同概览",
|
||||
"detailAttachments": "原文附件",
|
||||
"detailPaymentPlan": "付款计划",
|
||||
"detailAlertHistory": "预警记录",
|
||||
"archiveDate": "合同归档日期",
|
||||
"archiveDateHint": "该日期为合同申请单的归档日期",
|
||||
"parseStatus": "解析状态",
|
||||
"parseIssueTitle": "解析提示",
|
||||
"planStatus": "计划状态",
|
||||
"attachmentsEmpty": "暂无已归档的合同原文附件",
|
||||
"downloadAttachment": "下载附件",
|
||||
"attachmentDownloadFailed": "下载合同附件失败",
|
||||
"paymentPlanEmpty": "暂无可展示的付款计划",
|
||||
"anchorDate": "日期依据",
|
||||
"nodeStatus": {
|
||||
"pending": "待处理",
|
||||
"active": "进行中",
|
||||
"paid": "已付",
|
||||
"processing": "处理中",
|
||||
"resolved": "已停止提醒",
|
||||
"upcoming": "即将到期",
|
||||
"notStarted": "待起算",
|
||||
"overdue": "已逾期",
|
||||
"review": "待复核"
|
||||
},
|
||||
"reparse": "重新解析合同原文",
|
||||
"reparseSuccess": "已使用附件“{attachment}”重新解析",
|
||||
"reparseFailed": "重新解析合同失败",
|
||||
"reviewTitle": "待确认合同",
|
||||
"reviewSubtitle": "未匹配设备采购合同同义标题组、付款比例校验失败或关键字段冲突的合同不会进入付款预警,请下载原文核对。",
|
||||
"reviewSearchPlaceholder": "合同编号、采购编号或供应商",
|
||||
"reviewLoadFailed": "待确认合同加载失败",
|
||||
"reviewContractWorkflow": "合同号 / 流程编号",
|
||||
"reviewReason": "待确认原因",
|
||||
"reviewFallbackIssue": "解析结果待人工确认",
|
||||
"reviewEmpty": "暂无待确认合同"
|
||||
},
|
||||
"contractPaymentReview": {
|
||||
"title": "待确认合同",
|
||||
"subtitle": "未匹配设备采购合同同义标题组、付款比例校验失败或关键字段冲突的合同不会进入付款预警,请下载原文核对。",
|
||||
"searchPlaceholder": "合同编号、采购编号、供应商或申请人",
|
||||
"loadFailed": "待确认合同加载失败",
|
||||
"contractWorkflow": "合同号 / 流程编号",
|
||||
"reason": "待确认原因",
|
||||
"fallbackIssue": "解析结果待人工确认",
|
||||
"empty": "暂无待确认合同"
|
||||
},
|
||||
"contractPaymentReparse": {
|
||||
"action": "重新解析合同原文",
|
||||
"success": "已使用附件“{attachment}”重新解析",
|
||||
"failed": "重新解析合同失败"
|
||||
},
|
||||
"pendingAlerts": "待处理预警", "processing": "已发起付款", "dataPending": "数据待确认", "paid": "已付款", "stagePaid": "已付", "amountRatioDate": "金额 / 比例 · 日期", "applicant": "申请人", "company": "公司", "erpSchema": "付款账套", "statusLabel": "状态", "contractPrefix": "合同", "datePending": "待补充日期", "statusNormal": "正常", "statusNeedsCompletion": "待补充", "statusOverdue": "已逾期", "statusUpcoming": "即将到期", "statusActive": "未到期", "statusCompleted": "已完成",
|
||||
"totalPrefix": "共", "contractSupplier": "合同号 / 供应商", "nextAlert": "下一预警", "triggerBasis": "触发依据", "alertDate": "预警日期", "alertRuleHint": "每阶段按自然日提醒三轮,到日后并入最近的周五 18:00 汇总发送。没有对应日期则不提醒。\n预付款:合同归档日后第 7、14、21 天(页面显示首轮)\n出货款:交货期限前 7 天、当天、后 14 天\n验收款:验收单归档后第 30、40、60 天\n质保款:质保到期前 7 天、当天、后 14 天", "alertFirstRound": "首轮", "payDate": "付款日期", "markPaid": "标为已付", "markPaidTitle": "标为已付", "markPaidHint": "{stage} · {amount} / {percent}%。只标记这一阶段。尚未发送的预警会关闭,已经发出的记录保留。", "markPaidDate": "付款日期", "markPaidRemark": "说明(可选)", "markPaidRemarkPlaceholder": "例如:财务已确认付款,ERP 单号未对上", "markPaidConfirm": "确认已付", "markPaidSource": "来源:手动标记", "markPaidSuccess": "已标为已付", "markPaidFailed": "标记失败", "processStatus": "处理状态", "owner": "采购负责人", "oaData": "OA 数据", "contractRule": "合同规则", "ownerDefault": "采购负责人", "workflowNo": "合同申请单流程编号", "contractNoPending": "合同号待从附件解析", "synced": "已同步", "detailSubtitle": "OA 数据、付款节点与企业微信提醒记录", "backToOverview": "返回总览", "contractInfo": "OA 合同信息", "alertHistory": "预警记录", "alertRound": "第 {round} 次预警", "alertAudit": "预警发送记录", "alertAuditEmpty": "暂无预警记录", "alertNode": "付款节点", "alertScheduledAt": "计划日期", "alertSentAt": "发送时间", "alertStatus": {"pending": "待发送", "sent": "已发送", "failed": "发送失败"}, "roundValue": "第 {round} 次", "weeklyBatchesTitle": "周汇总批次", "weeklyBatchesSubtitle": "查看按收件人生成的付款预警周汇总、Excel 附件及发送记录。", "weeklySend": "发送预警", "weeklyBatchSubmitted": "发送预警任务已提交", "weeklyJobSent": "已发送 {sent} 个批次", "weeklyJobFailed": "{failed} 个批次发送失败,列表已更新,可点击失败图标查看原因", "weeklyJobPartial": "已发送 {sent} 个批次,另有 {failed} 个失败", "weeklyJobEmpty": "没有待发送的预警,批次记录不会变化", "weeklyJobTimeout": "发送任务仍在后台执行,请稍后重新打开本页查看", "weeklyJobError": "发送任务执行失败", "weeklyBatchesLoadFailed": "加载周汇总批次失败", "batchNo": "批次号", "weekKey": "周次", "batchStatusLabel": "发送状态", "batchFailureReason": "失败原因", "batchFailureReasonEmpty": "未记录具体失败原因", "batchFailureReasonAria": "查看发送失败原因", "batchFailureReasonLine": "{reason}:{detail}", "batchFailureReasonCode": {"notify_disabled": "企业微信通知未启用", "event_disabled": "合同付款预警通知事件未启用", "user_unbound": "收件人未绑定企业微信账号", "textcard_failed": "企业微信卡片发送失败", "file_upload_failed": "企业微信附件上传失败", "file_failed": "企业微信附件发送失败", "unknown": "发送失败"}, "batchTotal": "汇总笔数", "batchExcel": "Excel 附件", "batchSentAt": "发送时间", "weeklyBatchesEmpty": "暂无周汇总批次", "weeklyPendingSummary": "本周待发送 {count} 笔 · 下次发送 {datetime}", "weeklyPendingCountOnly": "本周待发送 {count} 笔", "downloadExcel": "下载 Excel", "excelDownloadFailed": "下载预警附件失败", "batchStatus": {"pending": "待发送", "sent": "已发送", "failed": "发送失败", "processing": "处理中", "resolved": "已停止提醒"}, "backToLedger": "返回", "detailLoadFailed": "加载合同详情失败", "detailLoading": "正在加载合同详情…", "detailOverview": "合同概览", "detailAttachments": "原文附件", "detailPaymentPlan": "付款计划", "detailAlertHistory": "预警记录", "archiveDate": "合同归档日期", "archiveDateHint": "该日期为合同申请单的归档日期", "parseStatus": "解析状态", "parseIssueTitle": "解析提示", "planStatus": "计划状态", "attachmentsEmpty": "暂无已归档的合同原文附件", "downloadAttachment": "下载附件", "previewAttachment": "预览", "attachmentPreviewFailed": "附件预览失败", "attachmentPreviewUnsupported": "该格式暂不支持在线预览,请下载后查看", "attachmentDownloadFailed": "下载合同附件失败", "paymentPlanEmpty": "暂无可展示的付款计划", "anchorDate": "日期依据", "nodeStatus": {"pending": "待处理", "active": "进行中", "paid": "已付", "processing": "处理中", "resolved": "已停止提醒", "upcoming": "即将到期", "notStarted": "待起算", "overdue": "已逾期", "review": "待复核", "notApplicable": "无此阶段"}, "reparse": "重新解析合同原文", "reparseSuccess": "已Line truncated
|
||||
, "syncConfirm": "将从 OA 同步合同与验收数据,只补全台账中的空字段,不会覆盖已有内容。是否继续?", "weeklySendConfirm": "将把本周待发送的付款预警汇总发给收件人。是否继续?", "scanAlertsConfirm": "将按当前付款计划扫描并生成待发送预警,不会立即发送。是否继续?"},
|
||||
"contractPaymentReview": {"title": "待确认合同", "subtitle": "未匹配设备采购合同同义标题组、付款比例校验失败或关键字段冲突的合同不会进入付款预警,请下载原文核对。", "searchPlaceholder": "合同编号、采购编号、供应商或申请人", "loadFailed": "待确认合同加载失败", "contractWorkflow": "合同号 / 合同申请单流程编号", "reason": "待确认原因", "fallbackIssue": "解析结果待人工确认", "empty": "暂无待确认合同", "manualTitle": "复核付款阶段", "manualSubtitle": "{supplier} · 采购单号 {purchaseOrder}。已识别的阶段已填入,可改。", "backToReview": "返回待确认", "confirmLedger": "确认进入台账", "confirmSuccess": "已进入合同台账", "issueTitle": "解析提示", "contractNoOptional": "合同编号(可空)", "contractNoPlaceholder": "附件未识别出合同号", "percentage": "比例 %", "stageAmount": "金额", "basisDate": "日期依据", "noStage": "无此阶段", "ruleIdentity": "采购单号和合同金额有效", "rulePercent": "启用阶段的比例合计为 100%,空比例不算 0", "ruleAmount": "每个启用阶段的金额等于合同金额乘以比例", "ruleDate": "预付款、出货款须填写日期依据", "hintPrepayment": "日期依据是合同归档日。正文写了定金或预付款比例时填在这里。", "hintShipment": "日期依据是交货期限。正文只有“收到定金后 N 天”时,请填写具体日期。", "hintAcceptance": "日期依据是验收单归档日。还没归档可以留空。", "hintWarranty": "没有质保款比例时勾选无此阶段。质保期不是付款比例。", "formLoadFailed": "复核表单加载失败", "submitFailed": "复核提交失败", "manualAction": "人工复核", "fillHintTitle": "填写提示"},
|
||||
"contractPaymentReparse": {"action": "重新解析合同原文", "success": "已使用附件“{attachment}”重新解析", "failed": "重新解析合同失败"},
|
||||
"procurementContract": {
|
||||
"title": "采购合同审查",
|
||||
"subtitle": "维护标准合同模板、风险红线规则并查看审查历史",
|
||||
@@ -5564,7 +5417,8 @@
|
||||
"interface": "接口定义",
|
||||
"binding": "绑定",
|
||||
"credential": "凭据引用",
|
||||
"capability": "能力清单"
|
||||
"capability": "能力清单",
|
||||
"calls": "调用日志"
|
||||
},
|
||||
"statusLabels": {
|
||||
"draft": "草稿",
|
||||
@@ -5615,7 +5469,7 @@
|
||||
"environment": "环境",
|
||||
"status": "状态",
|
||||
"clientInstance": "客户端实例",
|
||||
"interfaceDef": "接口定义",
|
||||
"interfaceDef": "接口步骤(有序)",
|
||||
"secretRef": "Secret 引用",
|
||||
"secretProvider": "来源",
|
||||
"account": "账号",
|
||||
@@ -5630,6 +5484,7 @@
|
||||
"code": "编码",
|
||||
"name": "名称",
|
||||
"connectorType": "连接器类型",
|
||||
"dbKind": "数据库类型(db_kind)",
|
||||
"environment": "环境",
|
||||
"credentialRef": "凭据引用编码",
|
||||
"configJson": "连接配置 JSON(接口地址/超时/默认 org 等)",
|
||||
@@ -5651,9 +5506,6 @@
|
||||
"effectiveTo": "生效结束",
|
||||
"contextSelector": "高级路由条件 JSON",
|
||||
"contextSelectorHint": "键值对须全部包含于调用上下文才会命中;当前版本调用方不传路由上下文,留空即为默认绑定。",
|
||||
"paramMapping": "参数映射 JSON",
|
||||
"paramMappingHint": "域参数到接口参数的翻译规则(如 erp_org→organization、condition 模板);留空=同名直通。",
|
||||
"bindingClientHint": "随所选接口定义自动带出并锁定,不可单独修改。",
|
||||
"secretRef": "Secret 引用键",
|
||||
"secretProvider": "Secret 来源",
|
||||
"credentialType": "凭据类型",
|
||||
@@ -5681,7 +5533,8 @@
|
||||
"msg": {
|
||||
"fillClient": "请填写名称",
|
||||
"fillInterface": "请选择客户端实例(编码可自动生成)",
|
||||
"fillBinding": "请填写能力、客户端实例与接口定义",
|
||||
"fillBinding": "请填写能力,并至少添加一个步骤(每步选择接口定义)",
|
||||
"fillDbKind": "请选择数据库类型(MySQL / Oracle / SQL Server / PostgreSQL)",
|
||||
"fillCredential": "请填写编码与 Secret 引用",
|
||||
"fillCredentialDb": "请填写编码,以及必填凭据字段:{fields}",
|
||||
"credentialTypeMissing": "凭据类型清单未加载,请刷新页面后重试",
|
||||
@@ -5716,7 +5569,8 @@
|
||||
"endpoint": "https://erp-api.example.com/ws",
|
||||
"wsdl": "https://erp-api.example.com/wsdl",
|
||||
"requestPath": "路径支持占位符,如 /transfer/xxx",
|
||||
"passwordKeep": "留空则保持原密码不变"
|
||||
"passwordKeep": "留空则保持原密码不变",
|
||||
"database": "erp-host:1521/ORCL 或 127.0.0.1:3306/dbname"
|
||||
},
|
||||
"advancedConfig": "高级配置(JSON)",
|
||||
"formatJson": "格式化",
|
||||
@@ -5737,7 +5591,70 @@
|
||||
},
|
||||
"connectorTypes": {
|
||||
"rest": "REST API",
|
||||
"soap": "SOAP 服务"
|
||||
"soap": "SOAP 服务",
|
||||
"database": "数据库直连"
|
||||
},
|
||||
"connectorDbKind": {
|
||||
"mysql": "MySQL",
|
||||
"oracle": "Oracle",
|
||||
"sqlserver": "SQL Server",
|
||||
"postgresql": "PostgreSQL"
|
||||
},
|
||||
"endpointLabel": {
|
||||
"database": "数据库连接串(host:port/service 或 /database)"
|
||||
},
|
||||
"bindingSteps": {
|
||||
"label": "执行步骤(有序)",
|
||||
"add": "添加步骤",
|
||||
"remove": "删除步骤",
|
||||
"moveUp": "上移",
|
||||
"moveDown": "下移",
|
||||
"interface": "接口定义",
|
||||
"paramMapping": "步骤 {index} 参数映射 JSON",
|
||||
"clientHint": "客户端实例由该步接口归属自动确定:{client}",
|
||||
"hint": "步骤按数组顺序执行;每步可配置独立的参数映射,客户端实例由各步接口归属自带。"
|
||||
},
|
||||
"callLogs": {
|
||||
"title": "调用记录",
|
||||
"filterInterface": "接口编码",
|
||||
"filterClient": "客户端编码",
|
||||
"filterConnector": "连接类型",
|
||||
"filterStatus": "状态",
|
||||
"filterOperationId": "operation_id",
|
||||
"filterTraceId": "trace_id",
|
||||
"filterBusinessRef": "业务单号",
|
||||
"filterKeyword": "参数关键字(模糊搜请求内容)",
|
||||
"dateFrom": "执行时间起",
|
||||
"dateTo": "执行时间止",
|
||||
"query": "查询",
|
||||
"reset": "重置",
|
||||
"colTime": "时间",
|
||||
"colCapability": "能力",
|
||||
"colInterface": "接口",
|
||||
"colRef": "单号",
|
||||
"colStep": "步骤",
|
||||
"colStatus": "状态",
|
||||
"colElapsed": "耗时",
|
||||
"detailTitle": "调用详情",
|
||||
"timeline": "步骤时间线",
|
||||
"request": "请求",
|
||||
"response": "响应",
|
||||
"wire": "线级请求(wire)",
|
||||
"rawPayload": "原始报文",
|
||||
"normalized": "业务参数(归一化)",
|
||||
"normalizedJson": "归一化 JSON",
|
||||
"copyBody": "复制 body",
|
||||
"copyCurl": "复制 curl",
|
||||
"copySql": "复制 SQL",
|
||||
"copyRaw": "复制原始报文",
|
||||
"copyJson": "复制 JSON",
|
||||
"copyOperationId": "复制 operation_id",
|
||||
"copyTraceId": "复制 trace_id",
|
||||
"copied": "已复制",
|
||||
"noWire": "无线级详情(历史记录)",
|
||||
"sqlWriteWarning": "⚠ 写入语句:请确认目标环境后再执行",
|
||||
"prevPage": "上一页",
|
||||
"nextPage": "下一页"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3777,19 +3777,21 @@
|
||||
"stageFileReady": "文件就绪",
|
||||
"stageWaitingRpa": "RPA 抓取中",
|
||||
"stageFailed": "失败",
|
||||
"precheckTitle": "调拨预检",
|
||||
"matchTitle": "可调拨清单",
|
||||
"businessDate": "业务日期",
|
||||
"executableCount": "可执行",
|
||||
"notMaturedCount": "当天收料",
|
||||
"blockedCount": "阻断",
|
||||
"estimatedQuantity": "预计调拨数量",
|
||||
"estimatedExternalWrites": "预计 ERP 单据",
|
||||
"pendingStockCheckCount": "待查库存",
|
||||
"invalidRowCount": "已失效 {count} 行",
|
||||
"reasonQuantityMismatch": "ERP 账面库存数量与收料数量不一致",
|
||||
"reasonInventoryNotFound": "ERP 无此批号的库存记录,库存按 0 展示",
|
||||
"reasonExternalQueryFailed": "外部系统查询失败",
|
||||
"reasonFutureDate": "收料日期晚于业务日期",
|
||||
"selectedCount": "已选 {count} 张",
|
||||
"generateTransfer": "直接生成调拨单",
|
||||
"generateTransfer": "生成调拨单",
|
||||
"colSource": "收料来源",
|
||||
"colMaterial": "料号",
|
||||
"colName": "品名",
|
||||
@@ -3798,21 +3800,27 @@
|
||||
"colReceiptDate": "收料日期",
|
||||
"colFromWarehouse": "拨出仓库",
|
||||
"colFromQty": "库存数量",
|
||||
"stockCheckedAtTitle": "库存查询时刻:{time}",
|
||||
"colToWarehouse": "拨入仓库",
|
||||
"colFromBatch": "拨出批号",
|
||||
"filterPlaceholder": "按料号 / 品名 / Invoice / 批号筛选",
|
||||
"filterAll": "全部结果",
|
||||
"requerySelected": "重查选中 ERP 库存",
|
||||
"requerySelected": "重查选中",
|
||||
"receiptDateLabel": "收料日期",
|
||||
"receiptDateTo": "收料日期止",
|
||||
"receiptDateHint": "截止不超出 D+1 规则(业务日期前一天)",
|
||||
"receiptDateHint": "默认为 D+1 规则日期(业务日期前一天,即可匹配截止日);截止不超出该日,起始不得晚于截止",
|
||||
"requeryRow": "重查",
|
||||
"colToQty": "拨入数量",
|
||||
"colResult": "预检结果",
|
||||
"colResult": "匹配结果",
|
||||
"resultExecutable": "可执行",
|
||||
"resultNotMatured": "当天收料",
|
||||
"resultBlocked": "已阻断",
|
||||
"resultUnknown": "结果未知",
|
||||
"resultFileRemoved": "文件已移除",
|
||||
"resultPendingStockCheck": "待查库存",
|
||||
"staleRow": "数据已过期,请重查",
|
||||
"fileChangedRow": "文件已更新,将自动对齐",
|
||||
"fileRemovedQuarantined": "另有 {count} 行已随收料文件移除而失效,已移出本清单;请到「待处理异常」处理,可标记无需继续处理。",
|
||||
"runProgress": "调拨执行进度",
|
||||
"runExecuting": "执行中",
|
||||
"runSuccess": "已完成",
|
||||
@@ -3827,12 +3835,22 @@
|
||||
"exceptionsTitle": "未生成 ERP 单据",
|
||||
"exceptionBusinessFailed": "业务失败",
|
||||
"exceptionTechnicalFailed": "技术失败",
|
||||
"exceptionPrecheckExpired": "预检失效",
|
||||
"exceptionMatchExpired": "匹配已失效",
|
||||
"downloadReceiptFiles": "下载收料来源文件",
|
||||
"downloadErpInventory": "下载 ERP 库存表",
|
||||
"downloadExceptions": "下载异常 Excel",
|
||||
"backlogTitle": "待处理异常",
|
||||
"retryErp": "重新查询 ERP",
|
||||
"resumeAction": "恢复处理",
|
||||
"colAging": "老化",
|
||||
"colAction": "操作",
|
||||
"selectedRows": "已选 {count} 行",
|
||||
"clearSelection": "取消选择",
|
||||
"receiptDateInvalid": "起始日期不得晚于截止日期",
|
||||
"toastRequeryDone": "重查完成:{ok} 行已更新,{failed} 行失败",
|
||||
"toastRequeryRecovered": "恢复完成:{recovered} 笔已可执行 · {blocked} 笔仍阻断",
|
||||
"toastExecuteFileChanged": "{count} 笔文件已更新,请重新匹配",
|
||||
"toastCloseDone": "关闭完成:{ok} 行成功,{failed} 行失败",
|
||||
"batchCloseTitle": "标记无需继续处理({count} 项)",
|
||||
"manualClose": "标记无需继续处理",
|
||||
"manualCloseTitle": "标记无需继续处理",
|
||||
"manualCloseHint": "关闭后自动排程不再处理;历史与审计永久保留。",
|
||||
@@ -3855,20 +3873,20 @@
|
||||
"hub_to_hub": "HUB仓间调拨"
|
||||
},
|
||||
"transferTypeComingSoon": "即将上线",
|
||||
"precheckParams": "预检参数",
|
||||
"matchParams": "匹配参数",
|
||||
"selectAll": "本组全选",
|
||||
"selectEnabledAll": "全选已启用",
|
||||
"clearSources": "清空选择",
|
||||
"selectedSourceCount": "已选 {count} 个来源实例",
|
||||
"needSelectSource": "请至少选择一个已启用来源实例",
|
||||
"confirmScopeAndPrecheck": "确认范围并预检",
|
||||
"confirmScopeAndMatch": "确认范围并匹配",
|
||||
"homeWelcome": "你好,您已进入",
|
||||
"homeTodayLabel": "今日待办",
|
||||
"homeTodayAction": "发起今日调拨预检",
|
||||
"homeTodayAction": "匹配可调拨库存",
|
||||
"homeTodayHint": "选择来源实例后,系统默认以昨天为业务日期处理可成熟收料。",
|
||||
"homeHistoryLabel": "历史待办",
|
||||
"homeRecoverable": "可恢复异常",
|
||||
"homeRecoverableHint": "可重新查询 ERP 库存后继续处理",
|
||||
"homeRecoverable": "待恢复异常",
|
||||
"homeRecoverableHint": "可重查库存或一键恢复处理",
|
||||
"homeClosed": "已人工关闭",
|
||||
"homeClosedHint": "可查看原因并恢复处理",
|
||||
"homeUnknown": "结果未知",
|
||||
@@ -3888,6 +3906,91 @@
|
||||
"batchRetry": "批量重试 RPA",
|
||||
"downloadFiles": "下载收料文件",
|
||||
"selectedRetryableCount": "其中 {count} 个可重试",
|
||||
"noRetryable": "所选来源均无需重试(已就绪或抓取中)"
|
||||
"noRetryable": "所选来源均无需重试(已就绪或抓取中)",
|
||||
"homeMatchLabel": "库存匹配",
|
||||
"homeBoardLabel": "待办看板",
|
||||
"homeExecutable": "可调拨明细",
|
||||
"homeExecutableHint": "勾选后按行生成调拨单",
|
||||
"executableTitle": "可调拨明细",
|
||||
"executableEmpty": "暂无可调拨明细",
|
||||
"executableSelectedCount": "已选 {count} 笔可执行明细",
|
||||
"runTitle": "调拨单生成",
|
||||
"runBadge": {
|
||||
"queued": "排队中",
|
||||
"executing": "执行中",
|
||||
"success": "成功",
|
||||
"partialFailed": "部分失败",
|
||||
"failed": "失败"
|
||||
},
|
||||
"orderStatus": {
|
||||
"pending": "待处理",
|
||||
"executing": "执行中",
|
||||
"success": "成功",
|
||||
"resultUnknown": "结果未知",
|
||||
"failed": "失败",
|
||||
"cancelled": "已关闭"
|
||||
},
|
||||
"orderAction": {
|
||||
"retrigger": "重新触发",
|
||||
"retry": "重试",
|
||||
"retryAccepted": "调拨单 {docNo} 已重新提交执行,进度将自动刷新。",
|
||||
"retryPartial": "重查完成:{ready} 行可执行、{blocked} 行仍阻断已留恢复池。",
|
||||
"closeOrder": "关闭调拨单"
|
||||
},
|
||||
"orderReasonPrefix": "原因:{reason}",
|
||||
"poll": {
|
||||
"connecting": "连接中…"
|
||||
},
|
||||
"execute": {
|
||||
"accepted": "已提交,执行排队中,进度将在下方更新。",
|
||||
"noSelection": "请至少选择一个可执行明细行"
|
||||
},
|
||||
"retriggerDialog": {
|
||||
"title": "重新触发 {docNo}",
|
||||
"body": "将复用本单原单号与提交时间戳,只重新触发末步(幂等安全,不会重复建单)。",
|
||||
"confirm": "确认重新触发",
|
||||
"dismiss": "返回"
|
||||
},
|
||||
"orderClose": {
|
||||
"title": "关闭调拨单 {docNo}",
|
||||
"impactHint": "本票 {count} 行明细将随关闭脱离并回到待执行池(可重新勾选组建新票):",
|
||||
"redline": "关闭调拨单≠ERP 无单据:关闭前必须人工到 ERP 确认无对应单据。",
|
||||
"reasonPlaceholder": "关闭原因(必填)",
|
||||
"confirm": "确认关闭",
|
||||
"dismiss": "返回"
|
||||
},
|
||||
"toastOrderClosed": "调拨单已关闭,行已回到待执行池",
|
||||
"toastRetriggerAccepted": "已重新触发,正在排队执行末步",
|
||||
"homeExecuted": {
|
||||
"title": "已执行调拨单",
|
||||
"refresh": "刷新",
|
||||
"empty": "暂无已执行调拨单",
|
||||
"pageInfo": "共 {total} 张 · 第 {page} 页",
|
||||
"back": "返回",
|
||||
"all": "全部",
|
||||
"groupHint": {
|
||||
"success": "ERP 单号已回写,可查看明细",
|
||||
"failed": "可重查库存或人工关票",
|
||||
"executing": "正在写中间表/触发 ERP 建单",
|
||||
"resultUnknown": "只读,需线下核实 ERP"
|
||||
},
|
||||
"dateFrom": "开始日期",
|
||||
"dateTo": "结束日期",
|
||||
"group": {
|
||||
"success": "成功",
|
||||
"failed": "失败",
|
||||
"executing": "执行中",
|
||||
"resultUnknown": "结果未知"
|
||||
},
|
||||
"closeDialog": {
|
||||
"title": "关闭调拨单 {docNo}",
|
||||
"reasonRequired": "关闭原因(必填)",
|
||||
"redlineWhole": "关闭将作废整张调拨单(含未成行),操作不可撤销。",
|
||||
"redlineResidue": "ERP 可能已写入的行不会被自动删除,残留行需按 SOP 人工核对。",
|
||||
"redlineReopen": "单内全部明细将脱离本单回到待执行池,可重新勾选组建新票。",
|
||||
"redlineErpCheck": "关闭调拨单≠ERP 无单据:关闭前必须人工到 ERP 确认无对应单据。",
|
||||
"confirm": "确认关闭"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,6 +150,7 @@
|
||||
"CHAT.USER_ATTACHMENTS_LIMIT_EXCEEDED": "附件数量超过上限(最多 200 个),请减少后重试。",
|
||||
"CONTRACT_PAYMENT_FORBIDDEN": "你没有合同付款预警的访问权限。",
|
||||
"CONTRACT_PAYMENT_ADMIN_REQUIRED": "仅管理员可执行合同付款预警的同步、扫描或发送操作。",
|
||||
"CONTRACT_PAYMENT_ATTACHMENT_UNAVAILABLE": "合同原文已被清理,且无法从原系统重新下载。请先同步 OA 数据后再试。",
|
||||
"VOUCHER_CHECK_FORBIDDEN": "你没有立账凭证检核的访问权限。",
|
||||
"VOUCHER_CHECK_ADMIN_REQUIRED": "仅管理员可强制重检或修改立账凭证通知配置。",
|
||||
"SHIPPING_TASK_SELECTION_INVALID": "请选择 1 到 100 个发货任务。",
|
||||
@@ -559,8 +560,8 @@
|
||||
"TRANSFER_INVOICE_CONFLICT": "同一 Invoice 存在冲突(多料号或多日期)。",
|
||||
"TRANSFER_QUANTITY_MISMATCH": "收料数量与 ERP 库存不相等,已阻断。",
|
||||
"TRANSFER_ERP_INVENTORY_NOT_FOUND": "ERP 未找到该 Invoice 库存。",
|
||||
"TRANSFER_PRECHECK_EXPIRED": "预检已过期或快照变化,请重新预检。",
|
||||
"TRANSFER_CONFIRMATION_REQUIRED": "预检未就绪,无法执行。",
|
||||
"TRANSFER_MATCH_EXPIRED": "匹配已过期或快照变化,请重新匹配。",
|
||||
"TRANSFER_CONFIRMATION_REQUIRED": "匹配未就绪,无法执行。",
|
||||
"TRANSFER_DUPLICATE_NOT_VERIFIED": "重复 Invoice 无法证明原单已过账。",
|
||||
"TRANSFER_RESULT_UNKNOWN": "ERP 结果未知,只读,请按人工核实 SOP 处理。",
|
||||
"TRANSFER_MANUAL_CLOSE_REASON_REQUIRED": "人工关闭必须填写原因。",
|
||||
@@ -570,8 +571,19 @@
|
||||
"TRANSFER.ROUTE_NOT_RESOLVED": "来源实例路由归属未配置。",
|
||||
"TRANSFER.EXTERNAL_NOT_FROZEN": "外部系统契约未冻结,禁止调用。",
|
||||
"TRANSFER.EXTERNAL_QUERY_TIMEOUT": "外部系统查询超时,请重试。",
|
||||
"TRANSFER.PRECHECK_ALREADY_EXECUTED": "该预检已执行,请勿重复提交。",
|
||||
"TRANSFER.SELECTION_INVALID": "选择范围包含不可执行 Invoice。",
|
||||
"TRANSFER.INVALID_STATE_TRANSITION": "非法状态转换。"
|
||||
"TRANSFER.INVALID_STATE_TRANSITION": "非法状态转换。",
|
||||
"TRANSFER.BATCH_ITEMS_REQUIRED": "请提供要操作的明细行。",
|
||||
"TRANSFER.EXECUTE_ITEMS_INVALID": "部分明细行不存在或不可执行,请刷新后重试。",
|
||||
"TRANSFER.ITEMS_STALE": "部分明细行匹配结果已过期,请重新匹配。",
|
||||
"TRANSFER.FILE_CHANGED": "收料文件已更新,请重新匹配后再执行。",
|
||||
"TRANSFER.ORG_REQUIRED": "外部组织代码不能为空。",
|
||||
"TRANSFER.RETRIGGER_NOT_ALLOWED": "仅结果未知(result_unknown)票允许重新触发;禁止关闭后重建。",
|
||||
"TRANSFER.RETRY_NOT_ALLOWED": "该行已随文件移除,无法重查;请标记无需继续处理或等待文件重新同步。",
|
||||
"TRANSFER.DOCUMENT_CLOSE_NOT_ALLOWED": "仅失败票(业务拒绝/技术失败)允许关闭;结果未知票请使用「重新触发」,执行中的票不可关闭。",
|
||||
"TRANSFER.DOCUMENT_NOT_FOUND": "调拨票不存在。",
|
||||
"INTEGRATION.BINDING_LEGACY_PUT_REJECTED": "旧单步字段会截断该绑定的多步配方,请改用 steps_json 提交有序步骤。",
|
||||
"INTEGRATION.CALL_NOT_FOUND": "集成调用记录不存在。",
|
||||
"INTEGRATION.BINDING_STEPS_INVALID": "绑定步骤配置不合法:steps_json 必填且为非空数组,每项须为对象。"
|
||||
}
|
||||
}
|
||||
@@ -702,7 +702,7 @@
|
||||
"movementStandardField": "標準異動欄位",
|
||||
"movementBindingLabel": "異動解析規則",
|
||||
"movementBindingNone": "未綁定",
|
||||
"movementBindingHint": "綁定已發布異動規則後,預檢將複用已歸檔收料文件;未綁定時預檢不會觸發抓取(fail-closed)。",
|
||||
"movementBindingHint": "綁定已發布異動規則後,匹配將複用已歸檔收料文件;未綁定時匹配不會觸發抓取(fail-closed)。",
|
||||
"movementFields": {
|
||||
"doc_no": "單號", "line_no": "項次", "in_out_flag": "進出庫別", "material_code": "料號",
|
||||
"material_name": "品名", "warehouse_code": "倉庫", "storage_code": "儲位", "lot_no": "批號",
|
||||
@@ -2476,7 +2476,7 @@
|
||||
"platformJobAccountingVoucherPoPrint": "立帳憑證 PO 訂單產生",
|
||||
"accountingVoucherPoPrintHint": "每週二 05:00 依上月發票從 ERP 取數,產生制式採購單 PDF 並上傳到「PO訂單」目錄;早於 06:00 檢核週批。同名略過。",
|
||||
"platformJobAccountingVoucherOaSalesRelease": "立帳憑證銷貨放行單拉取",
|
||||
"accountingVoucherOaSalesReleaseHint": "每週二 05:30 從 E10 篩上月已歸檔銷貨放行單,下載表單 PDF 並上傳到「銷貨單」目錄;早於 06:00 檢核週批。同名略過。",
|
||||
"accountingVoucherOaSalesReleaseHint": "每週二 05:30 從 E10 篩上月已歸檔銷貨放行單,下載表單 PDF 並上傳到「銷貨放行申請單」目錄;早於 06:00 檢核週批。同名略過。",
|
||||
"voucherCheckScope": "帳套",
|
||||
"voucherCheckProfile": "業務方 Profile",
|
||||
"voucherCheckNotifyMissing": "缺資料通知",
|
||||
@@ -5019,191 +5019,11 @@
|
||||
}
|
||||
},
|
||||
"contractPayment": {
|
||||
"title": "合約付款預警",
|
||||
"subtitle": "同步 OA 合約、驗收和廠商預付款請款作業,按三輪規則通知採購職位",
|
||||
"sync": "同步 OA 資料",
|
||||
"forceSync": "強制覆蓋 OA 欄位",
|
||||
"forceSyncConfirm": "將以本次 OA 回傳的非空欄位覆蓋既有 OA 資料,並記錄變更稽核。是否繼續?",
|
||||
"reparseExisting": "批量重新解析既有合約",
|
||||
"reparseExistingConfirm": "將使用已歸檔的合約附件依目前規則更新所有既有合約的解析結果,不會同步或覆蓋 OA 欄位。是否繼續?",
|
||||
"scanAlerts": "掃描產生預警",
|
||||
"jobSubmitted": "工作已提交",
|
||||
"actionFailed": "操作失敗",
|
||||
"loadFailed": "載入合約失敗",
|
||||
"searchPlaceholder": "搜尋合約編號、採購單號、供應商或申請人",
|
||||
"allStatus": "全部",
|
||||
"search": "查詢",
|
||||
"ledger": "合約台帳",
|
||||
"items": "筆",
|
||||
"empty": "暫無合約資料",
|
||||
"purchaseOrder": "採購單號",
|
||||
"supplier": "供應商",
|
||||
"amount": "合約金額",
|
||||
"deliveryDate": "交貨期限",
|
||||
"timeline": "付款計畫時間線",
|
||||
"notAvailable": "—",
|
||||
"stats": {
|
||||
"contracts": "合約總數",
|
||||
"pendingParse": "待處理合約",
|
||||
"readyPlans": "計畫已產生",
|
||||
"alerts": "待預警節點"
|
||||
},
|
||||
"ledgerFocus": {
|
||||
"due": "即將到期",
|
||||
"dueHint": "7日內",
|
||||
"overdue": "逾期未付",
|
||||
"needsCompletion": "待補充",
|
||||
"dueThisMonth": "本月應付",
|
||||
"dueThisMonthHint": "本自然月",
|
||||
"active": "進行中"
|
||||
},
|
||||
"status": {
|
||||
"completed": "已完成",
|
||||
"needs_review": "待覆核",
|
||||
"pending": "待解析"
|
||||
},
|
||||
"stateLabel": {
|
||||
"parsed": "已解析",
|
||||
"needs_review": "待複核",
|
||||
"pending": "待解析",
|
||||
"active": "已生效"
|
||||
},
|
||||
"nodeType": {
|
||||
"prepayment": "預付款",
|
||||
"shipment": "出貨款",
|
||||
"acceptance": "驗收款",
|
||||
"warranty": "質保款"
|
||||
},
|
||||
"ruleConfirmed": "已確定",
|
||||
"prepaymentRule": "合約歸檔後第 7/14/21 天預警;請款以 OA 廠商預付款請款作業為準。",
|
||||
"shipmentRule": "交貨期限前 7 天、到期日、到期後 14 天預警;請款以 OA 廠商預付款請款作業為準。",
|
||||
"acceptanceRule": "驗收歸檔後第 30/40/60 天預警;質保款在質保到期前 7 天、到期日、到期後 14 天預警。",
|
||||
"pendingAlerts": "待處理預警",
|
||||
"processing": "已發起付款",
|
||||
"dataPending": "資料待確認",
|
||||
"paid": "已付款",
|
||||
"amountRatioDate": "金額 / 比例 · 日期",
|
||||
"applicant": "申請人",
|
||||
"statusLabel": "狀態",
|
||||
"contractPrefix": "合約",
|
||||
"datePending": "待補充日期",
|
||||
"statusNormal": "正常",
|
||||
"statusNeedsCompletion": "待補充",
|
||||
"statusOverdue": "已逾期",
|
||||
"statusUpcoming": "即將到期",
|
||||
"statusActive": "進行中",
|
||||
"statusCompleted": "已完成",
|
||||
"totalPrefix": "共",
|
||||
"contractSupplier": "合約號 / 供應商",
|
||||
"nextAlert": "下一預警",
|
||||
"triggerBasis": "觸發依據",
|
||||
"alertDate": "預警日期",
|
||||
"alertFirstRound": "首輪",
|
||||
"payDate": "付款日期",
|
||||
"processStatus": "處理狀態",
|
||||
"owner": "採購負責人",
|
||||
"oaData": "OA 資料",
|
||||
"contractRule": "合約規則",
|
||||
"ownerDefault": "採購負責人",
|
||||
"workflowNo": "流程編號",
|
||||
"contractNoPending": "合約號待從附件解析",
|
||||
"synced": "已同步",
|
||||
"detailSubtitle": "OA 資料、付款節點與企業微信提醒記錄",
|
||||
"backToOverview": "返回總覽",
|
||||
"contractInfo": "OA 合約資訊",
|
||||
"alertHistory": "預警記錄",
|
||||
"alertRound": "第 {round} 次預警",
|
||||
"alertAudit": "預警發送記錄",
|
||||
"alertAuditEmpty": "暫無預警記錄",
|
||||
"alertNode": "付款節點",
|
||||
"alertScheduledAt": "計畫日期",
|
||||
"alertSentAt": "發送時間",
|
||||
"alertStatus": {
|
||||
"pending": "待發送",
|
||||
"sent": "已發送",
|
||||
"failed": "發送失敗"
|
||||
},
|
||||
"roundValue": "第 {round} 次",
|
||||
"weeklyBatchesTitle": "週彙總批次",
|
||||
"weeklyBatchesSubtitle": "查看依收件人產生的付款預警週彙總、Excel 附件與發送記錄。",
|
||||
"weeklySend": "傳送預警",
|
||||
"weeklyBatchSubmitted": "發送預警任務已提交",
|
||||
"weeklyBatchesLoadFailed": "載入週彙總批次失敗",
|
||||
"batchNo": "批次號",
|
||||
"weekKey": "週次",
|
||||
"batchStatusLabel": "發送狀態",
|
||||
"batchTotal": "彙總筆數",
|
||||
"batchExcel": "Excel 附件",
|
||||
"batchSentAt": "發送時間",
|
||||
"weeklyBatchesEmpty": "暫無週彙總批次",
|
||||
"weeklyPendingSummary": "本週待發送 {count} 筆 · 下次發送 {datetime}",
|
||||
"weeklyPendingCountOnly": "本週待發送 {count} 筆",
|
||||
"downloadExcel": "下載 Excel",
|
||||
"excelDownloadFailed": "下載預警附件失敗",
|
||||
"batchStatus": {
|
||||
"pending": "待發送",
|
||||
"sent": "已發送",
|
||||
"failed": "發送失敗",
|
||||
"processing": "處理中",
|
||||
"resolved": "已停止提醒"
|
||||
},
|
||||
"backToLedger": "返回",
|
||||
"detailLoadFailed": "載入合約詳情失敗",
|
||||
"detailLoading": "正在載入合約詳情…",
|
||||
"detailOverview": "合約概覽",
|
||||
"detailAttachments": "原文附件",
|
||||
"detailPaymentPlan": "付款計畫",
|
||||
"detailAlertHistory": "預警記錄",
|
||||
"archiveDate": "合約歸檔日期",
|
||||
"archiveDateHint": "該日期為合約申請單的歸檔日期",
|
||||
"parseStatus": "解析狀態",
|
||||
"parseIssueTitle": "解析提示",
|
||||
"planStatus": "計畫狀態",
|
||||
"attachmentsEmpty": "暫無已歸檔的合約原文附件",
|
||||
"downloadAttachment": "下載附件",
|
||||
"attachmentDownloadFailed": "下載合約附件失敗",
|
||||
"paymentPlanEmpty": "暫無可展示的付款計畫",
|
||||
"anchorDate": "日期依據",
|
||||
"nodeStatus": {
|
||||
"pending": "待處理",
|
||||
"active": "進行中",
|
||||
"paid": "已付",
|
||||
"processing": "處理中",
|
||||
"resolved": "已停止提醒",
|
||||
"upcoming": "即將到期",
|
||||
"notStarted": "待起算",
|
||||
"overdue": "已逾期",
|
||||
"review": "待複核"
|
||||
},
|
||||
"sessionHint": "本期不使用對話和歷史會話,請從上方 Tab 查看台帳。",
|
||||
"moreActions": "更多",
|
||||
"reparse": "重新解析合同原文",
|
||||
"reparseSuccess": "已使用附件“{attachment}”重新解析",
|
||||
"reparseFailed": "重新解析合同失败",
|
||||
"reviewTitle": "待确认合同",
|
||||
"reviewSubtitle": "未匹配设备采购合同同义标题组、付款比例校验失败或关键字段冲突的合同不会进入付款预警,请下载原文核对。",
|
||||
"reviewSearchPlaceholder": "合同编号、采购编号或供应商",
|
||||
"reviewLoadFailed": "待确认合同加载失败",
|
||||
"reviewContractWorkflow": "合同号 / 流程编号",
|
||||
"reviewReason": "待确认原因",
|
||||
"reviewFallbackIssue": "解析结果待人工确认",
|
||||
"reviewEmpty": "暂无待确认合同"
|
||||
},
|
||||
"contractPaymentReview": {
|
||||
"title": "待確認合約",
|
||||
"subtitle": "未符合設備採購合約同義標題組、付款比例驗證失敗或關鍵欄位衝突的合約,不會進入付款預警,請下載原文核對。",
|
||||
"searchPlaceholder": "合約編號、採購單號或供應商",
|
||||
"loadFailed": "待確認合約載入失敗",
|
||||
"contractWorkflow": "合約號 / 流程編號",
|
||||
"reason": "待確認原因",
|
||||
"fallbackIssue": "解析結果待人工確認",
|
||||
"empty": "暫無待確認合約"
|
||||
},
|
||||
"contractPaymentReparse": {
|
||||
"action": "重新解析合約原文",
|
||||
"success": "已使用附件“{attachment}”重新解析",
|
||||
"failed": "重新解析合約失敗"
|
||||
},
|
||||
"title": "合約付款預警", "subtitle": "同步 OA 合約、驗收和廠商預付款請款作業,按三輪規則通知採購職位", "sessionHint": "本期不使用對話和歷史會話,請從上方 Tab 查看台帳。", "sync": "同步 OA 資料", "moreActions": "更多", "forceSync": "強制覆蓋 OA 欄位", "forceSyncConfirm": "將以本次 OA 回傳的非空欄位覆蓋既有 OA 資料,並記錄變更稽核。是否繼續?", "reparseExisting": "批量重新解析既有合約", "reparseExistingConfirm": "將使用已歸檔的合約附件依目前規則更新所有既有合約的解析結果,不會同步或覆蓋 OA 欄位。是否繼續?", "scanAlerts": "掃描產生預警", "jobSubmitted": "工作已提交", "actionFailed": "操作失敗", "loadFailed": "載入合約失敗", "searchPlaceholder": "搜尋合約編號、採購單號、供應商或申請人", "allStatus": "全部", "search": "查詢", "ledger": "合約台帳", "items": "筆", "empty": "暫無合約資料", "purchaseOrder": "採購單號", "supplier": "供應商", "amount": "合約金額", "deliveryDate": "交貨期限", "timeline": "付款計畫時間線", "notAvailable": "—", "stats": {"contracts": "合約總數", "pendingParse": "待處理合約", "readyPlans": "計畫已產生", "alerts": "待預警節點"}, "ledgerFocus": {"due": "即將到期", "dueHint": "7日內", "overdue": "逾期未付", "active": "未到期", "activeHint": "7日外", "dueThisMonth": "本月應付", "dueThisMonthHint": "本自然月"}, "status": {"completed": "已完成", "needs_review": "待覆核", "pending": "待解析"}, "stateLabel": {"parsed": "已解析", "needs_review": "待複核", "pending": "待解析", "active": "已生效"}, "nodeType": {"prepayment": "預付款", "shipment": "出貨款", "acceptance": "驗收款", "warranty": "質保款"}, "ruleConfirmed": "已確定", "prepaymentRule": "合約歸檔後第 7/14/21 天預警;請款以 OA 廠商預付款請款作業為準。", "shipmentRule": "交貨期限前 7 天、到期日、到期後 14 天預警;請款以 OA 廠商預付款請款作業為準。", "acceptanceRule": "驗收歸檔後第 30/40/60 天預警;質保款在質保到期前 7 天、到期日、到期後 14 天預警。", "pendingAlerts": "待處理預警", "processing": "已發起付款", "dataPending": "資料待確認", "paid": "已付款", "stagePaid": "已付", "amountRatioDate": "金額 / 比例 · 日期", "applicant": "申請人", "company": "公司", "erpSchema": "付款帳套", "statusLabel": "狀態", "contractPrefix": "合約", "datePending": "待補充日期", "statusNormal": "正常", "statusNeedsCompletion": "待補充", "statusOverdue": "已逾期", "statusUpcoming": "即將到期", "statusActive": "未到期", "statusCompleted": "已完成", "totalPrefix": "共", "contractSupplier": "合約號 / 供應商", "nextAlert": "下一預警", "triggerBasis": "觸發依據", "alertDate": "預警日期", "alertRuleHint": "每階段按自然日提醒三輪,到期後併入最近的週五 18:00 彙總發送。沒有對應日期則不提醒。\n預付款:合約歸檔日後第 7、14、21 天(頁面顯示首輪)\n出貨款:交貨期限前 7 天、當天、後 14 天\n驗收款:驗收單歸檔後第 30、40、60 天\n質保款:質保到期前 7 天、當天、後 14 天", "alertFirstRound": "首輪", "payDate": "付款日期", "markPaid": "標為已付", "markPaidTitle": "標為已付", "markPaidHint": "{stage} · {amount} / {percent}%。只標記這一階段。尚未發送的預警會關閉,已經發出的記錄保留。", "markPaidDate": "付款日期", "markPaidRemark": "說明(可選)", "markPaidRemarkPlaceholder": "例如:財務已確認付款,ERP 單號未對上", "markPaidConfirm": "確認已付", "markPaidSource": "來源:手動標記", "markPaidSuccess": "已標為已付", "markPaidFailed": "標記失敗", "processStatus": "處理狀態", "owner": "採購負責人", "oaData": "OA 資料", "contractRule": "合約規則", "ownerDefault": "採購負責人", "workflowNo": "合約申請單流程編號", "contractNoPending": "合約號待從附件解析", "synced": "已同步", "detailSubtitle": "OA 資料、付款節點與企業微信提醒記錄", "backToOverview": "返回總覽", "contractInfo": "OA 合約資訊", "alertHistory": "預警記錄", "alertRound": "第 {round} 次預警", "alertAudit": "預警發送記錄", "alertAuditEmpty": "暫無預警記錄", "alertNode": "付款節點", "alertScheduledAt": "計畫日期", "alertSentAt": "發送時間", "alertStatus": {"pending": "待發送", "sent": "已發送", "failed": "發送失敗"}, "roundValue": "第 {round} 次", "weeklyBatchesTitle": "週彙總批次", "weeklyBatchesSubtitle": "查看依收件人產生的付款預警週彙總、Excel 附件與發送記錄。", "weeklySend": "傳送預警", "weeklyBatchSubmitted": "發送預警任務已提交", "weeklyJobSent": "已發送 {sent} 個批次", "weeklyJobFailed": "{failed} Line truncated
|
||||
, "syncConfirm": "將從 OA 同步合約與驗收資料,只補齊台帳中的空白欄位,不會覆蓋已有內容。是否繼續?", "weeklySendConfirm": "將把本週待發送的付款預警彙總發給收件人。是否繼續?", "scanAlertsConfirm": "將依目前付款計畫掃描並產生待發送預警,不會立即發送。是否繼續?"},
|
||||
"contractPaymentReview": {"title": "待確認合約", "subtitle": "未符合設備採購合約同義標題組、付款比例驗證失敗或關鍵欄位衝突的合約,不會進入付款預警,請下載原文核對。", "searchPlaceholder": "合約編號、採購單號、供應商或申請人", "loadFailed": "待確認合約載入失敗", "contractWorkflow": "合約號 / 合約申請單流程編號", "reason": "待確認原因", "fallbackIssue": "解析結果待人工確認", "empty": "暫無待確認合約", "manualTitle": "複核付款階段", "manualSubtitle": "{supplier} · 採購單號 {purchaseOrder}。已識別的階段已填入,可改。", "backToReview": "返回待確認", "confirmLedger": "確認進入台帳", "confirmSuccess": "已進入合同台帳", "issueTitle": "解析提示", "contractNoOptional": "合同編號(可空)", "contractNoPlaceholder": "附件未識別出合同號", "percentage": "比例 %", "stageAmount": "金額", "basisDate": "日期依據", "noStage": "無此階段", "ruleIdentity": "採購單號和合同金額有效", "rulePercent": "啟用階段的比例合計為 100%,空白比例不算 0", "ruleAmount": "每個啟用階段的金額等於合同金額乘以比例", "ruleDate": "預付款、出貨款須填寫日期依據", "hintPrepayment": "日期依據是合同歸檔日。正文寫了定金或預付款比例時填在這裡。", "hintShipment": "日期依據是交貨期限。正文只有「收到定金後 N 天」時,請填寫具體日期。", "hintAcceptance": "日期依據是驗收單歸檔日。尚未歸檔可以留空。", "hintWarranty": "沒有質保款比例時勾選無此階段。質保期不是付款比例。", "formLoadFailed": "複核表單載入失敗", "submitFailed": "複核提交失敗", "manualAction": "人工複核", "fillHintTitle": "填寫提示"},
|
||||
"contractPaymentReparse": {"action": "重新解析合約原文", "success": "已使用附件“{attachment}”重新解析", "failed": "重新解析合約失敗"},
|
||||
"contractPaymentReview": {"title": "待確認合約", "subtitle": "未符合設備採購合約同義標題組、付款比例驗證失敗或關鍵欄位衝突的合約,不會進入付款預警,請下載原文核對。", "searchPlaceholder": "合約編號、採購單號、供應商或申請人", "loadFailed": "待確認合約載入失敗", "contractWorkflow": "合約號 / 合約申請單流程編號", "reason": "待確認原因", "fallbackIssue": "解析結果待人工確認", "empty": "暫無待確認合約", "manualTitle": "複核付款階段", "manualSubtitle": "{supplier} · 採購單號 {purchaseOrder}。已識別的階段已填入,可改。", "backToReview": "返回待確認", "confirmLedger": "確認進入台帳", "confirmSuccess": "已進入合同台帳", "issueTitle": "解析提示", "contractNoOptional": "合同編號(可空)", "contractNoPlaceholder": "附件未識別出合同號", "percentage": "比例 %", "stageAmount": "金額", "basisDate": "日期依據", "noStage": "無此階段", "ruleIdentity": "採購單號和合同金額有效", "rulePercent": "啟用階段的比例合計為 100%,空白比例不算 0", "ruleAmount": "每個啟用階段的金額等於合同金額乘以比例", "ruleDate": "預付款、出貨款須填寫日期依據", "hintPrepayment": "日期依據是合同歸檔日。正文寫了定金或預付款比例時填在這裡。", "hintShipment": "日期依據是交貨期限。正文只有「收到定金後 N 天」時,請填寫具體日期。", "hintAcceptance": "日期依據是驗收單歸檔日。尚未歸檔可以留空。", "hintWarranty": "沒有質保款比例時勾選無此階段。質保期不是付款比例。", "formLoadFailed": "複核表單載入失敗", "submitFailed": "複核提交失敗", "manualAction": "人工複核", "fillHintTitle": "填寫提示"},
|
||||
"procurementContract": {
|
||||
"title": "採購合同審查",
|
||||
"subtitle": "維護標準合同模板、風險紅線規則並查看審查歷史",
|
||||
@@ -5564,7 +5384,8 @@
|
||||
"interface": "介面定義",
|
||||
"binding": "繫結",
|
||||
"credential": "憑證引用",
|
||||
"capability": "能力清單"
|
||||
"capability": "能力清單",
|
||||
"calls": "呼叫日誌"
|
||||
},
|
||||
"statusLabels": {
|
||||
"draft": "草稿",
|
||||
@@ -5615,7 +5436,7 @@
|
||||
"environment": "環境",
|
||||
"status": "狀態",
|
||||
"clientInstance": "客戶端實例",
|
||||
"interfaceDef": "介面定義",
|
||||
"interfaceDef": "介面步驟(有序)",
|
||||
"secretRef": "Secret 引用",
|
||||
"secretProvider": "來源",
|
||||
"account": "帳號",
|
||||
@@ -5630,6 +5451,7 @@
|
||||
"code": "編碼",
|
||||
"name": "名稱",
|
||||
"connectorType": "連接器類型",
|
||||
"dbKind": "資料庫類型(db_kind)",
|
||||
"environment": "環境",
|
||||
"credentialRef": "憑證引用編碼",
|
||||
"configJson": "連接配置 JSON(介面位址/逾時/預設 org 等)",
|
||||
@@ -5651,9 +5473,6 @@
|
||||
"effectiveTo": "生效結束",
|
||||
"contextSelector": "進階路由條件 JSON",
|
||||
"contextSelectorHint": "鍵值對須全部包含於呼叫上下文才會命中;當前版本呼叫方不傳路由上下文,留空即為預設綁定。",
|
||||
"paramMapping": "參數映射 JSON",
|
||||
"paramMappingHint": "域參數到介面參數的翻譯規則(如 erp_org→organization、condition 模板);留空=同名直通。",
|
||||
"bindingClientHint": "隨所選介面定義自動帶出並鎖定,不可單獨修改。",
|
||||
"secretRef": "Secret 引用鍵",
|
||||
"secretProvider": "Secret 來源",
|
||||
"credentialType": "憑證類型",
|
||||
@@ -5681,7 +5500,8 @@
|
||||
"msg": {
|
||||
"fillClient": "請填寫名稱",
|
||||
"fillInterface": "請選擇客戶端實例(編碼可自動產生)",
|
||||
"fillBinding": "請填寫能力、客戶端實例與介面定義",
|
||||
"fillBinding": "請填寫能力,並至少新增一個步驟(每步選擇介面定義)",
|
||||
"fillDbKind": "請選擇資料庫類型(MySQL / Oracle / SQL Server / PostgreSQL)",
|
||||
"fillCredential": "請填寫編碼與 Secret 引用",
|
||||
"fillCredentialDb": "請填寫編碼,以及必填憑據欄位:{fields}",
|
||||
"credentialTypeMissing": "憑據類型清單未載入,請重新整理頁面後重試",
|
||||
@@ -5716,7 +5536,8 @@
|
||||
"endpoint": "https://erp-api.example.com/ws",
|
||||
"wsdl": "https://erp-api.example.com/wsdl",
|
||||
"requestPath": "路徑支援佔位符,如 /transfer/xxx",
|
||||
"passwordKeep": "留空則保持原密碼不變"
|
||||
"passwordKeep": "留空則保持原密碼不變",
|
||||
"database": "erp-host:1521/ORCL 或 127.0.0.1:3306/dbname"
|
||||
},
|
||||
"advancedConfig": "進階配置(JSON)",
|
||||
"formatJson": "格式化",
|
||||
@@ -5737,7 +5558,70 @@
|
||||
},
|
||||
"connectorTypes": {
|
||||
"rest": "REST API",
|
||||
"soap": "SOAP 服務"
|
||||
"soap": "SOAP 服務",
|
||||
"database": "資料庫直連"
|
||||
},
|
||||
"connectorDbKind": {
|
||||
"mysql": "MySQL",
|
||||
"oracle": "Oracle",
|
||||
"sqlserver": "SQL Server",
|
||||
"postgresql": "PostgreSQL"
|
||||
},
|
||||
"endpointLabel": {
|
||||
"database": "資料庫連線字串(host:port/service 或 /database)"
|
||||
},
|
||||
"bindingSteps": {
|
||||
"label": "執行步驟(有序)",
|
||||
"add": "新增步驟",
|
||||
"remove": "刪除步驟",
|
||||
"moveUp": "上移",
|
||||
"moveDown": "下移",
|
||||
"interface": "介面定義",
|
||||
"paramMapping": "步驟 {index} 參數映射 JSON",
|
||||
"clientHint": "客戶端實例由該步介面歸屬自動確定:{client}",
|
||||
"hint": "步驟按陣列順序執行;每步可配置獨立的參數映射,客戶端實例由各步介面歸屬自帶。"
|
||||
},
|
||||
"callLogs": {
|
||||
"title": "呼叫記錄",
|
||||
"filterInterface": "介面編碼",
|
||||
"filterClient": "客戶端編碼",
|
||||
"filterConnector": "連線類型",
|
||||
"filterStatus": "狀態",
|
||||
"filterOperationId": "operation_id",
|
||||
"filterTraceId": "trace_id",
|
||||
"filterBusinessRef": "業務單號",
|
||||
"filterKeyword": "參數關鍵字(模糊搜尋請求內容)",
|
||||
"dateFrom": "執行時間起",
|
||||
"dateTo": "執行時間止",
|
||||
"query": "查詢",
|
||||
"reset": "重置",
|
||||
"colTime": "時間",
|
||||
"colCapability": "能力",
|
||||
"colInterface": "介面",
|
||||
"colRef": "單號",
|
||||
"colStep": "步驟",
|
||||
"colStatus": "狀態",
|
||||
"colElapsed": "耗時",
|
||||
"detailTitle": "呼叫詳情",
|
||||
"timeline": "步驟時間線",
|
||||
"request": "請求",
|
||||
"response": "回應",
|
||||
"wire": "線級請求(wire)",
|
||||
"rawPayload": "原始報文",
|
||||
"normalized": "業務參數(歸一化)",
|
||||
"normalizedJson": "歸一化 JSON",
|
||||
"copyBody": "複製 body",
|
||||
"copyCurl": "複製 curl",
|
||||
"copySql": "複製 SQL",
|
||||
"copyRaw": "複製原始報文",
|
||||
"copyJson": "複製 JSON",
|
||||
"copyOperationId": "複製 operation_id",
|
||||
"copyTraceId": "複製 trace_id",
|
||||
"copied": "已複製",
|
||||
"noWire": "無線級詳情(歷史記錄)",
|
||||
"sqlWriteWarning": "⚠ 寫入語句:請確認目標環境後再執行",
|
||||
"prevPage": "上一頁",
|
||||
"nextPage": "下一頁"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3778,19 +3778,21 @@
|
||||
"stageFileReady": "檔案就緒",
|
||||
"stageWaitingRpa": "RPA 擷取中",
|
||||
"stageFailed": "失敗",
|
||||
"precheckTitle": "調撥預檢",
|
||||
"matchTitle": "可調撥清單",
|
||||
"businessDate": "業務日期",
|
||||
"executableCount": "可執行",
|
||||
"notMaturedCount": "當天收料",
|
||||
"blockedCount": "阻斷",
|
||||
"estimatedQuantity": "預計調撥數量",
|
||||
"estimatedExternalWrites": "預計 ERP 單據",
|
||||
"pendingStockCheckCount": "待查庫存",
|
||||
"invalidRowCount": "已失效 {count} 行",
|
||||
"reasonQuantityMismatch": "ERP 帳面庫存數量與收料數量不一致",
|
||||
"reasonInventoryNotFound": "ERP 無此批號的庫存記錄,庫存按 0 顯示",
|
||||
"reasonExternalQueryFailed": "外部系統查詢失敗",
|
||||
"reasonFutureDate": "收料日期晚於業務日期",
|
||||
"selectedCount": "已選 {count} 張",
|
||||
"generateTransfer": "直接產生調撥單",
|
||||
"generateTransfer": "產生調撥單",
|
||||
"colSource": "收料來源",
|
||||
"colMaterial": "料號",
|
||||
"colName": "品名",
|
||||
@@ -3799,21 +3801,27 @@
|
||||
"colReceiptDate": "收料日期",
|
||||
"colFromWarehouse": "撥出倉庫",
|
||||
"colFromQty": "庫存數量",
|
||||
"stockCheckedAtTitle": "庫存查詢時刻:{time}",
|
||||
"colToWarehouse": "撥入倉庫",
|
||||
"colFromBatch": "撥出批號",
|
||||
"filterPlaceholder": "按料號 / 品名 / Invoice / 批號篩選",
|
||||
"filterAll": "全部結果",
|
||||
"requerySelected": "重查選中 ERP 庫存",
|
||||
"requerySelected": "重查選中",
|
||||
"receiptDateLabel": "收料日期",
|
||||
"receiptDateTo": "收料日期止",
|
||||
"receiptDateHint": "截止不超出 D+1 規則(業務日期前一天)",
|
||||
"receiptDateHint": "預設為 D+1 規則日期(業務日期前一天,即可匹配截止日);截止不超出該日,起始不得晚於截止",
|
||||
"requeryRow": "重查",
|
||||
"colToQty": "撥入數量",
|
||||
"colResult": "預檢結果",
|
||||
"colResult": "匹配結果",
|
||||
"resultExecutable": "可執行",
|
||||
"resultNotMatured": "當天收料",
|
||||
"resultBlocked": "已阻斷",
|
||||
"resultUnknown": "結果未知",
|
||||
"resultFileRemoved": "檔案已移除",
|
||||
"resultPendingStockCheck": "待查庫存",
|
||||
"staleRow": "資料已過期,請重查",
|
||||
"fileChangedRow": "檔案已更新,將自動對齊",
|
||||
"fileRemovedQuarantined": "另有 {count} 筆已隨收料檔案移除而失效,已移出本清單;請到「待處理異常」處理,可標記無需繼續處理。",
|
||||
"runProgress": "調撥執行進度",
|
||||
"runExecuting": "執行中",
|
||||
"runSuccess": "已完成",
|
||||
@@ -3828,12 +3836,22 @@
|
||||
"exceptionsTitle": "未產生 ERP 單據",
|
||||
"exceptionBusinessFailed": "業務失敗",
|
||||
"exceptionTechnicalFailed": "技術失敗",
|
||||
"exceptionPrecheckExpired": "預檢失效",
|
||||
"exceptionMatchExpired": "匹配已失效",
|
||||
"downloadReceiptFiles": "下載收料來源檔案",
|
||||
"downloadErpInventory": "下載 ERP 庫存表",
|
||||
"downloadExceptions": "下載異常 Excel",
|
||||
"backlogTitle": "待處理異常",
|
||||
"retryErp": "重新查詢 ERP",
|
||||
"resumeAction": "恢復處理",
|
||||
"colAging": "老化",
|
||||
"colAction": "操作",
|
||||
"selectedRows": "已選 {count} 行",
|
||||
"clearSelection": "取消選擇",
|
||||
"receiptDateInvalid": "起始日期不得晚於截止日期",
|
||||
"toastRequeryDone": "重查完成:{ok} 行已更新,{failed} 行失敗",
|
||||
"toastRequeryRecovered": "恢復完成:{recovered} 筆已可執行 · {blocked} 筆仍阻斷",
|
||||
"toastExecuteFileChanged": "{count} 筆檔案已更新,請重新匹配",
|
||||
"toastCloseDone": "關閉完成:{ok} 行成功,{failed} 行失敗",
|
||||
"batchCloseTitle": "標記無需繼續處理({count} 項)",
|
||||
"manualClose": "標記無需繼續處理",
|
||||
"manualCloseTitle": "標記無需繼續處理",
|
||||
"manualCloseHint": "關閉後自動排程不再處理;歷史與稽核永久保留。",
|
||||
@@ -3856,20 +3874,20 @@
|
||||
"hub_to_hub": "HUB倉間調撥"
|
||||
},
|
||||
"transferTypeComingSoon": "即將上線",
|
||||
"precheckParams": "預檢參數",
|
||||
"matchParams": "匹配參數",
|
||||
"selectAll": "本組全選",
|
||||
"selectEnabledAll": "全選已啟用",
|
||||
"clearSources": "清空選擇",
|
||||
"selectedSourceCount": "已選 {count} 個來源實例",
|
||||
"needSelectSource": "請至少選擇一個已啟用來源實例",
|
||||
"confirmScopeAndPrecheck": "確認範圍並預檢",
|
||||
"confirmScopeAndMatch": "確認範圍並匹配",
|
||||
"homeWelcome": "你好,您已進入",
|
||||
"homeTodayLabel": "今日待辦",
|
||||
"homeTodayAction": "發起今日調撥預檢",
|
||||
"homeTodayAction": "匹配可調撥庫存",
|
||||
"homeTodayHint": "選擇來源實例後,系統預設以昨天為業務日期處理可成熟收料。",
|
||||
"homeHistoryLabel": "歷史待辦",
|
||||
"homeRecoverable": "可恢復異常",
|
||||
"homeRecoverableHint": "可重新查詢 ERP 庫存後繼續處理",
|
||||
"homeRecoverable": "待恢復異常",
|
||||
"homeRecoverableHint": "可重查庫存或一鍵恢復處理",
|
||||
"homeClosed": "已人工關閉",
|
||||
"homeClosedHint": "可查看原因並恢復處理",
|
||||
"homeUnknown": "結果未知",
|
||||
@@ -3889,6 +3907,91 @@
|
||||
"batchRetry": "批次重試 RPA",
|
||||
"downloadFiles": "下載收料文件",
|
||||
"selectedRetryableCount": "其中 {count} 個可重試",
|
||||
"noRetryable": "所選來源均無需重試(已就緒或抓取中)"
|
||||
"noRetryable": "所選來源均無需重試(已就緒或抓取中)",
|
||||
"homeMatchLabel": "庫存匹配",
|
||||
"homeBoardLabel": "待辦看板",
|
||||
"homeExecutable": "可調撥明細",
|
||||
"homeExecutableHint": "勾選後按行產生調撥單",
|
||||
"executableTitle": "可調撥明細",
|
||||
"executableEmpty": "暫無可調撥明細",
|
||||
"executableSelectedCount": "已選 {count} 筆可執行明細",
|
||||
"runTitle": "調撥單生成",
|
||||
"runBadge": {
|
||||
"queued": "排隊中",
|
||||
"executing": "執行中",
|
||||
"success": "成功",
|
||||
"partialFailed": "部分失敗",
|
||||
"failed": "失敗"
|
||||
},
|
||||
"orderStatus": {
|
||||
"pending": "待處理",
|
||||
"executing": "執行中",
|
||||
"success": "成功",
|
||||
"resultUnknown": "結果未知",
|
||||
"failed": "失敗",
|
||||
"cancelled": "已關閉"
|
||||
},
|
||||
"orderAction": {
|
||||
"retrigger": "重新觸發",
|
||||
"retry": "重試",
|
||||
"retryAccepted": "調撥單 {docNo} 已重新提交執行,進度將自動刷新。",
|
||||
"retryPartial": "重查完成:{ready} 行可執行、{blocked} 行仍阻斷已留恢復池。",
|
||||
"closeOrder": "關閉調撥單"
|
||||
},
|
||||
"orderReasonPrefix": "原因:{reason}",
|
||||
"poll": {
|
||||
"connecting": "連線中…"
|
||||
},
|
||||
"execute": {
|
||||
"accepted": "已提交,執行排隊中,進度將於下方更新。",
|
||||
"noSelection": "請至少選擇一個可執行明細行"
|
||||
},
|
||||
"retriggerDialog": {
|
||||
"title": "重新觸發 {docNo}",
|
||||
"body": "將復用本單原單號與提交時間戳,只重新觸發末步(冪等安全,不會重複建單)。",
|
||||
"confirm": "確認重新觸發",
|
||||
"dismiss": "返回"
|
||||
},
|
||||
"orderClose": {
|
||||
"title": "關閉調撥單 {docNo}",
|
||||
"impactHint": "本票 {count} 行明細將隨關閉脫離並回到待執行池(可重新勾選組建新票):",
|
||||
"redline": "關閉調撥單≠ERP 無單據:關閉前必須人工到 ERP 確認無對應單據。",
|
||||
"reasonPlaceholder": "關閉原因(必填)",
|
||||
"confirm": "確認關閉",
|
||||
"dismiss": "返回"
|
||||
},
|
||||
"toastOrderClosed": "調撥單已關閉,行已回到待執行池",
|
||||
"toastRetriggerAccepted": "已重新觸發,正在排隊執行末步",
|
||||
"homeExecuted": {
|
||||
"title": "已執行調撥單",
|
||||
"refresh": "重新整理",
|
||||
"empty": "暫無已執行調撥單",
|
||||
"pageInfo": "共 {total} 張 · 第 {page} 頁",
|
||||
"back": "返回",
|
||||
"all": "全部",
|
||||
"groupHint": {
|
||||
"success": "ERP 單號已回寫,可查看明細",
|
||||
"failed": "可重查庫存或人工關票",
|
||||
"executing": "正在寫中間表/觸發 ERP 建單",
|
||||
"resultUnknown": "唯讀,需線下核實 ERP"
|
||||
},
|
||||
"dateFrom": "開始日期",
|
||||
"dateTo": "結束日期",
|
||||
"group": {
|
||||
"success": "成功",
|
||||
"failed": "失敗",
|
||||
"executing": "執行中",
|
||||
"resultUnknown": "結果未知"
|
||||
},
|
||||
"closeDialog": {
|
||||
"title": "關閉調撥單 {docNo}",
|
||||
"reasonRequired": "關閉原因(必填)",
|
||||
"redlineWhole": "關閉將作廢整張調撥單(含未成行),操作不可撤銷。",
|
||||
"redlineResidue": "ERP 可能已寫入的行不會被自動刪除,殘留行需按 SOP 人工核對。",
|
||||
"redlineReopen": "單內全部明細將脫離本單回到待執行池,可重新勾選組建新票。",
|
||||
"redlineErpCheck": "關閉調撥單≠ERP 無單據:關閉前必須人工到 ERP 確認無對應單據。",
|
||||
"confirm": "確認關閉"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,6 +150,7 @@
|
||||
"CHAT.USER_ATTACHMENTS_LIMIT_EXCEEDED": "附件數量超過上限(最多 200 個),請減少後重試。",
|
||||
"CONTRACT_PAYMENT_FORBIDDEN": "你沒有合約付款預警的存取權限。",
|
||||
"CONTRACT_PAYMENT_ADMIN_REQUIRED": "僅管理員可執行合約付款預警的同步、掃描或發送操作。",
|
||||
"CONTRACT_PAYMENT_ATTACHMENT_UNAVAILABLE": "合約原文已被清理,且無法從原系統重新下載。請先同步 OA 資料後再試。",
|
||||
"VOUCHER_CHECK_FORBIDDEN": "你沒有立帳憑證檢核的存取權限。",
|
||||
"VOUCHER_CHECK_ADMIN_REQUIRED": "僅管理員可強制重檢或修改立帳憑證通知設定。",
|
||||
"SHIPPING_TASK_SELECTION_INVALID": "請選擇 1 到 100 個發貨任務。",
|
||||
@@ -559,8 +560,8 @@
|
||||
"TRANSFER_INVOICE_CONFLICT": "同一 Invoice 存在衝突(多料號或多日期)。",
|
||||
"TRANSFER_QUANTITY_MISMATCH": "收料數量與 ERP 庫存不相等,已阻斷。",
|
||||
"TRANSFER_ERP_INVENTORY_NOT_FOUND": "ERP 未找到該 Invoice 庫存。",
|
||||
"TRANSFER_PRECHECK_EXPIRED": "預檢已過期或快照變更,請重新預檢。",
|
||||
"TRANSFER_CONFIRMATION_REQUIRED": "預檢未就緒,無法執行。",
|
||||
"TRANSFER_MATCH_EXPIRED": "匹配已過期或快照變更,請重新匹配。",
|
||||
"TRANSFER_CONFIRMATION_REQUIRED": "匹配未就緒,無法執行。",
|
||||
"TRANSFER_DUPLICATE_NOT_VERIFIED": "重複 Invoice 無法證明原單已過帳。",
|
||||
"TRANSFER_RESULT_UNKNOWN": "ERP 結果未知,唯讀,請依人工核實 SOP 處理。",
|
||||
"TRANSFER_MANUAL_CLOSE_REASON_REQUIRED": "人工關閉必須填寫原因。",
|
||||
@@ -570,8 +571,19 @@
|
||||
"TRANSFER.ROUTE_NOT_RESOLVED": "來源實例路由歸屬未設定。",
|
||||
"TRANSFER.EXTERNAL_NOT_FROZEN": "外部系統契約未凍結,禁止呼叫。",
|
||||
"TRANSFER.EXTERNAL_QUERY_TIMEOUT": "外部系統查詢逾時,請重試。",
|
||||
"TRANSFER.PRECHECK_ALREADY_EXECUTED": "該預檢已執行,請勿重複提交。",
|
||||
"TRANSFER.SELECTION_INVALID": "選擇範圍包含不可執行 Invoice。",
|
||||
"TRANSFER.INVALID_STATE_TRANSITION": "非法狀態轉換。"
|
||||
"TRANSFER.INVALID_STATE_TRANSITION": "非法狀態轉換。",
|
||||
"TRANSFER.BATCH_ITEMS_REQUIRED": "請提供要操作的明細行。",
|
||||
"TRANSFER.EXECUTE_ITEMS_INVALID": "部分明細行不存在或不可執行,請重新整理後再試。",
|
||||
"TRANSFER.ITEMS_STALE": "部分明細行匹配結果已過期,請重新匹配。",
|
||||
"TRANSFER.FILE_CHANGED": "收料檔案已更新,請重新匹配後再執行。",
|
||||
"TRANSFER.ORG_REQUIRED": "外部組織代碼不能為空。",
|
||||
"TRANSFER.RETRIGGER_NOT_ALLOWED": "僅結果未知(result_unknown)票允許重新觸發;禁止關閉後重建。",
|
||||
"TRANSFER.RETRY_NOT_ALLOWED": "該行已隨檔案移除,無法重查;請標記無需繼續處理或等待檔案重新同步。",
|
||||
"TRANSFER.DOCUMENT_CLOSE_NOT_ALLOWED": "僅失敗票(業務拒絕/技術失敗)允許關閉;結果未知票請使用「重新觸發」,執行中的票不可關閉。",
|
||||
"TRANSFER.DOCUMENT_NOT_FOUND": "調撥票不存在。",
|
||||
"INTEGRATION.BINDING_LEGACY_PUT_REJECTED": "舊單步欄位會截斷該繫結的多步配方,請改用 steps_json 提交有序步驟。",
|
||||
"INTEGRATION.CALL_NOT_FOUND": "整合調用記錄不存在。",
|
||||
"INTEGRATION.BINDING_STEPS_INVALID": "綁定步驟配置不合法:steps_json 必填且為非空陣列,每項須為物件。"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user