Merge branch 'hugo-shipping-notice' into dev
# Conflicts: # backend/app/services/shipping_notice/receipt_report_notification.py
This commit is contained in:
commit
876a7ade7d
212 files changed
+12056
-2889
No files matched your search
@@ -288,6 +288,10 @@ export const createShippingInventoryStructureAnalysis = (file: File) => {
|
||||
method: 'POST', body: form, ...auth(),
|
||||
});
|
||||
};
|
||||
/** 读取标准异动字段目录(只读领域契约,供收料异动解析规则映射表单)。 */
|
||||
export const fetchMovementFields = () => requestJson<Array<{ code: string; value_type: string; required: boolean; is_identity: boolean }>>(
|
||||
'/api/admin/shipping-notice/movement-fields', auth(),
|
||||
);
|
||||
/** 用已分析的真实栏位创建库存文件解析方案草稿。 */
|
||||
export const createShippingInventoryParsingDraftFromAnalysis = (id: number, payload: Record<string, unknown>) => requestJson<unknown>(
|
||||
`/api/admin/shipping-notice/inventory-structure-analyses/${id}/create-profile-draft`,
|
||||
|
||||
+136
@@ -0,0 +1,136 @@
|
||||
/**
|
||||
* features/admin/modules/integration-connector/IntegrationConnectorPage.spec.ts
|
||||
* 用途:锁定凭据引用列表的重设计列——类型/账号/来源/启停开关,以及能力清单 tab 的激活与注册表渲染;
|
||||
* 不再出现内部实现列(secret_ref 原文)与无行动价值的「更新时间」列。
|
||||
* 依赖:vi.mock(useIntegrationConnectorAdmin)、@vue/test-utils、i18n。
|
||||
* 逻辑:mock composable 返回固定 fixture(password 账密 + token 两条),断言
|
||||
* 列表按类型标签/非密账号/来源本地化与布尔启停开关渲染。
|
||||
*/
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { defineComponent, h, ref } from 'vue';
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { createMemoryHistory, createRouter } from 'vue-router';
|
||||
import i18n from '@/i18n';
|
||||
import IntegrationConnectorPage from './IntegrationConnectorPage.vue';
|
||||
import { createEmptyBindingForm, createEmptyClientInstanceForm, createEmptyCredentialReferenceForm, createEmptyInterfaceDefinitionForm } from './types/integration-connector.types';
|
||||
|
||||
const mockState = vi.hoisted(() => {
|
||||
const capabilities = [
|
||||
{ name: 'in_transit_transfer.create_transfer', write: true, idempotency: 'invoice' },
|
||||
{ name: 'in_transit_transfer.query_inventory', write: false, idempotency: 'none' },
|
||||
{ name: 'in_transit_transfer.verify_duplicate', write: false, idempotency: 'invoice' },
|
||||
];
|
||||
const bindings = [
|
||||
{
|
||||
id: 1, capability: 'in_transit_transfer.query_inventory', context_selector_json: {},
|
||||
client_instance_code: '1001', interface_definition_code: 'IF-A',
|
||||
mapping_version: 1, priority: 0, environment: 'prod',
|
||||
effective_from: null, effective_to: null, status: 'published',
|
||||
},
|
||||
];
|
||||
const credentials = [
|
||||
{
|
||||
id: 1, code: 'tiptop-erp', secret_ref: 'db:tiptop-erp', secret_provider: 'db',
|
||||
credential_type: 'password', secret_fields: { username: 'tiptop' }, has_secret: true,
|
||||
version: 1, status: 'active', updated_at: '2026-09-21T18:30:00', last_verified_at: null,
|
||||
},
|
||||
{
|
||||
id: 2, code: 'wms-token', secret_ref: 'db:wms-token', secret_provider: 'env',
|
||||
credential_type: 'token', secret_fields: {}, has_secret: true,
|
||||
version: 1, status: 'rotating', updated_at: null, last_verified_at: null,
|
||||
},
|
||||
];
|
||||
const noop = () => vi.fn();
|
||||
return { credentials, capabilities, bindings };
|
||||
});
|
||||
|
||||
vi.mock('./composables/useIntegrationConnectorAdmin', () => ({
|
||||
useIntegrationConnectorAdmin: () => ({
|
||||
clients: ref([]), interfaces: ref([]), 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),
|
||||
clientForm: ref(createEmptyClientInstanceForm()),
|
||||
interfaceForm: ref(createEmptyInterfaceDefinitionForm()),
|
||||
bindingForm: ref(createEmptyBindingForm()),
|
||||
credentialForm: ref(createEmptyCredentialReferenceForm()),
|
||||
showCallModal: ref(false), callCapability: ref(''), callParamsText: ref(''), callContextText: ref(''),
|
||||
callResult: ref(null), callBusy: ref(false),
|
||||
testingClientCode: ref(''), testResultText: ref(''),
|
||||
lifecycleBusy: ref(false),
|
||||
loadAll: vi.fn(), openCreateModal: vi.fn(), openEditModal: vi.fn(), closeFormModal: vi.fn(),
|
||||
saveActive: vi.fn(), testConnection: vi.fn(), openCallModal: vi.fn(), closeCallModal: vi.fn(),
|
||||
runCall: vi.fn(), deleteClient: vi.fn(), toggleClient: vi.fn(), toggleCredential: vi.fn(),
|
||||
changeInterfaceLifecycle: vi.fn(), changeBindingLifecycle: vi.fn(),
|
||||
}),
|
||||
}));
|
||||
|
||||
function mountPage() {
|
||||
const router = createRouter({ history: createMemoryHistory(), routes: [{ path: '/:pathMatch(.*)*', component: { template: '<div/>' } }] });
|
||||
const Harness = defineComponent({
|
||||
setup() {
|
||||
return () => h('div', { style: 'width: 1400px' }, [h(IntegrationConnectorPage)]);
|
||||
},
|
||||
});
|
||||
return mount(Harness, { global: { plugins: [i18n, router] } });
|
||||
}
|
||||
|
||||
describe('IntegrationConnectorPage credential list', () => {
|
||||
it('按重设计列渲染:类型徽标 + 非密账号 + 来源徽标 + 启停开关,不再显示 secret_ref 原文', () => {
|
||||
const wrapper = mountPage();
|
||||
const text = wrapper.text();
|
||||
// password 类型:类型标签 + 非密账号(username 值)+ 来源本地化;状态不走文字(开关 + 悬停提示)
|
||||
expect(text).toContain('tiptop-erp');
|
||||
expect(text).toContain('账密');
|
||||
expect(text).toContain('tiptop');
|
||||
expect(text).toContain('界面维护(加密保存)');
|
||||
// token 类型:非密字段为空显示占位;env 来源显示 Secret 键名
|
||||
expect(text).toContain('wms-token');
|
||||
expect(text).toContain('令牌');
|
||||
// 内部实现列不再出现:db: 前缀的 secret_ref 原文不渲染
|
||||
expect(wrapper.findAll('td').some((td) => td.text() === 'db:tiptop-erp')).toBe(false);
|
||||
// 「更新时间」列已移除:updated_at 只是行保存时间,非最后轮换/验证时间,无行动价值
|
||||
expect(text).not.toContain('2026-09-21 18:30');
|
||||
expect(text).not.toContain('更新时间');
|
||||
// 布尔启停走行内开关(与客户端实例一致),开关后不带状态文字,精确状态走悬停提示
|
||||
expect(wrapper.findAll('[data-testid="credential-status-toggle"]').length).toBe(2);
|
||||
expect(wrapper.find('[data-testid="credential-status"]').exists()).toBe(false);
|
||||
expect(text).not.toContain('启用中');
|
||||
expect(text).not.toContain('轮换中');
|
||||
// 表头与客户端实例一致为「启用」(布尔开关列);「状态」留给接口/绑定的多状态徽章列
|
||||
expect(wrapper.findAll('th').some((th) => th.text() === '启用')).toBe(true);
|
||||
});
|
||||
|
||||
it('能力清单 tab 可激活:渲染注册能力(写/幂等)与调用入口,新增按钮隐藏', async () => {
|
||||
const wrapper = mountPage();
|
||||
const capTab = wrapper.findAll('[role="tab"]').find((b) => b.text() === '能力清单')!;
|
||||
await capTab.trigger('click');
|
||||
// tab 进入选中态(此前 selectTab 对 capability 直接 return,点击无效)
|
||||
expect(capTab.attributes('aria-selected')).toBe('true');
|
||||
const text = wrapper.text();
|
||||
// 中文名称为主行,注册名保留为次行(绑定引用用精确标识)
|
||||
expect(text).toContain('创建调拨单');
|
||||
expect(text).toContain('在途库存查询');
|
||||
expect(text).toContain('防重校验');
|
||||
expect(text).toContain('in_transit_transfer.query_inventory');
|
||||
expect(text).toContain('in_transit_transfer.create_transfer');
|
||||
// 写入/幂等本地化:不再出现原始 yes/no 与 invoice/none
|
||||
expect(wrapper.findAll('td').some((td) => td.text() === '是')).toBe(true);
|
||||
expect(wrapper.findAll('td').some((td) => td.text() === '否')).toBe(true);
|
||||
expect(text).toContain('按单据号幂等');
|
||||
expect(text).not.toContain('yes');
|
||||
expect(text).not.toContain('invoice');
|
||||
// 只读清单:无「新增」入口;每行提供「调用」按钮(打开手动调用弹窗)
|
||||
expect(wrapper.findAll('button').some((b) => b.text().includes('新增'))).toBe(false);
|
||||
expect(wrapper.findAll('button').some((b) => b.text().includes('调用'))).toBe(true);
|
||||
});
|
||||
|
||||
it('绑定列表能力列渲染「中文名 + 注册名」两行', async () => {
|
||||
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('in_transit_transfer.query_inventory');
|
||||
});
|
||||
});
|
||||
+325
-58
@@ -1,28 +1,39 @@
|
||||
<!--
|
||||
features/admin/modules/integration-connector/IntegrationConnectorPage.vue
|
||||
用途:集成连接器管理页——四个配置实体(客户端实例/接口定义/绑定/凭据引用)tab 列表 +
|
||||
能力清单与手动调用测试;创建/编辑弹窗 + 连接测试。
|
||||
依赖:useIntegrationConnectorAdmin、两个弹窗组件、useI18n。
|
||||
逻辑:按 tab 展示列表与「新增」;配置「绑定」是让自动调拨跑起来的最小闭环核心。
|
||||
能力清单与手动调用测试;创建/编辑抽屉 + 行内连接测试。
|
||||
依赖:useIntegrationConnectorAdmin、抽屉与调用测试弹窗组件、useI18n。
|
||||
逻辑:按 tab 展示列表与「新增」;客户端列表展示类型/环境徽章、行内启停开关与
|
||||
连接测试结果(徽章 + 可展开详情);接口定义与绑定列表均以状态徽章 + 生命周期行内
|
||||
按钮(发布/撤回/退役/恢复,绑定发布由后端就绪门禁校验接口已发布且客户端启用)
|
||||
驱动状态,表单内状态只读;凭据列表布尔启停走行内开关
|
||||
(与客户端实例一致,表头同为「启用」,开关不带状态文字,精确状态走悬停提示);
|
||||
能力清单为只读注册表(能力中文名为主行 + 注册名次行,写入/幂等本地化,未注册翻译兜底原值);
|
||||
接口/绑定列表的客户端与接口
|
||||
引用列统一展示「名称 + 编码」两行;类型/环境/状态取值均本地化,
|
||||
未知值兜底原样显示;配置「绑定」是让自动调拨跑起来的最小闭环核心。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted } from 'vue';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { Plus, Edit, Trash2, Plug, PlayCircle } from 'lucide-vue-next';
|
||||
import IntegrationConnectorFormModal from './components/IntegrationConnectorFormModal.vue';
|
||||
import IntegrationConnectorFormDrawer from './components/IntegrationConnectorFormDrawer.vue';
|
||||
import IntegrationCapabilityCallModal from './components/IntegrationCapabilityCallModal.vue';
|
||||
import { CONNECTOR_TYPE_OPTIONS, ENVIRONMENT_OPTIONS } from './types/integration-connector.types';
|
||||
import { useIntegrationConnectorAdmin } from './composables/useIntegrationConnectorAdmin';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const {
|
||||
clients, interfaces, bindings, credentials, capabilities,
|
||||
clients, interfaces, bindings, credentials, capabilities, credentialTypes,
|
||||
isLoading, activeEntity, showFormModal, isSaving,
|
||||
clientForm, interfaceForm, bindingForm, credentialForm,
|
||||
showCallModal, callCapability, callParamsText, callContextText, callResult, callBusy,
|
||||
testResultText,
|
||||
testingClientCode, testResults,
|
||||
lifecycleBusy,
|
||||
loadAll, openCreateModal, openEditModal, closeFormModal, saveActive,
|
||||
testConnection, openCallModal, closeCallModal, runCall, deleteClient,
|
||||
testConnection, toggleClient, toggleCredential, openCallModal, closeCallModal, runCall, deleteClient,
|
||||
changeInterfaceLifecycle, changeBindingLifecycle,
|
||||
} = useIntegrationConnectorAdmin();
|
||||
|
||||
onMounted(() => { void loadAll(); });
|
||||
@@ -35,16 +46,110 @@ const tabs: Array<{ key: TabKey; labelKey: string }> = [
|
||||
{ key: 'credential', labelKey: 'admin.integrationConnector.tabs.credential' },
|
||||
{ key: 'capability', labelKey: 'admin.integrationConnector.tabs.capability' },
|
||||
];
|
||||
const activeTab = computed<TabKey>(() => (activeEntity.value === 'credential' ? 'credential' : activeEntity.value));
|
||||
// 当前激活 tab:页面本地状态(capability 为只读注册表 tab,不属于可编辑实体);
|
||||
// 初始取 activeEntity,保证携带实体态进入页面时列表与 tab 一致。
|
||||
const activeTab = ref<TabKey>(activeEntity.value);
|
||||
|
||||
const clientOptions = computed(() => clients.value.map((c) => ({ code: c.code, name: c.name })));
|
||||
const interfaceOptions = computed(() => interfaces.value.map((i) => ({ code: i.code, name: i.name })));
|
||||
/** 客户端选项带 connector_type:接口表单联动展示连接器类型用。 */
|
||||
const clientOptions = computed(() => clients.value.map((c) => ({ code: c.code, name: c.name, connector_type: c.connector_type })));
|
||||
/** 接口选项带 client_instance_code:绑定表单联动带出并锁定客户端实例用。 */
|
||||
const interfaceOptions = computed(() => interfaces.value.map((i) => ({ code: i.code, name: i.name, client_instance_code: i.client_instance_code })));
|
||||
const capabilityOptions = computed(() => capabilities.value.map((c) => ({ name: c.name })));
|
||||
const credentialOptions = computed(() => credentials.value.map((c) => ({ code: c.code })));
|
||||
|
||||
/** 编码 → 名称(列表引用列展示「名称 + 编码」用);编码无对应记录时回退空串,由模板兜底显示编码。 */
|
||||
function clientNameOf(code: string) {
|
||||
return clients.value.find((c) => c.code === code)?.name ?? '';
|
||||
}
|
||||
function interfaceNameOf(code: string) {
|
||||
return interfaces.value.find((i) => i.code === code)?.name ?? '';
|
||||
}
|
||||
|
||||
/** 行内展开测试详情的客户端编码(同一时刻至多展开一行)。 */
|
||||
const expandedTestCode = ref('');
|
||||
|
||||
/** 连接器类型本地化标签;未注册类型兜底原样显示(不写死类型集合)。 */
|
||||
function connectorTypeLabel(value: string) {
|
||||
const opt = CONNECTOR_TYPE_OPTIONS.find((item) => item.value === value);
|
||||
return opt ? t(opt.labelKey) : value;
|
||||
}
|
||||
|
||||
/** 环境本地化标签;未知值兜底原样显示。 */
|
||||
function envLabel(value: string) {
|
||||
return (ENVIRONMENT_OPTIONS as readonly string[]).includes(value)
|
||||
? t(`admin.integrationConnector.envLabels.${value}`)
|
||||
: value;
|
||||
}
|
||||
|
||||
/** 状态本地化标签;未知值兜底原样显示。 */
|
||||
function statusLabel(value: string) {
|
||||
return t(`admin.integrationConnector.statusLabels.${value}`, value);
|
||||
}
|
||||
|
||||
/** 能力本地化标签;未注册翻译的能力兜底原值(能力名含点号,i18n 按嵌套路径组织)。 */
|
||||
function capabilityLabelOf(name: string) {
|
||||
return t(`admin.integrationConnector.capabilityLabels.${name}`, name);
|
||||
}
|
||||
|
||||
/** 幂等语义本地化标签;未知值兜底原样显示。 */
|
||||
function idempotencyLabel(value: string) {
|
||||
return t(`admin.integrationConnector.idempotencyLabels.${value}`, value);
|
||||
}
|
||||
|
||||
/** 凭据来源本地化标签(db=界面维护/加密保存,env=环境注入);与状态共用 statusLabels。 */
|
||||
function secretProviderLabel(value: string) {
|
||||
return statusLabel(value);
|
||||
}
|
||||
|
||||
/** 凭据类型本地化标签;未注册类型兜底原样显示(不写死类型集合)。 */
|
||||
function credentialTypeLabel(value: string) {
|
||||
return t(`admin.integrationConnector.credentialTypeLabels.${value}`, value);
|
||||
}
|
||||
|
||||
/** 账号列文本:db 模式显示非密字段值(类型定义驱动);env 模式显示 Secret 键名。 */
|
||||
function credentialAccountText(row: { secret_provider: string; secret_fields: Record<string, string>; secret_ref: string }) {
|
||||
if (row.secret_provider === 'env') return row.secret_ref;
|
||||
const values = Object.values(row.secret_fields ?? {}).filter(Boolean);
|
||||
return values.length ? values.join(' / ') : '—';
|
||||
}
|
||||
|
||||
/** 状态徽标配色:启用中绿 / 轮换中橙 / 其余中性。 */
|
||||
function statusBadgeClass(value: string) {
|
||||
if (value === 'active' || value === 'published') return 'bg-emerald-50 text-emerald-700';
|
||||
if (value === 'rotating') return 'bg-amber-50 text-amber-700';
|
||||
return 'bg-surface-soft text-secondary';
|
||||
}
|
||||
|
||||
/** 行内测试结果(无结果返回 null,供模板 v-if 使用)。 */
|
||||
function testResultOf(code: string) {
|
||||
return testResults.value[code] ?? null;
|
||||
}
|
||||
|
||||
/** 测试徽章配色:成功绿 / 失败红。 */
|
||||
function testBadgeClass(code: string) {
|
||||
return testResultOf(code)?.ok
|
||||
? 'bg-green-100 text-green-700 hover:bg-green-200'
|
||||
: 'bg-red-100 text-red-700 hover:bg-red-200';
|
||||
}
|
||||
|
||||
/** 测试徽章文案。 */
|
||||
function testBadgeText(code: string) {
|
||||
return testResultOf(code)?.ok
|
||||
? t('admin.integrationConnector.testOkBadge')
|
||||
: t('admin.integrationConnector.testFailBadge');
|
||||
}
|
||||
|
||||
/** 展开行详情文本:原因码 · 脱敏消息。 */
|
||||
function testDetailText(code: string) {
|
||||
const r = testResultOf(code);
|
||||
if (!r) return '';
|
||||
return r.message ? `${r.code} · ${r.message}` : r.code;
|
||||
}
|
||||
|
||||
function selectTab(key: TabKey) {
|
||||
// capability tab 只读展示,不进入表单实体;其余映射到可编辑实体。
|
||||
if (key === 'capability') return;
|
||||
activeEntity.value = key;
|
||||
activeTab.value = key;
|
||||
// capability tab 只读展示注册表(无新增/表单入口),activeEntity 保持最后一个可编辑实体供抽屉复用。
|
||||
if (key !== 'capability') activeEntity.value = key;
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -91,40 +196,92 @@ function selectTab(key: TabKey) {
|
||||
<table class="admin-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="px-6 py-4 text-left text-xs">{{ t('admin.integrationConnector.headers.code') }}</th>
|
||||
<th class="px-6 py-4 text-left text-xs">{{ t('admin.integrationConnector.headers.name') }}</th>
|
||||
<th class="px-6 py-4 text-left text-xs">{{ t('admin.integrationConnector.headers.connectorType') }}</th>
|
||||
<th class="px-6 py-4 text-left text-xs">{{ t('admin.integrationConnector.headers.environment') }}</th>
|
||||
<th class="px-6 py-4 text-right text-xs w-40">{{ t('admin.integrationConnector.headers.actions') }}</th>
|
||||
<th class="px-6 py-4 text-left text-xs">{{ t('admin.integrationConnector.headers.endpoint') }}</th>
|
||||
<th class="px-6 py-4 text-left text-xs">{{ t('admin.integrationConnector.fields.enabled') }}</th>
|
||||
<th class="px-6 py-4 text-left text-xs">{{ t('admin.integrationConnector.headers.testStatus') }}</th>
|
||||
<th class="px-6 py-4 text-right text-xs w-36">{{ t('admin.integrationConnector.headers.actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-if="clients.length === 0"><td colspan="5" class="px-6 admin-table-empty">{{ t('admin.integrationConnector.empty') }}</td></tr>
|
||||
<tr v-for="row in clients" :key="row.code">
|
||||
<td class="px-6 py-4 text-sm font-medium text-primary mono">{{ row.code }}</td>
|
||||
<td class="px-6 py-4 text-sm text-secondary">{{ row.name }}</td>
|
||||
<td class="px-6 py-4 text-sm text-secondary">{{ row.connector_type }}</td>
|
||||
<td class="px-6 py-4 text-sm text-secondary">{{ row.environment }}</td>
|
||||
<td class="px-6 py-4 text-right">
|
||||
<div class="inline-flex items-center gap-1">
|
||||
<button type="button" class="p-2 rounded-lg text-muted hover:bg-brand-50 hover:text-brand-600" :title="t('admin.integrationConnector.test')" @click="testConnection(row.code)">
|
||||
<Plug class="w-4 h-4" />
|
||||
<tr v-if="clients.length === 0"><td colspan="7" class="px-6 admin-table-empty">{{ t('admin.integrationConnector.empty') }}</td></tr>
|
||||
<template v-for="row in clients" :key="row.code">
|
||||
<tr>
|
||||
<td class="px-6 py-4">
|
||||
<p class="text-sm font-medium text-primary">{{ row.name }}</p>
|
||||
<p class="text-xs text-muted mono mt-0.5">{{ row.code }}</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 bg-surface-soft text-secondary">{{ connectorTypeLabel(row.connector_type) }}</span>
|
||||
</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="row.environment === 'prod' ? 'bg-green-100 text-green-700' : row.environment === 'test' ? 'bg-amber-100 text-amber-700' : 'bg-surface-soft text-secondary'"
|
||||
>{{ envLabel(row.environment) }}</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 max-w-[240px]">
|
||||
<span v-if="row.endpoint" class="block truncate text-xs font-mono text-secondary" :title="row.endpoint">{{ row.endpoint }}</span>
|
||||
<span v-else class="text-xs text-muted">—</span>
|
||||
</td>
|
||||
<td class="px-6 py-4">
|
||||
<button
|
||||
type="button"
|
||||
role="switch"
|
||||
:aria-checked="row.enabled"
|
||||
:title="t('admin.integrationConnector.fields.enabled')"
|
||||
class="relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors"
|
||||
:class="row.enabled ? 'bg-brand-600' : 'bg-slate-300'"
|
||||
data-testid="client-toggle"
|
||||
:disabled="lifecycleBusy"
|
||||
@click="toggleClient(row)"
|
||||
>
|
||||
<span class="inline-block h-4 w-4 transform rounded-full bg-white shadow transition-transform" :class="row.enabled ? 'translate-x-4' : 'translate-x-0.5'" />
|
||||
</button>
|
||||
<button type="button" class="p-2 rounded-lg text-muted hover:bg-surface-soft hover:text-secondary" :title="t('admin.edit')" @click="openEditModal('client', row)">
|
||||
<Edit class="w-4 h-4" />
|
||||
</td>
|
||||
<td class="px-6 py-4">
|
||||
<span v-if="testingClientCode === row.code" class="text-xs text-muted">{{ t('admin.integrationConnector.msg.testing') }}</span>
|
||||
<button
|
||||
v-else-if="testResultOf(row.code)"
|
||||
type="button"
|
||||
class="inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium"
|
||||
:class="testBadgeClass(row.code)"
|
||||
:title="t('admin.integrationConnector.testDetailToggle')"
|
||||
data-testid="client-test-badge"
|
||||
@click="expandedTestCode = expandedTestCode === row.code ? '' : row.code"
|
||||
>
|
||||
{{ testBadgeText(row.code) }}
|
||||
</button>
|
||||
<button type="button" class="p-2 rounded-lg text-muted hover:bg-red-50 hover:text-red-600" :title="t('admin.delete')" @click="deleteClient(row.code)">
|
||||
<Trash2 class="w-4 h-4" />
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<span v-else class="text-xs text-muted">—</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 text-right">
|
||||
<div class="inline-flex items-center gap-1">
|
||||
<button type="button" class="p-2 rounded-lg text-muted hover:bg-brand-50 hover:text-brand-600" :title="t('admin.integrationConnector.test')" @click="testConnection(row.code)">
|
||||
<Plug class="w-4 h-4" />
|
||||
</button>
|
||||
<button type="button" class="p-2 rounded-lg text-muted hover:bg-surface-soft hover:text-secondary" :title="t('admin.edit')" @click="openEditModal('client', row)">
|
||||
<Edit class="w-4 h-4" />
|
||||
</button>
|
||||
<button type="button" class="p-2 rounded-lg text-muted hover:bg-red-50 hover:text-red-600" :title="t('admin.delete')" @click="deleteClient(row)">
|
||||
<Trash2 class="w-4 h-4" />
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<!-- 测试详情展开行:原因码 + 脱敏消息 -->
|
||||
<tr v-if="expandedTestCode === row.code && testResultOf(row.code)">
|
||||
<td colspan="7" class="px-6 py-3 bg-surface-soft" data-testid="client-test-detail">
|
||||
<p class="text-xs font-mono text-secondary break-all">{{ testDetailText(row.code) }}</p>
|
||||
</td>
|
||||
</tr>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
<p v-if="testResultText" class="mt-3 rounded-lg bg-surface-soft p-3 text-xs font-mono text-secondary whitespace-pre-wrap break-all">{{ testResultText }}</p>
|
||||
</div>
|
||||
|
||||
<!-- 接口定义 -->
|
||||
<!-- 接口定义:状态徽章 + 生命周期行内按钮(发布/撤回/退役/恢复,后端转移表校验) -->
|
||||
<div v-else-if="activeTab === 'interface'" class="admin-table-wrap">
|
||||
<table class="admin-table">
|
||||
<thead>
|
||||
@@ -132,8 +289,8 @@ function selectTab(key: TabKey) {
|
||||
<th class="px-6 py-4 text-left text-xs">{{ t('admin.integrationConnector.headers.code') }}</th>
|
||||
<th class="px-6 py-4 text-left text-xs">{{ t('admin.integrationConnector.headers.name') }}</th>
|
||||
<th class="px-6 py-4 text-left text-xs">{{ t('admin.integrationConnector.headers.clientInstance') }}</th>
|
||||
<th class="px-6 py-4 text-left text-xs">{{ t('admin.integrationConnector.headers.status') }}</th>
|
||||
<th class="px-6 py-4 text-right text-xs w-24">{{ t('admin.integrationConnector.headers.actions') }}</th>
|
||||
<th class="px-6 py-4 text-left text-xs w-28">{{ t('admin.integrationConnector.headers.status') }}</th>
|
||||
<th class="px-6 py-4 text-right text-xs w-48">{{ t('admin.integrationConnector.headers.actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -141,10 +298,48 @@ function selectTab(key: TabKey) {
|
||||
<tr v-for="row in interfaces" :key="row.code">
|
||||
<td class="px-6 py-4 text-sm font-medium text-primary mono">{{ row.code }}</td>
|
||||
<td class="px-6 py-4 text-sm text-secondary">{{ row.name }}</td>
|
||||
<td class="px-6 py-4 text-sm text-secondary">{{ row.client_instance_code }}</td>
|
||||
<td class="px-6 py-4 text-sm text-secondary">{{ row.status }}</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>
|
||||
</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="interface-status">{{ statusLabel(row.status) }}</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 text-right">
|
||||
<div class="inline-flex items-center gap-1">
|
||||
<!-- 生命周期按钮按当前状态显隐:draft→发布;published→撤回+退役;retired→恢复;按钮不换行防窄列折字 -->
|
||||
<button
|
||||
v-if="row.status === 'draft'"
|
||||
type="button"
|
||||
class="whitespace-nowrap px-2 py-1 rounded-md text-xs font-medium text-brand-600 hover:bg-brand-50 disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
data-testid="interface-publish"
|
||||
:disabled="lifecycleBusy"
|
||||
@click="changeInterfaceLifecycle(row, 'publish')"
|
||||
>{{ t('admin.integrationConnector.lifecycle.publish') }}</button>
|
||||
<template v-else-if="row.status === 'published'">
|
||||
<button
|
||||
type="button"
|
||||
class="whitespace-nowrap px-2 py-1 rounded-md text-xs font-medium text-secondary hover:bg-surface-soft disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
data-testid="interface-unpublish"
|
||||
:disabled="lifecycleBusy"
|
||||
@click="changeInterfaceLifecycle(row, 'unpublish')"
|
||||
>{{ t('admin.integrationConnector.lifecycle.unpublish') }}</button>
|
||||
<button
|
||||
type="button"
|
||||
class="whitespace-nowrap px-2 py-1 rounded-md text-xs font-medium text-amber-600 hover:bg-amber-50 disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
data-testid="interface-retire"
|
||||
:disabled="lifecycleBusy"
|
||||
@click="changeInterfaceLifecycle(row, 'retire')"
|
||||
>{{ t('admin.integrationConnector.lifecycle.retire') }}</button>
|
||||
</template>
|
||||
<button
|
||||
v-else-if="row.status === 'retired'"
|
||||
type="button"
|
||||
class="whitespace-nowrap px-2 py-1 rounded-md text-xs font-medium text-secondary hover:bg-surface-soft disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
data-testid="interface-reopen"
|
||||
:disabled="lifecycleBusy"
|
||||
@click="changeInterfaceLifecycle(row, 'reopen')"
|
||||
>{{ t('admin.integrationConnector.lifecycle.reopen') }}</button>
|
||||
<button type="button" class="p-2 rounded-lg text-muted hover:bg-surface-soft hover:text-secondary" :title="t('admin.edit')" @click="openEditModal('interface', row)">
|
||||
<Edit class="w-4 h-4" />
|
||||
</button>
|
||||
@@ -155,7 +350,7 @@ function selectTab(key: TabKey) {
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- 绑定 -->
|
||||
<!-- 绑定:状态徽章 + 生命周期行内按钮(发布/撤回/退役/恢复,后端转移表 + 发布就绪门禁校验) -->
|
||||
<div v-else-if="activeTab === 'binding'" class="admin-table-wrap">
|
||||
<table class="admin-table">
|
||||
<thead>
|
||||
@@ -163,19 +358,64 @@ function selectTab(key: TabKey) {
|
||||
<th class="px-6 py-4 text-left text-xs">{{ t('admin.integrationConnector.headers.capability') }}</th>
|
||||
<th class="px-6 py-4 text-left text-xs">{{ t('admin.integrationConnector.headers.clientInstance') }}</th>
|
||||
<th class="px-6 py-4 text-left text-xs">{{ t('admin.integrationConnector.headers.interfaceDef') }}</th>
|
||||
<th class="px-6 py-4 text-left text-xs">{{ t('admin.integrationConnector.headers.status') }}</th>
|
||||
<th class="px-6 py-4 text-right text-xs w-24">{{ t('admin.integrationConnector.headers.actions') }}</th>
|
||||
<th class="px-6 py-4 text-left text-xs w-28">{{ t('admin.integrationConnector.headers.status') }}</th>
|
||||
<th class="px-6 py-4 text-right text-xs w-48">{{ t('admin.integrationConnector.headers.actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-if="bindings.length === 0"><td colspan="5" class="px-6 admin-table-empty">{{ t('admin.integrationConnector.empty') }}</td></tr>
|
||||
<tr v-for="row in bindings" :key="row.id">
|
||||
<td class="px-6 py-4 text-sm font-medium text-primary">{{ row.capability }}</td>
|
||||
<td class="px-6 py-4 text-sm text-secondary">{{ row.client_instance_code }}</td>
|
||||
<td class="px-6 py-4 text-sm text-secondary">{{ row.interface_definition_code }}</td>
|
||||
<td class="px-6 py-4 text-sm text-secondary">{{ row.status }}</td>
|
||||
<!-- 能力引用列与客户端/接口引用列同款「名称 + 编码」两行;无中文翻译时只显注册名避免重复 -->
|
||||
<td class="px-6 py-4">
|
||||
<p class="text-sm text-primary">{{ capabilityLabelOf(row.capability) }}</p>
|
||||
<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>
|
||||
</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>
|
||||
</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>
|
||||
</td>
|
||||
<td class="px-6 py-4 text-right">
|
||||
<div class="inline-flex items-center gap-1">
|
||||
<!-- 生命周期按钮按当前状态显隐:draft→发布;published→撤回+退役;retired→恢复;按钮不换行防窄列折字 -->
|
||||
<button
|
||||
v-if="row.status === 'draft'"
|
||||
type="button"
|
||||
class="whitespace-nowrap px-2 py-1 rounded-md text-xs font-medium text-brand-600 hover:bg-brand-50 disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
data-testid="binding-publish"
|
||||
:disabled="lifecycleBusy"
|
||||
@click="changeBindingLifecycle(row, 'publish')"
|
||||
>{{ t('admin.integrationConnector.lifecycle.publish') }}</button>
|
||||
<template v-else-if="row.status === 'published'">
|
||||
<button
|
||||
type="button"
|
||||
class="whitespace-nowrap px-2 py-1 rounded-md text-xs font-medium text-secondary hover:bg-surface-soft disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
data-testid="binding-unpublish"
|
||||
:disabled="lifecycleBusy"
|
||||
@click="changeBindingLifecycle(row, 'unpublish')"
|
||||
>{{ t('admin.integrationConnector.lifecycle.unpublish') }}</button>
|
||||
<button
|
||||
type="button"
|
||||
class="whitespace-nowrap px-2 py-1 rounded-md text-xs font-medium text-amber-600 hover:bg-amber-50 disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
data-testid="binding-retire"
|
||||
:disabled="lifecycleBusy"
|
||||
@click="changeBindingLifecycle(row, 'retire')"
|
||||
>{{ t('admin.integrationConnector.lifecycle.retire') }}</button>
|
||||
</template>
|
||||
<button
|
||||
v-else-if="row.status === 'retired'"
|
||||
type="button"
|
||||
class="whitespace-nowrap px-2 py-1 rounded-md text-xs font-medium text-secondary hover:bg-surface-soft disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
data-testid="binding-reopen"
|
||||
:disabled="lifecycleBusy"
|
||||
@click="changeBindingLifecycle(row, 'reopen')"
|
||||
>{{ t('admin.integrationConnector.lifecycle.reopen') }}</button>
|
||||
<button type="button" class="p-2 rounded-lg text-muted hover:bg-surface-soft hover:text-secondary" :title="t('admin.edit')" @click="openEditModal('binding', row)">
|
||||
<Edit class="w-4 h-4" />
|
||||
</button>
|
||||
@@ -192,19 +432,40 @@ function selectTab(key: TabKey) {
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="px-6 py-4 text-left text-xs">{{ t('admin.integrationConnector.headers.code') }}</th>
|
||||
<th class="px-6 py-4 text-left text-xs">{{ t('admin.integrationConnector.headers.secretRef') }}</th>
|
||||
<th class="px-6 py-4 text-left text-xs">{{ t('admin.integrationConnector.headers.connectorType') }}</th>
|
||||
<th class="px-6 py-4 text-left text-xs">{{ t('admin.integrationConnector.headers.account') }}</th>
|
||||
<th class="px-6 py-4 text-left text-xs">{{ t('admin.integrationConnector.headers.secretProvider') }}</th>
|
||||
<th class="px-6 py-4 text-left text-xs">{{ t('admin.integrationConnector.headers.status') }}</th>
|
||||
<th class="px-6 py-4 text-right text-xs w-24">{{ t('admin.integrationConnector.headers.actions') }}</th>
|
||||
<th class="px-6 py-4 text-left text-xs">{{ t('admin.integrationConnector.fields.enabled') }}</th>
|
||||
<th class="px-6 py-4 text-right text-xs w-32">{{ t('admin.integrationConnector.headers.actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-if="credentials.length === 0"><td colspan="5" class="px-6 admin-table-empty">{{ t('admin.integrationConnector.empty') }}</td></tr>
|
||||
<tr v-if="credentials.length === 0"><td colspan="6" class="px-6 admin-table-empty">{{ t('admin.integrationConnector.empty') }}</td></tr>
|
||||
<tr v-for="row in credentials" :key="row.code">
|
||||
<td class="px-6 py-4 text-sm font-medium text-primary mono">{{ row.code }}</td>
|
||||
<td class="px-6 py-4 text-sm text-secondary mono">{{ row.secret_ref }}</td>
|
||||
<td class="px-6 py-4 text-sm text-secondary">{{ row.secret_provider }}</td>
|
||||
<td class="px-6 py-4 text-sm text-secondary">{{ row.status }}</td>
|
||||
<td class="px-6 py-4 text-sm">
|
||||
<span class="inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium bg-surface-soft text-secondary">{{ credentialTypeLabel(row.credential_type) }}</span>
|
||||
</td>
|
||||
<td class="px-6 py-4 text-sm text-secondary mono">{{ credentialAccountText(row) }}</td>
|
||||
<td class="px-6 py-4 text-sm">
|
||||
<span class="inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium bg-surface-soft text-secondary" :title="row.secret_provider === 'db' ? statusLabel('db') : row.secret_ref">{{ secretProviderLabel(row.secret_provider) }}</span>
|
||||
</td>
|
||||
<td class="px-6 py-4">
|
||||
<!-- 行内启停开关:布尔语义,与客户端实例开关完全同款(含 title 用同一 i18n 键);rotating 视为启用侧,点击即停用;解析层只认 active,停用即断流 -->
|
||||
<button
|
||||
type="button"
|
||||
role="switch"
|
||||
:aria-checked="row.status !== 'retired'"
|
||||
:title="t('admin.integrationConnector.fields.enabled')"
|
||||
class="relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors"
|
||||
:class="row.status !== 'retired' ? 'bg-brand-600' : 'bg-slate-300'"
|
||||
data-testid="credential-status-toggle"
|
||||
:disabled="lifecycleBusy"
|
||||
@click="toggleCredential(row)"
|
||||
>
|
||||
<span class="inline-block h-4 w-4 transform rounded-full bg-white shadow transition-transform" :class="row.status !== 'retired' ? 'translate-x-4' : 'translate-x-0.5'" />
|
||||
</button>
|
||||
</td>
|
||||
<td class="px-6 py-4 text-right">
|
||||
<div class="inline-flex items-center gap-1">
|
||||
<button type="button" class="p-2 rounded-lg text-muted hover:bg-surface-soft hover:text-secondary" :title="t('admin.edit')" @click="openEditModal('credential', row)">
|
||||
@@ -231,9 +492,13 @@ function selectTab(key: TabKey) {
|
||||
<tbody>
|
||||
<tr v-if="capabilities.length === 0"><td colspan="4" class="px-6 admin-table-empty">{{ t('admin.integrationConnector.empty') }}</td></tr>
|
||||
<tr v-for="row in capabilities" :key="row.name">
|
||||
<td class="px-6 py-4 text-sm font-medium text-primary">{{ row.name }}</td>
|
||||
<td class="px-6 py-4 text-sm text-secondary">{{ row.write ? 'yes' : 'no' }}</td>
|
||||
<td class="px-6 py-4 text-sm text-secondary">{{ row.idempotency }}</td>
|
||||
<!-- 中文名称为主行,注册名作为精确标识(绑定引用用)保留为次行;无中文翻译时只显注册名避免重复 -->
|
||||
<td class="px-6 py-4">
|
||||
<p class="text-sm font-medium text-primary">{{ capabilityLabelOf(row.name) }}</p>
|
||||
<p v-if="capabilityLabelOf(row.name) !== row.name" class="text-xs text-muted mono mt-0.5">{{ row.name }}</p>
|
||||
</td>
|
||||
<td class="px-6 py-4 text-sm text-secondary">{{ row.write ? t('admin.integrationConnector.writeLabels.yes') : t('admin.integrationConnector.writeLabels.no') }}</td>
|
||||
<td class="px-6 py-4 text-sm text-secondary">{{ idempotencyLabel(row.idempotency) }}</td>
|
||||
<td class="px-6 py-4 text-right">
|
||||
<button type="button" class="inline-flex items-center gap-2 px-3 py-1.5 rounded-lg text-sm font-medium text-brand-600 hover:bg-brand-50" @click="openCallModal(row.name)">
|
||||
<PlayCircle class="w-4 h-4" />
|
||||
@@ -246,7 +511,7 @@ function selectTab(key: TabKey) {
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<IntegrationConnectorFormModal
|
||||
<IntegrationConnectorFormDrawer
|
||||
:visible="showFormModal"
|
||||
:active-entity="activeEntity"
|
||||
:client-form="clientForm"
|
||||
@@ -257,6 +522,8 @@ function selectTab(key: TabKey) {
|
||||
:client-options="clientOptions"
|
||||
:interface-options="interfaceOptions"
|
||||
:capability-options="capabilityOptions"
|
||||
:credential-type-options="credentialTypes"
|
||||
:credential-options="credentialOptions"
|
||||
@close="closeFormModal"
|
||||
@save="saveActive"
|
||||
/>
|
||||
|
||||
+18
@@ -13,6 +13,7 @@ import type {
|
||||
IntegrationCapabilityRow,
|
||||
IntegrationClientInstanceRow,
|
||||
IntegrationCredentialReferenceRow,
|
||||
IntegrationCredentialTypeSpec,
|
||||
IntegrationInterfaceDefinitionRow,
|
||||
} from '../types/integration-connector.types';
|
||||
|
||||
@@ -74,6 +75,13 @@ export const updateIntegrationInterfaceDefinition = (code: string, payload: Reco
|
||||
method: 'PUT', ...jsonAuth(), body: JSON.stringify(payload),
|
||||
});
|
||||
|
||||
/** 接口定义生命周期动作(publish/unpublish/retire/reopen);状态只能经此流转。 */
|
||||
export const changeIntegrationInterfaceLifecycle = (code: string, action: 'publish' | 'unpublish' | 'retire' | 'reopen') =>
|
||||
requestJson<IntegrationInterfaceDefinitionRow>(
|
||||
`${BASE}/interface-definitions/${encodeURIComponent(code)}/${action}`,
|
||||
{ method: 'POST', ...jsonAuth(), body: JSON.stringify({}) },
|
||||
);
|
||||
|
||||
// ---- 绑定 ----
|
||||
|
||||
export const listIntegrationBindings = () =>
|
||||
@@ -89,11 +97,21 @@ export const updateIntegrationBinding = (id: number, payload: Record<string, unk
|
||||
method: 'PUT', ...jsonAuth(), body: JSON.stringify(payload),
|
||||
});
|
||||
|
||||
/** 绑定生命周期动作(publish/unpublish/retire/reopen);状态只能经此流转。 */
|
||||
export const changeIntegrationBindingLifecycle = (id: number, action: 'publish' | 'unpublish' | 'retire' | 'reopen') =>
|
||||
requestJson<IntegrationBindingRow>(
|
||||
`${BASE}/bindings/${id}/${action}`,
|
||||
{ method: 'POST', ...jsonAuth(), body: JSON.stringify({}) },
|
||||
);
|
||||
|
||||
// ---- 凭据引用 ----
|
||||
|
||||
export const listIntegrationCredentialReferences = () =>
|
||||
requestJson<IntegrationCredentialReferenceRow[]>(`${BASE}/credential-references`, auth());
|
||||
|
||||
export const listIntegrationCredentialTypes = () =>
|
||||
requestJson<IntegrationCredentialTypeSpec[]>(`${BASE}/credential-references/types`, auth());
|
||||
|
||||
export const createIntegrationCredentialReference = (payload: Record<string, unknown>) =>
|
||||
requestJson<IntegrationCredentialReferenceRow>(`${BASE}/credential-references`, {
|
||||
method: 'POST', ...jsonAuth(), body: JSON.stringify(payload),
|
||||
|
||||
+410
@@ -0,0 +1,410 @@
|
||||
/**
|
||||
* features/admin/modules/integration-connector/components/IntegrationConnectorFormDrawer.spec.ts
|
||||
* 用途:锁定表单按连接器类型动态显示字段——REST 显示超时/HTTP方法/请求路径,
|
||||
* SOAP 显示 WSDL;以及抽屉化后的 JSON 编辑字段(格式化/失焦校验)、
|
||||
* 脏检查关闭确认与 Esc 关闭行为。
|
||||
* 依赖:@vue/test-utils、vitest、i18n。
|
||||
* 逻辑:切换 connector_type 断言字段可见性;对 JsonTextareaField 断言格式化改写
|
||||
* 与非法 JSON 提示;mock window.confirm 断言脏表单关闭拦截与放行。
|
||||
*/
|
||||
import { mount, enableAutoUnmount } from '@vue/test-utils';
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
import i18n from '@/i18n';
|
||||
import IntegrationConnectorFormDrawer from './IntegrationConnectorFormDrawer.vue';
|
||||
import JsonTextareaField from './JsonTextareaField.vue';
|
||||
import {
|
||||
createEmptyClientInstanceForm,
|
||||
createEmptyInterfaceDefinitionForm,
|
||||
createEmptyBindingForm,
|
||||
createEmptyCredentialReferenceForm,
|
||||
type InterfaceDefinitionFormState,
|
||||
} from '../types/integration-connector.types';
|
||||
|
||||
enableAutoUnmount(afterEach);
|
||||
|
||||
function mountDrawer(overrides: Partial<Record<string, unknown>> = {}) {
|
||||
return mount(IntegrationConnectorFormDrawer, {
|
||||
props: {
|
||||
visible: true,
|
||||
activeEntity: 'client',
|
||||
clientForm: createEmptyClientInstanceForm(),
|
||||
interfaceForm: createEmptyInterfaceDefinitionForm(),
|
||||
bindingForm: createEmptyBindingForm(),
|
||||
credentialForm: createEmptyCredentialReferenceForm(),
|
||||
isSaving: false,
|
||||
clientOptions: [],
|
||||
interfaceOptions: [],
|
||||
capabilityOptions: [],
|
||||
credentialTypeOptions: [
|
||||
{ type: 'password', fields: [
|
||||
{ key: 'username', secret: false, required: true },
|
||||
{ key: 'password', secret: true, required: true },
|
||||
] },
|
||||
{ type: 'token', fields: [{ key: 'token', secret: true, required: true }] },
|
||||
],
|
||||
...overrides,
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
}
|
||||
|
||||
describe('IntegrationConnectorFormDrawer connector-type fields', () => {
|
||||
it('REST 默认显示接口地址与超时字段', () => {
|
||||
const wrapper = mountDrawer();
|
||||
expect(wrapper.find('[data-testid="client-endpoint"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="client-timeout"]').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('切换到 SOAP 后连接地址 label 变为 WSDL,超时仍显示;同一 endpoint 字段', async () => {
|
||||
const wrapper = mountDrawer();
|
||||
await wrapper.find('[data-testid="client-connector-type"]').setValue('soap');
|
||||
await wrapper.vm.$nextTick();
|
||||
// 连接地址仍是同一 client-endpoint 字段,仅 label 变 WSDL
|
||||
expect(wrapper.find('[data-testid="client-endpoint"]').exists()).toBe(true);
|
||||
// 超时在 SOAP 下也显示
|
||||
expect(wrapper.find('[data-testid="client-timeout"]').exists()).toBe(true);
|
||||
const labels = wrapper.findAll('label').map((l) => l.text());
|
||||
expect(labels.some((t) => t.includes('WSDL'))).toBe(true);
|
||||
});
|
||||
|
||||
it('接口定义 REST 显示 HTTP 方法与请求路径', () => {
|
||||
const wrapper = mountDrawer({ activeEntity: 'interface' });
|
||||
const labels = wrapper.findAll('label').map((l) => l.text());
|
||||
expect(labels.some((t) => t.includes('HTTP 方法'))).toBe(true);
|
||||
expect(labels.some((t) => t.includes('请求路径'))).toBe(true);
|
||||
});
|
||||
|
||||
it('接口定义:选客户端实例后编码自动建议为「客户端编码-名称slug」,连接器类型为同款禁用下拉随客户端联动', async () => {
|
||||
const interfaceForm = createEmptyInterfaceDefinitionForm();
|
||||
interfaceForm.name = '鼎捷TOPGP库存查询GetItemStockList';
|
||||
const wrapper = mountDrawer({
|
||||
activeEntity: 'interface',
|
||||
interfaceForm,
|
||||
clientOptions: [{ code: '1001', name: '鼎捷TOPGP', connector_type: 'soap' }],
|
||||
});
|
||||
await wrapper.find('[data-testid="interface-client"]').setValue('1001');
|
||||
// 编码留空 → 按客户端编码 + 名称 slug 自动建议
|
||||
expect(interfaceForm.code).toBe('1001-topgp-getitemstocklist');
|
||||
// 连接器类型与客户端实例同款下拉控件,仅禁用只读:随所选客户端联动展示
|
||||
const typeSelect = wrapper.find('[data-testid="interface-connector-type"]');
|
||||
expect(typeSelect.text()).toContain('SOAP');
|
||||
expect(typeSelect.attributes('disabled')).toBeDefined();
|
||||
// 只渲染当前类型单项,不提供其他选项(不可改选)
|
||||
expect(typeSelect.findAll('option').length).toBe(1);
|
||||
});
|
||||
|
||||
it('接口定义:状态在底部操作条以状态胶囊只读展示(悬停承载说明),无启用勾选', () => {
|
||||
const interfaceForm = createEmptyInterfaceDefinitionForm();
|
||||
interfaceForm.status = 'published';
|
||||
const wrapper = mountDrawer({ activeEntity: 'interface', interfaceForm });
|
||||
// 操作条只放安静的状态指示器:彩点胶囊,不放表单控件与多行文案;长说明走悬停 title
|
||||
const chip = wrapper.find('[data-testid="lifecycle-status-chip"]');
|
||||
expect(chip.exists()).toBe(true);
|
||||
expect(chip.text()).toContain('已发布');
|
||||
expect(chip.attributes('title')).toContain('发布');
|
||||
// 启用勾选已移除
|
||||
expect(wrapper.findAll('input[type="checkbox"]').length).toBe(0);
|
||||
});
|
||||
|
||||
it('绑定:无来源实例编码字段,状态在底部操作条以禁用下拉只读展示', () => {
|
||||
const wrapper = mountDrawer({ activeEntity: 'binding' });
|
||||
const labels = wrapper.findAll('label').map((l) => l.text());
|
||||
// 来源快捷列已删除:路由条件统一走高级配置 JSON
|
||||
expect(labels.some((t) => t.includes('来源实例编码'))).toBe(false);
|
||||
// 状态胶囊在底部操作条(转移只经列表生命周期按钮)
|
||||
const chip = wrapper.find('[data-testid="lifecycle-status-chip"]');
|
||||
expect(chip.exists()).toBe(true);
|
||||
expect(chip.attributes('title')).toContain('发布');
|
||||
});
|
||||
|
||||
it('绑定:选定接口定义后客户端实例自动带出并锁定', async () => {
|
||||
const bindingForm = createEmptyBindingForm();
|
||||
const wrapper = mountDrawer({
|
||||
activeEntity: 'binding',
|
||||
bindingForm,
|
||||
clientOptions: [
|
||||
{ code: '1001', name: '鼎捷TOPGP' },
|
||||
{ code: '2001', name: '另一实例' },
|
||||
],
|
||||
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();
|
||||
});
|
||||
|
||||
it('绑定能力下拉选项本地化:有翻译显示「中文名(注册名)」,无翻译兜底注册名', () => {
|
||||
const wrapper = mountDrawer({
|
||||
activeEntity: 'binding',
|
||||
capabilityOptions: [
|
||||
{ name: 'in_transit_transfer.query_inventory' },
|
||||
{ name: 'unknown.capability' },
|
||||
],
|
||||
});
|
||||
// 能力下拉是绑定表单首个 select;选项不再出现原始注册名裸文案
|
||||
const capabilitySelect = wrapper.find('select');
|
||||
expect(capabilitySelect.findAll('option').map((o) => o.text())).toEqual([
|
||||
'在途库存查询(in_transit_transfer.query_inventory)',
|
||||
'unknown.capability',
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe('IntegrationConnectorFormDrawer JSON fields', () => {
|
||||
function findJsonField(wrapper: ReturnType<typeof mountDrawer>, labelPart: string) {
|
||||
const field = wrapper
|
||||
.findAllComponents(JsonTextareaField)
|
||||
.find((w) => String(w.props('label')).includes(labelPart));
|
||||
expect(field, `未找到 label 含 ${labelPart} 的 JSON 字段`).toBeDefined();
|
||||
return field!;
|
||||
}
|
||||
|
||||
it('接口定义 4 个 JSON 字段纵向全宽堆叠渲染', () => {
|
||||
const wrapper = mountDrawer({ activeEntity: 'interface' });
|
||||
const labels = wrapper.findAllComponents(JsonTextareaField).map((w) => String(w.props('label')));
|
||||
expect(labels.some((t) => t.includes('请求模板'))).toBe(true);
|
||||
expect(labels.some((t) => t.includes('入参 Schema'))).toBe(true);
|
||||
expect(labels.some((t) => t.includes('回传映射'))).toBe(true);
|
||||
expect(labels.some((t) => t.includes('出参 Schema'))).toBe(true);
|
||||
});
|
||||
|
||||
it('格式化按钮将合法 JSON pretty-print 写回表单 state', async () => {
|
||||
const interfaceForm: InterfaceDefinitionFormState = createEmptyInterfaceDefinitionForm();
|
||||
const wrapper = mountDrawer({ activeEntity: 'interface', interfaceForm });
|
||||
const field = findJsonField(wrapper, '请求模板');
|
||||
await field!.find('[data-testid="json-textarea"]').setValue('{"method":"POST","params":["erp_org"]}');
|
||||
await field!.find('[data-testid="json-format-button"]').trigger('click');
|
||||
// 断言格式化结果写回父级表单对象(v-model 链路)
|
||||
expect(interfaceForm.request_spec_json).toBe('{\n "method": "POST",\n "params": [\n "erp_org"\n ]\n}');
|
||||
});
|
||||
|
||||
it('非法 JSON 失焦后显示红字提示,格式化不改写内容', async () => {
|
||||
const interfaceForm: InterfaceDefinitionFormState = createEmptyInterfaceDefinitionForm();
|
||||
const wrapper = mountDrawer({ activeEntity: 'interface', interfaceForm });
|
||||
const field = findJsonField(wrapper, '请求模板');
|
||||
const textarea = field!.find('[data-testid="json-textarea"]');
|
||||
await textarea.setValue('{ invalid');
|
||||
expect(field!.find('[data-testid="json-error"]').exists()).toBe(false);
|
||||
await textarea.trigger('blur');
|
||||
// 失焦后才提示,输入过程中不打断
|
||||
expect(field!.find('[data-testid="json-error"]').exists()).toBe(true);
|
||||
expect(field!.find('[data-testid="json-error"]').text()).toContain('JSON 格式无效');
|
||||
// 非法时格式化按钮不改写内容
|
||||
await field!.find('[data-testid="json-format-button"]').trigger('click');
|
||||
expect(interfaceForm.request_spec_json).toBe('{ invalid');
|
||||
});
|
||||
|
||||
it('客户端实例与绑定实体的 JSON 字段同样启用格式化能力', () => {
|
||||
const clientWrapper = mountDrawer({ activeEntity: 'client' });
|
||||
expect(findJsonField(clientWrapper, '连接配置').find('[data-testid="json-format-button"]').exists()).toBe(true);
|
||||
const bindingWrapper = mountDrawer({ activeEntity: 'binding' });
|
||||
expect(findJsonField(bindingWrapper, '高级路由条件').find('[data-testid="json-format-button"]').exists()).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('IntegrationConnectorFormDrawer close guard', () => {
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('抽屉带 dialog 语义且打开时渲染标题', () => {
|
||||
const wrapper = mountDrawer({ activeEntity: 'client' });
|
||||
const dialog = wrapper.find('[role="dialog"]');
|
||||
expect(dialog.exists()).toBe(true);
|
||||
expect(dialog.attributes('aria-modal')).toBe('true');
|
||||
expect(dialog.attributes('aria-label')).toContain('客户端实例');
|
||||
});
|
||||
|
||||
it('干净表单点击遮罩直接关闭,不弹确认', async () => {
|
||||
const confirmSpy = vi.spyOn(window, 'confirm').mockReturnValue(false);
|
||||
const wrapper = mountDrawer();
|
||||
await wrapper.find('[data-testid="connector-form-drawer"]').trigger('click');
|
||||
expect(wrapper.emitted('close')).toHaveLength(1);
|
||||
expect(confirmSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('脏表单关闭先确认:拒绝则留在抽屉,允许才 emit close', async () => {
|
||||
const confirmSpy = vi.spyOn(window, 'confirm').mockReturnValue(false);
|
||||
const wrapper = mountDrawer();
|
||||
await wrapper.find('[data-testid="client-endpoint"]').setValue('https://erp.example.com');
|
||||
await wrapper.find('[data-testid="connector-form-drawer"]').trigger('click');
|
||||
// 用户拒绝关闭 → 不 emit
|
||||
expect(confirmSpy).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.emitted('close')).toBeUndefined();
|
||||
|
||||
confirmSpy.mockReturnValue(true);
|
||||
await wrapper.find('[data-testid="connector-form-drawer"]').trigger('click');
|
||||
// 用户确认放弃 → 放行关闭
|
||||
expect(wrapper.emitted('close')).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('Esc 关闭走同一确认入口(脏表单拒绝时不关闭)', async () => {
|
||||
const confirmSpy = vi.spyOn(window, 'confirm').mockReturnValue(false);
|
||||
const wrapper = mountDrawer();
|
||||
await wrapper.find('[data-testid="client-endpoint"]').setValue('https://erp.example.com');
|
||||
document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' }));
|
||||
expect(confirmSpy).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.emitted('close')).toBeUndefined();
|
||||
|
||||
// 干净表单 Esc 直接关闭
|
||||
const cleanWrapper = mountDrawer();
|
||||
document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' }));
|
||||
expect(cleanWrapper.emitted('close')).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('IntegrationConnectorFormDrawer credential modes', () => {
|
||||
it('db 模式按类型动态渲染字段(secret 字段为密码框),不显示 Secret 引用键', () => {
|
||||
const wrapper = mountDrawer({ activeEntity: 'credential' });
|
||||
const username = wrapper.find('[data-testid="credential-field-username"]');
|
||||
const password = wrapper.find('[data-testid="credential-field-password"]');
|
||||
expect(username.exists()).toBe(true);
|
||||
expect(password.exists()).toBe(true);
|
||||
expect(password.attributes('type')).toBe('password');
|
||||
expect(username.attributes('type')).toBe('text');
|
||||
expect(wrapper.find('[data-testid="credential-secret-ref"]').exists()).toBe(false);
|
||||
// 占位符提示列出该类型提供的 credential_* 键
|
||||
expect(wrapper.text()).toContain('{credential_username}');
|
||||
expect(wrapper.text()).toContain('{credential_password}');
|
||||
});
|
||||
|
||||
it('编辑态密文字段显示留空保持原值提示', () => {
|
||||
const form = { ...createEmptyCredentialReferenceForm(), id: 7, fields: { username: 'erp_user' } };
|
||||
const wrapper = mountDrawer({ activeEntity: 'credential', credentialForm: form });
|
||||
const password = wrapper.find('[data-testid="credential-field-password"]');
|
||||
expect(password.attributes('placeholder')).toContain('留空');
|
||||
expect((wrapper.find('[data-testid="credential-field-username"]').element as HTMLInputElement).value).toBe('erp_user');
|
||||
});
|
||||
|
||||
it('切换凭据类型到 token 后按新类型渲染字段', async () => {
|
||||
const wrapper = mountDrawer({ activeEntity: 'credential' });
|
||||
await wrapper.find('[data-testid="credential-type"]').setValue('token');
|
||||
expect(wrapper.find('[data-testid="credential-field-token"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="credential-field-username"]').exists()).toBe(false);
|
||||
expect(wrapper.text()).toContain('{credential_token}');
|
||||
});
|
||||
|
||||
it('切到 env 模式只显示 Secret 引用键,隐藏类型字段', async () => {
|
||||
const wrapper = mountDrawer({ activeEntity: 'credential' });
|
||||
await wrapper.find('[data-testid="credential-provider"]').setValue('env');
|
||||
expect(wrapper.find('[data-testid="credential-secret-ref"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="credential-field-username"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="credential-field-password"]').exists()).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('IntegrationConnectorFormDrawer credential identity freeze', () => {
|
||||
it('新建态:类型/来源下拉选项本地化渲染(与列表徽章一致),状态不进表单,无只读信息区', () => {
|
||||
const wrapper = mountDrawer({ activeEntity: 'credential' });
|
||||
const typeOptions = wrapper.find('[data-testid="credential-type"]').findAll('option');
|
||||
expect(typeOptions.map((o) => o.text())).toEqual(['账密', '令牌']);
|
||||
const providerOptions = wrapper.find('[data-testid="credential-provider"]').findAll('option');
|
||||
expect(providerOptions.map((o) => o.text())).toEqual(['界面维护(加密保存)', '环境变量']);
|
||||
// 状态由列表生命周期按钮流转,凭据表单只有来源/类型两个下拉
|
||||
expect(wrapper.findAll('select').length).toBe(2);
|
||||
// 新建态没有只读信息区
|
||||
expect(wrapper.find('[data-testid="credential-meta"]').exists()).toBe(false);
|
||||
// 正文分组:基本信息 + 凭据值
|
||||
expect(wrapper.text()).toContain('基本信息');
|
||||
expect(wrapper.text()).toContain('凭据值');
|
||||
});
|
||||
|
||||
it('编辑态:编码/类型/来源以同款禁用表单控件只读展示(不用徽章形态),启用开关在底部操作条', () => {
|
||||
const form = { ...createEmptyCredentialReferenceForm(), id: 7, code: 'tiptop-erp', credential_type: 'password', secret_provider: 'db', status: 'active' };
|
||||
const wrapper = mountDrawer({ activeEntity: 'credential', credentialForm: form });
|
||||
// 与新建态同款正常控件、禁用只读:编码输入框 + 来源/类型下拉(本地化文案,不出现裸枚举)
|
||||
const codeInput = wrapper.find('[data-testid="credential-code"]');
|
||||
expect((codeInput.element as HTMLInputElement).disabled).toBe(true);
|
||||
expect((codeInput.element as HTMLInputElement).value).toBe('tiptop-erp');
|
||||
const providerSelect = wrapper.find('[data-testid="credential-provider"]');
|
||||
expect(providerSelect.attributes('disabled')).toBeDefined();
|
||||
expect(providerSelect.text()).toContain('界面维护(加密保存)');
|
||||
const typeSelect = wrapper.find('[data-testid="credential-type"]');
|
||||
expect(typeSelect.attributes('disabled')).toBeDefined();
|
||||
expect(typeSelect.text()).toContain('账密');
|
||||
// 状态 = 底部操作条启用开关(随保存生效),悬停 title 说明停用断流后果
|
||||
const row = wrapper.find('[data-testid="credential-enabled-row"]');
|
||||
expect(row.exists()).toBe(true);
|
||||
expect(row.text()).toContain('随保存操作生效');
|
||||
const switchBtn = wrapper.find('[data-testid="credential-enabled-switch"]');
|
||||
expect(switchBtn.attributes('aria-checked')).toBe('true');
|
||||
expect(switchBtn.attributes('title')).toContain('立即失败');
|
||||
// 变更路径一句话提示
|
||||
expect(wrapper.text()).toContain('以上信息创建后不可更改');
|
||||
});
|
||||
|
||||
it('凭据值段占位符逐个以代码徽章展示', () => {
|
||||
const wrapper = mountDrawer({ activeEntity: 'credential' });
|
||||
const chips = wrapper.findAll('[data-testid="credential-placeholder-chip"]');
|
||||
expect(chips.map((c) => c.text())).toEqual(['{credential_username}', '{credential_password}']);
|
||||
});
|
||||
});
|
||||
|
||||
describe('IntegrationConnectorFormDrawer client form redesign', () => {
|
||||
it('名称失焦且编码为空时自动建议 kebab-case 编码;已填编码不被覆盖', async () => {
|
||||
const clientForm = createEmptyClientInstanceForm();
|
||||
const wrapper = mountDrawer({ clientForm });
|
||||
await wrapper.find('[data-testid="client-name"]').setValue('ERP X');
|
||||
await wrapper.find('[data-testid="client-name"]').trigger('blur');
|
||||
expect(clientForm.code).toBe('erp-x');
|
||||
|
||||
await wrapper.find('[data-testid="client-name"]').setValue('Another Name');
|
||||
await wrapper.find('[data-testid="client-name"]').trigger('blur');
|
||||
expect(clientForm.code).toBe('erp-x');
|
||||
});
|
||||
|
||||
it('编辑态编码锁定不可改,类型/环境下拉本地化渲染', async () => {
|
||||
const clientForm = { ...createEmptyClientInstanceForm(), id: 3, code: 'erp-x' };
|
||||
const wrapper = mountDrawer({ clientForm });
|
||||
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 服务']);
|
||||
const envOptions = wrapper.find('[data-testid="client-environment"]').findAll('option');
|
||||
expect(envOptions.map((o) => o.text())).toEqual(['开发', '测试', '生产']);
|
||||
});
|
||||
|
||||
it('凭据引用为下拉选择(含「无(匿名访问)」空项),高级配置按类型给出生效键提示', async () => {
|
||||
const wrapper = mountDrawer({
|
||||
credentialOptions: [{ code: 'tiptop-erp' }, { code: 'wms-token' }],
|
||||
});
|
||||
const credOptions = wrapper.find('[data-testid="client-credential-ref"]').findAll('option');
|
||||
expect(credOptions.map((o) => o.text())).toEqual(['无(匿名访问)', 'tiptop-erp', 'wms-token']);
|
||||
// REST:高级配置提示列出生效键 headers
|
||||
expect(wrapper.text()).toContain('"headers"');
|
||||
// 切到 SOAP:提示变为「暂无额外生效键」语义
|
||||
await wrapper.find('[data-testid="client-connector-type"]').setValue('soap');
|
||||
expect(wrapper.text()).toContain('暂无额外生效的配置键');
|
||||
});
|
||||
|
||||
it('启用开关置于底部操作条左侧:小字注明随保存生效,点击翻转 state,非客户端实体不渲染', async () => {
|
||||
const clientForm = createEmptyClientInstanceForm();
|
||||
const wrapper = mountDrawer({ clientForm });
|
||||
const row = wrapper.find('[data-testid="client-enabled-row"]');
|
||||
// 启用不再是表单体里的孤行复选框,而是底部操作条左侧的 role="switch" 开关
|
||||
expect(row.exists()).toBe(true);
|
||||
expect(wrapper.findAll('input[type="checkbox"]').length).toBe(0);
|
||||
const switchBtn = wrapper.find('[data-testid="client-enabled-switch"]');
|
||||
expect(switchBtn.attributes('role')).toBe('switch');
|
||||
// 小字「随保存操作生效」与列表行内开关的即时生效区分;悬停 title 携带停用后果
|
||||
expect(row.text()).toContain('随保存操作生效');
|
||||
expect(switchBtn.attributes('title')).toContain('连接测试不受影响');
|
||||
// 默认启用;点击翻转表单 state,aria 状态同步
|
||||
expect(clientForm.enabled).toBe(true);
|
||||
await switchBtn.trigger('click');
|
||||
expect(clientForm.enabled).toBe(false);
|
||||
expect(switchBtn.attributes('aria-checked')).toBe('false');
|
||||
// 凭据实体渲染自己的启用开关(同一底部形态),客户端开关行不出现
|
||||
const credWrapper = mountDrawer({ activeEntity: 'credential' });
|
||||
expect(credWrapper.find('[data-testid="client-enabled-row"]').exists()).toBe(false);
|
||||
expect(credWrapper.find('[data-testid="credential-enabled-row"]').exists()).toBe(true);
|
||||
// 接口/绑定不渲染启用开关,改为底部状态只读下拉
|
||||
const ifaceWrapper = mountDrawer({ activeEntity: 'interface' });
|
||||
expect(ifaceWrapper.find('[data-testid="client-enabled-row"]').exists()).toBe(false);
|
||||
expect(ifaceWrapper.find('[data-testid="lifecycle-status-row"]').exists()).toBe(true);
|
||||
});
|
||||
});
|
||||
+565
@@ -0,0 +1,565 @@
|
||||
<!--
|
||||
features/admin/modules/integration-connector/components/IntegrationConnectorFormDrawer.vue
|
||||
用途:集成连接器四实体(客户端实例/接口定义/绑定/凭据引用)创建与编辑抽屉。
|
||||
依赖:activeEntity 对应的表单 state、useI18n、JsonTextareaField。
|
||||
逻辑:由 IntegrationConnectorPage 打开;按 activeEntity 渲染对应字段,客户端实例
|
||||
表单按「基本信息 → 连接配置 → 高级」分组,启用开关置于底部操作条左侧(随保存生效,悬停显示停用后果);
|
||||
客户端编码留空时按名称自动建议、
|
||||
接口编码留空时按「客户端实例编码-名称」自动建议(均可手改,已填不覆盖,编辑态编码锁定);
|
||||
客户端实例的连接器类型/环境/凭据引用均为下拉(选项来自模块常量与凭据列表,未知值兜底);
|
||||
接口定义的连接器类型随所选客户端实例联动只读展示(提交由后端以客户端为准推导);
|
||||
绑定的客户端实例随所选接口定义联动带出并锁定(接口归属即客户端归属);
|
||||
绑定表单的能力下拉选项本地化为「中文名(注册名)」(未注册翻译兜底注册名);
|
||||
接口与绑定的状态均为只读徽章(发布/退役走列表生命周期按钮),四个 JSON 契约字段常显不折叠;
|
||||
凭据引用:状态不进表单(由列表生命周期按钮流转);编辑态以「基本信息」只读信息区
|
||||
展示编码/类型/来源/状态(label+值行,与接口定义只读字段同款式),新建态下拉选项
|
||||
文案本地化与列表一致;高级配置帮助文案按连接器类型的生效键动态切换。
|
||||
JSON 配置字段统一走 JsonTextareaField;提交 emit save。右侧抽屉承载(表单长、JSON 面积大),
|
||||
带未保存离开确认(脏检查)、Esc 关闭与 dialog aria 语义。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import JsonTextareaField from './JsonTextareaField.vue';
|
||||
import {
|
||||
CONNECTOR_CONFIG_KEYS,
|
||||
CONNECTOR_TYPE_OPTIONS,
|
||||
ENVIRONMENT_OPTIONS,
|
||||
suggestClientCode,
|
||||
suggestInterfaceCode,
|
||||
} from '../types/integration-connector.types';
|
||||
import type {
|
||||
BindingFormState,
|
||||
ClientInstanceFormState,
|
||||
CredentialReferenceFormState,
|
||||
InterfaceDefinitionFormState,
|
||||
} from '../types/integration-connector.types';
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean;
|
||||
activeEntity: 'client' | 'interface' | 'binding' | 'credential';
|
||||
clientForm: ClientInstanceFormState;
|
||||
interfaceForm: InterfaceDefinitionFormState;
|
||||
bindingForm: BindingFormState;
|
||||
credentialForm: CredentialReferenceFormState;
|
||||
isSaving: boolean;
|
||||
/** 客户端实例选项:connector_type 供接口表单联动展示连接器类型。 */
|
||||
clientOptions: Array<{ code: string; name: string; connector_type?: string }>;
|
||||
/** 接口定义选项: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 }> }>;
|
||||
/** 凭据引用选项(客户端表单下拉用);缺省渲染为空列表。 */
|
||||
credentialOptions?: Array<{ code: string }>;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
close: [];
|
||||
save: [];
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const panelRef = ref<HTMLElement | null>(null);
|
||||
/** 打开时刻的表单快照,用于脏检查(表单均为扁平原始值,stringify 比对可靠)。 */
|
||||
const initialSnapshot = ref('');
|
||||
|
||||
const entityTitle = computed(() => t(`admin.integrationConnector.tabs.${props.activeEntity}`));
|
||||
|
||||
/** 抽屉顶部提示按实体区分(客户端表单提示编码用途;其余实体提示与自身相关的关键规则)。 */
|
||||
const entityHint = computed(() => t(`admin.integrationConnector.formHints.${props.activeEntity}`));
|
||||
|
||||
/** 名称失焦时若编码仍为空,按名称自动建议(已手填的编码不覆盖;编辑态编码锁定)。 */
|
||||
function onClientNameBlur() {
|
||||
if (!props.clientForm.code.trim()) {
|
||||
props.clientForm.code = suggestClientCode(props.clientForm.name);
|
||||
}
|
||||
}
|
||||
|
||||
/** 连接器类型本地化标签;未注册类型兜底原样显示(不写死类型集合)。 */
|
||||
function connectorTypeLabel(value: string) {
|
||||
const opt = CONNECTOR_TYPE_OPTIONS.find((item) => item.value === value);
|
||||
return opt ? t(opt.labelKey) : value;
|
||||
}
|
||||
|
||||
/** 状态本地化标签;未知值兜底原样显示。 */
|
||||
function statusLabel(value: string) {
|
||||
return t(`admin.integrationConnector.statusLabels.${value}`, value);
|
||||
}
|
||||
|
||||
/** 引用型下拉选项文案:「名称(编码)」;无名称时兜底编码本身(凭据类实体无名称字段)。 */
|
||||
function optionLabel(name: string, code: string) {
|
||||
return name ? `${name}(${code})` : code;
|
||||
}
|
||||
|
||||
/** 能力本地化标签;未注册翻译兜底原值(能力名含点号,i18n 按嵌套路径组织)。 */
|
||||
function capabilityLabel(name: string) {
|
||||
return t(`admin.integrationConnector.capabilityLabels.${name}`, name);
|
||||
}
|
||||
|
||||
/** 能力下拉选项文案:有中文翻译时「中文名(注册名)」,否则注册名本身(避免重复)。 */
|
||||
function capabilityOptionLabel(name: string) {
|
||||
const label = capabilityLabel(name);
|
||||
return label === name ? name : `${label}(${name})`;
|
||||
}
|
||||
|
||||
/** 接口编码仍为空且已选客户端实例时,按「客户端编码-名称」补建议(已手填不覆盖)。 */
|
||||
function suggestInterfaceCodeIfEmpty() {
|
||||
const form = props.interfaceForm;
|
||||
if (form.code.trim() || !form.client_instance_code) return;
|
||||
const suggested = suggestInterfaceCode(form.client_instance_code, form.name);
|
||||
if (suggested) form.code = suggested;
|
||||
}
|
||||
|
||||
/** 接口名称失焦:编码仍为空则补建议。 */
|
||||
function onInterfaceNameBlur() {
|
||||
suggestInterfaceCodeIfEmpty();
|
||||
}
|
||||
|
||||
/** 切换接口的客户端实例:联动展示其连接器类型(仅展示,提交由后端以客户端为准推导),并补编码建议。 */
|
||||
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;
|
||||
}
|
||||
suggestInterfaceCodeIfEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换绑定的接口定义:联动带出其所属客户端实例并锁定(接口归属即客户端归属)。
|
||||
* 后端创建/更新仍做成对校验(INTEGRATION.BINDING_PAIR_MISMATCH)兜底直连 API 的场景。
|
||||
*/
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/** 高级配置示例(JSON 属代码示例,不入 i18n——字面大括号会破坏 vue-i18n 消息编译)。 */
|
||||
const CLIENT_CONFIG_EXAMPLE = '{ "headers": { "X-Tenant": "AWSBI" } }';
|
||||
|
||||
/** 高级配置帮助文案:按连接器类型列出当前生效键;无生效键时明确说明透传语义。 */
|
||||
const clientConfigHint = computed(() => {
|
||||
const keys = CONNECTOR_CONFIG_KEYS[props.clientForm.connector_type] ?? [];
|
||||
if (keys.length) {
|
||||
return t('admin.integrationConnector.advancedHints.withKeys', { keys: keys.map((k) => `"${k}"`).join('、') });
|
||||
}
|
||||
return t('admin.integrationConnector.advancedHints.none');
|
||||
});
|
||||
|
||||
/** 当前所选凭据类型的字段定义(来自后端注册表;未加载时回退空)。 */
|
||||
const credentialTypeSpec = computed(() => {
|
||||
if (props.activeEntity !== 'credential') return null;
|
||||
return props.credentialTypeOptions.find((item) => item.type === props.credentialForm.credential_type) ?? null;
|
||||
});
|
||||
|
||||
/** 该凭据类型提供的模板占位符(credential_<key>)清单,供接口模板作者参考。 */
|
||||
const credentialPlaceholderKeys = computed(() =>
|
||||
(credentialTypeSpec.value?.fields ?? []).map((field) => `{credential_${field.key}}`),
|
||||
);
|
||||
|
||||
function credentialFieldLabel(key: string) {
|
||||
return t(`admin.integrationConnector.credentialFields.${key}`, key);
|
||||
}
|
||||
|
||||
/** 凭据引用编辑态判定:编辑时编码/类型/来源渲染为禁用表单控件(行业惯例:凭据形态创建后不可变)。 */
|
||||
const isCredentialEdit = computed(() => Boolean(props.credentialForm.id));
|
||||
|
||||
/** 凭据启用态:两态开关(active/retired;rotating 存量视为启用侧,点击即停用)。 */
|
||||
const credentialEnabled = computed(() => props.credentialForm.status !== 'retired');
|
||||
|
||||
/** 凭据 footer 启用开关翻转:active↔retired,随「保存更改」一并提交(PUT 仅接受这两值)。 */
|
||||
function toggleCredentialEnabled() {
|
||||
props.credentialForm.status = props.credentialForm.status === 'retired' ? 'active' : 'retired';
|
||||
}
|
||||
|
||||
/** 接口/绑定生命周期状态(footer 只读展示;转移只经列表生命周期按钮,表单不可改)。 */
|
||||
const lifecycleStatus = computed(() =>
|
||||
props.activeEntity === 'interface' ? props.interfaceForm.status : props.bindingForm.status,
|
||||
);
|
||||
|
||||
/** 状态胶囊配色:已发布绿 / 其余中性(与列表状态徽章同规则;未知值兜底中性)。 */
|
||||
const lifecycleChipClass = computed(() => {
|
||||
if (lifecycleStatus.value === 'published') return 'bg-emerald-50 text-emerald-700';
|
||||
return 'bg-surface-soft text-secondary';
|
||||
});
|
||||
|
||||
/** 凭据类型本地化标签;未注册类型兜底原样显示(不写死类型集合)。 */
|
||||
function credentialTypeLabel(value: string) {
|
||||
return t(`admin.integrationConnector.credentialTypeLabels.${value}`, value);
|
||||
}
|
||||
|
||||
/** 凭据来源本地化标签(与列表徽章共用 statusLabels.db/env)。 */
|
||||
function credentialProviderLabel(value: string) {
|
||||
return t(`admin.integrationConnector.statusLabels.${value}`, value);
|
||||
}
|
||||
|
||||
const activeForm = computed(() => {
|
||||
if (props.activeEntity === 'client') return props.clientForm;
|
||||
if (props.activeEntity === 'interface') return props.interfaceForm;
|
||||
if (props.activeEntity === 'binding') return props.bindingForm;
|
||||
return props.credentialForm;
|
||||
});
|
||||
|
||||
/** 表单相对打开时是否有变更;有变更时关闭需用户确认,防误触丢数据。 */
|
||||
const isDirty = computed(() => JSON.stringify(activeForm.value) !== initialSnapshot.value);
|
||||
|
||||
/** 统一关闭入口:脏表单先弹确认,取消则留在抽屉。 */
|
||||
function requestClose() {
|
||||
if (isDirty.value && !window.confirm(t('admin.integrationConnector.msg.unsavedConfirm'))) return;
|
||||
emit('close');
|
||||
}
|
||||
|
||||
/** Esc 关闭走同一确认入口。 */
|
||||
function onKeydown(e: KeyboardEvent) {
|
||||
if (e.key === 'Escape') requestClose();
|
||||
}
|
||||
|
||||
watch(
|
||||
() => props.visible,
|
||||
(visible) => {
|
||||
if (visible) {
|
||||
initialSnapshot.value = JSON.stringify(activeForm.value);
|
||||
document.addEventListener('keydown', onKeydown);
|
||||
void nextTick(() => panelRef.value?.focus());
|
||||
} else {
|
||||
document.removeEventListener('keydown', onKeydown);
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
onBeforeUnmount(() => document.removeEventListener('keydown', onKeydown));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-if="visible"
|
||||
class="fixed inset-0 z-50 flex justify-end bg-overlay"
|
||||
data-testid="connector-form-drawer"
|
||||
@click.self="requestClose"
|
||||
>
|
||||
<aside
|
||||
ref="panelRef"
|
||||
tabindex="-1"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
:aria-label="entityTitle"
|
||||
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-7 pb-4 border-b border-default shrink-0">
|
||||
<h3 class="section-title">{{ entityTitle }}</h3>
|
||||
<p class="section-desc mt-1">{{ entityHint }}</p>
|
||||
</div>
|
||||
<div class="px-5 sm:px-8 py-5 space-y-5 overflow-y-auto flex-1">
|
||||
<!-- 客户端实例:基本信息 → 连接配置 → 高级 三段式 -->
|
||||
<template v-if="activeEntity === 'client'">
|
||||
<div class="space-y-4">
|
||||
<h4 class="text-xs font-bold uppercase tracking-wide text-muted">{{ t('admin.integrationConnector.sections.basic') }}</h4>
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.name') }}</label>
|
||||
<input v-model="clientForm.name" type="text" class="input-field text-sm" data-testid="client-name" @blur="onClientNameBlur" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.code') }}</label>
|
||||
<input v-model="clientForm.code" type="text" class="input-field text-sm font-mono" :disabled="Boolean(clientForm.id)" data-testid="client-code" />
|
||||
<p class="text-xs text-muted">{{ t('admin.integrationConnector.fields.codeHint') }}</p>
|
||||
</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">
|
||||
<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.fields.environment') }}</label>
|
||||
<select v-model="clientForm.environment" class="input-field text-sm" data-testid="client-environment">
|
||||
<option v-for="env in ENVIRONMENT_OPTIONS" :key="env" :value="env">{{ t(`admin.integrationConnector.envLabels.${env}`) }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<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 地址) -->
|
||||
<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" />
|
||||
</div>
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.timeout') }}</label>
|
||||
<input v-model="clientForm.timeout_seconds" type="number" class="input-field text-sm" min="0" data-testid="client-timeout" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.credentialRef') }}</label>
|
||||
<select v-model="clientForm.credential_ref_code" class="input-field text-sm" data-testid="client-credential-ref">
|
||||
<option value="">{{ t('admin.integrationConnector.fields.credentialNone') }}</option>
|
||||
<option v-for="opt in credentialOptions || []" :key="opt.code" :value="opt.code">{{ opt.code }}</option>
|
||||
</select>
|
||||
<p class="text-xs text-muted">{{ t('admin.integrationConnector.fields.credentialRefHint') }}</p>
|
||||
</div>
|
||||
</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.sections.advanced') }}</summary>
|
||||
<div class="mt-2 space-y-2">
|
||||
<p class="text-xs text-muted">{{ clientConfigHint }}</p>
|
||||
<JsonTextareaField
|
||||
v-model="clientForm.config_json"
|
||||
:label="t('admin.integrationConnector.fields.configJson')"
|
||||
:placeholder="CLIENT_CONFIG_EXAMPLE"
|
||||
/>
|
||||
</div>
|
||||
</details>
|
||||
</template>
|
||||
|
||||
<!-- 接口定义:编码自动建议 + 类型随客户端联动(只读徽章)+ 接口契约 JSON 常显 + 状态只读徽章 -->
|
||||
<template v-else-if="activeEntity === 'interface'">
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.name') }}</label>
|
||||
<input v-model="interfaceForm.name" type="text" class="input-field text-sm" data-testid="interface-name" @blur="onInterfaceNameBlur" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.code') }}</label>
|
||||
<input v-model="interfaceForm.code" type="text" class="input-field text-sm font-mono" :disabled="Boolean(interfaceForm.id)" data-testid="interface-code" />
|
||||
<p class="text-xs text-muted">{{ t('admin.integrationConnector.fields.codeHintInterface') }}</p>
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.clientInstance') }}</label>
|
||||
<select v-model="interfaceForm.client_instance_code" class="input-field text-sm" data-testid="interface-client" @change="onInterfaceClientChange">
|
||||
<option v-for="opt in clientOptions" :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.connectorType') }}</label>
|
||||
<!-- 与客户端实例同款下拉控件、仅禁用只读:类型随客户端实例自动确定(后端以其为单一事实源推导),不可单独修改 -->
|
||||
<select
|
||||
:value="interfaceForm.connector_type"
|
||||
class="input-field text-sm disabled:opacity-70"
|
||||
disabled
|
||||
data-testid="interface-connector-type"
|
||||
>
|
||||
<option :value="interfaceForm.connector_type">{{ connectorTypeLabel(interfaceForm.connector_type) }}</option>
|
||||
</select>
|
||||
<p class="text-xs text-muted">{{ t('admin.integrationConnector.fields.connectorTypeHint') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="interfaceForm.connector_type === 'rest'" class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.httpMethod') }}</label>
|
||||
<select v-model="interfaceForm.http_method" class="input-field text-sm">
|
||||
<option value="">—</option>
|
||||
<option value="GET">GET</option>
|
||||
<option value="POST">POST</option>
|
||||
<option value="PUT">PUT</option>
|
||||
<option value="DELETE">DELETE</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.requestPath') }}</label>
|
||||
<input v-model="interfaceForm.request_path" type="text" class="input-field text-sm font-mono" :placeholder="t('admin.integrationConnector.placeholders.requestPath')" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- 接口契约(请求模板/入参 Schema/回传映射/出参 Schema)即接口定义本体:常显纵向全宽,不再折叠 -->
|
||||
<div class="space-y-4">
|
||||
<h4 class="text-xs font-bold uppercase tracking-wide text-muted">{{ t('admin.integrationConnector.sections.contract') }}</h4>
|
||||
<JsonTextareaField v-model="interfaceForm.request_spec_json" :label="t('admin.integrationConnector.fields.requestSpec')" />
|
||||
<JsonTextareaField v-model="interfaceForm.input_schema_json" :label="t('admin.integrationConnector.fields.inputSchema')" />
|
||||
<JsonTextareaField v-model="interfaceForm.response_mapping_json" :label="t('admin.integrationConnector.fields.responseMapping')" />
|
||||
<JsonTextareaField v-model="interfaceForm.output_schema_json" :label="t('admin.integrationConnector.fields.outputSchema')" />
|
||||
</div>
|
||||
<!-- 状态不进表单正文:以底部操作条只读下拉展示(转移只经列表生命周期按钮) -->
|
||||
</template>
|
||||
|
||||
<!-- 绑定:客户端实例随接口定义联动锁定;状态为只读徽章(发布/退役走列表生命周期按钮) -->
|
||||
<template v-else-if="activeEntity === 'binding'">
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.capability') }}</label>
|
||||
<select v-model="bindingForm.capability" class="input-field text-sm">
|
||||
<option v-for="cap in capabilityOptions" :key="cap.name" :value="cap.name">{{ capabilityOptionLabel(cap.name) }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.environment') }}</label>
|
||||
<select v-model="bindingForm.environment" class="input-field text-sm">
|
||||
<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" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.priority') }}</label>
|
||||
<input v-model.number="bindingForm.priority" type="number" class="input-field text-sm" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.effectiveFrom') }}</label>
|
||||
<input v-model="bindingForm.effective_from" type="datetime-local" class="input-field text-sm" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.effectiveTo') }}</label>
|
||||
<input v-model="bindingForm.effective_to" type="datetime-local" class="input-field text-sm" />
|
||||
</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>
|
||||
<!-- 状态不进表单正文:以底部操作条只读下拉展示(转移只经列表生命周期按钮) -->
|
||||
</template>
|
||||
|
||||
<!-- 凭据引用:基本信息统一为正常表单控件(编辑态禁用只读,不用徽章形态);状态经底部启用开关随保存生效 -->
|
||||
<template v-else>
|
||||
<div class="space-y-4">
|
||||
<h4 class="text-xs font-bold uppercase tracking-wide text-muted">{{ t('admin.integrationConnector.sections.basic') }}</h4>
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.code') }}</label>
|
||||
<input v-model="credentialForm.code" type="text" class="input-field text-sm font-mono disabled:opacity-70" :disabled="isCredentialEdit" data-testid="credential-code" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.secretProvider') }}</label>
|
||||
<!-- 编辑态禁用:db↔env 切换会让存量密文变孤儿数据或调用期晚失败,变更须新建引用 -->
|
||||
<select v-model="credentialForm.secret_provider" class="input-field text-sm disabled:opacity-70" :disabled="isCredentialEdit" data-testid="credential-provider">
|
||||
<option value="db">{{ credentialProviderLabel('db') }}</option>
|
||||
<option value="env">{{ credentialProviderLabel('env') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.credentialType') }}</label>
|
||||
<!-- 编辑态禁用:类型决定密文字段结构,中途改类型会使存量密文失效,变更须新建引用 -->
|
||||
<select
|
||||
v-model="credentialForm.credential_type"
|
||||
class="input-field text-sm disabled:opacity-70"
|
||||
:disabled="isCredentialEdit || credentialForm.secret_provider !== 'db'"
|
||||
data-testid="credential-type"
|
||||
>
|
||||
<option v-for="spec in credentialTypeOptions" :key="spec.type" :value="spec.type">{{ credentialTypeLabel(spec.type) }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<p v-if="isCredentialEdit" class="text-xs text-muted">{{ t('admin.integrationConnector.formHints.credentialImmutable') }}</p>
|
||||
</div>
|
||||
<!-- 凭据值段:db 按类型动态渲染(secret 字段加密落库不回显,编辑留空 = 保持旧值);env 只登记配置键名 -->
|
||||
<div class="space-y-4">
|
||||
<h4 class="text-xs font-bold uppercase tracking-wide text-muted">{{ t('admin.integrationConnector.sections.credentialValues') }}</h4>
|
||||
<template v-if="credentialForm.secret_provider === 'db'">
|
||||
<div v-if="credentialTypeSpec" class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<div v-for="field in credentialTypeSpec.fields" :key="field.key" class="space-y-1.5">
|
||||
<label class="label-field">
|
||||
{{ credentialFieldLabel(field.key) }}
|
||||
<span v-if="!field.secret" class="text-xs text-muted">({{ t('admin.integrationConnector.fields.visibleField') }})</span>
|
||||
</label>
|
||||
<input
|
||||
v-model="credentialForm.fields[field.key]"
|
||||
:type="field.secret ? 'password' : 'text'"
|
||||
class="input-field text-sm"
|
||||
:autocomplete="field.secret ? 'new-password' : 'off'"
|
||||
:placeholder="field.secret && credentialForm.id ? t('admin.integrationConnector.placeholders.passwordKeep') : ''"
|
||||
:data-testid="`credential-field-${field.key}`"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 模板占位符以代码徽章逐个展示,供接口模板作者复制 -->
|
||||
<div v-if="credentialPlaceholderKeys.length" class="flex flex-wrap items-center gap-2 text-xs text-muted">
|
||||
<span>{{ t('admin.integrationConnector.msg.credentialPlaceholdersHint') }}</span>
|
||||
<code
|
||||
v-for="key in credentialPlaceholderKeys"
|
||||
:key="key"
|
||||
class="rounded bg-surface-soft px-1.5 py-0.5 font-mono text-[11px] text-secondary"
|
||||
data-testid="credential-placeholder-chip"
|
||||
>{{ key }}</code>
|
||||
</div>
|
||||
</template>
|
||||
<div v-else class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.secretRef') }}</label>
|
||||
<input v-model="credentialForm.secret_ref" type="text" class="input-field text-sm" data-testid="credential-secret-ref" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class="admin-modal-footer">
|
||||
<!-- 启用开关置于操作条左侧(仅客户端实体):内容区滚动时始终可见;
|
||||
小字「随保存操作生效」与列表行内开关的即时生效区分,悬停 title 显示停用的调用期后果 -->
|
||||
<div v-if="activeEntity === 'client'" class="mr-auto flex items-center gap-2.5" data-testid="client-enabled-row">
|
||||
<button
|
||||
type="button"
|
||||
role="switch"
|
||||
:aria-checked="clientForm.enabled"
|
||||
:title="t('admin.integrationConnector.fields.enabledHint')"
|
||||
class="relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors"
|
||||
:class="clientForm.enabled ? 'bg-brand-600' : 'bg-slate-300'"
|
||||
data-testid="client-enabled-switch"
|
||||
@click="clientForm.enabled = !clientForm.enabled"
|
||||
>
|
||||
<span class="inline-block h-4 w-4 transform rounded-full bg-white shadow transition-transform" :class="clientForm.enabled ? 'translate-x-4' : 'translate-x-0.5'" />
|
||||
</button>
|
||||
<span class="whitespace-nowrap text-sm font-medium text-secondary">{{ t('admin.integrationConnector.fields.enabled') }}</span>
|
||||
<span class="whitespace-nowrap text-xs text-muted">{{ t('admin.integrationConnector.fields.enabledFooterHint') }}</span>
|
||||
</div>
|
||||
<!-- 凭据启用开关:同一底部形态;翻转 active↔retired,随「保存更改」提交(停用即断流,title 说明后果) -->
|
||||
<div v-else-if="activeEntity === 'credential'" class="mr-auto flex items-center gap-2.5" data-testid="credential-enabled-row">
|
||||
<button
|
||||
type="button"
|
||||
role="switch"
|
||||
:aria-checked="credentialEnabled"
|
||||
:title="t('admin.integrationConnector.fields.credentialEnabledHint')"
|
||||
class="relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors"
|
||||
:class="credentialEnabled ? 'bg-brand-600' : 'bg-slate-300'"
|
||||
data-testid="credential-enabled-switch"
|
||||
@click="toggleCredentialEnabled"
|
||||
>
|
||||
<span class="inline-block h-4 w-4 transform rounded-full bg-white shadow transition-transform" :class="credentialEnabled ? 'translate-x-4' : 'translate-x-0.5'" />
|
||||
</button>
|
||||
<span class="whitespace-nowrap text-sm font-medium text-secondary">{{ t('admin.integrationConnector.fields.enabled') }}</span>
|
||||
<span class="whitespace-nowrap text-xs text-muted">{{ t('admin.integrationConnector.fields.enabledFooterHint') }}</span>
|
||||
</div>
|
||||
<!-- 接口/绑定生命周期状态:安静的状态指示器(彩点胶囊 + 悬停承载长说明)——
|
||||
操作条不放表单控件与多行文案,转移入口在列表行内按钮 -->
|
||||
<div v-else-if="activeEntity === 'interface' || activeEntity === 'binding'" class="mr-auto flex items-center gap-2" data-testid="lifecycle-status-row">
|
||||
<span class="whitespace-nowrap text-xs text-muted">{{ t('admin.integrationConnector.fields.status') }}</span>
|
||||
<span
|
||||
class="inline-flex items-center gap-1.5 whitespace-nowrap rounded-full px-2.5 py-1 text-xs font-medium"
|
||||
:class="lifecycleChipClass"
|
||||
:title="t('admin.integrationConnector.fields.statusHint')"
|
||||
data-testid="lifecycle-status-chip"
|
||||
>
|
||||
<span class="h-1.5 w-1.5 rounded-full bg-current" />
|
||||
{{ statusLabel(lifecycleStatus) }}
|
||||
</span>
|
||||
</div>
|
||||
<button type="button" class="btn-ghost" @click="requestClose">{{ t('admin.cancel') }}</button>
|
||||
<button type="button" class="btn-primary disabled:opacity-70" :disabled="isSaving" @click="emit('save')">
|
||||
{{ isSaving ? t('admin.save') + '...' : t('admin.save') }}
|
||||
</button>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
</template>
|
||||
-96
@@ -1,96 +0,0 @@
|
||||
/**
|
||||
* features/admin/modules/integration-connector/components/IntegrationConnectorFormModal.spec.ts
|
||||
* 用途:锁定表单按连接器类型动态显示字段——REST 显示超时/HTTP方法/请求路径,
|
||||
* SOAP 显示 WSDL;关键字段从 JSON 拆出独立输入框,JSON 收进高级配置折叠。
|
||||
* 依赖:@vue/test-utils、i18n。
|
||||
* 逻辑:切换 connector_type 后断言对应字段的可见性;高级配置折叠默认收起。
|
||||
*/
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import i18n from '@/i18n';
|
||||
import IntegrationConnectorFormModal from './IntegrationConnectorFormModal.vue';
|
||||
import {
|
||||
createEmptyClientInstanceForm,
|
||||
createEmptyInterfaceDefinitionForm,
|
||||
createEmptyBindingForm,
|
||||
createEmptyCredentialReferenceForm,
|
||||
} from '../types/integration-connector.types';
|
||||
|
||||
function mountModal() {
|
||||
return mount(IntegrationConnectorFormModal, {
|
||||
props: {
|
||||
visible: true,
|
||||
activeEntity: 'client',
|
||||
clientForm: createEmptyClientInstanceForm(),
|
||||
interfaceForm: createEmptyInterfaceDefinitionForm(),
|
||||
bindingForm: createEmptyBindingForm(),
|
||||
credentialForm: createEmptyCredentialReferenceForm(),
|
||||
isSaving: false,
|
||||
clientOptions: [],
|
||||
interfaceOptions: [],
|
||||
capabilityOptions: [],
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
}
|
||||
|
||||
describe('IntegrationConnectorFormModal connector-type fields', () => {
|
||||
it('REST 默认显示接口地址与超时字段', () => {
|
||||
const wrapper = mountModal();
|
||||
expect(wrapper.find('[data-testid="client-endpoint"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="client-timeout"]').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('切换到 SOAP 后连接地址 label 变为 WSDL,超时仍显示;同一 endpoint 字段', async () => {
|
||||
const wrapper = mountModal();
|
||||
await wrapper.find('[data-testid="client-connector-type"]').setValue('soap');
|
||||
await wrapper.vm.$nextTick();
|
||||
// 连接地址仍是同一 client-endpoint 字段,仅 label 变 WSDL
|
||||
expect(wrapper.find('[data-testid="client-endpoint"]').exists()).toBe(true);
|
||||
// 超时在 SOAP 下也显示
|
||||
expect(wrapper.find('[data-testid="client-timeout"]').exists()).toBe(true);
|
||||
const labels = wrapper.findAll('label').map((l) => l.text());
|
||||
expect(labels.some((t) => t.includes('WSDL'))).toBe(true);
|
||||
});
|
||||
|
||||
it('接口定义 REST 显示 HTTP 方法与请求路径', () => {
|
||||
const wrapper = mount(IntegrationConnectorFormModal, {
|
||||
props: {
|
||||
visible: true,
|
||||
activeEntity: 'interface',
|
||||
clientForm: createEmptyClientInstanceForm(),
|
||||
interfaceForm: createEmptyInterfaceDefinitionForm(),
|
||||
bindingForm: createEmptyBindingForm(),
|
||||
credentialForm: createEmptyCredentialReferenceForm(),
|
||||
isSaving: false,
|
||||
clientOptions: [],
|
||||
interfaceOptions: [],
|
||||
capabilityOptions: [],
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
const labels = wrapper.findAll('label').map((l) => l.text());
|
||||
expect(labels.some((t) => t.includes('HTTP 方法'))).toBe(true);
|
||||
expect(labels.some((t) => t.includes('请求路径'))).toBe(true);
|
||||
});
|
||||
|
||||
it('绑定显示来源实例编码独立字段', () => {
|
||||
const wrapper = mount(IntegrationConnectorFormModal, {
|
||||
props: {
|
||||
visible: true,
|
||||
activeEntity: 'binding',
|
||||
clientForm: createEmptyClientInstanceForm(),
|
||||
interfaceForm: createEmptyInterfaceDefinitionForm(),
|
||||
bindingForm: createEmptyBindingForm(),
|
||||
credentialForm: createEmptyCredentialReferenceForm(),
|
||||
isSaving: false,
|
||||
clientOptions: [],
|
||||
interfaceOptions: [],
|
||||
capabilityOptions: [],
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
const labels = wrapper.findAll('label').map((l) => l.text());
|
||||
expect(labels.some((t) => t.includes('来源实例编码'))).toBe(true);
|
||||
});
|
||||
});
|
||||
-277
@@ -1,277 +0,0 @@
|
||||
<!--
|
||||
features/admin/modules/integration-connector/components/IntegrationConnectorFormModal.vue
|
||||
用途:集成连接器四实体(客户端实例/接口定义/绑定/凭据引用)创建与编辑弹窗。
|
||||
依赖:activeEntity 对应的表单 state、useI18n。
|
||||
逻辑:由 IntegrationConnectorPage 打开;按 activeEntity 渲染对应字段;提交 emit save。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import type {
|
||||
BindingFormState,
|
||||
ClientInstanceFormState,
|
||||
CredentialReferenceFormState,
|
||||
InterfaceDefinitionFormState,
|
||||
} from '../types/integration-connector.types';
|
||||
|
||||
const props = defineProps<{
|
||||
visible: boolean;
|
||||
activeEntity: 'client' | 'interface' | 'binding' | 'credential';
|
||||
clientForm: ClientInstanceFormState;
|
||||
interfaceForm: InterfaceDefinitionFormState;
|
||||
bindingForm: BindingFormState;
|
||||
credentialForm: CredentialReferenceFormState;
|
||||
isSaving: boolean;
|
||||
clientOptions: Array<{ code: string; name: string }>;
|
||||
interfaceOptions: Array<{ code: string; name: string }>;
|
||||
capabilityOptions: Array<{ name: string }>;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
close: [];
|
||||
save: [];
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="visible" class="admin-modal-overlay animate-fade-in items-center">
|
||||
<div class="admin-modal-panel max-w-2xl max-h-[92vh] scale-100">
|
||||
<div class="px-5 sm:px-8 pt-5 sm:pt-7 pb-4 border-b border-subtle">
|
||||
<h3 class="section-title">{{ t(`admin.integrationConnector.tabs.${activeEntity}`) }}</h3>
|
||||
<p class="section-desc mt-1">{{ t('admin.integrationConnector.formHint') }}</p>
|
||||
</div>
|
||||
<div class="px-5 sm:px-8 py-5 space-y-5 overflow-y-auto">
|
||||
<!-- 客户端实例 -->
|
||||
<template v-if="activeEntity === 'client'">
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.code') }}</label>
|
||||
<input v-model="clientForm.code" type="text" class="input-field text-sm" :disabled="Boolean(clientForm.id)" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.name') }}</label>
|
||||
<input v-model="clientForm.name" type="text" class="input-field text-sm" />
|
||||
</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">
|
||||
<option value="rest">rest</option>
|
||||
<option value="soap">soap</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.environment') }}</label>
|
||||
<input v-model="clientForm.environment" type="text" class="input-field text-sm" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- 连接地址:endpoint 合一字段;label 按连接器类型显示(REST=接口地址,SOAP=WSDL 地址) -->
|
||||
<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" />
|
||||
</div>
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.timeout') }}</label>
|
||||
<input v-model="clientForm.timeout_seconds" type="number" class="input-field text-sm" min="0" data-testid="client-timeout" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.credentialRef') }}</label>
|
||||
<input v-model="clientForm.credential_ref_code" type="text" class="input-field text-sm" />
|
||||
</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-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.configJson') }}</label>
|
||||
<textarea v-model="clientForm.config_json" rows="6" class="input-field text-sm font-mono" spellcheck="false" />
|
||||
</div>
|
||||
</details>
|
||||
<label class="inline-flex items-center gap-2 text-sm text-secondary cursor-pointer">
|
||||
<input v-model="clientForm.enabled" type="checkbox" class="w-4 h-4 rounded text-brand-600 border-default" />
|
||||
{{ t('admin.integrationConnector.fields.enabled') }}
|
||||
</label>
|
||||
</template>
|
||||
|
||||
<!-- 接口定义 -->
|
||||
<template v-else-if="activeEntity === 'interface'">
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.code') }}</label>
|
||||
<input v-model="interfaceForm.code" type="text" class="input-field text-sm" :disabled="Boolean(interfaceForm.id)" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.name') }}</label>
|
||||
<input v-model="interfaceForm.name" type="text" class="input-field text-sm" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.clientInstance') }}</label>
|
||||
<select v-model="interfaceForm.client_instance_code" class="input-field text-sm">
|
||||
<option v-for="opt in clientOptions" :key="opt.code" :value="opt.code">{{ opt.code }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.connectorType') }}</label>
|
||||
<select v-model="interfaceForm.connector_type" class="input-field text-sm">
|
||||
<option value="rest">rest</option>
|
||||
<option value="soap">soap</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="interfaceForm.connector_type === 'rest'" class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.httpMethod') }}</label>
|
||||
<select v-model="interfaceForm.http_method" class="input-field text-sm">
|
||||
<option value="">—</option>
|
||||
<option value="GET">GET</option>
|
||||
<option value="POST">POST</option>
|
||||
<option value="PUT">PUT</option>
|
||||
<option value="DELETE">DELETE</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.requestPath') }}</label>
|
||||
<input v-model="interfaceForm.request_path" type="text" class="input-field text-sm font-mono" :placeholder="t('admin.integrationConnector.placeholders.requestPath')" />
|
||||
</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 grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.requestSpec') }}</label>
|
||||
<textarea v-model="interfaceForm.request_spec_json" rows="5" class="input-field text-sm font-mono" spellcheck="false" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.inputSchema') }}</label>
|
||||
<textarea v-model="interfaceForm.input_schema_json" rows="5" class="input-field text-sm font-mono" spellcheck="false" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.responseMapping') }}</label>
|
||||
<textarea v-model="interfaceForm.response_mapping_json" rows="5" class="input-field text-sm font-mono" spellcheck="false" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.outputSchema') }}</label>
|
||||
<textarea v-model="interfaceForm.output_schema_json" rows="5" class="input-field text-sm font-mono" spellcheck="false" />
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.status') }}</label>
|
||||
<select v-model="interfaceForm.status" class="input-field text-sm">
|
||||
<option value="draft">draft</option>
|
||||
<option value="published">published</option>
|
||||
<option value="retired">retired</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="flex items-end pb-1">
|
||||
<label class="inline-flex items-center gap-2 text-sm text-secondary cursor-pointer">
|
||||
<input v-model="interfaceForm.enabled" type="checkbox" class="w-4 h-4 rounded text-brand-600 border-default" />
|
||||
{{ t('admin.integrationConnector.fields.enabled') }}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 绑定 -->
|
||||
<template v-else-if="activeEntity === 'binding'">
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.capability') }}</label>
|
||||
<select v-model="bindingForm.capability" class="input-field text-sm">
|
||||
<option v-for="cap in capabilityOptions" :key="cap.name" :value="cap.name">{{ cap.name }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.environment') }}</label>
|
||||
<input v-model="bindingForm.environment" type="text" class="input-field text-sm" />
|
||||
</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">
|
||||
<option v-for="opt in clientOptions" :key="opt.code" :value="opt.code">{{ opt.code }}</option>
|
||||
</select>
|
||||
</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">
|
||||
<option v-for="opt in interfaceOptions" :key="opt.code" :value="opt.code">{{ 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" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.priority') }}</label>
|
||||
<input v-model.number="bindingForm.priority" type="number" class="input-field text-sm" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.effectiveFrom') }}</label>
|
||||
<input v-model="bindingForm.effective_from" type="datetime-local" class="input-field text-sm" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.effectiveTo') }}</label>
|
||||
<input v-model="bindingForm.effective_to" type="datetime-local" class="input-field text-sm" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.contextSourceCode') }}</label>
|
||||
<input v-model="bindingForm.context_source_code" type="text" class="input-field text-sm" :placeholder="t('admin.integrationConnector.placeholders.contextSourceCode')" />
|
||||
</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-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.contextSelector') }}</label>
|
||||
<textarea v-model="bindingForm.context_selector_json" rows="4" class="input-field text-sm font-mono" spellcheck="false" />
|
||||
</div>
|
||||
</details>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.status') }}</label>
|
||||
<select v-model="bindingForm.status" class="input-field text-sm">
|
||||
<option value="draft">draft</option>
|
||||
<option value="published">published</option>
|
||||
<option value="retired">retired</option>
|
||||
</select>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 凭据引用 -->
|
||||
<template v-else>
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.code') }}</label>
|
||||
<input v-model="credentialForm.code" type="text" class="input-field text-sm" :disabled="Boolean(credentialForm.id)" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.secretRef') }}</label>
|
||||
<input v-model="credentialForm.secret_ref" type="text" class="input-field text-sm" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.secretProvider') }}</label>
|
||||
<input v-model="credentialForm.secret_provider" type="text" class="input-field text-sm" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.credentialType') }}</label>
|
||||
<input v-model="credentialForm.credential_type" type="text" class="input-field text-sm" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.status') }}</label>
|
||||
<select v-model="credentialForm.status" class="input-field text-sm">
|
||||
<option value="active">active</option>
|
||||
<option value="rotating">rotating</option>
|
||||
<option value="retired">retired</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class="admin-modal-footer">
|
||||
<button type="button" class="btn-ghost" @click="emit('close')">{{ t('admin.cancel') }}</button>
|
||||
<button type="button" class="btn-primary disabled:opacity-70" :disabled="isSaving" @click="emit('save')">
|
||||
{{ isSaving ? t('admin.save') + '...' : t('admin.save') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
<!--
|
||||
features/admin/modules/integration-connector/components/JsonTextareaField.vue
|
||||
用途:JSON 配置字段统一编辑器——全宽等宽 textarea + 格式化按钮 + 失焦即时校验,
|
||||
供本模块四实体表单(请求模板/Schema/映射/连接配置/上下文选择器)复用。
|
||||
依赖:useI18n。
|
||||
逻辑:v-model 承载 JSON 文本(由父级表单 state 持有);失焦时校验,非法显示红字
|
||||
提示;「格式化」仅在合法 JSON 时 pretty-print 改写,非法时只提示不改写内容。
|
||||
空值视为合法(与保存链路 parseJsonField 的「空串返回 {}」一致)。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
const props = defineProps<{
|
||||
/** 字段标签,同时用于错误提示中的字段名。 */
|
||||
label: string;
|
||||
modelValue: string;
|
||||
/** 可选占位示例(如高级配置的生效键示例),空内文时展示。 */
|
||||
placeholder?: string;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: string];
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const touched = ref(false);
|
||||
|
||||
/** 是否为合法 JSON 对象文本;空串合法。 */
|
||||
const isValid = computed(() => {
|
||||
const trimmed = props.modelValue.trim();
|
||||
if (!trimmed) return true;
|
||||
try {
|
||||
const parsed = JSON.parse(trimmed);
|
||||
return Boolean(parsed) && typeof parsed === 'object' && !Array.isArray(parsed);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
function onBlur() {
|
||||
touched.value = true;
|
||||
}
|
||||
|
||||
/** 格式化(pretty-print);内容为空或非法时仅标记已触碰以显示校验提示。 */
|
||||
function format() {
|
||||
touched.value = true;
|
||||
if (!isValid.value || !props.modelValue.trim()) return;
|
||||
emit('update:modelValue', JSON.stringify(JSON.parse(props.modelValue.trim()), null, 2));
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="space-y-1.5">
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<label class="label-field">{{ label }}</label>
|
||||
<button
|
||||
type="button"
|
||||
class="text-xs font-medium text-brand-600 hover:text-brand-700 disabled:opacity-50 disabled:cursor-not-allowed"
|
||||
:disabled="!modelValue.trim()"
|
||||
data-testid="json-format-button"
|
||||
@click="format"
|
||||
>
|
||||
{{ t('admin.integrationConnector.formatJson') }}
|
||||
</button>
|
||||
</div>
|
||||
<textarea
|
||||
:value="modelValue"
|
||||
rows="12"
|
||||
class="input-field text-sm font-mono leading-5"
|
||||
spellcheck="false"
|
||||
:placeholder="placeholder"
|
||||
data-testid="json-textarea"
|
||||
@input="emit('update:modelValue', ($event.target as HTMLTextAreaElement).value)"
|
||||
@blur="onBlur"
|
||||
/>
|
||||
<p v-if="touched && !isValid" class="text-xs text-red-600" data-testid="json-error">
|
||||
{{ t('admin.integrationConnector.invalidJsonHint') }}
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
+241
-11
@@ -21,10 +21,13 @@ const api = vi.hoisted(() => ({
|
||||
listIntegrationInterfaceDefinitions: vi.fn(),
|
||||
createIntegrationInterfaceDefinition: vi.fn(),
|
||||
updateIntegrationInterfaceDefinition: vi.fn(),
|
||||
changeIntegrationInterfaceLifecycle: vi.fn(),
|
||||
listIntegrationBindings: vi.fn(),
|
||||
createIntegrationBinding: vi.fn(),
|
||||
updateIntegrationBinding: vi.fn(),
|
||||
changeIntegrationBindingLifecycle: vi.fn(),
|
||||
listIntegrationCredentialReferences: vi.fn(),
|
||||
listIntegrationCredentialTypes: vi.fn(),
|
||||
createIntegrationCredentialReference: vi.fn(),
|
||||
updateIntegrationCredentialReference: vi.fn(),
|
||||
listIntegrationCapabilities: vi.fn(),
|
||||
@@ -55,6 +58,7 @@ describe('useIntegrationConnectorAdmin', () => {
|
||||
api.listIntegrationInterfaceDefinitions.mockResolvedValue([]);
|
||||
api.listIntegrationBindings.mockResolvedValue([]);
|
||||
api.listIntegrationCredentialReferences.mockResolvedValue([]);
|
||||
api.listIntegrationCredentialTypes.mockResolvedValue([]);
|
||||
api.listIntegrationCapabilities.mockResolvedValue([]);
|
||||
const c = makeHarness();
|
||||
await c.loadAll();
|
||||
@@ -65,14 +69,14 @@ describe('useIntegrationConnectorAdmin', () => {
|
||||
it('新建客户端实例:关键字段独立列 + config_json 解析为对象并 POST', async () => {
|
||||
const c = makeHarness();
|
||||
c.openCreateModal('client');
|
||||
c.clientForm.value.code = 'ERP-X';
|
||||
c.clientForm.value.code = 'erp-x';
|
||||
c.clientForm.value.name = 'ERP X';
|
||||
c.clientForm.value.endpoint = 'https://x.invalid';
|
||||
c.clientForm.value.timeout_seconds = '90';
|
||||
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',
|
||||
endpoint: 'https://x.invalid', timeout_seconds: 90,
|
||||
config_json: { headers: { 'X-Tenant': 'A' } }, credential_ref_code: null, enabled: true,
|
||||
});
|
||||
@@ -81,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',
|
||||
config_json: {}, credential_ref_code: null, enabled: true,
|
||||
});
|
||||
c.clientForm.value.name = 'new';
|
||||
@@ -92,22 +96,41 @@ describe('useIntegrationConnectorAdmin', () => {
|
||||
it('非法 JSON 字段触发拦截且不调 API', async () => {
|
||||
const c = makeHarness();
|
||||
c.openCreateModal('client');
|
||||
c.clientForm.value.code = 'ERP-X';
|
||||
c.clientForm.value.code = 'erp-x';
|
||||
c.clientForm.value.name = 'ERP X';
|
||||
c.clientForm.value.config_json = '{bad json';
|
||||
await c.saveActive();
|
||||
expect(api.createIntegrationClientInstance).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('客户端实例必填:缺 code 不调 API', async () => {
|
||||
it('客户端实例必填:缺名称不调 API', async () => {
|
||||
const c = makeHarness();
|
||||
c.openCreateModal('client');
|
||||
c.clientForm.value.name = 'ERP X';
|
||||
c.clientForm.value.code = 'erp-x';
|
||||
await c.saveActive();
|
||||
expect(api.createIntegrationClientInstance).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('绑定:必填校验与 POST payload', async () => {
|
||||
it('编码留空时按名称自动生成 kebab-case 并提交', async () => {
|
||||
const c = makeHarness();
|
||||
c.openCreateModal('client');
|
||||
c.clientForm.value.name = 'ERP X';
|
||||
await c.saveActive();
|
||||
expect(api.createIntegrationClientInstance).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ code: 'erp-x', name: 'ERP X' }),
|
||||
);
|
||||
});
|
||||
|
||||
it('编码格式非法(大写/下划线)时不调 API', async () => {
|
||||
const c = makeHarness();
|
||||
c.openCreateModal('client');
|
||||
c.clientForm.value.name = 'ERP X';
|
||||
c.clientForm.value.code = 'Bad_Code';
|
||||
await c.saveActive();
|
||||
expect(api.createIntegrationClientInstance).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('绑定:必填校验与 POST payload(状态与来源快捷列不随表单提交)', async () => {
|
||||
const c = makeHarness();
|
||||
c.openCreateModal('binding');
|
||||
c.bindingForm.value.capability = 'in_transit_transfer.query_inventory';
|
||||
@@ -116,25 +139,134 @@ describe('useIntegrationConnectorAdmin', () => {
|
||||
await c.saveActive();
|
||||
expect(api.createIntegrationBinding).toHaveBeenCalledWith({
|
||||
capability: 'in_transit_transfer.query_inventory', context_selector_json: {},
|
||||
context_source_code: null,
|
||||
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,
|
||||
});
|
||||
const payload = api.createIntegrationBinding.mock.calls[0][0] as Record<string, unknown>;
|
||||
// 状态走列表生命周期按钮;客户端实例随接口定义联动(仍随 payload 提交)
|
||||
expect(payload).not.toHaveProperty('status');
|
||||
expect(payload).not.toHaveProperty('context_source_code');
|
||||
});
|
||||
|
||||
it('绑定生命周期:publish 调动作端点并刷新绑定列表', async () => {
|
||||
const c = makeHarness();
|
||||
api.changeIntegrationBindingLifecycle.mockResolvedValue({});
|
||||
api.listIntegrationBindings.mockResolvedValue([]);
|
||||
c.bindings.value = [{
|
||||
id: 7, capability: 'in_transit_transfer.query_inventory', context_selector_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',
|
||||
});
|
||||
}];
|
||||
await c.changeBindingLifecycle(c.bindings.value[0], 'publish');
|
||||
expect(api.changeIntegrationBindingLifecycle).toHaveBeenCalledWith(7, 'publish');
|
||||
expect(api.listIntegrationBindings).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('凭据引用:创建 payload 不含明文 secret', async () => {
|
||||
it('接口定义:编码留空按「客户端编码-名称」建议;payload 不含 connector_type/status/enabled', async () => {
|
||||
const c = makeHarness();
|
||||
c.openCreateModal('interface');
|
||||
c.interfaceForm.value.name = '鼎捷TOPGP库存查询GetItemStockList';
|
||||
c.interfaceForm.value.client_instance_code = '1001';
|
||||
await c.saveActive();
|
||||
expect(api.createIntegrationInterfaceDefinition).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ code: '1001-topgp-getitemstocklist', client_instance_code: '1001' }),
|
||||
);
|
||||
const payload = api.createIntegrationInterfaceDefinition.mock.calls[0][0] as Record<string, unknown>;
|
||||
// 类型由后端按客户端推导、状态走生命周期按钮:均不随表单 payload 提交
|
||||
expect(payload).not.toHaveProperty('connector_type');
|
||||
expect(payload).not.toHaveProperty('status');
|
||||
expect(payload).not.toHaveProperty('enabled');
|
||||
});
|
||||
|
||||
it('接口定义生命周期:publish 调动作端点并刷新接口列表', async () => {
|
||||
const c = makeHarness();
|
||||
api.changeIntegrationInterfaceLifecycle.mockResolvedValue({});
|
||||
api.listIntegrationInterfaceDefinitions.mockResolvedValue([]);
|
||||
c.interfaces.value = [{
|
||||
id: 9, code: 'IF-LC', name: 'iface', client_instance_code: 'CLI-A', connector_type: 'rest',
|
||||
http_method: null, request_path: null, request_spec_json: {}, input_schema_json: {},
|
||||
response_mapping_json: {}, output_schema_json: {}, version: 1, status: 'draft', enabled: true,
|
||||
}];
|
||||
await c.changeInterfaceLifecycle(c.interfaces.value[0], 'publish');
|
||||
expect(api.changeIntegrationInterfaceLifecycle).toHaveBeenCalledWith('IF-LC', 'publish');
|
||||
expect(api.listIntegrationInterfaceDefinitions).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('凭据引用 env 模式:创建 payload 只含 secret_ref,不含明文 secret', async () => {
|
||||
const c = makeHarness();
|
||||
c.openCreateModal('credential');
|
||||
c.credentialForm.value.secret_provider = 'env';
|
||||
c.credentialForm.value.code = 'CRED-A';
|
||||
c.credentialForm.value.secret_ref = 'IN_TRANSIT_ERP_PASSWORD';
|
||||
await c.saveActive();
|
||||
expect(api.createIntegrationCredentialReference).toHaveBeenCalledWith({
|
||||
code: 'CRED-A', secret_ref: 'IN_TRANSIT_ERP_PASSWORD', secret_provider: 'env',
|
||||
code: 'CRED-A', secret_provider: 'env',
|
||||
credential_type: 'password', status: 'active',
|
||||
secret_ref: 'IN_TRANSIT_ERP_PASSWORD',
|
||||
});
|
||||
});
|
||||
|
||||
it('凭据引用 db 模式:创建 payload 按类型字段组装,不含 secret_ref', async () => {
|
||||
const c = makeHarness();
|
||||
c.credentialTypes.value = [
|
||||
{ type: 'password', fields: [
|
||||
{ key: 'username', secret: false, required: true },
|
||||
{ key: 'password', secret: true, required: true },
|
||||
] },
|
||||
];
|
||||
c.openCreateModal('credential');
|
||||
c.credentialForm.value.code = 'CRED-DB';
|
||||
c.credentialForm.value.fields = { username: 'erp_user', password: 'erp_pass' };
|
||||
await c.saveActive();
|
||||
expect(api.createIntegrationCredentialReference).toHaveBeenCalledWith({
|
||||
code: 'CRED-DB', secret_provider: 'db',
|
||||
credential_type: 'password', status: 'active',
|
||||
username: 'erp_user', password: 'erp_pass',
|
||||
});
|
||||
});
|
||||
|
||||
it('凭据引用 db 模式:编辑时全部字段留空 → payload 不带凭据键(仅元数据)', async () => {
|
||||
const c = makeHarness();
|
||||
c.credentialTypes.value = [{ type: 'password', fields: [
|
||||
{ key: 'username', secret: false, required: true },
|
||||
{ key: 'password', secret: true, required: true },
|
||||
] }];
|
||||
c.openCreateModal('credential');
|
||||
c.credentialForm.value.id = 9;
|
||||
c.credentialForm.value.code = 'CRED-DB';
|
||||
c.credentialForm.value.fields = {};
|
||||
await c.saveActive();
|
||||
expect(api.updateIntegrationCredentialReference).toHaveBeenCalledWith('CRED-DB', {
|
||||
code: 'CRED-DB', secret_provider: 'db',
|
||||
credential_type: 'password', status: 'active',
|
||||
});
|
||||
});
|
||||
|
||||
it('凭据引用 db 模式:新建缺必填字段 → 不调 API', async () => {
|
||||
const c = makeHarness();
|
||||
c.credentialTypes.value = [{ type: 'password', fields: [
|
||||
{ key: 'username', secret: false, required: true },
|
||||
{ key: 'password', secret: true, required: true },
|
||||
] }];
|
||||
c.openCreateModal('credential');
|
||||
c.credentialForm.value.code = 'CRED-DB';
|
||||
c.credentialForm.value.fields = { username: 'only-user' };
|
||||
await c.saveActive();
|
||||
expect(api.createIntegrationCredentialReference).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('凭据引用 db 模式:类型未注册 → 不调 API', async () => {
|
||||
const c = makeHarness();
|
||||
c.openCreateModal('credential');
|
||||
c.credentialForm.value.code = 'CRED-X';
|
||||
c.credentialForm.value.credential_type = 'unknown';
|
||||
await c.saveActive();
|
||||
expect(api.createIntegrationCredentialReference).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('连接测试与能力调用走对应 API', async () => {
|
||||
const c = makeHarness();
|
||||
api.testIntegrationClientConnection.mockResolvedValue({ ok: true });
|
||||
@@ -145,4 +277,102 @@ describe('useIntegrationConnectorAdmin', () => {
|
||||
await c.runCall();
|
||||
expect(api.callIntegrationCapability).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('连接测试结果按行存放:probe 失败归 ok=false 并带原因码', async () => {
|
||||
const c = makeHarness();
|
||||
api.testIntegrationClientConnection.mockResolvedValue({
|
||||
ok: false, status: 'failed', result: { ok: false, code: 'HTTP_502', message: 'bad gateway' },
|
||||
});
|
||||
await c.testConnection('CLI-A');
|
||||
expect(c.testResults.value['CLI-A']).toEqual({ ok: false, code: 'HTTP_502', message: 'bad gateway' });
|
||||
});
|
||||
|
||||
it('行内启停:切换调用 PUT,失败自动回滚', async () => {
|
||||
const c = makeHarness();
|
||||
api.updateIntegrationClientInstance.mockRejectedValue(new Error('network down'));
|
||||
const row = { code: 'CLI-A', enabled: true };
|
||||
await c.toggleClient(row);
|
||||
expect(api.updateIntegrationClientInstance).toHaveBeenCalledWith('CLI-A', { enabled: false });
|
||||
expect(row.enabled).toBe(true);
|
||||
|
||||
api.updateIntegrationClientInstance.mockResolvedValue({});
|
||||
await c.toggleClient(row);
|
||||
expect(row.enabled).toBe(false);
|
||||
});
|
||||
|
||||
it('凭据状态行内切换:只传 status 调 PUT,rotating 视为启用侧,失败回滚', async () => {
|
||||
const c = makeHarness();
|
||||
api.updateIntegrationCredentialReference.mockResolvedValue({});
|
||||
const row = { code: 'CRED-A', status: 'active' };
|
||||
await c.toggleCredential(row);
|
||||
expect(api.updateIntegrationCredentialReference).toHaveBeenCalledWith('CRED-A', { status: 'retired' });
|
||||
expect(row.status).toBe('retired');
|
||||
|
||||
// rotating 非停用态:点击即停用
|
||||
const rotating = { code: 'CRED-B', status: 'rotating' };
|
||||
await c.toggleCredential(rotating);
|
||||
expect(api.updateIntegrationCredentialReference).toHaveBeenCalledWith('CRED-B', { status: 'retired' });
|
||||
|
||||
// 停用态点击切回启用;失败时回滚保持停用
|
||||
api.updateIntegrationCredentialReference.mockRejectedValue(new Error('network down'));
|
||||
await c.toggleCredential(row);
|
||||
expect(row.status).toBe('retired');
|
||||
});
|
||||
|
||||
it('删除客户端实例需确认:拒绝不调 API,确认才删', async () => {
|
||||
const c = makeHarness();
|
||||
const confirmSpy = vi.spyOn(window, 'confirm').mockReturnValue(false);
|
||||
await c.deleteClient({ code: 'CLI-A', name: '客户端A' });
|
||||
expect(confirmSpy).toHaveBeenCalledTimes(1);
|
||||
expect(api.deleteIntegrationClientInstance).not.toHaveBeenCalled();
|
||||
|
||||
confirmSpy.mockReturnValue(true);
|
||||
await c.deleteClient({ code: 'CLI-A', name: '客户端A' });
|
||||
expect(api.deleteIntegrationClientInstance).toHaveBeenCalledWith('CLI-A');
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('接口退役需确认:拒绝不调 API,确认才调', async () => {
|
||||
const c = makeHarness();
|
||||
const confirmSpy = vi.spyOn(window, 'confirm').mockReturnValue(false);
|
||||
api.changeIntegrationInterfaceLifecycle.mockResolvedValue({});
|
||||
api.listIntegrationInterfaceDefinitions.mockResolvedValue([]);
|
||||
c.interfaces.value = [{
|
||||
id: 3, code: 'IF-R', name: 'iface', client_instance_code: 'CLI-A', 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,
|
||||
}];
|
||||
// 退役接近终态且使引用绑定同时失效:确认拒绝则不调 API
|
||||
await c.changeInterfaceLifecycle(c.interfaces.value[0], 'retire');
|
||||
expect(confirmSpy).toHaveBeenCalledTimes(1);
|
||||
expect(api.changeIntegrationInterfaceLifecycle).not.toHaveBeenCalled();
|
||||
confirmSpy.mockReturnValue(true);
|
||||
await c.changeInterfaceLifecycle(c.interfaces.value[0], 'retire');
|
||||
expect(api.changeIntegrationInterfaceLifecycle).toHaveBeenCalledWith('IF-R', 'retire');
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('可逆转移(撤回)免确认直达;进行中重复触发被互斥忽略', async () => {
|
||||
const c = makeHarness();
|
||||
const confirmSpy = vi.spyOn(window, 'confirm');
|
||||
let resolveApi!: (value: unknown) => void;
|
||||
api.changeIntegrationInterfaceLifecycle.mockImplementation(
|
||||
() => new Promise((resolve) => { resolveApi = resolve; }),
|
||||
);
|
||||
api.listIntegrationInterfaceDefinitions.mockResolvedValue([]);
|
||||
c.interfaces.value = [{
|
||||
id: 4, code: 'IF-U', name: 'iface', client_instance_code: 'CLI-A', 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 first = c.changeInterfaceLifecycle(c.interfaces.value[0], 'unpublish');
|
||||
const second = c.changeInterfaceLifecycle(c.interfaces.value[0], 'unpublish');
|
||||
resolveApi({});
|
||||
await Promise.all([first, second]);
|
||||
expect(api.changeIntegrationInterfaceLifecycle).toHaveBeenCalledTimes(1);
|
||||
// 可逆转移不弹确认
|
||||
expect(confirmSpy).not.toHaveBeenCalled();
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
});
|
||||
+167
-26
@@ -3,14 +3,23 @@
|
||||
* 集成连接器管理编排:客户端实例/接口定义/绑定/凭据引用四实体列表与增改表单,
|
||||
* 以及能力清单与手动调用测试。
|
||||
* 依赖:integration-connector.api、types、useMessage、useI18n。
|
||||
* 逻辑:各列表独立 loadAll;新增/编辑共用表单弹窗态(form.id 区分);能力测试
|
||||
* 独立于配置表单(CapabilityCall 弹窗)。保存/删除后刷新对应列表。
|
||||
* 逻辑:各列表独立 loadAll;新增/编辑共用表单弹窗态(form.id 区分);客户端编码
|
||||
* 可手改、留空按名称自动生成,接口定义编码留空按「客户端编码-名称」自动建议;
|
||||
* 接口与绑定状态只经 change*Lifecycle 按钮流转(表单内只读徽章);绑定表单的
|
||||
* 客户端实例随所选接口定义联动带出并锁定(接口归属即客户端归属);
|
||||
* 凭据状态只经列表行内开关流转(启用↔停用,表单不维护状态);
|
||||
* 全部行内状态操作经 lifecycleBusy 互斥(进行中忽略新触发);接口/绑定退役
|
||||
* 接近终态需 window.confirm 二次确认,可逆转移直达;
|
||||
* 连接测试结果按行存放(列表徽章+展开详情);
|
||||
* 启停支持行内开关(失败回滚);删除带确认。保存/删除后刷新对应列表。
|
||||
*/
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import {
|
||||
callIntegrationCapability,
|
||||
changeIntegrationBindingLifecycle,
|
||||
changeIntegrationInterfaceLifecycle,
|
||||
createIntegrationBinding,
|
||||
createIntegrationClientInstance,
|
||||
createIntegrationCredentialReference,
|
||||
@@ -20,6 +29,7 @@ import {
|
||||
listIntegrationCapabilities,
|
||||
listIntegrationClientInstances,
|
||||
listIntegrationCredentialReferences,
|
||||
listIntegrationCredentialTypes,
|
||||
listIntegrationInterfaceDefinitions,
|
||||
testIntegrationClientConnection,
|
||||
updateIntegrationBinding,
|
||||
@@ -30,13 +40,18 @@ import {
|
||||
import {
|
||||
bindingRowToForm,
|
||||
clientInstanceRowToForm,
|
||||
CLIENT_CODE_PATTERN,
|
||||
createEmptyBindingForm,
|
||||
createEmptyClientInstanceForm,
|
||||
createEmptyCredentialReferenceForm,
|
||||
createEmptyInterfaceDefinitionForm,
|
||||
credentialReferenceRowToForm,
|
||||
interfaceDefinitionRowToForm,
|
||||
normalizeConnectionTestResponse,
|
||||
suggestClientCode,
|
||||
suggestInterfaceCode,
|
||||
type BindingFormState,
|
||||
type ClientConnectionTestResult,
|
||||
type ClientInstanceFormState,
|
||||
type CredentialReferenceFormState,
|
||||
type IntegrationBindingRow,
|
||||
@@ -44,12 +59,17 @@ import {
|
||||
type IntegrationCapabilityRow,
|
||||
type IntegrationClientInstanceRow,
|
||||
type IntegrationCredentialReferenceRow,
|
||||
type IntegrationCredentialTypeSpec,
|
||||
type IntegrationInterfaceDefinitionRow,
|
||||
type InterfaceDefinitionFormState,
|
||||
} from '../types/integration-connector.types';
|
||||
|
||||
type EditableEntity = 'client' | 'interface' | 'binding' | 'credential';
|
||||
|
||||
/** 接口定义/绑定生命周期动作(与后端 CONFIG_STATUS_TRANSITIONS 一一对应)。 */
|
||||
export type InterfaceLifecycleAction = 'publish' | 'unpublish' | 'retire' | 'reopen';
|
||||
export type BindingLifecycleAction = InterfaceLifecycleAction;
|
||||
|
||||
export function useIntegrationConnectorAdmin() {
|
||||
const { t } = useI18n();
|
||||
const msg = useMessage();
|
||||
@@ -60,6 +80,7 @@ export function useIntegrationConnectorAdmin() {
|
||||
const bindings = ref<IntegrationBindingRow[]>([]);
|
||||
const credentials = ref<IntegrationCredentialReferenceRow[]>([]);
|
||||
const capabilities = ref<IntegrationCapabilityRow[]>([]);
|
||||
const credentialTypes = ref<IntegrationCredentialTypeSpec[]>([]);
|
||||
const isLoading = ref(true);
|
||||
|
||||
// ---- 表单弹窗态 ----
|
||||
@@ -79,14 +100,32 @@ export function useIntegrationConnectorAdmin() {
|
||||
const callResult = ref<IntegrationCallResultRow | null>(null);
|
||||
const callBusy = ref(false);
|
||||
|
||||
// ---- 连接测试 ----
|
||||
// ---- 连接测试(结果按客户端编码存放,供列表行内徽章 + 可展开详情) ----
|
||||
const testingClientCode = ref('');
|
||||
const testResultText = ref('');
|
||||
const testResults = ref<Record<string, ClientConnectionTestResult>>({});
|
||||
|
||||
// ---- 状态转移互斥锁:任一启停/生命周期转移进行中即忽略新转移,防连点与并发转移 ----
|
||||
const lifecycleBusy = ref(false);
|
||||
|
||||
/** 行内状态操作统一入口:busy 互斥包裹,进行中重复触发直接忽略。 */
|
||||
const runStateToggle = async (fn: () => Promise<void>) => {
|
||||
if (lifecycleBusy.value) return;
|
||||
lifecycleBusy.value = true;
|
||||
try {
|
||||
await fn();
|
||||
} finally {
|
||||
lifecycleBusy.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const loadClients = async () => { clients.value = await listIntegrationClientInstances(); };
|
||||
const loadInterfaces = async () => { interfaces.value = await listIntegrationInterfaceDefinitions(); };
|
||||
const loadBindings = async () => { bindings.value = await listIntegrationBindings(); };
|
||||
const loadCredentials = async () => { credentials.value = await listIntegrationCredentialReferences(); };
|
||||
const loadCredentials = async () => {
|
||||
const [rows, typeSpecs] = await Promise.all([listIntegrationCredentialReferences(), listIntegrationCredentialTypes()]);
|
||||
credentials.value = rows;
|
||||
credentialTypes.value = typeSpecs;
|
||||
};
|
||||
const loadCapabilities = async () => { capabilities.value = await listIntegrationCapabilities(); };
|
||||
|
||||
const loadAll = async () => {
|
||||
@@ -154,37 +193,45 @@ export function useIntegrationConnectorAdmin() {
|
||||
try {
|
||||
if (activeEntity.value === 'client') {
|
||||
const form = clientForm.value;
|
||||
if (!form.code.trim() || !form.name.trim()) {
|
||||
if (!form.name.trim()) {
|
||||
msg.warning(t('admin.integrationConnector.msg.fillClient'));
|
||||
return;
|
||||
}
|
||||
// 编码可由用户手改;留空时按名称兜底自动生成(唯一性由后端 409 兜底)。
|
||||
const code = form.code.trim() || suggestClientCode(form.name);
|
||||
if (!CLIENT_CODE_PATTERN.test(code)) {
|
||||
msg.warning(t('admin.integrationConnector.msg.codeInvalid'));
|
||||
return;
|
||||
}
|
||||
const configJson = parseJsonField(form.config_json, 'config_json');
|
||||
const payload = {
|
||||
code: form.code.trim(), name: form.name.trim(), connector_type: form.connector_type,
|
||||
code, name: form.name.trim(), connector_type: form.connector_type,
|
||||
environment: form.environment,
|
||||
endpoint: form.endpoint.trim() || null,
|
||||
timeout_seconds: form.timeout_seconds.trim() ? Number(form.timeout_seconds) : null,
|
||||
config_json: configJson,
|
||||
credential_ref_code: form.credential_ref_code.trim() || null, enabled: form.enabled,
|
||||
};
|
||||
if (form.id) await updateIntegrationClientInstance(form.code, payload);
|
||||
if (form.id) await updateIntegrationClientInstance(code, payload);
|
||||
else await createIntegrationClientInstance(payload);
|
||||
} else if (activeEntity.value === 'interface') {
|
||||
const form = interfaceForm.value;
|
||||
if (!form.code.trim() || !form.client_instance_code.trim()) {
|
||||
if (!form.client_instance_code.trim()) {
|
||||
msg.warning(t('admin.integrationConnector.msg.fillInterface'));
|
||||
return;
|
||||
}
|
||||
// 编码留空时按「客户端实例编码-名称」自动建议(可手改;全局唯一由后端 409 兜底)。
|
||||
// 连接器类型/状态/启用不随表单提交:类型由后端按客户端实例推导,状态走生命周期按钮。
|
||||
const code = form.code.trim() || suggestInterfaceCode(form.client_instance_code, form.name);
|
||||
const payload = {
|
||||
code: form.code.trim(), name: form.name.trim() || form.code.trim(),
|
||||
client_instance_code: form.client_instance_code.trim(), connector_type: form.connector_type,
|
||||
code, name: form.name.trim() || code,
|
||||
client_instance_code: form.client_instance_code.trim(),
|
||||
http_method: form.http_method.trim() || null,
|
||||
request_path: form.request_path.trim() || null,
|
||||
request_spec_json: parseJsonField(form.request_spec_json, 'request_spec_json'),
|
||||
input_schema_json: parseJsonField(form.input_schema_json, 'input_schema_json'),
|
||||
response_mapping_json: parseJsonField(form.response_mapping_json, 'response_mapping_json'),
|
||||
output_schema_json: parseJsonField(form.output_schema_json, 'output_schema_json'),
|
||||
status: form.status, enabled: form.enabled,
|
||||
};
|
||||
if (form.id) await updateIntegrationInterfaceDefinition(form.code, payload);
|
||||
else await createIntegrationInterfaceDefinition(payload);
|
||||
@@ -194,26 +241,55 @@ export function useIntegrationConnectorAdmin() {
|
||||
msg.warning(t('admin.integrationConnector.msg.fillBinding'));
|
||||
return;
|
||||
}
|
||||
// 客户端实例随所选接口定义联动带出(接口归属即客户端归属);
|
||||
// 状态不随表单提交:新建固定 draft,发布/退役走列表生命周期按钮。
|
||||
const payload = {
|
||||
capability: form.capability.trim(), context_selector_json: parseJsonField(form.context_selector_json, 'context_selector_json'),
|
||||
context_source_code: form.context_source_code.trim() || null,
|
||||
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(),
|
||||
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,
|
||||
status: form.status,
|
||||
};
|
||||
if (form.id) await updateIntegrationBinding(form.id, payload);
|
||||
else await createIntegrationBinding(payload);
|
||||
} else {
|
||||
const form = credentialForm.value;
|
||||
if (!form.code.trim() || !form.secret_ref.trim()) {
|
||||
// db 模式:按凭据类型注册表动态字段,界面维护、服务端加密落库;
|
||||
// 编辑时密文字段留空 = 沿用旧值。env 模式:只存环境配置键名。
|
||||
if (!form.code.trim()) {
|
||||
msg.warning(t('admin.integrationConnector.msg.fillCredential'));
|
||||
return;
|
||||
}
|
||||
const payload = {
|
||||
code: form.code.trim(), secret_ref: form.secret_ref.trim(), secret_provider: form.secret_provider,
|
||||
const payload: Record<string, unknown> = {
|
||||
code: form.code.trim(), secret_provider: form.secret_provider,
|
||||
credential_type: form.credential_type, status: form.status,
|
||||
};
|
||||
if (form.secret_provider === 'db') {
|
||||
const typeSpec = credentialTypes.value.find((item) => item.type === form.credential_type);
|
||||
if (!typeSpec) {
|
||||
msg.warning(t('admin.integrationConnector.msg.credentialTypeMissing'));
|
||||
return;
|
||||
}
|
||||
if (!form.id) {
|
||||
const missing = typeSpec.fields
|
||||
.filter((field) => field.required && !(form.fields[field.key] || '').trim())
|
||||
.map((field) => t(`admin.integrationConnector.credentialFields.${field.key}`, field.key));
|
||||
if (missing.length) {
|
||||
msg.warning(t('admin.integrationConnector.msg.fillCredentialDb', { fields: missing.join('、') }));
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (const field of typeSpec.fields) {
|
||||
const value = (form.fields[field.key] || '').trim();
|
||||
if (value) payload[field.key] = value;
|
||||
}
|
||||
} else {
|
||||
if (!form.secret_ref.trim()) {
|
||||
msg.warning(t('admin.integrationConnector.msg.fillCredential'));
|
||||
return;
|
||||
}
|
||||
payload.secret_ref = form.secret_ref.trim();
|
||||
}
|
||||
if (form.id) await updateIntegrationCredentialReference(form.code, payload);
|
||||
else await createIntegrationCredentialReference(payload);
|
||||
}
|
||||
@@ -233,11 +309,11 @@ export function useIntegrationConnectorAdmin() {
|
||||
// ---- 连接测试 ----
|
||||
const testConnection = async (code: string) => {
|
||||
testingClientCode.value = code;
|
||||
testResultText.value = '';
|
||||
try {
|
||||
const result = await testIntegrationClientConnection(code);
|
||||
testResultText.value = JSON.stringify(result, null, 2);
|
||||
msg.success(t('admin.integrationConnector.msg.testOk'));
|
||||
const normalized = normalizeConnectionTestResponse(await testIntegrationClientConnection(code));
|
||||
testResults.value = { ...testResults.value, [code]: normalized };
|
||||
if (normalized.ok) msg.success(t('admin.integrationConnector.msg.testOk'));
|
||||
else msg.error(t('admin.integrationConnector.msg.testFailed', { code: normalized.code }));
|
||||
} catch (e) {
|
||||
msg.error((e as Error).message || t('admin.msg.requestFailed'));
|
||||
} finally {
|
||||
@@ -245,6 +321,64 @@ export function useIntegrationConnectorAdmin() {
|
||||
}
|
||||
};
|
||||
|
||||
// ---- 行内启停:直接切换 enabled;失败回滚并提示 ----
|
||||
const toggleClient = async (row: IntegrationClientInstanceRow) => {
|
||||
await runStateToggle(async () => {
|
||||
const target = !row.enabled;
|
||||
row.enabled = target;
|
||||
try {
|
||||
await updateIntegrationClientInstance(row.code, { enabled: target });
|
||||
} catch (e) {
|
||||
row.enabled = !target;
|
||||
msg.error((e as Error).message || t('admin.integrationConnector.msg.toggleFailed'));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// ---- 凭据状态行内切换:启用↔停用(rotating 视为启用侧,点击即停用);解析层只认 active,停用即断流;失败回滚并提示 ----
|
||||
const toggleCredential = async (row: IntegrationCredentialReferenceRow) => {
|
||||
await runStateToggle(async () => {
|
||||
const target = row.status === 'retired' ? 'active' : 'retired';
|
||||
const prev = row.status;
|
||||
row.status = target;
|
||||
try {
|
||||
await updateIntegrationCredentialReference(row.code, { status: target });
|
||||
} catch (e) {
|
||||
row.status = prev;
|
||||
msg.error((e as Error).message || t('admin.integrationConnector.msg.toggleFailed'));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// ---- 接口定义生命周期:发布/撤回/退役/恢复(状态唯一入口,后端转移表校验) ----
|
||||
// 退役接近终态且使引用该接口的绑定同时失效 → 二次确认;其余转移可逆,免确认直达。
|
||||
const changeInterfaceLifecycle = async (row: IntegrationInterfaceDefinitionRow, action: InterfaceLifecycleAction) => {
|
||||
await runStateToggle(async () => {
|
||||
if (action === 'retire' && !window.confirm(t('admin.integrationConnector.msg.retireInterfaceConfirm'))) return;
|
||||
try {
|
||||
await changeIntegrationInterfaceLifecycle(row.code, action);
|
||||
await loadInterfaces();
|
||||
msg.success(t('admin.integrationConnector.msg.statusUpdated'));
|
||||
} catch (e) {
|
||||
msg.error((e as Error).message || t('admin.integrationConnector.msg.statusUpdateFailed'));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// ---- 绑定生命周期:发布/撤回/退役/恢复(状态唯一入口,后端转移表 + 发布就绪门禁校验) ----
|
||||
const changeBindingLifecycle = async (row: IntegrationBindingRow, action: BindingLifecycleAction) => {
|
||||
await runStateToggle(async () => {
|
||||
if (action === 'retire' && !window.confirm(t('admin.integrationConnector.msg.retireBindingConfirm'))) return;
|
||||
try {
|
||||
await changeIntegrationBindingLifecycle(row.id, action);
|
||||
await loadBindings();
|
||||
msg.success(t('admin.integrationConnector.msg.statusUpdated'));
|
||||
} catch (e) {
|
||||
msg.error((e as Error).message || t('admin.integrationConnector.msg.statusUpdateFailed'));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// ---- 能力调用测试 ----
|
||||
const openCallModal = (capability: string) => {
|
||||
callCapability.value = capability;
|
||||
@@ -274,9 +408,14 @@ export function useIntegrationConnectorAdmin() {
|
||||
}
|
||||
};
|
||||
|
||||
const deleteClient = async (code: string) => {
|
||||
/** 删除客户端实例:先确认(提示语带名称),确认后才调 API。 */
|
||||
const deleteClient = async (row: IntegrationClientInstanceRow) => {
|
||||
const summary = t('admin.integrationConnector.msg.deleteConfirm', { code: row.code, name: row.name });
|
||||
if (!window.confirm(summary)) return;
|
||||
try {
|
||||
await deleteIntegrationClientInstance(code);
|
||||
await deleteIntegrationClientInstance(row.code);
|
||||
const { [row.code]: _removed, ...rest } = testResults.value;
|
||||
testResults.value = rest;
|
||||
await loadClients();
|
||||
msg.success(t('admin.integrationConnector.msg.deleted'));
|
||||
} catch (e) {
|
||||
@@ -285,12 +424,14 @@ export function useIntegrationConnectorAdmin() {
|
||||
};
|
||||
|
||||
return {
|
||||
clients, interfaces, bindings, credentials, capabilities,
|
||||
clients, interfaces, bindings, credentials, capabilities, credentialTypes,
|
||||
isLoading, activeEntity, showFormModal, isSaving,
|
||||
clientForm, interfaceForm, bindingForm, credentialForm,
|
||||
showCallModal, callCapability, callParamsText, callContextText, callResult, callBusy,
|
||||
testingClientCode, testResultText,
|
||||
testingClientCode, testResults,
|
||||
lifecycleBusy,
|
||||
loadAll, openCreateModal, openEditModal, closeFormModal, saveActive,
|
||||
testConnection, openCallModal, closeCallModal, runCall, deleteClient,
|
||||
testConnection, toggleClient, toggleCredential, openCallModal, closeCallModal, runCall, deleteClient,
|
||||
changeInterfaceLifecycle, changeBindingLifecycle,
|
||||
};
|
||||
}
|
||||
+120
-17
@@ -9,12 +9,104 @@
|
||||
/** 连接器类型:与后端 CONNECTOR_TYPES 对齐。 */
|
||||
export type IntegrationConnectorType = 'rest' | 'soap';
|
||||
|
||||
/** 连接器类型选项(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' },
|
||||
];
|
||||
|
||||
/** 环境选项(与发布流程 dev→test→prod 对齐;新增环境在此追加并补四语言文案)。 */
|
||||
export const ENVIRONMENT_OPTIONS = ['dev', 'test', 'prod'] as const;
|
||||
|
||||
/** 各连接器类型当前生效的 config_json 键(高级配置帮助文案依据,与 transports 消费代码对齐)。 */
|
||||
export const CONNECTOR_CONFIG_KEYS: Readonly<Record<string, ReadonlyArray<string>>> = {
|
||||
rest: ['headers'],
|
||||
soap: [],
|
||||
};
|
||||
|
||||
/** 客户端编码规则:小写字母/数字开头,仅小写字母、数字、连字符(保存后不可改)。 */
|
||||
export const CLIENT_CODE_PATTERN = /^[a-z0-9][a-z0-9-]*$/;
|
||||
|
||||
/** 编码最大长度(与后端 String(64) 列宽一致)。 */
|
||||
const CODE_MAX_LENGTH = 64;
|
||||
|
||||
/** 由名称提取编码 slug:拉丁字符转 kebab-case;无拉丁字符(如纯中文)返回空串。 */
|
||||
function slugifyName(name: string): string {
|
||||
return String(name || '')
|
||||
.toLowerCase()
|
||||
.replace(/[^a-z0-9]+/g, '-')
|
||||
.replace(/^-+|-+$/g, '');
|
||||
}
|
||||
|
||||
/** 由名称建议客户端编码:slug 为空时回退 conn-xxxx(可手改,保存后不可改)。 */
|
||||
export function suggestClientCode(name: string): string {
|
||||
const slug = slugifyName(name);
|
||||
if (slug) return slug.slice(0, CODE_MAX_LENGTH);
|
||||
return `conn-${Math.random().toString(36).slice(2, 6)}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* 建议接口定义编码:客户端编码前缀 + 名称 slug(如 1001-topgp-getitemstocklist)。
|
||||
* 前缀降低跨客户端撞码概率,slug 保证同一客户端下多个接口可区分;
|
||||
* 仅是建议值(可手改),全局唯一仍由后端 409 兜底。
|
||||
*/
|
||||
export function suggestInterfaceCode(clientCode: string, name: string): string {
|
||||
const prefix = String(clientCode || '').trim();
|
||||
if (!prefix) return '';
|
||||
const slug = slugifyName(name);
|
||||
const suffix = slug || Math.random().toString(36).slice(2, 6);
|
||||
return `${prefix}-${suffix}`.slice(0, CODE_MAX_LENGTH);
|
||||
}
|
||||
|
||||
/** 行内连接测试结果(列表徽章 + 可展开详情的数据模型)。 */
|
||||
export interface ClientConnectionTestResult {
|
||||
ok: boolean;
|
||||
code: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
/** 连接测试接口响应(后端返回 { ok, status, result },result 为传输层 raw dict)。 */
|
||||
export interface ClientConnectionTestResponse {
|
||||
ok?: boolean;
|
||||
status?: string;
|
||||
result?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
const CALL_FAILURE_STATUSES = ['business_failed', 'technical_failed', 'timeout', 'result_unknown'];
|
||||
|
||||
/** 把连接测试响应归一为行内展示模型:优先 probe 结果;回退兼容只实现 call 的传输 raw dict。 */
|
||||
export function normalizeConnectionTestResponse(response: ClientConnectionTestResponse): ClientConnectionTestResult {
|
||||
const raw = response.result ?? {};
|
||||
if (typeof raw.ok === 'boolean') {
|
||||
return { ok: raw.ok, code: String(raw.code ?? ''), message: String(raw.message ?? '') };
|
||||
}
|
||||
const status = String(raw.status ?? response.status ?? '');
|
||||
return {
|
||||
ok: !CALL_FAILURE_STATUSES.includes(status),
|
||||
code: String(raw.code ?? status),
|
||||
message: String(raw.message ?? ''),
|
||||
};
|
||||
}
|
||||
|
||||
/** 配置状态:draft 草稿 / published 已发布 / retired 已退役。 */
|
||||
export type IntegrationConfigStatus = 'draft' | 'published' | 'retired';
|
||||
|
||||
/** 凭据状态。 */
|
||||
export type IntegrationCredentialStatus = 'active' | 'rotating' | 'retired';
|
||||
|
||||
/** 凭据类型字段定义(secret=加密落库且永不回显;required 合并旧值后仍必填)。 */
|
||||
export interface IntegrationCredentialTypeField {
|
||||
key: string;
|
||||
secret: boolean;
|
||||
required: boolean;
|
||||
}
|
||||
|
||||
/** 凭据类型规格(后端代码注册表下发,UI 按其动态渲染字段)。 */
|
||||
export interface IntegrationCredentialTypeSpec {
|
||||
type: string;
|
||||
fields: IntegrationCredentialTypeField[];
|
||||
}
|
||||
|
||||
/** 能力清单项(后端 capability 注册表)。 */
|
||||
export interface IntegrationCapabilityRow {
|
||||
name: string;
|
||||
@@ -71,7 +163,7 @@ export interface IntegrationBindingRow {
|
||||
id: number;
|
||||
capability: string;
|
||||
context_selector_json: Record<string, unknown>;
|
||||
context_source_code: string | null;
|
||||
param_mapping_json: Record<string, unknown>;
|
||||
client_instance_code: string;
|
||||
interface_definition_code: string;
|
||||
mapping_version: number;
|
||||
@@ -82,15 +174,18 @@ export interface IntegrationBindingRow {
|
||||
status: IntegrationConfigStatus;
|
||||
}
|
||||
|
||||
/** 凭据引用(只存 secret_ref,不落明文)。 */
|
||||
/** 凭据引用(db 模式按类型加密落库不落明文;env 模式存环境配置键名)。 */
|
||||
export interface IntegrationCredentialReferenceRow {
|
||||
id: number;
|
||||
code: string;
|
||||
secret_ref: string;
|
||||
secret_provider: string;
|
||||
credential_type: string;
|
||||
secret_fields: Record<string, string>;
|
||||
has_secret: boolean;
|
||||
version: number;
|
||||
status: IntegrationCredentialStatus;
|
||||
updated_at: string | null;
|
||||
last_verified_at: string | null;
|
||||
}
|
||||
|
||||
@@ -108,7 +203,11 @@ export interface ClientInstanceFormState {
|
||||
enabled: boolean;
|
||||
}
|
||||
|
||||
/** 接口定义表单(JSON 字段以文本承载,提交时解析)。 */
|
||||
/**
|
||||
* 接口定义表单(JSON 字段以文本承载,提交时解析)。
|
||||
* connector_type 仅作展示:随所选客户端实例联动回填,提交时后端以客户端实例为单一事实源推导;
|
||||
* status 仅作徽章展示:新建固定 draft,发布/退役经列表生命周期按钮流转,均不随表单提交。
|
||||
*/
|
||||
export interface InterfaceDefinitionFormState {
|
||||
id: number | null;
|
||||
code: string;
|
||||
@@ -122,15 +221,18 @@ export interface InterfaceDefinitionFormState {
|
||||
response_mapping_json: string;
|
||||
output_schema_json: string;
|
||||
status: IntegrationConfigStatus;
|
||||
enabled: boolean;
|
||||
}
|
||||
|
||||
/** 绑定表单。 */
|
||||
/**
|
||||
* 绑定表单(JSON 字段以文本承载,提交时解析)。
|
||||
* client_instance_code 随所选接口定义联动带出并锁定(接口归属即客户端归属),仍随表单提交;
|
||||
* status 仅作徽章展示:新建固定 draft,发布/退役经列表生命周期按钮流转,均不随表单提交。
|
||||
*/
|
||||
export interface BindingFormState {
|
||||
id: number | null;
|
||||
capability: string;
|
||||
context_selector_json: string;
|
||||
context_source_code: string;
|
||||
param_mapping_json: string;
|
||||
client_instance_code: string;
|
||||
interface_definition_code: string;
|
||||
mapping_version: number;
|
||||
@@ -141,13 +243,14 @@ export interface BindingFormState {
|
||||
status: IntegrationConfigStatus;
|
||||
}
|
||||
|
||||
/** 凭据引用表单。 */
|
||||
/** 凭据引用表单(按凭据类型动态字段;fields 值留空 = 编辑时保持旧值)。 */
|
||||
export interface CredentialReferenceFormState {
|
||||
id: number | null;
|
||||
code: string;
|
||||
secret_ref: string;
|
||||
secret_provider: string;
|
||||
credential_type: string;
|
||||
fields: Record<string, string>;
|
||||
status: IntegrationCredentialStatus;
|
||||
}
|
||||
|
||||
@@ -188,7 +291,7 @@ export function clientInstanceRowToForm(row: IntegrationClientInstanceRow): Clie
|
||||
};
|
||||
}
|
||||
|
||||
/** 创建空的接口定义表单。 */
|
||||
/** 创建空的接口定义表单(新建固定落 draft,上线走列表「发布」按钮)。 */
|
||||
export function createEmptyInterfaceDefinitionForm(): InterfaceDefinitionFormState {
|
||||
return {
|
||||
id: null,
|
||||
@@ -203,11 +306,10 @@ export function createEmptyInterfaceDefinitionForm(): InterfaceDefinitionFormSta
|
||||
response_mapping_json: '',
|
||||
output_schema_json: '',
|
||||
status: 'draft',
|
||||
enabled: true,
|
||||
};
|
||||
}
|
||||
|
||||
/** 列表行回填为接口定义编辑表单。 */
|
||||
/** 列表行回填为接口定义编辑表单(connector_type/status 仅回显,不随保存提交)。 */
|
||||
export function interfaceDefinitionRowToForm(row: IntegrationInterfaceDefinitionRow): InterfaceDefinitionFormState {
|
||||
return {
|
||||
id: row.id,
|
||||
@@ -222,7 +324,6 @@ export function interfaceDefinitionRowToForm(row: IntegrationInterfaceDefinition
|
||||
response_mapping_json: toJsonText(row.response_mapping_json),
|
||||
output_schema_json: toJsonText(row.output_schema_json),
|
||||
status: row.status,
|
||||
enabled: Boolean(row.enabled),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -232,7 +333,7 @@ export function createEmptyBindingForm(): BindingFormState {
|
||||
id: null,
|
||||
capability: '',
|
||||
context_selector_json: '',
|
||||
context_source_code: '',
|
||||
param_mapping_json: '',
|
||||
client_instance_code: '',
|
||||
interface_definition_code: '',
|
||||
mapping_version: 1,
|
||||
@@ -244,13 +345,13 @@ export function createEmptyBindingForm(): BindingFormState {
|
||||
};
|
||||
}
|
||||
|
||||
/** 列表行回填为绑定编辑表单。 */
|
||||
/** 列表行回填为绑定编辑表单(status 仅回显,不随保存提交)。 */
|
||||
export function bindingRowToForm(row: IntegrationBindingRow): BindingFormState {
|
||||
return {
|
||||
id: row.id,
|
||||
capability: row.capability,
|
||||
context_selector_json: toJsonText(row.context_selector_json),
|
||||
context_source_code: row.context_source_code ?? '',
|
||||
param_mapping_json: toJsonText(row.param_mapping_json),
|
||||
client_instance_code: row.client_instance_code,
|
||||
interface_definition_code: row.interface_definition_code,
|
||||
mapping_version: Number(row.mapping_version || 1),
|
||||
@@ -262,19 +363,20 @@ export function bindingRowToForm(row: IntegrationBindingRow): BindingFormState {
|
||||
};
|
||||
}
|
||||
|
||||
/** 创建空的凭据引用表单。 */
|
||||
/** 创建空的凭据引用表单(管理端默认 db 模式 + password 类型:界面维护、加密落库、免重启)。 */
|
||||
export function createEmptyCredentialReferenceForm(): CredentialReferenceFormState {
|
||||
return {
|
||||
id: null,
|
||||
code: '',
|
||||
secret_ref: '',
|
||||
secret_provider: 'env',
|
||||
secret_provider: 'db',
|
||||
credential_type: 'password',
|
||||
fields: {},
|
||||
status: 'active',
|
||||
};
|
||||
}
|
||||
|
||||
/** 列表行回填为凭据引用编辑表单。 */
|
||||
/** 列表行回填为凭据引用编辑表单(密文字段不回填,留空 = 保持旧值)。 */
|
||||
export function credentialReferenceRowToForm(row: IntegrationCredentialReferenceRow): CredentialReferenceFormState {
|
||||
return {
|
||||
id: row.id,
|
||||
@@ -282,6 +384,7 @@ export function credentialReferenceRowToForm(row: IntegrationCredentialReference
|
||||
secret_ref: row.secret_ref,
|
||||
secret_provider: row.secret_provider,
|
||||
credential_type: row.credential_type,
|
||||
fields: { ...(row.secret_fields ?? {}) },
|
||||
status: row.status,
|
||||
};
|
||||
}
|
||||
@@ -124,7 +124,7 @@
|
||||
<label><span>{{ t('admin.shippingInventory.inventorySiteName') }}</span><input v-model="source.display_name" class="input-field" required></label>
|
||||
<label><span>{{ t('admin.shippingInventory.connectorType') }}</span><select v-model="source.connector_type" class="select-field"><option value="dbs">{{ t('admin.shippingInventory.platform.dbs') }}</option><option value="crane">{{ t('admin.shippingInventory.platform.crane') }}</option></select></label>
|
||||
<label><span>{{ t('admin.shippingInventory.connection') }}</span><select v-model.number="source.rpa_profile_id" class="select-field" required><option :value="0">{{ t('admin.shippingInventory.chooseConnection') }}</option><option v-for="item in compatibleProfiles" :key="String(item.id)" :value="Number(item.id)">{{ item.display_name || item.profile_code }}</option></select></label>
|
||||
<label><span>{{ t('admin.shippingInventory.parsingProfiles') }}</span><select v-model.number="source.parsing_profile_id" class="select-field" :disabled="source.enabled"><option :value="0">{{ t('admin.shippingInventory.notConfigured') }}</option><option v-for="item in parsingProfiles.filter((row) => row.status === 'published')" :key="String(item.id)" :value="Number(item.id)">{{ item.display_name || item.profile_code }} V{{ item.version }}</option></select></label>
|
||||
<label><span>{{ t('admin.shippingInventory.parsingProfiles') }}</span><select v-model.number="source.parsing_profile_id" class="select-field" :disabled="source.enabled"><option :value="0">{{ t('admin.shippingInventory.notConfigured') }}</option><option v-for="item in parsingProfiles.filter((row) => row.status === 'published' && row.purpose !== 'movement')" :key="String(item.id)" :value="Number(item.id)">{{ item.display_name || item.profile_code }} V{{ item.version }}</option></select></label>
|
||||
<label><span>{{ t('admin.shippingInventory.excelTemplates') }}</span><select v-model.number="source.excel_template_id" class="select-field"><option :value="0">{{ t('admin.shippingInventory.notConfigured') }}</option><option v-for="item in excelTemplates.filter((row) => row.status === 'published')" :key="String(item.id)" :value="Number(item.id)">{{ item.display_name || item.template_code }}</option></select></label>
|
||||
<label><span>{{ t('admin.shippingInventory.warehouseResolution') }}</span><select v-model="source.warehouse_resolution_mode" class="select-field"><option value="fixed">{{ t('admin.shippingInventory.fixedWarehouse') }}</option><option value="inventory_match">{{ t('admin.shippingInventory.inventoryMatch') }}</option></select></label>
|
||||
<label v-if="source.warehouse_resolution_mode === 'fixed'"><span>{{ t('admin.shippingInventory.warehouse') }}</span><input v-model="source.fixed_warehouse_id" class="input-field" required></label>
|
||||
@@ -178,6 +178,7 @@
|
||||
<button type="button" class="btn-secondary btn-sm full" @click="addReceiptParameter">{{ t('admin.shippingInventory.addParameter') }}</button>
|
||||
</template>
|
||||
<p v-else class="form-tip full">{{ t('admin.shippingInventory.receiptCraneFixedPath') }}</p>
|
||||
<label class="full"><span>{{ t('admin.shippingInventory.movementBindingLabel') }}</span><select v-model.number="receiptConfig.parsing_profile_id" class="select-field"><option :value="null">{{ t('admin.shippingInventory.movementBindingNone') }}</option><option v-for="item in parsingProfiles.filter((row) => row.status === 'published' && row.purpose === 'movement')" :key="`movement-bind-${item.id}`" :value="Number(item.id)">{{ item.display_name || item.profile_code }} V{{ item.version }}</option></select><small>{{ t('admin.shippingInventory.movementBindingHint') }}</small></label>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
@@ -185,21 +186,32 @@
|
||||
<template v-else-if="activeTab === 'parsing'">
|
||||
<template v-if="parsingReadOnly">
|
||||
<section class="parsing-summary full">
|
||||
<div><span>{{ t('admin.shippingInventory.parsingPurposeLabel') }}</span><strong>{{ t(`admin.shippingInventory.parsingPurpose.${parsing.purpose === 'movement' ? 'movement' : 'inventory'}`) }}</strong></div>
|
||||
<div><span>{{ t('admin.shippingInventory.fileFormat') }}</span><strong>{{ parsing.file_format.toUpperCase() }}</strong></div>
|
||||
<div><span>{{ t('admin.shippingInventory.sheetName') }}</span><strong>{{ parsing.sheet_name || t('admin.shippingInventory.csvFile') }}</strong></div>
|
||||
<div><span>{{ t('admin.shippingInventory.headerRowIndex') }}</span><strong>{{ t('admin.shippingInventory.headerRowOption', { row: parsing.header_row_index }) }}</strong></div>
|
||||
</section>
|
||||
<section class="readonly-mapping-section full">
|
||||
<div class="subsection">{{ t('admin.shippingInventory.fieldMappings') }}</div>
|
||||
<p class="section-hint">{{ t('admin.shippingInventory.readonlyFieldMappingsHint') }}</p>
|
||||
<div v-for="(item, index) in parsing.field_mappings" :key="`readonly-field-${index}`" class="parsing-mapping-card">
|
||||
<div class="mapping-title"><strong>{{ t('admin.shippingInventory.mappingItem', { number: index + 1 }) }}</strong></div>
|
||||
<div class="mapping-display"><span>{{ t('admin.shippingInventory.inventoryField') }}</span><b>{{ inventoryFieldName(item.inventory_field) }}</b><small>{{ inventoryFieldDescription(item.inventory_field) }}</small></div>
|
||||
<div class="mapping-arrow" aria-hidden="true">→</div>
|
||||
<div class="mapping-display"><span>{{ t('admin.shippingInventory.sourceHeader') }}</span><b>{{ item.source_header }}</b></div>
|
||||
</div>
|
||||
<div class="subsection">{{ t(`admin.shippingInventory.${parsingLabelNs}.fieldMappings`) }}</div>
|
||||
<p class="section-hint">{{ t(parsing.purpose === 'movement' ? 'admin.shippingInventory.movementMappingHint' : 'admin.shippingInventory.readonlyFieldMappingsHint') }}</p>
|
||||
<template v-if="parsing.purpose === 'movement'">
|
||||
<div v-for="(item, index) in parsing.movement_mappings" :key="`readonly-movement-${item.code}`" class="parsing-mapping-card">
|
||||
<div class="mapping-title"><strong>{{ t('admin.shippingInventory.mappingItem', { number: index + 1 }) }}</strong></div>
|
||||
<div class="mapping-display"><span>{{ t('admin.shippingInventory.movementStandardField') }}</span><b>{{ t(`admin.shippingInventory.movementFields.${item.code}`) }}</b><small><b v-if="item.required">{{ t('admin.shippingInventory.movementRequiredMark') }}</b><template v-if="item.required && item.is_identity"> · </template><b v-if="item.is_identity">{{ t('admin.shippingInventory.movementIdentityMark') }}</b></small></div>
|
||||
<div class="mapping-arrow" aria-hidden="true">→</div>
|
||||
<div class="mapping-display"><span>{{ t(`admin.shippingInventory.${parsingLabelNs}.sourceHeader`) }}</span><b>{{ item.alias || '-' }}</b></div>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div v-for="(item, index) in parsing.field_mappings" :key="`readonly-field-${index}`" class="parsing-mapping-card">
|
||||
<div class="mapping-title"><strong>{{ t('admin.shippingInventory.mappingItem', { number: index + 1 }) }}</strong></div>
|
||||
<div class="mapping-display"><span>{{ t('admin.shippingInventory.inventoryField') }}</span><b>{{ inventoryFieldName(item.inventory_field) }}</b><small>{{ inventoryFieldDescription(item.inventory_field) }}</small></div>
|
||||
<div class="mapping-arrow" aria-hidden="true">→</div>
|
||||
<div class="mapping-display"><span>{{ t('admin.shippingInventory.sourceHeader') }}</span><b>{{ item.source_header }}</b></div>
|
||||
</div>
|
||||
</template>
|
||||
</section>
|
||||
<section class="readonly-mapping-section full">
|
||||
<section v-if="parsing.purpose !== 'movement'" class="readonly-mapping-section full">
|
||||
<div class="subsection">{{ t('admin.shippingInventory.matchKeys') }}</div>
|
||||
<p class="section-hint">{{ t('admin.shippingInventory.readonlyMatchKeysHint') }}</p>
|
||||
<div v-for="(item, index) in parsing.match_keys" :key="`readonly-match-${index}`" class="parsing-mapping-card match-key-card">
|
||||
@@ -213,12 +225,13 @@
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<label><span>{{ t('admin.shippingInventory.parsingProfileCode') }}</span><input v-model="parsing.profile_code" class="input-field" :disabled="Boolean(selectedId)" required></label>
|
||||
<label><span>{{ t('admin.shippingInventory.parsingProfileName') }}</span><input v-model="parsing.display_name" class="input-field" required></label>
|
||||
<label><span>{{ t(`admin.shippingInventory.${parsingLabelNs}.code`) }}</span><input v-model="parsing.profile_code" class="input-field" :disabled="Boolean(selectedId)" required></label>
|
||||
<label><span>{{ t(`admin.shippingInventory.${parsingLabelNs}.name`) }}</span><input v-model="parsing.display_name" class="input-field" required></label>
|
||||
<label><span>{{ t('admin.shippingInventory.parsingPurposeLabel') }}</span><select v-model="parsing.purpose" class="select-field" :disabled="Boolean(selectedId)" @change="resetMappingRowsForPurpose"><option value="inventory">{{ t('admin.shippingInventory.parsingPurpose.inventory') }}</option><option value="movement">{{ t('admin.shippingInventory.parsingPurpose.movement') }}</option></select><small>{{ t('admin.shippingInventory.parsingPurposeHint') }}</small></label>
|
||||
<label><span>{{ t('admin.shippingInventory.fileFormat') }}</span><select v-model="parsing.file_format" class="select-field"><option value="xls">xls</option><option value="xlsx">xlsx</option><option value="csv">csv</option></select></label>
|
||||
<label v-if="!selectedId" class="full"><span>{{ t('admin.shippingInventory.temporaryInventorySession') }}</span><select v-model="selectedTemporaryInventorySession" class="select-field" @change="loadTemporaryInventorySession"><option value="">{{ t('admin.shippingInventory.temporaryInventorySessionNone') }}</option><option v-for="item in temporaryInventorySessions" :key="item.session_no" :value="item.session_no">{{ item.source_file_name }} · {{ item.session_no }}</option></select><small>{{ t('admin.shippingInventory.temporaryInventorySessionHint') }}</small></label>
|
||||
<label v-if="!selectedId && parsing.purpose !== 'movement'" class="full"><span>{{ t('admin.shippingInventory.temporaryInventorySession') }}</span><select v-model="selectedTemporaryInventorySession" class="select-field" @change="loadTemporaryInventorySession"><option value="">{{ t('admin.shippingInventory.temporaryInventorySessionNone') }}</option><option v-for="item in temporaryInventorySessions" :key="item.session_no" :value="item.session_no">{{ item.source_file_name }} · {{ item.session_no }}</option></select><small>{{ t('admin.shippingInventory.temporaryInventorySessionHint') }}</small></label>
|
||||
<div v-if="temporaryInventorySessionSelected" class="form-tip full">{{ t('admin.shippingInventory.temporaryInventorySessionSelected', { mapping: temporaryInventorySessionSelected.confirmed_usage?.mapping_origin || '-' }) }}</div>
|
||||
<label v-if="!selectedId" class="full"><span>{{ t('admin.shippingInventory.inventorySampleFile') }}</span><input type="file" accept=".xls,.xlsx,.csv" :disabled="analysisLoading || Boolean(temporaryInventorySessionSelected)" @change="analyseInventorySample"><small>{{ t('admin.shippingInventory.inventorySampleFileHint') }}</small></label>
|
||||
<label v-if="!selectedId" class="full"><span>{{ t(`admin.shippingInventory.${parsingLabelNs}.sampleFile`) }}</span><input type="file" accept=".xls,.xlsx,.csv" :disabled="analysisLoading || Boolean(temporaryInventorySessionSelected)" @change="analyseInventorySample"><small>{{ t(`admin.shippingInventory.${parsingLabelNs}.sampleFileHint`) }}</small></label>
|
||||
<section v-else-if="structureAnalysis" class="sample-evidence-card full">
|
||||
<div>
|
||||
<strong>{{ pendingSampleReplacement ? t('admin.shippingInventory.pendingInventorySampleReplacement') : t('admin.shippingInventory.savedInventorySample') }}</strong>
|
||||
@@ -236,28 +249,37 @@
|
||||
<template v-if="structureAnalysis">
|
||||
<label><span>{{ t('admin.shippingInventory.sheetName') }}</span><select v-model="parsing.sheet_name" class="select-field" @change="applyAnalysisCandidate"><option v-for="candidate in analysisCandidates" :key="candidateKey(candidate)" :value="candidate.sheet_name || ''">{{ candidate.sheet_name || t('admin.shippingInventory.csvFile') }}</option></select></label>
|
||||
<label><span>{{ t('admin.shippingInventory.headerRowIndex') }}</span><select v-model.number="parsing.header_row_index" class="select-field" @change="applyAnalysisCandidate"><option v-for="candidate in analysisCandidatesForSheet" :key="candidateKey(candidate)" :value="candidate.header_row_index">{{ t('admin.shippingInventory.headerRowOption', { row: candidate.header_row_index }) }}</option></select></label>
|
||||
<section class="analysis-preview full"><strong>{{ t('admin.shippingInventory.inventoryAnalysisPreview') }}</strong><p>{{ t('admin.shippingInventory.inventoryAnalysisSummary', structureAnalysis.validation_summary) }}</p><div class="analysis-columns"><span v-for="column in selectedAnalysisColumns" :key="`${column.index}-${column.header}`"><b>{{ column.header || t('admin.shippingInventory.emptyHeader') }}</b><small>{{ column.inferred_type }} · {{ column.sample_values?.join(' / ') || '-' }}</small></span></div></section>
|
||||
<section v-if="structureAnalysis.match_result?.candidates?.length" class="analysis-preview full"><strong>{{ t('admin.shippingInventory.parsingPlanRecommendation') }}</strong><div class="recommendation-list"><article v-for="candidate in structureAnalysis.match_result.candidates" :key="candidate.profile_id"><b>{{ candidate.display_name }} V{{ candidate.version }}</b><small>{{ t(`admin.shippingInventory.recommendationLevel.${candidate.level}`) }} · {{ t('admin.shippingInventory.usedBySites', { count: candidate.source_count }) }}</small><p v-if="candidate.difference?.added_columns?.length">{{ t('admin.shippingInventory.addedColumns', { columns: candidate.difference.added_columns.join('、') }) }}</p><p v-if="candidate.difference?.column_order_changed?.length">{{ t('admin.shippingInventory.columnOrderChanged') }}</p><button type="button" class="btn-secondary btn-sm" @click="adoptRecommendedProfile(candidate.profile_id)">{{ t('admin.shippingInventory.adoptParsingPlan') }}</button></article></div></section>
|
||||
<section class="analysis-preview full"><strong>{{ t(`admin.shippingInventory.${parsingLabelNs}.analysisPreview`) }}</strong><p>{{ t('admin.shippingInventory.inventoryAnalysisSummary', structureAnalysis.validation_summary) }}</p><div class="analysis-columns"><span v-for="column in selectedAnalysisColumns" :key="`${column.index}-${column.header}`"><b>{{ column.header || t('admin.shippingInventory.emptyHeader') }}</b><small>{{ column.inferred_type }} · {{ column.sample_values?.join(' / ') || '-' }}</small></span></div></section>
|
||||
<section v-if="parsing.purpose !== 'movement' && structureAnalysis.match_result?.candidates?.length" class="analysis-preview full"><strong>{{ t('admin.shippingInventory.parsingPlanRecommendation') }}</strong><div class="recommendation-list"><article v-for="candidate in structureAnalysis.match_result.candidates" :key="candidate.profile_id"><b>{{ candidate.display_name }} V{{ candidate.version }}</b><small>{{ t(`admin.shippingInventory.recommendationLevel.${candidate.level}`) }} · {{ t('admin.shippingInventory.usedBySites', { count: candidate.source_count }) }}</small><p v-if="candidate.difference?.added_columns?.length">{{ t('admin.shippingInventory.addedColumns', { columns: candidate.difference.added_columns.join('、') }) }}</p><p v-if="candidate.difference?.column_order_changed?.length">{{ t('admin.shippingInventory.columnOrderChanged') }}</p><button type="button" class="btn-secondary btn-sm" @click="adoptRecommendedProfile(candidate.profile_id)">{{ t('admin.shippingInventory.adoptParsingPlan') }}</button></article></div></section>
|
||||
</template>
|
||||
<div v-else class="form-tip full">{{ t(`admin.shippingInventory.${parsingLabelNs}.sampleRequired`) }}</div>
|
||||
<template v-if="parsing.purpose === 'movement'">
|
||||
<div class="subsection full">{{ t(`admin.shippingInventory.${parsingLabelNs}.fieldMappings`) }}<small>{{ t('admin.shippingInventory.movementMappingHint') }}</small></div>
|
||||
<div v-for="item in parsing.movement_mappings" :key="`movement-${item.code}`" class="parsing-mapping-card full">
|
||||
<div class="mapping-title"><strong>{{ t(`admin.shippingInventory.movementFields.${item.code}`) }}</strong><small><b v-if="item.required">{{ t('admin.shippingInventory.movementRequiredMark') }}</b><template v-if="item.required && item.is_identity"> · </template><b v-if="item.is_identity">{{ t('admin.shippingInventory.movementIdentityMark') }}</b></small></div>
|
||||
<label class="full"><span>{{ t(`admin.shippingInventory.${parsingLabelNs}.sourceHeader`) }}</span><select v-model="item.alias" class="select-field" :disabled="!structureAnalysis" :required="item.required"><option value="">{{ t('admin.shippingInventory.chooseSourceHeader') }}</option><option v-for="header in selectedAnalysisHeaders" :key="header" :value="header">{{ header }}</option></select></label>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else>
|
||||
<div class="subsection full">{{ t('admin.shippingInventory.fieldMappings') }}</div>
|
||||
<div v-for="(item, index) in parsing.field_mappings" :key="`field-${index}`" class="parsing-mapping-card full">
|
||||
<div class="mapping-title"><strong>{{ t('admin.shippingInventory.mappingItem', { number: index + 1 }) }}</strong><button type="button" class="btn-danger btn-sm" @click="parsing.field_mappings.splice(index, 1)">{{ t('admin.delete') }}</button></div>
|
||||
<label><span>{{ t('admin.shippingInventory.inventoryField') }}</span><select v-model="item.inventory_field" class="select-field" required><option value="">{{ t('admin.shippingInventory.chooseInventoryField') }}</option><option v-for="field in activeInventoryFields" :key="field.id" :value="String(field.id)">{{ inventoryFieldOptionLabel(field) }}</option></select></label>
|
||||
<label><span>{{ t('admin.shippingInventory.sourceHeader') }}</span><select v-model="item.source_header" class="select-field" :disabled="!structureAnalysis" required><option value="">{{ t('admin.shippingInventory.chooseSourceHeader') }}</option><option v-for="header in selectedAnalysisHeaders" :key="header" :value="header">{{ header }}</option></select></label>
|
||||
<small v-if="item.inventory_field" class="mapping-help">{{ inventoryFieldDescription(item.inventory_field) }}</small>
|
||||
</div>
|
||||
<button type="button" class="btn-secondary btn-sm full" :disabled="!structureAnalysis" @click="addParsingFieldMapping">{{ t('admin.shippingInventory.addFieldMapping') }}</button>
|
||||
<div class="subsection full">{{ t('admin.shippingInventory.matchKeys') }}<small>{{ t('admin.shippingInventory.matchKeysHint') }}</small></div>
|
||||
<div v-for="(item, index) in parsing.match_keys" :key="`match-${index}`" class="parsing-mapping-card match-key-card full">
|
||||
<div class="mapping-title"><strong>{{ t('admin.shippingInventory.mappingItem', { number: index + 1 }) }}</strong><button type="button" class="btn-danger btn-sm" @click="parsing.match_keys.splice(index, 1)">{{ t('admin.delete') }}</button></div>
|
||||
<label><span>{{ t('admin.shippingInventory.orderField') }}</span><select v-model="item.order_field_id" class="select-field" required><option value="">{{ t('admin.shippingInventory.chooseOrderField') }}</option><option v-for="field in matchingOrderFields" :key="field.field_id" :value="field.field_id">{{ orderFieldOptionLabel(field) }}</option></select></label>
|
||||
<label><span>{{ t('admin.shippingInventory.inventoryField') }}</span><select v-model="item.inventory_field" class="select-field" required><option value="">{{ t('admin.shippingInventory.chooseInventoryField') }}</option><option v-for="field in mappedMatchingInventoryFields" :key="field.id" :value="String(field.id)">{{ inventoryFieldOptionLabel(field) }}</option></select></label>
|
||||
<small v-if="item.inventory_field" class="mapping-help">{{ inventoryFieldDescription(item.inventory_field) }}</small>
|
||||
</div>
|
||||
<button type="button" class="btn-secondary btn-sm full" :disabled="!canAddParsingMatchKey" @click="addParsingMatchKey">{{ t('admin.shippingInventory.addMatchKey') }}</button>
|
||||
<p v-if="!unusedMatchingInventoryFields.length || !unusedOrderMatchFields.length" class="match-key-tip full">{{ t('admin.shippingInventory.matchKeysComplete') }}</p>
|
||||
<p v-else-if="!structureAnalysis" class="match-key-tip full">{{ t('admin.shippingInventory.matchKeysAnalysisRequired') }}</p>
|
||||
</template>
|
||||
<div v-else class="form-tip full">{{ t('admin.shippingInventory.inventorySampleRequired') }}</div>
|
||||
<div class="subsection full">{{ t('admin.shippingInventory.fieldMappings') }}</div>
|
||||
<div v-for="(item, index) in parsing.field_mappings" :key="`field-${index}`" class="parsing-mapping-card full">
|
||||
<div class="mapping-title"><strong>{{ t('admin.shippingInventory.mappingItem', { number: index + 1 }) }}</strong><button type="button" class="btn-danger btn-sm" @click="parsing.field_mappings.splice(index, 1)">{{ t('admin.delete') }}</button></div>
|
||||
<label><span>{{ t('admin.shippingInventory.inventoryField') }}</span><select v-model="item.inventory_field" class="select-field" required><option value="">{{ t('admin.shippingInventory.chooseInventoryField') }}</option><option v-for="field in activeInventoryFields" :key="field.id" :value="String(field.id)">{{ inventoryFieldOptionLabel(field) }}</option></select></label>
|
||||
<label><span>{{ t('admin.shippingInventory.sourceHeader') }}</span><select v-model="item.source_header" class="select-field" :disabled="!structureAnalysis" required><option value="">{{ t('admin.shippingInventory.chooseSourceHeader') }}</option><option v-for="header in selectedAnalysisHeaders" :key="header" :value="header">{{ header }}</option></select></label>
|
||||
<small v-if="item.inventory_field" class="mapping-help">{{ inventoryFieldDescription(item.inventory_field) }}</small>
|
||||
</div>
|
||||
<button type="button" class="btn-secondary btn-sm full" :disabled="!structureAnalysis" @click="addParsingFieldMapping">{{ t('admin.shippingInventory.addFieldMapping') }}</button>
|
||||
<div class="subsection full">{{ t('admin.shippingInventory.matchKeys') }}<small>{{ t('admin.shippingInventory.matchKeysHint') }}</small></div>
|
||||
<div v-for="(item, index) in parsing.match_keys" :key="`match-${index}`" class="parsing-mapping-card match-key-card full">
|
||||
<div class="mapping-title"><strong>{{ t('admin.shippingInventory.mappingItem', { number: index + 1 }) }}</strong><button type="button" class="btn-danger btn-sm" @click="parsing.match_keys.splice(index, 1)">{{ t('admin.delete') }}</button></div>
|
||||
<label><span>{{ t('admin.shippingInventory.orderField') }}</span><select v-model="item.order_field_id" class="select-field" required><option value="">{{ t('admin.shippingInventory.chooseOrderField') }}</option><option v-for="field in matchingOrderFields" :key="field.field_id" :value="field.field_id">{{ orderFieldOptionLabel(field) }}</option></select></label>
|
||||
<label><span>{{ t('admin.shippingInventory.inventoryField') }}</span><select v-model="item.inventory_field" class="select-field" required><option value="">{{ t('admin.shippingInventory.chooseInventoryField') }}</option><option v-for="field in mappedMatchingInventoryFields" :key="field.id" :value="String(field.id)">{{ inventoryFieldOptionLabel(field) }}</option></select></label>
|
||||
<small v-if="item.inventory_field" class="mapping-help">{{ inventoryFieldDescription(item.inventory_field) }}</small>
|
||||
</div>
|
||||
<button type="button" class="btn-secondary btn-sm full" :disabled="!canAddParsingMatchKey" @click="addParsingMatchKey">{{ t('admin.shippingInventory.addMatchKey') }}</button>
|
||||
<p v-if="!unusedMatchingInventoryFields.length || !unusedOrderMatchFields.length" class="match-key-tip full">{{ t('admin.shippingInventory.matchKeysComplete') }}</p>
|
||||
<p v-else-if="!structureAnalysis" class="match-key-tip full">{{ t('admin.shippingInventory.matchKeysAnalysisRequired') }}</p>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
@@ -324,16 +346,17 @@
|
||||
|
||||
<template v-else-if="activeTab === 'mappings'">
|
||||
<label><span>{{ t('admin.shippingInventory.source') }}</span><select v-model.number="mapping.inventory_source_id" class="select-field" required><option :value="0">{{ t('admin.shippingInventory.chooseSource') }}</option><option v-for="item in sources" :key="String(item.id)" :value="Number(item.id)">{{ item.display_name || item.source_code }}</option></select></label>
|
||||
<label><span>{{ t('admin.shippingInventory.freightWarehouse') }}</span><input v-model="mapping.freight_warehouse_id" class="input-field" :placeholder="t('admin.shippingInventory.defaultMapping')"></label>
|
||||
<label><span>{{ t('admin.shippingInventory.freightWarehouse') }}</span><input v-model="mapping.freight_warehouse_id" class="input-field"></label>
|
||||
<label><span>{{ t('admin.shippingInventory.externalSystem') }}</span><input v-model="mapping.external_system_code" class="input-field" required></label>
|
||||
<label><span>{{ t('admin.shippingInventory.externalOrganization') }}</span><input v-model="mapping.external_organization_code" class="input-field"></label>
|
||||
<label><span>{{ t('admin.shippingInventory.externalSite') }}</span><input v-model="mapping.external_site_code" class="input-field"></label>
|
||||
<label><span>{{ t('admin.shippingInventory.inTransitWarehouseCode') }}</span><input v-model="mapping.in_transit_warehouse_code" class="input-field" required></label>
|
||||
<label><span>{{ t('admin.shippingInventory.externalWarehouseCode') }}</span><input v-model="mapping.external_warehouse_code" class="input-field" required></label>
|
||||
<label><span>{{ t('admin.shippingInventory.externalWarehouseName') }}</span><input v-model="mapping.external_warehouse_name" class="input-field" required></label>
|
||||
<div class="switch-field"><span>{{ t('admin.shippingInventory.enabled') }}</span><button type="button" class="status-switch" :class="{ on: mapping.enabled }" role="switch" :aria-checked="mapping.enabled" @click="mapping.enabled = !mapping.enabled"><i></i><b>{{ mapping.enabled ? t('admin.shippingInventory.enabledState') : t('admin.shippingInventory.disabledState') }}</b></button></div>
|
||||
</template>
|
||||
|
||||
<section v-if="selectedId" class="readiness-card full" :class="{ ready: source.enabled }">
|
||||
<section v-if="activeTab === 'sources' && selectedId" class="readiness-card full" :class="{ ready: source.enabled }">
|
||||
<div class="readiness-inline">
|
||||
<template v-if="source.enabled">
|
||||
<span class="readiness-marker is-passed" aria-hidden="true">✓</span>
|
||||
@@ -423,7 +446,7 @@
|
||||
<header class="clone-template-header"><div><h3 id="bulk-parsing-binding-title">{{ t('admin.shippingInventory.bulkBindParsingProfile') }}</h3><p>{{ t('admin.shippingInventory.bulkBindParsingProfileHint') }}</p></div><button type="button" class="drawer-close" :aria-label="t('admin.close')" @click="closeBulkParsingBinding">×</button></header>
|
||||
<form class="clone-template-form" @submit.prevent="submitBulkParsingBinding">
|
||||
<label><span>{{ t('admin.shippingInventory.inventorySites') }}</span><select v-model="bulkBinding.sourceIds" class="select-field" multiple required><option v-for="item in sources.filter((row) => !row.enabled)" :key="String(item.id)" :value="Number(item.id)">{{ item.display_name || item.source_code }}</option></select></label>
|
||||
<label><span>{{ t('admin.shippingInventory.parsingProfiles') }}</span><select v-model.number="bulkBinding.profileId" class="select-field" required><option :value="0">{{ t('admin.shippingInventory.notConfigured') }}</option><option v-for="item in parsingProfiles.filter((row) => row.status === 'published')" :key="String(item.id)" :value="Number(item.id)">{{ item.display_name || item.profile_code }} V{{ item.version }}</option></select></label>
|
||||
<label><span>{{ t('admin.shippingInventory.parsingProfiles') }}</span><select v-model.number="bulkBinding.profileId" class="select-field" required><option :value="0">{{ t('admin.shippingInventory.notConfigured') }}</option><option v-for="item in parsingProfiles.filter((row) => row.status === 'published' && row.purpose !== 'movement')" :key="String(item.id)" :value="Number(item.id)">{{ item.display_name || item.profile_code }} V{{ item.version }}</option></select></label>
|
||||
<div class="clone-template-actions"><button type="button" class="btn-ghost btn-sm" :disabled="bulkBinding.saving" @click="closeBulkParsingBinding">{{ t('admin.cancel') }}</button><button type="submit" class="btn-primary" :disabled="bulkBinding.saving">{{ bulkBinding.saving ? t('admin.shippingInventory.saving') : t('admin.shippingInventory.bulkBindParsingProfile') }}</button></div>
|
||||
</form>
|
||||
</section>
|
||||
@@ -479,6 +502,7 @@ import {
|
||||
getShippingExcelTemplateLayout,
|
||||
createShippingInventoryStructureAnalysis,
|
||||
createShippingInventoryParsingDraftFromAnalysis,
|
||||
fetchMovementFields,
|
||||
previewShippingInventorySampleReplacement,
|
||||
createShippingParsingDraftFromTemporarySession,
|
||||
adoptShippingInventoryParsingProfile,
|
||||
@@ -512,6 +536,7 @@ import type { ShippingInventoryConfigurationTest, ShippingInventoryReadinessChec
|
||||
import { isConfigurationTestRunning, needsReadinessAction, readinessMarkerKind } from './shippingInventoryReadiness';
|
||||
import { normaliseInventoryReportPath } from './shippingInventorySourceForm';
|
||||
import { buildReceiptReportConfigPayload } from './receiptReportConfigForm';
|
||||
import { buildMovementFieldMapping } from './movementParsingProfileForm';
|
||||
|
||||
type TabKey = 'profiles' | 'parsing' | 'inventoryFields' | 'templates' | 'sources' | 'rules' | 'snapshots' | 'exports' | 'mappings';
|
||||
type Item = Record<string, any>;
|
||||
@@ -617,7 +642,13 @@ const successTextsInput = computed<string>({
|
||||
get: () => (profile.upload_config_json.success_texts || []).join('\n'),
|
||||
set: (value) => { profile.upload_config_json.success_texts = String(value || '').split(/\r?\n/).map((item) => item.trim()).filter(Boolean); },
|
||||
});
|
||||
const parsing = reactive({ profile_code: '', display_name: '', file_format: 'xlsx', sheet_name: '', header_row_index: 1, field_mappings: [] as ParsingFieldMapping[], match_keys: [] as ParsingMatchKey[] });
|
||||
const parsing = reactive({
|
||||
profile_code: '', display_name: '', file_format: 'xlsx', sheet_name: '', header_row_index: 1,
|
||||
purpose: 'inventory' as 'inventory' | 'movement',
|
||||
field_mappings: [] as ParsingFieldMapping[], match_keys: [] as ParsingMatchKey[],
|
||||
movement_mappings: [] as Array<{ code: string; alias: string; required: boolean; is_identity: boolean }>,
|
||||
});
|
||||
const movementFields = ref<Array<{ code: string; value_type: string; required: boolean; is_identity: boolean }>>([]);
|
||||
const inventoryField = reactive<InventoryFieldForm>({ display_name: '', description: '', value_type: 'text', usage_type: 'general', sort_order: 100, status: 'active' });
|
||||
const excelTemplate = reactive({ template_code: '', display_name: '', filename_pattern: '{business_no}.xlsx', mappings: [] as TemplateMapping[], file: null as File | null });
|
||||
const templateClone = reactive({ visible: false, template_code: '', display_name: '', saving: false });
|
||||
@@ -625,7 +656,7 @@ const bulkBinding = reactive({ visible: false, sourceIds: [] as number[], profil
|
||||
const batchValidation = reactive({ visible: false, sourceIds: [] as number[], query: '', statusFilter: 'all' as 'all' | 'processing' | 'completed' | 'completed_empty' | 'failed', saving: false, result: null as ShippingInventoryValidationBatch | null });
|
||||
let batchValidationTimer: number | null = null;
|
||||
const source = reactive({ source_code: '', display_name: '', connector_type: 'dbs', rpa_profile_id: 0, parsing_profile_id: 0, excel_template_id: 0, warehouse_resolution_mode: 'fixed', fixed_warehouse_id: '', snapshot_ttl_seconds: 86400, report_path_json: { program_group: '', program_label: '', report_group: 'Inventory', report_name: '' }, query_parameters_json: [] as Parameter[], enabled: false, activation: { ready: false, checks: [] as ShippingInventoryReadinessCheck[], missing_requirements: [] as string[] } as SourceActivation });
|
||||
const receiptConfig = reactive({ report_path_json: { program_group: '', program_label: '', report_group: 'Inbound', report_name: '' } as Record<string, string>, query_parameters_json: [] as Parameter[] });
|
||||
const receiptConfig = reactive({ report_path_json: { program_group: '', program_label: '', report_group: 'Inbound', report_name: '' } as Record<string, string>, query_parameters_json: [] as Parameter[], parsing_profile_id: null as number | null });
|
||||
const receiptConfigExists = ref(false);
|
||||
const receiptSectionTouched = ref(false);
|
||||
const receiptSectionOpen = ref(false);
|
||||
@@ -633,7 +664,7 @@ const inventoryPathOpen = ref(true);
|
||||
const receiptBaseline = ref('');
|
||||
const sourceBaseline = ref('');
|
||||
const rule = reactive({ rule_code: '', rule_name: '', scope: 'line', priority: 100, conditions: [{ source_kind: 'order_field', order_field_id: '', operator: 'prefix', expected: '' }] as RuleCondition[], source_codes: [] as string[] });
|
||||
const mapping = reactive({ inventory_source_id: 0, freight_warehouse_id: '', external_system_code: 'TOPGP', external_organization_code: '', external_site_code: '', external_warehouse_code: '', external_warehouse_name: '', enabled: true });
|
||||
const mapping = reactive({ inventory_source_id: 0, freight_warehouse_id: '', external_system_code: 'TOPGP', external_organization_code: '', external_site_code: '', in_transit_warehouse_code: '', external_warehouse_code: '', external_warehouse_name: '', enabled: true });
|
||||
const compatibleRoutingFields = computed(() => routingFields.value.filter((item) => item.scope === (rule.scope === 'task' ? 'header' : 'line')));
|
||||
const activeInventoryFields = computed(() => inventoryFields.value.filter((item) => item.status === 'active'));
|
||||
const matchingInventoryFields = computed(() => activeInventoryFields.value.filter((item) => item.usage_type === 'match_identity'));
|
||||
@@ -716,10 +747,14 @@ const currentItems = computed<Item[]>(() => {
|
||||
});
|
||||
const compatibleProfiles = computed(() => profiles.value.filter((item) => item.connector_type === source.connector_type));
|
||||
const selectedRuleStatus = computed(() => rules.value.find((item) => Number(item.id) === selectedId.value)?.status || 'draft');
|
||||
const ruleReadOnly = computed(() => ['published', 'retired'].includes(selectedRuleStatus.value));
|
||||
// 只读判定必须限定在规则页签:selectedId 是各页签共享的,站点 id 可能与规则 id 相同,
|
||||
// 不加页签限定时已发布规则会让站点页签的保存按钮被误禁用(点击无任何请求)。
|
||||
const ruleReadOnly = computed(() => activeTab.value === 'rules' && ['published', 'retired'].includes(selectedRuleStatus.value));
|
||||
const selectedTemplateStatus = computed(() => excelTemplates.value.find((item) => Number(item.id) === selectedId.value)?.status || 'draft');
|
||||
const selectedParsingStatus = computed(() => parsingProfiles.value.find((item) => Number(item.id) === selectedId.value)?.status || 'draft');
|
||||
const parsingReadOnly = computed(() => activeTab.value === 'parsing' && ['published', 'retired'].includes(selectedParsingStatus.value));
|
||||
/** 按规则用途切换弹窗标签命名空间:收料异动模式下不再出现"库存"措辞。 */
|
||||
const parsingLabelNs = computed(() => parsing.purpose === 'movement' ? 'movementParsing' : 'inventoryParsing');
|
||||
const inventoryFieldReadOnly = computed(() => activeTab.value === 'inventoryFields' && inventoryField.status !== 'active');
|
||||
const analysisCandidates = computed<Item[]>(() => structureAnalysis.value?.structure?.candidates || []);
|
||||
const analysisCandidatesForSheet = computed<Item[]>(() => analysisCandidates.value.filter((item) => String(item.sheet_name || '') === parsing.sheet_name));
|
||||
@@ -817,12 +852,13 @@ const filteredBatchValidationRuns = computed(() => {
|
||||
/** 加载服务端配置与运行审计投影,页面不保留第二份真相。 */
|
||||
async function load(): Promise<void> {
|
||||
try {
|
||||
const [[profileRows, sourceRows, ruleRows, mappingRows, snapshotRows, exportRows, parsingRows, templateRows], inventoryFieldRows, fieldCatalog, configurationCatalog, temporarySessions] = await Promise.all([
|
||||
getShippingInventoryConfig(), getShippingInventoryFields(), getShippingInventoryRoutingFields(), getShippingInventoryConfigurationCatalog(), listShippingTemporaryInventorySessions(),
|
||||
const [[profileRows, sourceRows, ruleRows, mappingRows, snapshotRows, exportRows, parsingRows, templateRows], inventoryFieldRows, fieldCatalog, configurationCatalog, temporarySessions, movementFieldRows] = await Promise.all([
|
||||
getShippingInventoryConfig(), getShippingInventoryFields(), getShippingInventoryRoutingFields(), getShippingInventoryConfigurationCatalog(), listShippingTemporaryInventorySessions(), fetchMovementFields(),
|
||||
]);
|
||||
profiles.value = profileRows as Item[]; sources.value = sourceRows as Item[]; rules.value = ruleRows as Item[];
|
||||
mappings.value = mappingRows as Item[]; snapshots.value = snapshotRows as Item[]; exports.value = exportRows as Item[];
|
||||
parsingProfiles.value = parsingRows as Item[];
|
||||
movementFields.value = movementFieldRows;
|
||||
inventoryFields.value = inventoryFieldRows as Item[];
|
||||
excelTemplates.value = templateRows as Item[];
|
||||
temporaryInventorySessions.value = temporarySessions as Item[];
|
||||
@@ -845,6 +881,7 @@ function resetReceiptConfig(connectorType: unknown): void {
|
||||
? { report_name: 'Inbound Details' }
|
||||
: { program_group: '', program_label: '', report_group: 'Inbound', report_name: '' },
|
||||
query_parameters_json: [],
|
||||
parsing_profile_id: null,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -864,6 +901,7 @@ async function loadReceiptConfig(sourceId: number, connectorType: unknown): Prom
|
||||
? { report_name: 'Inbound Details' }
|
||||
: { program_group: '', program_label: '', report_group: 'Inbound', report_name: '', ...((config.report_path_json || {}) as Record<string, string>) },
|
||||
query_parameters_json: Array.isArray(config.query_parameters_json) ? config.query_parameters_json.map((parameter) => ({ ...parameter })) : [],
|
||||
parsing_profile_id: config.parsing_profile_id ? Number(config.parsing_profile_id) : null,
|
||||
});
|
||||
receiptConfigExists.value = true;
|
||||
receiptSectionOpen.value = true;
|
||||
@@ -924,7 +962,7 @@ function selectInventoryMappingTab(tab: 'parsing' | 'inventoryFields'): void {
|
||||
function createNew(): void {
|
||||
selectedId.value = null;
|
||||
if (activeTab.value === 'profiles') Object.assign(profile, { profile_code: '', display_name: '', connector_type: 'dbs', login_url: '', username: '', password: '', login_config_json: { auth_mode: 'password' }, enabled: true, upload_config_json: defaultUploadConfig('dbs') });
|
||||
if (activeTab.value === 'parsing') { Object.assign(parsing, { profile_code: '', display_name: '', file_format: 'xlsx', sheet_name: '', header_row_index: 1, field_mappings: [], match_keys: [] }); structureAnalysis.value = null; pendingSampleReplacement.value = null; sampleReplacementConfirmed.value = false; selectedTemporaryInventorySession.value = ''; }
|
||||
if (activeTab.value === 'parsing') { Object.assign(parsing, { profile_code: '', display_name: '', file_format: 'xlsx', sheet_name: '', header_row_index: 1, purpose: 'inventory', field_mappings: [], match_keys: [], movement_mappings: [] }); structureAnalysis.value = null; pendingSampleReplacement.value = null; sampleReplacementConfirmed.value = false; selectedTemporaryInventorySession.value = ''; }
|
||||
if (activeTab.value === 'inventoryFields') Object.assign(inventoryField, { display_name: '', description: '', value_type: 'text', usage_type: 'general', sort_order: 100, status: 'active' });
|
||||
if (activeTab.value === 'templates') {
|
||||
Object.assign(excelTemplate, { template_code: '', display_name: '', filename_pattern: '{business_no}.xlsx', mappings: [], file: null });
|
||||
@@ -942,7 +980,7 @@ function createNew(): void {
|
||||
sourceBaseline.value = '';
|
||||
}
|
||||
if (activeTab.value === 'rules') Object.assign(rule, { rule_code: '', rule_name: '', scope: 'line', priority: 100, conditions: [{ source_kind: 'order_field', order_field_id: '', operator: 'prefix', expected: '' }], source_codes: [] });
|
||||
if (activeTab.value === 'mappings') Object.assign(mapping, { inventory_source_id: 0, freight_warehouse_id: '', external_system_code: 'TOPGP', external_organization_code: '', external_site_code: '', external_warehouse_code: '', external_warehouse_name: '', enabled: true });
|
||||
if (activeTab.value === 'mappings') Object.assign(mapping, { inventory_source_id: 0, freight_warehouse_id: '', external_system_code: 'TOPGP', external_organization_code: '', external_site_code: '', in_transit_warehouse_code: '', external_warehouse_code: '', external_warehouse_name: '', enabled: true });
|
||||
drawerOpen.value = true;
|
||||
}
|
||||
|
||||
@@ -953,8 +991,10 @@ function selectItem(item: Item): void {
|
||||
if (activeTab.value === 'parsing') Object.assign(parsing, {
|
||||
profile_code: item.profile_code, display_name: item.display_name, file_format: item.file_format,
|
||||
sheet_name: item.definition?.sheet_name || '', header_row_index: item.definition?.header_row_index ?? 0,
|
||||
purpose: item.purpose === 'movement' ? 'movement' : 'inventory',
|
||||
field_mappings: Object.entries(item.definition?.field_mapping || {}).map(([inventory_field, source_header]) => ({ inventory_field, source_header: String(source_header) })),
|
||||
match_keys: (item.definition?.match_keys || []).map((entry: Record<string, unknown>) => ({ order_field_id: String(entry.order_field_id || ''), inventory_field: String(entry.inventory_field_id || entry.inventory_field || '') })),
|
||||
movement_mappings: buildMovementMappings(item),
|
||||
});
|
||||
if (activeTab.value === 'parsing') {
|
||||
// 草稿恢复保存的最小化样本证据,而不是要求管理员再次上传原始库存文件。
|
||||
@@ -1000,7 +1040,7 @@ function selectItem(item: Item): void {
|
||||
})),
|
||||
source_codes: item.action_payload_json?.source_codes || [],
|
||||
});
|
||||
if (activeTab.value === 'mappings') Object.assign(mapping, { ...item, freight_warehouse_id: item.freight_warehouse_id || '', external_organization_code: item.external_organization_code || '', external_site_code: item.external_site_code || '' });
|
||||
if (activeTab.value === 'mappings') Object.assign(mapping, { ...item, freight_warehouse_id: item.freight_warehouse_id || '', external_organization_code: item.external_organization_code || '', external_site_code: item.external_site_code || '', in_transit_warehouse_code: item.in_transit_warehouse_code || '' });
|
||||
drawerOpen.value = true;
|
||||
}
|
||||
|
||||
@@ -1120,7 +1160,13 @@ async function saveCurrent(): Promise<void> {
|
||||
try {
|
||||
if (activeTab.value === 'profiles') await saveShippingRpaProfile({ ...profile, display_name: profile.display_name || profile.profile_code, upload_config_json: profile.upload_config_json }, selectedId.value || undefined);
|
||||
if (activeTab.value === 'parsing') {
|
||||
const payload = {
|
||||
const payload = parsing.purpose === 'movement' ? {
|
||||
profile_code: parsing.profile_code, display_name: parsing.display_name || parsing.profile_code, file_format: parsing.file_format,
|
||||
purpose: 'movement', sheet_name: parsing.sheet_name || null, header_row_index: parsing.header_row_index,
|
||||
// 标准异动字段契约:code 由只读目录下发,这里只裁剪/校验别名映射。
|
||||
field_mapping: buildMovementFieldMapping(parsing.movement_mappings),
|
||||
match_keys: [] as string[],
|
||||
} : {
|
||||
profile_code: parsing.profile_code, display_name: parsing.display_name || parsing.profile_code, file_format: parsing.file_format,
|
||||
sheet_name: parsing.sheet_name || null, header_row_index: parsing.header_row_index,
|
||||
field_mapping: Object.fromEntries(parsing.field_mappings.map((item) => [item.inventory_field, item.source_header])),
|
||||
@@ -1364,6 +1410,31 @@ async function refreshSelectedSource(): Promise<void> {
|
||||
|
||||
/** 新增一行结构化 DBS 查询参数,避免要求管理员编辑 JSON。 */
|
||||
function addParameter(): void { source.query_parameters_json.push({ name: '', mode: 'single', values: [], required: false, select_all: false }); }
|
||||
/** 把已保存 movement 规则的定义与只读字段目录合并为可编辑映射行;目录缺失时退化为纯 code 行。 */
|
||||
function buildMovementMappings(item: Item) {
|
||||
const saved = (item.definition?.field_mapping || {}) as Record<string, unknown>;
|
||||
const catalog = movementFields.value.length
|
||||
? movementFields.value
|
||||
: Object.keys(saved).map((code) => ({ code, required: false, is_identity: false }));
|
||||
return catalog.map((field) => ({
|
||||
code: field.code, alias: String(saved[field.code] || ''),
|
||||
required: Boolean(field.required), is_identity: Boolean(field.is_identity),
|
||||
}));
|
||||
}
|
||||
|
||||
/** 切换用途时初始化对应映射行:movement 预填标准字段目录,inventory 清空自由映射。 */
|
||||
function resetMappingRowsForPurpose(): void {
|
||||
if (parsing.purpose === 'movement') {
|
||||
parsing.movement_mappings = movementFields.value.map((field) => ({
|
||||
code: field.code, alias: '', required: Boolean(field.required), is_identity: Boolean(field.is_identity),
|
||||
}));
|
||||
parsing.field_mappings = [];
|
||||
parsing.match_keys = [];
|
||||
} else {
|
||||
parsing.movement_mappings = [];
|
||||
}
|
||||
}
|
||||
|
||||
function addParsingFieldMapping(): void {
|
||||
if (!structureAnalysis.value) {
|
||||
message.warning(t('admin.shippingInventory.inventorySampleRequired'));
|
||||
@@ -1531,6 +1602,8 @@ function rowTitle(item: Item): string { return String(item.display_name || item.
|
||||
function rowMeta(item: Item): string {
|
||||
if (activeTab.value === 'inventoryFields') return `${t(`admin.shippingInventory.inventoryFieldType.${item.value_type || 'text'}`)} · ${t(`admin.shippingInventory.inventoryFieldPurposeOption.${item.usage_type || 'general'}`)}`;
|
||||
if (item.connector_type) return String(item.display_name ? t(`admin.shippingInventory.platform.${item.connector_type}`) : item.connector_type);
|
||||
// 解析规则列表带出用途徽标文案,库存/异动两种规则在列表一眼可分。
|
||||
if (activeTab.value === 'parsing') return `${t(`admin.shippingInventory.parsingPurpose.${item.purpose === 'movement' ? 'movement' : 'inventory'}`)} · V${item.version ?? '-'}`;
|
||||
return String(item.source_code || item.profile_code || item.rule_code || item.external_warehouse_code || '-');
|
||||
}
|
||||
|
||||
@@ -1557,11 +1630,13 @@ function serialiseSourceInput(): string {
|
||||
});
|
||||
}
|
||||
|
||||
/** 将收料配置表单稳定序列化,作为统一保存与启用守卫的收料脏检查基线。 */
|
||||
/** 将收料配置表单稳定序列化(含异动解析规则绑定),作为统一保存与启用守卫的收料脏检查基线。 */
|
||||
function serialiseReceiptInput(): string {
|
||||
return JSON.stringify({
|
||||
report_path_json: receiptConfig.report_path_json,
|
||||
query_parameters_json: receiptConfig.query_parameters_json,
|
||||
// 异动解析绑定必须参与脏检查:否则只改绑定时统一保存会跳过收料配置提交,改动被静默丢弃。
|
||||
parsing_profile_id: receiptConfig.parsing_profile_id ? Number(receiptConfig.parsing_profile_id) : null,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* features/admin/modules/shipping-inventory/movementParsingProfileForm.spec.ts
|
||||
* 用途:覆盖收料异动解析规则映射的组装边界。
|
||||
* 依赖:movementParsingProfileForm、vitest。
|
||||
* 逻辑:标准异动字段是只读领域契约——映射键必须是契约 code,必填字段缺失要阻断保存。
|
||||
*/
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { buildMovementFieldMapping, REQUIRED_MOVEMENT_FIELD_CODES } from './movementParsingProfileForm';
|
||||
|
||||
describe('movementParsingProfileForm', () => {
|
||||
it('exports the fixed required movement field codes', () => {
|
||||
// 关键断言:必填集是后端契约的镜像,变更必须显式同步。
|
||||
expect(REQUIRED_MOVEMENT_FIELD_CODES).toEqual(['doc_no', 'material_code', 'quantity', 'movement_date']);
|
||||
});
|
||||
|
||||
it('builds code-keyed mapping, trims aliases and drops empty optional rows', () => {
|
||||
const mapping = buildMovementFieldMapping([
|
||||
{ code: 'doc_no', alias: ' 单据编号 ', required: true, is_identity: true },
|
||||
{ code: 'line_no', alias: '', required: false, is_identity: false },
|
||||
{ code: 'material_code', alias: '料号', required: true, is_identity: true },
|
||||
{ code: 'quantity', alias: '数量', required: true, is_identity: false },
|
||||
{ code: 'movement_date', alias: '异动日期', required: true, is_identity: true },
|
||||
]);
|
||||
expect(mapping).toEqual({ doc_no: '单据编号', material_code: '料号', quantity: '数量', movement_date: '异动日期' });
|
||||
});
|
||||
|
||||
it('rejects saving when a required movement field has no alias', () => {
|
||||
// 关键断言:缺必填映射必须抛错并点名缺失字段,不允许带着残缺契约提交。
|
||||
expect(() => buildMovementFieldMapping([
|
||||
{ code: 'doc_no', alias: '单据编号', required: true, is_identity: true },
|
||||
{ code: 'material_code', alias: '', required: true, is_identity: true },
|
||||
{ code: 'quantity', alias: '数量', required: true, is_identity: false },
|
||||
{ code: 'movement_date', alias: '', required: true, is_identity: true },
|
||||
])).toThrowError(/material_code, movement_date/);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* features/admin/modules/shipping-inventory/movementParsingProfileForm.ts
|
||||
* 用途:组装收料异动解析规则(purpose='movement')的标准字段映射载荷。
|
||||
* 依赖:无外部依赖。
|
||||
* 逻辑:标准异动字段目录由后端 /admin/shipping-notice/movement-fields 只读下发,
|
||||
* 本模块只做裁剪与校验——映射键是契约 code,必填字段缺失阻断保存;
|
||||
* 不提供任何自定义字段的入口(业务领域字段不允许用户自定义)。
|
||||
*/
|
||||
|
||||
/** 与后端 movement_contract.MOVEMENT_FIELDS 的 required 标记保持一致,变更必须双向同步。 */
|
||||
export const REQUIRED_MOVEMENT_FIELD_CODES = ['doc_no', 'material_code', 'quantity', 'movement_date'] as const;
|
||||
|
||||
/** 标准异动字段映射行(目录行 + 管理员选择的报表表头别名)。 */
|
||||
export type MovementFieldMapping = {
|
||||
code: string;
|
||||
alias: string;
|
||||
required: boolean;
|
||||
is_identity: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* 构造异动解析定义的 field_mapping({契约code: 报表表头别名})。
|
||||
* 核心逻辑:别名 trim 后为空的行视为未映射——可选字段直接剔除,
|
||||
* 必填字段缺失则抛错点名,禁止带着残缺契约提交到后端。
|
||||
* @param mappings - 异动字段映射行(来自只读字段目录 + 用户选择)。
|
||||
* @returns 可直接放入保存载荷的 field_mapping 对象。
|
||||
*/
|
||||
export function buildMovementFieldMapping(mappings: MovementFieldMapping[]): Record<string, string> {
|
||||
const mapping: Record<string, string> = {};
|
||||
for (const item of mappings || []) {
|
||||
const alias = String(item.alias || '').trim();
|
||||
if (!alias) continue;
|
||||
mapping[String(item.code).trim()] = alias;
|
||||
}
|
||||
const missing = REQUIRED_MOVEMENT_FIELD_CODES.filter((code) => !mapping[code]);
|
||||
if (missing.length) throw new Error(`missing required movement fields: ${missing.join(', ')}`);
|
||||
return mapping;
|
||||
}
|
||||
+18
@@ -31,10 +31,28 @@ describe('receiptReportConfigForm', () => {
|
||||
{ name: 'Warehouse', mode: 'multi_text', values: ['AWSDU', 'AWSDU-02'], required: false, select_all: false },
|
||||
{ name: 'Owner', mode: 'single', values: ['AWS'], required: false, select_all: false },
|
||||
],
|
||||
// 关键断言:载荷契约固定三元——未绑定时异动解析绑定显式为 null,不缺键。
|
||||
parsing_profile_id: null,
|
||||
});
|
||||
expect(payload).not.toHaveProperty('source_code');
|
||||
expect(payload).not.toHaveProperty('snapshot_ttl_seconds');
|
||||
expect(payload).not.toHaveProperty('enabled');
|
||||
expect(payload).not.toHaveProperty('warehouse_ids_json');
|
||||
});
|
||||
|
||||
it('carries movement profile binding and normalizes absent id to explicit unbind', () => {
|
||||
// 关键断言:异动解析绑定随配置提交;未绑定时必须显式提交 null(解绑),不能省略键。
|
||||
const bound = buildReceiptReportConfigPayload({
|
||||
report_path_json: { report_name: 'Inbound Details' },
|
||||
query_parameters_json: [],
|
||||
parsing_profile_id: 7,
|
||||
});
|
||||
expect(bound.parsing_profile_id).toBe(7);
|
||||
|
||||
const unbound = buildReceiptReportConfigPayload({
|
||||
report_path_json: { report_name: 'Inbound Details' },
|
||||
query_parameters_json: [],
|
||||
});
|
||||
expect(unbound.parsing_profile_id).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -9,11 +9,14 @@
|
||||
export type ReceiptReportConfigInput = {
|
||||
report_path_json: Record<string, unknown>;
|
||||
query_parameters_json: Array<Record<string, unknown>>;
|
||||
/** 收料异动解析规则绑定;0/undefined 视为未绑定并归一为 null(显式解绑)。 */
|
||||
parsing_profile_id?: number | null;
|
||||
};
|
||||
|
||||
/**
|
||||
* 构造独立收料配置保存载荷。
|
||||
* 核心逻辑:白名单复制可配置业务字段,不允许调用方把库存源、Profile 或启停字段带入收料 API。
|
||||
* 核心逻辑:白名单复制可配置业务字段,不允许调用方把库存源、Profile 或启停字段带入收料 API;
|
||||
* 异动解析绑定随配置一并提交(null=解绑)。
|
||||
* @param input - 抽屉中的收料配置表单状态。
|
||||
* @returns 仅包含收料配置 API 支持字段的深拷贝载荷。
|
||||
*/
|
||||
@@ -21,5 +24,6 @@ export function buildReceiptReportConfigPayload(input: ReceiptReportConfigInput)
|
||||
return {
|
||||
report_path_json: { ...(input.report_path_json || {}) },
|
||||
query_parameters_json: (input.query_parameters_json || []).map((item) => ({ ...item })),
|
||||
parsing_profile_id: input.parsing_profile_id ? Number(input.parsing_profile_id) : null,
|
||||
};
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import type {
|
||||
TransferRunResult,
|
||||
TransferSourceFileStatus,
|
||||
TransferSourceOption,
|
||||
TransferType,
|
||||
} from '../types/transfer.types';
|
||||
|
||||
const BASE = '/api/in-transit-transfer';
|
||||
@@ -26,6 +27,10 @@ const jsonHeaders = () => ({ 'Content-Type': 'application/json', ...getAuthHeade
|
||||
export interface CreatePrecheckPayload {
|
||||
source_codes: string[];
|
||||
business_date?: string;
|
||||
receipt_date_from?: string;
|
||||
receipt_date_to?: string;
|
||||
/** 调拨业务类型;缺省为在途仓至HUB仓 */
|
||||
transfer_type?: TransferType;
|
||||
}
|
||||
|
||||
/** 创建预检(只读) */
|
||||
@@ -86,12 +91,27 @@ export const downloadTransferReceiptFiles = (runNo: string) =>
|
||||
|
||||
/** 下载预检冻结的 ERP 库存表(csv) */
|
||||
export const downloadTransferErpInventory = (runNo: string) =>
|
||||
requestBlob(`${BASE}/runs/${runNo}/erp-inventory`, { headers: getAuthHeaders() });
|
||||
requestBlob(`${BASE}/runs/${runNo}/external-inventory`, { headers: getAuthHeaders() });
|
||||
|
||||
/** 下载七 Sheet 异常 Excel */
|
||||
export const downloadTransferExceptions = (runNo: string) =>
|
||||
requestBlob(`${BASE}/runs/${runNo}/exceptions.xlsx`, { headers: getAuthHeaders() });
|
||||
|
||||
/** 批量重查 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`,
|
||||
{ method: 'POST', body: JSON.stringify(invoiceNos ? { invoice_nos: invoiceNos } : {}), headers: { ...getAuthHeaders(), 'Content-Type': 'application/json' } },
|
||||
);
|
||||
|
||||
/** 按选中来源打包下载各自最新归档收料文件(zip) */
|
||||
export const downloadTransferSourceFiles = (sourceCodes: string[]) =>
|
||||
requestBlob(`${BASE}/sources/receipt-files`, {
|
||||
method: 'POST',
|
||||
headers: { ...getAuthHeaders(), 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ source_codes: sourceCodes }),
|
||||
});
|
||||
|
||||
/** 待处理异常列表(可恢复/已关闭/结果未知 + 老化等级) */
|
||||
export const listTransferBacklog = () =>
|
||||
requestJson<TransferBacklogItem[]>(`${BASE}/backlog`, { headers: getAuthHeaders() });
|
||||
|
||||
@@ -103,6 +103,8 @@ const isTransferMessage = computed(
|
||||
|| message.type === 'transfer-progress'
|
||||
|| message.type === 'transfer-result',
|
||||
);
|
||||
/** 调拨消息带宽表格(预检明细 10+ 列),放宽气泡宽度上限避免横向挤压成局部布局。 */
|
||||
const wideMessage = computed(() => isTransferMessage.value || isContractReviewMessage.value);
|
||||
|
||||
const isLeaveMessage = computed(() =>
|
||||
message.type === 'leave-form'
|
||||
@@ -709,8 +711,8 @@ function handleInlineDownload(file: InlineDownloadFile): void {
|
||||
<template>
|
||||
<div
|
||||
:data-msg-index="index"
|
||||
class="group mx-auto mb-6 flex w-full max-w-4xl animate-slide-up"
|
||||
:class="message.role === 'user' ? 'justify-end' : 'justify-start'"
|
||||
class="group mx-auto mb-6 flex w-full animate-slide-up"
|
||||
:class="message.role === 'user' ? 'justify-end' : wideMessage ? 'max-w-[min(96vw,1500px)]' : 'max-w-4xl justify-start'"
|
||||
>
|
||||
<div
|
||||
class="flex flex-col"
|
||||
@@ -721,7 +723,7 @@ function handleInlineDownload(file: InlineDownloadFile): void {
|
||||
class="text-[15px] leading-relaxed"
|
||||
:class="message.role === 'user'
|
||||
? 'rounded-2xl rounded-tr-sm bg-brand-600 px-5 py-2.5 text-white shadow-sm shadow-brand-500/15'
|
||||
: isContractReviewMessage
|
||||
: isContractReviewMessage || isTransferMessage
|
||||
? 'w-full'
|
||||
: shippingOrderExtractionState
|
||||
? 'w-full'
|
||||
|
||||
@@ -64,14 +64,14 @@ describe('TransferHomePanel chat home entry', () => {
|
||||
precheck_id: 'TPC-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_erp_write_count: 1, precheck_hash: 'sha256:x',
|
||||
estimated_transfer_quantity: '1200', estimated_external_write_count: 1, precheck_hash: 'sha256:x',
|
||||
});
|
||||
api.getTransferPrecheck.mockResolvedValue({
|
||||
summary: {
|
||||
precheck_id: 'TPC-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_erp_write_count: 1, precheck_hash: 'sha256:x',
|
||||
estimated_transfer_quantity: '1200', estimated_external_write_count: 1, precheck_hash: 'sha256:x',
|
||||
},
|
||||
items: [{
|
||||
source_code: 'DBS-AWSBI', material_no: 'MAT-1', material_name: '连接器组件', specification: 'A',
|
||||
|
||||
@@ -118,8 +118,8 @@ function goBack() {
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<!-- 子流程:复用自驱动的 TransferMessageView -->
|
||||
<div v-else class="w-full max-w-4xl pr-2">
|
||||
<!-- 子流程:复用自驱动的 TransferMessageView(预检宽表格需要全宽,上限对齐消息气泡宽布局) -->
|
||||
<div v-else class="w-full max-w-[min(96vw,1500px)] pr-2">
|
||||
<button
|
||||
type="button"
|
||||
data-testid="transfer-home-back"
|
||||
|
||||
@@ -38,7 +38,7 @@ const payload = {
|
||||
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_erp_write_count: 1,
|
||||
estimated_external_write_count: 1,
|
||||
precheck_hash: 'sha256:x',
|
||||
},
|
||||
items: [{
|
||||
@@ -57,7 +57,7 @@ const runPayload = {
|
||||
run_no: 'RUN-1',
|
||||
status: 'success',
|
||||
result: {
|
||||
erp_documents: [{
|
||||
external_documents: [{
|
||||
document_no: 'TRF-10001', from_warehouse: 'DBS-TRANSIT', to_warehouse: 'HUB-CN01',
|
||||
material_count: 1, total_quantity: '1200', posting_status: 'posted',
|
||||
lines: [{ material_no: 'MAT-1', material_name: '连接器组件', specification: 'A', invoice_no: 'INV-001', quantity: '1200' }],
|
||||
@@ -167,7 +167,7 @@ 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'] });
|
||||
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);
|
||||
});
|
||||
});
|
||||
@@ -16,6 +16,8 @@ import TransferBacklogSummaryCard from './TransferBacklogSummaryCard.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 { triggerBlobDownload } from '@/shared/utils/download';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import type {
|
||||
TransferBacklogItem,
|
||||
@@ -23,6 +25,7 @@ import type {
|
||||
TransferPrecheckSummary,
|
||||
TransferRunResult,
|
||||
TransferSourceProgress,
|
||||
TransferType,
|
||||
} from '../../types/transfer.types';
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -86,6 +89,40 @@ function applyPayload(payload?: Record<string, unknown> | null) {
|
||||
applyPayload(props.payload);
|
||||
watch(() => props.payload, applyPayload);
|
||||
|
||||
/** 打包下载选中来源的最新归档收料文件 */
|
||||
async function onDownloadSources(sourceCodes: string[]) {
|
||||
if (!sourceCodes.length) return;
|
||||
busy.value = true;
|
||||
try {
|
||||
const result = await downloadTransferSourceFiles(sourceCodes);
|
||||
triggerBlobDownload(result.blob, result.filename ?? `receipt-files-${sourceCodes.length}.zip`);
|
||||
} catch (e) {
|
||||
reportError(e);
|
||||
} finally {
|
||||
busy.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/** 重新获取 ERP 库存:批量重查后用服务端明细原位刷新(保留勾选中仍阻断的行) */
|
||||
async function onRequery(invoiceNos: string[]) {
|
||||
if (!invoiceNos.length || !transfer.precheckId.value) return;
|
||||
busy.value = true;
|
||||
try {
|
||||
await requeryTransferItems(transfer.precheckId.value, invoiceNos);
|
||||
const detail = await getTransferPrecheck(transfer.precheckId.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),
|
||||
);
|
||||
transfer.selected.value = new Set([...transfer.selected.value].filter((no) => stillBlocked.has(no)));
|
||||
} catch (e) {
|
||||
reportError(e);
|
||||
} finally {
|
||||
busy.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/** 直接生成调拨单(决策 4/5:无独立确认页) */
|
||||
async function onExecute(invoiceNos: string[]) {
|
||||
busy.value = true;
|
||||
@@ -159,11 +196,15 @@ async function onCloseConfirm(reason: string) {
|
||||
}
|
||||
}
|
||||
|
||||
/** 来源实例选择确认 → 创建预检并切换预检卡(决策 4:两步第一步) */
|
||||
async function onSourceConfirm(sourceCodes: string[]) {
|
||||
/** 来源实例选择确认 → 创建预检并切换预检卡(决策 4:两步第一步;收料日期范围为查询范围;调拨类型决定数据范围) */
|
||||
async function onSourceConfirm(
|
||||
sourceCodes: string[],
|
||||
dateRange?: { from?: string; to?: string },
|
||||
transferType?: TransferType,
|
||||
) {
|
||||
busy.value = true;
|
||||
try {
|
||||
await transfer.createPrecheck(sourceCodes);
|
||||
await transfer.createPrecheck(sourceCodes, undefined, dateRange, transferType);
|
||||
mode.value = 'precheck';
|
||||
summaryRef.value = transfer.precheck.value;
|
||||
items.value = transfer.items.value;
|
||||
@@ -206,15 +247,20 @@ async function onSourceRetry(sourceCodes: string[]) {
|
||||
:busy="busy"
|
||||
:retrying="retryingSource"
|
||||
@confirm="onSourceConfirm"
|
||||
@download="onDownloadSources"
|
||||
@retry="onSourceRetry"
|
||||
/>
|
||||
<TransferPrecheckCard
|
||||
v-else-if="mode === 'precheck' && 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))"
|
||||
@requery="onRequery"
|
||||
@execute="onExecute"
|
||||
/>
|
||||
<TransferProgressCard v-else-if="mode === 'progress'" :run-no="runNo" :status="status" :busy="busy" />
|
||||
|
||||
@@ -1,24 +1,34 @@
|
||||
<!--
|
||||
features/chat/components/messages/TransferPrecheckCard.vue
|
||||
用途:预检卡——计数 + 调拨明细表(决策 6 十列)+ 勾选 + “直接生成调拨单”按钮。
|
||||
依赖:props(summary/items/selected/busy)、i18n chat.transfer.*。
|
||||
逻辑:阻断/未成熟项 checkbox 禁用;无选择或 busy 时生成按钮禁用;
|
||||
emit execute(invoiceNos)(决策 4/5:无独立确认页)。
|
||||
用途:预检卡——计数 + 来源失败提示 + 调拨明细表(含筛选)+ 勾选 + “直接生成调拨单”按钮。
|
||||
依赖:props(summary/items/sources/selected/busy)、i18n chat.transfer.*。
|
||||
逻辑:明细表渲染 filtered(关键字/结果筛选生效);阻断/未成熟项 checkbox 禁用;
|
||||
重查范围含可恢复阻断与可执行行;阻断原因经结果徽标 title 悬浮透出不占行高;
|
||||
无选择或 busy 时生成按钮禁用;emit execute(invoiceNos)(决策 4/5:无独立确认页);
|
||||
来源级解析/文件失败经 sources.error_code 透出(防"安静全 0")。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import type { TransferPrecheckItem, TransferPrecheckSummary } from '../../types/transfer.types';
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { deriveBatchNo } from './transferBatch';
|
||||
import type { TransferPrecheckItem, TransferPrecheckSummary, TransferSourceProgress } from '../../types/transfer.types';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const props = defineProps<{
|
||||
summary: TransferPrecheckSummary;
|
||||
items: TransferPrecheckItem[];
|
||||
sources?: TransferSourceProgress[];
|
||||
selected: Set<string>;
|
||||
busy?: boolean;
|
||||
requeryBusy?: boolean;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
toggle: [invoiceNo: string, checked: boolean];
|
||||
'toggle-all': [invoiceNos: string[], checked: boolean];
|
||||
execute: [invoiceNos: string[]];
|
||||
requery: [invoiceNos: string[]];
|
||||
}>();
|
||||
|
||||
const selectedCount = computed(() =>
|
||||
@@ -26,10 +36,67 @@ const selectedCount = computed(() =>
|
||||
);
|
||||
const executeDisabled = computed(() => props.busy || selectedCount.value === 0);
|
||||
|
||||
/** 来源级失败(解析/文件/RPA 触发):必须可见,防止计数全 0 却无任何解释。 */
|
||||
const failedSources = computed(() =>
|
||||
(props.sources ?? []).filter((source) => source.error_code || source.error_message),
|
||||
);
|
||||
|
||||
/** 筛选与全选状态(表格交互本地态,勾选集合仍由父级持有)。 */
|
||||
const keyword = ref('');
|
||||
const resultFilter = ref<'all' | 'executable' | 'blocked' | 'not_matured'>('all');
|
||||
|
||||
function isBlocked(item: TransferPrecheckItem): boolean {
|
||||
return String(item.result).startsWith('blocked_');
|
||||
}
|
||||
|
||||
/** 勾选可用范围:可执行(可生成调拨)或可恢复阻断(可重查 ERP)。 */
|
||||
function isSelectable(item: TransferPrecheckItem): boolean {
|
||||
return item.result === 'executable';
|
||||
}
|
||||
|
||||
function isCheckable(item: TransferPrecheckItem): boolean {
|
||||
return isSelectable(item) || isBlocked(item);
|
||||
}
|
||||
|
||||
/** 可重查行:可恢复阻断 + 可执行(已可执行也允许重查核对最新库存)。 */
|
||||
function isRequeryable(item: TransferPrecheckItem): boolean {
|
||||
return isBlocked(item) || item.result === 'executable';
|
||||
}
|
||||
|
||||
const filtered = computed(() =>
|
||||
props.items.filter((item) => {
|
||||
const kw = keyword.value.trim().toLowerCase();
|
||||
if (kw) {
|
||||
const haystack = [item.material_no, item.material_name, item.invoice_no, item.lot_no]
|
||||
.map((value) => String(value ?? '').toLowerCase());
|
||||
if (!haystack.some((value) => value.includes(kw))) return false;
|
||||
}
|
||||
if (resultFilter.value === 'executable' && item.result !== 'executable') return false;
|
||||
if (resultFilter.value === 'blocked' && !isBlocked(item)) return false;
|
||||
if (resultFilter.value === 'not_matured' && item.result !== 'not_matured') return false;
|
||||
return true;
|
||||
}),
|
||||
);
|
||||
|
||||
const filteredInvoiceNos = computed(() => filtered.value.map((item) => item.invoice_no));
|
||||
const allFilteredSelected = computed(() =>
|
||||
filteredInvoiceNos.value.length > 0 && filteredInvoiceNos.value.every((no) => props.selected.has(no)),
|
||||
);
|
||||
const selectedRequeryableCount = computed(() =>
|
||||
filtered.value.filter((item) => isRequeryable(item) && props.selected.has(item.invoice_no)).length,
|
||||
);
|
||||
|
||||
function toggleAll(): void {
|
||||
emit('toggle-all', filteredInvoiceNos.value, !allFilteredSelected.value);
|
||||
}
|
||||
|
||||
function requerySelected(): void {
|
||||
const nos = filtered.value
|
||||
.filter((item) => isRequeryable(item) && props.selected.has(item.invoice_no))
|
||||
.map((item) => item.invoice_no);
|
||||
if (nos.length) emit('requery', nos);
|
||||
}
|
||||
|
||||
function isChecked(item: TransferPrecheckItem): boolean {
|
||||
return props.selected.has(item.invoice_no);
|
||||
}
|
||||
@@ -41,11 +108,31 @@ function resultLabel(result: string): string {
|
||||
blocked_quantity_mismatch: 'chat.transfer.resultBlocked',
|
||||
blocked_inventory_not_found: 'chat.transfer.resultBlocked',
|
||||
blocked_future_date: 'chat.transfer.resultBlocked',
|
||||
erp_query_timeout: 'chat.transfer.resultUnknown',
|
||||
external_query_timeout: 'chat.transfer.resultUnknown',
|
||||
result_unknown: 'chat.transfer.resultUnknown',
|
||||
};
|
||||
return map[result] ?? 'chat.transfer.resultBlocked';
|
||||
}
|
||||
|
||||
/** 阻断原因悬浮文案:已知结果码走 i18n 本地化;带明细后缀(如查询失败的底层原因)原样保留追加。 */
|
||||
const REASON_I18N_KEYS: Record<string, string> = {
|
||||
blocked_quantity_mismatch: 'chat.transfer.reasonQuantityMismatch',
|
||||
blocked_inventory_not_found: 'chat.transfer.reasonInventoryNotFound',
|
||||
blocked_external_query_failed: 'chat.transfer.reasonExternalQueryFailed',
|
||||
blocked_future_date: 'chat.transfer.reasonFutureDate',
|
||||
};
|
||||
|
||||
function reasonTitle(item: TransferPrecheckItem): string | undefined {
|
||||
if (!isBlocked(item) || !item.reason) return undefined;
|
||||
const key = REASON_I18N_KEYS[item.result];
|
||||
if (!key) return item.reason;
|
||||
const base = t(key);
|
||||
const marker = ': ';
|
||||
const detail = item.reason.includes(marker)
|
||||
? item.reason.slice(item.reason.indexOf(marker) + marker.length).trim()
|
||||
: '';
|
||||
return detail ? `${base}:${detail}` : base;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -73,22 +160,65 @@ function resultLabel(result: string): string {
|
||||
<div class="text-[11px] text-muted">{{ $t('chat.transfer.estimatedQuantity') }}</div>
|
||||
</div>
|
||||
<div class="rounded-lg bg-surface-soft p-2 text-center">
|
||||
<div class="text-lg font-black text-brand-600">{{ summary.estimated_erp_write_count }}</div>
|
||||
<div class="text-[11px] text-muted">{{ $t('chat.transfer.estimatedErpWrites') }}</div>
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<div class="overflow-x-auto">
|
||||
<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"
|
||||
>
|
||||
<div class="mb-1 font-bold">{{ $t('chat.transfer.sourceErrorTitle') }}</div>
|
||||
<div v-for="source in failedSources" :key="source.source_code" class="leading-5">
|
||||
{{ source.source_code }}:{{ source.error_message || source.error_code }}
|
||||
</div>
|
||||
</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-precheck-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">
|
||||
<option value="all">{{ $t('chat.transfer.filterAll') }}</option>
|
||||
<option value="executable">{{ $t('chat.transfer.resultExecutable') }}</option>
|
||||
<option value="blocked">{{ $t('chat.transfer.resultBlocked') }}</option>
|
||||
<option value="not_matured">{{ $t('chat.transfer.resultNotMatured') }}</option>
|
||||
</select>
|
||||
<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"
|
||||
:disabled="props.requeryBusy || selectedRequeryableCount === 0"
|
||||
data-testid="transfer-precheck-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">
|
||||
<thead>
|
||||
<tr class="border-b border-default bg-surface-soft text-left text-[11px] text-muted">
|
||||
<th class="p-2"></th>
|
||||
<th class="p-2">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="allFilteredSelected"
|
||||
data-testid="transfer-precheck-select-all"
|
||||
@change="toggleAll"
|
||||
/>
|
||||
</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.colSpec') }}</th>
|
||||
<th class="p-2">{{ $t('chat.transfer.colInvoice') }}</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>
|
||||
@@ -97,8 +227,8 @@ function resultLabel(result: string): string {
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="item in items"
|
||||
:key="item.invoice_no"
|
||||
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) }"
|
||||
:data-testid="`transfer-item-${item.invoice_no}`"
|
||||
@@ -107,31 +237,47 @@ function resultLabel(result: string): string {
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="isChecked(item)"
|
||||
:disabled="!isSelectable(item) || busy"
|
||||
:disabled="!isCheckable(item) || busy"
|
||||
:data-testid="`transfer-check-${item.invoice_no}`"
|
||||
@change="emit('toggle', item.invoice_no, ($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.specification }}</td>
|
||||
<td class="p-2 font-semibold">{{ item.invoice_no }}</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">{{ item.to_warehouse }}</td>
|
||||
<td class="p-2">{{ item.to_quantity }}</td>
|
||||
<td class="p-2">
|
||||
<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',
|
||||
}"
|
||||
>
|
||||
{{ $t(resultLabel(item.result)) }}
|
||||
</span>
|
||||
<div class="flex 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',
|
||||
}"
|
||||
:title="reasonTitle(item)"
|
||||
data-testid="transfer-item-result"
|
||||
>
|
||||
{{ $t(resultLabel(item.result)) }}
|
||||
</span>
|
||||
<button
|
||||
v-if="isRequeryable(item)"
|
||||
type="button"
|
||||
class="ml-1 rounded border border-brand-200 px-1 text-[10px] font-bold text-brand-700 transition hover:bg-brand-50 disabled:opacity-40"
|
||||
:disabled="props.requeryBusy"
|
||||
:data-testid="`transfer-requery-${item.invoice_no}`"
|
||||
@click="emit('requery', [item.invoice_no])"
|
||||
>
|
||||
{{ $t('chat.transfer.requeryRow') }}
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -141,7 +287,7 @@ function resultLabel(result: string): string {
|
||||
<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 }) }} ·
|
||||
{{ $t('chat.transfer.estimatedErpWrites') }}:{{ summary.estimated_erp_write_count }}
|
||||
{{ $t('chat.transfer.estimatedExternalWrites') }}:{{ summary.estimated_external_write_count }}
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -39,9 +39,9 @@ function reasonLabel(reason: string): string {
|
||||
</div>
|
||||
|
||||
<!-- 已生成 ERP 单据:按单号聚合 + 可展开物料明细 -->
|
||||
<div v-if="run.result.erp_documents.length" class="flex flex-col gap-2">
|
||||
<div v-if="run.result.external_documents.length" class="flex flex-col gap-2">
|
||||
<details
|
||||
v-for="doc in run.result.erp_documents"
|
||||
v-for="doc in run.result.external_documents"
|
||||
:key="doc.document_no"
|
||||
class="rounded-lg border border-default"
|
||||
data-testid="transfer-erp-document"
|
||||
|
||||
@@ -58,7 +58,7 @@ describe('TransferSourceSelectCard', () => {
|
||||
expect(wrapper.emitted('confirm')?.[0][0]).toEqual(['DBS-AWSBI', 'DBS-AWSSG', 'CRANE-SZ']);
|
||||
});
|
||||
|
||||
it('“清空”清空已选实例', async () => {
|
||||
it('“清空选择”清空已选实例', async () => {
|
||||
const wrapper = mountCard();
|
||||
await wrapper.find('[data-testid="transfer-source-select-visible"]').trigger('click');
|
||||
await wrapper.find('[data-testid="transfer-source-clear"]').trigger('click');
|
||||
@@ -66,6 +66,28 @@ describe('TransferSourceSelectCard', () => {
|
||||
expect(wrapper.emitted('confirm')).toBeUndefined();
|
||||
});
|
||||
|
||||
it('选中后上下文操作条原位替换选择辅助区,清空选择后还原', async () => {
|
||||
// [断言意图] 未选中零死按钮(仅辅助区);有选中时批量操作条同槽位出现并带计数;
|
||||
// 清空选择后还原辅助区——Gmail/Linear 式批量操作栏切换行为。
|
||||
const wrapper = mountCard();
|
||||
expect(wrapper.find('[data-testid="transfer-source-aids"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="transfer-source-action-bar"]').exists()).toBe(false);
|
||||
await wrapper.find('[data-testid="transfer-source-option-DBS-AWSBI"] input').setValue(true);
|
||||
expect(wrapper.find('[data-testid="transfer-source-aids"]').exists()).toBe(false);
|
||||
expect(wrapper.find('[data-testid="transfer-source-action-bar"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="transfer-source-action-bar"]').text()).toContain('已选 1');
|
||||
await wrapper.find('[data-testid="transfer-source-clear"]').trigger('click');
|
||||
expect(wrapper.find('[data-testid="transfer-source-aids"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="transfer-source-action-bar"]').exists()).toBe(false);
|
||||
expect(wrapper.emitted('confirm')).toBeUndefined();
|
||||
});
|
||||
|
||||
it('D+1 规则提示收进 ⓘ 悬浮(title),不再平铺占宽', () => {
|
||||
// [断言意图] 长规则文案通过原生 title 渐进披露,紧凑日期行不换行错位。
|
||||
const wrapper = mountCard();
|
||||
expect(wrapper.find('[data-testid="transfer-source-date-hint"]').attributes('title')).toBe('截止不超出 D+1 规则(业务日期前一天)');
|
||||
});
|
||||
|
||||
it('“只选可重试”勾选无文件/失败来源', async () => {
|
||||
const wrapper = mountCard();
|
||||
await wrapper.find('[data-testid="transfer-source-select-retryable"]').trigger('click');
|
||||
@@ -86,4 +108,33 @@ describe('TransferSourceSelectCard', () => {
|
||||
await wrapper.find('[data-testid="transfer-source-batch-retry"]').trigger('click');
|
||||
expect(wrapper.emitted('retry')?.[0][0]).toEqual(['DBS-AWSSG']);
|
||||
});
|
||||
|
||||
it('已过期来源显示「文件已过期」徽标且可重试', async () => {
|
||||
// [断言意图] 保留期已到的来源不得误报就绪(has_ready_file=false);
|
||||
// expired 状态与 none/failed 一样允许重新触发收料 RPA。
|
||||
const wrapper = mountCard({}, [
|
||||
{ source_code: 'CRANE-EXP', display_name: '过期在途仓', platform: 'crane', enabled: true, has_ready_file: false, file_status: 'expired' },
|
||||
]);
|
||||
expect(wrapper.find('[data-testid="transfer-source-status-CRANE-EXP"]').text()).toBe('文件已过期');
|
||||
expect((wrapper.find('[data-testid="transfer-source-retry-CRANE-EXP"]').element as HTMLButtonElement).disabled).toBe(false);
|
||||
await wrapper.find('[data-testid="transfer-source-option-CRANE-EXP"] input').setValue(true);
|
||||
await wrapper.find('[data-testid="transfer-source-batch-retry"]').trigger('click');
|
||||
expect(wrapper.emitted('retry')?.[0][0]).toEqual(['CRANE-EXP']);
|
||||
});
|
||||
|
||||
it('确认默认携带调拨类型 in_transit_to_hub', async () => {
|
||||
// [断言意图] 类型 1 为缺省选中值,确认事件第三参回传类型。
|
||||
const wrapper = mountCard();
|
||||
await wrapper.find('[data-testid="transfer-source-option-DBS-AWSBI"] input').setValue(true);
|
||||
await wrapper.find('[data-testid="transfer-source-confirm"]').trigger('click');
|
||||
expect(wrapper.emitted('confirm')?.[0][2]).toBe('in_transit_to_hub');
|
||||
});
|
||||
|
||||
it('调拨类型 2/3 占位禁用且不可选中', async () => {
|
||||
// [断言意图] 一期仅开放类型 1;占位类型按钮 disabled,防止发起未支持链路。
|
||||
const wrapper = mountCard();
|
||||
expect((wrapper.find('[data-testid="transfer-type-option-hub_repair_out"]').element as HTMLButtonElement).disabled).toBe(true);
|
||||
expect((wrapper.find('[data-testid="transfer-type-option-hub_to_hub"]').element as HTMLButtonElement).disabled).toBe(true);
|
||||
expect((wrapper.find('[data-testid="transfer-type-option-in_transit_to_hub"]').element as HTMLButtonElement).disabled).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -1,15 +1,19 @@
|
||||
<!--
|
||||
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)。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import type { TransferSourceOption } from '../../types/transfer.types';
|
||||
import type { TransferSourceOption, TransferType } from '../../types/transfer.types';
|
||||
|
||||
const props = defineProps<{
|
||||
sources: TransferSourceOption[];
|
||||
@@ -19,22 +23,39 @@ const props = defineProps<{
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
confirm: [sourceCodes: string[]];
|
||||
confirm: [sourceCodes: string[], dateRange?: { from?: string; to?: string }, transferType?: TransferType];
|
||||
/** 批量重试收料 RPA:传来源编码列表 */
|
||||
retry: [sourceCodes: string[]];
|
||||
download: [sourceCodes: string[]];
|
||||
}>();
|
||||
|
||||
const { warning: notifyWarning } = useMessage();
|
||||
const { t } = useI18n();
|
||||
|
||||
const selected = ref<Set<string>>(new Set());
|
||||
/** 收料日期范围(预检查询范围);截止不得超出 D+1 规则(后端卡控)。 */
|
||||
const dateFrom = ref('');
|
||||
const dateTo = ref('');
|
||||
/** 调拨业务类型:决定本次预检纳入哪些收料数据;一期仅类型 1 开放。 */
|
||||
const transferType = ref<TransferType>('in_transit_to_hub');
|
||||
|
||||
/** 类型选项元数据;enabled=false 为占位类型(UI 禁用 + 后端 fail-closed 双保险)。 */
|
||||
const transferTypeOptions: Array<{ value: TransferType; enabled: boolean }> = [
|
||||
{ value: 'in_transit_to_hub', enabled: true },
|
||||
{ value: 'hub_repair_out', enabled: false },
|
||||
{ value: 'hub_to_hub', enabled: false },
|
||||
];
|
||||
|
||||
function transferTypeLabel(value: TransferType): string {
|
||||
return t(`chat.transfer.transferType.${value}`);
|
||||
}
|
||||
|
||||
const platforms = computed(() => [...new Set(props.sources.map((source) => source.platform))]);
|
||||
const selectedCount = computed(() => selected.value.size);
|
||||
|
||||
/** 可重试判定:仅 待抓取(none) / 抓取失败(failed) 的来源可重试(ready/fetching 不重复触发)。 */
|
||||
/** 可重试判定:仅 待抓取(none) / 抓取失败(failed) / 已过期(expired) 的来源可重试(ready/fetching 不重复触发)。 */
|
||||
function isRetryable(source: TransferSourceOption): boolean {
|
||||
return source.file_status === 'none' || source.file_status === 'failed';
|
||||
return source.file_status === 'none' || source.file_status === 'failed' || source.file_status === 'expired';
|
||||
}
|
||||
|
||||
/** 全部可重试来源。 */
|
||||
@@ -50,6 +71,7 @@ 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 downloadDisabled = computed(() => props.busy || !selectedHasReadyFile.value);
|
||||
|
||||
function toggle(sourceCode: string, checked: boolean) {
|
||||
const next = new Set(selected.value);
|
||||
@@ -96,6 +118,13 @@ function batchRetry() {
|
||||
emit('retry', codes);
|
||||
}
|
||||
|
||||
function downloadSelected(): void {
|
||||
const codes = [...selected.value].filter(
|
||||
(code) => props.sources.find((s) => s.source_code === code)?.has_ready_file,
|
||||
);
|
||||
if (codes.length) emit('download', codes);
|
||||
}
|
||||
|
||||
function confirm() {
|
||||
if (selectedCount.value === 0) {
|
||||
notifyWarning(t('chat.transfer.needSelectSource'), t('chat.transfer.sourceSelectTitle'));
|
||||
@@ -105,7 +134,7 @@ function confirm() {
|
||||
notifyWarning(t('chat.transfer.needReadyFile'), t('chat.transfer.sourceSelectTitle'));
|
||||
return;
|
||||
}
|
||||
emit('confirm', [...selected.value]);
|
||||
emit('confirm', [...selected.value], { from: dateFrom.value || undefined, to: dateTo.value || undefined }, transferType.value);
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -114,7 +143,54 @@ 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>
|
||||
|
||||
<div class="mb-3 flex flex-wrap items-center gap-2">
|
||||
<!-- [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>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<span class="text-xs font-bold text-secondary">{{ $t('chat.transfer.transferTypeLabel') }}</span>
|
||||
<button
|
||||
v-for="option in transferTypeOptions"
|
||||
:key="option.value"
|
||||
type="button"
|
||||
class="rounded-full border px-3 py-1 text-xs font-bold disabled:cursor-not-allowed disabled:opacity-40"
|
||||
:class="transferType === option.value
|
||||
? 'border-brand-600 bg-brand-600 text-white hover:bg-brand-700'
|
||||
: 'border-brand-200 text-brand-700 hover:bg-brand-50'"
|
||||
:disabled="busy || !option.enabled"
|
||||
:title="option.enabled ? undefined : t('chat.transfer.transferTypeComingSoon')"
|
||||
:data-testid="`transfer-type-option-${option.value}`"
|
||||
@click="transferType = option.value"
|
||||
>
|
||||
{{ transferTypeLabel(option.value) }}
|
||||
<span v-if="!option.enabled" class="ml-1 font-normal opacity-70">{{ t('chat.transfer.transferTypeComingSoon') }}</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="mt-2 flex flex-wrap items-center gap-2">
|
||||
<span class="text-xs font-bold text-secondary">{{ $t('chat.transfer.receiptDateLabel') }}</span>
|
||||
<input
|
||||
v-model="dateFrom"
|
||||
type="date"
|
||||
class="rounded-lg border border-default bg-surface px-2 py-1 text-xs text-primary"
|
||||
data-testid="transfer-source-date-from"
|
||||
/>
|
||||
<span class="text-xs text-muted">~</span>
|
||||
<input
|
||||
v-model="dateTo"
|
||||
type="date"
|
||||
class="rounded-lg border border-default bg-surface px-2 py-1 text-xs text-primary"
|
||||
data-testid="transfer-source-date-to"
|
||||
/>
|
||||
<!-- D+1 规则属低频说明:收进原生 title 悬浮(渐进披露),避免长文案挤压布局。 -->
|
||||
<span
|
||||
class="cursor-help text-xs text-muted"
|
||||
:title="$t('chat.transfer.receiptDateHint')"
|
||||
data-testid="transfer-source-date-hint"
|
||||
>ⓘ</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- [ZONE 2] 选择辅助/上下文操作条:有选中时原位替换辅助区(批量操作惯例),未选中零死按钮。 -->
|
||||
<div v-if="selectedCount === 0" class="mb-3 flex flex-wrap items-center gap-2" data-testid="transfer-source-aids">
|
||||
<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 disabled:opacity-50"
|
||||
@@ -133,28 +209,45 @@ function confirm() {
|
||||
>
|
||||
{{ $t('chat.transfer.selectRetryable') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg bg-brand-600 px-3 py-1.5 text-xs font-bold text-white hover:bg-brand-700 disabled:opacity-50"
|
||||
:disabled="batchRetryDisabled"
|
||||
data-testid="transfer-source-batch-retry"
|
||||
@click="batchRetry"
|
||||
>
|
||||
{{ $t('chat.transfer.batchRetry') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-default px-3 py-1.5 text-xs font-bold text-secondary hover-surface-soft disabled:opacity-50"
|
||||
:disabled="busy"
|
||||
data-testid="transfer-source-clear"
|
||||
@click="clearSelected"
|
||||
>
|
||||
{{ $t('chat.transfer.clearSources') }}
|
||||
</button>
|
||||
<span class="ml-auto text-xs text-muted">
|
||||
</div>
|
||||
<div
|
||||
v-else
|
||||
class="mb-3 flex flex-wrap items-center gap-2 rounded-lg border border-brand-200 bg-brand-50 px-3 py-2"
|
||||
data-testid="transfer-source-action-bar"
|
||||
>
|
||||
<span class="text-xs font-bold text-secondary">
|
||||
{{ $t('chat.transfer.selectedSourceCount', { count: selectedCount }) }}
|
||||
<span v-if="selectedRetryableCount > 0" class="text-amber-600"> · {{ $t('chat.transfer.selectedRetryableCount', { count: selectedRetryableCount }) }}</span>
|
||||
</span>
|
||||
<span class="ml-auto flex flex-wrap items-center gap-2">
|
||||
<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 disabled:opacity-50"
|
||||
:disabled="batchRetryDisabled"
|
||||
data-testid="transfer-source-batch-retry"
|
||||
@click="batchRetry"
|
||||
>
|
||||
{{ $t('chat.transfer.batchRetry') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-default px-3 py-1.5 text-xs font-bold text-secondary hover-surface-soft disabled:opacity-50"
|
||||
:disabled="busy || downloadDisabled"
|
||||
data-testid="transfer-source-download"
|
||||
@click="downloadSelected"
|
||||
>
|
||||
{{ $t('chat.transfer.downloadFiles') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-lg border border-default px-3 py-1.5 text-xs font-bold text-secondary hover-surface-soft disabled:opacity-50"
|
||||
:disabled="busy"
|
||||
data-testid="transfer-source-clear"
|
||||
@click="clearSelected"
|
||||
>
|
||||
{{ $t('chat.transfer.clearSources') }}
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div v-for="platform in platforms" :key="platform" class="mb-3 rounded-lg border border-subtle">
|
||||
@@ -208,6 +301,13 @@ function confirm() {
|
||||
>
|
||||
{{ t('chat.transfer.fileFailed') }}
|
||||
</span>
|
||||
<span
|
||||
v-else-if="source.file_status === 'expired'"
|
||||
class="inline-flex items-center gap-1 rounded-full bg-orange-50 px-2 py-0.5 text-[10px] font-bold text-orange-700"
|
||||
:data-testid="`transfer-source-status-${source.source_code}`"
|
||||
>
|
||||
{{ t('chat.transfer.fileExpired') }}
|
||||
</span>
|
||||
<span
|
||||
v-else
|
||||
class="inline-flex items-center gap-1 rounded-full bg-surface-strong px-2 py-0.5 text-[10px] font-bold text-muted"
|
||||
@@ -230,8 +330,7 @@ function confirm() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="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 }) }}</span>
|
||||
<div class="flex items-center justify-end border-t border-subtle pt-3">
|
||||
<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"
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* features/chat/components/messages/transferBatch.spec.ts
|
||||
* 用途:覆盖批号转换规则。
|
||||
* 依赖:transferBatch、vitest。
|
||||
* 逻辑:WTP 前缀替换为 HOW;其余原样;空值安全。
|
||||
*/
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { deriveBatchNo } from './transferBatch';
|
||||
|
||||
describe('transferBatch', () => {
|
||||
it('replaces WTP prefix with HOW and keeps the rest', () => {
|
||||
expect(deriveBatchNo('WTP26082728')).toBe('HOW26082728');
|
||||
expect(deriveBatchNo('wtp26082728')).toBe('HOW26082728');
|
||||
});
|
||||
|
||||
it('returns non-WTP values unchanged', () => {
|
||||
expect(deriveBatchNo('HS000131')).toBe('HS000131');
|
||||
expect(deriveBatchNo('4294235')).toBe('4294235');
|
||||
});
|
||||
|
||||
it('returns empty string for empty input', () => {
|
||||
expect(deriveBatchNo('')).toBe('');
|
||||
expect(deriveBatchNo(null)).toBe('');
|
||||
expect(deriveBatchNo(undefined)).toBe('');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* features/chat/components/messages/transferBatch.ts
|
||||
* 用途:在途调拨批号转换规则(拨出/拨入批号展示)。
|
||||
* 依赖:无。
|
||||
* 逻辑:原批号以 WTP 开头时替换前缀为 HOW 获得真实批号;其余规则不变、原样展示。
|
||||
*/
|
||||
|
||||
/** 原批号(如 WMS 的 WTP26082728)→ 真实批号(HOW26082728);空值/非 WTP 原样返回。 */
|
||||
export function deriveBatchNo(lotNo: string | null | undefined): string {
|
||||
const value = String(lotNo ?? '').trim();
|
||||
if (!value) return '';
|
||||
if (value.toUpperCase().startsWith('WTP')) return `HOW${value.slice(3)}`;
|
||||
return value;
|
||||
}
|
||||
@@ -23,7 +23,7 @@ const summary = {
|
||||
expires_at: '',
|
||||
counts: { file_invoice_count: 3, not_matured_count: 1, prechecked_count: 2, executable_count: 2, blocked_count: 0 },
|
||||
estimated_transfer_quantity: '2400',
|
||||
estimated_erp_write_count: 2,
|
||||
estimated_external_write_count: 2,
|
||||
precheck_hash: 'sha256:x',
|
||||
};
|
||||
|
||||
@@ -82,6 +82,27 @@ describe('TransferPrecheckCard', () => {
|
||||
await wrapper.find('[data-testid="transfer-generate-button"]').trigger('click');
|
||||
expect(wrapper.emitted('execute')?.[0][0]).toEqual(['INV-001']);
|
||||
});
|
||||
|
||||
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' },
|
||||
];
|
||||
const wrapper = mount(TransferPrecheckCard, {
|
||||
props: { summary, items: dupItems, selected: new Set() },
|
||||
...mountOptions,
|
||||
});
|
||||
expect(wrapper.findAll('tbody tr').length).toBe(3);
|
||||
await wrapper.find('[data-testid="transfer-precheck-filter"]').setValue('HOX');
|
||||
const rows = wrapper.findAll('tbody tr');
|
||||
expect(rows.length).toBe(1);
|
||||
expect(rows[0].text()).toContain('HOX-1');
|
||||
});
|
||||
});
|
||||
|
||||
describe('TransferResultCard', () => {
|
||||
@@ -89,7 +110,7 @@ describe('TransferResultCard', () => {
|
||||
run_no: 'RUN-1',
|
||||
status: 'partial_failed',
|
||||
result: {
|
||||
erp_documents: [{
|
||||
external_documents: [{
|
||||
document_no: 'TRF-10001',
|
||||
from_warehouse: 'DBS-TRANSIT',
|
||||
to_warehouse: 'HUB-CN01',
|
||||
|
||||
@@ -31,7 +31,7 @@ const summary = {
|
||||
expires_at: '',
|
||||
counts: { file_invoice_count: 2, not_matured_count: 0, prechecked_count: 2, executable_count: 2, blocked_count: 0 },
|
||||
estimated_transfer_quantity: '2400',
|
||||
estimated_erp_write_count: 2,
|
||||
estimated_external_write_count: 2,
|
||||
precheck_hash: 'sha256:abc',
|
||||
};
|
||||
|
||||
@@ -54,7 +54,7 @@ describe('useChatTransfer', () => {
|
||||
api.getTransferRun.mockResolvedValue({
|
||||
run_no: 'RUN-20260806-1',
|
||||
status: 'success',
|
||||
result: { erp_documents: [], exceptions: [] },
|
||||
result: { external_documents: [], exceptions: [] },
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import type {
|
||||
TransferRunResult,
|
||||
TransferSourceOption,
|
||||
TransferSourceProgress,
|
||||
TransferType,
|
||||
} from '../types/transfer.types';
|
||||
|
||||
export function useChatTransfer() {
|
||||
@@ -59,12 +60,23 @@ export function useChatTransfer() {
|
||||
const selectedCount = computed(() => selected.value.size);
|
||||
const estimatedQuantity = computed(() => precheck.value?.estimated_transfer_quantity ?? '0');
|
||||
|
||||
/** 创建预检(缺文件时来源级阶段展示等待/失败) */
|
||||
async function createPrecheck(sourceCodes: string[], businessDate?: string) {
|
||||
/** 创建预检(缺文件时来源级阶段展示等待/失败);transferType 决定收料数据范围,缺省在途仓至HUB仓 */
|
||||
async function createPrecheck(
|
||||
sourceCodes: string[],
|
||||
businessDate?: string,
|
||||
dateRange?: { from?: string; to?: string },
|
||||
transferType?: TransferType,
|
||||
) {
|
||||
busy.value = true;
|
||||
error.value = '';
|
||||
try {
|
||||
const summary = await createTransferPrecheck({ source_codes: sourceCodes, business_date: businessDate });
|
||||
const summary = await createTransferPrecheck({
|
||||
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();
|
||||
return summary;
|
||||
@@ -165,7 +177,7 @@ export function useChatTransfer() {
|
||||
async function downloadErpInventory() {
|
||||
if (!runNo.value) return null;
|
||||
const result = await downloadTransferErpInventory(runNo.value);
|
||||
saveBlob(result.blob, result.filename ?? `erp-inventory-${runNo.value}.csv`);
|
||||
saveBlob(result.blob, result.filename ?? `external-inventory-${runNo.value}.csv`);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ const detail: TransferPrecheckDetail = {
|
||||
expires_at: '',
|
||||
counts: { file_invoice_count: 3, not_matured_count: 1, prechecked_count: 2, executable_count: 2, blocked_count: 0 },
|
||||
estimated_transfer_quantity: '2400',
|
||||
estimated_erp_write_count: 2,
|
||||
estimated_external_write_count: 2,
|
||||
precheck_hash: 'sha256:abc',
|
||||
},
|
||||
sources: [{ source_code: 'DBS-AWSBI', stage: 'file_ready', file_no: 'REC-1', file_version: 'v3' }],
|
||||
@@ -49,7 +49,7 @@ const runResult = {
|
||||
run_no: 'RUN-20260806-001',
|
||||
status: 'success',
|
||||
result: {
|
||||
erp_documents: [{
|
||||
external_documents: [{
|
||||
document_no: 'TRF-10001',
|
||||
from_warehouse: 'DBS-TRANSIT',
|
||||
to_warehouse: 'HUB-CN01',
|
||||
@@ -85,7 +85,7 @@ describe('in-transit-transfer e2e contract', () => {
|
||||
transfer.toggleSelect('INV-002', false);
|
||||
await transfer.execute();
|
||||
expect(api.executeTransferPrecheck).toHaveBeenCalledWith('TPC-20260806-001', ['INV-001']);
|
||||
expect(transfer.run.value?.result.erp_documents[0].document_no).toBe('TRF-10001');
|
||||
expect(transfer.run.value?.result.external_documents[0].document_no).toBe('TRF-10001');
|
||||
});
|
||||
|
||||
it('刷新恢复:重建 composable 后按 run_no 恢复最终结果(决策 17)', async () => {
|
||||
@@ -93,7 +93,7 @@ describe('in-transit-transfer e2e contract', () => {
|
||||
transfer.runNo.value = 'RUN-20260806-001';
|
||||
await transfer.refreshRun();
|
||||
expect(transfer.run.value?.status).toBe('success');
|
||||
expect(transfer.run.value?.result.erp_documents[0].material_count).toBe(2);
|
||||
expect(transfer.run.value?.result.external_documents[0].material_count).toBe(2);
|
||||
});
|
||||
|
||||
it('下载:收料来源文件与 ERP 库存表(决策 21/22 前端入口)', async () => {
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
* 逻辑:卡片/组合式函数只消费这些稳定类型;状态与后端 13 状态集对齐。
|
||||
*/
|
||||
|
||||
/** 调拨业务类型(与后端 TransferType 枚举一致;类型 2/3 一期占位未开放) */
|
||||
export type TransferType = 'in_transit_to_hub' | 'hub_repair_out' | 'hub_to_hub';
|
||||
|
||||
/** 预检计数 */
|
||||
export interface TransferPrecheckCounts {
|
||||
file_invoice_count: number;
|
||||
@@ -30,7 +33,7 @@ export interface TransferPrecheckSummary {
|
||||
expires_at: string;
|
||||
counts: TransferPrecheckCounts;
|
||||
estimated_transfer_quantity: string;
|
||||
estimated_erp_write_count: number;
|
||||
estimated_external_write_count: number;
|
||||
precheck_hash: string;
|
||||
}
|
||||
|
||||
@@ -50,6 +53,7 @@ export interface TransferPrecheckItem {
|
||||
reason?: string;
|
||||
erp_document_no?: string | null;
|
||||
raw_lines?: TransferRawLine[];
|
||||
lot_no?: string;
|
||||
}
|
||||
|
||||
/** 来源实例级进度(决策 18:来源隔离展示) */
|
||||
@@ -104,7 +108,7 @@ export interface TransferRunResult {
|
||||
run_no: string;
|
||||
status: string;
|
||||
result: {
|
||||
erp_documents: ErpDocument[];
|
||||
external_documents: ErpDocument[];
|
||||
exceptions: TransferExceptionItem[];
|
||||
};
|
||||
}
|
||||
@@ -156,8 +160,8 @@ export interface TransferSourceOption {
|
||||
display_name: string;
|
||||
platform: string;
|
||||
enabled: boolean;
|
||||
/** 收料文件状态:ready / fetching / failed / none(只读投影货代收料事实) */
|
||||
file_status?: 'ready' | 'fetching' | 'failed' | 'none';
|
||||
/** 收料文件状态:ready / fetching / failed / expired / none(只读投影货代收料事实) */
|
||||
file_status?: 'ready' | 'fetching' | 'failed' | 'expired' | 'none';
|
||||
/** 是否已有当前可用的收料文件(门禁:无 ready 文件禁止确认预检) */
|
||||
has_ready_file?: boolean;
|
||||
file_no?: string | null;
|
||||
@@ -167,7 +171,7 @@ export interface TransferSourceOption {
|
||||
/** 来源收料文件状态(门禁 + 状态标识 + 重试返回) */
|
||||
export interface TransferSourceFileStatus {
|
||||
source_code: string;
|
||||
file_status: 'ready' | 'fetching' | 'failed' | 'none';
|
||||
file_status: 'ready' | 'fetching' | 'failed' | 'expired' | 'none';
|
||||
has_ready_file: boolean;
|
||||
file_no?: string | null;
|
||||
file_sha256?: string | null;
|
||||
|
||||
@@ -653,6 +653,22 @@ async function mountView(query: Record<string, string> = {}) {
|
||||
moreActions: '更多操作',
|
||||
inventorySource: '库存源',
|
||||
},
|
||||
lineActions: {
|
||||
closeLine: '结案(不再发货)',
|
||||
closeLineConfirm: '确认结案',
|
||||
editLine: '编辑',
|
||||
more: '更多操作',
|
||||
},
|
||||
inlineEdit: {
|
||||
save: '保存',
|
||||
cancel: '取消',
|
||||
busy: '系统处理中,请稍后再修改',
|
||||
},
|
||||
releaseBar: {
|
||||
label: '放行补录',
|
||||
missingPrefix: '缺 ',
|
||||
missingSuffix: ' 项放行信息',
|
||||
},
|
||||
workflowProgress: {
|
||||
automatingFooterHint: '系统自动推进中',
|
||||
},
|
||||
@@ -682,6 +698,9 @@ async function mountView(query: Record<string, string> = {}) {
|
||||
downloadInventory: '下载库存文件',
|
||||
retryInventory: '重新获取库存',
|
||||
releaseShortage: '库存缺口放行',
|
||||
releaseShortageHint: '放行后本次发货按缺口处理。',
|
||||
releaseReasonPlaceholder: '可填写放行原因(选填)',
|
||||
releaseConfirm: '确认放行',
|
||||
shortage: '库存不足',
|
||||
pending: '库存匹配或通知文件尚未生成。',
|
||||
},
|
||||
@@ -733,6 +752,9 @@ async function mountView(query: Record<string, string> = {}) {
|
||||
processGate: {
|
||||
inventoryActions: {
|
||||
retryInventoryPreparation: '重新获取库存(RPA)',
|
||||
retryInventoryMatching: '重新匹配库存',
|
||||
downloadInventoryFile: '下载库存文件',
|
||||
releaseInventoryShortage: '库存缺口放行',
|
||||
},
|
||||
actionCodes: {
|
||||
confirm_customer: '确认客户',
|
||||
@@ -792,6 +814,27 @@ async function mountView(query: Record<string, string> = {}) {
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开通知准备行的更多操作菜单(⋯)。
|
||||
* 核心逻辑:展示态行级动作(重试/放行/下载)已收纳进该菜单,入口按钮在表格行内。
|
||||
*/
|
||||
async function openLineOverflowMenu(wrapper: { get: (selector: string) => { trigger: (event: string) => Promise<void> } }, lineId: number | string) {
|
||||
await wrapper.get(`[data-testid="review-fulfillment-line-more-${lineId}"]`).trigger('click');
|
||||
await nextTick();
|
||||
}
|
||||
|
||||
/**
|
||||
* 断言行级菜单项已渲染并触发点击。
|
||||
* 核心逻辑:菜单经 Teleport 渲染到 body,必须走 document.body 查询而不是 wrapper.find;
|
||||
* 点击后 flushPromises 等待菜单收起与异步动作(下载/门禁提交)落位。
|
||||
*/
|
||||
async function clickLineMenuItem(lineId: number | string, action: string) {
|
||||
const item = document.body.querySelector(`[data-testid="review-fulfillment-line-action-${action}-${lineId}"]`) as HTMLButtonElement | null;
|
||||
expect(item, `行级菜单项 ${action}-${lineId} 应已渲染`).toBeTruthy();
|
||||
item!.click();
|
||||
await flushPromises();
|
||||
}
|
||||
|
||||
/** 将共享 Case fixture 恢复为可编辑草稿,避免跨用例污染确认恢复态。 */
|
||||
function resetActiveCaseFixture() {
|
||||
activeCase.value = createActiveCaseFixture();
|
||||
@@ -2677,16 +2720,17 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
expect(workspace.text()).toContain('PN-FROZEN');
|
||||
expect(workspace.text()).toContain('DBS');
|
||||
expect(wrapper.find('[data-testid="review-fulfillment-frozen-order"]').exists()).toBe(false);
|
||||
expect(wrapper.get('[data-testid="review-fulfillment-line-download-1001"]').attributes('title'))
|
||||
.toBeTruthy();
|
||||
expect(wrapper.get('[data-testid="review-fulfillment-line-retry-preparation-1001"]').attributes('title'))
|
||||
.toBeTruthy();
|
||||
expect(wrapper.get('[data-testid="review-fulfillment-line-retry-matching-1001"]').exists()).toBe(true);
|
||||
expect(wrapper.get('[data-testid="review-fulfillment-line-release-1001"]').exists()).toBe(true);
|
||||
// 展示态行级动作收纳进更多菜单(⋯):逐项断言授权动作入口存在,不再有常显按钮。
|
||||
await openLineOverflowMenu(wrapper, 1001);
|
||||
expect(document.body.querySelector('[data-testid="review-fulfillment-line-action-download_inventory_file-1001"]')).toBeTruthy();
|
||||
expect(document.body.querySelector('[data-testid="review-fulfillment-line-action-retry_inventory_preparation-1001"]')).toBeTruthy();
|
||||
expect(document.body.querySelector('[data-testid="review-fulfillment-line-action-retry_inventory_matching-1001"]')).toBeTruthy();
|
||||
expect(document.body.querySelector('[data-testid="review-fulfillment-line-action-release_inventory_shortage-1001"]')).toBeTruthy();
|
||||
expect(workspace.text()).toContain('库存不足');
|
||||
await wrapper.get('[data-testid="review-fulfillment-line-download-1001"]').trigger('click');
|
||||
await clickLineMenuItem(1001, 'download_inventory_file');
|
||||
expect(downloadWorkspaceShippingLineInventoryFileMock).toHaveBeenCalledWith('SN-FROZEN', 'SIF-LINE-DBS');
|
||||
await wrapper.get('[data-testid="review-fulfillment-line-retry-preparation-1001"]').trigger('click');
|
||||
await openLineOverflowMenu(wrapper, 1001);
|
||||
await clickLineMenuItem(1001, 'retry_inventory_preparation');
|
||||
expect(submitProcessGatePrimaryActionMock).toHaveBeenCalledWith(
|
||||
expect.any(Object),
|
||||
expect.objectContaining({
|
||||
@@ -2696,7 +2740,8 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
);
|
||||
// Gate 恢复受理后立即启动五阶段轮询,不依赖浏览器手动刷新。
|
||||
expect(startWorkflowProgressPollingMock).toHaveBeenCalledTimes(1);
|
||||
await wrapper.get('[data-testid="review-fulfillment-line-release-1001"]').trigger('click');
|
||||
await openLineOverflowMenu(wrapper, 1001);
|
||||
await clickLineMenuItem(1001, 'release_inventory_shortage');
|
||||
expect(wrapper.get('[data-testid="review-release-inventory-dialog"]').text()).toContain('ODM ID');
|
||||
expect(wrapper.get('[data-testid="review-release-inventory-dialog"]').text()).toContain('ODM-001');
|
||||
const dialog = wrapper.get('[data-testid="review-release-inventory-dialog"]');
|
||||
@@ -2763,11 +2808,11 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
|
||||
const wrapper = await mountView({ lifecycle_stage: 'fulfillment_prep' });
|
||||
await flushPromises();
|
||||
await wrapper.get('[data-testid="review-fulfillment-line-release-1001"]').trigger('click');
|
||||
const dialog = wrapper.get('[data-testid="review-release-inventory-dialog"]');
|
||||
await dialog.find('textarea').setValue('客户确认分批发货');
|
||||
await dialog.find('input').setValue('A-01');
|
||||
await dialog.get('button.bg-amber-600').trigger('click');
|
||||
// 缺字段短缺行:放行入口在更多菜单,必填补录在行内补录条完成(原因不再强制)。
|
||||
await openLineOverflowMenu(wrapper, 1001);
|
||||
await clickLineMenuItem(1001, 'release_inventory_shortage');
|
||||
await wrapper.get('[data-testid="review-fulfillment-release-input-1001-102"]').setValue('A-01');
|
||||
await wrapper.get('[data-testid="review-fulfillment-release-confirm-1001"]').trigger('click');
|
||||
await new Promise<void>((resolve) => setTimeout(resolve, 0));
|
||||
await nextTick();
|
||||
|
||||
@@ -2823,11 +2868,10 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
|
||||
const wrapper = await mountView({ lifecycle_stage: 'fulfillment_prep' });
|
||||
await flushPromises();
|
||||
await wrapper.get('[data-testid="review-fulfillment-line-release-1002"]').trigger('click');
|
||||
const dialog = wrapper.get('[data-testid="review-release-inventory-dialog"]');
|
||||
await dialog.find('textarea').setValue('客户确认单行放行');
|
||||
await dialog.find('input').setValue('A-01');
|
||||
await dialog.get('button.bg-amber-600').trigger('click');
|
||||
await openLineOverflowMenu(wrapper, 1002);
|
||||
await clickLineMenuItem(1002, 'release_inventory_shortage');
|
||||
await wrapper.get('[data-testid="review-fulfillment-release-input-1002-102"]').setValue('A-01');
|
||||
await wrapper.get('[data-testid="review-fulfillment-release-confirm-1002"]').trigger('click');
|
||||
await new Promise<void>((resolve) => setTimeout(resolve, 0));
|
||||
await nextTick();
|
||||
|
||||
@@ -2899,11 +2943,10 @@ describe('ShippingOrderReviewView layout phase 1', () => {
|
||||
});
|
||||
|
||||
const wrapper = await mountView({ lifecycle_stage: 'fulfillment_prep' });
|
||||
await wrapper.get('[data-testid="review-fulfillment-line-release-1003"]').trigger('click');
|
||||
const dialog = wrapper.get('[data-testid="review-release-inventory-dialog"]');
|
||||
await dialog.find('textarea').setValue('客户确认分批发货');
|
||||
await dialog.find('input').setValue('A-01');
|
||||
await dialog.get('button.bg-amber-600').trigger('click');
|
||||
await openLineOverflowMenu(wrapper, 1003);
|
||||
await clickLineMenuItem(1003, 'release_inventory_shortage');
|
||||
await wrapper.get('[data-testid="review-fulfillment-release-input-1003-102"]').setValue('A-01');
|
||||
await wrapper.get('[data-testid="review-fulfillment-release-confirm-1003"]').trigger('click');
|
||||
await wrapper.get('[data-testid="review-lifecycle-stage-fulfillment_prep"]').findAll('button')[1].trigger('click');
|
||||
resolvePostReleaseTask?.(taskDetail());
|
||||
await new Promise<void>((resolve) => setTimeout(resolve, 0));
|
||||
|
||||
@@ -449,7 +449,18 @@ const isLifecycleFreightUpload = computed(() => lifecycleActiveStageCode.value =
|
||||
const isLifecycleUploadComplete = computed(() => lifecycleActiveStageCode.value === 'upload_complete');
|
||||
/** 正式任务已通知完成时,即使用户回看前置阶段也只能查看,不能再修改已产出通知。 */
|
||||
const isCompletedFormalTask = computed(() => lifecycleCurrentStageCode.value === 'upload_complete');
|
||||
const isReviewContentReadOnly = computed(() => isReadOnly.value || isCompletedFormalTask.value);
|
||||
/**
|
||||
* STP 自动建单进行中(等待入队/排队/执行):与 isProcessingAutomating 的 STP 分支同源。
|
||||
* 期间表单只读——后端 `_locked_case` 同步拒绝内容写入(REVIEW_DRAFT_LOCKED_BY_AUTOMATION),
|
||||
* 前端不再展示可编辑假象,避免用户误以为修改已生效。
|
||||
*/
|
||||
const isStpAutoCreateInProgress = computed(() => {
|
||||
const stpStatus = String(activeCase.value?.automation?.status || '').trim().toLowerCase();
|
||||
return !hasFormalOt.value && ['waiting_to_start', 'queued', 'running'].includes(stpStatus);
|
||||
});
|
||||
const isReviewContentReadOnly = computed(() => (
|
||||
isReadOnly.value || isCompletedFormalTask.value || isStpAutoCreateInProgress.value
|
||||
));
|
||||
|
||||
/** 二期编辑窗(D10):读正式任务 ui_state.edit_window;前端 fail-closed,锁定字段禁用/提示。 */
|
||||
const formalEditWindow = computed(() => formalTaskDetail.value?.ui_state?.edit_window ?? null);
|
||||
@@ -5319,7 +5330,7 @@ watch(
|
||||
<div class="overflow-x-auto overscroll-x-contain" data-testid="review-fulfillment-prep-table-scroll">
|
||||
<table class="review-fulfillment-prep-table min-w-[1060px] text-xs">
|
||||
<thead class="border-b border-default bg-surface-muted/50 text-left"><tr><th v-if="preparationEditable" class="w-10 px-3 py-2"><input type="checkbox" class="rounded border-default" :checked="allPreparationWaveSelected" :disabled="!preparationWaveSelectableLines.length || preparationWaveBusy" :aria-label="t('chat.shippingOrderReview.fulfillmentDecision.selectReady')" @change="toggleAllPreparationLineSelection(($event.target as HTMLInputElement).checked)"></th><th v-if="preparationCustomerPoLineVisible" class="whitespace-nowrap px-3 py-2">{{ preparationCustomerPoLineLabel() }}</th><th class="whitespace-nowrap px-3 py-2">{{ t('chat.shippingOrderReview.workbench.resultReservation') }}</th><th class="px-3 py-2">{{ t('chat.shippingOrderReview.workbench.resultPartNumber') }}</th><th class="whitespace-nowrap px-3 py-2">{{ t('chat.shippingOrderReview.lifecycle.prepare.requiredQty') }}</th><th class="px-3 py-2">{{ t('chat.shippingOrderReview.lifecycle.prepare.inventorySource') }}</th><th v-if="formalPreparationOdmColumnVisible" class="whitespace-nowrap px-3 py-2">{{ t('chat.shippingOrderReview.odmConflict.column') }}</th><th class="whitespace-nowrap px-3 py-2">{{ t('chat.shippingOrderReview.fulfillmentDecision.availableQty') }}</th><th class="whitespace-nowrap px-3 py-2">{{ t('chat.shippingOrderReview.fulfillmentDecision.shortage') }}</th><th class="whitespace-nowrap px-3 py-2">{{ t('chat.shippingOrderReview.lifecycle.prepare.lineStatus') }}</th><th class="review-fulfillment-sticky-action-head whitespace-nowrap px-3 py-2">{{ t('chat.shippingOrderReview.lineOps.moreActions') }}</th></tr></thead>
|
||||
<tbody><template v-for="(line, lineIndex) in formalPreparationDisplayLines" :key="line.snapshot_line_id || `${line.reservation_id}-${line.part_number}`"><tr :class="Number(line.shortage_qty || 0) > 0 ? 'border-b border-amber-100 bg-amber-50/40 last:border-0 dark:border-amber-950 dark:bg-amber-950/10' : 'border-b border-default last:border-0'"><td v-if="preparationEditable" class="w-10 px-3 py-2"><input type="checkbox" class="rounded border-default" :checked="selectedPreparationSnapshotLineIds.includes(String(line.snapshot_line_id))" :disabled="preparationWaveBusy || !preparationWaveSelectableLines.some((item) => String(item.snapshot_line_id) === String(line.snapshot_line_id))" :aria-label="`${t('chat.shippingOrderReview.fulfillmentDecision.selectReady')}: ${preparationLineCustomerPoLine(line)}`" :data-testid="`review-fulfillment-line-select-${line.snapshot_line_id || lineIndex}`" @change="togglePreparationLineSelection(String(line.snapshot_line_id || lineIndex), ($event.target as HTMLInputElement).checked)"></td><td v-if="preparationCustomerPoLineVisible" class="whitespace-nowrap px-3 py-2">{{ preparationLineCustomerPoLine(line) }}</td><td class="whitespace-nowrap px-3 py-2 font-medium text-primary"><template v-if="editingLine && isInlineEditing(line)"><input v-model="editingLine.reservation_id" type="text" class="w-28 rounded border border-default bg-surface px-1.5 py-1 text-xs" :disabled="inlineEditSaving" :aria-label="t('chat.shippingOrderReview.workbench.resultReservation')" :data-testid="`review-fulfillment-line-edit-reservation-${line.snapshot_line_id}`" @keyup.enter="saveInlineEdit(line)" @keyup.esc="cancelInlineEdit" /></template><span v-else>{{ line.reservation_id || '—' }}</span></td><td class="max-w-[220px] px-3 py-2"><template v-if="editingLine && isInlineEditing(line)"><input v-model="editingLine.part_number" type="text" class="w-full min-w-0 rounded border border-default bg-surface px-1.5 py-1 text-xs" :disabled="inlineEditSaving" :aria-label="t('chat.shippingOrderReview.workbench.resultPartNumber')" :data-testid="`review-fulfillment-line-edit-part-${line.snapshot_line_id}`" @keyup.enter="saveInlineEdit(line)" @keyup.esc="cancelInlineEdit" /></template><span v-else class="block max-w-[220px] truncate" :title="line.part_number || '—'">{{ line.part_number || '—' }}</span></td><td class="whitespace-nowrap px-3 py-2"><template v-if="editingLine && isInlineEditing(line)"><input :value="editingLine.required_qty" type="number" min="0" step="any" class="w-20 rounded border border-default bg-surface px-1.5 py-1 text-xs" :disabled="inlineEditSaving" :aria-label="t('chat.shippingOrderReview.lifecycle.prepare.requiredQty')" :data-testid="`review-fulfillment-line-edit-qty-${line.snapshot_line_id}`" @input="updateInlineEditQty(($event.target as HTMLInputElement).value)" @keyup.enter="saveInlineEdit(line)" @keyup.esc="cancelInlineEdit" /></template><span v-else>{{ line.required_qty ?? '—' }}</span></td><td class="max-w-[220px] px-3 py-2"><template v-if="isInlineEditing(line) && inlineSourceOptions(line).length"><select class="w-full min-w-0 rounded border border-default bg-surface px-1.5 py-1 text-xs" :data-testid="`review-fulfillment-line-edit-source-${line.snapshot_line_id}`" :aria-label="t('chat.shippingOrderReview.lifecycle.prepare.selectSource')" :value="editingLine?.source_code" :disabled="inlineEditSaving" @change="updateInlineEditSource(($event.target as HTMLSelectElement).value)"><option v-for="option in inlineSourceOptions(line)" :key="option.value" :value="option.value">{{ option.label }}</option></select></template><span v-else class="block max-w-[220px] truncate" :title="formalPreparationLineSource(line)">{{ formalPreparationLineSource(line) || '—' }}</span></td><td v-if="formalPreparationOdmColumnVisible" class="whitespace-nowrap px-3 py-2"><div v-if="(line.odm_values?.length || 0) > 1 && !formalPreparationSourceLocked" class="flex items-center gap-1" :data-testid="`review-line-odm-${line.snapshot_line_id || lineIndex}`"><select class="min-w-0 flex-1 rounded border border-default bg-surface px-1.5 py-1 text-xs" :data-testid="`review-line-odm-select-${line.snapshot_line_id || lineIndex}`" :aria-label="t('chat.shippingOrderReview.odmConflict.title')" :value="lineOdmSelections[String(line.snapshot_line_id || lineIndex)] || line.chosen_odm_id || ''" @change="lineOdmSelections[String(line.snapshot_line_id || lineIndex)] = ($event.target as HTMLSelectElement).value"><option value="" disabled>{{ t('chat.shippingOrderReview.odmConflict.placeholder') }}</option><option v-for="value in line.odm_values" :key="value" :value="value">{{ value }}</option></select><button type="button" class="rounded bg-brand-600 px-2 py-1 text-xs font-medium text-white disabled:opacity-50" :data-testid="`review-line-odm-confirm-${line.snapshot_line_id || lineIndex}`" :disabled="!lineOdmSelections[String(line.snapshot_line_id || lineIndex)] || lineOdmBusy" :aria-label="t('chat.shippingOrderReLine truncated
|
||||
<tbody><template v-for="(line, lineIndex) in formalPreparationDisplayLines" :key="line.snapshot_line_id || `${line.reservation_id}-${line.part_number}`"><tr :class="Number(line.shortage_qty || 0) > 0 ? 'border-b border-amber-100 bg-amber-50/40 last:border-0 dark:border-amber-950 dark:bg-amber-950/10' : 'border-b border-default last:border-0'"><td v-if="preparationEditable" class="w-10 px-3 py-2"><input type="checkbox" class="rounded border-default" :checked="selectedPreparationSnapshotLineIds.includes(String(line.snapshot_line_id))" :disabled="preparationWaveBusy || !preparationWaveSelectableLines.some((item) => String(item.snapshot_line_id) === String(line.snapshot_line_id))" :aria-label="`${t('chat.shippingOrderReview.fulfillmentDecision.selectReady')}: ${preparationLineCustomerPoLine(line)}`" :data-testid="`review-fulfillment-line-select-${line.snapshot_line_id || lineIndex}`" @change="togglePreparationLineSelection(String(line.snapshot_line_id || lineIndex), ($event.target as HTMLInputElement).checked)"></td><td v-if="preparationCustomerPoLineVisible" class="whitespace-nowrap px-3 py-2">{{ preparationLineCustomerPoLine(line) }}</td><td class="whitespace-nowrap px-3 py-2 font-medium text-primary"><template v-if="editingLine && isInlineEditing(line)"><input v-model="editingLine.reservation_id" type="text" class="w-28 rounded border border-default bg-surface px-1.5 py-1 text-xs" :disabled="inlineEditSaving" :aria-label="t('chat.shippingOrderReview.workbench.resultReservation')" :data-testid="`review-fulfillment-line-edit-reservation-${line.snapshot_line_id}`" @keyup.enter="saveInlineEdit(line)" @keyup.esc="cancelInlineEdit" /></template><span v-else>{{ line.reservation_id || '—' }}</span></td><td class="max-w-[220px] px-3 py-2"><template v-if="editingLine && isInlineEditing(line)"><input v-model="editingLine.part_number" type="text" class="w-full min-w-0 rounded border border-default bg-surface px-1.5 py-1 text-xs" :disabled="inlineEditSaving" :aria-label="t('chat.shippingOrderReview.workbench.resultPartNumber')" :data-testid="`review-fulfillment-line-edit-part-${line.snapshot_line_id}`" @keyup.enter="saveInlineEdit(line)" @keyup.esc="cancelInlineEdit" /></template><span v-else class="block max-w-[220px] truncate" :title="line.part_number || '—'">{{ line.part_number || '—' }}</span></td><td class="whitespace-nowrap px-3 py-2"><template v-if="editingLine && isInlineEditing(line)"><input :value="editingLine.required_qty" type="number" min="0" step="any" class="w-20 rounded border border-default bg-surface px-1.5 py-1 text-xs" :disabled="inlineEditSaving" :aria-label="t('chat.shippingOrderReview.lifecycle.prepare.requiredQty')" :data-testid="`review-fulfillment-line-edit-qty-${line.snapshot_line_id}`" @input="updateInlineEditQty(($event.target as HTMLInputElement).value)" @keyup.enter="saveInlineEdit(line)" @keyup.esc="cancelInlineEdit" /></template><span v-else>{{ line.required_qty ?? '—' }}</span></td><td class="max-w-[220px] px-3 py-2"><template v-if="isInlineEditing(line) && inlineSourceOptions(line).length"><select class="w-full min-w-0 rounded border border-default bg-surface px-1.5 py-1 text-xs" :data-testid="`review-fulfillment-line-edit-source-${line.snapshot_line_id}`" :aria-label="t('chat.shippingOrderReview.lifecycle.prepare.selectSource')" :value="editingLine?.source_code" :disabled="inlineEditSaving" @change="updateInlineEditSource(($event.target as HTMLSelectElement).value)"><option v-for="option in inlineSourceOptions(line)" :key="option.value" :value="option.value">{{ option.label }}</option></select></template><span v-else class="block max-w-[220px] truncate" :title="formalPreparationLineSource(line)">{{ formalPreparationLineSource(line) || '—' }}</span></td><td v-if="formalPreparationOdmColumnVisible" class="whitespace-nowrap px-3 py-2"><div v-if="(line.odm_values?.length || 0) > 1 && !formalPreparationSourceLocked" class="flex items-center gap-1" :data-testid="`review-line-odm-${line.snapshot_line_id || lineIndex}`"><select class="min-w-0 flex-1 rounded border border-default bg-surface px-1.5 py-1 text-xs" :data-testid="`review-line-odm-select-${line.snapshot_line_id || lineIndex}`" :aria-label="t('chat.shippingOrderReview.odmConflict.title')" :value="lineOdmSelections[String(line.snapshot_line_id || lineIndex)] || line.chosen_odm_id || ''" @change="lineOdmSelections[String(line.snapshot_line_id || lineIndex)] = ($event.target as HTMLSelectElement).value"><option value="" disabled>{{ t('chat.shippingOrderReview.odmConflict.placeholder') }}</option><option v-for="value in line.odm_values" :key="value" :value="value">{{ value }}</option></select><button type="button" class="rounded bg-brand-600 px-2 py-1 text-xs font-medium text-white disabled:opacity-50" :data-testid="`review-line-odm-confirm-${line.snapshot_line_id || lineIndex}`" :disabled="!lineOdmSelections[String(line.snapshot_line_id || lineIndex)] || lineOdmBusy" :aria-label="t('chat.shippingOrderReLine truncated
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -6143,6 +6154,8 @@ watch(
|
||||
@adjudicate="({ suggestion, body }) => decideSuggestion(suggestion.suggestion_no, body)"
|
||||
/>
|
||||
|
||||
<!-- 底栏只读不含 STP 运行锁(isStpAutoCreateInProgress):运行态已由 automating 单独承载
|
||||
(隐藏全部写按钮并显示运行提示);叠加会让 footer 整体隐藏,运行提示永远不可见。 -->
|
||||
<ReviewWorkbenchFooter
|
||||
v-if="showOrderReviewEditor || isLifecycleIntakeParse"
|
||||
:available-actions="availableActions"
|
||||
@@ -6152,7 +6165,7 @@ watch(
|
||||
:show-stp-retry="showObjectRetryOnFooter"
|
||||
:auto-gate-hint="t(autoGateHintKey)"
|
||||
:saving="saving"
|
||||
:is-read-only="isReviewContentReadOnly"
|
||||
:is-read-only="isReadOnly || isCompletedFormalTask"
|
||||
:has-draft="Boolean(displayCase?.draft) || isLifecycleIntakeParse"
|
||||
:unsaved-count="unsavedEditCount"
|
||||
:flow-presentation="flowPresentation"
|
||||
|
||||
@@ -635,7 +635,9 @@
|
||||
"pathSectionConfigured": "Configured",
|
||||
"pathSectionNotConfigured": "Not configured",
|
||||
"parsingProfiles": "Inventory Parsing",
|
||||
"parsingProfilesHelp": "Maintain inventory file structures, field mappings, and order-field match keys shared by inventory sites.",
|
||||
"parsingProfilesHelp": "Maintain reusable file parsing rules: inventory parsing targets the inventory field catalog and order match keys; receipt movement targets the standard movement fields (read-only contract).",
|
||||
"inventoryParsing": { "code": "Inventory Parsing Code", "name": "Inventory Parsing Name", "sampleFile": "Inventory Sample File", "sampleFileHint": "Upload an Excel or CSV file. The system reads worksheets, headers, and a small sample for plan confirmation.", "sampleRequired": "Upload an inventory sample file and complete structure recognition first.", "sourceHeader": "Inventory File Header", "fieldMappings": "Inventory Standard Field Mappings", "analysisPreview": "Inventory Analysis Preview" },
|
||||
"movementParsing": { "code": "Movement Parsing Code", "name": "Movement Parsing Name", "sampleFile": "Receipt Sample File", "sampleFileHint": "Upload an Excel or CSV file. The system reads worksheets, headers, and a small sample for movement parsing confirmation.", "sampleRequired": "Upload a receipt movement sample file and complete structure recognition first.", "sourceHeader": "Movement File Header", "fieldMappings": "Standard Movement Field Mappings", "analysisPreview": "Movement Analysis Preview" },
|
||||
"inventoryMapping": "Inventory Parsing",
|
||||
"inventoryMappingPlans": "Parsing Rules",
|
||||
"inventoryFields": "Inventory Field Catalog",
|
||||
@@ -690,6 +692,21 @@
|
||||
"inventorySampleAnalysing": "Analysing inventory file structure...",
|
||||
"inventorySampleRequired": "Upload an inventory sample file and complete structure recognition first.",
|
||||
"parsingProfileName": "Inventory Parsing Name",
|
||||
"parsingPurposeLabel": "Rule Purpose",
|
||||
"parsingPurposeHint": "Purpose cannot be changed after creation: inventory parsing uses the inventory field catalog, receipt movement uses the standard movement fields (read-only contract).",
|
||||
"parsingPurpose": { "inventory": "Inventory Parsing", "movement": "Receipt Movement" },
|
||||
"movementMappingHint": "Standard movement fields are a read-only business contract (✱ required, 🔑 match identity). Just pick the report header alias for each field.",
|
||||
"movementRequiredMark": "Required",
|
||||
"movementIdentityMark": "Match identity",
|
||||
"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).",
|
||||
"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.",
|
||||
"quantity": "Quantity", "movement_date": "Movement Date"
|
||||
},
|
||||
"inventoryAnalysisFailed": "Inventory file structure recognition failed.",
|
||||
"inventoryAnalysisPreview": "Recognition Preview",
|
||||
"inventoryAnalysisSummary": "Found {candidate_count} candidate headers with {sample_row_count} sample rows and suggested {valid_inventory_field_suggestions} inventory fields.",
|
||||
@@ -826,8 +843,7 @@
|
||||
"exports": "Export Records",
|
||||
"exportsHelp": "Read-only inventory export results. Retries and manual exports are not initiated here.",
|
||||
"externalMappings": "Warehouse Mapping",
|
||||
"mappingsHelp": "Map a freight warehouse, or a source default, to an external system warehouse code.",
|
||||
"defaultMapping": "Source Default Mapping",
|
||||
"mappingsHelp": "Map an inventory source to external system warehouse and in-transit warehouse codes; freight warehouse is optional and used as the receipt-warehouse matching key.",
|
||||
"loadFailed": "Failed to load shipping inventory configuration",
|
||||
"createNew": "New",
|
||||
"saving": "Saving...",
|
||||
@@ -1036,12 +1052,13 @@
|
||||
"publishedImmutable": "Published rules are retained as immutable audit definitions. Create and publish a new rule instead.",
|
||||
"source": "Inventory Source",
|
||||
"chooseSource": "Select an inventory source",
|
||||
"freightWarehouse": "Freight Warehouse (optional)",
|
||||
"freightWarehouse": "Freight Warehouse",
|
||||
"externalSystem": "Target system",
|
||||
"externalOrganization": "Target organization (optional)",
|
||||
"externalSite": "Target site (optional)",
|
||||
"externalWarehouseCode": "Target warehouse code",
|
||||
"externalWarehouseName": "Target warehouse name",
|
||||
"inTransitWarehouseCode": "In-transit warehouse code",
|
||||
"snapshotStatus": "Snapshot Status",
|
||||
"snapshotFile": "Snapshot file",
|
||||
"expiresAt": "Valid until",
|
||||
@@ -5141,7 +5158,6 @@
|
||||
"title": "Integration Connector",
|
||||
"subtitle": "Configure external system clients, interface templates and response mapping, then bind them to capabilities; this is the integration config that makes auto-transfer run.",
|
||||
"add": "Add",
|
||||
"formHint": "Maintain JSON fields in the editor; the publish status decides whether a config is used by the Worker.",
|
||||
"call": "Call",
|
||||
"test": "Test Connection",
|
||||
"empty": "No data",
|
||||
@@ -5152,6 +5168,48 @@
|
||||
"credential": "Credential References",
|
||||
"capability": "Capabilities"
|
||||
},
|
||||
"statusLabels": {
|
||||
"draft": "Draft",
|
||||
"published": "Published",
|
||||
"retired": "Retired",
|
||||
"active": "Active",
|
||||
"rotating": "Rotating",
|
||||
"db": "UI-managed (encrypted)",
|
||||
"env": "Environment variable"
|
||||
},
|
||||
"envLabels": {
|
||||
"dev": "Dev",
|
||||
"test": "Test",
|
||||
"prod": "Prod"
|
||||
},
|
||||
"capabilityLabels": {
|
||||
"in_transit_transfer": {
|
||||
"create_transfer": "Create transfer",
|
||||
"query_inventory": "In-transit inventory query",
|
||||
"verify_duplicate": "Duplicate check"
|
||||
}
|
||||
},
|
||||
"writeLabels": { "yes": "Yes", "no": "No" },
|
||||
"idempotencyLabels": { "none": "None", "invoice": "Idempotent by document no." },
|
||||
"credentialTypeLabels": {
|
||||
"password": "Username + Password",
|
||||
"token": "Token",
|
||||
"api_key": "API Key"
|
||||
},
|
||||
"lifecycle": {
|
||||
"publish": "Publish",
|
||||
"unpublish": "Unpublish",
|
||||
"retire": "Retire",
|
||||
"reopen": "Reopen draft"
|
||||
},
|
||||
"formHints": {
|
||||
"client": "The code is the unique identifier referenced by interface definitions and bindings; it cannot be changed after saving.",
|
||||
"interface": "The code can be auto-generated; the JSON contract is the interface itself and is maintained in the editors; only a published interface is picked up by binding resolution.",
|
||||
"binding": "Bindings decide which client and interface a capability routes to per environment/source; only published bindings are called automatically.",
|
||||
"credential": "In db mode, credentials are maintained in the UI and encrypted server-side; in env mode only the environment variable key is stored and the value is injected by the environment.",
|
||||
"credentialImmutable": "These fields are locked after creation; to change them, create a new credential reference and point the client instance at it.",
|
||||
"capability": "Registered platform capabilities (read-only); try them here."
|
||||
},
|
||||
"headers": {
|
||||
"code": "Code",
|
||||
"name": "Name",
|
||||
@@ -5159,13 +5217,16 @@
|
||||
"environment": "Environment",
|
||||
"status": "Status",
|
||||
"clientInstance": "Client Instance",
|
||||
"interfaceDef": "Interface Definition",
|
||||
"secretRef": "Secret Ref",
|
||||
"secretProvider": "Provider",
|
||||
"interfaceDef": "Interface",
|
||||
"secretRef": "Secret Reference",
|
||||
"secretProvider": "Source",
|
||||
"account": "Account",
|
||||
"capability": "Capability",
|
||||
"write": "Write",
|
||||
"idempotency": "Idempotency",
|
||||
"actions": "Actions"
|
||||
"actions": "Actions",
|
||||
"endpoint": "Endpoint",
|
||||
"testStatus": "Connection Test"
|
||||
},
|
||||
"fields": {
|
||||
"code": "Code",
|
||||
@@ -5173,49 +5234,83 @@
|
||||
"connectorType": "Connector Type",
|
||||
"environment": "Environment",
|
||||
"credentialRef": "Credential Reference Code",
|
||||
"configJson": "Connection config JSON (endpoint/timeout/default org, etc.)",
|
||||
"configJson": "Connection Config JSON (endpoint / timeout / default org, etc.)",
|
||||
"clientInstance": "Client Instance",
|
||||
"requestSpec": "Request template JSON",
|
||||
"inputSchema": "Input schema JSON",
|
||||
"responseMapping": "Response mapping JSON",
|
||||
"outputSchema": "Output schema JSON",
|
||||
"requestSpec": "Request Template JSON",
|
||||
"inputSchema": "Input Schema JSON",
|
||||
"responseMapping": "Response Mapping JSON",
|
||||
"outputSchema": "Output Schema JSON",
|
||||
"status": "Status",
|
||||
"enabled": "Enabled",
|
||||
"enabledHint": "When off, capability calls through this instance are rejected (treated as no binding); connection tests still run.",
|
||||
"enabledFooterHint": "Applied when saved",
|
||||
"credentialEnabledHint": "When off, calls referencing this credential fail immediately (treated as a missing credential); connection tests still run.",
|
||||
"capability": "Capability",
|
||||
"interfaceDef": "Interface Definition",
|
||||
"mappingVersion": "Mapping Version",
|
||||
"priority": "Priority",
|
||||
"effectiveFrom": "Effective From",
|
||||
"effectiveTo": "Effective To",
|
||||
"contextSelector": "Context selector JSON (key-value, e.g. source_code=DBS-AWSBI)",
|
||||
"secretRef": "Secret Ref Key",
|
||||
"secretProvider": "Secret Provider",
|
||||
"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",
|
||||
"endpoint": "Endpoint",
|
||||
"timeout": "Timeout (s)",
|
||||
"wsdl": "WSDL URL",
|
||||
"httpMethod": "HTTP Method",
|
||||
"requestPath": "Request Path",
|
||||
"contextSourceCode": "Source Instance Code"
|
||||
"username": "Username",
|
||||
"password": "Password",
|
||||
"visibleField": "non-secret",
|
||||
"codeHint": "Auto-generated from name when left blank; lowercase letters, digits and hyphens only; immutable after saving.",
|
||||
"codeHintInterface": "Auto-generated as \"client code - name\" when left empty; immutable after saving.",
|
||||
"connectorTypeHint": "Determined by the selected client instance; cannot be changed here.",
|
||||
"statusHint": "New definitions start as draft; update via the list buttons (Publish / Unpublish / Retire / Reopen draft).",
|
||||
"credentialNone": "None (anonymous)",
|
||||
"credentialRefHint": "Reference a centrally managed credential (password stored encrypted); rotate the password by updating the credential only."
|
||||
},
|
||||
"credentialFields": {
|
||||
"username": "Username",
|
||||
"password": "Password",
|
||||
"token": "Token",
|
||||
"api_key": "API Key"
|
||||
},
|
||||
"msg": {
|
||||
"fillClient": "Please fill in code and name",
|
||||
"fillInterface": "Please fill in code and select a client instance",
|
||||
"fillBinding": "Please fill in capability, client instance and interface definition",
|
||||
"fillCredential": "Please fill in code and secret ref",
|
||||
"invalidJson": "{field} JSON is invalid",
|
||||
"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",
|
||||
"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",
|
||||
"credentialPlaceholdersHint": "Template placeholders provided by this credential:",
|
||||
"invalidJson": "{field} is not valid JSON",
|
||||
"unsavedConfirm": "You have unsaved changes. Close anyway?",
|
||||
"saved": "Saved",
|
||||
"deleted": "Deleted",
|
||||
"testOk": "Connection test passed"
|
||||
"testOk": "Connection test passed",
|
||||
"codeInvalid": "Code allows lowercase letters, digits and hyphens only, and must start with a letter or digit",
|
||||
"deleteConfirm": "Delete client instance \"{name}\" ({code})? Interface definitions and bindings referencing it will break.",
|
||||
"toggleFailed": "Failed to toggle enabled state",
|
||||
"testFailed": "Connection failed ({code})",
|
||||
"testing": "Testing…",
|
||||
"statusUpdated": "Status updated",
|
||||
"statusUpdateFailed": "Failed to update status",
|
||||
"retireInterfaceConfirm": "Retiring invalidates all bindings referencing this interface; reopen it as draft to publish again. Retire anyway?",
|
||||
"retireBindingConfirm": "Retiring takes this binding out of automatic calls; reopen it as draft to publish again. Retire anyway?"
|
||||
},
|
||||
"callModal": {
|
||||
"title": "Call capability: {capability}",
|
||||
"hint": "Debug only: manually call a registered capability; params and context are resolved by the current binding.",
|
||||
"hint": "For debugging only: manually call a registered capability; params and context are resolved via current bindings.",
|
||||
"params": "Params JSON",
|
||||
"paramsHint": "Fill per the capability input schema, e.g. invoice_no / from_warehouse / to_warehouse / quantity.",
|
||||
"paramsHint": "Fill in per the capability input schema, e.g. invoice_no / from_warehouse / to_warehouse / quantity.",
|
||||
"context": "Context JSON",
|
||||
"contextHint": "Used for binding selector matching, e.g. source_code=DBS-AWSBI.",
|
||||
"result": "Result",
|
||||
"result": "Call Result",
|
||||
"run": "Call",
|
||||
"running": "Calling…"
|
||||
},
|
||||
@@ -5223,8 +5318,28 @@
|
||||
"endpoint": "https://erp-api.example.com/ws",
|
||||
"wsdl": "https://erp-api.example.com/wsdl",
|
||||
"requestPath": "Path supports placeholders, e.g. /transfer/xxx",
|
||||
"contextSourceCode": "e.g. DBS-AWSBI"
|
||||
"passwordKeep": "Leave blank to keep the current password"
|
||||
},
|
||||
"advancedConfig": "Advanced config (JSON)"
|
||||
"advancedConfig": "Advanced Config (JSON)",
|
||||
"formatJson": "Format",
|
||||
"invalidJsonHint": "Invalid JSON — fix it before saving",
|
||||
"testOkBadge": "Connected",
|
||||
"testFailBadge": "Failed",
|
||||
"testDetailToggle": "Click to expand/collapse details",
|
||||
"advancedHints": {
|
||||
"withKeys": "Config keys currently in effect: {keys}. Other keys are stored as-is but have no effect yet.",
|
||||
"none": "This connector type has no extra config keys in effect; content is stored as-is for future use."
|
||||
},
|
||||
"sections": {
|
||||
"basic": "Basic Info",
|
||||
"connection": "Connection",
|
||||
"advanced": "Advanced",
|
||||
"contract": "Interface contract (JSON)",
|
||||
"credentialValues": "Credential Values"
|
||||
},
|
||||
"connectorTypes": {
|
||||
"rest": "REST API",
|
||||
"soap": "SOAP Service"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2640,6 +2640,7 @@
|
||||
"blockReason": "Reason to address",
|
||||
"manualReason": "Manual reason",
|
||||
"confirmBlocked": "Build eligibility is not satisfied. Resolve inventory or validation issues before confirming.",
|
||||
"autoCreateBlocked": "Manual build is eligible but automatic creation is not; after confirmation, a human will drive it forward.",
|
||||
"autoGateProgressHint": "Auto-create eligibility is met — waiting for the system to start.",
|
||||
"autoGateWaitingHint": "Auto-create eligibility is met — waiting for the system to start.",
|
||||
"autoGateRunningHint": "The system is creating the order and progressing automatically.",
|
||||
@@ -3709,7 +3710,11 @@
|
||||
"notMaturedCount": "Same-day receipt",
|
||||
"blockedCount": "Blocked",
|
||||
"estimatedQuantity": "Est. transfer qty",
|
||||
"estimatedErpWrites": "Est. ERP documents",
|
||||
"estimatedExternalWrites": "Est. ERP documents",
|
||||
"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",
|
||||
"colSource": "Source",
|
||||
@@ -3717,9 +3722,18 @@
|
||||
"colName": "Name",
|
||||
"colSpec": "Spec",
|
||||
"colInvoice": "Invoice",
|
||||
"colReceiptDate": "Receipt Date",
|
||||
"colFromWarehouse": "From warehouse",
|
||||
"colFromQty": "From qty",
|
||||
"colFromQty": "Stock qty",
|
||||
"colToWarehouse": "To warehouse",
|
||||
"colFromBatch": "Outbound Batch",
|
||||
"filterPlaceholder": "Filter by material / name / Invoice / batch",
|
||||
"filterAll": "All results",
|
||||
"requerySelected": "Requery selected ERP stock",
|
||||
"receiptDateLabel": "Receipt date",
|
||||
"receiptDateTo": "Receipt date to",
|
||||
"receiptDateHint": "End cannot exceed the D+1 rule (day before business date)",
|
||||
"requeryRow": "Requery",
|
||||
"colToQty": "To qty",
|
||||
"colResult": "Result",
|
||||
"resultExecutable": "Executable",
|
||||
@@ -3761,9 +3775,17 @@
|
||||
"noBacklog": "No backlog exceptions",
|
||||
"sourceSelectTitle": "Select receipt source instances",
|
||||
"sourceSelectHint": "DBS / Crane are platform groups; select the actual source instances to process.",
|
||||
"selectAll": "Select all",
|
||||
"transferTypeLabel": "Transfer type",
|
||||
"transferType": {
|
||||
"in_transit_to_hub": "In-transit to HUB",
|
||||
"hub_repair_out": "HUB repair outbound",
|
||||
"hub_to_hub": "HUB to HUB"
|
||||
},
|
||||
"transferTypeComingSoon": "Coming soon",
|
||||
"precheckParams": "Precheck parameters",
|
||||
"selectAll": "Select all in group",
|
||||
"selectEnabledAll": "Select all enabled",
|
||||
"clearSources": "Clear",
|
||||
"clearSources": "Clear selection",
|
||||
"selectedSourceCount": "Selected {count} source instances",
|
||||
"needSelectSource": "Select at least one enabled source instance",
|
||||
"confirmScopeAndPrecheck": "Confirm scope & precheck",
|
||||
@@ -3784,11 +3806,14 @@
|
||||
"fileReady": "File ready",
|
||||
"fileFetching": "Fetching",
|
||||
"fileFailed": "Fetch failed",
|
||||
"fileExpired": "File expired",
|
||||
"sourceErrorTitle": "Source processing failed",
|
||||
"fileNone": "Pending",
|
||||
"needReadyFile": "A selected source has no receipt file / is fetching / failed. Retry receipt RPA first.",
|
||||
"selectVisible": "Select visible",
|
||||
"selectRetryable": "Select retryable",
|
||||
"batchRetry": "Batch retry RPA",
|
||||
"downloadFiles": "Download receipt files",
|
||||
"selectedRetryableCount": "{count} retryable",
|
||||
"noRetryable": "No selected source needs retry (already ready or fetching)"
|
||||
}
|
||||
|
||||
@@ -355,7 +355,6 @@
|
||||
"SHIPPING_CUSTOMER_CHANGE_REASON_REQUIRED": "A reason is required when changing customer status, short code, or auto-match authorization.",
|
||||
"SHIPPING_CUSTOMER_NAME_REQUIRED": "Standard customer name is required.",
|
||||
"SHIPPING_CUSTOMER_SHORT_CODE_INVALID": "Customer short code must contain 2-6 letters.",
|
||||
"SHIPPING_CUSTOMER_SHORT_CODE_EXISTS": "Customer short code already exists.",
|
||||
"SHIPPING_CUSTOMER_STATUS_INVALID": "Invalid customer status.",
|
||||
"SHIPPING_CUSTOMER_CONFLICT": "Customer data conflict.",
|
||||
"SHIPPING_CUSTOMER_IDENTIFIER_TYPE_INVALID": "Invalid identifier type.",
|
||||
@@ -377,7 +376,6 @@
|
||||
"SHIPPING_CUSTOMER_IMPORT_COLUMNS_MISSING": "Required import columns are missing.",
|
||||
"SHIPPING_CUSTOMER_IMPORT_KEY_REQUIRED": "Legacy customer key is required.",
|
||||
"SHIPPING_CUSTOMER_IMPORT_DUPLICATE_KEY": "Duplicate legacy key in the same source.",
|
||||
"SHIPPING_CUSTOMER_IMPORT_SHORT_CODE_CONFLICT": "Short code conflicts with an existing customer.",
|
||||
"SHIPPING_CUSTOMER_IMPORT_NAME_MATCH": "Customer name may duplicate an existing customer.",
|
||||
"SHIPPING_CUSTOMER_IMPORT_IDENTIFIER_CUSTOMER_MISSING": "No customer mapping was found for this identifier.",
|
||||
"SHIPPING_CUSTOMER_IMPORT_NOT_FOUND": "Import batch not found.",
|
||||
@@ -555,8 +553,8 @@
|
||||
"TRANSFER_SECRET_NOT_EXPOSED": "Sensitive credentials must not be exposed.",
|
||||
"TRANSFER_NOTIFICATION_FAILED": "Notification failed; ERP result is unaffected.",
|
||||
"TRANSFER.ROUTE_NOT_RESOLVED": "Route mapping is not configured for this source.",
|
||||
"TRANSFER.ERP_NOT_FROZEN": "ERP contract is not frozen; call forbidden.",
|
||||
"TRANSFER.ERP_QUERY_TIMEOUT": "ERP query timed out; retry.",
|
||||
"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."
|
||||
|
||||
@@ -635,7 +635,9 @@
|
||||
"pathSectionConfigured": "ตั้งค่าแล้ว",
|
||||
"pathSectionNotConfigured": "ยังไม่ได้ตั้งค่า",
|
||||
"parsingProfiles": "แผนการแยกวิเคราะห์ไฟล์สต็อก",
|
||||
"parsingProfilesHelp": "จัดการโครงสร้างไฟล์สต็อก การจับคู่ฟิลด์ และคีย์จับคู่ฟิลด์คำสั่งซื้อที่ใช้ร่วมกันได้ระหว่างไซต์สต็อก",
|
||||
"parsingProfilesHelp": "จัดการกฎการอ่านไฟล์ที่ใช้ร่วมกันได้ระหว่างไซต์: การแยกวิเคราะห์สต็อกใช้สารบัญฟิลด์สต็อกและคีย์จับคู่คำสั่งซื้อ ส่วนการรับ-เคลื่อนไหวใช้ฟิลด์มาตรฐาน (สัญญาแบบอ่านอย่างเดียว)",
|
||||
"inventoryParsing": { "code": "รหัสแผนการอ่านสต็อก", "name": "ชื่อแผนการอ่านสต็อก", "sampleFile": "ไฟล์ตัวอย่างสต็อก", "sampleFileHint": "อัปโหลด Excel หรือ CSV แล้วระบบจะอ่านชีต หัวตาราง และตัวอย่างเล็กน้อยเพื่อยืนยันแผนการอ่านสต็อก", "sampleRequired": "โปรดอัปโหลดไฟล์ตัวอย่างสต็อกและทำการระบุโครงสร้างให้เสร็จก่อน", "sourceHeader": "หัวตารางไฟล์สต็อก", "fieldMappings": "การจับคู่ฟิลด์มาตรฐานสต็อก", "analysisPreview": "ภาพรวมการวิเคราะห์สต็อก" },
|
||||
"movementParsing": { "code": "รหัสแผนการอ่านการเคลื่อนไหว", "name": "ชื่อแผนการอ่านการเคลื่อนไหว", "sampleFile": "ไฟล์ตัวอย่างการรับ", "sampleFileHint": "อัปโหลด Excel หรือ CSV แล้วระบบจะอ่านชีต หัวตาราง และตัวอย่างเล็กน้อยเพื่อยืนยันการอ่านการรับ-เคลื่อนไหว", "sampleRequired": "โปรดอัปโหลดไฟล์ตัวอย่างการรับ-เคลื่อนไหวและทำการระบุโครงสร้างให้เสร็จก่อน", "sourceHeader": "หัวตารางไฟล์การเคลื่อนไหว", "fieldMappings": "การจับคู่ฟิลด์มาตรฐานการเคลื่อนไหว", "analysisPreview": "ภาพรวมการวิเคราะห์การเคลื่อนไหว" },
|
||||
"inventoryMapping": "แผนการแยกวิเคราะห์ไฟล์สต็อก",
|
||||
"inventoryMappingPlans": "แผนการแยกข้อมูล",
|
||||
"inventoryFields": "รายการฟิลด์สต็อก",
|
||||
@@ -690,6 +692,21 @@
|
||||
"inventorySampleAnalysing": "กำลังวิเคราะห์โครงสร้างไฟล์สต็อก...",
|
||||
"inventorySampleRequired": "โปรดอัปโหลดไฟล์ตัวอย่างสต็อกและทำการระบุโครงสร้างให้เสร็จก่อน",
|
||||
"parsingProfileName": "ชื่อแผนการอ่านไฟล์",
|
||||
"parsingPurposeLabel": "วัตถุประสงค์ของกฎ",
|
||||
"parsingPurposeHint": "เปลี่ยนวัตถุประสงค์ไม่ได้หลังสร้าง: การแยกวิเคราะห์สินค้าคงเหลือใช้สารบัญฟิลด์สินค้าคงเหลือ ส่วนการรับ-เคลื่อนไหวใช้ฟิลด์มาตรฐาน (สัญญาแบบอ่านอย่างเดียว)",
|
||||
"parsingPurpose": { "inventory": "แยกวิเคราะห์สินค้าคงเหลือ", "movement": "การรับ-เคลื่อนไหว" },
|
||||
"movementMappingHint": "ฟิลด์มาตรฐานเป็นสัญญาแบบอ่านอย่างเดียว (✱ จำเป็น, 🔑 ตัวตนสำหรับจับคู่) เพียงเลือกหัวคอลัมน์รายงานให้แต่ละฟิลด์",
|
||||
"movementRequiredMark": "จำเป็น",
|
||||
"movementIdentityMark": "ตัวตนจับคู่",
|
||||
"movementStandardField": "ฟิลด์มาตรฐานการเคลื่อนไหว",
|
||||
"movementBindingLabel": "กฎการแยกวิเคราะห์การเคลื่อนไหว",
|
||||
"movementBindingNone": "ยังไม่ผูก",
|
||||
"movementBindingHint": "เมื่อผูกกฎที่เผยแพร่แล้ว การตรวจก่อนจะใช้ไฟล์ที่เก็บถาวรซ้ำ หากไม่ผูก การตรวจก่อนจะไม่เรียกดึงข้อมูล (fail-closed)",
|
||||
"movementFields": {
|
||||
"doc_no": "เลขที่เอกสาร", "line_no": "ลำดับรายการ", "in_out_flag": "เข้า/ออก", "material_code": "รหัสวัสดุ",
|
||||
"material_name": "ชื่อวัสดุ", "warehouse_code": "คลังสินค้า", "storage_code": "ตำแหน่งจัดเก็บ", "lot_no": "เลขล็อต",
|
||||
"quantity": "จำนวน", "movement_date": "วันที่เคลื่อนไหว"
|
||||
},
|
||||
"inventoryAnalysisFailed": "การระบุโครงสร้างไฟล์สต็อกล้มเหลว",
|
||||
"inventoryAnalysisPreview": "ตัวอย่างผลการระบุ",
|
||||
"inventoryAnalysisSummary": "พบหัวตารางที่เลือกได้ {candidate_count} รายการ มีแถวตัวอย่าง {sample_row_count} แถว และแนะนำฟิลด์สต็อก {valid_inventory_field_suggestions} รายการ",
|
||||
@@ -826,8 +843,7 @@
|
||||
"exports": "บันทึกการส่งออก",
|
||||
"exportsHelp": "ดูผลการส่งออกสต็อกแบบอ่านอย่างเดียว ไม่สั่งส่งออกหรือทดลองใหม่ที่นี่",
|
||||
"externalMappings": "การแมปคลัง",
|
||||
"mappingsHelp": "แมปคลังของผู้ให้บริการขนส่ง หรือคลังเริ่มต้นของแหล่งข้อมูล ไปยังรหัสคลังของระบบภายนอก",
|
||||
"defaultMapping": "การแมปเริ่มต้นของแหล่งข้อมูล",
|
||||
"mappingsHelp": "แมปแหล่งสินค้าคงคลังไปยังรหัสคลังปลายทางและรหัสคลังระหว่างทางของระบบภายนอก คลังผู้ให้บริการเป็นทางเลือกและใช้เป็นคีย์จับคู่คลังรับสินค้า",
|
||||
"loadFailed": "โหลดการตั้งค่าสินค้าคงคลังขนส่งไม่สำเร็จ",
|
||||
"createNew": "สร้างใหม่",
|
||||
"saving": "กำลังบันทึก...",
|
||||
@@ -1036,12 +1052,13 @@
|
||||
"publishedImmutable": "กฎที่เผยแพร่จะถูกเก็บเป็นคำนิยามตรวจสอบที่แก้ไขไม่ได้ โปรดสร้างและเผยแพร่กฎใหม่แทน",
|
||||
"source": "แหล่งสต็อก",
|
||||
"chooseSource": "เลือกแหล่งสต็อก",
|
||||
"freightWarehouse": "คลังผู้ให้บริการ (ไม่บังคับ)",
|
||||
"freightWarehouse": "คลังผู้ให้บริการ",
|
||||
"externalSystem": "ระบบปลายทาง",
|
||||
"externalOrganization": "องค์กรปลายทาง (ไม่บังคับ)",
|
||||
"externalSite": "สถานที่ปลายทาง (ไม่บังคับ)",
|
||||
"externalWarehouseCode": "รหัสคลังปลายทาง",
|
||||
"externalWarehouseName": "ชื่อคลังปลายทาง",
|
||||
"inTransitWarehouseCode": "รหัสคลังระหว่างทาง",
|
||||
"snapshotStatus": "สถานะสแนปช็อต",
|
||||
"snapshotFile": "ไฟล์สแนปช็อต",
|
||||
"expiresAt": "ใช้ได้ถึง",
|
||||
@@ -5010,80 +5027,158 @@
|
||||
"title": "ตัวเชื่อมต่อระบบ",
|
||||
"subtitle": "กำหนดค่าไคลเอนต์ระบบภายนอก เทมเพลตอินเทอร์เฟซ และการแมปผลตอบกลับ แล้วผูกกับความสามารถ นี่คือการกำหนดค่าแบบบูรณาการที่ทำให้การโอนย้ายอัตโนมัติทำงานได้",
|
||||
"add": "เพิ่ม",
|
||||
"formHint": "ดูแลฟิลด์ JSON ในตัวแก้ไข สถานะการเผยแพร่เป็นตัวกำหนดว่าการกำหนดค่านี้ถูกใช้โดย Worker หรือไม่",
|
||||
"call": "เรียก",
|
||||
"test": "ทดสอบการเชื่อมต่อ",
|
||||
"empty": "ไม่มีข้อมูล",
|
||||
"tabs": {
|
||||
"client": "อินสแตนซ์ไคลเอนต์",
|
||||
"client": "อินสแตนซ์ไคลเอ็นต์",
|
||||
"interface": "นิยามอินเทอร์เฟซ",
|
||||
"binding": "การผูก",
|
||||
"credential": "การอ้างอิงข้อมูลรับรอง",
|
||||
"capability": "รายการความสามารถ"
|
||||
},
|
||||
"statusLabels": {
|
||||
"draft": "ฉบับร่าง",
|
||||
"published": "เผยแพร่แล้ว",
|
||||
"retired": "เลิกใช้",
|
||||
"active": "ใช้งานอยู่",
|
||||
"rotating": "กำลังหมุนเวียน",
|
||||
"db": "จัดการใน UI (เข้ารหัส)",
|
||||
"env": "ตัวแปรสภาพแวดล้อม"
|
||||
},
|
||||
"envLabels": {
|
||||
"dev": "พัฒนา",
|
||||
"test": "ทดสอบ",
|
||||
"prod": "ผลิต"
|
||||
},
|
||||
"capabilityLabels": {
|
||||
"in_transit_transfer": {
|
||||
"create_transfer": "สร้างใบโอนย้าย",
|
||||
"query_inventory": "สอบถามสต๊อกระหว่างทาง",
|
||||
"verify_duplicate": "ตรวจสอบข้อมูลซ้ำ"
|
||||
}
|
||||
},
|
||||
"writeLabels": { "yes": "ใช่", "no": "ไม่ใช่" },
|
||||
"idempotencyLabels": { "none": "ไม่มี", "invoice": "กันซ้ำด้วยเลขเอกสาร" },
|
||||
"credentialTypeLabels": {
|
||||
"password": "บัญชี+รหัสผ่าน",
|
||||
"token": "โทเคน",
|
||||
"api_key": "คีย์ API"
|
||||
},
|
||||
"lifecycle": {
|
||||
"publish": "เผยแพร่",
|
||||
"unpublish": "ยกเลิกการเผยแพร่",
|
||||
"retire": "เลิกใช้",
|
||||
"reopen": "คืนสถานะร่าง"
|
||||
},
|
||||
"formHints": {
|
||||
"client": "รหัสคือตัวระบุเฉพาะที่นิยามอินเทอร์เฟซและการผูกใช้อ้างอิง แก้ไขไม่ได้หลังบันทึก",
|
||||
"interface": "รหัสสร้างอัตโนมัติได้ สัญญา JSON คือเนื้อหาของอินเทอร์เฟซ กรุณาดูแลในตัวแก้ไข หลังเผยแพร่เท่านั้นที่การผูกจะเรียกใช้อัตโนมัติ",
|
||||
"binding": "การผูกกำหนดว่าความสามารถจะถูกกำหนดเส้นทางไปยังไคลเอ็นต์และอินเทอร์เฟซใดในแต่ละสภาพแวดล้อม/แหล่งที่มา มีเพียงที่เผยแพร่แล้วเท่านั้นที่ถูกเรียกอัตโนมัติ",
|
||||
"credential": "โหมด db ดูแลบัญชี/รหัสผ่านในหน้าจอและเข้ารหัสฝั่งเซิร์ฟเวอร์; โหมด env เก็บเพียงชื่อตัวแปรสภาพแวดล้อม โดยค่าจริงถูกฉีดโดยสภาพแวดล้อม",
|
||||
"credentialImmutable": "ข้อมูลข้างต้นจะถูกล็อกหลังจากสร้างแล้ว หากต้องการเปลี่ยน ให้สร้างการอ้างอิงข้อมูลรับรองใหม่แล้วชี้อินสแตนซ์ไคลเอ็นต์ไปยังการอ้างอิงใหม่",
|
||||
"capability": "รายการความสามารถที่ลงทะเบียนไว้ของแพลตฟอร์ม (อ่านอย่างเดียว) ทดลองเรียกได้ที่นี่"
|
||||
},
|
||||
"headers": {
|
||||
"code": "รหัส",
|
||||
"name": "ชื่อ",
|
||||
"connectorType": "ประเภท",
|
||||
"environment": "สภาพแวดล้อม",
|
||||
"status": "สถานะ",
|
||||
"clientInstance": "อินสแตนซ์ไคลเอนต์",
|
||||
"interfaceDef": "นิยามอินเทอร์เฟซ",
|
||||
"clientInstance": "อินสแตนซ์ไคลเอ็นต์",
|
||||
"interfaceDef": "อินเทอร์เฟซ",
|
||||
"secretRef": "การอ้างอิง Secret",
|
||||
"secretProvider": "แหล่งที่มา",
|
||||
"account": "บัญชี",
|
||||
"capability": "ความสามารถ",
|
||||
"write": "เขียน",
|
||||
"idempotency": "ไอดีมโพเทนซ์",
|
||||
"actions": "การดำเนินการ"
|
||||
"idempotency": "ความไม่ซ้ำ",
|
||||
"actions": "การดำเนินการ",
|
||||
"endpoint": "ที่อยู่เชื่อมต่อ",
|
||||
"testStatus": "ทดสอบการเชื่อมต่อ"
|
||||
},
|
||||
"fields": {
|
||||
"code": "รหัส",
|
||||
"name": "ชื่อ",
|
||||
"connectorType": "ประเภทตัวเชื่อมต่อ",
|
||||
"environment": "สภาพแวดล้อม",
|
||||
"credentialRef": "รหัสอ้างอิงข้อมูลรับรอง",
|
||||
"configJson": "JSON การตั้งค่าการเชื่อมต่อ (endpoint/หมดเวลา/org เริ่มต้น ฯลฯ)",
|
||||
"clientInstance": "อินสแตนซ์ไคลเอนต์",
|
||||
"credentialRef": "รหัสการอ้างอิงข้อมูลรับรอง",
|
||||
"configJson": "JSON การตั้งค่าการเชื่อมต่อ (ที่อยู่/หมดเวลา/org เริ่มต้น ฯลฯ)",
|
||||
"clientInstance": "อินสแตนซ์ไคลเอ็นต์",
|
||||
"requestSpec": "JSON เทมเพลตคำขอ",
|
||||
"inputSchema": "JSON Schema ขาเข้า",
|
||||
"inputSchema": "JSON Schema พารามิเตอร์ขาเข้า",
|
||||
"responseMapping": "JSON การแมปผลตอบกลับ",
|
||||
"outputSchema": "JSON Schema ขาออก",
|
||||
"outputSchema": "JSON Schema ผลลัพธ์",
|
||||
"status": "สถานะ",
|
||||
"enabled": "เปิดใช้งาน",
|
||||
"enabledHint": "เมื่อปิด การเรียกความสามารถผ่านอินสแตนซ์นี้จะถูกปฏิเสธ (ถือว่าไม่มี binding) แต่การทดสอบการเชื่อมต่อยังใช้งานได้",
|
||||
"enabledFooterHint": "มีผลเมื่อบันทึก",
|
||||
"credentialEnabledHint": "เมื่อปิด การเรียกที่อ้างอิงข้อมูลรับรองนี้จะล้มเหลวทันที (ถือว่าไม่มีข้อมูลรับรอง) การทดสอบการเชื่อมต่อยังใช้งานได้",
|
||||
"capability": "ความสามารถ",
|
||||
"interfaceDef": "นิยามอินเทอร์เฟซ",
|
||||
"mappingVersion": "เวอร์ชันการแมป",
|
||||
"priority": "ลำดับความสำคัญ",
|
||||
"effectiveFrom": "เริ่มมีผล",
|
||||
"effectiveTo": "สิ้นสุดมีผล",
|
||||
"contextSelector": "JSON ตัวเลือกบริบท (คู่คีย์-ค่า เช่น source_code=DBS-AWSBI)",
|
||||
"effectiveFrom": "มีผลตั้งแต่",
|
||||
"effectiveTo": "มีผลถึง",
|
||||
"contextSelector": "JSON เงื่อนไขการกำหนดเส้นทางขั้นสูง",
|
||||
"contextSelectorHint": "คู่คีย์-ค่าทั้งหมดต้องอยู่ในบริบทการเรียกจึงจะจับคู่ได้ โดยเวอร์ชันปัจจุบันผู้เรียกไม่ส่งบริบทการกำหนดเส้นทาง ปล่อยว่างไว้จะเป็นการผูกค่าเริ่มต้น",
|
||||
"paramMapping": "JSON การแมปพารามิเตอร์",
|
||||
"paramMappingHint": "กฎการแปลพารามิเตอร์โดเมนเป็นพารามิเตอร์อินเทอร์เฟซ (เช่น erp_org เป็น organization, เทมเพลต condition) หากว่างจะส่งต่อชื่อเดียวกัน",
|
||||
"bindingClientHint": "ดึงและล็อกโดยอัตโนมัติตามคำนิยามอินเทอร์เฟซที่เลือก แก้ไขเองไม่ได้",
|
||||
"secretRef": "คีย์อ้างอิง Secret",
|
||||
"secretProvider": "แหล่งที่มาของ Secret",
|
||||
"secretProvider": "แหล่ง Secret",
|
||||
"credentialType": "ประเภทข้อมูลรับรอง",
|
||||
"endpoint": "ที่อยู่ปลายทาง",
|
||||
"endpoint": "ที่อยู่อินเทอร์เฟซ",
|
||||
"timeout": "หมดเวลา (วินาที)",
|
||||
"wsdl": "URL WSDL",
|
||||
"httpMethod": "วิธี HTTP",
|
||||
"wsdl": "ที่อยู่ WSDL",
|
||||
"httpMethod": "เมธอด HTTP",
|
||||
"requestPath": "เส้นทางคำขอ",
|
||||
"contextSourceCode": "รหัสแหล่งรับของ"
|
||||
"username": "ชื่อผู้ใช้",
|
||||
"password": "รหัสผ่าน",
|
||||
"visibleField": "ไม่เป็นความลับ",
|
||||
"codeHint": "เว้นว่างจะสร้างอัตโนมัติจากชื่อ; ใช้ตัวอักษรพิมพ์เล็ก ตัวเลข และยัติภังค์เท่านั้น แก้ไขไม่ได้หลังบันทึก",
|
||||
"codeHintInterface": "หากเว้นว่างจะสร้างอัตโนมัติจาก \"รหัสไคลเอ็นต์-ชื่อ\" และแก้ไขไม่ได้หลังบันทึก",
|
||||
"connectorTypeHint": "กำหนดโดยอินสแตนซ์ไคลเอ็นต์ที่เลือก แก้ไขที่นี่ไม่ได้",
|
||||
"statusHint": "รายการใหม่บันทึกเป็นฉบับร่าง อัปเดตสถานะผ่านปุ่มในรายการ (เผยแพร่ / ยกเลิกการเผยแพร่ / เลิกใช้ / คืนสถานะร่าง)",
|
||||
"credentialNone": "ไม่มี (ไม่ระบุตัวตน)",
|
||||
"credentialRefHint": "อ้างอิงข้อมูลรับรองที่จัดเก็บรวมศูนย์ (รหัสผ่านถูกเข้ารหัสไว้); เปลี่ยนรหัสผ่านที่ข้อมูลรับรองเท่านั้น ไม่ต้องแก้ไคลเอนต์"
|
||||
},
|
||||
"credentialFields": {
|
||||
"username": "ชื่อผู้ใช้",
|
||||
"password": "รหัสผ่าน",
|
||||
"token": "โทเคน",
|
||||
"api_key": "คีย์ API"
|
||||
},
|
||||
"msg": {
|
||||
"fillClient": "กรุณากรอกรหัสและชื่อ",
|
||||
"fillInterface": "กรุณากรอกรหัสและเลือกอินสแตนซ์ไคลเอนต์",
|
||||
"fillBinding": "กรุณากรอกความสามารถ อินสแตนซ์ไคลเอนต์ และนิยามอินเทอร์เฟซ",
|
||||
"fillClient": "กรุณากรอกชื่อ",
|
||||
"fillInterface": "กรุณาเลือกอินสแตนซ์ไคลเอ็นต์ (รหัสสร้างอัตโนมัติได้)",
|
||||
"fillBinding": "กรุณากรอกความสามารถ อินสแตนซ์ไคลเอ็นต์ และนิยามอินเทอร์เฟซ",
|
||||
"fillCredential": "กรุณากรอกรหัสและการอ้างอิง Secret",
|
||||
"invalidJson": "JSON ของ {field} ไม่ถูกต้อง",
|
||||
"fillCredentialDb": "กรุณากรอกรหัส และฟิลด์ข้อมูลประจำตัวที่จำเป็น: {fields}",
|
||||
"credentialTypeMissing": "รายการประเภทข้อมูลประจำตัวยังไม่โหลด โปรดรีเฟรชแล้วลองใหม่",
|
||||
"credentialPlaceholdersHint": "ตัวยึดตำแหน่งเทมเพลตจากข้อมูลประจำตัวนี้:",
|
||||
"invalidJson": "{field} รูปแบบ JSON ไม่ถูกต้อง",
|
||||
"unsavedConfirm": "มีการเปลี่ยนแปลงที่ยังไม่ได้บันทึก ต้องการปิดหรือไม่?",
|
||||
"saved": "บันทึกแล้ว",
|
||||
"deleted": "ลบแล้ว",
|
||||
"testOk": "การทดสอบการเชื่อมต่อผ่าน"
|
||||
"testOk": "ทดสอบการเชื่อมต่อผ่าน",
|
||||
"codeInvalid": "รหัสใช้ตัวอักษรพิมพ์เล็ก ตัวเลข และยัติภังค์เท่านั้น และต้องขึ้นต้นด้วยตัวอักษรหรือตัวเลข",
|
||||
"deleteConfirm": "ลบอินสแตนซ์ไคลเอ็นต์ \"{name}\" ({code}) หรือไม่? นิยามอินเทอร์เฟซและการผูกที่อ้างอิงจะใช้ไม่ได้",
|
||||
"toggleFailed": "สลับสถานะเปิดใช้งานไม่สำเร็จ",
|
||||
"testFailed": "การเชื่อมต่อล้มเหลว ({code})",
|
||||
"testing": "กำลังทดสอบ…",
|
||||
"statusUpdated": "อัปเดตสถานะแล้ว",
|
||||
"statusUpdateFailed": "อัปเดตสถานะไม่สำเร็จ",
|
||||
"retireInterfaceConfirm": "การเลิกใช้จะทำให้การผูกที่อ้างอิงอินเทอร์เฟซนี้ใช้ไม่ได้ทั้งหมด เปิดเป็นฉบับร่างแล้วเผยแพร่ใหม่ได้ ยืนยันเลิกใช้หรือไม่?",
|
||||
"retireBindingConfirm": "การเลิกใช้จะถอดการผูกนี้ออกจากการเรียกอัตโนมัติ เปิดเป็นฉบับร่างแล้วเผยแพร่ใหม่ได้ ยืนยันเลิกใช้หรือไม่?"
|
||||
},
|
||||
"callModal": {
|
||||
"title": "เรียกความสามารถ: {capability}",
|
||||
"hint": "สำหรับการดีบักเท่านั้น: เรียกความสามารถที่ลงทะเบียนด้วยตนเอง พารามิเตอร์และบริบทจะถูกแก้ไขตามการผูกปัจจุบัน",
|
||||
"hint": "สำหรับดีบักเท่านั้น: เรียกความสามารถที่ลงทะเบียนไว้ด้วยตนเอง พารามิเตอร์และบริบทจะถูกแก้ไขตามการผูกปัจจุบัน",
|
||||
"params": "JSON พารามิเตอร์",
|
||||
"paramsHint": "กรอกตาม Schema ขาเข้าของความสามารถ เช่น invoice_no / from_warehouse / to_warehouse / quantity",
|
||||
"paramsHint": "กรอกตาม Schema พารามิเตอร์ขาเข้าของความสามารถ เช่น invoice_no / from_warehouse / to_warehouse / quantity",
|
||||
"context": "JSON บริบท",
|
||||
"contextHint": "ใช้สำหรับจับคู่ตัวเลือกการผูก เช่น source_code=DBS-AWSBI",
|
||||
"contextHint": "ใช้จับคู่ตัวเลือกการผูก เช่น source_code=DBS-AWSBI",
|
||||
"result": "ผลการเรียก",
|
||||
"run": "เรียก",
|
||||
"running": "กำลังเรียก…"
|
||||
@@ -5091,9 +5186,29 @@
|
||||
"placeholders": {
|
||||
"endpoint": "https://erp-api.example.com/ws",
|
||||
"wsdl": "https://erp-api.example.com/wsdl",
|
||||
"requestPath": "เส้นทางรองรับตัวแปร เช่น /transfer/xxx",
|
||||
"contextSourceCode": "เช่น DBS-AWSBI"
|
||||
"requestPath": "เส้นทางรองรับตัวยึดตำแหน่ง เช่น /transfer/xxx",
|
||||
"passwordKeep": "ปล่อยว่างไว้เพื่อคงรหัสผ่านเดิม"
|
||||
},
|
||||
"advancedConfig": "การตั้งค่าขั้นสูง (JSON)"
|
||||
"advancedConfig": "การตั้งค่าขั้นสูง (JSON)",
|
||||
"formatJson": "จัดรูปแบบ",
|
||||
"invalidJsonHint": "รูปแบบ JSON ไม่ถูกต้อง โปรดแก้ไขก่อนบันทึก",
|
||||
"testOkBadge": "เชื่อมต่อได้",
|
||||
"testFailBadge": "เชื่อมต่อล้มเหลว",
|
||||
"testDetailToggle": "คลิกเพื่อขยาย/ย่อรายละเอียด",
|
||||
"advancedHints": {
|
||||
"withKeys": "คีย์การตั้งค่าที่มีผลในปัจจุบัน: {keys} ส่วนคีย์อื่นจะถูกบันทึกไว้ตามที่เป็นโดยยังไม่มีผล",
|
||||
"none": "ประเภทตัวเชื่อมต่อนี้ยังไม่มีคีย์การตั้งค่าเพิ่มเติมที่มีผล เนื้อหาที่นี่จะถูกบันทึกตามที่เป็นเพื่อใช้ขยายในอนาคต"
|
||||
},
|
||||
"sections": {
|
||||
"basic": "ข้อมูลพื้นฐาน",
|
||||
"connection": "การเชื่อมต่อ",
|
||||
"advanced": "ขั้นสูง",
|
||||
"contract": "สัญญาอินเทอร์เฟซ (JSON)",
|
||||
"credentialValues": "ค่าข้อมูลรับรอง"
|
||||
},
|
||||
"connectorTypes": {
|
||||
"rest": "REST API",
|
||||
"soap": "บริการ SOAP"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2640,6 +2640,7 @@
|
||||
"blockReason": "เหตุผลที่ต้องดำเนินการ",
|
||||
"manualReason": "เหตุผลด้วยตนเอง",
|
||||
"confirmBlocked": "ร่างยังไม่ผ่านคุณสมบัติการสร้างคำสั่ง โปรดแก้ปัญหาแหล่งสต็อกหรือการตรวจสอบก่อนยืนยัน",
|
||||
"autoCreateBlocked": "ผ่านคุณสมบัติสร้างด้วยตนเอง แต่ไม่ผ่านการสร้างอัตโนมัติ หลังยืนยันผู้ใช้จะเป็นผู้ดำเนินการต่อ",
|
||||
"autoGateProgressHint": "ผ่านคุณสมบัติสร้างอัตโนมัติแล้ว — รอระบบเริ่มทำงาน",
|
||||
"autoGateWaitingHint": "ผ่านคุณสมบัติสร้างอัตโนมัติแล้ว — รอระบบเริ่มทำงาน",
|
||||
"autoGateRunningHint": "ระบบกำลังสร้างออเดอร์และดำเนินการต่อโดยอัตโนมัติ",
|
||||
@@ -3709,7 +3710,11 @@
|
||||
"notMaturedCount": "รับของวันนี้",
|
||||
"blockedCount": "ถูกบล็อก",
|
||||
"estimatedQuantity": "จำนวนโอนโดยประมาณ",
|
||||
"estimatedErpWrites": "เอกสาร ERP โดยประมาณ",
|
||||
"estimatedExternalWrites": "เอกสาร ERP โดยประมาณ",
|
||||
"reasonQuantityMismatch": "ปริมาณสต๊อกตามบัญชี ERP ไม่ตรงกับปริมาณที่รับสินค้า",
|
||||
"reasonInventoryNotFound": "ไม่มีระเบียนสต๊อก ERP สำหรับล็อตนี้ แสดงสต๊อกเป็น 0",
|
||||
"reasonExternalQueryFailed": "การสอบถามระบบภายนอกล้มเหลว",
|
||||
"reasonFutureDate": "วันที่รับสินค้าหลังวันที่ทำธุรกรรม",
|
||||
"selectedCount": "เลือก {count} รายการ",
|
||||
"generateTransfer": "สร้างใบโอนทันที",
|
||||
"colSource": "แหล่งรับของ",
|
||||
@@ -3717,9 +3722,18 @@
|
||||
"colName": "ชื่อ",
|
||||
"colSpec": "สเปก",
|
||||
"colInvoice": "Invoice",
|
||||
"colReceiptDate": "วันที่รับสินค้า",
|
||||
"colFromWarehouse": "คลังต้นทาง",
|
||||
"colFromQty": "จำนวนต้นทาง",
|
||||
"colFromQty": "จำนวนสต๊อก",
|
||||
"colToWarehouse": "คลังปลายทาง",
|
||||
"colFromBatch": "ล็อตต้นทาง",
|
||||
"filterPlaceholder": "กรองตามรหัสวัสดุ / ชื่อ / Invoice / ล็อต",
|
||||
"filterAll": "ทุกผลลัพธ์",
|
||||
"requerySelected": "ตรวจซ้ำ ERP ที่เลือก",
|
||||
"receiptDateLabel": "วันที่รับสินค้า",
|
||||
"receiptDateTo": "วันที่รับสินค้าถึง",
|
||||
"receiptDateHint": "วันสิ้นสุดต้องไม่เกินกฎ D+1 (วันก่อนวันทำการ)",
|
||||
"requeryRow": "ตรวจซ้ำ",
|
||||
"colToQty": "จำนวนปลายทาง",
|
||||
"colResult": "ผลตรวจ",
|
||||
"resultExecutable": "ดำเนินการได้",
|
||||
@@ -3761,9 +3775,17 @@
|
||||
"noBacklog": "ไม่มีรายการค้างดำเนินการ",
|
||||
"sourceSelectTitle": "เลือกแหล่งรับของ",
|
||||
"sourceSelectHint": "DBS / Crane เป็นเพียงกลุ่มแพลตฟอร์ม กรุณาเลือกแหล่งรับของจริงที่ต้องการดำเนินการ",
|
||||
"selectAll": "เลือกทั้งหมด",
|
||||
"transferTypeLabel": "ประเภทการโอนย้าย",
|
||||
"transferType": {
|
||||
"in_transit_to_hub": "ระหว่างทางไปยัง HUB",
|
||||
"hub_repair_out": "ส่งออกซ่อมจาก HUB",
|
||||
"hub_to_hub": "โอนระหว่าง HUB"
|
||||
},
|
||||
"transferTypeComingSoon": "เร็ว ๆ นี้",
|
||||
"precheckParams": "พารามิเตอร์ตรวจสอบก่อน",
|
||||
"selectAll": "เลือกทั้งกลุ่ม",
|
||||
"selectEnabledAll": "เลือกที่เปิดใช้งานทั้งหมด",
|
||||
"clearSources": "ล้างข้อมูล",
|
||||
"clearSources": "ล้างการเลือก",
|
||||
"selectedSourceCount": "เลือกแล้ว {count} แหล่งรับ",
|
||||
"needSelectSource": "กรุณาเลือกแหล่งรับที่เปิดใช้งานอย่างน้อยหนึ่งรายการ",
|
||||
"confirmScopeAndPrecheck": "ยืนยันขอบเขตและตรวจสอบ",
|
||||
@@ -3784,11 +3806,14 @@
|
||||
"fileReady": "ไฟล์พร้อมแล้ว",
|
||||
"fileFetching": "กำลังดึง",
|
||||
"fileFailed": "ดึงล้มเหลว",
|
||||
"fileExpired": "ไฟล์หมดอายุ",
|
||||
"sourceErrorTitle": "ประมวลผลแหล่งข้อมูลล้มเหลว",
|
||||
"fileNone": "รอดำเนินการ",
|
||||
"needReadyFile": "แหล่งที่เลือกไม่มีไฟล์รับของ / กำลังดึง / ล้มเหลว โปรดลอง RPA รับของก่อน",
|
||||
"selectVisible": "เลือกที่เห็นทั้งหมด",
|
||||
"selectRetryable": "เลือกที่ลองใหม่ได้",
|
||||
"batchRetry": "ลองใหม่เป็นชุด",
|
||||
"downloadFiles": "ดาวน์โหลดไฟล์การรับสินค้า",
|
||||
"selectedRetryableCount": "ลองใหม่ได้ {count} รายการ",
|
||||
"noRetryable": "ไม่มีแหล่งที่เลือกต้องลองใหม่ (พร้อมแล้วหรือกำลังดึง)"
|
||||
}
|
||||
|
||||
@@ -355,7 +355,6 @@
|
||||
"SHIPPING_CUSTOMER_CHANGE_REASON_REQUIRED": "ต้องระบุเหตุผลเมื่อแก้ไขสถานะ รหัสย่อ หรือสิทธิ์การจับคู่อัตโนมัติของลูกค้า",
|
||||
"SHIPPING_CUSTOMER_NAME_REQUIRED": "ต้องระบุชื่อลูกค้ามาตรฐาน",
|
||||
"SHIPPING_CUSTOMER_SHORT_CODE_INVALID": "รหัสย่อลูกค้าต้องเป็นตัวอักษร 2-6 ตัว",
|
||||
"SHIPPING_CUSTOMER_SHORT_CODE_EXISTS": "รหัสย่อลูกค้ามีอยู่แล้ว",
|
||||
"SHIPPING_CUSTOMER_STATUS_INVALID": "สถานะลูกค้าไม่ถูกต้อง",
|
||||
"SHIPPING_CUSTOMER_CONFLICT": "ข้อมูลลูกค้าขัดแย้ง",
|
||||
"SHIPPING_CUSTOMER_IDENTIFIER_TYPE_INVALID": "ประเภทหลักฐานไม่ถูกต้อง",
|
||||
@@ -377,7 +376,6 @@
|
||||
"SHIPPING_CUSTOMER_IMPORT_COLUMNS_MISSING": "ขาดคอลัมน์ที่จำเป็น",
|
||||
"SHIPPING_CUSTOMER_IMPORT_KEY_REQUIRED": "ต้องระบุรหัสลูกค้าเดิม",
|
||||
"SHIPPING_CUSTOMER_IMPORT_DUPLICATE_KEY": "รหัสลูกค้าเดิมซ้ำในแหล่งเดียวกัน",
|
||||
"SHIPPING_CUSTOMER_IMPORT_SHORT_CODE_CONFLICT": "รหัสย่อขัดแย้งกับลูกค้าที่มีอยู่",
|
||||
"SHIPPING_CUSTOMER_IMPORT_NAME_MATCH": "ชื่อลูกค้าอาจซ้ำกับลูกค้าที่มีอยู่",
|
||||
"SHIPPING_CUSTOMER_IMPORT_IDENTIFIER_CUSTOMER_MISSING": "ไม่พบลูกค้าที่ตรงกับหลักฐาน",
|
||||
"SHIPPING_CUSTOMER_IMPORT_NOT_FOUND": "ไม่พบชุดนำเข้า",
|
||||
@@ -555,8 +553,8 @@
|
||||
"TRANSFER_SECRET_NOT_EXPOSED": "ห้ามเปิดเผยข้อมูลลับ",
|
||||
"TRANSFER_NOTIFICATION_FAILED": "การแจ้งเตือนล้มเหลว ไม่กระทบผล ERP",
|
||||
"TRANSFER.ROUTE_NOT_RESOLVED": "ยังไม่กำหนดเส้นทางสำหรับแหล่งนี้",
|
||||
"TRANSFER.ERP_NOT_FROZEN": "สัญญา ERP ยังไม่ถูกกำหนด ห้ามเรียก",
|
||||
"TRANSFER.ERP_QUERY_TIMEOUT": "สอบถาม ERP หมดเวลา กรุณาลองใหม่",
|
||||
"TRANSFER.EXTERNAL_NOT_FROZEN": "สัญญาภายนอกยังไม่ถูกกำหนด ห้ามเรียก",
|
||||
"TRANSFER.EXTERNAL_QUERY_TIMEOUT": "สอบถามระบบภายนอกหมดเวลา กรุณาลองใหม่",
|
||||
"TRANSFER.PRECHECK_ALREADY_EXECUTED": "การตรวจสอบนี้ดำเนินการแล้ว",
|
||||
"TRANSFER.SELECTION_INVALID": "รายการที่เลือกมี Invoice ที่ดำเนินการไม่ได้",
|
||||
"TRANSFER.INVALID_STATE_TRANSITION": "การเปลี่ยนสถานะไม่ถูกต้อง"
|
||||
|
||||
@@ -764,7 +764,9 @@
|
||||
"pathSectionConfigured": "已配置",
|
||||
"pathSectionNotConfigured": "未配置",
|
||||
"parsingProfiles": "库存解析",
|
||||
"parsingProfilesHelp": "维护可由多个库存站点共享的库存文件结构、字段对应关系和订单字段匹配键。",
|
||||
"parsingProfilesHelp": "维护可跨站点复用的文件解析规则:库存解析面向库存字段目录与订单匹配键,收料异动面向标准异动字段(只读契约)。",
|
||||
"inventoryParsing": { "code": "库存解析编号", "name": "库存解析名称", "sampleFile": "库存样本文件", "sampleFileHint": "上传 .xls、.xlsx 或 .csv 后,系统会读取工作表、表头和少量样例,供确认库存解析。", "sampleRequired": "请先上传库存样本文件并完成结构识别。", "sourceHeader": "库存文件表头名称", "fieldMappings": "库存标准字段映射", "analysisPreview": "库存分析预览" },
|
||||
"movementParsing": { "code": "异动解析编号", "name": "异动解析名称", "sampleFile": "收料样本文件", "sampleFileHint": "上传 .xls、.xlsx 或 .csv 后,系统会读取工作表、表头和少量样例,供确认收料异动解析。", "sampleRequired": "请先上传收料异动样本文件并完成结构识别。", "sourceHeader": "异动文件表头名称", "fieldMappings": "标准异动字段映射", "analysisPreview": "异动分析预览" },
|
||||
"inventoryMapping": "库存解析",
|
||||
"inventoryMappingPlans": "解析规则",
|
||||
"inventoryFields": "库存字段目录",
|
||||
@@ -819,6 +821,21 @@
|
||||
"inventorySampleAnalysing": "正在分析库存文件结构...",
|
||||
"inventorySampleRequired": "请先上传库存样本文件并完成结构识别。",
|
||||
"parsingProfileName": "库存解析名称",
|
||||
"parsingPurposeLabel": "规则用途",
|
||||
"parsingPurposeHint": "用途创建后不可变更:库存解析面向库存字段目录,收料异动面向标准异动字段(只读契约)。",
|
||||
"parsingPurpose": { "inventory": "库存解析", "movement": "收料异动" },
|
||||
"movementMappingHint": "标准异动字段为只读业务契约(✱ 必填、🔑 匹配身份),只需为每个字段选择报表表头别名。",
|
||||
"movementRequiredMark": "必填",
|
||||
"movementIdentityMark": "匹配身份",
|
||||
"movementStandardField": "标准异动字段",
|
||||
"movementBindingLabel": "异动解析规则",
|
||||
"movementBindingNone": "未绑定",
|
||||
"movementBindingHint": "绑定已发布异动规则后,预检将复用已归档收料文件;未绑定时预检不会触发抓取(fail-closed)。",
|
||||
"movementFields": {
|
||||
"doc_no": "单号", "line_no": "项次", "in_out_flag": "进出库别", "material_code": "料号",
|
||||
"material_name": "品名", "warehouse_code": "仓库", "storage_code": "储位", "lot_no": "批号",
|
||||
"quantity": "数量", "movement_date": "异动日期"
|
||||
},
|
||||
"inventoryAnalysisFailed": "库存文件结构识别失败。",
|
||||
"inventoryAnalysisPreview": "识别结果预览",
|
||||
"inventoryAnalysisSummary": "识别到 {candidate_count} 个可选表头,当前样例行数 {sample_row_count};已建议 {valid_inventory_field_suggestions} 个库存字段。",
|
||||
@@ -955,8 +972,7 @@
|
||||
"exports": "导出记录",
|
||||
"exportsHelp": "只读查看库存导出的执行结果;不在此处重试或触发导出。",
|
||||
"externalMappings": "仓库映射",
|
||||
"mappingsHelp": "将货代仓库或库存源默认仓库映射到外部系统仓库编码。",
|
||||
"defaultMapping": "库存源默认映射",
|
||||
"mappingsHelp": "将库存源映射到外部系统仓库编码与在途仓编码;货代仓库可空,作为按收料仓库匹配映射行的键。",
|
||||
"loadFailed": "加载货代库存配置失败",
|
||||
"createNew": "新建",
|
||||
"saving": "保存中...",
|
||||
@@ -1165,12 +1181,13 @@
|
||||
"publishedImmutable": "已发布规则作为审计定义保留,不能修改。请新建规则后重新发布。",
|
||||
"source": "库存源",
|
||||
"chooseSource": "请选择库存源",
|
||||
"freightWarehouse": "货代仓库(可选)",
|
||||
"freightWarehouse": "货代仓库",
|
||||
"externalSystem": "目标系统",
|
||||
"externalOrganization": "目标组织(可选)",
|
||||
"externalSite": "目标地点(可选)",
|
||||
"externalWarehouseCode": "目标仓库编码",
|
||||
"externalWarehouseName": "目标仓库名称",
|
||||
"inTransitWarehouseCode": "在途仓编码",
|
||||
"snapshotStatus": "快照状态",
|
||||
"snapshotFile": "快照文件",
|
||||
"expiresAt": "有效至",
|
||||
@@ -5169,7 +5186,6 @@
|
||||
"title": "集成连接器",
|
||||
"subtitle": "配置外部系统客户端、接口模板与回传映射,并绑定到能力;它是自动调拨跑起来的集成配置。",
|
||||
"add": "新增",
|
||||
"formHint": "JSON 字段请在编辑框中维护;发布状态决定该配置是否被 Worker 使用。",
|
||||
"call": "调用",
|
||||
"test": "连接测试",
|
||||
"empty": "暂无数据",
|
||||
@@ -5180,6 +5196,48 @@
|
||||
"credential": "凭据引用",
|
||||
"capability": "能力清单"
|
||||
},
|
||||
"statusLabels": {
|
||||
"draft": "草稿",
|
||||
"published": "已发布",
|
||||
"retired": "已退役",
|
||||
"active": "启用中",
|
||||
"rotating": "轮换中",
|
||||
"db": "界面维护(加密保存)",
|
||||
"env": "环境变量"
|
||||
},
|
||||
"envLabels": {
|
||||
"dev": "开发",
|
||||
"test": "测试",
|
||||
"prod": "生产"
|
||||
},
|
||||
"capabilityLabels": {
|
||||
"in_transit_transfer": {
|
||||
"create_transfer": "创建调拨单",
|
||||
"query_inventory": "在途库存查询",
|
||||
"verify_duplicate": "防重校验"
|
||||
}
|
||||
},
|
||||
"writeLabels": { "yes": "是", "no": "否" },
|
||||
"idempotencyLabels": { "none": "无", "invoice": "按单据号幂等" },
|
||||
"credentialTypeLabels": {
|
||||
"password": "账密",
|
||||
"token": "令牌",
|
||||
"api_key": "API 密钥"
|
||||
},
|
||||
"lifecycle": {
|
||||
"publish": "发布",
|
||||
"unpublish": "撤回发布",
|
||||
"retire": "退役",
|
||||
"reopen": "恢复草稿"
|
||||
},
|
||||
"formHints": {
|
||||
"client": "编码是接口定义与绑定引用本实例的唯一标识,保存后不可修改。",
|
||||
"interface": "编码可自动生成;JSON 契约即接口本体,请在编辑框中维护;发布后才会被绑定解析自动调用。",
|
||||
"binding": "绑定决定能力在指定环境/来源下路由到哪个客户端与接口;仅「已发布」的绑定会被自动调用。",
|
||||
"credential": "db 模式在界面维护账号密码并由服务端加密落库;env 模式仅登记环境变量键名,真实值由环境注入。",
|
||||
"credentialImmutable": "以上信息创建后不可更改;如需变更请新建凭据引用,并将客户端实例指向新引用。",
|
||||
"capability": "平台已注册的业务能力清单(只读),可在此手动试调。"
|
||||
},
|
||||
"headers": {
|
||||
"code": "编码",
|
||||
"name": "名称",
|
||||
@@ -5190,10 +5248,13 @@
|
||||
"interfaceDef": "接口定义",
|
||||
"secretRef": "Secret 引用",
|
||||
"secretProvider": "来源",
|
||||
"account": "账号",
|
||||
"capability": "能力",
|
||||
"write": "写入",
|
||||
"idempotency": "幂等",
|
||||
"actions": "操作"
|
||||
"actions": "操作",
|
||||
"endpoint": "连接地址",
|
||||
"testStatus": "连接测试"
|
||||
},
|
||||
"fields": {
|
||||
"code": "编码",
|
||||
@@ -5209,13 +5270,20 @@
|
||||
"outputSchema": "出参 Schema JSON",
|
||||
"status": "状态",
|
||||
"enabled": "启用",
|
||||
"enabledHint": "关闭后该实例的能力调用会被拒绝(视同无可用绑定),连接测试不受影响。",
|
||||
"enabledFooterHint": "随保存操作生效",
|
||||
"credentialEnabledHint": "关闭后引用该凭据的调用将立即失败(视同凭据缺失);连接测试不受影响。",
|
||||
"capability": "能力",
|
||||
"interfaceDef": "接口定义",
|
||||
"mappingVersion": "映射版本",
|
||||
"priority": "优先级",
|
||||
"effectiveFrom": "生效开始",
|
||||
"effectiveTo": "生效结束",
|
||||
"contextSelector": "上下文选择器 JSON(键值对,如 source_code=DBS-AWSBI)",
|
||||
"contextSelector": "高级路由条件 JSON",
|
||||
"contextSelectorHint": "键值对须全部包含于调用上下文才会命中;当前版本调用方不传路由上下文,留空即为默认绑定。",
|
||||
"paramMapping": "参数映射 JSON",
|
||||
"paramMappingHint": "域参数到接口参数的翻译规则(如 erp_org→organization、condition 模板);留空=同名直通。",
|
||||
"bindingClientHint": "随所选接口定义自动带出并锁定,不可单独修改。",
|
||||
"secretRef": "Secret 引用键",
|
||||
"secretProvider": "Secret 来源",
|
||||
"credentialType": "凭据类型",
|
||||
@@ -5224,17 +5292,44 @@
|
||||
"wsdl": "WSDL 地址",
|
||||
"httpMethod": "HTTP 方法",
|
||||
"requestPath": "请求路径",
|
||||
"contextSourceCode": "来源实例编码"
|
||||
"username": "用户名",
|
||||
"password": "密码",
|
||||
"visibleField": "非密文",
|
||||
"codeHint": "留空时按名称自动生成;仅小写字母、数字、连字符,保存后不可修改。",
|
||||
"codeHintInterface": "留空时按「客户端实例编码-名称」自动生成,保存后不可修改。",
|
||||
"connectorTypeHint": "随客户端实例自动确定,不可单独修改。",
|
||||
"statusHint": "新建保存为草稿;通过列表「发布 / 撤回 / 退役 / 恢复」按钮更新。",
|
||||
"credentialNone": "无(匿名访问)",
|
||||
"credentialRefHint": "引用统一保管的凭据(密码加密存放);换密码只需更新凭据引用,无需改客户端。"
|
||||
},
|
||||
"credentialFields": {
|
||||
"username": "用户名",
|
||||
"password": "密码",
|
||||
"token": "令牌",
|
||||
"api_key": "API 密钥"
|
||||
},
|
||||
"msg": {
|
||||
"fillClient": "请填写编码与名称",
|
||||
"fillInterface": "请填写编码并选择客户端实例",
|
||||
"fillClient": "请填写名称",
|
||||
"fillInterface": "请选择客户端实例(编码可自动生成)",
|
||||
"fillBinding": "请填写能力、客户端实例与接口定义",
|
||||
"fillCredential": "请填写编码与 Secret 引用",
|
||||
"fillCredentialDb": "请填写编码,以及必填凭据字段:{fields}",
|
||||
"credentialTypeMissing": "凭据类型清单未加载,请刷新页面后重试",
|
||||
"credentialPlaceholdersHint": "该凭据提供的模板占位符:",
|
||||
"invalidJson": "{field} JSON 格式无效",
|
||||
"unsavedConfirm": "当前有未保存的更改,确定关闭吗?",
|
||||
"saved": "已保存",
|
||||
"deleted": "已删除",
|
||||
"testOk": "连接测试通过"
|
||||
"testOk": "连接测试通过",
|
||||
"codeInvalid": "编码仅允许小写字母、数字和连字符,且以字母或数字开头",
|
||||
"deleteConfirm": "确定删除客户端实例「{name}」({code})吗?引用它的接口定义与绑定将失效。",
|
||||
"toggleFailed": "启停切换失败",
|
||||
"testFailed": "连接失败({code})",
|
||||
"testing": "测试中…",
|
||||
"statusUpdated": "状态已更新",
|
||||
"statusUpdateFailed": "状态更新失败",
|
||||
"retireInterfaceConfirm": "退役后,引用该接口的绑定将同时失效;可「恢复草稿」后重新发布。确定退役吗?",
|
||||
"retireBindingConfirm": "退役后,该绑定将退出自动调用;可「恢复草稿」后重新发布。确定退役吗?"
|
||||
},
|
||||
"callModal": {
|
||||
"title": "调用能力:{capability}",
|
||||
@@ -5251,8 +5346,28 @@
|
||||
"endpoint": "https://erp-api.example.com/ws",
|
||||
"wsdl": "https://erp-api.example.com/wsdl",
|
||||
"requestPath": "路径支持占位符,如 /transfer/xxx",
|
||||
"contextSourceCode": "例如 DBS-AWSBI"
|
||||
"passwordKeep": "留空则保持原密码不变"
|
||||
},
|
||||
"advancedConfig": "高级配置(JSON)"
|
||||
"advancedConfig": "高级配置(JSON)",
|
||||
"formatJson": "格式化",
|
||||
"invalidJsonHint": "JSON 格式无效,请修正后再保存",
|
||||
"testOkBadge": "连接正常",
|
||||
"testFailBadge": "连接失败",
|
||||
"testDetailToggle": "点击展开/收起详情",
|
||||
"advancedHints": {
|
||||
"withKeys": "当前生效的配置键:{keys};其余键仅保存透传、暂不生效。",
|
||||
"none": "当前连接器类型暂无额外生效的配置键;此处内容会原样保存,供后续扩展使用。"
|
||||
},
|
||||
"sections": {
|
||||
"basic": "基本信息",
|
||||
"connection": "连接配置",
|
||||
"advanced": "高级",
|
||||
"contract": "接口契约(JSON)",
|
||||
"credentialValues": "凭据值"
|
||||
},
|
||||
"connectorTypes": {
|
||||
"rest": "REST API",
|
||||
"soap": "SOAP 服务"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3783,7 +3783,11 @@
|
||||
"notMaturedCount": "当天收料",
|
||||
"blockedCount": "阻断",
|
||||
"estimatedQuantity": "预计调拨数量",
|
||||
"estimatedErpWrites": "预计 ERP 单据",
|
||||
"estimatedExternalWrites": "预计 ERP 单据",
|
||||
"reasonQuantityMismatch": "ERP 账面库存数量与收料数量不一致",
|
||||
"reasonInventoryNotFound": "ERP 无此批号的库存记录,库存按 0 展示",
|
||||
"reasonExternalQueryFailed": "外部系统查询失败",
|
||||
"reasonFutureDate": "收料日期晚于业务日期",
|
||||
"selectedCount": "已选 {count} 张",
|
||||
"generateTransfer": "直接生成调拨单",
|
||||
"colSource": "收料来源",
|
||||
@@ -3791,9 +3795,18 @@
|
||||
"colName": "品名",
|
||||
"colSpec": "规格",
|
||||
"colInvoice": "Invoice",
|
||||
"colReceiptDate": "收料日期",
|
||||
"colFromWarehouse": "拨出仓库",
|
||||
"colFromQty": "拨出数量",
|
||||
"colFromQty": "库存数量",
|
||||
"colToWarehouse": "拨入仓库",
|
||||
"colFromBatch": "拨出批号",
|
||||
"filterPlaceholder": "按料号 / 品名 / Invoice / 批号筛选",
|
||||
"filterAll": "全部结果",
|
||||
"requerySelected": "重查选中 ERP 库存",
|
||||
"receiptDateLabel": "收料日期",
|
||||
"receiptDateTo": "收料日期止",
|
||||
"receiptDateHint": "截止不超出 D+1 规则(业务日期前一天)",
|
||||
"requeryRow": "重查",
|
||||
"colToQty": "拨入数量",
|
||||
"colResult": "预检结果",
|
||||
"resultExecutable": "可执行",
|
||||
@@ -3835,9 +3848,17 @@
|
||||
"noBacklog": "暂无待处理异常",
|
||||
"sourceSelectTitle": "选择收料来源实例",
|
||||
"sourceSelectHint": "DBS、Crane 仅为平台分组;请勾选实际需要处理的来源实例。",
|
||||
"selectAll": "全选",
|
||||
"transferTypeLabel": "调拨类型",
|
||||
"transferType": {
|
||||
"in_transit_to_hub": "在途仓至HUB仓",
|
||||
"hub_repair_out": "HUB仓维修出",
|
||||
"hub_to_hub": "HUB仓间调拨"
|
||||
},
|
||||
"transferTypeComingSoon": "即将上线",
|
||||
"precheckParams": "预检参数",
|
||||
"selectAll": "本组全选",
|
||||
"selectEnabledAll": "全选已启用",
|
||||
"clearSources": "清空",
|
||||
"clearSources": "清空选择",
|
||||
"selectedSourceCount": "已选 {count} 个来源实例",
|
||||
"needSelectSource": "请至少选择一个已启用来源实例",
|
||||
"confirmScopeAndPrecheck": "确认范围并预检",
|
||||
@@ -3858,11 +3879,14 @@
|
||||
"fileReady": "文件已就绪",
|
||||
"fileFetching": "抓取中",
|
||||
"fileFailed": "抓取失败",
|
||||
"fileExpired": "文件已过期",
|
||||
"sourceErrorTitle": "来源处理失败",
|
||||
"fileNone": "待抓取",
|
||||
"needReadyFile": "所选来源存在无收料文件/或抓取中/或失败,请先重试收料 RPA",
|
||||
"selectVisible": "全选可见",
|
||||
"selectRetryable": "只选可重试",
|
||||
"batchRetry": "批量重试 RPA",
|
||||
"downloadFiles": "下载收料文件",
|
||||
"selectedRetryableCount": "其中 {count} 个可重试",
|
||||
"noRetryable": "所选来源均无需重试(已就绪或抓取中)"
|
||||
}
|
||||
|
||||
@@ -355,7 +355,6 @@
|
||||
"SHIPPING_CUSTOMER_CHANGE_REASON_REQUIRED": "修改客户状态、简码或自动匹配授权时必须填写原因。",
|
||||
"SHIPPING_CUSTOMER_NAME_REQUIRED": "标准客户名称必填。",
|
||||
"SHIPPING_CUSTOMER_SHORT_CODE_INVALID": "客户简码必须为 2-6 位英文字母。",
|
||||
"SHIPPING_CUSTOMER_SHORT_CODE_EXISTS": "客户简码已存在。",
|
||||
"SHIPPING_CUSTOMER_STATUS_INVALID": "客户状态无效。",
|
||||
"SHIPPING_CUSTOMER_CONFLICT": "客户数据冲突。",
|
||||
"SHIPPING_CUSTOMER_IDENTIFIER_TYPE_INVALID": "识别证据类型无效。",
|
||||
@@ -377,7 +376,6 @@
|
||||
"SHIPPING_CUSTOMER_IMPORT_COLUMNS_MISSING": "导入文件缺少必要列。",
|
||||
"SHIPPING_CUSTOMER_IMPORT_KEY_REQUIRED": "历史客户键必填。",
|
||||
"SHIPPING_CUSTOMER_IMPORT_DUPLICATE_KEY": "同一来源存在重复历史客户键。",
|
||||
"SHIPPING_CUSTOMER_IMPORT_SHORT_CODE_CONFLICT": "客户简码与现有客户冲突。",
|
||||
"SHIPPING_CUSTOMER_IMPORT_NAME_MATCH": "客户名称可能与现有客户重复。",
|
||||
"SHIPPING_CUSTOMER_IMPORT_IDENTIFIER_CUSTOMER_MISSING": "识别证据找不到对应客户。",
|
||||
"SHIPPING_CUSTOMER_IMPORT_NOT_FOUND": "导入批次不存在。",
|
||||
@@ -555,8 +553,8 @@
|
||||
"TRANSFER_SECRET_NOT_EXPOSED": "不允许暴露敏感凭据。",
|
||||
"TRANSFER_NOTIFICATION_FAILED": "通知发送失败,不影响 ERP 结果。",
|
||||
"TRANSFER.ROUTE_NOT_RESOLVED": "来源实例路由归属未配置。",
|
||||
"TRANSFER.ERP_NOT_FROZEN": "ERP 契约未冻结,禁止调用。",
|
||||
"TRANSFER.ERP_QUERY_TIMEOUT": "ERP 查询超时,请重试。",
|
||||
"TRANSFER.EXTERNAL_NOT_FROZEN": "外部系统契约未冻结,禁止调用。",
|
||||
"TRANSFER.EXTERNAL_QUERY_TIMEOUT": "外部系统查询超时,请重试。",
|
||||
"TRANSFER.PRECHECK_ALREADY_EXECUTED": "该预检已执行,请勿重复提交。",
|
||||
"TRANSFER.SELECTION_INVALID": "选择范围包含不可执行 Invoice。",
|
||||
"TRANSFER.INVALID_STATE_TRANSITION": "非法状态转换。"
|
||||
|
||||
@@ -635,7 +635,9 @@
|
||||
"pathSectionConfigured": "已設定",
|
||||
"pathSectionNotConfigured": "未設定",
|
||||
"parsingProfiles": "庫存解析",
|
||||
"parsingProfilesHelp": "維護可由多個庫存站點共用的庫存檔案結構、欄位對應與訂單欄位匹配鍵。",
|
||||
"parsingProfilesHelp": "維護可跨站點共用的檔案解析規則:庫存解析面向庫存欄位目錄與訂單匹配鍵,收料異動面向標準異動欄位(唯讀契約)。",
|
||||
"inventoryParsing": { "code": "庫存解析編碼", "name": "庫存解析名稱", "sampleFile": "庫存樣本檔案", "sampleFileHint": "上傳 .xls、.xlsx 或 .csv 後,系統會讀取工作表、表頭與少量樣例,供確認庫存解析。", "sampleRequired": "請先上傳庫存樣本檔案並完成結構識別。", "sourceHeader": "庫存檔案表頭名稱", "fieldMappings": "庫存標準欄位映射", "analysisPreview": "庫存分析預覽" },
|
||||
"movementParsing": { "code": "異動解析編碼", "name": "異動解析名稱", "sampleFile": "收料樣本檔案", "sampleFileHint": "上傳 .xls、.xlsx 或 .csv 後,系統會讀取工作表、表頭與少量樣例,供確認收料異動解析。", "sampleRequired": "請先上傳收料異動樣本檔案並完成結構識別。", "sourceHeader": "異動檔案表頭名稱", "fieldMappings": "標準異動欄位映射", "analysisPreview": "異動分析預覽" },
|
||||
"inventoryMapping": "庫存解析",
|
||||
"inventoryMappingPlans": "解析規則",
|
||||
"inventoryFields": "庫存欄位目錄",
|
||||
@@ -690,6 +692,21 @@
|
||||
"inventorySampleAnalysing": "正在分析庫存檔案結構...",
|
||||
"inventorySampleRequired": "請先上傳庫存樣本檔案並完成結構識別。",
|
||||
"parsingProfileName": "庫存解析名稱",
|
||||
"parsingPurposeLabel": "規則用途",
|
||||
"parsingPurposeHint": "用途建立後不可變更:庫存解析面向庫存欄位目錄,收料異動面向標準異動欄位(唯讀契約)。",
|
||||
"parsingPurpose": { "inventory": "庫存解析", "movement": "收料異動" },
|
||||
"movementMappingHint": "標準異動欄位為唯讀業務契約(✱ 必填、🔑 匹配身份),只需為每個欄位選擇報表表頭別名。",
|
||||
"movementRequiredMark": "必填",
|
||||
"movementIdentityMark": "匹配身份",
|
||||
"movementStandardField": "標準異動欄位",
|
||||
"movementBindingLabel": "異動解析規則",
|
||||
"movementBindingNone": "未綁定",
|
||||
"movementBindingHint": "綁定已發布異動規則後,預檢將複用已歸檔收料文件;未綁定時預檢不會觸發抓取(fail-closed)。",
|
||||
"movementFields": {
|
||||
"doc_no": "單號", "line_no": "項次", "in_out_flag": "進出庫別", "material_code": "料號",
|
||||
"material_name": "品名", "warehouse_code": "倉庫", "storage_code": "儲位", "lot_no": "批號",
|
||||
"quantity": "數量", "movement_date": "異動日期"
|
||||
},
|
||||
"inventoryAnalysisFailed": "庫存檔案結構識別失敗。",
|
||||
"inventoryAnalysisPreview": "識別結果預覽",
|
||||
"inventoryAnalysisSummary": "識別到 {candidate_count} 個可選表頭,目前樣例行數 {sample_row_count};已建議 {valid_inventory_field_suggestions} 個庫存欄位。",
|
||||
@@ -826,8 +843,7 @@
|
||||
"exports": "匯出記錄",
|
||||
"exportsHelp": "唯讀查看庫存匯出的執行結果;此處不重試或觸發匯出。",
|
||||
"externalMappings": "倉庫映射",
|
||||
"mappingsHelp": "將貨代倉庫或庫存來源預設倉庫對應至外部系統倉庫編碼。",
|
||||
"defaultMapping": "庫存來源預設對應",
|
||||
"mappingsHelp": "將庫存來源對應至外部系統倉庫編碼與在途倉編碼;貨代倉庫可為空,作為按收料倉庫匹配映射列的鍵。",
|
||||
"loadFailed": "載入貨代庫存設定失敗",
|
||||
"createNew": "新增",
|
||||
"saving": "儲存中...",
|
||||
@@ -1036,12 +1052,13 @@
|
||||
"publishedImmutable": "已發布規則作為稽核定義保留,不能修改。請新增規則後重新發布。",
|
||||
"source": "庫存來源",
|
||||
"chooseSource": "請選擇庫存來源",
|
||||
"freightWarehouse": "貨代倉庫(可選)",
|
||||
"freightWarehouse": "貨代倉庫",
|
||||
"externalSystem": "目標系統",
|
||||
"externalOrganization": "目標組織(可選)",
|
||||
"externalSite": "目標地點(可選)",
|
||||
"externalWarehouseCode": "目標倉庫編碼",
|
||||
"externalWarehouseName": "目標倉庫名稱",
|
||||
"inTransitWarehouseCode": "在途倉編碼",
|
||||
"snapshotStatus": "快照狀態",
|
||||
"snapshotFile": "快照檔案",
|
||||
"expiresAt": "有效至",
|
||||
@@ -5015,7 +5032,6 @@
|
||||
"title": "整合連接器",
|
||||
"subtitle": "設定外部系統客戶端、介面範本與回傳映射,並繫結到能力;這是自動調撥能運行的整合設定。",
|
||||
"add": "新增",
|
||||
"formHint": "JSON 欄位請在編輯框中維護;發布狀態決定該設定是否被 Worker 使用。",
|
||||
"call": "呼叫",
|
||||
"test": "連線測試",
|
||||
"empty": "暫無資料",
|
||||
@@ -5026,6 +5042,48 @@
|
||||
"credential": "憑證引用",
|
||||
"capability": "能力清單"
|
||||
},
|
||||
"statusLabels": {
|
||||
"draft": "草稿",
|
||||
"published": "已發布",
|
||||
"retired": "已退役",
|
||||
"active": "啟用中",
|
||||
"rotating": "輪換中",
|
||||
"db": "介面維護(加密保存)",
|
||||
"env": "環境變數"
|
||||
},
|
||||
"envLabels": {
|
||||
"dev": "開發",
|
||||
"test": "測試",
|
||||
"prod": "生產"
|
||||
},
|
||||
"capabilityLabels": {
|
||||
"in_transit_transfer": {
|
||||
"create_transfer": "建立調撥單",
|
||||
"query_inventory": "在途庫存查詢",
|
||||
"verify_duplicate": "防重校驗"
|
||||
}
|
||||
},
|
||||
"writeLabels": { "yes": "是", "no": "否" },
|
||||
"idempotencyLabels": { "none": "無", "invoice": "按單據號冪等" },
|
||||
"credentialTypeLabels": {
|
||||
"password": "帳密",
|
||||
"token": "權杖",
|
||||
"api_key": "API 金鑰"
|
||||
},
|
||||
"lifecycle": {
|
||||
"publish": "發布",
|
||||
"unpublish": "撤回發布",
|
||||
"retire": "退役",
|
||||
"reopen": "恢復草稿"
|
||||
},
|
||||
"formHints": {
|
||||
"client": "編碼是介面定義與繫結引用本實例的唯一標識,儲存後不可修改。",
|
||||
"interface": "編碼可自動產生;JSON 契約即介面本體,請在編輯框中維護;發布後才會被繫結解析自動呼叫。",
|
||||
"binding": "繫結決定能力在指定環境/來源下路由到哪個客戶端與介面;僅「已發布」的繫結會被自動呼叫。",
|
||||
"credential": "db 模式在介面維護帳號密碼並由伺服器端加密入庫;env 模式僅登記環境變數鍵名,實際值由環境注入。",
|
||||
"credentialImmutable": "以上資訊建立後不可更改;如需變更請建立新的憑證引用,並將用戶端實例指向新引用。",
|
||||
"capability": "平台已註冊的業務能力清單(唯讀),可在此手動試調。"
|
||||
},
|
||||
"headers": {
|
||||
"code": "編碼",
|
||||
"name": "名稱",
|
||||
@@ -5036,10 +5094,13 @@
|
||||
"interfaceDef": "介面定義",
|
||||
"secretRef": "Secret 引用",
|
||||
"secretProvider": "來源",
|
||||
"account": "帳號",
|
||||
"capability": "能力",
|
||||
"write": "寫入",
|
||||
"idempotency": "冪等",
|
||||
"actions": "操作"
|
||||
"actions": "操作",
|
||||
"endpoint": "連線位址",
|
||||
"testStatus": "連線測試"
|
||||
},
|
||||
"fields": {
|
||||
"code": "編碼",
|
||||
@@ -5047,7 +5108,7 @@
|
||||
"connectorType": "連接器類型",
|
||||
"environment": "環境",
|
||||
"credentialRef": "憑證引用編碼",
|
||||
"configJson": "連線設定 JSON(介面位址/逾時/預設 org 等)",
|
||||
"configJson": "連接配置 JSON(介面位址/逾時/預設 org 等)",
|
||||
"clientInstance": "客戶端實例",
|
||||
"requestSpec": "請求範本 JSON",
|
||||
"inputSchema": "入參 Schema JSON",
|
||||
@@ -5055,13 +5116,20 @@
|
||||
"outputSchema": "出參 Schema JSON",
|
||||
"status": "狀態",
|
||||
"enabled": "啟用",
|
||||
"enabledHint": "關閉後該實例的能力呼叫會被拒絕(視同無可用綁定),連線測試不受影響。",
|
||||
"enabledFooterHint": "隨儲存操作生效",
|
||||
"credentialEnabledHint": "關閉後引用該憑證的呼叫會立即失敗(視同憑證缺失),連線測試不受影響。",
|
||||
"capability": "能力",
|
||||
"interfaceDef": "介面定義",
|
||||
"mappingVersion": "映射版本",
|
||||
"priority": "優先順序",
|
||||
"effectiveFrom": "生效開始",
|
||||
"effectiveTo": "生效結束",
|
||||
"contextSelector": "上下文選擇器 JSON(鍵值對,如 source_code=DBS-AWSBI)",
|
||||
"contextSelector": "進階路由條件 JSON",
|
||||
"contextSelectorHint": "鍵值對須全部包含於呼叫上下文才會命中;當前版本呼叫方不傳路由上下文,留空即為預設綁定。",
|
||||
"paramMapping": "參數映射 JSON",
|
||||
"paramMappingHint": "域參數到介面參數的翻譯規則(如 erp_org→organization、condition 模板);留空=同名直通。",
|
||||
"bindingClientHint": "隨所選介面定義自動帶出並鎖定,不可單獨修改。",
|
||||
"secretRef": "Secret 引用鍵",
|
||||
"secretProvider": "Secret 來源",
|
||||
"credentialType": "憑證類型",
|
||||
@@ -5070,23 +5138,50 @@
|
||||
"wsdl": "WSDL 位址",
|
||||
"httpMethod": "HTTP 方法",
|
||||
"requestPath": "請求路徑",
|
||||
"contextSourceCode": "來源實例編碼"
|
||||
"username": "使用者名稱",
|
||||
"password": "密碼",
|
||||
"visibleField": "非密文",
|
||||
"codeHint": "留空時依名稱自動產生;僅小寫字母、數字、連字符號,儲存後不可修改。",
|
||||
"codeHintInterface": "留空時按「客戶端實例編碼-名稱」自動產生,儲存後不可修改。",
|
||||
"connectorTypeHint": "隨客戶端實例自動確定,不可單獨修改。",
|
||||
"statusHint": "新增儲存為草稿;透過清單「發布 / 撤回 / 退役 / 恢復」按鈕更新。",
|
||||
"credentialNone": "無(匿名存取)",
|
||||
"credentialRefHint": "引用統一保管的憑證(密碼加密存放);換密碼只需更新憑證引用,無需改客戶端。"
|
||||
},
|
||||
"credentialFields": {
|
||||
"username": "使用者名稱",
|
||||
"password": "密碼",
|
||||
"token": "權杖",
|
||||
"api_key": "API 金鑰"
|
||||
},
|
||||
"msg": {
|
||||
"fillClient": "請填寫編碼與名稱",
|
||||
"fillInterface": "請填寫編碼並選擇客戶端實例",
|
||||
"fillClient": "請填寫名稱",
|
||||
"fillInterface": "請選擇客戶端實例(編碼可自動產生)",
|
||||
"fillBinding": "請填寫能力、客戶端實例與介面定義",
|
||||
"fillCredential": "請填寫編碼與 Secret 引用",
|
||||
"fillCredentialDb": "請填寫編碼,以及必填憑據欄位:{fields}",
|
||||
"credentialTypeMissing": "憑據類型清單未載入,請重新整理頁面後重試",
|
||||
"credentialPlaceholdersHint": "該憑據提供的模板佔位符:",
|
||||
"invalidJson": "{field} JSON 格式無效",
|
||||
"unsavedConfirm": "目前有未儲存的變更,確定關閉嗎?",
|
||||
"saved": "已儲存",
|
||||
"deleted": "已刪除",
|
||||
"testOk": "連線測試通過"
|
||||
"testOk": "連線測試通過",
|
||||
"codeInvalid": "編碼僅允許小寫字母、數字和連字符號,且以字母或數字開頭",
|
||||
"deleteConfirm": "確定刪除客戶端實例「{name}」({code})嗎?引用它的介面定義與繫結將失效。",
|
||||
"toggleFailed": "啟停切換失敗",
|
||||
"testFailed": "連線失敗({code})",
|
||||
"testing": "測試中…",
|
||||
"statusUpdated": "狀態已更新",
|
||||
"statusUpdateFailed": "狀態更新失敗",
|
||||
"retireInterfaceConfirm": "退役後,引用該介面的繫結將同時失效;可「恢復草稿」後重新發布。確定退役嗎?",
|
||||
"retireBindingConfirm": "退役後,該繫結將退出自動呼叫;可「恢復草稿」後重新發布。確定退役嗎?"
|
||||
},
|
||||
"callModal": {
|
||||
"title": "呼叫能力:{capability}",
|
||||
"hint": "僅供偵錯:手動呼叫一個已註冊能力,入參與上下文將依目前繫結解析。",
|
||||
"hint": "僅供除錯:手動呼叫一個已註冊能力,入參與上下文將按目前繫結解析。",
|
||||
"params": "入參 JSON",
|
||||
"paramsHint": "依能力入參 Schema 填寫,例如 invoice_no / from_warehouse / to_warehouse / quantity。",
|
||||
"paramsHint": "按能力入參 Schema 填寫,例如 invoice_no / from_warehouse / to_warehouse / quantity。",
|
||||
"context": "上下文 JSON",
|
||||
"contextHint": "用於繫結選擇器匹配,如 source_code=DBS-AWSBI。",
|
||||
"result": "呼叫結果",
|
||||
@@ -5097,8 +5192,28 @@
|
||||
"endpoint": "https://erp-api.example.com/ws",
|
||||
"wsdl": "https://erp-api.example.com/wsdl",
|
||||
"requestPath": "路徑支援佔位符,如 /transfer/xxx",
|
||||
"contextSourceCode": "例如 DBS-AWSBI"
|
||||
"passwordKeep": "留空則保持原密碼不變"
|
||||
},
|
||||
"advancedConfig": "進階設定(JSON)"
|
||||
"advancedConfig": "進階配置(JSON)",
|
||||
"formatJson": "格式化",
|
||||
"invalidJsonHint": "JSON 格式無效,請修正後再儲存",
|
||||
"testOkBadge": "連線正常",
|
||||
"testFailBadge": "連線失敗",
|
||||
"testDetailToggle": "點擊展開/收起詳情",
|
||||
"advancedHints": {
|
||||
"withKeys": "目前生效的設定鍵:{keys};其餘鍵僅原樣保存、暫不生效。",
|
||||
"none": "目前連接器類型暫無額外生效的設定鍵;此處內容會原樣保存,供後續擴充使用。"
|
||||
},
|
||||
"sections": {
|
||||
"basic": "基本資訊",
|
||||
"connection": "連線設定",
|
||||
"advanced": "進階",
|
||||
"contract": "介面契約(JSON)",
|
||||
"credentialValues": "憑證值"
|
||||
},
|
||||
"connectorTypes": {
|
||||
"rest": "REST API",
|
||||
"soap": "SOAP 服務"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2640,6 +2640,7 @@
|
||||
"blockReason": "需要處理的原因",
|
||||
"manualReason": "人工說明",
|
||||
"confirmBlocked": "目前草稿未滿足建單資格,請先處理庫存源或校驗問題後再確認。",
|
||||
"autoCreateBlocked": "人工建單資格已通過,但自動建單資格未通過;確認後將由人工推進。",
|
||||
"autoGateProgressHint": "已滿足自動建單條件,等待系統啟動。",
|
||||
"autoGateWaitingHint": "已滿足自動建單條件,等待系統啟動。",
|
||||
"autoGateRunningHint": "系統正在自動建單並推進。",
|
||||
@@ -3709,7 +3710,11 @@
|
||||
"notMaturedCount": "當天收料",
|
||||
"blockedCount": "阻斷",
|
||||
"estimatedQuantity": "預計調撥數量",
|
||||
"estimatedErpWrites": "預計 ERP 單據",
|
||||
"estimatedExternalWrites": "預計 ERP 單據",
|
||||
"reasonQuantityMismatch": "ERP 帳面庫存數量與收料數量不一致",
|
||||
"reasonInventoryNotFound": "ERP 無此批號的庫存記錄,庫存按 0 顯示",
|
||||
"reasonExternalQueryFailed": "外部系統查詢失敗",
|
||||
"reasonFutureDate": "收料日期晚於業務日期",
|
||||
"selectedCount": "已選 {count} 張",
|
||||
"generateTransfer": "直接產生調撥單",
|
||||
"colSource": "收料來源",
|
||||
@@ -3717,9 +3722,18 @@
|
||||
"colName": "品名",
|
||||
"colSpec": "規格",
|
||||
"colInvoice": "Invoice",
|
||||
"colReceiptDate": "收料日期",
|
||||
"colFromWarehouse": "撥出倉庫",
|
||||
"colFromQty": "撥出數量",
|
||||
"colFromQty": "庫存數量",
|
||||
"colToWarehouse": "撥入倉庫",
|
||||
"colFromBatch": "撥出批號",
|
||||
"filterPlaceholder": "按料號 / 品名 / Invoice / 批號篩選",
|
||||
"filterAll": "全部結果",
|
||||
"requerySelected": "重查選中 ERP 庫存",
|
||||
"receiptDateLabel": "收料日期",
|
||||
"receiptDateTo": "收料日期止",
|
||||
"receiptDateHint": "截止不超出 D+1 規則(業務日期前一天)",
|
||||
"requeryRow": "重查",
|
||||
"colToQty": "撥入數量",
|
||||
"colResult": "預檢結果",
|
||||
"resultExecutable": "可執行",
|
||||
@@ -3761,9 +3775,17 @@
|
||||
"noBacklog": "暫無待處理異常",
|
||||
"sourceSelectTitle": "選擇收料來源實例",
|
||||
"sourceSelectHint": "DBS、Crane 僅為平台分組;請勾選實際需要處理的來源實例。",
|
||||
"selectAll": "全選",
|
||||
"transferTypeLabel": "調撥類型",
|
||||
"transferType": {
|
||||
"in_transit_to_hub": "在途倉至HUB倉",
|
||||
"hub_repair_out": "HUB倉維修出",
|
||||
"hub_to_hub": "HUB倉間調撥"
|
||||
},
|
||||
"transferTypeComingSoon": "即將上線",
|
||||
"precheckParams": "預檢參數",
|
||||
"selectAll": "本組全選",
|
||||
"selectEnabledAll": "全選已啟用",
|
||||
"clearSources": "清空",
|
||||
"clearSources": "清空選擇",
|
||||
"selectedSourceCount": "已選 {count} 個來源實例",
|
||||
"needSelectSource": "請至少選擇一個已啟用來源實例",
|
||||
"confirmScopeAndPrecheck": "確認範圍並預檢",
|
||||
@@ -3784,11 +3806,14 @@
|
||||
"fileReady": "檔案已就緒",
|
||||
"fileFetching": "抓取中",
|
||||
"fileFailed": "抓取失敗",
|
||||
"fileExpired": "檔案已過期",
|
||||
"sourceErrorTitle": "來源處理失敗",
|
||||
"fileNone": "待抓取",
|
||||
"needReadyFile": "所選來源存在無收料檔案/或抓取中/或失敗,請先重試收料 RPA",
|
||||
"selectVisible": "全選可見",
|
||||
"selectRetryable": "只選可重試",
|
||||
"batchRetry": "批次重試 RPA",
|
||||
"downloadFiles": "下載收料文件",
|
||||
"selectedRetryableCount": "其中 {count} 個可重試",
|
||||
"noRetryable": "所選來源均無需重試(已就緒或抓取中)"
|
||||
}
|
||||
|
||||
@@ -355,7 +355,6 @@
|
||||
"SHIPPING_CUSTOMER_CHANGE_REASON_REQUIRED": "修改客戶狀態、簡碼或自動匹配授權時必須填寫原因。",
|
||||
"SHIPPING_CUSTOMER_NAME_REQUIRED": "標準客戶名稱必填。",
|
||||
"SHIPPING_CUSTOMER_SHORT_CODE_INVALID": "客戶簡碼必須為 2-6 位英文字母。",
|
||||
"SHIPPING_CUSTOMER_SHORT_CODE_EXISTS": "客戶簡碼已存在。",
|
||||
"SHIPPING_CUSTOMER_STATUS_INVALID": "客戶狀態無效。",
|
||||
"SHIPPING_CUSTOMER_CONFLICT": "客戶資料衝突。",
|
||||
"SHIPPING_CUSTOMER_IDENTIFIER_TYPE_INVALID": "識別證據類型無效。",
|
||||
@@ -377,7 +376,6 @@
|
||||
"SHIPPING_CUSTOMER_IMPORT_COLUMNS_MISSING": "匯入檔案缺少必要欄位。",
|
||||
"SHIPPING_CUSTOMER_IMPORT_KEY_REQUIRED": "歷史客戶鍵必填。",
|
||||
"SHIPPING_CUSTOMER_IMPORT_DUPLICATE_KEY": "同一來源存在重複歷史客戶鍵。",
|
||||
"SHIPPING_CUSTOMER_IMPORT_SHORT_CODE_CONFLICT": "客戶簡碼與現有客戶衝突。",
|
||||
"SHIPPING_CUSTOMER_IMPORT_NAME_MATCH": "客戶名稱可能與現有客戶重複。",
|
||||
"SHIPPING_CUSTOMER_IMPORT_IDENTIFIER_CUSTOMER_MISSING": "識別證據找不到對應客戶。",
|
||||
"SHIPPING_CUSTOMER_IMPORT_NOT_FOUND": "匯入批次不存在。",
|
||||
@@ -555,8 +553,8 @@
|
||||
"TRANSFER_SECRET_NOT_EXPOSED": "不允許暴露敏感憑證。",
|
||||
"TRANSFER_NOTIFICATION_FAILED": "通知傳送失敗,不影響 ERP 結果。",
|
||||
"TRANSFER.ROUTE_NOT_RESOLVED": "來源實例路由歸屬未設定。",
|
||||
"TRANSFER.ERP_NOT_FROZEN": "ERP 契約未凍結,禁止呼叫。",
|
||||
"TRANSFER.ERP_QUERY_TIMEOUT": "ERP 查詢逾時,請重試。",
|
||||
"TRANSFER.EXTERNAL_NOT_FROZEN": "外部系統契約未凍結,禁止呼叫。",
|
||||
"TRANSFER.EXTERNAL_QUERY_TIMEOUT": "外部系統查詢逾時,請重試。",
|
||||
"TRANSFER.PRECHECK_ALREADY_EXECUTED": "該預檢已執行,請勿重複提交。",
|
||||
"TRANSFER.SELECTION_INVALID": "選擇範圍包含不可執行 Invoice。",
|
||||
"TRANSFER.INVALID_STATE_TRANSITION": "非法狀態轉換。"
|
||||
|
||||
Reference in new issue
Block a user