refactor(admin): 管理端组件库迁移 Element Plus
- App/ChatView 接入 ElConfigProvider 多语言(zh-CN/zh-TW/en),AdminLayout 间距壳层统一持有 - OrderProfile 全家 22 文件迁移:页头/按钮/徽标/自绘弹窗/表单控件统一 element-trial 范式 - schema/审计中心/字段资产/身份规则/库存源/连接器/调拨类型页面同步迁移,新增 __tests__ 回归 - 迁移遵循「业务脚本零改动」:事件内联适配保持原 handler 契约,焦点陷阱与关闭语义不变 - i18n admin/common 四语言补充组件文案,架构文档记录迁移范式
This commit is contained in:
1 parent
8102a1fe44
commit
bf3154033b
66 files changed
+10766
-5934
No files matched your search
@@ -30,7 +30,8 @@
|
||||
| 组织方式 | Feature-Module | 按业务域(auth / workspace / chat / admin / kb)垂直拆分,域内自包含 api / composables / views |
|
||||
| 逻辑封装 | Composables | 副作用、表单、SSE、分页等放入 `use*`,View 只做编排 |
|
||||
| 跨页状态 | Pinia | 替代 localStorage + CustomEvent 为主的跨组件可变状态 |
|
||||
| 未采用 | FSD、Element Plus | 目录层级更浅、迁移成本可控;继续 Tailwind + Design Tokens |
|
||||
| 未采用 | FSD | 目录层级更浅、迁移成本可控;继续 Tailwind + Design Tokens |
|
||||
| 受限采用 | Element Plus | 2026-10 起评审引入(admin 试点 + chat 在途调拨面板);仅用行为型组件(el-dialog/el-table/el-select 等),布局仍 Tailwind;组件显式 import + 页面级全量 CSS(含暗色 css-vars) |
|
||||
|
||||
**固定技术栈(勿擅自替换):**
|
||||
|
||||
@@ -184,7 +185,7 @@ flowchart TB
|
||||
3. **单一 HTTP 客户端**:`@/shared/api/client`;SSE 对话走 `useChat`,不另造客户端。
|
||||
4. **路由按域拆分**:新路由写入 `app/router/routes/<domain>.routes.ts`,守卫逻辑放 `guards.ts`。
|
||||
5. **i18n 四语言同步**:新增 key 须同时写入 `zh-CN`、`zh-TW`、`en`、`th` 对应 JSON。
|
||||
6. **不引入未经评审的重型 UI 库**(Element Plus、Naive UI 等);复用 `shared/components` 与 Tailwind。
|
||||
6. **重型 UI 库仅限已评审的 Element Plus**(2026-10 评审引入,见 §1 选型表):新增使用场景须延续「行为型组件 + Tailwind 布局」模式并在评审说明给出理由;Naive UI 等其余库仍禁入;复用 `shared/components` 与 Tailwind。
|
||||
7. **大页面必须薄壳化**:参考 chat / kb / schedules 模式(见 §5)。
|
||||
|
||||
### 4.2 文件体量与拆分
|
||||
|
||||
+33
-9
@@ -7,7 +7,12 @@
|
||||
* 书签/刷新冷启动遇到 401 时只回登录页;本页已确认会话后中途失效才弹窗。
|
||||
*/
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { watch, onMounted, onBeforeUnmount } from 'vue';
|
||||
import { computed, watch, onMounted, onBeforeUnmount } from 'vue';
|
||||
import { ElConfigProvider } from 'element-plus';
|
||||
import zhCn from 'element-plus/es/locale/lang/zh-cn';
|
||||
import zhTw from 'element-plus/es/locale/lang/zh-tw';
|
||||
import en from 'element-plus/es/locale/lang/en';
|
||||
import th from 'element-plus/es/locale/lang/th';
|
||||
import { useTheme } from '@/shared/composables/useTheme';
|
||||
import LevelMessageDialog from '@/shared/components/LevelMessageDialog.vue';
|
||||
import { useGlobalMessageDialog } from '@/shared/composables/useGlobalMessageDialog';
|
||||
@@ -18,6 +23,23 @@ import { useLinkedNavStore } from '@/features/sso/stores/linked-nav.store';
|
||||
|
||||
const router = useRouter();
|
||||
const { locale, t } = useI18n();
|
||||
|
||||
/**
|
||||
* Element Plus 组件内置文案(下拉占位/日期面板/分页等)跟随应用语言:
|
||||
* EP 有独立 locale 体系,默认英文,必须在根部经 el-config-provider 注入当前语言包。
|
||||
*/
|
||||
const elementPlusLocale = computed(() => {
|
||||
switch (locale.value) {
|
||||
case 'zh-TW':
|
||||
return zhTw;
|
||||
case 'en':
|
||||
return en;
|
||||
case 'th':
|
||||
return th;
|
||||
default:
|
||||
return zhCn;
|
||||
}
|
||||
});
|
||||
const { themePreference, initTheme, setThemePreference } = useTheme();
|
||||
const {
|
||||
messageDialogVisible,
|
||||
@@ -136,12 +158,14 @@ onBeforeUnmount(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<router-view />
|
||||
<LevelMessageDialog
|
||||
v-model="messageDialogVisible"
|
||||
:level="messageDialogLevel"
|
||||
:title="messageDialogTitle"
|
||||
:message="messageDialogContent"
|
||||
@close="closeMessageDialog"
|
||||
/>
|
||||
<el-config-provider :locale="elementPlusLocale">
|
||||
<router-view />
|
||||
<LevelMessageDialog
|
||||
v-model="messageDialogVisible"
|
||||
:level="messageDialogLevel"
|
||||
:title="messageDialogTitle"
|
||||
:message="messageDialogContent"
|
||||
@close="closeMessageDialog"
|
||||
/>
|
||||
</el-config-provider>
|
||||
</template>
|
||||
@@ -53,8 +53,9 @@ const visibleModules = computed(() =>
|
||||
ADMIN_MODULE_METAS.filter((item) => config.admin.modules[item.configKey] !== false),
|
||||
);
|
||||
|
||||
// 调拨类型(transfer_types)已移入货代管理子菜单(路由规则之下),不再作为顶级入口渲染
|
||||
const standardModules = computed(() =>
|
||||
visibleModules.value.filter((item) => item.id !== 'wecom' && item.id !== 'shipping_inventory'),
|
||||
visibleModules.value.filter((item) => item.id !== 'wecom' && item.id !== 'shipping_inventory' && item.id !== 'transfer_types'),
|
||||
);
|
||||
|
||||
const isModuleActive = (moduleId: AdminModuleId): boolean =>
|
||||
@@ -62,11 +63,19 @@ const isModuleActive = (moduleId: AdminModuleId): boolean =>
|
||||
|
||||
const isReportsActive = computed(() => route.meta.adminModule === 'reports');
|
||||
const isWecomActive = computed(() => route.meta.adminModule === 'wecom');
|
||||
const isShippingActive = computed(() => route.meta.adminModule === 'shipping_inventory');
|
||||
// 货代管理激活态涵盖调拨类型:进入该子页时父菜单高亮并自动展开
|
||||
const isShippingActive = computed(() => (
|
||||
route.meta.adminModule === 'shipping_inventory' || route.meta.adminModule === 'transfer_types'
|
||||
));
|
||||
|
||||
const shippingGroups = computed(() => [...new Set(SHIPPING_CONFIG_SUB_MODULE_METAS.map((item) => item.groupKey))]);
|
||||
const shippingExpanded = ref<Record<string, boolean>>({});
|
||||
|
||||
// 子菜单项可见性:调拨类型沿用自身的模块 config 开关,其余跟随货代管理父开关
|
||||
const visibleShippingSubMetas = computed(() =>
|
||||
SHIPPING_CONFIG_SUB_MODULE_METAS.filter((item) => item.id !== 'transfer_types' || config.admin.modules.transfer_types !== false),
|
||||
);
|
||||
|
||||
const isShippingSubActive = (sub: (typeof SHIPPING_CONFIG_SUB_MODULE_METAS)[number]): boolean => {
|
||||
if (route.name !== sub.routeName) return false;
|
||||
if (!sub.query) return true;
|
||||
@@ -224,7 +233,7 @@ watch(
|
||||
</button>
|
||||
<div v-if="shippingExpanded[groupKey]" class="pl-3 space-y-1">
|
||||
<button
|
||||
v-for="sub in SHIPPING_CONFIG_SUB_MODULE_METAS.filter((item) => item.groupKey === groupKey)"
|
||||
v-for="sub in visibleShippingSubMetas.filter((item) => item.groupKey === groupKey)"
|
||||
:key="sub.id"
|
||||
type="button"
|
||||
class="admin-nav-subitem text-left"
|
||||
|
||||
@@ -23,7 +23,8 @@ export interface ShippingConfigSubModuleMeta {
|
||||
| 'AdminShippingOrderExtractionRuns'
|
||||
| 'AdminShippingAudit'
|
||||
| 'AdminShippingProcessGates'
|
||||
| 'AdminShippingOrderDocumentProfiles';
|
||||
| 'AdminShippingOrderDocumentProfiles'
|
||||
| 'AdminTransferTypes';
|
||||
path:
|
||||
| 'shipping-notice'
|
||||
| 'shipping-field-assets'
|
||||
@@ -32,7 +33,8 @@ export interface ShippingConfigSubModuleMeta {
|
||||
| 'shipping-order-extraction-runs'
|
||||
| 'shipping-audit'
|
||||
| 'shipping-process-gates'
|
||||
| 'shipping-order-document-profiles';
|
||||
| 'shipping-order-document-profiles'
|
||||
| 'transfer-types';
|
||||
labelKey: string;
|
||||
groupKey: 'admin.nav.shippingOrderRecognition' | 'admin.nav.shippingInventoryManagement' | 'admin.nav.shippingRunAudit';
|
||||
query?: { section: 'parsing' | 'profiles' | 'sources' | 'mappings' | 'rules' | 'templates' | 'snapshots' | 'exports' };
|
||||
@@ -82,6 +84,8 @@ export const SHIPPING_CONFIG_SUB_MODULE_METAS: ShippingConfigSubModuleMeta[] = [
|
||||
{ id: 'inventory_sites', routeName: 'AdminShippingInventory', path: 'shipping-notice', labelKey: 'admin.shippingInventory.sources', groupKey: 'admin.nav.shippingInventoryManagement', query: { section: 'sources' } },
|
||||
{ id: 'warehouse_mappings', routeName: 'AdminShippingInventory', path: 'shipping-notice', labelKey: 'admin.shippingInventory.externalMappings', groupKey: 'admin.nav.shippingInventoryManagement', query: { section: 'mappings' } },
|
||||
{ id: 'routing_rules', routeName: 'AdminShippingInventory', path: 'shipping-notice', labelKey: 'admin.shippingInventory.rules', groupKey: 'admin.nav.shippingInventoryManagement', query: { section: 'rules' } },
|
||||
// 调拨类型(原顶级入口「在途调拨类型」移入货代管理,挂在路由规则之下;路由独立注册于 AdminTransferTypes)
|
||||
{ id: 'transfer_types', routeName: 'AdminTransferTypes', path: 'transfer-types', labelKey: 'admin.nav.transferTypes', groupKey: 'admin.nav.shippingInventoryManagement' },
|
||||
{ id: 'shipping_templates', routeName: 'AdminShippingInventory', path: 'shipping-notice', labelKey: 'admin.shippingInventory.excelTemplates', groupKey: 'admin.nav.shippingInventoryManagement', query: { section: 'templates' } },
|
||||
{ id: 'shipping_audit', routeName: 'AdminShippingAudit', path: 'shipping-audit', labelKey: 'admin.nav.shippingAudit', groupKey: 'admin.nav.shippingRunAudit' },
|
||||
{ id: 'process_gates', routeName: 'AdminShippingProcessGates', path: 'shipping-process-gates', labelKey: 'admin.nav.shippingProcessGates', groupKey: 'admin.nav.shippingRunAudit' },
|
||||
|
||||
+13
-6
@@ -194,19 +194,26 @@ describe('IntegrationCallLogsPanel', () => {
|
||||
});
|
||||
const wrapper = mountPanel();
|
||||
await flushPromises();
|
||||
const options = wrapper.find('[data-testid="call-filter-status"]').findAll('option')
|
||||
.map((o) => o.element.value).filter((v) => v !== '');
|
||||
// 筛选下拉已迁移 el-select:原生 <option> 由 ElOption 组件承载(下拉本体 teleport 到 body),
|
||||
// value 从组件 prop 读取(等价旧的原生 option value 枚举);「—」占位项 value 为空串需剔除
|
||||
const options = wrapper.getComponent('[data-testid="call-filter-status"]')
|
||||
.findAllComponents({ name: 'ElOption' })
|
||||
.map((o) => String(o.props('value')))
|
||||
.filter((v) => v !== '');
|
||||
expect(options).toEqual([
|
||||
'success', 'duplicate_success', 'duplicate_unverified',
|
||||
'business_failed', 'technical_failed', 'timeout', 'result_unknown',
|
||||
]);
|
||||
// 状态徽章已迁移 el-tag(success/danger type 配色替代旧 Tailwind bg-*-100 类);
|
||||
// call-row 落在首列单元格内,状态徽章在同行其他列,故改按 el-table 行定位
|
||||
const tableRows = wrapper.findAll('.el-table__row');
|
||||
// [断言意图] 成功族判定:duplicate_success(幂等重放命中,业务已成功)徽章走绿色成功侧
|
||||
const dupOkRow = wrapper.findAll('[data-testid="call-row"]')[0];
|
||||
const dupOkRow = tableRows[0];
|
||||
expect(dupOkRow.text()).toContain('duplicate_success');
|
||||
expect(dupOkRow.find('span.bg-green-100').exists()).toBe(true);
|
||||
expect(dupOkRow.find('.el-tag--success').exists()).toBe(true);
|
||||
// [断言意图] duplicate_unverified(回执未核实)保守归非成功态,徽章保持红色 ✗
|
||||
const dupUnknownRow = wrapper.findAll('[data-testid="call-row"]')[1];
|
||||
const dupUnknownRow = tableRows[1];
|
||||
expect(dupUnknownRow.text()).toContain('duplicate_unverified');
|
||||
expect(dupUnknownRow.find('span.bg-red-100').exists()).toBe(true);
|
||||
expect(dupUnknownRow.find('.el-tag--danger').exists()).toBe(true);
|
||||
});
|
||||
});
|
||||
+15
-1
@@ -7,6 +7,17 @@
|
||||
* 列表按类型标签/非密账号/来源本地化与布尔启停开关渲染。
|
||||
*/
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
|
||||
// el-table 在 jsdom 依赖 ResizeObserver 计算列布局,缺失时行不渲染单元格
|
||||
class ResizeObserverStub {
|
||||
observe(): void {}
|
||||
|
||||
unobserve(): void {}
|
||||
|
||||
disconnect(): void {}
|
||||
}
|
||||
(globalThis as Record<string, unknown>).ResizeObserver
|
||||
= (globalThis as Record<string, unknown>).ResizeObserver || ResizeObserverStub;
|
||||
import { defineComponent, h, ref } from 'vue';
|
||||
import { mount } from '@vue/test-utils';
|
||||
import { createMemoryHistory, createRouter } from 'vue-router';
|
||||
@@ -79,8 +90,11 @@ function mountPage() {
|
||||
}
|
||||
|
||||
describe('IntegrationConnectorPage credential list', () => {
|
||||
it('按重设计列渲染:类型徽标 + 非密账号 + 来源徽标 + 启停开关,不再显示 secret_ref 原文', () => {
|
||||
it('按重设计列渲染:类型徽标 + 非密账号 + 来源徽标 + 启停开关,不再显示 secret_ref 原文', async () => {
|
||||
const wrapper = mountPage();
|
||||
// el-table 行单元格在挂载后的 nextTick 才渲染(EP 迁移适配;旧手写表格为同步渲染)
|
||||
await wrapper.vm.$nextTick();
|
||||
await wrapper.vm.$nextTick();
|
||||
const text = wrapper.text();
|
||||
// password 类型:类型标签 + 非密账号(username 值)+ 来源本地化;状态不走文字(开关 + 悬停提示)
|
||||
expect(text).toContain('tiptop-erp');
|
||||
|
||||
+453
-357
@@ -3,9 +3,11 @@
|
||||
用途:集成连接器管理页——四个配置实体(客户端实例/接口定义/绑定/凭据引用)tab 列表 +
|
||||
能力清单与手动调用测试;创建/编辑抽屉 + 行内连接测试;调用日志 tab
|
||||
承载筛选/分页列表/详情抽屉(能力无关通用口径)。
|
||||
依赖:useIntegrationConnectorAdmin、抽屉与调用测试弹窗组件、useI18n。
|
||||
逻辑:按 tab 展示列表与「新增」;客户端列表展示类型/环境徽章、行内启停开关与
|
||||
连接测试结果(徽章 + 可展开详情);接口定义与绑定列表均以状态徽章 + 生命周期行内
|
||||
依赖:element-plus(表格/页签/开关/标签/空态/骨架屏,沿用管理端 element-trial 主题)、
|
||||
useIntegrationConnectorAdmin、抽屉与调用测试弹窗组件、useI18n。
|
||||
逻辑:按 tab 展示列表与「新增」(el-tabs name 绑定 activeTab,capability/calls 只读 tab
|
||||
不切 activeEntity);客户端列表展示类型/环境徽章、行内启停开关与
|
||||
连接测试结果(徽章 + 点击展开详情);接口定义与绑定列表均以状态徽章 + 生命周期行内
|
||||
按钮(发布/撤回/退役/恢复,绑定发布由后端就绪门禁校验接口已发布且客户端启用)
|
||||
驱动状态,表单内状态只读;凭据列表布尔启停走行内开关
|
||||
(与客户端实例一致,表头同为「启用」,开关不带状态文字,精确状态走悬停提示);
|
||||
@@ -13,17 +15,38 @@
|
||||
接口/绑定列表的客户端与接口
|
||||
引用列统一展示「名称 + 编码」两行;类型/环境/状态取值均本地化,
|
||||
未知值兜底原样显示;配置「绑定」是让自动调拨跑起来的最小闭环核心。
|
||||
视觉层已迁移 Element Plus(element-trial 主题),布局间距由 AdminLayout 壳层持有
|
||||
(根节点裸铺 + 内部分区,页面不自带水平 padding/max-w)。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { Plus, Edit, Trash2, Plug, PlayCircle } from 'lucide-vue-next';
|
||||
import {
|
||||
ElButton,
|
||||
ElEmpty,
|
||||
ElSkeleton,
|
||||
ElSwitch,
|
||||
ElTable,
|
||||
ElTableColumn,
|
||||
ElTabPane,
|
||||
ElTabs,
|
||||
ElTag,
|
||||
} from 'element-plus';
|
||||
import { Connection, Delete, Edit, Plus, VideoPlay } from '@element-plus/icons-vue';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import IntegrationConnectorFormDrawer from './components/IntegrationConnectorFormDrawer.vue';
|
||||
import IntegrationCapabilityCallModal from './components/IntegrationCapabilityCallModal.vue';
|
||||
import IntegrationCallLogsPanel from './components/IntegrationCallLogsPanel.vue';
|
||||
import { CONNECTOR_TYPE_OPTIONS, ENVIRONMENT_OPTIONS } from './types/integration-connector.types';
|
||||
import { useIntegrationConnectorAdmin } from './composables/useIntegrationConnectorAdmin';
|
||||
import type { IntegrationBindingRow } from './types/integration-connector.types';
|
||||
import type {
|
||||
IntegrationBindingRow,
|
||||
IntegrationClientInstanceRow,
|
||||
IntegrationCredentialReferenceRow,
|
||||
IntegrationInterfaceDefinitionRow,
|
||||
} from './types/integration-connector.types';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
@@ -97,6 +120,13 @@ function envLabel(value: string) {
|
||||
: value;
|
||||
}
|
||||
|
||||
/** 环境徽章配色:生产绿 / 测试橙 / 其余中性(el-tag type 映射)。 */
|
||||
function envTagType(value: string): 'success' | 'warning' | 'info' {
|
||||
if (value === 'prod') return 'success';
|
||||
if (value === 'test') return 'warning';
|
||||
return 'info';
|
||||
}
|
||||
|
||||
/** 状态本地化标签;未知值兜底原样显示。 */
|
||||
function statusLabel(value: string) {
|
||||
return t(`admin.integrationConnector.statusLabels.${value}`, value);
|
||||
@@ -129,11 +159,11 @@ function credentialAccountText(row: { secret_provider: string; secret_fields: Re
|
||||
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';
|
||||
/** 状态徽章配色:启用/已发布绿 / 轮换中橙 / 其余中性(el-tag type 映射)。 */
|
||||
function statusTagType(value: string): 'success' | 'warning' | 'info' {
|
||||
if (value === 'active' || value === 'published') return 'success';
|
||||
if (value === 'rotating') return 'warning';
|
||||
return 'info';
|
||||
}
|
||||
|
||||
/** 行内测试结果(无结果返回 null,供模板 v-if 使用)。 */
|
||||
@@ -141,13 +171,6 @@ 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
|
||||
@@ -170,368 +193,324 @@ function selectTab(key: TabKey) {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="admin-table-section animate-fade-in-up">
|
||||
<div class="admin-table-header admin-table-header--stacked">
|
||||
<section class="connector-page">
|
||||
<header class="page-header">
|
||||
<div>
|
||||
<h2 class="section-title">{{ t('admin.integrationConnector.title') }}</h2>
|
||||
<p class="section-desc mt-1">{{ t('admin.integrationConnector.subtitle') }}</p>
|
||||
<h2 class="page-title">{{ t('admin.integrationConnector.title') }}</h2>
|
||||
<p class="page-subtitle">{{ t('admin.integrationConnector.subtitle') }}</p>
|
||||
</div>
|
||||
<button
|
||||
<el-button
|
||||
v-if="activeTab !== 'capability' && activeTab !== 'calls'"
|
||||
type="button"
|
||||
class="flex items-center gap-2 px-4 py-2 bg-brand-600 text-white rounded-xl hover:bg-brand-700 transition-all shadow-lg shadow-brand-200 active:scale-95 text-sm font-medium"
|
||||
type="primary"
|
||||
:icon="Plus"
|
||||
@click="openCreateModal(activeEntity)"
|
||||
>
|
||||
<Plus class="w-4 h-4" />
|
||||
<span>{{ t('admin.integrationConnector.add') }}</span>
|
||||
</button>
|
||||
</div>
|
||||
{{ t('admin.integrationConnector.add') }}
|
||||
</el-button>
|
||||
</header>
|
||||
|
||||
<div class="flex gap-1 border-b border-default" role="tablist">
|
||||
<button
|
||||
v-for="tab in tabs"
|
||||
:key="tab.key"
|
||||
type="button"
|
||||
role="tab"
|
||||
class="px-4 py-2.5 text-sm font-medium border-b-2 -mb-px transition-colors"
|
||||
:class="activeTab === tab.key ? 'border-brand-600 text-brand-600' : 'border-transparent text-muted hover:text-secondary'"
|
||||
:aria-selected="activeTab === tab.key"
|
||||
@click="selectTab(tab.key)"
|
||||
>
|
||||
{{ t(tab.labelKey) }}
|
||||
</button>
|
||||
</div>
|
||||
<el-tabs :model-value="activeTab" class="connector-tabs" @tab-change="selectTab($event as TabKey)">
|
||||
<el-tab-pane v-for="tab in tabs" :key="tab.key" :name="tab.key" :label="t(tab.labelKey)" />
|
||||
</el-tabs>
|
||||
|
||||
<div v-if="isLoading" class="flex items-center justify-center py-20">
|
||||
<div class="animate-spin rounded-full h-10 w-10 border-b-2 border-brand-600" />
|
||||
</div>
|
||||
<el-skeleton v-if="isLoading" :rows="6" animated class="page-skeleton" />
|
||||
|
||||
<template v-else>
|
||||
<!-- 客户端实例 -->
|
||||
<div v-if="activeTab === 'client'" class="admin-table-wrap">
|
||||
<table class="admin-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<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-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="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>
|
||||
</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>
|
||||
<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>
|
||||
<el-table v-if="activeTab === 'client'" :data="clients" row-key="code">
|
||||
<template #empty>
|
||||
<el-empty :description="t('admin.integrationConnector.empty')" :image-size="60" />
|
||||
</template>
|
||||
<el-table-column :label="t('admin.integrationConnector.headers.name')" min-width="180">
|
||||
<template #default="{ row }">
|
||||
<p class="cell-primary">{{ row.name }}</p>
|
||||
<p class="cell-mono">{{ row.code }}</p>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.headers.connectorType')" width="130">
|
||||
<template #default="{ row }">
|
||||
<el-tag type="info" effect="plain" size="small">{{ connectorTypeLabel(row.connector_type) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.headers.environment')" width="90">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="envTagType(row.environment)" size="small">{{ envLabel(row.environment) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.headers.endpoint')" min-width="200">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row.endpoint" class="cell-ellipsis mono" :title="row.endpoint">{{ row.endpoint }}</span>
|
||||
<span v-else class="cell-muted">—</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.fields.enabled')" width="80">
|
||||
<template #default="{ row }">
|
||||
<el-switch
|
||||
:model-value="row.enabled"
|
||||
:disabled="lifecycleBusy"
|
||||
:title="t('admin.integrationConnector.fields.enabled')"
|
||||
data-testid="client-toggle"
|
||||
@change="toggleClient(row as IntegrationClientInstanceRow)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.headers.testStatus')" width="140">
|
||||
<template #default="{ row }">
|
||||
<span v-if="testingClientCode === row.code" class="cell-muted">{{ t('admin.integrationConnector.msg.testing') }}</span>
|
||||
<template v-else-if="testResultOf(row.code)">
|
||||
<el-tag
|
||||
:type="testResultOf(row.code)?.ok ? 'success' : 'danger'"
|
||||
size="small"
|
||||
class="test-badge"
|
||||
:title="t('admin.integrationConnector.testDetailToggle')"
|
||||
data-testid="client-test-badge"
|
||||
@click="expandedTestCode = expandedTestCode === row.code ? '' : row.code"
|
||||
>
|
||||
{{ testBadgeText(row.code) }}
|
||||
</el-tag>
|
||||
<!-- 测试详情展开区:原因码 + 脱敏消息(点击徽章展开/收起) -->
|
||||
<p
|
||||
v-if="expandedTestCode === row.code"
|
||||
class="test-detail"
|
||||
data-testid="client-test-detail"
|
||||
>{{ testDetailText(row.code) }}</p>
|
||||
</template>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<span v-else class="cell-muted">{{ t('admin.integrationConnector.testNotRun') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.headers.actions')" width="140" align="right">
|
||||
<template #default="{ row }">
|
||||
<div class="row-actions">
|
||||
<el-button link type="primary" :icon="Connection" :title="t('admin.integrationConnector.test')" @click="testConnection(row.code)" />
|
||||
<el-button link type="primary" :icon="Edit" :title="t('admin.edit')" @click="openEditModal('client', row as IntegrationClientInstanceRow)" />
|
||||
<el-button link type="danger" :icon="Delete" :title="t('admin.delete')" @click="deleteClient(row as IntegrationClientInstanceRow)" />
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 接口定义:状态徽章 + 生命周期行内按钮(发布/撤回/退役/恢复,后端转移表校验) -->
|
||||
<div v-else-if="activeTab === 'interface'" class="admin-table-wrap">
|
||||
<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.clientInstance') }}</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="interfaces.length === 0"><td colspan="5" class="px-6 admin-table-empty">{{ t('admin.integrationConnector.empty') }}</td></tr>
|
||||
<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">
|
||||
<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>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<el-table v-else-if="activeTab === 'interface'" :data="interfaces" row-key="code">
|
||||
<template #empty>
|
||||
<el-empty :description="t('admin.integrationConnector.empty')" :image-size="60" />
|
||||
</template>
|
||||
<el-table-column :label="t('admin.integrationConnector.headers.code')" min-width="180">
|
||||
<template #default="{ row }">
|
||||
<span class="cell-primary mono">{{ row.code }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.headers.name')" min-width="160">
|
||||
<template #default="{ row }">{{ row.name }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.headers.clientInstance')" min-width="180">
|
||||
<template #default="{ row }">
|
||||
<p class="cell-primary">{{ clientNameOf(row.client_instance_code) || row.client_instance_code }}</p>
|
||||
<p class="cell-mono">{{ row.client_instance_code }}</p>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.headers.status')" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="statusTagType(row.status)" size="small" data-testid="interface-status">{{ statusLabel(row.status) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.headers.actions')" width="200" align="right">
|
||||
<template #default="{ row }">
|
||||
<div class="row-actions">
|
||||
<!-- 生命周期按钮按当前状态显隐:draft→发布;published→撤回+退役;retired→恢复 -->
|
||||
<el-button
|
||||
v-if="row.status === 'draft'"
|
||||
link
|
||||
type="primary"
|
||||
data-testid="interface-publish"
|
||||
:disabled="lifecycleBusy"
|
||||
@click="changeInterfaceLifecycle(row as IntegrationInterfaceDefinitionRow, 'publish')"
|
||||
>{{ t('admin.integrationConnector.lifecycle.publish') }}</el-button>
|
||||
<template v-else-if="row.status === 'published'">
|
||||
<el-button
|
||||
link
|
||||
type="info"
|
||||
data-testid="interface-unpublish"
|
||||
:disabled="lifecycleBusy"
|
||||
@click="changeInterfaceLifecycle(row as IntegrationInterfaceDefinitionRow, 'unpublish')"
|
||||
>{{ t('admin.integrationConnector.lifecycle.unpublish') }}</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="warning"
|
||||
data-testid="interface-retire"
|
||||
:disabled="lifecycleBusy"
|
||||
@click="changeInterfaceLifecycle(row as IntegrationInterfaceDefinitionRow, 'retire')"
|
||||
>{{ t('admin.integrationConnector.lifecycle.retire') }}</el-button>
|
||||
</template>
|
||||
<el-button
|
||||
v-else-if="row.status === 'retired'"
|
||||
link
|
||||
type="info"
|
||||
data-testid="interface-reopen"
|
||||
:disabled="lifecycleBusy"
|
||||
@click="changeInterfaceLifecycle(row as IntegrationInterfaceDefinitionRow, 'reopen')"
|
||||
>{{ t('admin.integrationConnector.lifecycle.reopen') }}</el-button>
|
||||
<el-button link type="primary" :icon="Edit" :title="t('admin.edit')" @click="openEditModal('interface', row as IntegrationInterfaceDefinitionRow)" />
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 绑定:状态徽章 + 生命周期行内按钮(发布/撤回/退役/恢复,后端转移表 + 发布就绪门禁校验) -->
|
||||
<div v-else-if="activeTab === 'binding'" class="admin-table-wrap">
|
||||
<table class="admin-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<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 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">
|
||||
<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 v-for="(step, idx) in bindingStepsOf(row)" :key="`c-${step.interface_code}-${idx}`" class="text-sm text-primary">
|
||||
<span class="mr-1 text-xs text-muted">{{ idx + 1 }}.</span>{{ clientNameOf(step.client_code) || step.client_code }}
|
||||
</p>
|
||||
</td>
|
||||
<td class="px-6 py-4">
|
||||
<!-- 有序步骤编排:编号 + 接口名,悬停显示接口编码;旧单步行兜底为一步 -->
|
||||
<p v-for="(step, idx) in bindingStepsOf(row)" :key="`i-${step.interface_code}-${idx}`" class="text-sm text-primary">
|
||||
<span class="mr-1 text-xs text-muted">{{ idx + 1 }}.</span><span :title="step.interface_code">{{ interfaceNameOf(step.interface_code) || step.interface_code }}</span>
|
||||
</p>
|
||||
</td>
|
||||
<td class="px-6 py-4">
|
||||
<span class="inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium" :class="statusBadgeClass(row.status)" data-testid="binding-status">{{ statusLabel(row.status) }}</span>
|
||||
</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>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<el-table v-else-if="activeTab === 'binding'" :data="bindings" row-key="id">
|
||||
<template #empty>
|
||||
<el-empty :description="t('admin.integrationConnector.empty')" :image-size="60" />
|
||||
</template>
|
||||
<el-table-column :label="t('admin.integrationConnector.headers.capability')" min-width="190">
|
||||
<template #default="{ row }">
|
||||
<!-- 能力引用列与客户端/接口引用列同款「名称 + 编码」两行;无中文翻译时只显注册名避免重复 -->
|
||||
<p class="cell-primary">{{ capabilityLabelOf(row.capability) }}</p>
|
||||
<p v-if="capabilityLabelOf(row.capability) !== row.capability" class="cell-mono">{{ row.capability }}</p>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.headers.clientInstance')" min-width="160">
|
||||
<template #default="{ row }">
|
||||
<!-- 有序步骤:逐步渲染客户端(与接口步骤列对齐) -->
|
||||
<p v-for="(step, idx) in bindingStepsOf(row as IntegrationBindingRow)" :key="`c-${step.interface_code}-${idx}`" class="cell-primary">
|
||||
<span class="step-no">{{ idx + 1 }}.</span>{{ clientNameOf(step.client_code) || step.client_code }}
|
||||
</p>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.headers.interfaceDef')" min-width="190">
|
||||
<template #default="{ row }">
|
||||
<!-- 有序步骤编排:编号 + 接口名,悬停显示接口编码;旧单步行兜底为一步 -->
|
||||
<p v-for="(step, idx) in bindingStepsOf(row as IntegrationBindingRow)" :key="`i-${step.interface_code}-${idx}`" class="cell-primary">
|
||||
<span class="step-no">{{ idx + 1 }}.</span><span :class="interfaceNameOf(step.interface_code) ? 'cell-ellipsis-inline' : 'cell-ellipsis-inline mono'" :title="step.interface_code">{{ interfaceNameOf(step.interface_code) || step.interface_code }}</span>
|
||||
</p>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.headers.status')" width="100">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="statusTagType(row.status)" size="small" data-testid="binding-status">{{ statusLabel(row.status) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.headers.actions')" width="200" align="right">
|
||||
<template #default="{ row }">
|
||||
<div class="row-actions">
|
||||
<!-- 生命周期按钮按当前状态显隐:draft→发布;published→撤回+退役;retired→恢复 -->
|
||||
<el-button
|
||||
v-if="row.status === 'draft'"
|
||||
link
|
||||
type="primary"
|
||||
data-testid="binding-publish"
|
||||
:disabled="lifecycleBusy"
|
||||
@click="changeBindingLifecycle(row as IntegrationBindingRow, 'publish')"
|
||||
>{{ t('admin.integrationConnector.lifecycle.publish') }}</el-button>
|
||||
<template v-else-if="row.status === 'published'">
|
||||
<el-button
|
||||
link
|
||||
type="info"
|
||||
data-testid="binding-unpublish"
|
||||
:disabled="lifecycleBusy"
|
||||
@click="changeBindingLifecycle(row as IntegrationBindingRow, 'unpublish')"
|
||||
>{{ t('admin.integrationConnector.lifecycle.unpublish') }}</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="warning"
|
||||
data-testid="binding-retire"
|
||||
:disabled="lifecycleBusy"
|
||||
@click="changeBindingLifecycle(row as IntegrationBindingRow, 'retire')"
|
||||
>{{ t('admin.integrationConnector.lifecycle.retire') }}</el-button>
|
||||
</template>
|
||||
<el-button
|
||||
v-else-if="row.status === 'retired'"
|
||||
link
|
||||
type="info"
|
||||
data-testid="binding-reopen"
|
||||
:disabled="lifecycleBusy"
|
||||
@click="changeBindingLifecycle(row as IntegrationBindingRow, 'reopen')"
|
||||
>{{ t('admin.integrationConnector.lifecycle.reopen') }}</el-button>
|
||||
<el-button link type="primary" :icon="Edit" :title="t('admin.edit')" @click="openEditModal('binding', row as IntegrationBindingRow)" />
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 凭据引用 -->
|
||||
<div v-else-if="activeTab === 'credential'" class="admin-table-wrap">
|
||||
<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.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.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="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">
|
||||
<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)">
|
||||
<Edit class="w-4 h-4" />
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<el-table v-else-if="activeTab === 'credential'" :data="credentials" row-key="code">
|
||||
<template #empty>
|
||||
<el-empty :description="t('admin.integrationConnector.empty')" :image-size="60" />
|
||||
</template>
|
||||
<el-table-column :label="t('admin.integrationConnector.headers.code')" min-width="160">
|
||||
<template #default="{ row }">
|
||||
<span class="cell-primary mono">{{ row.code }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.headers.connectorType')" width="120">
|
||||
<template #default="{ row }">
|
||||
<el-tag type="info" effect="plain" size="small">{{ credentialTypeLabel(row.credential_type) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.headers.account')" min-width="140">
|
||||
<template #default="{ row }">
|
||||
<span class="cell-regular mono">{{ credentialAccountText(row as { secret_provider: string; secret_fields: Record<string, string>; secret_ref: string }) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.headers.secretProvider')" width="170">
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
type="info"
|
||||
effect="plain"
|
||||
size="small"
|
||||
:title="row.secret_provider === 'db' ? statusLabel('db') : row.secret_ref"
|
||||
>{{ secretProviderLabel(row.secret_provider) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.fields.enabled')" width="80">
|
||||
<template #default="{ row }">
|
||||
<!-- 行内启停开关:布尔语义,与客户端实例开关完全同款(含 title 用同一 i18n 键);rotating 视为启用侧,
|
||||
点击即停用;解析层只认 active,停用即断流 -->
|
||||
<el-switch
|
||||
:model-value="row.status !== 'retired'"
|
||||
:disabled="lifecycleBusy"
|
||||
:title="t('admin.integrationConnector.fields.enabled')"
|
||||
data-testid="credential-status-toggle"
|
||||
@change="toggleCredential(row as IntegrationCredentialReferenceRow)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.headers.actions')" width="90" align="right">
|
||||
<template #default="{ row }">
|
||||
<div class="row-actions">
|
||||
<el-button link type="primary" :icon="Edit" :title="t('admin.edit')" @click="openEditModal('credential', row as IntegrationCredentialReferenceRow)" />
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 调用日志:筛选 + 分页列表 + 详情抽屉(能力无关通用口径;只读 tab,无新增入口) -->
|
||||
<IntegrationCallLogsPanel v-else-if="activeTab === 'calls'" />
|
||||
|
||||
<!-- 能力清单 -->
|
||||
<div v-else class="admin-table-wrap">
|
||||
<table class="admin-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<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.write') }}</th>
|
||||
<th class="px-6 py-4 text-left text-xs">{{ t('admin.integrationConnector.headers.idempotency') }}</th>
|
||||
<th class="px-6 py-4 text-right text-xs w-28">{{ t('admin.integrationConnector.headers.actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<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">
|
||||
<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" />
|
||||
{{ t('admin.integrationConnector.call') }}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<el-table v-else :data="capabilities" row-key="name">
|
||||
<template #empty>
|
||||
<el-empty :description="t('admin.integrationConnector.empty')" :image-size="60" />
|
||||
</template>
|
||||
<el-table-column :label="t('admin.integrationConnector.headers.name')" min-width="220">
|
||||
<template #default="{ row }">
|
||||
<!-- 中文名称为主行,注册名作为精确标识(绑定引用用)保留为次行;无中文翻译时只显注册名避免重复 -->
|
||||
<p class="cell-primary">{{ capabilityLabelOf(row.name) }}</p>
|
||||
<p v-if="capabilityLabelOf(row.name) !== row.name" class="cell-mono">{{ row.name }}</p>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.headers.write')" width="100">
|
||||
<template #default="{ row }">{{ row.write ? t('admin.integrationConnector.writeLabels.yes') : t('admin.integrationConnector.writeLabels.no') }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.headers.idempotency')" min-width="120">
|
||||
<template #default="{ row }">{{ idempotencyLabel(row.idempotency) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.headers.actions')" width="110" align="right">
|
||||
<template #default="{ row }">
|
||||
<el-button link type="primary" :icon="VideoPlay" @click="openCallModal(row.name)">
|
||||
{{ t('admin.integrationConnector.call') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
|
||||
<IntegrationConnectorFormDrawer
|
||||
@@ -563,3 +542,120 @@ function selectTab(key: TabKey) {
|
||||
/>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* 全宽布局:水平内边距由 AdminLayout 壳层统一持有,页面只保留内部块间距 */
|
||||
.connector-page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.page-header {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
margin: 0;
|
||||
color: var(--el-text-color-primary);
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.page-subtitle {
|
||||
margin: 4px 0 0;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
/* 六页签:el-tabs 承载页签语义,面板仍在下方按 activeTab 条件渲染(保持按需挂载) */
|
||||
.connector-tabs :deep(.el-tabs__header) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.page-skeleton {
|
||||
padding: 8px 0;
|
||||
}
|
||||
|
||||
/* 单元格内双行展示:主行(名称)+ 次行(编码,等宽小字) */
|
||||
.cell-primary {
|
||||
margin: 0;
|
||||
color: var(--el-text-color-primary);
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.cell-regular {
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.cell-mono {
|
||||
margin: 2px 0 0;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.mono {
|
||||
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
|
||||
}
|
||||
|
||||
.cell-muted {
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.cell-ellipsis {
|
||||
display: block;
|
||||
max-width: 240px;
|
||||
overflow: hidden;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.cell-ellipsis-inline {
|
||||
display: inline-block;
|
||||
max-width: 160px;
|
||||
overflow: hidden;
|
||||
vertical-align: bottom;
|
||||
color: var(--el-text-color-primary);
|
||||
font-size: 13px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.step-no {
|
||||
margin-right: 4px;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* 行内操作:图标链接按钮组 */
|
||||
.row-actions {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
/* 连接测试徽章可点击展开详情;详情为等宽脱敏文本 */
|
||||
.test-badge {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.test-detail {
|
||||
margin: 4px 0 0;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
word-break: break-all;
|
||||
}
|
||||
</style>
|
||||
+186
@@ -0,0 +1,186 @@
|
||||
/**
|
||||
* features/admin/modules/integration-connector/__tests__/IntegrationConnectorPage.spec.ts
|
||||
* 用途:集成连接器页 EP 迁移后的冒烟契约——el-tabs 页签、el-table 列表渲染
|
||||
* (类型/环境 el-tag、行内 el-switch 启停开关)、编辑抽屉(el-drawer +
|
||||
* el-form 控件族)与新增提交路径调用 create API。
|
||||
* 依赖:@vue/test-utils、vitest、@/i18n、integration-connector.api(mock)。
|
||||
* 逻辑:mock 模块 API 返回一条 REST 客户端 + 一条凭据引用 + 一条能力(形状与
|
||||
* types/integration-connector.types.ts 对齐);页面走真实 composable,
|
||||
* 断言 EP 组件结构与关键交互路径(列表 → 打开编辑抽屉 → 新建并保存调用 create),
|
||||
* 不锁样式细节。
|
||||
*/
|
||||
import { enableAutoUnmount, flushPromises, mount } from '@vue/test-utils';
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import i18n from '@/i18n';
|
||||
import IntegrationConnectorPage from '../IntegrationConnectorPage.vue';
|
||||
|
||||
// el-table 布局依赖 ResizeObserver,jsdom 缺失需补齐桩实现
|
||||
class ResizeObserverStub {
|
||||
observe(): void {}
|
||||
|
||||
unobserve(): void {}
|
||||
|
||||
disconnect(): void {}
|
||||
}
|
||||
(globalThis as Record<string, unknown>).ResizeObserver
|
||||
= (globalThis as Record<string, unknown>).ResizeObserver || ResizeObserverStub;
|
||||
|
||||
const api = vi.hoisted(() => ({
|
||||
listIntegrationCapabilities: vi.fn(),
|
||||
callIntegrationCapability: vi.fn(),
|
||||
listIntegrationClientInstances: vi.fn(),
|
||||
createIntegrationClientInstance: vi.fn(),
|
||||
updateIntegrationClientInstance: vi.fn(),
|
||||
deleteIntegrationClientInstance: vi.fn(),
|
||||
testIntegrationClientConnection: vi.fn(),
|
||||
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(),
|
||||
listIntegrationCalls: vi.fn(),
|
||||
getIntegrationCall: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('../api/integration-connector.api', () => api);
|
||||
|
||||
enableAutoUnmount(afterEach);
|
||||
|
||||
// EP 重型页面(表格+页签+抽屉+调用日志面板)在全量并行渲染时较慢,放宽本文件超时,
|
||||
// 避免三文件同跑时「打开编辑抽屉」等重挂载用例撞 5s 默认超时
|
||||
vi.setConfig({ testTimeout: 20000 });
|
||||
|
||||
// ---- 测试夹具:形状与 types/integration-connector.types.ts 序列化契约对齐 ----
|
||||
const clientRow = {
|
||||
id: 1,
|
||||
code: 'erp-prod',
|
||||
name: '生产 ERP',
|
||||
connector_type: 'rest',
|
||||
environment: 'prod',
|
||||
endpoint: 'https://erp.example.com/api',
|
||||
timeout_seconds: 60,
|
||||
db_kind: null,
|
||||
config_json: {},
|
||||
credential_ref_code: null,
|
||||
enabled: true,
|
||||
};
|
||||
const credentialRow = {
|
||||
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: null,
|
||||
last_verified_at: null,
|
||||
};
|
||||
const capabilityRow = {
|
||||
name: 'in_transit_transfer.query_inventory',
|
||||
write: false,
|
||||
idempotency: 'invoice',
|
||||
input_schema: {},
|
||||
output_schema: {},
|
||||
};
|
||||
|
||||
const mountPage = async () => {
|
||||
const wrapper = mount(IntegrationConnectorPage, { global: { plugins: [i18n] } });
|
||||
await flushPromises();
|
||||
return wrapper;
|
||||
};
|
||||
|
||||
describe('IntegrationConnectorPage EP 迁移冒烟', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
api.listIntegrationClientInstances.mockResolvedValue([clientRow]);
|
||||
api.listIntegrationInterfaceDefinitions.mockResolvedValue([]);
|
||||
api.listIntegrationBindings.mockResolvedValue([]);
|
||||
api.listIntegrationCredentialReferences.mockResolvedValue([credentialRow]);
|
||||
api.listIntegrationCredentialTypes.mockResolvedValue([
|
||||
{
|
||||
type: 'password',
|
||||
fields: [
|
||||
{ key: 'username', secret: false, required: true },
|
||||
{ key: 'password', secret: true, required: true },
|
||||
],
|
||||
},
|
||||
]);
|
||||
api.listIntegrationCapabilities.mockResolvedValue([capabilityRow]);
|
||||
api.listIntegrationCalls.mockResolvedValue({ total: 0, page: 1, page_size: 20, items: [] });
|
||||
});
|
||||
|
||||
it('列表渲染:el-tabs 页签 + el-table 行 + 类型/环境标签 + 行内启停开关', async () => {
|
||||
const wrapper = await mountPage();
|
||||
// 关键断言:页签为 el-tabs;默认 client tab 的 el-table 渲染一行客户端
|
||||
expect(wrapper.find('.el-tabs').exists()).toBe(true);
|
||||
const table = wrapper.find('.connector-page .el-table');
|
||||
expect(table.exists()).toBe(true);
|
||||
expect(wrapper.text()).toContain('生产 ERP');
|
||||
expect(wrapper.text()).toContain('erp-prod');
|
||||
// 类型(info plain)与环境(prod=success)以 el-tag 呈现
|
||||
const tags = wrapper.findAll('.el-table .el-tag');
|
||||
expect(tags.length).toBeGreaterThanOrEqual(2);
|
||||
expect(wrapper.text()).toContain('生产');
|
||||
// 启停开关为 el-switch(data-testid 原位保留),启用态 aria-checked=true
|
||||
const toggle = wrapper.find('[data-testid="client-toggle"]');
|
||||
expect(toggle.exists()).toBe(true);
|
||||
expect(toggle.find('[role="switch"]').attributes('aria-checked')).toBe('true');
|
||||
});
|
||||
|
||||
it('打开编辑抽屉:el-drawer dialog 语义 + el-form(label-position=top) EP 控件族', async () => {
|
||||
const wrapper = await mountPage();
|
||||
// 操作列「编辑」为图标链接按钮(title=admin.edit),点击后 openEditModal 回填表单
|
||||
await wrapper.find('button[title="编辑"]').trigger('click');
|
||||
await flushPromises();
|
||||
const drawer = wrapper.find('[data-testid="connector-form-drawer"]');
|
||||
// 关键断言:抽屉为 el-drawer(open 态 + role=dialog),表单为 el-form label-position=top
|
||||
expect(drawer.exists()).toBe(true);
|
||||
expect(drawer.classes()).toContain('el-drawer');
|
||||
expect(drawer.classes()).toContain('open');
|
||||
expect(drawer.attributes('role')).toBe('dialog');
|
||||
const form = wrapper.find('.el-drawer .el-form');
|
||||
expect(form.exists()).toBe(true);
|
||||
expect(form.classes()).toContain('el-form--label-top');
|
||||
// 表单控件为 EP 组件:编码回显且编辑态锁定(el-input disabled)、连接地址 el-input 有值
|
||||
const code = wrapper.find('[data-testid="client-code"]');
|
||||
expect((code.element as HTMLInputElement).value).toBe('erp-prod');
|
||||
expect((code.element as HTMLInputElement).disabled).toBe(true);
|
||||
const endpoint = wrapper.find('[data-testid="client-endpoint"]');
|
||||
expect((endpoint.element as HTMLInputElement).value).toBe('https://erp.example.com/api');
|
||||
// 连接器类型/环境/凭据引用均为 el-select;启用开关置于底部操作条
|
||||
expect(wrapper.findAll('.el-drawer .el-select').length).toBeGreaterThanOrEqual(3);
|
||||
expect(wrapper.find('[data-testid="client-enabled-switch"]').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('打开新增后提交:保存按钮走 createIntegrationClientInstance(mock resolve)', async () => {
|
||||
const wrapper = await mountPage();
|
||||
api.createIntegrationClientInstance.mockResolvedValue({ ...clientRow, id: 2, code: 'erp-x' });
|
||||
// 顶部「新增」为 el-button type=primary
|
||||
await wrapper.find('.page-header .el-button--primary').trigger('click');
|
||||
await flushPromises();
|
||||
expect(wrapper.find('[data-testid="connector-form-drawer"].open').exists()).toBe(true);
|
||||
// 填名称(编码留空 → 按名称自动建议 erp-x),点抽屉底部「保存更改」
|
||||
await wrapper.find('[data-testid="client-name"]').setValue('ERP X');
|
||||
const footer = wrapper.find('.el-drawer__footer');
|
||||
expect(footer.exists()).toBe(true);
|
||||
await footer.find('.el-button--primary').trigger('click');
|
||||
await flushPromises();
|
||||
// 关键断言:提交路径调用 create API,payload 为 composable 组装的客户端实例字段
|
||||
expect(api.createIntegrationClientInstance).toHaveBeenCalledTimes(1);
|
||||
const payload = api.createIntegrationClientInstance.mock.calls[0][0];
|
||||
expect(payload.name).toBe('ERP X');
|
||||
expect(payload.code).toBe('erp-x');
|
||||
expect(payload.connector_type).toBe('rest');
|
||||
expect(payload.environment).toBe('prod');
|
||||
expect(payload.enabled).toBe(true);
|
||||
});
|
||||
});
|
||||
+632
-269
@@ -1,22 +1,41 @@
|
||||
<!--
|
||||
features/admin/modules/integration-connector/components/IntegrationCallLogsPanel.vue
|
||||
用途:集成调用日志面板——筛选条 + 分页列表 + 行点击详情抽屉(能力无关通用口径)。
|
||||
依赖:../api/integration-connector.api(listIntegrationCalls / getIntegrationCall)、
|
||||
../utils/integration-call-replay(buildCurl / buildSqlReplay)、
|
||||
useMessage、copyTextToClipboard、formatLocalDateTime、useI18n。
|
||||
依赖:element-plus(表格/筛选控件/日期选择/抽屉/空态/v-loading,沿用管理端 element-trial 主题)、
|
||||
../api/integration-connector.api(listIntegrationCalls / getIntegrationCall)、
|
||||
../utils/integration-call-replay(buildCurl / buildSqlReplay)、
|
||||
useMessage、copyTextToClipboard、formatLocalDateTime、useI18n。
|
||||
逻辑:筛选(接口编码/客户端编码/连接类型/状态/operation_id/trace_id/业务单号/
|
||||
参数关键字/执行时间起止)回车或点「查询」生效(查询回第一页),「重置」清空;
|
||||
列表按 id 倒序分页,行点击拉取全量详情开右侧抽屉;抽屉含步骤时间线
|
||||
(同 operation_id 各步、当前步高亮)、线级请求与业务参数双栏、原始报文与
|
||||
归一化 JSON 双栏;复制按钮组按连接类型分流:soap/rest=复制 body / 复制 curl,
|
||||
列表按 id 倒序分页,行点击拉取全量详情开右侧抽屉(el-drawer 原生承接 Esc 关闭);
|
||||
抽屉含步骤时间线(同 operation_id 各步、当前步高亮)、线级请求与业务参数双栏、
|
||||
原始报文与归一化 JSON 双栏;复制按钮组按连接类型分流:soap/rest=复制 body / 复制 curl,
|
||||
database=复制 SQL(绑定已内联、写入类自动包事务并红字警示),
|
||||
另有复制原始报文 / 复制 JSON / 复制 operation_id / 复制 trace_id;
|
||||
wire_json 为 NULL(历史存量行)时如实显示「无线级详情(历史记录)」,不回填。
|
||||
视觉层已迁移 Element Plus(element-trial 主题),布局间距由 AdminLayout 壳层持有。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ChevronLeft, ChevronRight, X } from 'lucide-vue-next';
|
||||
import {
|
||||
ElButton,
|
||||
ElDatePicker,
|
||||
ElDrawer,
|
||||
ElEmpty,
|
||||
ElIcon,
|
||||
ElInput,
|
||||
ElOption,
|
||||
ElSelect,
|
||||
ElTable,
|
||||
ElTableColumn,
|
||||
ElTag,
|
||||
vLoading,
|
||||
} from 'element-plus';
|
||||
import { ArrowLeft, ArrowRight, CircleCheck, CircleClose, Close } from '@element-plus/icons-vue';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { copyTextToClipboard } from '@/shared/utils/clipboard';
|
||||
import { formatLocalDateTime } from '@/shared/utils/dateTime';
|
||||
@@ -143,11 +162,6 @@ function closeDetail() {
|
||||
detail.value = null;
|
||||
}
|
||||
|
||||
/** 抽屉打开时 Esc 关闭(与表单抽屉行为一致)。 */
|
||||
function onEscKey(e: KeyboardEvent) {
|
||||
if (e.key === 'Escape' && detail.value) closeDetail();
|
||||
}
|
||||
|
||||
/** 复制文本到剪贴板(带降级方案),成功后弹「已复制」提示。 */
|
||||
async function copy(text: string) {
|
||||
const ok = await copyTextToClipboard(text);
|
||||
@@ -162,16 +176,6 @@ function isSuccess(status: string): boolean {
|
||||
return status === 'success' || status === 'duplicate_success';
|
||||
}
|
||||
|
||||
/** 状态徽标配色:成功绿 / 其余红。 */
|
||||
function statusBadgeClass(status: string): string {
|
||||
return isSuccess(status) ? 'bg-green-100 text-green-700' : 'bg-red-100 text-red-700';
|
||||
}
|
||||
|
||||
/** 状态图标:✓ 成功 / ✗ 失败。 */
|
||||
function statusIcon(status: string): string {
|
||||
return isSuccess(status) ? '✓' : '✗';
|
||||
}
|
||||
|
||||
/** 单号列文本:优先业务单号 business_ref,未透传时回退 operation_id 前 8 位。 */
|
||||
function refTextOf(row: IntegrationCallLogRow): string {
|
||||
return row.business_ref || row.operation_id.slice(0, 8);
|
||||
@@ -205,289 +209,648 @@ function prettyJson(value: unknown): string {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
window.addEventListener('keydown', onEscKey);
|
||||
void load();
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
window.removeEventListener('keydown', onEscKey);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="space-y-4">
|
||||
<!-- 筛选条:全部可选,回车 / 点查询生效 -->
|
||||
<div class="rounded-xl border border-default bg-surface p-4 space-y-3">
|
||||
<div class="grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-5" @keyup.enter="query">
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.callLogs.filterInterface') }}</label>
|
||||
<input v-model="filters.interface_code" type="text" class="input-field text-sm font-mono" data-testid="call-filter-interface" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.callLogs.filterClient') }}</label>
|
||||
<input v-model="filters.client_code" type="text" class="input-field text-sm font-mono" data-testid="call-filter-client" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.callLogs.filterConnector') }}</label>
|
||||
<select v-model="filters.connector_type" class="input-field text-sm" data-testid="call-filter-connector">
|
||||
<option value="">—</option>
|
||||
<option v-for="opt in CONNECTOR_TYPE_OPTIONS" :key="opt.value" :value="opt.value">{{ t(opt.labelKey) }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.callLogs.filterStatus') }}</label>
|
||||
<select v-model="filters.status" class="input-field text-sm font-mono" data-testid="call-filter-status">
|
||||
<option value="">—</option>
|
||||
<option v-for="s in CALL_STATUS_OPTIONS" :key="s" :value="s">{{ s }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.callLogs.filterOperationId') }}</label>
|
||||
<input v-model="filters.operation_id" type="text" class="input-field text-sm font-mono" data-testid="call-filter-operation-id" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.callLogs.filterTraceId') }}</label>
|
||||
<input v-model="filters.trace_id" type="text" class="input-field text-sm font-mono" data-testid="call-filter-trace-id" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.callLogs.filterBusinessRef') }}</label>
|
||||
<input v-model="filters.business_ref" type="text" class="input-field text-sm font-mono" data-testid="call-filter-business-ref" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.callLogs.filterKeyword') }}</label>
|
||||
<input v-model="filters.keyword" type="text" class="input-field text-sm" data-testid="call-filter-keyword" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.callLogs.dateFrom') }}</label>
|
||||
<input v-model="filters.date_from" type="date" class="input-field text-sm" data-testid="call-filter-date-from" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.callLogs.dateTo') }}</label>
|
||||
<input v-model="filters.date_to" type="date" class="input-field text-sm" data-testid="call-filter-date-to" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<button type="button" class="btn-primary" data-testid="call-filter-query" @click="query">
|
||||
{{ t('admin.integrationConnector.callLogs.query') }}
|
||||
</button>
|
||||
<button type="button" class="btn-ghost" data-testid="call-filter-reset" @click="resetFilters">
|
||||
{{ t('admin.integrationConnector.callLogs.reset') }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="call-logs-panel">
|
||||
<!-- 筛选条:一行化(flex wrap),全部可选,回车 / 点查询生效 -->
|
||||
<div class="filter-bar" @keyup.enter="query">
|
||||
<el-input
|
||||
v-model="filters.interface_code"
|
||||
class="filter-field mono-filter"
|
||||
:placeholder="t('admin.integrationConnector.callLogs.filterInterface')"
|
||||
clearable
|
||||
data-testid="call-filter-interface"
|
||||
/>
|
||||
<el-input
|
||||
v-model="filters.client_code"
|
||||
class="filter-field mono-filter"
|
||||
:placeholder="t('admin.integrationConnector.callLogs.filterClient')"
|
||||
clearable
|
||||
data-testid="call-filter-client"
|
||||
/>
|
||||
<el-select v-model="filters.connector_type" class="filter-field" data-testid="call-filter-connector">
|
||||
<el-option :label="t('common.filter.all')" value="" />
|
||||
<el-option v-for="opt in CONNECTOR_TYPE_OPTIONS" :key="opt.value" :value="opt.value" :label="t(opt.labelKey)" />
|
||||
</el-select>
|
||||
<el-select v-model="filters.status" class="filter-field mono-filter" data-testid="call-filter-status">
|
||||
<el-option :label="t('common.filter.all')" value="" />
|
||||
<el-option v-for="s in CALL_STATUS_OPTIONS" :key="s" :value="s" :label="s" />
|
||||
</el-select>
|
||||
<el-input
|
||||
v-model="filters.operation_id"
|
||||
class="filter-field mono-filter"
|
||||
:placeholder="t('admin.integrationConnector.callLogs.filterOperationId')"
|
||||
clearable
|
||||
data-testid="call-filter-operation-id"
|
||||
/>
|
||||
<el-input
|
||||
v-model="filters.trace_id"
|
||||
class="filter-field mono-filter"
|
||||
:placeholder="t('admin.integrationConnector.callLogs.filterTraceId')"
|
||||
clearable
|
||||
data-testid="call-filter-trace-id"
|
||||
/>
|
||||
<el-input
|
||||
v-model="filters.business_ref"
|
||||
class="filter-field mono-filter"
|
||||
:placeholder="t('admin.integrationConnector.callLogs.filterBusinessRef')"
|
||||
clearable
|
||||
data-testid="call-filter-business-ref"
|
||||
/>
|
||||
<el-input
|
||||
v-model="filters.keyword"
|
||||
class="filter-field"
|
||||
:placeholder="t('admin.integrationConnector.callLogs.filterKeyword')"
|
||||
clearable
|
||||
data-testid="call-filter-keyword"
|
||||
/>
|
||||
<el-date-picker
|
||||
v-model="filters.date_from"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
:placeholder="t('admin.integrationConnector.callLogs.dateFrom')"
|
||||
class="filter-field"
|
||||
data-testid="call-filter-date-from"
|
||||
/>
|
||||
<el-date-picker
|
||||
v-model="filters.date_to"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
:placeholder="t('admin.integrationConnector.callLogs.dateTo')"
|
||||
class="filter-field"
|
||||
data-testid="call-filter-date-to"
|
||||
/>
|
||||
<el-button type="primary" data-testid="call-filter-query" @click="query">
|
||||
{{ t('admin.integrationConnector.callLogs.query') }}
|
||||
</el-button>
|
||||
<el-button data-testid="call-filter-reset" @click="resetFilters">
|
||||
{{ t('admin.integrationConnector.callLogs.reset') }}
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<!-- 调用记录列表(id 倒序;行点击开详情抽屉) -->
|
||||
<div class="admin-table-wrap" :class="loading ? 'opacity-60 pointer-events-none' : ''">
|
||||
<div class="px-4 py-3 flex items-center justify-between">
|
||||
<h4 class="text-sm font-bold text-primary">{{ t('admin.integrationConnector.callLogs.title') }}</h4>
|
||||
<span class="text-xs text-muted font-mono">({{ total }})</span>
|
||||
<div class="logs-card">
|
||||
<div class="logs-head">
|
||||
<h4 class="logs-title">{{ t('admin.integrationConnector.callLogs.title') }}</h4>
|
||||
<span class="logs-total mono">({{ total }})</span>
|
||||
</div>
|
||||
<table class="admin-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="px-4 py-3 text-left text-xs w-16">#</th>
|
||||
<th class="px-4 py-3 text-left text-xs">{{ t('admin.integrationConnector.callLogs.colTime') }}</th>
|
||||
<th class="px-4 py-3 text-left text-xs">{{ t('admin.integrationConnector.callLogs.colCapability') }}</th>
|
||||
<th class="px-4 py-3 text-left text-xs">{{ t('admin.integrationConnector.callLogs.colInterface') }}</th>
|
||||
<th class="px-4 py-3 text-left text-xs">{{ t('admin.integrationConnector.callLogs.colRef') }}</th>
|
||||
<th class="px-4 py-3 text-left text-xs w-20">{{ t('admin.integrationConnector.callLogs.colStep') }}</th>
|
||||
<th class="px-4 py-3 text-left text-xs w-44">{{ t('admin.integrationConnector.callLogs.colStatus') }}</th>
|
||||
<th class="px-4 py-3 text-right text-xs w-24">{{ t('admin.integrationConnector.callLogs.colElapsed') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-if="items.length === 0">
|
||||
<td colspan="8" class="px-6 admin-table-empty">{{ t('admin.integrationConnector.empty') }}</td>
|
||||
</tr>
|
||||
<tr
|
||||
v-for="row in items"
|
||||
:key="row.id"
|
||||
data-testid="call-row"
|
||||
class="cursor-pointer hover:bg-surface-soft transition-colors"
|
||||
@click="openDetail(row)"
|
||||
>
|
||||
<td class="px-4 py-3 text-xs text-muted font-mono">{{ row.id }}</td>
|
||||
<td class="px-4 py-3 text-xs text-secondary font-mono whitespace-nowrap">{{ formatLocalDateTime(row.created_at) }}</td>
|
||||
<td class="px-4 py-3 text-xs font-mono text-secondary max-w-[220px]"><span class="block truncate" :title="row.capability">{{ row.capability }}</span></td>
|
||||
<td class="px-4 py-3 text-xs font-mono text-secondary max-w-[200px]"><span class="block truncate" :title="row.interface_code || ''">{{ row.interface_code || '—' }}</span></td>
|
||||
<td class="px-4 py-3 text-xs font-mono text-secondary" :title="row.business_ref || row.operation_id">{{ refTextOf(row) }}</td>
|
||||
<td class="px-4 py-3 text-xs text-secondary font-mono">{{ stepText(row) }}</td>
|
||||
<td class="px-4 py-3">
|
||||
<span class="inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium font-mono" :class="statusBadgeClass(row.status)">
|
||||
{{ statusIcon(row.status) }} {{ row.status }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-xs text-secondary font-mono text-right whitespace-nowrap">{{ row.elapsed_ms }}ms</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="flex items-center justify-end gap-3 px-4 py-3 text-xs text-secondary">
|
||||
<button
|
||||
type="button"
|
||||
class="p-1.5 rounded-lg text-muted hover:bg-surface-soft hover:text-secondary disabled:opacity-40 disabled:cursor-not-allowed"
|
||||
<el-table v-loading="loading" :data="items" row-key="id" class="logs-table" @row-click="openDetail">
|
||||
<template #empty>
|
||||
<el-empty :description="t('admin.integrationConnector.empty')" :image-size="60" />
|
||||
</template>
|
||||
<el-table-column label="#" width="80">
|
||||
<template #default="{ row }">
|
||||
<span class="cell-mono" data-testid="call-row">{{ row.id }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.callLogs.colTime')" width="170">
|
||||
<template #default="{ row }">
|
||||
<span class="cell-mono nowrap">{{ formatLocalDateTime(row.created_at) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.callLogs.colCapability')" min-width="200">
|
||||
<template #default="{ row }">
|
||||
<span class="cell-ellipsis mono" :title="row.capability">{{ row.capability }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.callLogs.colInterface')" min-width="180">
|
||||
<template #default="{ row }">
|
||||
<span class="cell-ellipsis mono" :title="row.interface_code || ''">{{ row.interface_code || '—' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.callLogs.colRef')" min-width="180">
|
||||
<template #default="{ row }">
|
||||
<span class="cell-mono" :title="row.business_ref || row.operation_id">{{ refTextOf(row as IntegrationCallLogRow) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.callLogs.colStep')" width="90">
|
||||
<template #default="{ row }">
|
||||
<span class="cell-mono">{{ stepText(row as IntegrationCallLogRow) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.callLogs.colStatus')" width="190">
|
||||
<template #default="{ row }">
|
||||
<el-tag :type="isSuccess(row.status) ? 'success' : 'danger'" size="small" class="status-tag">
|
||||
<el-icon class="status-icon">
|
||||
<CircleCheck v-if="isSuccess(row.status)" />
|
||||
<CircleClose v-else />
|
||||
</el-icon>
|
||||
<span class="mono">{{ row.status }}</span>
|
||||
</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.integrationConnector.callLogs.colElapsed')" width="110" align="right">
|
||||
<template #default="{ row }">
|
||||
<span class="cell-mono nowrap">{{ row.elapsed_ms }}ms</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pager">
|
||||
<el-button
|
||||
:icon="ArrowLeft"
|
||||
:title="t('admin.integrationConnector.callLogs.prevPage')"
|
||||
data-testid="call-prev-page"
|
||||
:disabled="page <= 1 || loading"
|
||||
@click="goPrev"
|
||||
>
|
||||
<ChevronLeft class="w-4 h-4" />
|
||||
</button>
|
||||
<span class="font-mono">{{ page }} / {{ totalPages }}</span>
|
||||
<button
|
||||
type="button"
|
||||
class="p-1.5 rounded-lg text-muted hover:bg-surface-soft hover:text-secondary disabled:opacity-40 disabled:cursor-not-allowed"
|
||||
/>
|
||||
<span class="pager-text mono">{{ page }} / {{ totalPages }}</span>
|
||||
<el-button
|
||||
:icon="ArrowRight"
|
||||
:title="t('admin.integrationConnector.callLogs.nextPage')"
|
||||
data-testid="call-next-page"
|
||||
:disabled="page >= totalPages || loading"
|
||||
@click="goNext"
|
||||
>
|
||||
<ChevronRight class="w-4 h-4" />
|
||||
</button>
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 详情抽屉:右侧滑出(步骤时间线 + 线级/归一化双栏 + 复现命令复制) -->
|
||||
<div
|
||||
v-if="detail"
|
||||
class="fixed inset-0 z-50 flex justify-end bg-overlay animate-fade-in"
|
||||
<!-- 详情抽屉:右侧滑出(步骤时间线 + 线级/归一化双栏 + 复现命令复制;Esc 关闭由 el-drawer 原生承接) -->
|
||||
<el-drawer
|
||||
:model-value="detail !== null"
|
||||
size="920px"
|
||||
resizable
|
||||
destroy-on-close
|
||||
:show-close="false"
|
||||
class="call-detail-drawer"
|
||||
data-testid="call-detail-drawer"
|
||||
@click.self="closeDetail"
|
||||
@close="closeDetail"
|
||||
>
|
||||
<aside role="dialog" aria-modal="true" :aria-label="t('admin.integrationConnector.callLogs.detailTitle')" class="h-full w-full max-w-4xl flex flex-col bg-surface shadow-2xl outline-none">
|
||||
<div class="px-5 sm:px-8 pt-5 sm:pt-6 pb-4 border-b border-default shrink-0 space-y-2">
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<h3 class="section-title">{{ t('admin.integrationConnector.callLogs.detailTitle') }} #{{ detail.call.id }}</h3>
|
||||
<button type="button" class="p-2 rounded-lg text-muted hover:bg-surface-soft hover:text-secondary" :aria-label="t('admin.cancel')" data-testid="call-detail-close" @click="closeDetail">
|
||||
<X class="w-4 h-4" />
|
||||
</button>
|
||||
<template #header>
|
||||
<div v-if="detail" class="detail-header">
|
||||
<div class="detail-title-row">
|
||||
<h3 class="detail-title">{{ t('admin.integrationConnector.callLogs.detailTitle') }} #{{ detail.call.id }}</h3>
|
||||
<el-button
|
||||
link
|
||||
:icon="Close"
|
||||
:aria-label="t('admin.cancel')"
|
||||
data-testid="call-detail-close"
|
||||
@click="closeDetail"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-x-6 gap-y-1 text-xs text-secondary">
|
||||
<span><span class="text-muted">{{ t('admin.integrationConnector.callLogs.colCapability') }}: </span><span class="font-mono">{{ detail.call.capability }}</span></span>
|
||||
<span>
|
||||
<span class="text-muted">{{ t('admin.integrationConnector.callLogs.colStatus') }}: </span>
|
||||
<span class="inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium font-mono" :class="statusBadgeClass(detail.call.status)">
|
||||
{{ statusIcon(detail.call.status) }} {{ detail.call.status }}
|
||||
</span>
|
||||
<div class="detail-meta">
|
||||
<span class="meta-item">
|
||||
<span class="meta-key">{{ t('admin.integrationConnector.callLogs.colCapability') }}: </span>
|
||||
<span class="mono">{{ detail.call.capability }}</span>
|
||||
</span>
|
||||
<span><span class="text-muted">{{ t('admin.integrationConnector.callLogs.colElapsed') }}: </span><span class="font-mono">{{ detail.call.elapsed_ms }}ms</span></span>
|
||||
<span v-if="detail.call.business_ref">
|
||||
<span class="text-muted">{{ t('admin.integrationConnector.callLogs.filterBusinessRef') }}: </span><span class="font-mono">{{ detail.call.business_ref }}</span>
|
||||
<span class="meta-item">
|
||||
<span class="meta-key">{{ t('admin.integrationConnector.callLogs.colStatus') }}: </span>
|
||||
<el-tag :type="isSuccess(detail.call.status) ? 'success' : 'danger'" size="small" class="status-tag">
|
||||
<el-icon class="status-icon">
|
||||
<CircleCheck v-if="isSuccess(detail.call.status)" />
|
||||
<CircleClose v-else />
|
||||
</el-icon>
|
||||
<span class="mono">{{ detail.call.status }}</span>
|
||||
</el-tag>
|
||||
</span>
|
||||
<span class="meta-item">
|
||||
<span class="meta-key">{{ t('admin.integrationConnector.callLogs.colElapsed') }}: </span>
|
||||
<span class="mono">{{ detail.call.elapsed_ms }}ms</span>
|
||||
</span>
|
||||
<span v-if="detail.call.business_ref" class="meta-item">
|
||||
<span class="meta-key">{{ t('admin.integrationConnector.callLogs.filterBusinessRef') }}: </span>
|
||||
<span class="mono">{{ detail.call.business_ref }}</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="flex flex-wrap items-center gap-x-6 gap-y-1 text-xs">
|
||||
<span class="flex items-center gap-1.5 min-w-0">
|
||||
<span class="text-muted font-mono shrink-0">operation:</span>
|
||||
<span class="font-mono text-secondary truncate max-w-[240px]" :title="detail.call.operation_id">{{ detail.call.operation_id }}</span>
|
||||
<button type="button" class="px-1.5 py-0.5 rounded-md text-xs font-medium text-brand-600 hover:bg-brand-50 shrink-0" data-testid="call-copy-operation-id" @click="copy(detail.call.operation_id)">
|
||||
<div class="detail-meta">
|
||||
<span class="meta-item min-w-0">
|
||||
<span class="meta-key mono">operation:</span>
|
||||
<span class="mono ellipsis" :title="detail.call.operation_id">{{ detail.call.operation_id }}</span>
|
||||
<el-button link type="primary" size="small" data-testid="call-copy-operation-id" @click="copy(detail.call.operation_id)">
|
||||
{{ t('admin.integrationConnector.callLogs.copyOperationId') }}
|
||||
</button>
|
||||
</el-button>
|
||||
</span>
|
||||
<span class="flex items-center gap-1.5 min-w-0">
|
||||
<span class="text-muted font-mono shrink-0">trace:</span>
|
||||
<span class="font-mono text-secondary truncate max-w-[240px]" :title="detail.call.trace_id">{{ detail.call.trace_id }}</span>
|
||||
<button type="button" class="px-1.5 py-0.5 rounded-md text-xs font-medium text-brand-600 hover:bg-brand-50 shrink-0" data-testid="call-copy-trace-id" @click="copy(detail.call.trace_id)">
|
||||
<span class="meta-item min-w-0">
|
||||
<span class="meta-key mono">trace:</span>
|
||||
<span class="mono ellipsis" :title="detail.call.trace_id">{{ detail.call.trace_id }}</span>
|
||||
<el-button link type="primary" size="small" data-testid="call-copy-trace-id" @click="copy(detail.call.trace_id)">
|
||||
{{ t('admin.integrationConnector.callLogs.copyTraceId') }}
|
||||
</button>
|
||||
</el-button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="px-5 sm:px-8 py-5 space-y-5 overflow-y-auto flex-1">
|
||||
<!-- 步骤时间线:同一次能力调用的 N 步(当前步高亮) -->
|
||||
<section class="space-y-2">
|
||||
<h4 class="text-xs font-bold uppercase tracking-wide text-muted">{{ t('admin.integrationConnector.callLogs.timeline') }}</h4>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<template v-for="(entry, idx) in detail.timeline" :key="entry.id">
|
||||
<div class="flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs" :class="isCurrentStep(entry) ? 'bg-brand-50 ring-1 ring-brand-300' : 'bg-surface-soft'">
|
||||
<span class="inline-block w-2 h-2 rounded-full shrink-0" :class="isSuccess(entry.status) ? 'bg-green-500' : 'bg-red-500'" />
|
||||
<span class="font-mono text-muted">{{ stepLabel(entry, idx) }}</span>
|
||||
<span class="text-secondary font-medium font-mono">{{ entry.interface_code || '—' }}</span>
|
||||
<span class="font-mono" :class="isSuccess(entry.status) ? 'text-green-600' : 'text-red-600'">{{ statusIcon(entry.status) }} {{ entry.status }}</span>
|
||||
<span class="text-muted font-mono">{{ entry.elapsed_ms }}ms</span>
|
||||
</div>
|
||||
<span v-if="idx < detail.timeline.length - 1" class="text-muted" aria-hidden="true">──</span>
|
||||
</template>
|
||||
</div>
|
||||
</section>
|
||||
<div v-if="detail" class="detail-body">
|
||||
<!-- 步骤时间线:同一次能力调用的 N 步(当前步高亮) -->
|
||||
<section class="detail-section">
|
||||
<h4 class="section-label">{{ t('admin.integrationConnector.callLogs.timeline') }}</h4>
|
||||
<div class="timeline">
|
||||
<template v-for="(entry, idx) in detail.timeline" :key="entry.id">
|
||||
<div class="timeline-step" :class="{ current: isCurrentStep(entry) }">
|
||||
<span class="timeline-dot" :class="isSuccess(entry.status) ? 'dot-ok' : 'dot-fail'" />
|
||||
<span class="cell-mono">{{ stepLabel(entry, idx) }}</span>
|
||||
<span class="step-interface mono">{{ entry.interface_code || '—' }}</span>
|
||||
<span class="mono" :class="isSuccess(entry.status) ? 'text-ok' : 'text-fail'">
|
||||
{{ entry.status }}
|
||||
</span>
|
||||
<span class="cell-mono">{{ entry.elapsed_ms }}ms</span>
|
||||
</div>
|
||||
<span v-if="idx < detail.timeline.length - 1" class="timeline-sep" aria-hidden="true">──</span>
|
||||
</template>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 请求:线级请求(wire)+ 业务参数(归一化)双栏 -->
|
||||
<section class="space-y-2">
|
||||
<h4 class="text-xs font-bold uppercase tracking-wide text-muted">{{ t('admin.integrationConnector.callLogs.request') }}</h4>
|
||||
<div class="grid grid-cols-1 gap-4 lg:grid-cols-2">
|
||||
<div class="rounded-xl border border-default p-3 space-y-2 min-w-0">
|
||||
<h5 class="text-xs font-bold text-primary">{{ t('admin.integrationConnector.callLogs.wire') }}</h5>
|
||||
<template v-if="wire">
|
||||
<!-- soap/rest:method/url/SOAPAction/headers + 完整请求 body XML -->
|
||||
<template v-if="wire.kind !== 'database'">
|
||||
<pre class="rounded-lg bg-surface-soft p-2.5 text-xs font-mono text-secondary whitespace-pre-wrap break-all">{{ wireMetaText }}</pre>
|
||||
<div class="text-xs text-muted font-mono">── request_body ──</div>
|
||||
<pre class="rounded-lg bg-surface-soft p-2.5 text-xs font-mono text-secondary whitespace-pre-wrap break-all max-h-72 overflow-y-auto">{{ wire.request_body }}</pre>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<button type="button" class="btn-ghost text-xs" data-testid="call-copy-body" @click="copy(wire.request_body || '')">
|
||||
{{ t('admin.integrationConnector.callLogs.copyBody') }}
|
||||
</button>
|
||||
<button type="button" class="btn-ghost text-xs" data-testid="call-copy-curl" @click="copy(curlCommand)">
|
||||
{{ t('admin.integrationConnector.callLogs.copyCurl') }}
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
<!-- database:pre/bulk/post 三段最终 SQL + 绑定首行 + 行数;写入类红字警示 -->
|
||||
<template v-else>
|
||||
<div v-for="(s, idx) in wire.statements || []" :key="idx" class="space-y-1">
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="inline-flex items-center rounded-full px-2 py-0.5 text-xs font-medium bg-surface-soft text-secondary font-mono">{{ s.phase }}</span>
|
||||
<span v-if="statementRowCount(s)" class="text-xs text-muted font-mono">rows: {{ statementRowCount(s) }}</span>
|
||||
</div>
|
||||
<pre class="rounded-lg bg-surface-soft p-2.5 text-xs font-mono text-secondary whitespace-pre-wrap break-all">{{ s.sql }}</pre>
|
||||
<pre v-if="s.binds && Object.keys(s.binds).length > 0" class="rounded-lg bg-surface-soft p-2.5 text-xs font-mono text-muted whitespace-pre-wrap break-all">{{ prettyJson(s.binds) }}</pre>
|
||||
</div>
|
||||
<div v-if="wire.rowcount !== undefined" class="text-xs text-muted font-mono">rowcount: {{ wire.rowcount }}</div>
|
||||
<p v-if="hasWriteStatement" class="text-xs font-medium text-red-600" data-testid="call-sql-write-warning">
|
||||
{{ t('admin.integrationConnector.callLogs.sqlWriteWarning') }}
|
||||
</p>
|
||||
<button type="button" class="btn-ghost text-xs" data-testid="call-copy-sql" @click="copy(sqlReplayText)">
|
||||
{{ t('admin.integrationConnector.callLogs.copySql') }}
|
||||
</button>
|
||||
</template>
|
||||
<!-- 请求:线级请求(wire)+ 业务参数(归一化)双栏 -->
|
||||
<section class="detail-section">
|
||||
<h4 class="section-label">{{ t('admin.integrationConnector.callLogs.request') }}</h4>
|
||||
<div class="dual-grid">
|
||||
<div class="pane">
|
||||
<h5 class="pane-title">{{ t('admin.integrationConnector.callLogs.wire') }}</h5>
|
||||
<template v-if="wire">
|
||||
<!-- soap/rest:method/url/SOAPAction/headers + 完整请求 body XML -->
|
||||
<template v-if="wire.kind !== 'database'">
|
||||
<pre class="pre-block">{{ wireMetaText }}</pre>
|
||||
<div class="pre-caption mono">── request_body ──</div>
|
||||
<pre class="pre-block pre-scroll">{{ wire.request_body }}</pre>
|
||||
<div class="copy-row">
|
||||
<el-button size="small" data-testid="call-copy-body" @click="copy(wire.request_body || '')">
|
||||
{{ t('admin.integrationConnector.callLogs.copyBody') }}
|
||||
</el-button>
|
||||
<el-button size="small" data-testid="call-copy-curl" @click="copy(curlCommand)">
|
||||
{{ t('admin.integrationConnector.callLogs.copyCurl') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<!-- 历史存量行 / 未捕获场景:wire_json 为 NULL,如实展示不回填 -->
|
||||
<p v-else class="text-xs text-muted" data-testid="call-no-wire">
|
||||
{{ t('admin.integrationConnector.callLogs.noWire') }}
|
||||
</p>
|
||||
</div>
|
||||
<div class="rounded-xl border border-default p-3 space-y-2 min-w-0">
|
||||
<h5 class="text-xs font-bold text-primary">{{ t('admin.integrationConnector.callLogs.normalized') }}</h5>
|
||||
<pre class="rounded-lg bg-surface-soft p-2.5 text-xs font-mono text-secondary whitespace-pre-wrap break-all max-h-72 overflow-y-auto">{{ prettyJson(detail.call.request_summary_json) }}</pre>
|
||||
<button type="button" class="btn-ghost text-xs" data-testid="call-copy-request-json" @click="copy(prettyJson(detail.call.request_summary_json))">
|
||||
{{ t('admin.integrationConnector.callLogs.copyJson') }}
|
||||
</button>
|
||||
</div>
|
||||
<!-- database:pre/bulk/post 三段最终 SQL + 绑定首行 + 行数;写入类红字警示 -->
|
||||
<template v-else>
|
||||
<div v-for="(s, idx) in wire.statements || []" :key="idx" class="sql-block">
|
||||
<div class="sql-head">
|
||||
<el-tag type="info" effect="plain" size="small" class="mono">{{ s.phase }}</el-tag>
|
||||
<span v-if="statementRowCount(s)" class="cell-mono">rows: {{ statementRowCount(s) }}</span>
|
||||
</div>
|
||||
<pre class="pre-block">{{ s.sql }}</pre>
|
||||
<pre v-if="s.binds && Object.keys(s.binds).length > 0" class="pre-block pre-muted">{{ prettyJson(s.binds) }}</pre>
|
||||
</div>
|
||||
<div v-if="wire.rowcount !== undefined" class="cell-mono">rowcount: {{ wire.rowcount }}</div>
|
||||
<p v-if="hasWriteStatement" class="write-warning" data-testid="call-sql-write-warning">
|
||||
{{ t('admin.integrationConnector.callLogs.sqlWriteWarning') }}
|
||||
</p>
|
||||
<el-button size="small" data-testid="call-copy-sql" @click="copy(sqlReplayText)">
|
||||
{{ t('admin.integrationConnector.callLogs.copySql') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</template>
|
||||
<!-- 历史存量行 / 未捕获场景:wire_json 为 NULL,如实展示不回填 -->
|
||||
<p v-else class="cell-muted" data-testid="call-no-wire">
|
||||
{{ t('admin.integrationConnector.callLogs.noWire') }}
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
<div class="pane">
|
||||
<h5 class="pane-title">{{ t('admin.integrationConnector.callLogs.normalized') }}</h5>
|
||||
<pre class="pre-block pre-scroll">{{ prettyJson(detail.call.request_summary_json) }}</pre>
|
||||
<el-button size="small" data-testid="call-copy-request-json" @click="copy(prettyJson(detail.call.request_summary_json))">
|
||||
{{ t('admin.integrationConnector.callLogs.copyJson') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 响应:原始报文 + 归一化 JSON 双栏 -->
|
||||
<section class="space-y-2">
|
||||
<h4 class="text-xs font-bold uppercase tracking-wide text-muted">{{ t('admin.integrationConnector.callLogs.response') }}</h4>
|
||||
<div class="grid grid-cols-1 gap-4 lg:grid-cols-2">
|
||||
<div class="rounded-xl border border-default p-3 space-y-2 min-w-0">
|
||||
<h5 class="text-xs font-bold text-primary">{{ t('admin.integrationConnector.callLogs.rawPayload') }}</h5>
|
||||
<pre v-if="wire" class="rounded-lg bg-surface-soft p-2.5 text-xs font-mono text-secondary whitespace-pre-wrap break-all max-h-72 overflow-y-auto">{{ rawResponseText }}</pre>
|
||||
<p v-else class="text-xs text-muted" data-testid="call-no-wire-response">{{ t('admin.integrationConnector.callLogs.noWire') }}</p>
|
||||
<button v-if="wire" type="button" class="btn-ghost text-xs" data-testid="call-copy-raw" @click="copy(rawResponseText)">
|
||||
{{ t('admin.integrationConnector.callLogs.copyRaw') }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="rounded-xl border border-default p-3 space-y-2 min-w-0">
|
||||
<h5 class="text-xs font-bold text-primary">{{ t('admin.integrationConnector.callLogs.normalizedJson') }}</h5>
|
||||
<pre class="rounded-lg bg-surface-soft p-2.5 text-xs font-mono text-secondary whitespace-pre-wrap break-all max-h-72 overflow-y-auto">{{ prettyJson(detail.call.response_summary_json) }}</pre>
|
||||
<button type="button" class="btn-ghost text-xs" data-testid="call-copy-response-json" @click="copy(prettyJson(detail.call.response_summary_json))">
|
||||
{{ t('admin.integrationConnector.callLogs.copyJson') }}
|
||||
</button>
|
||||
</div>
|
||||
<!-- 响应:原始报文 + 归一化 JSON 双栏 -->
|
||||
<section class="detail-section">
|
||||
<h4 class="section-label">{{ t('admin.integrationConnector.callLogs.response') }}</h4>
|
||||
<div class="dual-grid">
|
||||
<div class="pane">
|
||||
<h5 class="pane-title">{{ t('admin.integrationConnector.callLogs.rawPayload') }}</h5>
|
||||
<pre v-if="wire" class="pre-block pre-scroll">{{ rawResponseText }}</pre>
|
||||
<p v-else class="cell-muted" data-testid="call-no-wire-response">{{ t('admin.integrationConnector.callLogs.noWire') }}</p>
|
||||
<el-button v-if="wire" size="small" data-testid="call-copy-raw" @click="copy(rawResponseText)">
|
||||
{{ t('admin.integrationConnector.callLogs.copyRaw') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
<div class="pane">
|
||||
<h5 class="pane-title">{{ t('admin.integrationConnector.callLogs.normalizedJson') }}</h5>
|
||||
<pre class="pre-block pre-scroll">{{ prettyJson(detail.call.response_summary_json) }}</pre>
|
||||
<el-button size="small" data-testid="call-copy-response-json" @click="copy(prettyJson(detail.call.response_summary_json))">
|
||||
{{ t('admin.integrationConnector.callLogs.copyJson') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.call-logs-panel {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
/* 筛选条一行化:flex wrap + 固定宽度控件,回车/查询触发 */
|
||||
.filter-bar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: 10px;
|
||||
background: var(--el-bg-color);
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.filter-field {
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
/* 等宽栈无中文字形:中文 placeholder 需回退正文字体,避免宋体衬线观感(输入的编码仍为等宽) */
|
||||
.mono-filter :deep(.el-input__inner)::placeholder {
|
||||
font-family: var(--el-font-family);
|
||||
}
|
||||
.mono-filter :deep(.el-input__inner) {
|
||||
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
|
||||
}
|
||||
|
||||
/* 列表卡片 */
|
||||
.logs-card {
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: 10px;
|
||||
background: var(--el-bg-color);
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.logs-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.logs-title {
|
||||
margin: 0;
|
||||
color: var(--el-text-color-primary);
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.logs-total {
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.logs-table :deep(.el-table__row) {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.mono {
|
||||
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
|
||||
}
|
||||
|
||||
.cell-mono {
|
||||
color: var(--el-text-color-secondary);
|
||||
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.cell-muted {
|
||||
margin: 0;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.cell-ellipsis {
|
||||
display: block;
|
||||
max-width: 220px;
|
||||
overflow: hidden;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* 状态徽章:成功/失败 + 图标 + 原始状态值(等宽) */
|
||||
.status-tag {
|
||||
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
|
||||
}
|
||||
|
||||
.status-tag .status-icon {
|
||||
margin-right: 4px;
|
||||
}
|
||||
|
||||
/* 分页条 */
|
||||
.pager {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
.pager-text {
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* 详情抽屉头部:标题 + 元信息 + 复制入口 */
|
||||
.detail-header {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.detail-title-row {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.detail-title {
|
||||
margin: 0;
|
||||
color: var(--el-text-color-primary);
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.detail-meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 4px 24px;
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.meta-item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.meta-key {
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
.ellipsis {
|
||||
max-width: 240px;
|
||||
overflow: hidden;
|
||||
color: var(--el-text-color-regular);
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* 详情正文:分区标题 + 双栏面板 */
|
||||
.detail-body {
|
||||
display: grid;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.detail-section {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.section-label {
|
||||
margin: 0;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.dual-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
@media (max-width: 1200px) {
|
||||
.dual-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
.pane {
|
||||
display: grid;
|
||||
align-content: start;
|
||||
gap: 8px;
|
||||
min-width: 0;
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: 10px;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.pane-title {
|
||||
margin: 0;
|
||||
color: var(--el-text-color-primary);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.copy-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.pre-block {
|
||||
margin: 0;
|
||||
border-radius: 8px;
|
||||
background: var(--el-fill-color-light);
|
||||
color: var(--el-text-color-regular);
|
||||
padding: 10px;
|
||||
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.pre-scroll {
|
||||
max-height: 288px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.pre-muted {
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
.pre-caption {
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.sql-block {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.sql-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.write-warning {
|
||||
margin: 0;
|
||||
color: var(--el-color-danger);
|
||||
font-size: 12px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* 步骤时间线:chip 链 + 当前步高亮 */
|
||||
.timeline {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.timeline-step {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
border-radius: 8px;
|
||||
background: var(--el-fill-color-light);
|
||||
padding: 6px 10px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.timeline-step.current {
|
||||
border: 1px solid var(--el-color-primary-light-5);
|
||||
background: var(--el-color-primary-light-9);
|
||||
}
|
||||
|
||||
.timeline-dot {
|
||||
display: inline-block;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
flex: none;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.dot-ok {
|
||||
background: var(--el-color-success);
|
||||
}
|
||||
|
||||
.dot-fail {
|
||||
background: var(--el-color-danger);
|
||||
}
|
||||
|
||||
.step-interface {
|
||||
color: var(--el-text-color-regular);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.text-ok {
|
||||
color: var(--el-color-success);
|
||||
}
|
||||
|
||||
.text-fail {
|
||||
color: var(--el-color-danger);
|
||||
}
|
||||
|
||||
.timeline-sep {
|
||||
color: var(--el-text-color-placeholder);
|
||||
}
|
||||
</style>
|
||||
+100
-28
@@ -1,11 +1,19 @@
|
||||
<!--
|
||||
features/admin/modules/integration-connector/components/IntegrationCapabilityCallModal.vue
|
||||
用途:手动调用一个已注册能力(输入 params / context JSON),展示调用结果与 trace。
|
||||
依赖:showCallModal、callParamsText、callContextText、callResult、callBusy。
|
||||
逻辑:由 IntegrationConnectorPage 打开;emit close/run。
|
||||
依赖:element-plus(dialog 弹窗/只读 textarea/按钮,沿用管理端 element-trial 主题)、
|
||||
showCallModal、callParamsText、callContextText、callResult、callBusy。
|
||||
逻辑:由 IntegrationConnectorPage 打开;emit close/run。原自绘弹窗不点遮罩关闭、
|
||||
无 Esc 关闭、无右上角关闭钮,el-dialog 以 close-on-click-modal/close-on-press-escape/
|
||||
show-close 三关对齐该语义;关闭唯一入口是 footer 的取消与运行链路。
|
||||
视觉层已迁移 Element Plus(element-trial 主题),布局间距由 AdminLayout 壳层持有。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElButton, ElDialog, ElInput } from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import type { IntegrationCallResultRow } from '../types/integration-connector.types';
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -26,34 +34,98 @@ 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.callModal.title', { capability }) }}</h3>
|
||||
<p class="section-desc mt-1">{{ t('admin.integrationConnector.callModal.hint') }}</p>
|
||||
<el-dialog
|
||||
:model-value="visible"
|
||||
:title="t('admin.integrationConnector.callModal.title', { capability })"
|
||||
width="640px"
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
:show-close="false"
|
||||
class="capability-call-dialog"
|
||||
@close="emit('close')"
|
||||
>
|
||||
<div class="call-modal-body">
|
||||
<div class="readonly-field">
|
||||
<label class="readonly-label">{{ t('admin.integrationConnector.callModal.params') }}</label>
|
||||
<el-input
|
||||
:model-value="props.paramsText"
|
||||
type="textarea"
|
||||
:rows="6"
|
||||
spellcheck="false"
|
||||
readonly
|
||||
class="readonly-mono"
|
||||
/>
|
||||
<p class="readonly-hint">{{ t('admin.integrationConnector.callModal.paramsHint') }}</p>
|
||||
</div>
|
||||
<div class="px-5 sm:px-8 py-5 space-y-4 overflow-y-auto">
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.callModal.params') }}</label>
|
||||
<textarea :value="props.paramsText" rows="6" class="input-field text-sm font-mono" spellcheck="false" readonly />
|
||||
<p class="text-xs text-muted">{{ t('admin.integrationConnector.callModal.paramsHint') }}</p>
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.callModal.context') }}</label>
|
||||
<textarea :value="props.contextText" rows="4" class="input-field text-sm font-mono" spellcheck="false" readonly />
|
||||
<p class="text-xs text-muted">{{ t('admin.integrationConnector.callModal.contextHint') }}</p>
|
||||
</div>
|
||||
<div v-if="result" class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.callModal.result') }}</label>
|
||||
<pre class="rounded-lg bg-surface-soft p-3 text-xs font-mono text-secondary whitespace-pre-wrap break-all">{{ JSON.stringify(result, null, 2) }}</pre>
|
||||
</div>
|
||||
<div class="readonly-field">
|
||||
<label class="readonly-label">{{ t('admin.integrationConnector.callModal.context') }}</label>
|
||||
<el-input
|
||||
:model-value="props.contextText"
|
||||
type="textarea"
|
||||
:rows="4"
|
||||
spellcheck="false"
|
||||
readonly
|
||||
class="readonly-mono"
|
||||
/>
|
||||
<p class="readonly-hint">{{ t('admin.integrationConnector.callModal.contextHint') }}</p>
|
||||
</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="busy" @click="emit('run')">
|
||||
{{ busy ? t('admin.integrationConnector.callModal.running') : t('admin.integrationConnector.callModal.run') }}
|
||||
</button>
|
||||
<div v-if="result" class="readonly-field">
|
||||
<label class="readonly-label">{{ t('admin.integrationConnector.callModal.result') }}</label>
|
||||
<pre class="result-pre">{{ JSON.stringify(result, null, 2) }}</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<template #footer>
|
||||
<el-button @click="emit('close')">{{ t('admin.cancel') }}</el-button>
|
||||
<el-button type="primary" :loading="busy" :disabled="busy" @click="emit('run')">
|
||||
{{ busy ? t('admin.integrationConnector.callModal.running') : t('admin.integrationConnector.callModal.run') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.call-modal-body {
|
||||
display: grid;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.readonly-field {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.readonly-label {
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.readonly-hint {
|
||||
margin: 0;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* 只读 JSON 展示保留等宽字体 */
|
||||
.readonly-mono :deep(.el-textarea__inner) {
|
||||
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
|
||||
font-size: 13px;
|
||||
line-height: 1.45;
|
||||
color: var(--el-text-color-regular);
|
||||
}
|
||||
|
||||
.result-pre {
|
||||
margin: 0;
|
||||
max-height: 240px;
|
||||
overflow: auto;
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: 8px;
|
||||
background: var(--el-fill-color-light);
|
||||
color: var(--el-text-color-regular);
|
||||
padding: 12px;
|
||||
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
</style>
|
||||
+172
-121
@@ -4,12 +4,16 @@
|
||||
* SOAP 显示 WSDL,database 显示 db_kind 专属下拉与数据库连接串 label;
|
||||
* 绑定表单的有序步骤编辑器(添加/删除/上移下移/每步独立参数映射);
|
||||
* 以及抽屉化后的 JSON 编辑字段(格式化/失焦校验)、脏检查关闭确认与 Esc 关闭行为。
|
||||
* 依赖:@vue/test-utils、vitest、i18n。
|
||||
* 依赖:@vue/test-utils、vitest、element-plus(ElMessageBox mock)、i18n。
|
||||
* 逻辑:切换 connector_type 断言字段可见性;对 JsonTextareaField 断言格式化改写
|
||||
* 与非法 JSON 提示;mock window.confirm 断言脏表单关闭拦截与放行。
|
||||
* 与非法 JSON 提示;spy ElMessageBox.confirm 断言脏表单关闭拦截与放行。
|
||||
* 组件已迁移 Element Plus:el-drawer 正文懒渲染(挂载后统一 flushPromises)、
|
||||
* el-select/el-switch 等 DIV 根控件按 EP 组件结构交互(见下方辅助函数)。
|
||||
*/
|
||||
import { mount, enableAutoUnmount } from '@vue/test-utils';
|
||||
import { enableAutoUnmount, flushPromises, mount, type VueWrapper } from '@vue/test-utils';
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
import { nextTick } from 'vue';
|
||||
import { ElMessageBox } from 'element-plus';
|
||||
import i18n from '@/i18n';
|
||||
import IntegrationConnectorFormDrawer from './IntegrationConnectorFormDrawer.vue';
|
||||
import JsonTextareaField from './JsonTextareaField.vue';
|
||||
@@ -25,8 +29,8 @@ import {
|
||||
|
||||
enableAutoUnmount(afterEach);
|
||||
|
||||
function mountDrawer(overrides: Partial<Record<string, unknown>> = {}) {
|
||||
return mount(IntegrationConnectorFormDrawer, {
|
||||
async function mountDrawer(overrides: Partial<Record<string, unknown>> = {}) {
|
||||
const wrapper = mount(IntegrationConnectorFormDrawer, {
|
||||
props: {
|
||||
visible: true,
|
||||
activeEntity: 'client',
|
||||
@@ -49,19 +53,57 @@ function mountDrawer(overrides: Partial<Record<string, unknown>> = {}) {
|
||||
},
|
||||
global: { plugins: [i18n] },
|
||||
});
|
||||
// el-drawer 正文懒渲染(rendered 标记在 mounted 后置位),冲刷微任务队列等待表单挂载
|
||||
await flushPromises();
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
/** DIV 根控件(el-select 等)的 v-model 赋值:DOMWrapper.setValue 对 DIV 会抛错,
|
||||
* 必须走组件 update:modelValue;EP 下拉用户选择除 update:modelValue 外还会 emit change,
|
||||
* 表单 @change 联动(类型切换清 db_kind、接口选客户端联动类型/编码)依赖它,一并补发。 */
|
||||
async function setControl(wrapper: VueWrapper, testId: string, value: unknown) {
|
||||
const control = wrapper.getComponent(`[data-testid="${testId}"]`);
|
||||
control.setValue(value);
|
||||
control.vm.$emit('change', value);
|
||||
await nextTick();
|
||||
}
|
||||
|
||||
/** el-select 选项断言:原生 <option> 已由 ElOption 组件承载(下拉本体 teleport 到 body),
|
||||
* 文案从组件 label prop 读取。 */
|
||||
function optionLabelsOf(wrapper: VueWrapper, testId: string): string[] {
|
||||
return wrapper.getComponent(`[data-testid="${testId}"]`)
|
||||
.findAllComponents({ name: 'ElOption' })
|
||||
.map((option) => String(option.props('label')));
|
||||
}
|
||||
|
||||
/** el-select 禁用只读断言:根为 DIV 无 disabled 属性,EP 以 .el-select__wrapper 的
|
||||
* is-disabled class 表达禁用态。 */
|
||||
function isSelectDisabled(wrapper: VueWrapper, testId: string): boolean {
|
||||
return wrapper.getComponent(`[data-testid="${testId}"]`)
|
||||
.find('.el-select__wrapper')
|
||||
.classes()
|
||||
.includes('is-disabled');
|
||||
}
|
||||
|
||||
/** 模拟点击遮罩关闭:EP overlay 用 useSameTarget 过滤「从面板内部发起」的点击,
|
||||
* 需在 overlay 上按 mousedown → mouseup → click 三连触发才判定为遮罩点击。 */
|
||||
async function clickMask(wrapper: VueWrapper) {
|
||||
const overlay = wrapper.find('.el-overlay');
|
||||
await overlay.trigger('mousedown');
|
||||
await overlay.trigger('mouseup');
|
||||
await overlay.trigger('click');
|
||||
}
|
||||
|
||||
describe('IntegrationConnectorFormDrawer connector-type fields', () => {
|
||||
it('REST 默认显示接口地址与超时字段', () => {
|
||||
const wrapper = mountDrawer();
|
||||
it('REST 默认显示接口地址与超时字段', async () => {
|
||||
const wrapper = await 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();
|
||||
const wrapper = await mountDrawer();
|
||||
await setControl(wrapper, 'client-connector-type', 'soap');
|
||||
// 连接地址仍是同一 client-endpoint 字段,仅 label 变 WSDL
|
||||
expect(wrapper.find('[data-testid="client-endpoint"]').exists()).toBe(true);
|
||||
// 超时在 SOAP 下也显示
|
||||
@@ -70,8 +112,8 @@ describe('IntegrationConnectorFormDrawer connector-type fields', () => {
|
||||
expect(labels.some((t) => t.includes('WSDL'))).toBe(true);
|
||||
});
|
||||
|
||||
it('接口定义 REST 显示 HTTP 方法与请求路径', () => {
|
||||
const wrapper = mountDrawer({ activeEntity: 'interface' });
|
||||
it('接口定义 REST 显示 HTTP 方法与请求路径', async () => {
|
||||
const wrapper = await 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);
|
||||
@@ -80,26 +122,27 @@ describe('IntegrationConnectorFormDrawer connector-type fields', () => {
|
||||
it('接口定义:选客户端实例后编码自动建议为「客户端编码-名称slug」,连接器类型为同款禁用下拉随客户端联动', async () => {
|
||||
const interfaceForm = createEmptyInterfaceDefinitionForm();
|
||||
interfaceForm.name = '鼎捷TOPGP库存查询GetItemStockList';
|
||||
const wrapper = mountDrawer({
|
||||
const wrapper = await mountDrawer({
|
||||
activeEntity: 'interface',
|
||||
interfaceForm,
|
||||
clientOptions: [{ code: '1001', name: '鼎捷TOPGP', connector_type: 'soap' }],
|
||||
});
|
||||
await wrapper.find('[data-testid="interface-client"]').setValue('1001');
|
||||
await setControl(wrapper, 'interface-client', '1001');
|
||||
// 编码留空 → 按客户端编码 + 名称 slug 自动建议
|
||||
expect(interfaceForm.code).toBe('1001-topgp-getitemstocklist');
|
||||
// 连接器类型与客户端实例同款下拉控件,仅禁用只读:随所选客户端联动展示
|
||||
const typeSelect = wrapper.find('[data-testid="interface-connector-type"]');
|
||||
const typeSelect = wrapper.getComponent('[data-testid="interface-connector-type"]');
|
||||
expect(typeSelect.text()).toContain('SOAP');
|
||||
expect(typeSelect.attributes('disabled')).toBeDefined();
|
||||
// 只渲染当前类型单项,不提供其他选项(不可改选)
|
||||
expect(typeSelect.findAll('option').length).toBe(1);
|
||||
// el-select 根为 DIV 无 disabled 属性,禁用态改以 .el-select__wrapper 的 is-disabled class 断言
|
||||
expect(isSelectDisabled(wrapper, 'interface-connector-type')).toBe(true);
|
||||
// 原生 option 标签已由 ElOption 组件承载,等价断言「只渲染当前类型单项,不提供其他选项(不可改选)」
|
||||
expect(typeSelect.findAllComponents({ name: 'ElOption' }).length).toBe(1);
|
||||
});
|
||||
|
||||
it('接口定义:状态在底部操作条以状态胶囊只读展示(悬停承载说明),无启用勾选', () => {
|
||||
it('接口定义:状态在底部操作条以状态胶囊只读展示(悬停承载说明),无启用勾选', async () => {
|
||||
const interfaceForm = createEmptyInterfaceDefinitionForm();
|
||||
interfaceForm.status = 'published';
|
||||
const wrapper = mountDrawer({ activeEntity: 'interface', interfaceForm });
|
||||
const wrapper = await mountDrawer({ activeEntity: 'interface', interfaceForm });
|
||||
// 操作条只放安静的状态指示器:彩点胶囊,不放表单控件与多行文案;长说明走悬停 title
|
||||
const chip = wrapper.find('[data-testid="lifecycle-status-chip"]');
|
||||
expect(chip.exists()).toBe(true);
|
||||
@@ -109,8 +152,8 @@ describe('IntegrationConnectorFormDrawer connector-type fields', () => {
|
||||
expect(wrapper.findAll('input[type="checkbox"]').length).toBe(0);
|
||||
});
|
||||
|
||||
it('绑定:无来源实例编码字段,状态在底部操作条以禁用下拉只读展示', () => {
|
||||
const wrapper = mountDrawer({ activeEntity: 'binding' });
|
||||
it('绑定:无来源实例编码字段,状态在底部操作条以禁用下拉只读展示', async () => {
|
||||
const wrapper = await mountDrawer({ activeEntity: 'binding' });
|
||||
const labels = wrapper.findAll('label').map((l) => l.text());
|
||||
// 来源快捷列已删除:路由条件统一走高级配置 JSON
|
||||
expect(labels.some((t) => t.includes('来源实例编码'))).toBe(false);
|
||||
@@ -122,7 +165,7 @@ describe('IntegrationConnectorFormDrawer connector-type fields', () => {
|
||||
|
||||
it('绑定:添加步骤并选接口后,只读提示该步接口归属的客户端实例', async () => {
|
||||
const bindingForm = createEmptyBindingForm();
|
||||
const wrapper = mountDrawer({
|
||||
const wrapper = await mountDrawer({
|
||||
activeEntity: 'binding',
|
||||
bindingForm,
|
||||
clientOptions: [
|
||||
@@ -135,21 +178,25 @@ describe('IntegrationConnectorFormDrawer connector-type fields', () => {
|
||||
expect(wrapper.find('[data-testid="binding-client"]').exists()).toBe(false);
|
||||
// 添加一步并选择接口定义 → 只读提示其归属客户端实例
|
||||
await wrapper.find('[data-testid="binding-add-step"]').trigger('click');
|
||||
await wrapper.find('[data-testid="binding-step-interface-0"]').setValue('1001-iface');
|
||||
await setControl(wrapper, 'binding-step-interface-0', '1001-iface');
|
||||
expect(wrapper.find('[data-testid="binding-step-client-0"]').text()).toContain('1001');
|
||||
});
|
||||
|
||||
it('绑定能力下拉选项本地化:有翻译显示「中文名(注册名)」,无翻译兜底注册名', () => {
|
||||
const wrapper = mountDrawer({
|
||||
it('绑定能力下拉选项本地化:有翻译显示「中文名(注册名)」,无翻译兜底注册名', async () => {
|
||||
const wrapper = await 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([
|
||||
// 能力下拉是绑定表单首个 el-select;原生 <option> 已由 ElOption 组件承载,
|
||||
// 文案从 label prop 读取(等价旧的原生 option 文本枚举)
|
||||
const capabilitySelect = wrapper.findComponent({ name: 'ElSelect' });
|
||||
expect(capabilitySelect.exists()).toBe(true);
|
||||
const labels = capabilitySelect.findAllComponents({ name: 'ElOption' })
|
||||
.map((o) => String(o.props('label')));
|
||||
expect(labels).toEqual([
|
||||
'在途库存查询(in_transit_transfer.query_inventory)',
|
||||
'unknown.capability',
|
||||
]);
|
||||
@@ -158,16 +205,16 @@ describe('IntegrationConnectorFormDrawer connector-type fields', () => {
|
||||
|
||||
describe('IntegrationConnectorFormDrawer database connector type', () => {
|
||||
it('类型下拉含「数据库直连」;选中后显示 db_kind 四选一下拉、数据库连接串 label,超时照显', async () => {
|
||||
const wrapper = mountDrawer();
|
||||
const typeOptions = wrapper.find('[data-testid="client-connector-type"]').findAll('option');
|
||||
expect(typeOptions.map((o) => o.text())).toEqual(['REST API', 'SOAP 服务', '数据库直连']);
|
||||
const wrapper = await mountDrawer();
|
||||
// el-select 选项由 ElOption 组件承载,label 从组件 prop 读取(等价旧的原生 option 文本枚举)
|
||||
expect(optionLabelsOf(wrapper, 'client-connector-type')).toEqual(['REST API', 'SOAP 服务', '数据库直连']);
|
||||
// 非 database 类型不渲染 db_kind 下拉
|
||||
expect(wrapper.find('[data-testid="client-db-kind"]').exists()).toBe(false);
|
||||
await wrapper.find('[data-testid="client-connector-type"]').setValue('database');
|
||||
const dbKind = wrapper.find('[data-testid="client-db-kind"]');
|
||||
await setControl(wrapper, 'client-connector-type', 'database');
|
||||
const dbKind = wrapper.getComponent('[data-testid="client-db-kind"]');
|
||||
expect(dbKind.exists()).toBe(true);
|
||||
// db_kind 专属下拉四选一(含未选占位项),label 即库名
|
||||
expect(dbKind.findAll('option').map((o) => o.text())).toEqual(['—', 'MySQL', 'Oracle', 'SQL Server', 'PostgreSQL']);
|
||||
// db_kind 专属下拉四选一(含未选占位项),label 即库名;同上按 ElOption 组件 label 断言
|
||||
expect(optionLabelsOf(wrapper, 'client-db-kind')).toEqual(['—', 'MySQL', 'Oracle', 'SQL Server', 'PostgreSQL']);
|
||||
// endpoint label 切换为数据库连接串语义;超时字段照常显示
|
||||
const labels = wrapper.findAll('label').map((l) => l.text());
|
||||
expect(labels.some((t) => t.includes('数据库连接串'))).toBe(true);
|
||||
@@ -176,12 +223,12 @@ describe('IntegrationConnectorFormDrawer database connector type', () => {
|
||||
|
||||
it('database 类型不显示 HTTP 方法/请求路径(接口表单随客户端联动 database 类型)', async () => {
|
||||
const interfaceForm = createEmptyInterfaceDefinitionForm();
|
||||
const wrapper = mountDrawer({
|
||||
const wrapper = await mountDrawer({
|
||||
activeEntity: 'interface',
|
||||
interfaceForm,
|
||||
clientOptions: [{ code: 'erp-db', name: 'ERP Oracle', connector_type: 'database' }],
|
||||
});
|
||||
await wrapper.find('[data-testid="interface-client"]').setValue('erp-db');
|
||||
await setControl(wrapper, 'interface-client', 'erp-db');
|
||||
// 接口类型随客户端联动为 database
|
||||
expect(interfaceForm.connector_type).toBe('database');
|
||||
const labels = wrapper.findAll('label').map((l) => l.text());
|
||||
@@ -193,18 +240,18 @@ describe('IntegrationConnectorFormDrawer database connector type', () => {
|
||||
|
||||
it('切回非 database 类型后 db_kind 下拉隐藏且残留值清空', async () => {
|
||||
const clientForm = createEmptyClientInstanceForm();
|
||||
const wrapper = mountDrawer({ clientForm });
|
||||
await wrapper.find('[data-testid="client-connector-type"]').setValue('database');
|
||||
await wrapper.find('[data-testid="client-db-kind"]').setValue('oracle');
|
||||
const wrapper = await mountDrawer({ clientForm });
|
||||
await setControl(wrapper, 'client-connector-type', 'database');
|
||||
await setControl(wrapper, 'client-db-kind', 'oracle');
|
||||
expect(clientForm.db_kind).toBe('oracle');
|
||||
await wrapper.find('[data-testid="client-connector-type"]').setValue('rest');
|
||||
await setControl(wrapper, 'client-connector-type', 'rest');
|
||||
expect(wrapper.find('[data-testid="client-db-kind"]').exists()).toBe(false);
|
||||
expect(clientForm.db_kind).toBe('');
|
||||
});
|
||||
|
||||
it('database 类型高级配置提示列出生效键 oracle_lib_dir', async () => {
|
||||
const wrapper = mountDrawer();
|
||||
await wrapper.find('[data-testid="client-connector-type"]').setValue('database');
|
||||
const wrapper = await mountDrawer();
|
||||
await setControl(wrapper, 'client-connector-type', 'database');
|
||||
expect(wrapper.text()).toContain('"oracle_lib_dir"');
|
||||
});
|
||||
});
|
||||
@@ -227,15 +274,15 @@ describe('IntegrationConnectorFormDrawer binding steps editor', () => {
|
||||
|
||||
it('接口从单选改为有序多选:添加两步,每步独立接口下拉与归属客户端只读提示', async () => {
|
||||
const bindingForm = createEmptyBindingForm();
|
||||
const wrapper = mountBinding({ bindingForm });
|
||||
const wrapper = await mountBinding({ bindingForm });
|
||||
// 空态无步骤行
|
||||
expect(wrapper.findAll('[data-testid="binding-step-row"]').length).toBe(0);
|
||||
// 添加两步
|
||||
await wrapper.find('[data-testid="binding-add-step"]').trigger('click');
|
||||
await wrapper.find('[data-testid="binding-add-step"]').trigger('click');
|
||||
expect(bindingForm.steps).toHaveLength(2);
|
||||
await wrapper.find('[data-testid="binding-step-interface-0"]').setValue('IF-STAGE');
|
||||
await wrapper.find('[data-testid="binding-step-interface-1"]').setValue('IF-SUBMIT');
|
||||
await setControl(wrapper, 'binding-step-interface-0', 'IF-STAGE');
|
||||
await setControl(wrapper, 'binding-step-interface-1', 'IF-SUBMIT');
|
||||
// 每步显示归属客户端只读提示(跨客户端步骤:database + soap)
|
||||
expect(wrapper.find('[data-testid="binding-step-client-0"]').text()).toContain('erp-db');
|
||||
expect(wrapper.find('[data-testid="binding-step-client-1"]').text()).toContain('tiptop-ws');
|
||||
@@ -243,11 +290,11 @@ describe('IntegrationConnectorFormDrawer binding steps editor', () => {
|
||||
|
||||
it('上移/下移重排步骤顺序;首步无上移、末步无下移(禁用)', async () => {
|
||||
const bindingForm = createEmptyBindingForm();
|
||||
const wrapper = mountBinding({ bindingForm });
|
||||
const wrapper = await mountBinding({ bindingForm });
|
||||
await wrapper.find('[data-testid="binding-add-step"]').trigger('click');
|
||||
await wrapper.find('[data-testid="binding-add-step"]').trigger('click');
|
||||
await wrapper.find('[data-testid="binding-step-interface-0"]').setValue('IF-STAGE');
|
||||
await wrapper.find('[data-testid="binding-step-interface-1"]').setValue('IF-SUBMIT');
|
||||
await setControl(wrapper, 'binding-step-interface-0', 'IF-STAGE');
|
||||
await setControl(wrapper, 'binding-step-interface-1', 'IF-SUBMIT');
|
||||
expect(wrapper.find('[data-testid="binding-step-up-0"]').attributes('disabled')).toBeDefined();
|
||||
expect(wrapper.find('[data-testid="binding-step-down-1"]').attributes('disabled')).toBeDefined();
|
||||
// 下移首步 → 顺序翻转
|
||||
@@ -262,13 +309,12 @@ describe('IntegrationConnectorFormDrawer binding steps editor', () => {
|
||||
|
||||
it('删除步骤移除对应行;每步参数映射独立编辑写回对应步骤', async () => {
|
||||
const bindingForm = createEmptyBindingForm();
|
||||
const wrapper = mountBinding({ bindingForm });
|
||||
const wrapper = await mountBinding({ bindingForm });
|
||||
await wrapper.find('[data-testid="binding-add-step"]').trigger('click');
|
||||
await wrapper.find('[data-testid="binding-add-step"]').trigger('click');
|
||||
// 每步独立的 param_mapping JSON 编辑(沿用 JsonTextareaField 交互)
|
||||
const stepRows = wrapper.findAll('[data-testid="binding-step-row"]');
|
||||
await stepRows[0].findComponent(JsonTextareaField).find('[data-testid="json-textarea"]')
|
||||
.setValue('{"erp_org":{"expr":"external_org"}}');
|
||||
await stepRows[0].find('[data-testid="json-textarea"]').setValue('{"erp_org":{"expr":"external_org"}}');
|
||||
expect(bindingForm.steps[0].param_mapping_json).toBe('{"erp_org":{"expr":"external_org"}}');
|
||||
expect(bindingForm.steps[1].param_mapping_json).toBe('');
|
||||
// 删除首步 → 只剩原第二步
|
||||
@@ -277,7 +323,7 @@ describe('IntegrationConnectorFormDrawer binding steps editor', () => {
|
||||
expect(wrapper.findAll('[data-testid="binding-step-row"]').length).toBe(1);
|
||||
});
|
||||
|
||||
it('既有单接口绑定编辑回归:steps_json 单步行回显为一步且接口预选', () => {
|
||||
it('既有单接口绑定编辑回归:steps_json 单步行回显为一步且接口预选', async () => {
|
||||
const bindingForm = bindingRowToForm({
|
||||
id: 5, capability: 'in_transit_transfer.create_transfer', context_selector_json: {},
|
||||
steps_json: [{ interface_code: 'IF-STAGE', param_mapping_json: { erp_org: { expr: 'external_org' } } }],
|
||||
@@ -286,15 +332,16 @@ describe('IntegrationConnectorFormDrawer binding steps editor', () => {
|
||||
mapping_version: 1, priority: 0, environment: 'prod',
|
||||
effective_from: null, effective_to: null, status: 'draft',
|
||||
} as IntegrationBindingRow);
|
||||
const wrapper = mountBinding({ bindingForm });
|
||||
const wrapper = await mountBinding({ bindingForm });
|
||||
expect(wrapper.findAll('[data-testid="binding-step-row"]').length).toBe(1);
|
||||
expect((wrapper.find('[data-testid="binding-step-interface-0"]').element as HTMLSelectElement).value).toBe('IF-STAGE');
|
||||
// el-select 不再是原生 select:预选值改以 EP 选中项文本断言(选项 label 为「名称(编码)」,含编码)
|
||||
expect(wrapper.getComponent('[data-testid="binding-step-interface-0"]').text()).toContain('IF-STAGE');
|
||||
expect(wrapper.find('[data-testid="binding-step-client-0"]').text()).toContain('erp-db');
|
||||
});
|
||||
});
|
||||
|
||||
describe('IntegrationConnectorFormDrawer JSON fields', () => {
|
||||
function findJsonField(wrapper: ReturnType<typeof mountDrawer>, labelPart: string) {
|
||||
function findJsonField(wrapper: VueWrapper, labelPart: string) {
|
||||
const field = wrapper
|
||||
.findAllComponents(JsonTextareaField)
|
||||
.find((w) => String(w.props('label')).includes(labelPart));
|
||||
@@ -302,8 +349,8 @@ describe('IntegrationConnectorFormDrawer JSON fields', () => {
|
||||
return field!;
|
||||
}
|
||||
|
||||
it('接口定义 4 个 JSON 字段纵向全宽堆叠渲染', () => {
|
||||
const wrapper = mountDrawer({ activeEntity: 'interface' });
|
||||
it('接口定义 4 个 JSON 字段纵向全宽堆叠渲染', async () => {
|
||||
const wrapper = await 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);
|
||||
@@ -313,7 +360,7 @@ describe('IntegrationConnectorFormDrawer JSON fields', () => {
|
||||
|
||||
it('格式化按钮将合法 JSON pretty-print 写回表单 state', async () => {
|
||||
const interfaceForm: InterfaceDefinitionFormState = createEmptyInterfaceDefinitionForm();
|
||||
const wrapper = mountDrawer({ activeEntity: 'interface', interfaceForm });
|
||||
const wrapper = await 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');
|
||||
@@ -323,7 +370,7 @@ describe('IntegrationConnectorFormDrawer JSON fields', () => {
|
||||
|
||||
it('非法 JSON 失焦后显示红字提示,格式化不改写内容', async () => {
|
||||
const interfaceForm: InterfaceDefinitionFormState = createEmptyInterfaceDefinitionForm();
|
||||
const wrapper = mountDrawer({ activeEntity: 'interface', interfaceForm });
|
||||
const wrapper = await mountDrawer({ activeEntity: 'interface', interfaceForm });
|
||||
const field = findJsonField(wrapper, '请求模板');
|
||||
const textarea = field!.find('[data-testid="json-textarea"]');
|
||||
await textarea.setValue('{ invalid');
|
||||
@@ -337,10 +384,10 @@ describe('IntegrationConnectorFormDrawer JSON fields', () => {
|
||||
expect(interfaceForm.request_spec_json).toBe('{ invalid');
|
||||
});
|
||||
|
||||
it('客户端实例与绑定实体的 JSON 字段同样启用格式化能力', () => {
|
||||
const clientWrapper = mountDrawer({ activeEntity: 'client' });
|
||||
it('客户端实例与绑定实体的 JSON 字段同样启用格式化能力', async () => {
|
||||
const clientWrapper = await mountDrawer({ activeEntity: 'client' });
|
||||
expect(findJsonField(clientWrapper, '连接配置').find('[data-testid="json-format-button"]').exists()).toBe(true);
|
||||
const bindingWrapper = mountDrawer({ activeEntity: 'binding' });
|
||||
const bindingWrapper = await mountDrawer({ activeEntity: 'binding' });
|
||||
expect(findJsonField(bindingWrapper, '高级路由条件').find('[data-testid="json-format-button"]').exists()).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -350,8 +397,8 @@ describe('IntegrationConnectorFormDrawer close guard', () => {
|
||||
vi.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('抽屉带 dialog 语义且打开时渲染标题', () => {
|
||||
const wrapper = mountDrawer({ activeEntity: 'client' });
|
||||
it('抽屉带 dialog 语义且打开时渲染标题', async () => {
|
||||
const wrapper = await mountDrawer({ activeEntity: 'client' });
|
||||
const dialog = wrapper.find('[role="dialog"]');
|
||||
expect(dialog.exists()).toBe(true);
|
||||
expect(dialog.attributes('aria-modal')).toBe('true');
|
||||
@@ -359,47 +406,54 @@ describe('IntegrationConnectorFormDrawer close guard', () => {
|
||||
});
|
||||
|
||||
it('干净表单点击遮罩直接关闭,不弹确认', async () => {
|
||||
const confirmSpy = vi.spyOn(window, 'confirm').mockReturnValue(false);
|
||||
const wrapper = mountDrawer();
|
||||
await wrapper.find('[data-testid="connector-form-drawer"]').trigger('click');
|
||||
// 脏检查确认已由 window.confirm 迁移为 ElMessageBox.confirm;默认拒绝=取消语义,干净表单不应触达
|
||||
const confirmSpy = vi.spyOn(ElMessageBox, 'confirm').mockRejectedValue('cancelled');
|
||||
const wrapper = await mountDrawer();
|
||||
await clickMask(wrapper);
|
||||
await flushPromises();
|
||||
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();
|
||||
// ElMessageBox.confirm 的 resolve=确认放弃、reject=取消保留(等价旧 window.confirm 布尔返回)
|
||||
const confirmSpy = vi.spyOn(ElMessageBox, 'confirm').mockRejectedValue('cancelled');
|
||||
const wrapper = await mountDrawer();
|
||||
await wrapper.find('[data-testid="client-endpoint"]').setValue('https://erp.example.com');
|
||||
await wrapper.find('[data-testid="connector-form-drawer"]').trigger('click');
|
||||
await clickMask(wrapper);
|
||||
await flushPromises();
|
||||
// 用户拒绝关闭 → 不 emit
|
||||
expect(confirmSpy).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.emitted('close')).toBeUndefined();
|
||||
|
||||
confirmSpy.mockReturnValue(true);
|
||||
await wrapper.find('[data-testid="connector-form-drawer"]').trigger('click');
|
||||
confirmSpy.mockResolvedValue('confirm');
|
||||
await clickMask(wrapper);
|
||||
await flushPromises();
|
||||
// 用户确认放弃 → 放行关闭
|
||||
expect(wrapper.emitted('close')).toHaveLength(1);
|
||||
});
|
||||
|
||||
it('Esc 关闭走同一确认入口(脏表单拒绝时不关闭)', async () => {
|
||||
const confirmSpy = vi.spyOn(window, 'confirm').mockReturnValue(false);
|
||||
const wrapper = mountDrawer();
|
||||
const confirmSpy = vi.spyOn(ElMessageBox, 'confirm').mockRejectedValue('cancelled');
|
||||
const wrapper = await mountDrawer();
|
||||
await wrapper.find('[data-testid="client-endpoint"]').setValue('https://erp.example.com');
|
||||
document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' }));
|
||||
await flushPromises();
|
||||
expect(confirmSpy).toHaveBeenCalledTimes(1);
|
||||
expect(wrapper.emitted('close')).toBeUndefined();
|
||||
|
||||
// 干净表单 Esc 直接关闭
|
||||
const cleanWrapper = mountDrawer();
|
||||
const cleanWrapper = await mountDrawer();
|
||||
document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' }));
|
||||
await flushPromises();
|
||||
expect(cleanWrapper.emitted('close')).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe('IntegrationConnectorFormDrawer credential modes', () => {
|
||||
it('db 模式按类型动态渲染字段(secret 字段为密码框),不显示 Secret 引用键', () => {
|
||||
const wrapper = mountDrawer({ activeEntity: 'credential' });
|
||||
it('db 模式按类型动态渲染字段(secret 字段为密码框),不显示 Secret 引用键', async () => {
|
||||
const wrapper = await 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);
|
||||
@@ -412,25 +466,25 @@ describe('IntegrationConnectorFormDrawer credential modes', () => {
|
||||
expect(wrapper.text()).toContain('{credential_password}');
|
||||
});
|
||||
|
||||
it('编辑态密文字段显示留空保持原值提示', () => {
|
||||
it('编辑态密文字段显示留空保持原值提示', async () => {
|
||||
const form = { ...createEmptyCredentialReferenceForm(), id: 7, fields: { username: 'erp_user' } };
|
||||
const wrapper = mountDrawer({ activeEntity: 'credential', credentialForm: form });
|
||||
const wrapper = await 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');
|
||||
const wrapper = await mountDrawer({ activeEntity: 'credential' });
|
||||
await setControl(wrapper, 'credential-type', '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');
|
||||
const wrapper = await mountDrawer({ activeEntity: 'credential' });
|
||||
await setControl(wrapper, 'credential-provider', '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);
|
||||
@@ -438,14 +492,13 @@ describe('IntegrationConnectorFormDrawer credential modes', () => {
|
||||
});
|
||||
|
||||
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);
|
||||
it('新建态:类型/来源下拉选项本地化渲染(与列表徽章一致),状态不进表单,无只读信息区', async () => {
|
||||
const wrapper = await mountDrawer({ activeEntity: 'credential' });
|
||||
// 下拉选项由 ElOption 组件承载,本地化文案从 label prop 读取(等价旧的原生 option 文本枚举)
|
||||
expect(optionLabelsOf(wrapper, 'credential-type')).toEqual(['账密', '令牌']);
|
||||
expect(optionLabelsOf(wrapper, 'credential-provider')).toEqual(['界面维护(加密保存)', '环境变量']);
|
||||
// 状态由列表生命周期按钮流转,凭据表单只有来源/类型两个下拉(原生 select 计数等价改为 ElSelect 组件计数)
|
||||
expect(wrapper.findAllComponents({ name: 'ElSelect' }).length).toBe(2);
|
||||
// 新建态没有只读信息区
|
||||
expect(wrapper.find('[data-testid="credential-meta"]').exists()).toBe(false);
|
||||
// 正文分组:基本信息 + 凭据值
|
||||
@@ -453,32 +506,31 @@ describe('IntegrationConnectorFormDrawer credential identity freeze', () => {
|
||||
expect(wrapper.text()).toContain('凭据值');
|
||||
});
|
||||
|
||||
it('编辑态:编码/类型/来源以同款禁用表单控件只读展示(不用徽章形态),启用开关在底部操作条', () => {
|
||||
it('编辑态:编码/类型/来源以同款禁用表单控件只读展示(不用徽章形态),启用开关在底部操作条', async () => {
|
||||
const form = { ...createEmptyCredentialReferenceForm(), id: 7, code: 'tiptop-erp', credential_type: 'password', secret_provider: 'db', status: 'active' };
|
||||
const wrapper = mountDrawer({ activeEntity: 'credential', credentialForm: form });
|
||||
const wrapper = await 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('账密');
|
||||
expect(isSelectDisabled(wrapper, 'credential-provider')).toBe(true);
|
||||
expect(wrapper.find('[data-testid="credential-provider"]').text()).toContain('界面维护(加密保存)');
|
||||
expect(isSelectDisabled(wrapper, 'credential-type')).toBe(true);
|
||||
expect(wrapper.find('[data-testid="credential-type"]').text()).toContain('账密');
|
||||
// 状态 = 底部操作条启用开关(随保存生效),悬停 title 说明停用断流后果
|
||||
const row = wrapper.find('[data-testid="credential-enabled-row"]');
|
||||
expect(row.exists()).toBe(true);
|
||||
expect(row.text()).toContain('随保存操作生效');
|
||||
// el-switch 将 role="switch"/aria-checked 渲染在内部 input 上(aria-checked 由内部 role=switch 元素承载)
|
||||
const switchBtn = wrapper.find('[data-testid="credential-enabled-switch"]');
|
||||
expect(switchBtn.attributes('aria-checked')).toBe('true');
|
||||
expect(switchBtn.find('[role="switch"]').attributes('aria-checked')).toBe('true');
|
||||
expect(switchBtn.attributes('title')).toContain('立即失败');
|
||||
// 变更路径一句话提示
|
||||
expect(wrapper.text()).toContain('以上信息创建后不可更改');
|
||||
});
|
||||
|
||||
it('凭据值段占位符逐个以代码徽章展示', () => {
|
||||
const wrapper = mountDrawer({ activeEntity: 'credential' });
|
||||
it('凭据值段占位符逐个以代码徽章展示', async () => {
|
||||
const wrapper = await mountDrawer({ activeEntity: 'credential' });
|
||||
const chips = wrapper.findAll('[data-testid="credential-placeholder-chip"]');
|
||||
expect(chips.map((c) => c.text())).toEqual(['{credential_username}', '{credential_password}']);
|
||||
});
|
||||
@@ -487,7 +539,7 @@ describe('IntegrationConnectorFormDrawer credential identity freeze', () => {
|
||||
describe('IntegrationConnectorFormDrawer client form redesign', () => {
|
||||
it('名称失焦且编码为空时自动建议 kebab-case 编码;已填编码不被覆盖', async () => {
|
||||
const clientForm = createEmptyClientInstanceForm();
|
||||
const wrapper = mountDrawer({ clientForm });
|
||||
const wrapper = await 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');
|
||||
@@ -499,51 +551,50 @@ describe('IntegrationConnectorFormDrawer client form redesign', () => {
|
||||
|
||||
it('编辑态编码锁定不可改,类型/环境下拉本地化渲染', async () => {
|
||||
const clientForm = { ...createEmptyClientInstanceForm(), id: 3, code: 'erp-x' };
|
||||
const wrapper = mountDrawer({ clientForm });
|
||||
const wrapper = await 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(['开发', '测试', '生产']);
|
||||
// 下拉选项由 ElOption 组件承载,本地化文案从 label prop 读取(等价旧的原生 option 文本枚举)
|
||||
expect(optionLabelsOf(wrapper, 'client-connector-type')).toEqual(['REST API', 'SOAP 服务', '数据库直连']);
|
||||
expect(optionLabelsOf(wrapper, 'client-environment')).toEqual(['开发', '测试', '生产']);
|
||||
});
|
||||
|
||||
it('凭据引用为下拉选择(含「无(匿名访问)」空项),高级配置按类型给出生效键提示', async () => {
|
||||
const wrapper = mountDrawer({
|
||||
const wrapper = await 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']);
|
||||
// 下拉选项由 ElOption 组件承载,label 从组件 prop 读取(等价旧的原生 option 文本枚举)
|
||||
expect(optionLabelsOf(wrapper, 'client-credential-ref')).toEqual(['无(匿名访问)', 'tiptop-erp', 'wms-token']);
|
||||
// REST:高级配置提示列出生效键 headers
|
||||
expect(wrapper.text()).toContain('"headers"');
|
||||
// 切到 SOAP:提示变为「暂无额外生效键」语义
|
||||
await wrapper.find('[data-testid="client-connector-type"]').setValue('soap');
|
||||
await setControl(wrapper, 'client-connector-type', 'soap');
|
||||
expect(wrapper.text()).toContain('暂无额外生效的配置键');
|
||||
});
|
||||
|
||||
it('启用开关置于底部操作条左侧:小字注明随保存生效,点击翻转 state,非客户端实体不渲染', async () => {
|
||||
const clientForm = createEmptyClientInstanceForm();
|
||||
const wrapper = mountDrawer({ clientForm });
|
||||
const wrapper = await mountDrawer({ clientForm });
|
||||
const row = wrapper.find('[data-testid="client-enabled-row"]');
|
||||
// 启用不再是表单体里的孤行复选框,而是底部操作条左侧的 role="switch" 开关
|
||||
//(EP el-switch 自带隐藏 checkbox input,旧「无复选框」计数已锁死旧实现,等价改断言开关结构)
|
||||
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');
|
||||
expect(switchBtn.find('[role="switch"]').exists()).toBe(true);
|
||||
// 小字「随保存操作生效」与列表行内开关的即时生效区分;悬停 title 携带停用后果
|
||||
expect(row.text()).toContain('随保存操作生效');
|
||||
expect(switchBtn.attributes('title')).toContain('连接测试不受影响');
|
||||
// 默认启用;点击翻转表单 state,aria 状态同步
|
||||
// 默认启用;点击翻转表单 state,aria 状态同步(aria-checked 在内部 role=switch 元素上)
|
||||
expect(clientForm.enabled).toBe(true);
|
||||
await switchBtn.trigger('click');
|
||||
expect(clientForm.enabled).toBe(false);
|
||||
expect(switchBtn.attributes('aria-checked')).toBe('false');
|
||||
expect(switchBtn.find('[role="switch"]').attributes('aria-checked')).toBe('false');
|
||||
// 凭据实体渲染自己的启用开关(同一底部形态),客户端开关行不出现
|
||||
const credWrapper = mountDrawer({ activeEntity: 'credential' });
|
||||
const credWrapper = await 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' });
|
||||
const ifaceWrapper = await 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);
|
||||
});
|
||||
|
||||
+493
-292
@@ -1,9 +1,10 @@
|
||||
<!--
|
||||
features/admin/modules/integration-connector/components/IntegrationConnectorFormDrawer.vue
|
||||
用途:集成连接器四实体(客户端实例/接口定义/绑定/凭据引用)创建与编辑抽屉。
|
||||
依赖:activeEntity 对应的表单 state、useI18n、JsonTextareaField。
|
||||
逻辑:由 IntegrationConnectorPage 打开;按 activeEntity 渲染对应字段,客户端实例
|
||||
表单按「基本信息 → 连接配置 → 高级」分组,启用开关置于底部操作条左侧(随保存生效,悬停显示停用后果);
|
||||
依赖:element-plus(drawer 抽屉/form 表单控件族/ElMessageBox,沿用管理端 element-trial 主题)、
|
||||
activeEntity 对应的表单 state、useI18n、JsonTextareaField。
|
||||
逻辑:由 IntegrationConnectorPage 打开(props/emit 契约不变);按 activeEntity 渲染对应字段,
|
||||
客户端实例表单按「基本信息 → 连接配置 → 高级」分组,启用开关置于底部操作条左侧(随保存生效,悬停显示停用后果);
|
||||
客户端编码留空时按名称自动建议、
|
||||
接口编码留空时按「客户端实例编码-名称」自动建议(均可手改,已填不覆盖,编辑态编码锁定);
|
||||
客户端实例的连接器类型/环境/凭据引用均为下拉(选项来自模块常量与凭据列表,未知值兜底);
|
||||
@@ -18,11 +19,30 @@
|
||||
展示编码/类型/来源/状态(label+值行,与接口定义只读字段同款式),新建态下拉选项
|
||||
文案本地化与列表一致;高级配置帮助文案按连接器类型的生效键动态切换。
|
||||
JSON 配置字段统一走 JsonTextareaField;提交 emit save。右侧抽屉承载(表单长、JSON 面积大),
|
||||
带未保存离开确认(脏检查)、Esc 关闭与 dialog aria 语义。
|
||||
带未保存离开确认(脏检查经 ElMessageBox)、Esc/遮罩/× 关闭与 dialog aria 语义由 el-drawer 原生提供。
|
||||
视觉层已迁移 Element Plus(element-trial 主题),布局间距由 AdminLayout 壳层持有。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import {
|
||||
ElButton,
|
||||
ElDatePicker,
|
||||
ElDrawer,
|
||||
ElForm,
|
||||
ElFormItem,
|
||||
ElInput,
|
||||
ElInputNumber,
|
||||
ElMessageBox,
|
||||
ElOption,
|
||||
ElSelect,
|
||||
ElSwitch,
|
||||
ElTag,
|
||||
} from 'element-plus';
|
||||
import { ArrowDown, ArrowUp, CircleClose, Plus } from '@element-plus/icons-vue';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import JsonTextareaField from './JsonTextareaField.vue';
|
||||
import {
|
||||
CONNECTOR_CONFIG_KEYS,
|
||||
@@ -65,7 +85,6 @@ const emit = defineEmits<{
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const panelRef = ref<HTMLElement | null>(null);
|
||||
/** 打开时刻的表单快照,用于脏检查(表单均为扁平原始值,stringify 比对可靠)。 */
|
||||
const initialSnapshot = ref('');
|
||||
|
||||
@@ -232,12 +251,6 @@ 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);
|
||||
@@ -248,6 +261,39 @@ function credentialProviderLabel(value: string) {
|
||||
return t(`admin.integrationConnector.statusLabels.${value}`, value);
|
||||
}
|
||||
|
||||
// ---- 控件视图适配层(仅做「EP 控件值类型 ↔ 表单 state 类型」换算,不改提交契约) ----
|
||||
|
||||
/** 超时(秒):表单 state 恒为 string(composable 以 trim() 判空),el-input-number 产出 number。 */
|
||||
const timeoutSecondsModel = computed<number | undefined>({
|
||||
get: () => {
|
||||
const raw = props.clientForm.timeout_seconds;
|
||||
if (!raw.trim()) return undefined;
|
||||
const num = Number(raw);
|
||||
return Number.isFinite(num) ? num : undefined;
|
||||
},
|
||||
set: (value) => {
|
||||
props.clientForm.timeout_seconds = value === undefined || value === null ? '' : String(value);
|
||||
},
|
||||
});
|
||||
|
||||
/** 映射版本:清空时回退 1(与提交层 Number(form.mapping_version || 1) 兜底一致)。 */
|
||||
function setMappingVersion(value: number | undefined) {
|
||||
props.bindingForm.mapping_version = value ?? 1;
|
||||
}
|
||||
|
||||
/** 优先级:清空时回退 0(与提交层 Number(form.priority || 0) 兜底一致)。 */
|
||||
function setPriority(value: number | undefined) {
|
||||
props.bindingForm.priority = value ?? 0;
|
||||
}
|
||||
|
||||
/** 生效开始/结束:value-format 下控件产出 string|null,表单 state 恒为 string(空串=未设置)。 */
|
||||
function setEffectiveFrom(value: unknown) {
|
||||
props.bindingForm.effective_from = typeof value === 'string' ? value : '';
|
||||
}
|
||||
function setEffectiveTo(value: unknown) {
|
||||
props.bindingForm.effective_to = typeof value === 'string' ? value : '';
|
||||
}
|
||||
|
||||
const activeForm = computed(() => {
|
||||
if (props.activeEntity === 'client') return props.clientForm;
|
||||
if (props.activeEntity === 'interface') return props.interfaceForm;
|
||||
@@ -258,118 +304,112 @@ const activeForm = computed(() => {
|
||||
/** 表单相对打开时是否有变更;有变更时关闭需用户确认,防误触丢数据。 */
|
||||
const isDirty = computed(() => JSON.stringify(activeForm.value) !== initialSnapshot.value);
|
||||
|
||||
/** 统一关闭入口:脏表单先弹确认,取消则留在抽屉。 */
|
||||
function requestClose() {
|
||||
if (isDirty.value && !window.confirm(t('admin.integrationConnector.msg.unsavedConfirm'))) return;
|
||||
/**
|
||||
* 统一关闭入口:脏表单先经 ElMessageBox 确认(window.confirm 迁移),取消则留在抽屉。
|
||||
* 供 el-drawer before-close(Esc/遮罩/×)与底部「取消」按钮共用;保存成功路径不经此函数。
|
||||
*/
|
||||
async function requestClose() {
|
||||
if (!isDirty.value) {
|
||||
emit('close');
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
t('admin.integrationConnector.msg.unsavedConfirm'),
|
||||
{
|
||||
type: 'warning',
|
||||
confirmButtonText: t('common.deleteDialog.confirm'),
|
||||
cancelButtonText: t('common.deleteDialog.cancel'),
|
||||
},
|
||||
);
|
||||
} catch {
|
||||
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);
|
||||
}
|
||||
if (visible) initialSnapshot.value = JSON.stringify(activeForm.value);
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
onBeforeUnmount(() => document.removeEventListener('keydown', onKeydown));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-if="visible"
|
||||
class="fixed inset-0 z-50 flex justify-end bg-overlay"
|
||||
<el-drawer
|
||||
:model-value="visible"
|
||||
:title="entityTitle"
|
||||
size="720px"
|
||||
resizable
|
||||
destroy-on-close
|
||||
class="connector-form-drawer"
|
||||
data-testid="connector-form-drawer"
|
||||
@click.self="requestClose"
|
||||
:before-close="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">
|
||||
<div class="drawer-body">
|
||||
<p class="drawer-hint">{{ entityHint }}</p>
|
||||
<el-form label-position="top" @submit.prevent>
|
||||
<!-- 客户端实例:基本信息 → 连接配置 → 高级 三段式 -->
|
||||
<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" @change="onConnectorTypeChange">
|
||||
<option v-for="opt in CONNECTOR_TYPE_OPTIONS" :key="opt.value" :value="opt.value">{{ t(opt.labelKey) }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div v-if="clientForm.connector_type === 'database'" class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.dbKind') }}</label>
|
||||
<div class="form-section">
|
||||
<h4 class="section-title">{{ t('admin.integrationConnector.sections.basic') }}</h4>
|
||||
<div class="form-grid">
|
||||
<el-form-item :label="t('admin.integrationConnector.fields.name')">
|
||||
<el-input v-model="clientForm.name" data-testid="client-name" @blur="onClientNameBlur" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('admin.integrationConnector.fields.code')">
|
||||
<el-input v-model="clientForm.code" class="mono-input" :disabled="Boolean(clientForm.id)" data-testid="client-code" />
|
||||
<p class="field-hint">{{ t('admin.integrationConnector.fields.codeHint') }}</p>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('admin.integrationConnector.fields.connectorType')">
|
||||
<el-select v-model="clientForm.connector_type" data-testid="client-connector-type" @change="onConnectorTypeChange">
|
||||
<el-option v-for="opt in CONNECTOR_TYPE_OPTIONS" :key="opt.value" :value="opt.value" :label="t(opt.labelKey)" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="clientForm.connector_type === 'database'"
|
||||
:label="t('admin.integrationConnector.fields.dbKind')"
|
||||
>
|
||||
<!-- db_kind 专属四选一(D16):仅 database 类型显示;未选提交由 composable 校验拦截 -->
|
||||
<select v-model="clientForm.db_kind" class="input-field text-sm" data-testid="client-db-kind">
|
||||
<option value="">—</option>
|
||||
<option v-for="kind in DB_KIND_OPTIONS" :key="kind" :value="kind">{{ t(`admin.integrationConnector.connectorDbKind.${kind}`) }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.fields.environment') }}</label>
|
||||
<select v-model="clientForm.environment" class="input-field text-sm" data-testid="client-environment">
|
||||
<option v-for="env in ENVIRONMENT_OPTIONS" :key="env" :value="env">{{ t(`admin.integrationConnector.envLabels.${env}`) }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<el-select v-model="clientForm.db_kind" data-testid="client-db-kind">
|
||||
<el-option label="—" value="" />
|
||||
<el-option v-for="kind in DB_KIND_OPTIONS" :key="kind" :value="kind" :label="t(`admin.integrationConnector.connectorDbKind.${kind}`)" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('admin.integrationConnector.fields.environment')">
|
||||
<el-select v-model="clientForm.environment" data-testid="client-environment">
|
||||
<el-option v-for="env in ENVIRONMENT_OPTIONS" :key="env" :value="env" :label="t(`admin.integrationConnector.envLabels.${env}`)" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="space-y-4">
|
||||
<h4 class="text-xs font-bold uppercase tracking-wide text-muted">{{ t('admin.integrationConnector.sections.connection') }}</h4>
|
||||
<div class="form-section">
|
||||
<h4 class="section-title">{{ t('admin.integrationConnector.sections.connection') }}</h4>
|
||||
<!-- 连接地址:endpoint 合一字段;label 按连接器类型显示(REST=接口地址,SOAP=WSDL 地址,database=数据库连接串) -->
|
||||
<div class="space-y-1.5">
|
||||
<label class="label-field">{{ t(endpointLabelKey) }}</label>
|
||||
<input v-model="clientForm.endpoint" type="text" class="input-field text-sm" :placeholder="t(endpointPlaceholderKey)" data-testid="client-endpoint" />
|
||||
</div>
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<div class="space-y-1.5">
|
||||
<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>
|
||||
<el-form-item :label="t(endpointLabelKey)">
|
||||
<el-input v-model="clientForm.endpoint" :placeholder="t(endpointPlaceholderKey)" data-testid="client-endpoint" />
|
||||
</el-form-item>
|
||||
<div class="form-grid">
|
||||
<el-form-item :label="t('admin.integrationConnector.fields.timeout')">
|
||||
<el-input-number v-model="timeoutSecondsModel" :min="0" class="full-control" data-testid="client-timeout" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('admin.integrationConnector.fields.credentialRef')">
|
||||
<el-select v-model="clientForm.credential_ref_code" data-testid="client-credential-ref">
|
||||
<el-option :label="t('admin.integrationConnector.fields.credentialNone')" value="" />
|
||||
<el-option v-for="opt in credentialOptions || []" :key="opt.code" :value="opt.code" :label="opt.code" />
|
||||
</el-select>
|
||||
<p class="field-hint">{{ t('admin.integrationConnector.fields.credentialRefHint') }}</p>
|
||||
</el-form-item>
|
||||
</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>
|
||||
<details class="advanced-block">
|
||||
<summary class="advanced-summary">{{ t('admin.integrationConnector.sections.advanced') }}</summary>
|
||||
<div class="advanced-body">
|
||||
<p class="field-hint">{{ clientConfigHint }}</p>
|
||||
<JsonTextareaField
|
||||
v-model="clientForm.config_json"
|
||||
:label="t('admin.integrationConnector.fields.configJson')"
|
||||
@@ -379,147 +419,149 @@ onBeforeUnmount(() => document.removeEventListener('keydown', onKeydown));
|
||||
</details>
|
||||
</template>
|
||||
|
||||
<!-- 接口定义:编码自动建议 + 类型随客户端联动(只读徽章)+ 接口契约 JSON 常显 + 状态只读徽章 -->
|
||||
<!-- 接口定义:编码自动建议 + 类型随客户端联动(只读下拉)+ 接口契约 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>
|
||||
<div class="form-grid">
|
||||
<el-form-item :label="t('admin.integrationConnector.fields.name')">
|
||||
<el-input v-model="interfaceForm.name" data-testid="interface-name" @blur="onInterfaceNameBlur" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('admin.integrationConnector.fields.code')">
|
||||
<el-input v-model="interfaceForm.code" class="mono-input" :disabled="Boolean(interfaceForm.id)" data-testid="interface-code" />
|
||||
<p class="field-hint">{{ t('admin.integrationConnector.fields.codeHintInterface') }}</p>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('admin.integrationConnector.fields.clientInstance')">
|
||||
<el-select v-model="interfaceForm.client_instance_code" data-testid="interface-client" @change="onInterfaceClientChange">
|
||||
<el-option v-for="opt in clientOptions" :key="opt.code" :value="opt.code" :label="optionLabel(opt.name, opt.code)" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('admin.integrationConnector.fields.connectorType')">
|
||||
<!-- 与客户端实例同款下拉控件、仅禁用只读:类型随客户端实例自动确定(后端以其为单一事实源推导),不可单独修改 -->
|
||||
<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>
|
||||
<el-select :model-value="interfaceForm.connector_type" disabled data-testid="interface-connector-type">
|
||||
<el-option :value="interfaceForm.connector_type" :label="connectorTypeLabel(interfaceForm.connector_type)" />
|
||||
</el-select>
|
||||
<p class="field-hint">{{ t('admin.integrationConnector.fields.connectorTypeHint') }}</p>
|
||||
</el-form-item>
|
||||
</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 v-if="interfaceForm.connector_type === 'rest'" class="form-grid">
|
||||
<el-form-item :label="t('admin.integrationConnector.fields.httpMethod')">
|
||||
<el-select v-model="interfaceForm.http_method">
|
||||
<el-option label="—" value="" />
|
||||
<el-option label="GET" value="GET" />
|
||||
<el-option label="POST" value="POST" />
|
||||
<el-option label="PUT" value="PUT" />
|
||||
<el-option label="DELETE" value="DELETE" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('admin.integrationConnector.fields.requestPath')">
|
||||
<el-input v-model="interfaceForm.request_path" class="mono-input" :placeholder="t('admin.integrationConnector.placeholders.requestPath')" />
|
||||
</el-form-item>
|
||||
</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>
|
||||
<div class="form-section">
|
||||
<h4 class="section-title">{{ 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>
|
||||
|
||||
<!-- 绑定:接口为有序步骤编辑器(client 由各步接口归属自带);状态为只读徽章(发布/退役走列表生命周期按钮) -->
|
||||
<template v-else-if="activeEntity === 'binding'">
|
||||
<div class="grid grid-cols-1 gap-4 md:grid-cols-2">
|
||||
<div class="space-y-1.5">
|
||||
<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.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 class="form-grid">
|
||||
<el-form-item :label="t('admin.integrationConnector.fields.capability')">
|
||||
<el-select v-model="bindingForm.capability">
|
||||
<el-option v-for="cap in capabilityOptions" :key="cap.name" :value="cap.name" :label="capabilityOptionLabel(cap.name)" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('admin.integrationConnector.fields.environment')">
|
||||
<el-select v-model="bindingForm.environment">
|
||||
<el-option v-for="env in ENVIRONMENT_OPTIONS" :key="env" :value="env" :label="t(`admin.integrationConnector.envLabels.${env}`)" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('admin.integrationConnector.fields.mappingVersion')">
|
||||
<el-input-number
|
||||
:model-value="bindingForm.mapping_version"
|
||||
class="full-control"
|
||||
@update:model-value="setMappingVersion"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('admin.integrationConnector.fields.priority')">
|
||||
<el-input-number
|
||||
:model-value="bindingForm.priority"
|
||||
class="full-control"
|
||||
@update:model-value="setPriority"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('admin.integrationConnector.fields.effectiveFrom')">
|
||||
<el-date-picker
|
||||
:model-value="bindingForm.effective_from || undefined"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DD[T]HH:mm"
|
||||
:placeholder="t('admin.integrationConnector.fields.effectiveFrom')"
|
||||
class="full-control"
|
||||
@update:model-value="setEffectiveFrom"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('admin.integrationConnector.fields.effectiveTo')">
|
||||
<el-date-picker
|
||||
:model-value="bindingForm.effective_to || undefined"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DD[T]HH:mm"
|
||||
:placeholder="t('admin.integrationConnector.fields.effectiveTo')"
|
||||
class="full-control"
|
||||
@update:model-value="setEffectiveTo"
|
||||
/>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<!-- 有序步骤编辑器:提交时以 steps_json([{interface_code, param_mapping_json}])发送,
|
||||
调用期按数组顺序执行;client 由各步接口归属自带 → 每步只读提示,不再单独维护 -->
|
||||
<div class="space-y-3">
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<h4 class="text-xs font-bold uppercase tracking-wide text-muted">{{ t('admin.integrationConnector.bindingSteps.label') }}</h4>
|
||||
<button type="button" class="btn-ghost text-xs" data-testid="binding-add-step" @click="addBindingStep">
|
||||
+ {{ t('admin.integrationConnector.bindingSteps.add') }}
|
||||
</button>
|
||||
<div class="form-section">
|
||||
<div class="steps-head">
|
||||
<h4 class="section-title">{{ t('admin.integrationConnector.bindingSteps.label') }}</h4>
|
||||
<el-button :icon="Plus" size="small" data-testid="binding-add-step" @click="addBindingStep">
|
||||
{{ t('admin.integrationConnector.bindingSteps.add') }}
|
||||
</el-button>
|
||||
</div>
|
||||
<p class="text-xs text-muted">{{ t('admin.integrationConnector.bindingSteps.hint') }}</p>
|
||||
<p class="field-hint">{{ t('admin.integrationConnector.bindingSteps.hint') }}</p>
|
||||
<div
|
||||
v-for="(step, index) in bindingForm.steps"
|
||||
:key="index"
|
||||
class="space-y-2 rounded-lg border border-slate-200 px-3 py-2.5"
|
||||
class="step-row"
|
||||
data-testid="binding-step-row"
|
||||
>
|
||||
<div class="flex items-end gap-2">
|
||||
<span class="pb-2 text-xs font-bold text-muted">{{ index + 1 }}</span>
|
||||
<div class="flex-1 space-y-1.5">
|
||||
<label class="label-field">{{ t('admin.integrationConnector.bindingSteps.interface') }}</label>
|
||||
<select v-model="step.interface_code" class="input-field text-sm" :data-testid="`binding-step-interface-${index}`">
|
||||
<option value="">—</option>
|
||||
<option v-for="opt in interfaceOptions" :key="opt.code" :value="opt.code">{{ optionLabel(opt.name, opt.code) }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-ghost text-xs"
|
||||
<div class="step-line">
|
||||
<span class="step-index">{{ index + 1 }}</span>
|
||||
<el-form-item class="step-interface" :label="t('admin.integrationConnector.bindingSteps.interface')">
|
||||
<el-select v-model="step.interface_code" :data-testid="`binding-step-interface-${index}`">
|
||||
<el-option label="—" value="" />
|
||||
<el-option v-for="opt in interfaceOptions" :key="opt.code" :value="opt.code" :label="optionLabel(opt.name, opt.code)" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-button
|
||||
:icon="ArrowUp"
|
||||
:disabled="index === 0"
|
||||
:title="t('admin.integrationConnector.bindingSteps.moveUp')"
|
||||
:data-testid="`binding-step-up-${index}`"
|
||||
@click="moveBindingStep(index, -1)"
|
||||
>↑</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-ghost text-xs"
|
||||
/>
|
||||
<el-button
|
||||
:icon="ArrowDown"
|
||||
:disabled="index === bindingForm.steps.length - 1"
|
||||
:title="t('admin.integrationConnector.bindingSteps.moveDown')"
|
||||
:data-testid="`binding-step-down-${index}`"
|
||||
@click="moveBindingStep(index, 1)"
|
||||
>↓</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-ghost text-xs"
|
||||
/>
|
||||
<el-button
|
||||
type="danger"
|
||||
:icon="CircleClose"
|
||||
:title="t('admin.integrationConnector.bindingSteps.remove')"
|
||||
:data-testid="`binding-step-remove-${index}`"
|
||||
@click="removeBindingStep(index)"
|
||||
>✕</button>
|
||||
/>
|
||||
</div>
|
||||
<p v-if="bindingStepClientHint(index)" class="text-xs text-muted" :data-testid="`binding-step-client-${index}`">
|
||||
<p v-if="bindingStepClientHint(index)" class="field-hint" :data-testid="`binding-step-client-${index}`">
|
||||
{{ bindingStepClientHint(index) }}
|
||||
</p>
|
||||
<JsonTextareaField
|
||||
@@ -528,141 +570,300 @@ onBeforeUnmount(() => document.removeEventListener('keydown', onKeydown));
|
||||
/>
|
||||
</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">
|
||||
<details class="advanced-block">
|
||||
<summary class="advanced-summary">{{ t('admin.integrationConnector.advancedConfig') }}</summary>
|
||||
<div class="advanced-body">
|
||||
<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>
|
||||
<p class="field-hint">{{ t('admin.integrationConnector.fields.contextSelectorHint') }}</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>
|
||||
<div class="form-section">
|
||||
<h4 class="section-title">{{ t('admin.integrationConnector.sections.basic') }}</h4>
|
||||
<div class="form-grid">
|
||||
<el-form-item :label="t('admin.integrationConnector.fields.code')">
|
||||
<el-input v-model="credentialForm.code" class="mono-input" :disabled="isCredentialEdit" data-testid="credential-code" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('admin.integrationConnector.fields.secretProvider')">
|
||||
<!-- 编辑态禁用: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>
|
||||
<el-select v-model="credentialForm.secret_provider" :disabled="isCredentialEdit" data-testid="credential-provider">
|
||||
<el-option value="db" :label="credentialProviderLabel('db')" />
|
||||
<el-option value="env" :label="credentialProviderLabel('env')" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('admin.integrationConnector.fields.credentialType')">
|
||||
<!-- 编辑态禁用:类型决定密文字段结构,中途改类型会使存量密文失效,变更须新建引用 -->
|
||||
<select
|
||||
<el-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>
|
||||
<el-option v-for="spec in credentialTypeOptions" :key="spec.type" :value="spec.type" :label="credentialTypeLabel(spec.type)" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<p v-if="isCredentialEdit" class="text-xs text-muted">{{ t('admin.integrationConnector.formHints.credentialImmutable') }}</p>
|
||||
<p v-if="isCredentialEdit" class="field-hint">{{ 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>
|
||||
<div class="form-section">
|
||||
<h4 class="section-title">{{ 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
|
||||
<div v-if="credentialTypeSpec" class="form-grid">
|
||||
<el-form-item v-for="field in credentialTypeSpec.fields" :key="field.key" :label="credentialFieldLabel(field.key)">
|
||||
<el-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>
|
||||
<span v-if="!field.secret" class="field-hint">({{ t('admin.integrationConnector.fields.visibleField') }})</span>
|
||||
</el-form-item>
|
||||
</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>
|
||||
<div v-if="credentialPlaceholderKeys.length" class="placeholder-row">
|
||||
<span class="field-hint">{{ 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"
|
||||
class="placeholder-chip"
|
||||
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>
|
||||
<el-form-item v-else :label="t('admin.integrationConnector.fields.secretRef')">
|
||||
<el-input v-model="credentialForm.secret_ref" data-testid="credential-secret-ref" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
<div class="admin-modal-footer">
|
||||
</el-form>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="drawer-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"
|
||||
<div v-if="activeEntity === 'client'" class="footer-left" data-testid="client-enabled-row">
|
||||
<el-switch
|
||||
v-model="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>
|
||||
/>
|
||||
<span class="footer-label">{{ t('admin.integrationConnector.fields.enabled') }}</span>
|
||||
<span class="footer-hint">{{ 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"
|
||||
<div v-else-if="activeEntity === 'credential'" class="footer-left" data-testid="credential-enabled-row">
|
||||
<el-switch
|
||||
:model-value="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>
|
||||
@change="toggleCredentialEnabled"
|
||||
/>
|
||||
<span class="footer-label">{{ t('admin.integrationConnector.fields.enabled') }}</span>
|
||||
<span class="footer-hint">{{ 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"
|
||||
<div v-else-if="activeEntity === 'interface' || activeEntity === 'binding'" class="footer-left" data-testid="lifecycle-status-row">
|
||||
<span class="footer-hint">{{ t('admin.integrationConnector.fields.status') }}</span>
|
||||
<el-tag
|
||||
:type="lifecycleStatus === 'published' ? 'success' : 'info'"
|
||||
size="small"
|
||||
class="lifecycle-chip"
|
||||
:title="t('admin.integrationConnector.fields.statusHint')"
|
||||
data-testid="lifecycle-status-chip"
|
||||
>
|
||||
<span class="h-1.5 w-1.5 rounded-full bg-current" />
|
||||
<span class="chip-dot" />
|
||||
{{ statusLabel(lifecycleStatus) }}
|
||||
</span>
|
||||
</el-tag>
|
||||
</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')">
|
||||
<span class="footer-spacer" />
|
||||
<el-button :disabled="isSaving" @click="requestClose">{{ t('admin.cancel') }}</el-button>
|
||||
<el-button type="primary" :loading="isSaving" :disabled="isSaving" @click="emit('save')">
|
||||
{{ isSaving ? t('admin.save') + '...' : t('admin.save') }}
|
||||
</button>
|
||||
</el-button>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
</template>
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.drawer-body {
|
||||
display: grid;
|
||||
gap: 16px;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
|
||||
.drawer-hint {
|
||||
margin: 0;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* 分区标题:与在途调拨类型页同款(上分隔线 + 加粗小标题) */
|
||||
.section-title {
|
||||
margin: 8px 0 12px;
|
||||
border-top: 1px solid var(--el-border-color-lighter);
|
||||
padding-top: 12px;
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.form-section {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.form-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 0 16px;
|
||||
}
|
||||
|
||||
/* EP 控件在表单网格内占满整格 */
|
||||
.form-grid :deep(.el-select),
|
||||
.form-grid :deep(.el-input-number),
|
||||
.form-grid :deep(.el-date-editor),
|
||||
.el-form-item :deep(.el-select) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.full-control {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.mono-input :deep(.el-input__inner) {
|
||||
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
|
||||
}
|
||||
|
||||
.field-hint {
|
||||
margin: 2px 0 0;
|
||||
width: 100%;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
/* 高级配置折叠块:原生 details 语义保留,视觉走 EP 中性 token */
|
||||
.advanced-block {
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: 8px;
|
||||
padding: 8px 12px;
|
||||
}
|
||||
|
||||
.advanced-summary {
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.advanced-body {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
/* 有序步骤编辑器 */
|
||||
.steps-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.steps-head .section-title {
|
||||
border-top: none;
|
||||
margin: 0;
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.step-row {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: 8px;
|
||||
padding: 10px 12px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.step-line {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.step-index {
|
||||
padding-top: 30px;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.step-interface {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.placeholder-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.placeholder-chip {
|
||||
border-radius: 5px;
|
||||
background: var(--el-fill-color-light);
|
||||
color: var(--el-text-color-regular);
|
||||
padding: 2px 6px;
|
||||
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* 抽屉底部操作区:左侧业务开关/状态徽章 + 右侧取消/保存 */
|
||||
.drawer-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.footer-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.footer-label {
|
||||
white-space: nowrap;
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.footer-hint {
|
||||
white-space: nowrap;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.footer-spacer {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.lifecycle-chip .chip-dot {
|
||||
display: inline-block;
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background: currentColor;
|
||||
margin-right: 4px;
|
||||
}
|
||||
</style>
|
||||
+54
-14
@@ -2,14 +2,19 @@
|
||||
features/admin/modules/integration-connector/components/JsonTextareaField.vue
|
||||
用途:JSON 配置字段统一编辑器——全宽等宽 textarea + 格式化按钮 + 失焦即时校验,
|
||||
供本模块四实体表单(请求模板/Schema/映射/连接配置/上下文选择器)复用。
|
||||
依赖:useI18n。
|
||||
依赖:element-plus(textarea 输入与链接按钮,沿用管理端 element-trial 主题)、useI18n。
|
||||
逻辑:v-model 承载 JSON 文本(由父级表单 state 持有);失焦时校验,非法显示红字
|
||||
提示;「格式化」仅在合法 JSON 时 pretty-print 改写,非法时只提示不改写内容。
|
||||
空值视为合法(与保存链路 parseJsonField 的「空串返回 {}」一致)。
|
||||
视觉层已迁移 Element Plus(element-trial 主题),布局间距由 AdminLayout 壳层持有。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElButton, ElInput } from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
|
||||
const props = defineProps<{
|
||||
/** 字段标签,同时用于错误提示中的字段名。 */
|
||||
@@ -52,31 +57,66 @@ function format() {
|
||||
</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"
|
||||
<div class="json-field">
|
||||
<div class="json-field-head">
|
||||
<label class="json-field-label">{{ label }}</label>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
:disabled="!modelValue.trim()"
|
||||
data-testid="json-format-button"
|
||||
@click="format"
|
||||
>
|
||||
{{ t('admin.integrationConnector.formatJson') }}
|
||||
</button>
|
||||
</el-button>
|
||||
</div>
|
||||
<textarea
|
||||
:value="modelValue"
|
||||
rows="12"
|
||||
class="input-field text-sm font-mono leading-5"
|
||||
<el-input
|
||||
:model-value="modelValue"
|
||||
type="textarea"
|
||||
:rows="12"
|
||||
spellcheck="false"
|
||||
:placeholder="placeholder"
|
||||
class="json-field-textarea"
|
||||
data-testid="json-textarea"
|
||||
@input="emit('update:modelValue', ($event.target as HTMLTextAreaElement).value)"
|
||||
@update:model-value="emit('update:modelValue', $event)"
|
||||
@blur="onBlur"
|
||||
/>
|
||||
<p v-if="touched && !isValid" class="text-xs text-red-600" data-testid="json-error">
|
||||
<p v-if="touched && !isValid" class="json-field-error" data-testid="json-error">
|
||||
{{ t('admin.integrationConnector.invalidJsonHint') }}
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.json-field {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.json-field-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.json-field-label {
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
/* 等宽字体保留:JSON 契约字段的阅读与编辑都依赖等宽对齐 */
|
||||
.json-field-textarea :deep(.el-textarea__inner) {
|
||||
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
|
||||
font-size: 13px;
|
||||
line-height: 1.45;
|
||||
}
|
||||
|
||||
.json-field-error {
|
||||
margin: 0;
|
||||
color: var(--el-color-danger);
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
@@ -1,14 +1,34 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-audit/ShippingAuditCenterPage.vue
|
||||
用途:管理员货代统一审计中心——按 Conversation/Run/Candidate/Task/Gate/节点分组筛选、详情 Diff、关联链、哈希校验、受控导出。
|
||||
依赖:shipping-audit.api、shippingAuditDisplay、ShippingAuditEventDetailDrawer、Vue I18n、BusinessError、useMessage。
|
||||
依赖:element-plus(工具栏/筛选面板/提示横幅/时间线/分页,沿用管理端 element-trial 主题)、
|
||||
@element-plus/icons-vue、shipping-audit.api、shippingAuditDisplay、
|
||||
ShippingAuditEventDetailDrawer(el-drawer 版)、BusinessError、useMessage、Vue I18n。
|
||||
逻辑:列表不含快照全文;详情抽屉按权限脱敏;导出/校验写服务端访问审计;
|
||||
事件分组含复核/对话/Process Gate/资格/节点;支持 candidate_no / gate_code;
|
||||
窄屏用卡片列表;桌面表无横滚,Case/Task 在业务关联列,WF/Item/Run 芯片可复制。
|
||||
EP 迁移:按钮/筛选控件/横幅/空态/加载迁移为 el-button / el-input / el-select / el-date-picker /
|
||||
el-alert / el-empty / el-skeleton,审计事件列表迁移为 el-timeline(窄屏/桌面双容器保留
|
||||
原响应式断点与全部 data-testid 契约);业务脚本(筛选/关联链/哈希校验/导出)零改动。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import {
|
||||
ElAlert,
|
||||
ElButton,
|
||||
ElDatePicker,
|
||||
ElEmpty,
|
||||
ElInput,
|
||||
ElOption,
|
||||
ElSelect,
|
||||
ElSkeleton,
|
||||
ElTimeline,
|
||||
ElTimelineItem,
|
||||
} from 'element-plus';
|
||||
import { Refresh, Search } from '@element-plus/icons-vue';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import {
|
||||
@@ -264,304 +284,347 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="space-y-5 p-5 md:p-7" data-testid="shipping-audit-center">
|
||||
<header class="flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-start sm:justify-between">
|
||||
<div class="min-w-0">
|
||||
<h1 class="section-title">{{ t('admin.shippingAudit.title') }}</h1>
|
||||
<p class="section-desc mt-1 max-w-3xl">{{ t('admin.shippingAudit.subtitle') }}</p>
|
||||
<section class="shipping-audit-page" data-testid="shipping-audit-center">
|
||||
<header class="page-header">
|
||||
<div class="page-heading-copy">
|
||||
<h1>{{ t('admin.shippingAudit.title') }}</h1>
|
||||
<!-- 段落行宽限制(原 max-w-3xl)保留,页面根限宽/内边距由壳层持有 -->
|
||||
<p class="page-desc">{{ t('admin.shippingAudit.subtitle') }}</p>
|
||||
</div>
|
||||
<!-- [STEP] 窄屏主操作:刷新/导出;校验与关联链收入“更多”。 -->
|
||||
<div class="flex w-full flex-wrap items-center gap-2 sm:w-auto sm:justify-end">
|
||||
<button type="button" class="btn-secondary btn-sm" :disabled="loading" data-testid="shipping-audit-refresh" @click="load">
|
||||
<div class="page-actions">
|
||||
<el-button
|
||||
size="small"
|
||||
:icon="Refresh"
|
||||
:loading="loading"
|
||||
data-testid="shipping-audit-refresh"
|
||||
@click="load"
|
||||
>
|
||||
{{ t('admin.shippingAudit.refresh') }}
|
||||
</button>
|
||||
<button type="button" class="btn-secondary btn-sm" :disabled="exporting" data-testid="shipping-audit-export" @click="exportCsv">
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
:loading="exporting"
|
||||
:disabled="exporting"
|
||||
data-testid="shipping-audit-export"
|
||||
@click="exportCsv"
|
||||
>
|
||||
{{ exporting ? t('admin.shippingAudit.exporting') : t('admin.shippingAudit.export') }}
|
||||
</button>
|
||||
<div class="relative">
|
||||
<button
|
||||
type="button"
|
||||
class="btn-secondary btn-sm md:hidden"
|
||||
</el-button>
|
||||
<div class="more-wrap">
|
||||
<el-button
|
||||
size="small"
|
||||
class="more-toggle"
|
||||
data-testid="shipping-audit-more"
|
||||
@click="moreOpen = !moreOpen"
|
||||
>
|
||||
{{ t('admin.shippingAudit.moreActions') }}
|
||||
</button>
|
||||
<div
|
||||
class="absolute right-0 z-10 mt-1 w-44 rounded-lg border border-default bg-surface p-1 shadow-md md:static md:mt-0 md:flex md:w-auto md:items-center md:gap-2 md:border-0 md:bg-transparent md:p-0 md:shadow-none"
|
||||
:class="moreOpen ? 'block' : 'hidden md:flex'"
|
||||
>
|
||||
<button type="button" class="btn-secondary btn-sm w-full justify-start md:w-auto" :disabled="verifying" @click="runHashVerify">
|
||||
</el-button>
|
||||
<div class="more-panel" :class="{ 'more-panel--open': moreOpen }">
|
||||
<el-button size="small" :loading="verifying" :disabled="verifying" @click="runHashVerify">
|
||||
{{ verifying ? t('admin.shippingAudit.verifying') : t('admin.shippingAudit.verifyChain') }}
|
||||
</button>
|
||||
<button type="button" class="btn-secondary btn-sm w-full justify-start md:w-auto" @click="loadAssociationChain">
|
||||
</el-button>
|
||||
<el-button size="small" @click="loadAssociationChain">
|
||||
{{ t('admin.shippingAudit.loadChain') }}
|
||||
</button>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="grid gap-3 rounded-xl border border-default bg-surface p-3 md:grid-cols-3 lg:grid-cols-4">
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<div class="filters-panel">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.workflowId') }}</span>
|
||||
<input v-model="filters.workflow_id" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
<el-input v-model="filters.workflow_id" @keyup.enter="applyFilters" />
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.workflowItemId') }}</span>
|
||||
<input v-model="filters.workflow_item_id" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
<el-input v-model="filters.workflow_item_id" @keyup.enter="applyFilters" />
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.runNo') }}</span>
|
||||
<input v-model="filters.run_no" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
<el-input v-model="filters.run_no" @keyup.enter="applyFilters" />
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.documentId') }}</span>
|
||||
<input v-model="filters.document_id" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
<el-input v-model="filters.document_id" @keyup.enter="applyFilters" />
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.reviewCaseNo') }}</span>
|
||||
<input v-model="filters.review_case_no" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
<el-input v-model="filters.review_case_no" @keyup.enter="applyFilters" />
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.taskNo') }}</span>
|
||||
<input v-model="filters.task_no" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
<el-input v-model="filters.task_no" @keyup.enter="applyFilters" />
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.candidateNo') }}</span>
|
||||
<input
|
||||
<el-input
|
||||
v-model="filters.candidate_no"
|
||||
class="input-field text-sm"
|
||||
data-testid="shipping-audit-filter-candidate-no"
|
||||
@keyup.enter="applyFilters"
|
||||
>
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.gateCode') }}</span>
|
||||
<input
|
||||
<el-input
|
||||
v-model="filters.gate_code"
|
||||
class="input-field text-sm"
|
||||
data-testid="shipping-audit-filter-gate-code"
|
||||
@keyup.enter="applyFilters"
|
||||
>
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.actorType') }}</span>
|
||||
<select v-model="filters.actor_type" class="select-field text-sm" @change="applyFilters">
|
||||
<option value="">{{ t('admin.shippingAudit.filters.all') }}</option>
|
||||
<option value="user">{{ t('admin.shippingAudit.labels.actorTypes.user') }}</option>
|
||||
<option value="admin">{{ t('admin.shippingAudit.labels.actorTypes.admin') }}</option>
|
||||
<option value="system">{{ t('admin.shippingAudit.labels.actorTypes.system') }}</option>
|
||||
<option value="rpa">{{ t('admin.shippingAudit.labels.actorTypes.rpa') }}</option>
|
||||
</select>
|
||||
<el-select v-model="filters.actor_type" @change="applyFilters">
|
||||
<el-option :label="t('admin.shippingAudit.filters.all')" value="" />
|
||||
<el-option :label="t('admin.shippingAudit.labels.actorTypes.user')" value="user" />
|
||||
<el-option :label="t('admin.shippingAudit.labels.actorTypes.admin')" value="admin" />
|
||||
<el-option :label="t('admin.shippingAudit.labels.actorTypes.system')" value="system" />
|
||||
<el-option :label="t('admin.shippingAudit.labels.actorTypes.rpa')" value="rpa" />
|
||||
</el-select>
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.actorId') }}</span>
|
||||
<input v-model="filters.actor_id" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
<el-input v-model="filters.actor_id" @keyup.enter="applyFilters" />
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.eventTypeGroup') }}</span>
|
||||
<select
|
||||
<el-select
|
||||
v-model="filters.event_type_group"
|
||||
class="select-field text-sm"
|
||||
data-testid="shipping-audit-filter-event-type-group"
|
||||
@change="applyFilters"
|
||||
>
|
||||
<option value="">{{ t('admin.shippingAudit.filters.all') }}</option>
|
||||
<option value="review_workbench">{{ t('admin.shippingAudit.filters.eventTypeGroupReviewWorkbench') }}</option>
|
||||
<option value="formal_task_edit">{{ t('admin.shippingAudit.filters.eventTypeGroupFormalTaskEdit') }}</option>
|
||||
<option value="chat_workbench">{{ t('admin.shippingAudit.filters.eventTypeGroupChatWorkbench') }}</option>
|
||||
<option value="process_gate">{{ t('admin.shippingAudit.filters.eventTypeGroupProcessGate') }}</option>
|
||||
<option value="candidate_qualification">{{ t('admin.shippingAudit.filters.eventTypeGroupQualification') }}</option>
|
||||
<option value="workflow_node">{{ t('admin.shippingAudit.filters.eventTypeGroupWorkflowNode') }}</option>
|
||||
<option value="xfa_visual">{{ t('admin.shippingAudit.filters.eventTypeGroupXfaVisual') }}</option>
|
||||
<option value="xfa_split">{{ t('admin.shippingAudit.filters.eventTypeGroupXfaSplit') }}</option>
|
||||
<option value="xfa_unified">{{ t('admin.shippingAudit.filters.eventTypeGroupXfaUnified') }}</option>
|
||||
</select>
|
||||
<el-option :label="t('admin.shippingAudit.filters.all')" value="" />
|
||||
<el-option :label="t('admin.shippingAudit.filters.eventTypeGroupReviewWorkbench')" value="review_workbench" />
|
||||
<el-option :label="t('admin.shippingAudit.filters.eventTypeGroupFormalTaskEdit')" value="formal_task_edit" />
|
||||
<el-option :label="t('admin.shippingAudit.filters.eventTypeGroupChatWorkbench')" value="chat_workbench" />
|
||||
<el-option :label="t('admin.shippingAudit.filters.eventTypeGroupProcessGate')" value="process_gate" />
|
||||
<el-option :label="t('admin.shippingAudit.filters.eventTypeGroupQualification')" value="candidate_qualification" />
|
||||
<el-option :label="t('admin.shippingAudit.filters.eventTypeGroupWorkflowNode')" value="workflow_node" />
|
||||
<el-option :label="t('admin.shippingAudit.filters.eventTypeGroupXfaVisual')" value="xfa_visual" />
|
||||
<el-option :label="t('admin.shippingAudit.filters.eventTypeGroupXfaSplit')" value="xfa_split" />
|
||||
<el-option :label="t('admin.shippingAudit.filters.eventTypeGroupXfaUnified')" value="xfa_unified" />
|
||||
</el-select>
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.profileId') }}</span>
|
||||
<input
|
||||
<el-input
|
||||
v-model="filters.profile_id"
|
||||
class="input-field text-sm"
|
||||
data-testid="shipping-audit-filter-profile-id"
|
||||
@keyup.enter="applyFilters"
|
||||
>
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.bindingId') }}</span>
|
||||
<input
|
||||
<el-input
|
||||
v-model="filters.binding_id"
|
||||
class="input-field text-sm"
|
||||
data-testid="shipping-audit-filter-binding-id"
|
||||
@keyup.enter="applyFilters"
|
||||
>
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.eventType') }}</span>
|
||||
<input v-model="filters.event_type" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
<el-input v-model="filters.event_type" @keyup.enter="applyFilters" />
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.reasonCode') }}</span>
|
||||
<input v-model="filters.reason_code" class="input-field text-sm" data-testid="shipping-audit-filter-reason-code" @keyup.enter="applyFilters">
|
||||
<el-input
|
||||
v-model="filters.reason_code"
|
||||
data-testid="shipping-audit-filter-reason-code"
|
||||
@keyup.enter="applyFilters"
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.result') }}</span>
|
||||
<input v-model="filters.result" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
<el-input v-model="filters.result" @keyup.enter="applyFilters" />
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.createdFrom') }}</span>
|
||||
<input v-model="filters.created_from" type="datetime-local" class="input-field text-sm" @change="applyFilters">
|
||||
<!-- value-format 保持字符串契约,normalizeDateTimeFilter 逻辑不变 -->
|
||||
<el-date-picker
|
||||
v-model="filters.created_from"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DDTHH:mm"
|
||||
@change="applyFilters"
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.createdTo') }}</span>
|
||||
<input v-model="filters.created_to" type="datetime-local" class="input-field text-sm" @change="applyFilters">
|
||||
<el-date-picker
|
||||
v-model="filters.created_to"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DDTHH:mm"
|
||||
@change="applyFilters"
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary md:col-span-2 lg:col-span-1">
|
||||
<label class="filter-field filter-field--wide">
|
||||
<span>{{ t('admin.shippingAudit.filters.q') }}</span>
|
||||
<div class="flex gap-2">
|
||||
<input v-model="filters.q" class="input-field text-sm flex-1" @keyup.enter="applyFilters">
|
||||
<button type="button" class="btn-secondary btn-sm" @click="applyFilters">{{ t('admin.shippingAudit.apply') }}</button>
|
||||
<div class="filter-q-row">
|
||||
<el-input
|
||||
v-model="filters.q"
|
||||
:prefix-icon="Search"
|
||||
clearable
|
||||
@keyup.enter="applyFilters"
|
||||
@clear="applyFilters"
|
||||
/>
|
||||
<el-button size="small" @click="applyFilters">{{ t('admin.shippingAudit.apply') }}</el-button>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<p v-if="chainHint" class="rounded-lg border border-default bg-surface-soft px-3 py-2 text-xs text-secondary">{{ chainHint }}</p>
|
||||
<p
|
||||
<el-alert v-if="chainHint" type="info" :closable="false" :title="chainHint" />
|
||||
<el-alert
|
||||
v-if="verifyResult"
|
||||
class="rounded-lg border border-default bg-surface-soft px-3 py-2 text-xs text-secondary"
|
||||
data-testid="shipping-audit-verify-result"
|
||||
>
|
||||
{{ t('admin.shippingAudit.verifySummary', {
|
||||
type="info"
|
||||
:closable="false"
|
||||
:title="t('admin.shippingAudit.verifySummary', {
|
||||
ok: verifyResult.ok ? t('admin.shippingAudit.verifyOk') : t('admin.shippingAudit.verifyFailedShort'),
|
||||
checked: verifyResult.checked_chains,
|
||||
failed: verifyResult.failed_chains,
|
||||
}) }}
|
||||
</p>
|
||||
<p v-if="error" class="rounded-lg border border-rose-200 bg-rose-50 p-3 text-sm text-rose-700">{{ error }}</p>
|
||||
})"
|
||||
data-testid="shipping-audit-verify-result"
|
||||
/>
|
||||
<el-alert v-if="error" type="error" :closable="false" :title="error" />
|
||||
|
||||
<!-- 窄屏卡片列表:避免 1360px 表强制横向滚动才能点到 Diff -->
|
||||
<div class="space-y-3 lg:hidden" data-testid="shipping-audit-card-list">
|
||||
<p v-if="loading" class="rounded-xl border border-default bg-surface px-3 py-8 text-center text-sm text-muted">
|
||||
{{ t('admin.shippingAudit.loading') }}
|
||||
</p>
|
||||
<p v-else-if="!rows.length" class="rounded-xl border border-default bg-surface px-3 py-8 text-center text-sm text-muted">
|
||||
{{ t('admin.shippingAudit.empty') }}
|
||||
</p>
|
||||
<article
|
||||
v-for="row in rows"
|
||||
:key="row.id"
|
||||
class="rounded-xl border border-default bg-surface p-3"
|
||||
>
|
||||
<div class="flex items-start justify-between gap-2">
|
||||
<div class="min-w-0">
|
||||
<div class="text-sm font-medium text-secondary">{{ businessLabel('eventTypes', row.event_type) }}</div>
|
||||
<div class="mt-0.5 text-xs text-muted">{{ businessLabel('actions', row.action) }}</div>
|
||||
</div>
|
||||
<button type="button" class="shrink-0 text-sm text-brand-600 hover:underline" @click="openDetail(row.id)">
|
||||
{{ t('admin.shippingAudit.diff') }}
|
||||
</button>
|
||||
</div>
|
||||
<dl class="mt-2 grid gap-1 text-xs text-secondary">
|
||||
<div><dt class="inline text-muted">{{ t('admin.shippingAudit.columns.time') }}:</dt><dd class="inline">{{ formatTime(row.created_at) }}</dd></div>
|
||||
<div><dt class="inline text-muted">{{ t('admin.shippingAudit.columns.actor') }}:</dt><dd class="inline">{{ businessLabel('actorTypes', row.actor_type) }}</dd></div>
|
||||
<div><dt class="inline text-muted">{{ t('admin.shippingAudit.columns.reasonCode') }}:</dt><dd class="inline font-medium">{{ businessLabel('reasonCodes', row.reason_code) }}</dd></div>
|
||||
<div><dt class="inline text-muted">{{ t('admin.shippingAudit.columns.result') }}:</dt><dd class="inline">{{ businessLabel('results', row.result) }}</dd></div>
|
||||
<div v-if="primaryBusinessRefs(row) !== '—'">
|
||||
<dt class="inline text-muted">{{ t('admin.shippingAudit.columns.businessRefs') }}:</dt>
|
||||
<dd class="inline">{{ primaryBusinessRefs(row) }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<div
|
||||
v-if="techRefChips(row).length"
|
||||
class="mt-2 flex flex-wrap items-center gap-1.5"
|
||||
data-testid="shipping-audit-tech-ref-chips"
|
||||
<div class="audit-panel audit-panel--mobile" data-testid="shipping-audit-card-list">
|
||||
<el-skeleton v-if="loading" :rows="5" animated />
|
||||
<el-empty
|
||||
v-else-if="!rows.length"
|
||||
:description="t('admin.shippingAudit.empty')"
|
||||
:image-size="60"
|
||||
/>
|
||||
<el-timeline v-else class="audit-timeline">
|
||||
<el-timeline-item
|
||||
v-for="row in rows"
|
||||
:key="row.id"
|
||||
:timestamp="formatTime(row.created_at)"
|
||||
placement="top"
|
||||
>
|
||||
<span class="text-[10px] text-muted">{{ t('admin.shippingAudit.techRefs') }}</span>
|
||||
<button
|
||||
v-for="item in techRefChips(row)"
|
||||
:key="`${row.id}-m-tech-${item.label}`"
|
||||
type="button"
|
||||
class="rounded border border-default px-2 py-1 font-mono text-[11px] text-muted"
|
||||
:title="item.value"
|
||||
@click="copyTechId(item.value)"
|
||||
>
|
||||
{{ item.label }}
|
||||
</button>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
<!-- 桌面表:table-fixed + 无横滚;技术编号行内次要芯片,无需额外展开 -->
|
||||
<div class="hidden overflow-x-hidden rounded-xl border border-default bg-surface lg:block" data-testid="shipping-audit-desktop-table">
|
||||
<table class="w-full table-fixed text-left text-sm">
|
||||
<thead class="border-b border-default bg-surface-soft text-xs text-muted">
|
||||
<tr>
|
||||
<th class="w-[16%] px-3 py-2">{{ t('admin.shippingAudit.columns.time') }}</th>
|
||||
<th class="w-[20%] px-3 py-2">{{ t('admin.shippingAudit.columns.event') }}</th>
|
||||
<th class="w-[10%] px-3 py-2">{{ t('admin.shippingAudit.columns.actor') }}</th>
|
||||
<th class="w-[18%] px-3 py-2">{{ t('admin.shippingAudit.columns.reasonCode') }}</th>
|
||||
<th class="w-[10%] px-3 py-2">{{ t('admin.shippingAudit.columns.result') }}</th>
|
||||
<th class="w-[16%] px-3 py-2">{{ t('admin.shippingAudit.columns.businessRefs') }}</th>
|
||||
<th class="w-[10%] px-3 py-2"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-if="loading">
|
||||
<td colspan="7" class="px-3 py-8 text-center text-muted">{{ t('admin.shippingAudit.loading') }}</td>
|
||||
</tr>
|
||||
<tr v-else-if="!rows.length">
|
||||
<td colspan="7" class="px-3 py-8 text-center text-muted">{{ t('admin.shippingAudit.empty') }}</td>
|
||||
</tr>
|
||||
<tr
|
||||
v-for="row in rows"
|
||||
:key="row.id"
|
||||
class="border-b border-default last:border-0"
|
||||
>
|
||||
<td class="px-3 py-2 align-top text-xs">{{ formatTime(row.created_at) }}</td>
|
||||
<td class="px-3 py-2 align-top">
|
||||
<div class="font-medium break-words">{{ businessLabel('eventTypes', row.event_type) }}</div>
|
||||
<div class="text-[11px] text-muted break-words">{{ businessLabel('actions', row.action) }}</div>
|
||||
</td>
|
||||
<td class="px-3 py-2 align-top text-xs">{{ businessLabel('actorTypes', row.actor_type) }}</td>
|
||||
<td class="px-3 py-2 align-top text-xs break-words font-medium text-secondary">
|
||||
{{ businessLabel('reasonCodes', row.reason_code) }}
|
||||
</td>
|
||||
<td class="px-3 py-2 align-top">{{ businessLabel('results', row.result) }}</td>
|
||||
<td class="px-3 py-2 align-top text-[11px] text-secondary break-words">
|
||||
<div>{{ primaryBusinessRefs(row) }}</div>
|
||||
<div
|
||||
v-if="techRefChips(row).length"
|
||||
class="mt-1 flex flex-wrap gap-1"
|
||||
data-testid="shipping-audit-tech-ref-chips"
|
||||
>
|
||||
<button
|
||||
v-for="item in techRefChips(row)"
|
||||
:key="`${row.id}-tech-${item.label}`"
|
||||
type="button"
|
||||
class="rounded border border-default bg-surface-soft px-1 py-0.5 font-mono text-[10px] text-muted"
|
||||
:title="item.value"
|
||||
@click="copyTechId(item.value)"
|
||||
>
|
||||
{{ item.label }}
|
||||
</button>
|
||||
<div class="audit-event">
|
||||
<div class="audit-event-head">
|
||||
<div class="audit-event-name">
|
||||
<strong>{{ businessLabel('eventTypes', row.event_type) }}</strong>
|
||||
<span class="audit-event-action">{{ businessLabel('actions', row.action) }}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-3 py-2 align-top">
|
||||
<button type="button" class="text-brand-600 hover:underline" @click="openDetail(row.id)">
|
||||
<el-button link type="primary" @click="openDetail(row.id)">
|
||||
{{ t('admin.shippingAudit.diff') }}
|
||||
</el-button>
|
||||
</div>
|
||||
<dl class="audit-event-meta">
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingAudit.columns.actor') }}:</dt>
|
||||
<dd>{{ businessLabel('actorTypes', row.actor_type) }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingAudit.columns.reasonCode') }}:</dt>
|
||||
<dd class="audit-event-reason">{{ businessLabel('reasonCodes', row.reason_code) }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingAudit.columns.result') }}:</dt>
|
||||
<dd>{{ businessLabel('results', row.result) }}</dd>
|
||||
</div>
|
||||
<div v-if="primaryBusinessRefs(row) !== '—'">
|
||||
<dt>{{ t('admin.shippingAudit.columns.businessRefs') }}:</dt>
|
||||
<dd>{{ primaryBusinessRefs(row) }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<div
|
||||
v-if="techRefChips(row).length"
|
||||
class="tech-chips"
|
||||
data-testid="shipping-audit-tech-ref-chips"
|
||||
>
|
||||
<span class="tech-chips-label">{{ t('admin.shippingAudit.techRefs') }}</span>
|
||||
<button
|
||||
v-for="item in techRefChips(row)"
|
||||
:key="`${row.id}-m-tech-${item.label}`"
|
||||
type="button"
|
||||
class="tech-chip"
|
||||
:title="item.value"
|
||||
@click="copyTechId(item.value)"
|
||||
>
|
||||
{{ item.label }}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</el-timeline-item>
|
||||
</el-timeline>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end gap-3 text-sm">
|
||||
<span class="text-xs text-muted">{{ t('admin.shippingAudit.total', { count: total }) }}</span>
|
||||
<button type="button" class="rounded border border-default px-3 py-1.5 disabled:opacity-50" :disabled="page <= 1 || loading" @click="page -= 1; load()">{{ t('admin.shippingAudit.previous') }}</button>
|
||||
<span>{{ pageLabel }}</span>
|
||||
<button type="button" class="rounded border border-default px-3 py-1.5 disabled:opacity-50" :disabled="page * pageSize >= total || loading" @click="page += 1; load()">{{ t('admin.shippingAudit.next') }}</button>
|
||||
<!-- 桌面列表:与窄屏同一时间线内容,仅断点切换;技术编号行内次要芯片 -->
|
||||
<div class="audit-panel audit-panel--desktop" data-testid="shipping-audit-desktop-table">
|
||||
<el-skeleton v-if="loading" :rows="5" animated />
|
||||
<el-empty
|
||||
v-else-if="!rows.length"
|
||||
:description="t('admin.shippingAudit.empty')"
|
||||
:image-size="60"
|
||||
/>
|
||||
<el-timeline v-else class="audit-timeline">
|
||||
<el-timeline-item
|
||||
v-for="row in rows"
|
||||
:key="row.id"
|
||||
:timestamp="formatTime(row.created_at)"
|
||||
placement="top"
|
||||
>
|
||||
<div class="audit-event">
|
||||
<div class="audit-event-head">
|
||||
<div class="audit-event-name">
|
||||
<strong>{{ businessLabel('eventTypes', row.event_type) }}</strong>
|
||||
<span class="audit-event-action">{{ businessLabel('actions', row.action) }}</span>
|
||||
</div>
|
||||
<el-button link type="primary" @click="openDetail(row.id)">
|
||||
{{ t('admin.shippingAudit.diff') }}
|
||||
</el-button>
|
||||
</div>
|
||||
<dl class="audit-event-meta">
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingAudit.columns.actor') }}:</dt>
|
||||
<dd>{{ businessLabel('actorTypes', row.actor_type) }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingAudit.columns.reasonCode') }}:</dt>
|
||||
<dd class="audit-event-reason">{{ businessLabel('reasonCodes', row.reason_code) }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingAudit.columns.result') }}:</dt>
|
||||
<dd>{{ businessLabel('results', row.result) }}</dd>
|
||||
</div>
|
||||
<div v-if="primaryBusinessRefs(row) !== '—'">
|
||||
<dt>{{ t('admin.shippingAudit.columns.businessRefs') }}:</dt>
|
||||
<dd>{{ primaryBusinessRefs(row) }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<div
|
||||
v-if="techRefChips(row).length"
|
||||
class="tech-chips"
|
||||
data-testid="shipping-audit-tech-ref-chips"
|
||||
>
|
||||
<span class="tech-chips-label">{{ t('admin.shippingAudit.techRefs') }}</span>
|
||||
<button
|
||||
v-for="item in techRefChips(row)"
|
||||
:key="`${row.id}-tech-${item.label}`"
|
||||
type="button"
|
||||
class="tech-chip"
|
||||
:title="item.value"
|
||||
@click="copyTechId(item.value)"
|
||||
>
|
||||
{{ item.label }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</el-timeline-item>
|
||||
</el-timeline>
|
||||
</div>
|
||||
|
||||
<div class="pagination-row">
|
||||
<span class="pagination-total">{{ t('admin.shippingAudit.total', { count: total }) }}</span>
|
||||
<el-button size="small" :disabled="page <= 1 || loading" @click="page -= 1; load()">
|
||||
{{ t('admin.shippingAudit.previous') }}
|
||||
</el-button>
|
||||
<span class="pagination-page">{{ pageLabel }}</span>
|
||||
<el-button size="small" :disabled="page * pageSize >= total || loading" @click="page += 1; load()">
|
||||
{{ t('admin.shippingAudit.next') }}
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<ShippingAuditEventDetailDrawer
|
||||
@@ -571,3 +634,283 @@ onMounted(() => {
|
||||
/>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* 全宽布局:水平内边距由 AdminLayout 壳层统一持有,页面只保留内部块间距 */
|
||||
.shipping-audit-page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.page-header {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.page-heading-copy {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.page-header h1 {
|
||||
margin: 0;
|
||||
color: var(--el-text-color-primary);
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.page-desc {
|
||||
margin: 4px 0 0;
|
||||
max-width: 48rem;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
/* 页头操作区:相邻 el-button 间距统一交给 flex gap */
|
||||
.page-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.page-actions .el-button + .el-button,
|
||||
.more-panel .el-button + .el-button {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
/* “更多”操作区:窄屏为下拉面板,md+ 常驻内联(与原 md:hidden / md:static 语义一致) */
|
||||
.more-wrap {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.more-panel {
|
||||
position: absolute;
|
||||
z-index: 10;
|
||||
top: calc(100% + 4px);
|
||||
right: 0;
|
||||
display: none;
|
||||
min-width: 176px;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 4px;
|
||||
border: 1px solid var(--el-border-color-light);
|
||||
border-radius: 10px;
|
||||
background: var(--el-bg-color);
|
||||
padding: 4px;
|
||||
box-shadow: var(--el-box-shadow-light);
|
||||
}
|
||||
|
||||
.more-panel.more-panel--open {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.more-panel .el-button {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.more-toggle {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.more-panel,
|
||||
.more-panel.more-panel--open {
|
||||
position: static;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
gap: 8px;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.more-panel .el-button {
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
|
||||
/* 筛选面板:md 3 列 / lg 4 列(原 md:grid-cols-3 lg:grid-cols-4) */
|
||||
.filters-panel {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
border: 1px solid var(--el-border-color-light);
|
||||
border-radius: 12px;
|
||||
background: var(--el-bg-color);
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.filter-field {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.filter-field :deep(.el-select),
|
||||
.filter-field :deep(.el-date-editor.el-input) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.filter-q-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.filter-q-row :deep(.el-input) {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.filter-q-row .el-button {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.filters-panel {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.filter-field--wide {
|
||||
grid-column: span 2;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
.filters-panel {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.filter-field--wide {
|
||||
grid-column: auto;
|
||||
}
|
||||
}
|
||||
|
||||
/* 窄屏/桌面双列表容器:结构与 data-testid 契约保持,仅按 lg 断点切换可见性 */
|
||||
.audit-panel {
|
||||
border: 1px solid var(--el-border-color-light);
|
||||
border-radius: 12px;
|
||||
background: var(--el-bg-color);
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.audit-panel--desktop {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
.audit-panel--mobile {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.audit-panel--desktop {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.audit-timeline {
|
||||
padding: 4px 0 0 4px;
|
||||
}
|
||||
|
||||
.audit-event-head {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.audit-event-name {
|
||||
display: grid;
|
||||
min-width: 0;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.audit-event-name strong {
|
||||
color: var(--el-text-color-primary);
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.audit-event-action {
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.audit-event-meta {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
margin: 8px 0 0;
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.audit-event-meta dt {
|
||||
display: inline;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
.audit-event-meta dd {
|
||||
display: inline;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.audit-event-reason {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.tech-chips {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.tech-chips-label {
|
||||
color: var(--el-text-color-placeholder);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tech-chip {
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: 6px;
|
||||
background: var(--el-fill-color-lighter);
|
||||
padding: 2px 8px;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.tech-chip:hover {
|
||||
border-color: var(--el-color-primary-light-5);
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
|
||||
.pagination-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.pagination-total {
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.pagination-page {
|
||||
color: var(--el-text-color-primary);
|
||||
font-size: 13px;
|
||||
}
|
||||
</style>
|
||||
+326
-138
@@ -1,14 +1,30 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-audit/ShippingAuditEventDetailDrawer.vue
|
||||
用途:审计事件详情抽屉——业务化元数据、敏感脱敏提示、白名单 Diff、XFA 快照引用、哈希摘要。
|
||||
依赖:shipping-audit.api 类型、shippingAuditDisplay、Vue I18n、useMessage。
|
||||
依赖:element-plus(el-drawer / el-alert / el-descriptions / el-collapse / el-skeleton,
|
||||
沿用管理端 element-trial 主题)、shipping-audit.api 类型、shippingAuditDisplay、
|
||||
useMessage、Vue I18n。
|
||||
逻辑:由 ShippingAuditCenterPage 传入 detail;事件/动作/结果与列表同源业务标签;
|
||||
展示 before/after checksum 与 XFA snapshot_ref;技术编号以复制芯片展示;
|
||||
若快照/metadata 含视觉绑定前后摘要则单独渲染;关闭时 emit close;不自行拉接口。
|
||||
若快照/metadata 含视觉绑定前后摘要则单独渲染;对外契约(props: detail/loading、
|
||||
emit: close)不变,开合仍由父级 detail/loading 派生,关闭统一走 emit close;
|
||||
迁移为 el-drawer(size 640px / resizable / destroy-on-close);不自行拉接口。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import {
|
||||
ElAlert,
|
||||
ElCollapse,
|
||||
ElCollapseItem,
|
||||
ElDescriptions,
|
||||
ElDescriptionsItem,
|
||||
ElDrawer,
|
||||
ElSkeleton,
|
||||
} from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import type { ShippingAuditEventDetail } from '@/features/admin/api/shipping-audit.api';
|
||||
import { shippingAuditBusinessLabel } from './shippingAuditDisplay';
|
||||
@@ -96,7 +112,7 @@ const visualBindingDiff = computed(() => {
|
||||
});
|
||||
|
||||
/**
|
||||
* 关闭抽屉。
|
||||
* 关闭抽屉(el-drawer 关闭意图统一回传父级,保持 emit close 契约)。
|
||||
*/
|
||||
function onClose() {
|
||||
emit('close');
|
||||
@@ -104,165 +120,337 @@ function onClose() {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
v-if="open"
|
||||
class="fixed inset-0 z-50 flex justify-end bg-overlay"
|
||||
<el-drawer
|
||||
:model-value="open"
|
||||
size="640px"
|
||||
resizable
|
||||
destroy-on-close
|
||||
class="audit-detail-drawer"
|
||||
data-testid="shipping-audit-detail-drawer"
|
||||
@click.self="onClose"
|
||||
@update:model-value="onClose"
|
||||
>
|
||||
<aside class="h-full w-full max-w-xl overflow-y-auto bg-surface p-6 shadow-2xl">
|
||||
<div class="flex items-center justify-between">
|
||||
<h2 class="text-lg font-bold">{{ t('admin.shippingAudit.detailTitle') }}</h2>
|
||||
<button type="button" class="text-secondary" @click="onClose">{{ t('admin.close') }}</button>
|
||||
</div>
|
||||
<p v-if="loading" class="mt-6 text-muted">{{ t('admin.shippingAudit.loading') }}</p>
|
||||
<template v-else-if="detail">
|
||||
<p
|
||||
v-if="detail.sensitive_redacted"
|
||||
class="mt-4 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-800"
|
||||
data-testid="shipping-audit-sensitive-redacted"
|
||||
>
|
||||
{{ t('admin.shippingAudit.sensitiveRedacted') }}
|
||||
</p>
|
||||
<dl class="mt-5 grid grid-cols-1 gap-3 text-sm sm:grid-cols-2">
|
||||
<div>
|
||||
<dt class="text-xs text-muted">{{ t('admin.shippingAudit.columns.event') }}</dt>
|
||||
<dd class="mt-0.5 font-medium" data-testid="shipping-audit-detail-event">
|
||||
{{ label('eventTypes', detail.event_type) }}
|
||||
</dd>
|
||||
<dd class="text-xs text-muted">{{ label('actions', detail.action) }}</dd>
|
||||
<template #header>
|
||||
<h2 class="drawer-title">{{ t('admin.shippingAudit.detailTitle') }}</h2>
|
||||
</template>
|
||||
<el-skeleton v-if="loading" :rows="6" animated />
|
||||
<div v-else-if="detail" class="drawer-content">
|
||||
<el-alert
|
||||
v-if="detail.sensitive_redacted"
|
||||
type="warning"
|
||||
:closable="false"
|
||||
:title="t('admin.shippingAudit.sensitiveRedacted')"
|
||||
data-testid="shipping-audit-sensitive-redacted"
|
||||
/>
|
||||
<el-descriptions :column="2" size="small">
|
||||
<el-descriptions-item :label="t('admin.shippingAudit.columns.event')">
|
||||
<div class="detail-primary" data-testid="shipping-audit-detail-event">
|
||||
{{ label('eventTypes', detail.event_type) }}
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-xs text-muted">{{ t('admin.shippingAudit.columns.actor') }}</dt>
|
||||
<dd class="mt-0.5" data-testid="shipping-audit-detail-actor">
|
||||
{{ label('actorTypes', detail.actor_type) }}
|
||||
<span v-if="detail.actor_id" class="text-muted"> · {{ t('admin.shippingAudit.copyId') }}</span>
|
||||
</dd>
|
||||
<button
|
||||
v-if="detail.actor_id"
|
||||
type="button"
|
||||
class="mt-1 rounded border border-default px-2 py-0.5 font-mono text-[11px] text-muted"
|
||||
:title="String(detail.actor_id)"
|
||||
@click="copyTechId(detail.actor_id)"
|
||||
>
|
||||
{{ detail.actor_id }}
|
||||
</button>
|
||||
<div class="detail-sub">{{ label('actions', detail.action) }}</div>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingAudit.columns.actor')">
|
||||
<div data-testid="shipping-audit-detail-actor">
|
||||
{{ label('actorTypes', detail.actor_type) }}
|
||||
<span v-if="detail.actor_id" class="detail-sub"> · {{ t('admin.shippingAudit.copyId') }}</span>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-xs text-muted">{{ t('admin.shippingAudit.columns.reasonCode') }}</dt>
|
||||
<dd class="mt-0.5">{{ label('reasonCodes', detail.reason_code) }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-xs text-muted">{{ t('admin.shippingAudit.columns.result') }}</dt>
|
||||
<dd class="mt-0.5" data-testid="shipping-audit-detail-result">
|
||||
{{ label('results', detail.result) }}
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<button
|
||||
v-if="detail.actor_id"
|
||||
type="button"
|
||||
class="copy-chip copy-chip--mono"
|
||||
:title="String(detail.actor_id)"
|
||||
@click="copyTechId(detail.actor_id)"
|
||||
>
|
||||
{{ detail.actor_id }}
|
||||
</button>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingAudit.columns.reasonCode')">
|
||||
{{ label('reasonCodes', detail.reason_code) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingAudit.columns.result')">
|
||||
<span data-testid="shipping-audit-detail-result">{{ label('results', detail.result) }}</span>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<section class="mt-5" data-testid="shipping-audit-detail-tech-refs">
|
||||
<h3 class="text-sm font-semibold">{{ t('admin.shippingAudit.columns.refs') }}</h3>
|
||||
<p class="mt-1 text-[11px] text-muted">{{ t('admin.shippingAudit.techRefsHint') }}</p>
|
||||
<div v-if="techRefs.length" class="mt-2 flex flex-wrap gap-2">
|
||||
<button
|
||||
v-for="item in techRefs"
|
||||
:key="`${item.label}-${item.value}`"
|
||||
type="button"
|
||||
class="rounded border border-default px-2 py-1 text-[11px] text-secondary"
|
||||
:title="item.value"
|
||||
@click="copyTechId(item.value)"
|
||||
>
|
||||
<span class="text-muted">{{ item.label }}</span>
|
||||
· {{ t('admin.shippingAudit.copyId') }}
|
||||
</button>
|
||||
</div>
|
||||
<p v-else class="mt-2 text-xs text-muted">—</p>
|
||||
</section>
|
||||
<section class="detail-section" data-testid="shipping-audit-detail-tech-refs">
|
||||
<h3>{{ t('admin.shippingAudit.columns.refs') }}</h3>
|
||||
<p class="detail-hint">{{ t('admin.shippingAudit.techRefsHint') }}</p>
|
||||
<div v-if="techRefs.length" class="chip-row">
|
||||
<button
|
||||
v-for="item in techRefs"
|
||||
:key="`${item.label}-${item.value}`"
|
||||
type="button"
|
||||
class="copy-chip"
|
||||
:title="item.value"
|
||||
@click="copyTechId(item.value)"
|
||||
>
|
||||
<span class="copy-chip-label">{{ item.label }}</span>
|
||||
· {{ t('admin.shippingAudit.copyId') }}
|
||||
</button>
|
||||
</div>
|
||||
<p v-else class="detail-hint">—</p>
|
||||
</section>
|
||||
|
||||
<details class="mt-5 rounded-lg border border-default p-3 text-xs">
|
||||
<summary class="cursor-pointer font-medium text-secondary">
|
||||
{{ t('admin.shippingAudit.hashSection') }}
|
||||
</summary>
|
||||
<dl class="mt-3 space-y-2">
|
||||
<!-- 原生 details 迁移为 el-collapse -->
|
||||
<el-collapse class="hash-collapse">
|
||||
<el-collapse-item :title="t('admin.shippingAudit.hashSection')" name="hash">
|
||||
<dl class="hash-list">
|
||||
<div>
|
||||
<dt class="text-muted">{{ t('admin.shippingAudit.eventHash') }}</dt>
|
||||
<dd class="break-all font-mono text-[10px]">{{ detail.event_hash || '—' }}</dd>
|
||||
<dt>{{ t('admin.shippingAudit.eventHash') }}</dt>
|
||||
<dd>{{ detail.event_hash || '—' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt class="text-muted">{{ t('admin.shippingAudit.previousEventHash') }}</dt>
|
||||
<dd class="break-all font-mono text-[10px]">{{ detail.previous_event_hash || '—' }}</dd>
|
||||
<dt>{{ t('admin.shippingAudit.previousEventHash') }}</dt>
|
||||
<dd>{{ detail.previous_event_hash || '—' }}</dd>
|
||||
</div>
|
||||
<div v-if="detail.before_hash">
|
||||
<dt class="text-muted">{{ t('admin.shippingAudit.beforeHash') }}</dt>
|
||||
<dd class="break-all font-mono text-[10px]" data-testid="shipping-audit-before-hash">{{ detail.before_hash }}</dd>
|
||||
<dt>{{ t('admin.shippingAudit.beforeHash') }}</dt>
|
||||
<dd data-testid="shipping-audit-before-hash">{{ detail.before_hash }}</dd>
|
||||
</div>
|
||||
<div v-if="detail.after_hash">
|
||||
<dt class="text-muted">{{ t('admin.shippingAudit.afterHash') }}</dt>
|
||||
<dd class="break-all font-mono text-[10px]" data-testid="shipping-audit-after-hash">{{ detail.after_hash }}</dd>
|
||||
<dt>{{ t('admin.shippingAudit.afterHash') }}</dt>
|
||||
<dd data-testid="shipping-audit-after-hash">{{ detail.after_hash }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</details>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
|
||||
<section
|
||||
v-if="visualBindingDiff"
|
||||
class="mt-5"
|
||||
data-testid="shipping-audit-visual-binding-diff"
|
||||
>
|
||||
<h3 class="text-sm font-semibold">{{ t('admin.shippingAudit.visualBindingDiff') }}</h3>
|
||||
<p class="mt-1 text-[11px] text-muted">{{ t('admin.shippingAudit.visualBindingDiffHint') }}</p>
|
||||
<div class="mt-2 space-y-2 rounded-lg border border-default p-3 text-xs">
|
||||
<div>
|
||||
<div class="font-medium text-muted">{{ t('admin.shippingAudit.before') }}</div>
|
||||
<pre class="mt-1 whitespace-pre-wrap break-all">{{ visualBindingDiff.before == null ? '—' : JSON.stringify(visualBindingDiff.before, null, 2) }}</pre>
|
||||
</div>
|
||||
<div>
|
||||
<div class="font-medium text-muted">{{ t('admin.shippingAudit.after') }}</div>
|
||||
<pre class="mt-1 whitespace-pre-wrap break-all">{{ visualBindingDiff.after == null ? '—' : JSON.stringify(visualBindingDiff.after, null, 2) }}</pre>
|
||||
</div>
|
||||
<section
|
||||
v-if="visualBindingDiff"
|
||||
class="detail-section"
|
||||
data-testid="shipping-audit-visual-binding-diff"
|
||||
>
|
||||
<h3>{{ t('admin.shippingAudit.visualBindingDiff') }}</h3>
|
||||
<p class="detail-hint">{{ t('admin.shippingAudit.visualBindingDiffHint') }}</p>
|
||||
<div class="panel-box">
|
||||
<div>
|
||||
<div class="detail-label">{{ t('admin.shippingAudit.before') }}</div>
|
||||
<pre class="code-block">{{ visualBindingDiff.before == null ? '—' : JSON.stringify(visualBindingDiff.before, null, 2) }}</pre>
|
||||
</div>
|
||||
</section>
|
||||
<div>
|
||||
<div class="detail-label">{{ t('admin.shippingAudit.after') }}</div>
|
||||
<pre class="code-block">{{ visualBindingDiff.after == null ? '—' : JSON.stringify(visualBindingDiff.after, null, 2) }}</pre>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section
|
||||
v-if="detail.xfa_snapshot_refs?.length"
|
||||
class="mt-5"
|
||||
data-testid="shipping-audit-xfa-snapshots"
|
||||
>
|
||||
<h3 class="text-sm font-semibold">{{ t('admin.shippingAudit.xfaSnapshots') }}</h3>
|
||||
<p class="mt-1 text-[11px] text-muted">{{ t('admin.shippingAudit.xfaSnapshotsHint') }}</p>
|
||||
<ul class="mt-2 space-y-2">
|
||||
<li
|
||||
v-for="ref in detail.xfa_snapshot_refs"
|
||||
:key="ref.snapshot_ref"
|
||||
class="rounded-lg border border-default px-3 py-2 text-xs"
|
||||
<section
|
||||
v-if="detail.xfa_snapshot_refs?.length"
|
||||
class="detail-section"
|
||||
data-testid="shipping-audit-xfa-snapshots"
|
||||
>
|
||||
<h3>{{ t('admin.shippingAudit.xfaSnapshots') }}</h3>
|
||||
<p class="detail-hint">{{ t('admin.shippingAudit.xfaSnapshotsHint') }}</p>
|
||||
<ul class="ref-list">
|
||||
<li
|
||||
v-for="ref in detail.xfa_snapshot_refs"
|
||||
:key="ref.snapshot_ref"
|
||||
class="panel-box"
|
||||
>
|
||||
<div class="detail-primary">{{ ref.purpose }}</div>
|
||||
<button
|
||||
type="button"
|
||||
class="copy-chip copy-chip--mono"
|
||||
:title="ref.snapshot_ref"
|
||||
data-testid="shipping-audit-xfa-snapshot-ref"
|
||||
@click="copyTechId(ref.snapshot_ref)"
|
||||
>
|
||||
<div class="font-medium">{{ ref.purpose }}</div>
|
||||
<button
|
||||
type="button"
|
||||
class="mt-1 rounded border border-default px-2 py-0.5 font-mono text-[11px] text-muted"
|
||||
:title="ref.snapshot_ref"
|
||||
data-testid="shipping-audit-xfa-snapshot-ref"
|
||||
@click="copyTechId(ref.snapshot_ref)"
|
||||
>
|
||||
{{ t('admin.shippingAudit.copyId') }} · {{ ref.snapshot_ref.slice(0, 12) }}…
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
{{ t('admin.shippingAudit.copyId') }} · {{ ref.snapshot_ref.slice(0, 12) }}…
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<h3 class="mt-6 font-semibold">{{ t('admin.shippingAudit.diff') }}</h3>
|
||||
<div v-if="detail.diff?.length" class="mt-2 space-y-2" data-testid="shipping-audit-diff-rows">
|
||||
<div class="detail-section">
|
||||
<h3>{{ t('admin.shippingAudit.diff') }}</h3>
|
||||
<div v-if="detail.diff?.length" class="diff-rows" data-testid="shipping-audit-diff-rows">
|
||||
<div
|
||||
v-for="row in detail.diff"
|
||||
:key="row.key"
|
||||
class="rounded-lg border border-default p-3 text-xs"
|
||||
class="panel-box diff-row"
|
||||
>
|
||||
<div class="font-medium">{{ row.key }} · {{ row.change }}</div>
|
||||
<div class="mt-1 text-muted">{{ t('admin.shippingAudit.before') }}: {{ row.before == null ? '—' : JSON.stringify(row.before) }}</div>
|
||||
<div class="text-muted">{{ t('admin.shippingAudit.after') }}: {{ row.after == null ? '—' : JSON.stringify(row.after) }}</div>
|
||||
<div class="detail-primary">{{ row.key }} · {{ row.change }}</div>
|
||||
<div class="detail-hint">{{ t('admin.shippingAudit.before') }}: {{ row.before == null ? '—' : JSON.stringify(row.before) }}</div>
|
||||
<div class="detail-hint">{{ t('admin.shippingAudit.after') }}: {{ row.after == null ? '—' : JSON.stringify(row.after) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<p v-else class="mt-2 text-sm text-muted">{{ t('admin.shippingAudit.noDiff') }}</p>
|
||||
</template>
|
||||
</aside>
|
||||
</div>
|
||||
<p v-else class="detail-hint">{{ t('admin.shippingAudit.noDiff') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.drawer-title {
|
||||
margin: 0;
|
||||
color: var(--el-text-color-primary);
|
||||
font-size: 17px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.drawer-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.detail-section {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.detail-section h3 {
|
||||
margin: 0;
|
||||
color: var(--el-text-color-primary);
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.detail-hint {
|
||||
margin: 0;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.detail-primary {
|
||||
color: var(--el-text-color-primary);
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.detail-sub {
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.detail-label {
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.chip-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
/* 复制芯片:技术编号点击复制,保留 title 提示 */
|
||||
.copy-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
max-width: 100%;
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: 6px;
|
||||
background: var(--el-bg-color);
|
||||
padding: 3px 8px;
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 12px;
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.copy-chip:hover {
|
||||
border-color: var(--el-color-primary-light-5);
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
|
||||
.copy-chip-label {
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
.copy-chip--mono {
|
||||
color: var(--el-text-color-secondary);
|
||||
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
/* 哈希摘要折叠区:原生 details 迁移 el-collapse */
|
||||
.hash-collapse {
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: 8px;
|
||||
padding: 0 12px;
|
||||
}
|
||||
|
||||
.hash-collapse :deep(.el-collapse-item__header) {
|
||||
height: 36px;
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 13px;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.hash-collapse :deep(.el-collapse-item__wrap) {
|
||||
border-bottom: none;
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.hash-collapse :deep(.el-collapse-item__content) {
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
|
||||
.hash-list {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.hash-list dt {
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
.hash-list dd {
|
||||
margin: 0;
|
||||
color: var(--el-text-color-regular);
|
||||
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.panel-box {
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: 8px;
|
||||
padding: 10px 12px;
|
||||
}
|
||||
|
||||
.code-block {
|
||||
margin: 6px 0 0;
|
||||
max-height: 12rem;
|
||||
overflow: auto;
|
||||
border-radius: 6px;
|
||||
background: var(--el-fill-color-light);
|
||||
padding: 8px;
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 12px;
|
||||
line-height: 1.5;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.ref-list {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.ref-list .panel-box {
|
||||
display: grid;
|
||||
gap: 6px;
|
||||
justify-items: start;
|
||||
}
|
||||
|
||||
.diff-rows {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.diff-row {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
}
|
||||
</style>
|
||||
+640
-286
File diff suppressed because it is too large.
Load diff
+140
@@ -0,0 +1,140 @@
|
||||
/**
|
||||
* features/admin/modules/shipping-field-assets/__tests__/ShippingFieldAssetsPage.spec.ts
|
||||
* 用途:字段资产库 EP 迁移后的冒烟契约——工具栏一行化控件、主从工作台渲染、
|
||||
* 详情(descriptions/tag/alert)、新建与弃用对话框、审计时间线。
|
||||
* 依赖:@vue/test-utils、vitest、@/i18n、shipping-field-assets.api(mock)。
|
||||
* 逻辑:mock API 返回一条系统标准 + 一条扩展字段;断言 EP 组件结构与关键交互路径,
|
||||
* 不锁样式细节。
|
||||
*/
|
||||
import { enableAutoUnmount, flushPromises, mount } from '@vue/test-utils';
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import i18n from '@/i18n';
|
||||
import ShippingFieldAssetsPage from '../ShippingFieldAssetsPage.vue';
|
||||
|
||||
const apiMocks = vi.hoisted(() => ({
|
||||
listShippingFieldAssets: vi.fn(),
|
||||
getShippingFieldAsset: vi.fn(),
|
||||
getShippingFieldAssetImpact: vi.fn(),
|
||||
listShippingFieldAssetAudits: vi.fn(),
|
||||
createShippingFieldExtension: vi.fn(),
|
||||
updateShippingFieldExtension: vi.fn(),
|
||||
retireShippingFieldExtension: vi.fn(),
|
||||
restoreShippingFieldExtension: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock('@/features/admin/api/shipping-field-assets.api', async () => {
|
||||
const actual = await vi.importActual<Record<string, unknown>>(
|
||||
'@/features/admin/api/shipping-field-assets.api',
|
||||
);
|
||||
return { ...actual, ...apiMocks };
|
||||
});
|
||||
|
||||
enableAutoUnmount(afterEach);
|
||||
|
||||
const standardAsset = {
|
||||
id: 'std-1',
|
||||
field_code: 'customer_po_number',
|
||||
display_name_default: '客户 PO 号',
|
||||
asset_kind: 'system_standard',
|
||||
status: 'active',
|
||||
scope: 'header',
|
||||
value_type: 'string',
|
||||
storage_kind: 'typed_column',
|
||||
storage_path: 'customer_po_number',
|
||||
adoption_summary: { published: 1, draft: 0 },
|
||||
adoptions: [],
|
||||
updated_at: null,
|
||||
};
|
||||
const extensionAsset = {
|
||||
id: 'ext-1',
|
||||
field_code: 'wtp_special_flag',
|
||||
display_name_default: 'WTP 专用标记',
|
||||
asset_kind: 'extension',
|
||||
status: 'active',
|
||||
scope: 'line',
|
||||
value_type: 'boolean',
|
||||
storage_kind: 'extension_json',
|
||||
storage_path: 'extensions.wtp_special_flag',
|
||||
adoption_summary: { published: 0, draft: 1 },
|
||||
adoptions: [],
|
||||
updated_at: '2026-10-14T00:00:00',
|
||||
};
|
||||
|
||||
const mountPage = async () => {
|
||||
const wrapper = mount(ShippingFieldAssetsPage, { global: { plugins: [i18n] } });
|
||||
await flushPromises();
|
||||
return wrapper;
|
||||
};
|
||||
|
||||
describe('ShippingFieldAssetsPage EP 迁移冒烟', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
apiMocks.listShippingFieldAssets.mockResolvedValue({ items: [standardAsset, extensionAsset] });
|
||||
apiMocks.getShippingFieldAsset.mockImplementation(async (id: string) => (
|
||||
id === 'std-1' ? standardAsset : extensionAsset
|
||||
));
|
||||
apiMocks.getShippingFieldAssetImpact.mockResolvedValue({
|
||||
blocking_count: 0,
|
||||
blocking_items: [],
|
||||
blocking_kinds: [],
|
||||
historical: { observation_count: 61, immutable_schema_version_count: 3 },
|
||||
});
|
||||
apiMocks.listShippingFieldAssetAudits.mockResolvedValue({
|
||||
items: [{
|
||||
id: 'audit-1',
|
||||
event_type: 'created',
|
||||
actor_display_name: '管理员',
|
||||
request_id: 'req-1',
|
||||
created_at: '2026-10-14T10:00:00',
|
||||
change_summary: { action: 'create' },
|
||||
before: null,
|
||||
after: { field_code: 'wtp_special_flag' },
|
||||
}],
|
||||
});
|
||||
});
|
||||
|
||||
it('工具栏渲染 EP 控件且列表分组呈现两条资产', async () => {
|
||||
const wrapper = await mountPage();
|
||||
// 关键断言:EP 工具栏(搜索/两个筛选/刷新)与主从工作台列表分组齐全
|
||||
expect(wrapper.find('.toolbar .el-input').exists()).toBe(true);
|
||||
expect(wrapper.findAll('.toolbar .el-select')).toHaveLength(2);
|
||||
expect(wrapper.findAll('.toolbar .el-button').length).toBeGreaterThan(0);
|
||||
expect(wrapper.find('.assets-workbench .list-panel').exists()).toBe(true);
|
||||
expect(wrapper.text()).toContain('客户 PO 号');
|
||||
expect(wrapper.text()).toContain('WTP 专用标记');
|
||||
});
|
||||
|
||||
it('选中扩展字段:详情 descriptions/tag 渲染且出现弃用操作', async () => {
|
||||
const wrapper = await mountPage();
|
||||
// 关键断言:详情走 EP descriptions + 状态 tag + 扩展编辑卡(弃用按钮)
|
||||
const listItems = wrapper.findAll('.list-item');
|
||||
await listItems[1].trigger('click');
|
||||
await flushPromises();
|
||||
expect(wrapper.find('.detail-panel .el-descriptions').exists()).toBe(true);
|
||||
expect(wrapper.find('.detail-panel .el-tag').exists()).toBe(true);
|
||||
expect(wrapper.find('.edit-card').exists()).toBe(true);
|
||||
expect(wrapper.find('.edit-card').text()).toContain('弃用');
|
||||
// 弃用打开原因对话框(EP dialog),审计时间线渲染
|
||||
await wrapper.find('.edit-card .el-button--danger').trigger('click');
|
||||
await flushPromises();
|
||||
expect(wrapper.find('.el-dialog').exists()).toBe(true);
|
||||
expect(wrapper.find('.audit-timeline').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('新建扩展字段对话框可打开并提交调用 API', async () => {
|
||||
const wrapper = await mountPage();
|
||||
apiMocks.createShippingFieldExtension.mockResolvedValue({ ...extensionAsset, id: 'ext-2' });
|
||||
await wrapper.find('.page-header .el-button--primary').trigger('click');
|
||||
await flushPromises();
|
||||
// 关键断言:el-dialog 打开且表单控件为 EP 组件(两个输入 + 语义 textarea + 两个下拉)
|
||||
const dialog = wrapper.find('.el-dialog');
|
||||
expect(dialog.exists()).toBe(true);
|
||||
expect(dialog.findAll('.el-input').length).toBeGreaterThanOrEqual(2);
|
||||
expect(dialog.find('.el-textarea').exists()).toBe(true);
|
||||
expect(dialog.findAll('.el-select').length).toBe(2);
|
||||
await dialog.find('input').setValue('new_field');
|
||||
await dialog.find('.el-button--primary').trigger('click');
|
||||
await flushPromises();
|
||||
expect(apiMocks.createShippingFieldExtension).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
+80
-73
@@ -1,12 +1,18 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-field-assets/components/FieldImpactDrawer.vue
|
||||
用途:展示单字段影响分析(阻断对象明细/警告/历史只读),资产库与 Schema 页共用。
|
||||
依赖:ShippingFieldAssetImpact DTO、Vue I18n、Vue Router。
|
||||
逻辑:只读抽屉;列出具体配置对象与引用位置;不含订单正文或证据原文。
|
||||
依赖:element-plus(el-drawer 抽屉/el-skeleton 骨架/el-button 链接按钮,沿用管理端 element-trial 主题)、
|
||||
ShippingFieldAssetImpact DTO、Vue I18n、Vue Router。
|
||||
逻辑:只读抽屉(视觉层已迁移 Element Plus,v-model 对外契约保持不变);
|
||||
列出具体配置对象与引用位置;不含订单正文或证据原文。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { ElButton, ElDrawer, ElSkeleton } from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import type { ShippingFieldAssetImpact, ShippingFieldImpactItem } from '@/features/admin/types/shipping-field-assets.types';
|
||||
|
||||
defineProps<{
|
||||
@@ -39,80 +45,81 @@ function openAdminPath(item: ShippingFieldImpactItem): void {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="modelValue" class="impact-overlay" @click.self="$emit('update:modelValue', false)">
|
||||
<aside class="impact-drawer" role="dialog" aria-modal="true">
|
||||
<header>
|
||||
<h2>{{ t('admin.shippingFieldAssets.impactTitle') }}</h2>
|
||||
<button type="button" class="btn-ghost btn-sm" @click="$emit('update:modelValue', false)">{{ t('common.close') }}</button>
|
||||
</header>
|
||||
<div v-if="loading" class="impact-loading">{{ t('common.loading') }}</div>
|
||||
<template v-else-if="impact">
|
||||
<section v-if="impact.blocking_items?.length" class="impact-section blocked">
|
||||
<h3>{{ t('admin.shippingFieldAssets.impactBlocked') }}</h3>
|
||||
<p class="muted">{{ t('admin.shippingFieldAssets.blockingCount', { count: impact.blocking_count }) }}</p>
|
||||
<ul class="object-list">
|
||||
<li v-for="item in impact.blocking_items" :key="`${item.kind}-${item.object_id}-${item.reference_path}`">
|
||||
<strong>{{ blockingLabel(item.kind) }} · {{ item.display_name }}</strong>
|
||||
<small>
|
||||
#{{ item.object_id }}
|
||||
<template v-if="item.version != null"> · v{{ item.version }}</template>
|
||||
· {{ item.status }}
|
||||
</small>
|
||||
<code>{{ item.reference_path }}</code>
|
||||
<button
|
||||
v-if="item.admin_path"
|
||||
type="button"
|
||||
class="link-button"
|
||||
@click="openAdminPath(item)"
|
||||
>
|
||||
{{ t('admin.shippingFieldAssets.impactOpenTarget') }}
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section v-else class="impact-section ok">
|
||||
<p>{{ t('admin.shippingFieldAssets.impactNoBlocking') }}</p>
|
||||
</section>
|
||||
<section class="impact-section historical">
|
||||
<h3>{{ t('admin.shippingFieldAssets.impactHistorical') }}</h3>
|
||||
<ul>
|
||||
<li>{{ t('admin.shippingFieldAssets.impactHistoricalVersions', { count: impact.historical.immutable_schema_version_count }) }}</li>
|
||||
<li>{{ t('admin.shippingFieldAssets.impactHistoricalObservations', { count: impact.historical.observation_count }) }}</li>
|
||||
<li>{{ t('admin.shippingFieldAssets.impactHistoricalValues', { count: impact.historical.value_count }) }}</li>
|
||||
</ul>
|
||||
<ul v-if="impact.historical.immutable_schema_versions?.length" class="object-list compact">
|
||||
<li
|
||||
v-for="item in impact.historical.immutable_schema_versions"
|
||||
:key="item.schema_version_id"
|
||||
<el-drawer
|
||||
:model-value="modelValue"
|
||||
:title="t('admin.shippingFieldAssets.impactTitle')"
|
||||
size="640px"
|
||||
resizable
|
||||
destroy-on-close
|
||||
@update:model-value="$emit('update:modelValue', $event)"
|
||||
>
|
||||
<div v-if="loading" class="impact-loading">
|
||||
<el-skeleton :rows="5" animated />
|
||||
</div>
|
||||
<template v-else-if="impact">
|
||||
<section v-if="impact.blocking_items?.length" class="impact-section blocked">
|
||||
<h3>{{ t('admin.shippingFieldAssets.impactBlocked') }}</h3>
|
||||
<p class="muted">{{ t('admin.shippingFieldAssets.blockingCount', { count: impact.blocking_count }) }}</p>
|
||||
<ul class="object-list">
|
||||
<li v-for="item in impact.blocking_items" :key="`${item.kind}-${item.object_id}-${item.reference_path}`">
|
||||
<strong>{{ blockingLabel(item.kind) }} · {{ item.display_name }}</strong>
|
||||
<small>
|
||||
#{{ item.object_id }}
|
||||
<template v-if="item.version != null"> · v{{ item.version }}</template>
|
||||
· {{ item.status }}
|
||||
</small>
|
||||
<code>{{ item.reference_path }}</code>
|
||||
<el-button
|
||||
v-if="item.admin_path"
|
||||
link
|
||||
type="primary"
|
||||
class="link-button"
|
||||
@click="openAdminPath(item)"
|
||||
>
|
||||
{{ item.schema_display_name || item.schema_code || 'Schema' }}
|
||||
V{{ item.version }} ({{ item.status }})
|
||||
</li>
|
||||
</ul>
|
||||
<small>{{ t('admin.shippingFieldAssets.impactHistoricalHint') }}</small>
|
||||
</section>
|
||||
</template>
|
||||
</aside>
|
||||
</div>
|
||||
{{ t('admin.shippingFieldAssets.impactOpenTarget') }}
|
||||
</el-button>
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section v-else class="impact-section ok">
|
||||
<p>{{ t('admin.shippingFieldAssets.impactNoBlocking') }}</p>
|
||||
</section>
|
||||
<section class="impact-section historical">
|
||||
<h3>{{ t('admin.shippingFieldAssets.impactHistorical') }}</h3>
|
||||
<ul>
|
||||
<li>{{ t('admin.shippingFieldAssets.impactHistoricalVersions', { count: impact.historical.immutable_schema_version_count }) }}</li>
|
||||
<li>{{ t('admin.shippingFieldAssets.impactHistoricalObservations', { count: impact.historical.observation_count }) }}</li>
|
||||
<li>{{ t('admin.shippingFieldAssets.impactHistoricalValues', { count: impact.historical.value_count }) }}</li>
|
||||
</ul>
|
||||
<ul v-if="impact.historical.immutable_schema_versions?.length" class="object-list compact">
|
||||
<li
|
||||
v-for="item in impact.historical.immutable_schema_versions"
|
||||
:key="item.schema_version_id"
|
||||
>
|
||||
{{ item.schema_display_name || item.schema_code || 'Schema' }}
|
||||
V{{ item.version }} ({{ item.status }})
|
||||
</li>
|
||||
</ul>
|
||||
<small>{{ t('admin.shippingFieldAssets.impactHistoricalHint') }}</small>
|
||||
</section>
|
||||
</template>
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.impact-overlay { position: fixed; z-index: 60; inset: 0; display: flex; justify-content: flex-end; background: rgb(15 23 42 / 38%); }
|
||||
.impact-drawer { display: grid; width: min(520px, 96vw); height: 100%; grid-template-rows: auto 1fr; gap: 12px; overflow: hidden; background: #fff; padding: 18px; box-shadow: -12px 0 40px rgb(15 23 42 / 18%); }
|
||||
.impact-drawer header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
|
||||
.impact-drawer h2, .impact-drawer h3 { margin: 0; color: #1e293b; font-size: 15px; }
|
||||
.impact-drawer h3 { font-size: 13px; }
|
||||
.link-button { border: 0; background: transparent; color: #64748b; font: inherit; font-size: 13px; cursor: pointer; }
|
||||
.link-button { color: #1d4ed8; padding: 0; text-align: left; }
|
||||
.impact-loading, .muted { color: #64748b; font-size: 13px; }
|
||||
.impact-section { border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px; overflow-y: auto; }
|
||||
.impact-section.blocked { border-color: #fecaca; background: #fef2f2; }
|
||||
.impact-section.ok { border-color: #bbf7d0; background: #f0fdf4; color: #166534; font-size: 13px; }
|
||||
.impact-section.historical { background: #f8fafc; }
|
||||
.impact-section ul { margin: 8px 0 0; padding-left: 18px; color: #475569; font-size: 12px; }
|
||||
.impact-loading, .muted { margin: 0; color: var(--el-text-color-secondary); font-size: 12px; }
|
||||
.impact-section { border: 1px solid var(--el-border-color-lighter); border-radius: 8px; padding: 12px; overflow-y: auto; }
|
||||
.impact-section.blocked { border-color: var(--el-color-danger-light-5); background: var(--el-color-danger-light-9); }
|
||||
.impact-section.ok { border-color: var(--el-color-success-light-5); background: var(--el-color-success-light-9); color: var(--el-color-success-dark-2); font-size: 13px; }
|
||||
.impact-section.ok p { margin: 0; }
|
||||
.impact-section.historical { background: var(--el-fill-color-light); }
|
||||
.impact-section h3 { margin: 0; color: var(--el-text-color-primary); font-size: 13px; }
|
||||
.impact-section ul { margin: 8px 0 0; padding-left: 18px; color: var(--el-text-color-regular); font-size: 12px; }
|
||||
.object-list { list-style: none; padding-left: 0 !important; display: grid; gap: 0.75rem; }
|
||||
.object-list li { display: grid; gap: 0.2rem; border: 1px solid #fecaca; border-radius: 0.5rem; background: #fff; padding: 0.65rem 0.75rem; }
|
||||
.object-list.compact li { border-color: #e2e8f0; }
|
||||
.object-list small, .object-list code { color: #64748b; font-size: 11px; word-break: break-all; }
|
||||
.impact-section small { display: block; margin-top: 8px; color: #94a3b8; font-size: 11px; line-height: 1.4; }
|
||||
.object-list li { display: grid; gap: 0.2rem; justify-items: start; border: 1px solid var(--el-color-danger-light-5); border-radius: 0.5rem; background: var(--el-bg-color); padding: 0.65rem 0.75rem; }
|
||||
.object-list.compact li { border-color: var(--el-border-color-lighter); }
|
||||
.object-list li strong { color: var(--el-text-color-primary); font-size: 12px; }
|
||||
.object-list small, .object-list code { color: var(--el-text-color-secondary); font-size: 12px; word-break: break-all; }
|
||||
.link-button { padding: 0; }
|
||||
.impact-section small { display: block; margin-top: 8px; color: var(--el-text-color-placeholder); font-size: 12px; line-height: 1.4; }
|
||||
</style>
|
||||
+200
-95
@@ -1,14 +1,42 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-identity-rules/ShippingIdentityRulesPage.vue
|
||||
用途:维护引用已发布订单上下文字段的客户/送货站点识别定义,并发布不可变规则集。
|
||||
依赖:规则 API、Vue Composition API、Vue I18n。
|
||||
逻辑:管理员只能选择服务端提供的已发布识别字段,运行时只消费该字段的已裁决值。
|
||||
依赖:element-plus(按钮/表单控件/标签/空态/骨架屏,沿用管理端 element-trial 主题)、
|
||||
shipping-identity-rules.api、BusinessError、useMessage、Vue I18n。
|
||||
逻辑:管理员只能选择服务端提供的已发布识别字段,运行时只消费该字段的已裁决值;
|
||||
业务脚本(目录/规则集加载、定义保存与自动化授权、草稿保存与发布)保持原逻辑
|
||||
不变,仅视觉层从手写控件迁移 Element Plus(与在途调拨类型页同一范式)。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, reactive, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { ArrowUpRight, Check, CircleDotDashed, CircleHelp, FileCheck2, Layers3, Plus, Send, Tags } from 'lucide-vue-next';
|
||||
import {
|
||||
ElButton,
|
||||
ElCheckbox,
|
||||
ElCheckboxGroup,
|
||||
ElEmpty,
|
||||
ElForm,
|
||||
ElFormItem,
|
||||
ElInput,
|
||||
ElOption,
|
||||
ElSelect,
|
||||
ElSkeleton,
|
||||
ElTag,
|
||||
} from 'element-plus';
|
||||
import {
|
||||
Check,
|
||||
Collection,
|
||||
CollectionTag,
|
||||
DocumentChecked,
|
||||
Plus,
|
||||
Promotion,
|
||||
QuestionFilled,
|
||||
TopRight,
|
||||
} from '@element-plus/icons-vue';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import {
|
||||
@@ -211,8 +239,8 @@ onMounted(() => { void load(); });
|
||||
<section class="identity-rules-page">
|
||||
<header class="identity-hero">
|
||||
<div>
|
||||
<h1 class="section-title">{{ t('admin.shippingIdentityRules.title') }}</h1>
|
||||
<p class="section-desc mt-1">{{ t('admin.shippingIdentityRules.subtitle') }}</p>
|
||||
<h1 class="page-title">{{ t('admin.shippingIdentityRules.title') }}</h1>
|
||||
<p class="page-desc">{{ t('admin.shippingIdentityRules.subtitle') }}</p>
|
||||
</div>
|
||||
<div class="identity-hero__meta">
|
||||
<div class="identity-hero__status">
|
||||
@@ -220,9 +248,10 @@ onMounted(() => { void load(); });
|
||||
<span v-if="publishedRuleSet">V{{ publishedRuleSet.version }} · {{ t('admin.shippingIdentityRules.status.published') }}</span>
|
||||
<span v-else>{{ t('admin.shippingIdentityRules.status.draft') }}</span>
|
||||
</div>
|
||||
<button type="button" class="btn-ghost identity-hero__link" @click="openCustomerMaster">
|
||||
{{ t('admin.shippingIdentityRules.openCustomerMaster') }}<ArrowUpRight class="h-4 w-4" />
|
||||
</button>
|
||||
<el-button @click="openCustomerMaster">
|
||||
{{ t('admin.shippingIdentityRules.openCustomerMaster') }}
|
||||
<TopRight class="identity-ico identity-hero__link-icon" />
|
||||
</el-button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -233,43 +262,90 @@ onMounted(() => { void load(); });
|
||||
<div class="identity-flow__step"><span>03</span><div><strong>{{ t('admin.shippingIdentityRules.openCustomerMaster') }}</strong><small>{{ t('admin.shippingIdentityRules.workflowHint') }}</small></div></div>
|
||||
</section>
|
||||
|
||||
<p v-if="loading" class="identity-loading"><CircleDotDashed class="h-4 w-4 animate-spin" />{{ t('admin.shippingIdentityRules.loading') }}</p>
|
||||
<el-skeleton v-if="loading" class="identity-loading" :rows="6" animated />
|
||||
|
||||
<div v-else class="identity-workbench">
|
||||
<section class="identity-panel identity-panel--definitions">
|
||||
<div class="identity-panel__heading">
|
||||
<div><p class="identity-panel__eyebrow"><Tags class="h-4 w-4" />{{ t('admin.shippingIdentityRules.definitions') }}</p><h3>{{ activeDefinitions.length }}</h3></div>
|
||||
<div><p class="identity-panel__eyebrow"><CollectionTag class="identity-ico" />{{ t('admin.shippingIdentityRules.definitions') }}</p><h3>{{ activeDefinitions.length }}</h3></div>
|
||||
<p>{{ t('admin.shippingIdentityRules.definitionHint') }}</p>
|
||||
</div>
|
||||
|
||||
<div v-if="catalog?.definitions.length" class="identity-definition-list">
|
||||
<article v-for="definition in catalog.definitions" :key="definition.id" class="identity-definition-row">
|
||||
<div class="identity-definition-row__icon"><Tags class="h-4 w-4" /></div>
|
||||
<div class="min-w-0"><strong>{{ definition.display_name }}</strong><p>{{ definition.description || sourceDisplay(definition) }}</p></div>
|
||||
<span class="identity-target">{{ t(`admin.shippingIdentityRules.targets.${definition.target_type}`) }}</span>
|
||||
<select class="identity-automation identity-automation-select" :class="{ 'identity-automation--enabled': definition.max_automation === 'conditional' }" :value="definition.max_automation" :disabled="saving" @change="updateDefinitionAutomation(definition, ($event.target as HTMLSelectElement).value as 'none' | 'conditional')"><option value="none">{{ t('admin.shippingIdentityRules.automations.none') }}</option><option value="conditional">{{ t('admin.shippingIdentityRules.automations.conditional') }}</option></select>
|
||||
<div class="identity-definition-row__icon"><CollectionTag class="identity-ico" /></div>
|
||||
<div class="identity-definition-row__copy"><strong>{{ definition.display_name }}</strong><p>{{ definition.description || sourceDisplay(definition) }}</p></div>
|
||||
<el-tag type="info" size="small" effect="plain">{{ t(`admin.shippingIdentityRules.targets.${definition.target_type}`) }}</el-tag>
|
||||
<!-- 受控回显 + @change 即保存:保存失败时展示值自动回落到服务端快照 -->
|
||||
<el-select
|
||||
class="identity-automation-select"
|
||||
size="small"
|
||||
:model-value="definition.max_automation"
|
||||
:class="{ 'identity-automation--enabled': definition.max_automation === 'conditional' }"
|
||||
:disabled="saving"
|
||||
@change="(value) => updateDefinitionAutomation(definition, value)"
|
||||
>
|
||||
<el-option value="none" :label="t('admin.shippingIdentityRules.automations.none')" />
|
||||
<el-option value="conditional" :label="t('admin.shippingIdentityRules.automations.conditional')" />
|
||||
</el-select>
|
||||
</article>
|
||||
</div>
|
||||
<div v-else class="identity-empty"><Tags class="h-5 w-5" /><span>{{ t('admin.shippingIdentityRules.definitionHint') }}</span></div>
|
||||
<el-empty v-else class="identity-empty" :image-size="60" :description="t('admin.shippingIdentityRules.definitionHint')" />
|
||||
|
||||
<form class="identity-definition-form" @submit.prevent="saveDefinition">
|
||||
<div class="identity-form-title"><Plus class="h-4 w-4" /><strong>{{ t('admin.shippingIdentityRules.addDefinition') }}</strong></div>
|
||||
<el-form class="identity-definition-form" label-position="top" @submit.prevent="saveDefinition">
|
||||
<div class="identity-form-title"><Plus class="identity-ico" /><strong>{{ t('admin.shippingIdentityRules.addDefinition') }}</strong></div>
|
||||
<p class="identity-form-guide">{{ t('admin.shippingIdentityRules.formGuide') }}</p>
|
||||
<label><span>{{ t('admin.shippingIdentityRules.displayName') }}</span><input v-model="form.display_name" required class="input-field" :placeholder="t('admin.shippingIdentityRules.displayNamePlaceholder')"></label>
|
||||
<label><span>{{ t('admin.shippingIdentityRules.selectField') }}</span><select v-model="form.context_field_id" required class="input-field"><option value="">{{ t('admin.shippingIdentityRules.selectField') }}</option><option v-for="field in catalog?.context_fields" :key="field.field_id" :value="field.field_id">{{ field.display_name }}</option></select></label>
|
||||
<label><span>{{ t('admin.shippingIdentityRules.target') }}</span><select v-model="form.target_type" class="input-field"><option value="customer">{{ t('admin.shippingIdentityRules.targets.customer') }}</option><option value="site">{{ t('admin.shippingIdentityRules.targets.site') }}</option></select></label>
|
||||
<label><span>{{ t('admin.shippingIdentityRules.evidenceLabel') }}</span><input v-model="form.evidence_label" required class="input-field" :placeholder="t('admin.shippingIdentityRules.evidenceLabelPlaceholder')"></label>
|
||||
<label><span>{{ t('admin.shippingIdentityRules.description') }}</span><input v-model="form.description" class="input-field" :placeholder="t('admin.shippingIdentityRules.descriptionPlaceholder')"></label>
|
||||
<label><span class="identity-label-with-tip">{{ t('admin.shippingIdentityRules.automationPolicy') }}<CircleHelp class="identity-label-tip" :title="t('admin.shippingIdentityRules.automationPolicyHint')" :aria-label="t('admin.shippingIdentityRules.automationPolicyHint')" /></span><select v-model="form.max_automation" class="input-field"><option value="none">{{ t('admin.shippingIdentityRules.automations.none') }}</option><option value="conditional">{{ t('admin.shippingIdentityRules.automations.conditional') }}</option></select></label>
|
||||
<el-form-item :label="t('admin.shippingIdentityRules.displayName')">
|
||||
<el-input v-model="form.display_name" required :placeholder="t('admin.shippingIdentityRules.displayNamePlaceholder')" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('admin.shippingIdentityRules.selectField')">
|
||||
<el-select v-model="form.context_field_id">
|
||||
<el-option value="" :label="t('admin.shippingIdentityRules.selectField')" />
|
||||
<el-option v-for="field in catalog?.context_fields" :key="field.field_id" :value="field.field_id" :label="field.display_name" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('admin.shippingIdentityRules.target')">
|
||||
<el-select v-model="form.target_type">
|
||||
<el-option value="customer" :label="t('admin.shippingIdentityRules.targets.customer')" />
|
||||
<el-option value="site" :label="t('admin.shippingIdentityRules.targets.site')" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('admin.shippingIdentityRules.evidenceLabel')">
|
||||
<el-input v-model="form.evidence_label" required :placeholder="t('admin.shippingIdentityRules.evidenceLabelPlaceholder')" />
|
||||
</el-form-item>
|
||||
<el-form-item :label="t('admin.shippingIdentityRules.description')">
|
||||
<el-input v-model="form.description" :placeholder="t('admin.shippingIdentityRules.descriptionPlaceholder')" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<template #label>
|
||||
<span class="identity-label-with-tip">
|
||||
{{ t('admin.shippingIdentityRules.automationPolicy') }}
|
||||
<QuestionFilled class="identity-label-tip" :title="t('admin.shippingIdentityRules.automationPolicyHint')" :aria-label="t('admin.shippingIdentityRules.automationPolicyHint')" />
|
||||
</span>
|
||||
</template>
|
||||
<el-select v-model="form.max_automation">
|
||||
<el-option value="none" :label="t('admin.shippingIdentityRules.automations.none')" />
|
||||
<el-option value="conditional" :label="t('admin.shippingIdentityRules.automations.conditional')" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<div class="identity-source-help"><strong>{{ t('admin.shippingIdentityRules.selectionResult') }}</strong><span>{{ selectedSourceHint }}</span><small>{{ t(`admin.shippingIdentityRules.automations.${selectedAutomation}`) }}</small></div>
|
||||
<button type="submit" class="btn-primary identity-definition-form__submit" :disabled="saving || !form.context_field_id"><Plus class="h-4 w-4" />{{ t('admin.shippingIdentityRules.addDefinition') }}</button>
|
||||
</form>
|
||||
<el-button
|
||||
type="primary"
|
||||
native-type="submit"
|
||||
class="identity-definition-form__submit"
|
||||
:icon="Plus"
|
||||
:loading="saving"
|
||||
:disabled="saving || !form.context_field_id"
|
||||
>
|
||||
{{ t('admin.shippingIdentityRules.addDefinition') }}
|
||||
</el-button>
|
||||
</el-form>
|
||||
</section>
|
||||
|
||||
<aside class="identity-panel identity-panel--publication">
|
||||
<div class="identity-publication__header">
|
||||
<div class="identity-panel__eyebrow"><Layers3 class="h-4 w-4" />{{ t('admin.shippingIdentityRules.ruleSets') }}</div>
|
||||
<button type="button" class="btn-ghost btn-sm" :disabled="saving" @click="createDraft"><Plus class="h-4 w-4" />{{ t('admin.shippingIdentityRules.createDraft') }}</button>
|
||||
<div class="identity-panel__eyebrow"><Collection class="identity-ico" />{{ t('admin.shippingIdentityRules.ruleSets') }}</div>
|
||||
<el-button size="small" :icon="Plus" :disabled="saving" @click="createDraft">{{ t('admin.shippingIdentityRules.createDraft') }}</el-button>
|
||||
</div>
|
||||
<p class="identity-publication__hint">{{ t('admin.shippingIdentityRules.ruleSetHint') }}</p>
|
||||
|
||||
@@ -281,17 +357,20 @@ onMounted(() => { void load(); });
|
||||
|
||||
<div v-if="selectedRuleSet?.status === 'draft'" class="identity-selection">
|
||||
<div class="identity-selection__heading"><span>{{ t('admin.shippingIdentityRules.definitions') }}</span><strong>{{ selectedDefinitionCount }}/{{ activeDefinitions.length }}</strong></div>
|
||||
<label v-for="definition in activeDefinitions" :key="definition.id" class="identity-check-row">
|
||||
<input v-model="selectedDefinitionIds" type="checkbox" :value="definition.id"><span>{{ definition.display_name }}</span><small>{{ t(`admin.shippingIdentityRules.targets.${definition.target_type}`) }}</small>
|
||||
</label>
|
||||
<el-checkbox-group v-model="selectedDefinitionIds" class="identity-check-list">
|
||||
<el-checkbox v-for="definition in activeDefinitions" :key="definition.id" :value="definition.id" class="identity-check-row">
|
||||
<span class="identity-check-name">{{ definition.display_name }}</span>
|
||||
<small class="identity-check-target">{{ t(`admin.shippingIdentityRules.targets.${definition.target_type}`) }}</small>
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
<div v-else-if="selectedRuleSet" class="identity-published-definitions">
|
||||
<div class="identity-selection__heading"><span>{{ t('admin.shippingIdentityRules.publishedDefinitions') }}</span><strong>{{ selectedRuleSet.definition?.definitions.length || 0 }}</strong></div>
|
||||
<div v-if="selectedRuleSet.definition?.definitions.length" class="identity-published-definition-list">
|
||||
<div v-for="definition in selectedRuleSet.definition.definitions" :key="definition.id" class="identity-published-definition">
|
||||
<div><strong>{{ definition.display_name }}</strong><small>{{ definition.context_field?.display_name || definition.context_field?.field_code || '-' }}</small></div>
|
||||
<span class="identity-target">{{ t(`admin.shippingIdentityRules.targets.${definition.target_type}`) }}</span>
|
||||
<span class="identity-automation" :class="{ 'identity-automation--enabled': definition.max_automation === 'conditional' }">{{ t(`admin.shippingIdentityRules.automations.${definition.max_automation}`) }}</span>
|
||||
<div class="identity-published-definition__copy"><strong>{{ definition.display_name }}</strong><small>{{ definition.context_field?.display_name || definition.context_field?.field_code || '-' }}</small></div>
|
||||
<el-tag type="info" size="small" effect="plain">{{ t(`admin.shippingIdentityRules.targets.${definition.target_type}`) }}</el-tag>
|
||||
<el-tag :type="definition.max_automation === 'conditional' ? 'success' : 'info'" size="small">{{ t(`admin.shippingIdentityRules.automations.${definition.max_automation}`) }}</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<p v-else class="identity-published-empty">{{ t('admin.shippingIdentityRules.publishedDefinitionsEmpty') }}</p>
|
||||
@@ -299,10 +378,18 @@ onMounted(() => { void load(); });
|
||||
|
||||
<div v-if="selectedRuleSet" class="identity-publication__actions">
|
||||
<template v-if="selectedRuleSet.status === 'draft'">
|
||||
<button type="button" class="btn-ghost" :disabled="saving || !selectedDefinitionCount" @click="saveDraft"><FileCheck2 class="h-4 w-4" />{{ t('admin.shippingIdentityRules.saveDraft') }}</button>
|
||||
<button type="button" class="btn-primary" :disabled="saving || !selectedDefinitionCount" @click="publishDraft"><Send class="h-4 w-4" />{{ t('admin.shippingIdentityRules.publish') }}</button>
|
||||
<el-button size="small" :icon="DocumentChecked" :disabled="saving || !selectedDefinitionCount" @click="saveDraft">{{ t('admin.shippingIdentityRules.saveDraft') }}</el-button>
|
||||
<el-button type="primary" size="small" :icon="Promotion" :loading="saving" :disabled="saving || !selectedDefinitionCount" @click="publishDraft">{{ t('admin.shippingIdentityRules.publish') }}</el-button>
|
||||
</template>
|
||||
<div v-else class="identity-published"><Check class="h-4 w-4" /><span>{{ t('admin.shippingIdentityRules.status.published') }}</span><code>{{ selectedRuleSet.checksum || '-' }}</code></div>
|
||||
<el-alert v-else type="success" :closable="false" class="identity-published">
|
||||
<template #title>
|
||||
<span class="identity-published__line">
|
||||
<Check class="identity-ico" />
|
||||
<span>{{ t('admin.shippingIdentityRules.status.published') }}</span>
|
||||
<code>{{ selectedRuleSet.checksum || '-' }}</code>
|
||||
</span>
|
||||
</template>
|
||||
</el-alert>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
@@ -310,79 +397,97 @@ onMounted(() => { void load(); });
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.identity-rules-page { max-width: 1380px; margin: 0 auto; display: grid; gap: 1.25rem; color: #183253; }
|
||||
/* 全宽布局:水平内边距与居中由 AdminLayout 壳层统一持有,页面只保留内部块间距 */
|
||||
.identity-rules-page {
|
||||
display: grid;
|
||||
gap: 1.25rem;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.identity-ico {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.identity-hero { display: flex; align-items: end; justify-content: space-between; gap: 2rem; padding: .5rem .25rem .75rem; }
|
||||
.identity-panel__eyebrow { display: flex; align-items: center; gap: .45rem; color: #475569; font-size: .76rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
|
||||
.identity-hero h1 { margin: 0; }
|
||||
.identity-hero p { max-width: 760px; }
|
||||
.page-title { margin: 0; font-size: 20px; font-weight: 700; }
|
||||
.page-desc { margin: 4px 0 0; max-width: 760px; color: var(--el-text-color-secondary); font-size: 13px; line-height: 1.55; }
|
||||
.identity-panel__eyebrow { display: flex; align-items: center; gap: .45rem; color: var(--el-text-color-secondary); font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
|
||||
.identity-hero__meta { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; justify-content: flex-end; }
|
||||
/* 状态/品牌色统一 Tailwind 标准语义值(brand=sky 系 #0284c7、启用=green、草稿=amber),不再使用自造蓝绿 */
|
||||
.identity-hero__status { display: inline-flex; align-items: center; gap: .48rem; padding: .5rem .75rem; border: 1px solid #bae6fd; border-radius: 999px; background: #f0f9ff; color: #0369a1; font-size: .78rem; font-weight: 700; white-space: nowrap; }
|
||||
.identity-pulse { width: .5rem; height: .5rem; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 4px #d1fae5; }.identity-pulse--draft { background: #f59e0b; box-shadow: 0 0 0 4px #fef3c7; }
|
||||
.identity-hero__link { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
|
||||
.identity-flow { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; padding: 1rem; overflow: hidden; border: 1px solid #dce9f2; border-radius: 1rem; background: linear-gradient(105deg, #f4fbff, #fff); }
|
||||
.identity-flow__rail { position: absolute; top: 1.84rem; left: 12%; right: 12%; height: 1px; background: #cce5f2; }
|
||||
/* 状态色统一走 EP 语义变量(品牌=primary 系、已发布=success、草稿=warning) */
|
||||
.identity-hero__status { display: inline-flex; align-items: center; gap: .48rem; padding: .5rem .75rem; border: 1px solid var(--el-color-primary-light-7); border-radius: 999px; background: var(--el-color-primary-light-9); color: var(--el-color-primary-dark-2); font-size: 12px; font-weight: 700; white-space: nowrap; }
|
||||
.identity-pulse { width: .5rem; height: .5rem; border-radius: 50%; background: var(--el-color-success); box-shadow: 0 0 0 4px var(--el-color-success-light-8); }
|
||||
.identity-pulse--draft { background: var(--el-color-warning); box-shadow: 0 0 0 4px var(--el-color-warning-light-8); }
|
||||
.identity-hero__link-icon { margin-left: 4px; }
|
||||
.identity-flow { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; padding: 1rem; overflow: hidden; border: 1px solid var(--el-border-color-lighter); border-radius: 1rem; background: linear-gradient(105deg, var(--el-color-primary-light-9), var(--el-bg-color)); }
|
||||
.identity-flow__rail { position: absolute; top: 1.84rem; left: 12%; right: 12%; height: 1px; background: var(--el-border-color-light); }
|
||||
.identity-flow__step { position: relative; z-index: 1; display: flex; gap: .75rem; align-items: flex-start; min-width: 0; }
|
||||
.identity-flow__step > span { display: grid; place-items: center; flex: 0 0 1.65rem; height: 1.65rem; border: 1px solid #b9d8e8; border-radius: 50%; background: #fff; color: #6b8298; font-size: .66rem; font-weight: 800; }
|
||||
.identity-flow__step--active > span { border-color: #0284c7; background: #0284c7; color: #fff; box-shadow: 0 0 0 4px #e0f2fe; }
|
||||
.identity-flow strong { display: block; color: #193652; font-size: .82rem; font-weight: 800; }
|
||||
.identity-flow small { display: -webkit-box; overflow: hidden; margin-top: .15rem; color: #7a8fa6; font-size: .72rem; line-height: 1.45; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
|
||||
.identity-loading { display: flex; align-items: center; gap: .5rem; padding: 2rem; color: #6f839b; font-size: .9rem; }
|
||||
.identity-flow__step > span { display: grid; place-items: center; flex: 0 0 1.65rem; height: 1.65rem; border: 1px solid var(--el-border-color-light); border-radius: 50%; background: var(--el-bg-color); color: var(--el-text-color-secondary); font-size: 12px; font-weight: 700; }
|
||||
.identity-flow__step--active > span { border-color: var(--el-color-primary); background: var(--el-color-primary); color: var(--el-color-white); box-shadow: 0 0 0 4px var(--el-color-primary-light-8); }
|
||||
.identity-flow strong { display: block; color: var(--el-text-color-primary); font-size: 13px; font-weight: 700; }
|
||||
.identity-flow small { display: -webkit-box; overflow: hidden; margin-top: .15rem; color: var(--el-text-color-secondary); font-size: 12px; line-height: 1.45; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
|
||||
.identity-loading { padding: 2rem; }
|
||||
.identity-workbench { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .8fr); gap: 1.25rem; align-items: start; }
|
||||
.identity-panel { border: 1px solid #dce8f0; border-radius: 1rem; background: #fff; box-shadow: 0 10px 28px rgba(32, 78, 114, .055); }
|
||||
.identity-panel { border: 1px solid var(--el-border-color-light); border-radius: 1rem; background: var(--el-bg-color); box-shadow: var(--el-box-shadow-lighter); }
|
||||
.identity-panel--definitions { overflow: hidden; }
|
||||
.identity-panel__heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; padding: 1.25rem 1.35rem 1rem; border-bottom: 1px solid #edf3f7; }
|
||||
.identity-panel__heading h3 { margin: .2rem 0 0; color: #12395a; font-size: 2rem; font-weight: 800; line-height: 1; }
|
||||
.identity-panel__heading > p { max-width: 28rem; color: #71879e; font-size: .78rem; line-height: 1.55; text-align: right; }
|
||||
.identity-panel__heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; padding: 1.25rem 1.35rem 1rem; border-bottom: 1px solid var(--el-border-color-lighter); }
|
||||
.identity-panel__heading h3 { margin: .2rem 0 0; color: var(--el-text-color-primary); font-size: 2rem; font-weight: 700; line-height: 1; }
|
||||
.identity-panel__heading > p { max-width: 28rem; color: var(--el-text-color-secondary); font-size: 12px; line-height: 1.55; text-align: right; }
|
||||
.identity-definition-list { display: grid; }
|
||||
.identity-definition-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: .75rem; align-items: center; padding: .78rem 1.35rem; border-bottom: 1px solid #edf3f7; transition: background .18s ease; }
|
||||
.identity-definition-row:hover { background: #f7fbfd; }
|
||||
.identity-definition-row__icon { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: .6rem; background: #f0f9ff; color: #0284c7; }
|
||||
.identity-definition-row strong { color: #1a3856; font-size: .86rem; font-weight: 750; }
|
||||
.identity-definition-row p { overflow: hidden; margin-top: .18rem; color: #8194a8; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.identity-target, .identity-automation { padding: .32rem .52rem; border-radius: 999px; background: #f1f5f8; color: #677f98; font-size: .7rem; white-space: nowrap; }
|
||||
.identity-automation-select { border: 1px solid #dce8ef; cursor: pointer; }
|
||||
.identity-automation--enabled { background: #dcfce7; color: #15803d; }
|
||||
.identity-empty { display: flex; align-items: center; gap: .55rem; min-height: 5.5rem; padding: 1.2rem 1.35rem; color: #7c91a7; font-size: .82rem; }
|
||||
.identity-definition-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; padding: 1.1rem 1.35rem 1.35rem; background: linear-gradient(135deg, #f7fbfd 0%, #f3f9fc 100%); }
|
||||
.identity-form-title { grid-column: 1 / -1; display: flex; align-items: center; gap: .42rem; color: #173857; font-size: .85rem; }
|
||||
.identity-form-guide { grid-column: 1 / -1; margin: -.45rem 0 .1rem; color: #73889e; font-size: .75rem; line-height: 1.55; }
|
||||
.identity-definition-form label { display: grid; gap: .35rem; color: #667f99; font-size: .72rem; font-weight: 700; }
|
||||
.identity-definition-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: .75rem; align-items: center; padding: .78rem 1.35rem; border-bottom: 1px solid var(--el-border-color-lighter); transition: background .18s ease; }
|
||||
.identity-definition-row:hover { background: var(--el-fill-color-light); }
|
||||
.identity-definition-row__icon { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: .6rem; background: var(--el-color-primary-light-9); color: var(--el-color-primary); }
|
||||
.identity-definition-row__copy { min-width: 0; }
|
||||
.identity-definition-row strong { color: var(--el-text-color-primary); font-size: 13px; font-weight: 700; }
|
||||
.identity-definition-row p { overflow: hidden; margin-top: .18rem; color: var(--el-text-color-secondary); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
|
||||
/* 自动化授权下拉:conditional 时以成功色底提示,固定宽度避免挤压行 */
|
||||
.identity-automation-select { width: 128px; }
|
||||
.identity-automation-select :deep(.el-select__wrapper) { min-height: 28px; }
|
||||
.identity-automation--enabled :deep(.el-select__wrapper) { background: var(--el-color-success-light-9); }
|
||||
.identity-empty { padding: .6rem 0; }
|
||||
.identity-definition-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem 1rem; padding: 1.1rem 1.35rem 1.35rem; border-top: 1px solid var(--el-border-color-lighter); background: var(--el-fill-color-lighter); }
|
||||
.identity-form-title { grid-column: 1 / -1; display: flex; align-items: center; gap: .42rem; color: var(--el-text-color-primary); font-size: 13px; }
|
||||
.identity-form-guide { grid-column: 1 / -1; margin: 0; color: var(--el-text-color-secondary); font-size: 12px; line-height: 1.55; }
|
||||
.identity-definition-form :deep(.el-form-item) { margin-bottom: 0; }
|
||||
.identity-definition-form :deep(.el-form-item__label) { margin-bottom: 4px; color: var(--el-text-color-secondary); font-size: 12px; font-weight: 700; line-height: 1.35; }
|
||||
.identity-label-with-tip { display: inline-flex; align-items: center; gap: .28rem; }
|
||||
.identity-label-tip { width: .9rem; height: .9rem; color: #7d93a8; cursor: help; }
|
||||
.identity-label-tip:focus-visible { border-radius: 50%; outline: 2px solid #7dd3fc; outline-offset: 2px; }
|
||||
.identity-definition-form label small { color: #8295a8; font-size: .67rem; font-weight: 500; line-height: 1.35; }
|
||||
.identity-definition-form .input-field, .identity-static-field { box-sizing: border-box; min-width: 0; height: 2.75rem; padding: 0 .8rem; border-color: #d9e7ef; background: #fff; font-size: .83rem; line-height: 1.25; }
|
||||
.identity-definition-form select.input-field { padding-top: 0; padding-bottom: 0; line-height: 2.75rem; }
|
||||
.identity-static-field { display: flex; align-items: center; padding: 0 .8rem; border: 1px solid #d9e7ef; border-radius: .65rem; color: #5f7893; }
|
||||
.identity-source-help { display: grid; align-content: center; gap: .12rem; min-height: 2.75rem; padding: .48rem .7rem; border: 1px solid #d6eaf5; border-radius: .65rem; background: #edf8fe; color: #537189; font-size: .69rem; line-height: 1.35; }
|
||||
.identity-source-help strong { color: #0369a1; font-size: .72rem; }.identity-source-help small { color: #16a34a; font-size: .68rem; }
|
||||
.identity-definition-form__submit { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; align-self: end; min-height: 2.5rem; }
|
||||
.identity-label-tip { width: 14px; height: 14px; color: var(--el-text-color-placeholder); cursor: help; }
|
||||
.identity-source-help { grid-column: 1 / span 2; display: grid; align-content: center; gap: .12rem; min-height: 2.75rem; padding: .48rem .7rem; border: 1px solid var(--el-color-primary-light-8); border-radius: 8px; background: var(--el-color-primary-light-9); color: var(--el-text-color-regular); font-size: 12px; line-height: 1.35; }
|
||||
.identity-source-help strong { color: var(--el-color-primary-dark-2); font-size: 12px; }
|
||||
.identity-source-help small { color: var(--el-color-success); font-size: 12px; }
|
||||
.identity-definition-form__submit { grid-column: 3; align-self: end; min-height: 2.5rem; }
|
||||
.identity-panel--publication { position: sticky; top: 1rem; padding: 1.25rem; }
|
||||
.identity-publication__header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
|
||||
.identity-publication__header .btn-ghost, .identity-publication__actions button { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
|
||||
.identity-publication__hint { margin: .75rem 0 1rem; color: #75899f; font-size: .78rem; line-height: 1.6; }
|
||||
.identity-version-list { display: flex; flex-wrap: wrap; gap: .5rem; padding-bottom: 1rem; border-bottom: 1px solid #e9f0f4; }
|
||||
.identity-version { display: inline-flex; align-items: center; gap: .35rem; padding: .46rem .6rem; border: 1px solid #dbe7ee; border-radius: .6rem; background: #fff; color: #668099; font-size: .73rem; transition: all .18s ease; }
|
||||
.identity-version:hover, .identity-version--selected { border-color: #0284c7; background: #f0f9ff; color: #0369a1; }
|
||||
.identity-version span { font-weight: 800; }.identity-version small { font-size: .68rem; }
|
||||
.identity-publication__hint { margin: .75rem 0 1rem; color: var(--el-text-color-secondary); font-size: 12px; line-height: 1.6; }
|
||||
.identity-version-list { display: flex; flex-wrap: wrap; gap: .5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--el-border-color-lighter); }
|
||||
.identity-version { display: inline-flex; align-items: center; gap: .35rem; padding: .46rem .6rem; border: 1px solid var(--el-border-color-light); border-radius: 8px; background: var(--el-bg-color); color: var(--el-text-color-regular); font-size: 12px; cursor: pointer; transition: all .18s ease; }
|
||||
.identity-version:hover, .identity-version--selected { border-color: var(--el-color-primary); background: var(--el-color-primary-light-9); color: var(--el-color-primary-dark-2); }
|
||||
.identity-version span { font-weight: 700; }
|
||||
.identity-version small { font-size: 12px; }
|
||||
.identity-selection { margin: 1rem 0; }
|
||||
.identity-selection__heading { display: flex; justify-content: space-between; margin-bottom: .6rem; color: var(--el-text-color-primary); font-size: 12px; font-weight: 700; }
|
||||
.identity-selection__heading strong { color: var(--el-color-primary); }
|
||||
.identity-check-list { display: grid; }
|
||||
.identity-check-row { width: 100%; height: auto; margin-right: 0; padding: .54rem 0; border-bottom: 1px dashed var(--el-border-color-lighter); }
|
||||
.identity-check-row :deep(.el-checkbox__label) { display: flex; flex: 1; align-items: baseline; justify-content: space-between; gap: .5rem; min-width: 0; }
|
||||
.identity-check-name { overflow: hidden; color: var(--el-text-color-regular); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.identity-check-target { flex: none; color: var(--el-text-color-secondary); font-size: 12px; }
|
||||
.identity-published-definitions { margin: 1rem 0; }
|
||||
.identity-published-definition-list { display: grid; gap: .45rem; }
|
||||
.identity-published-definition { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .5rem; align-items: center; padding: .58rem .65rem; border: 1px solid #e5eef3; border-radius: .6rem; background: #fbfdfe; }
|
||||
.identity-published-definition { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .5rem; align-items: center; padding: .58rem .65rem; border: 1px solid var(--el-border-color-lighter); border-radius: 8px; background: var(--el-fill-color-lighter); }
|
||||
.identity-published-definition__copy { min-width: 0; }
|
||||
.identity-published-definition strong, .identity-published-definition small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.identity-published-definition strong { color: #294660; font-size: .76rem; }
|
||||
.identity-published-definition small { margin-top: .15rem; color: #8194a8; font-size: .68rem; }
|
||||
.identity-published-empty { margin: 0; color: #8194a8; font-size: .76rem; }
|
||||
.identity-selection__heading { display: flex; justify-content: space-between; margin-bottom: .6rem; color: #274563; font-size: .78rem; font-weight: 750; }
|
||||
.identity-selection__heading strong { color: #0284c7; }
|
||||
.identity-check-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .5rem; padding: .54rem 0; border-bottom: 1px dashed #e2ebf1; color: #37516c; font-size: .78rem; }
|
||||
/* @tailwindcss/forms 接管原生 checkbox 后 accent-color 无效:勾选填充取 currentColor,用 color 指定选中蓝 */
|
||||
.identity-check-row input { color: #0284c7; }.identity-check-row small { color: #8496a8; font-size: .68rem; }
|
||||
.identity-published-definition strong { color: var(--el-text-color-primary); font-size: 12px; }
|
||||
.identity-published-definition small { margin-top: .15rem; color: var(--el-text-color-secondary); font-size: 12px; }
|
||||
.identity-published-empty { margin: 0; color: var(--el-text-color-secondary); font-size: 12px; }
|
||||
.identity-publication__actions { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem; padding-top: 1rem; }
|
||||
.identity-publication__actions .btn-primary, .identity-publication__actions .btn-ghost { min-width: 0; font-size: .79rem; }
|
||||
.identity-published { grid-column: 1 / -1; display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: .45rem; padding: .7rem; border-radius: .65rem; background: #dcfce7; color: #15803d; font-size: .78rem; font-weight: 700; }.identity-published code { overflow: hidden; color: #16a34a; font-size: .67rem; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.identity-publication__actions .el-button { min-width: 0; }
|
||||
.identity-publication__actions .el-button + .el-button { margin-left: 0; }
|
||||
.identity-published { grid-column: 1 / -1; }
|
||||
.identity-published__line { display: flex; align-items: center; gap: .45rem; min-width: 0; font-size: 12px; }
|
||||
.identity-published__line code { flex: 1; overflow: hidden; text-align: right; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
|
||||
@media (max-width: 980px) { .identity-workbench { grid-template-columns: 1fr; }.identity-panel--publication { position: static; }.identity-hero { align-items: flex-start; flex-direction: column; gap: .85rem; }.identity-hero__meta { justify-content: flex-start; }.identity-flow__rail { display: none; } }
|
||||
@media (max-width: 700px) { .identity-rules-page { gap: 1rem; }.identity-flow { grid-template-columns: 1fr; }.identity-definition-form { grid-template-columns: 1fr; }.identity-definition-row { grid-template-columns: auto minmax(0, 1fr); }.identity-target, .identity-automation { justify-self: start; }.identity-panel__heading { align-items: flex-start; flex-direction: column; }.identity-panel__heading > p { text-align: left; }.identity-definition-row__icon { grid-row: span 2; }.identity-publication__actions { grid-template-columns: 1fr; } }
|
||||
@media (max-width: 700px) { .identity-rules-page { gap: 1rem; }.identity-flow { grid-template-columns: 1fr; }.identity-definition-form { grid-template-columns: 1fr; }.identity-source-help, .identity-definition-form__submit { grid-column: auto; }.identity-definition-row { grid-template-columns: auto minmax(0, 1fr); }.identity-definition-row .el-tag, .identity-definition-row .identity-automation-select { justify-self: start; }.identity-panel__heading { align-items: flex-start; flex-direction: column; }.identity-panel__heading > p { text-align: left; }.identity-definition-row__icon { grid-row: span 2; }.identity-publication__actions { grid-template-columns: 1fr; } }
|
||||
@media (prefers-reduced-motion: reduce) { .identity-definition-row, .identity-version { transition: none; } }
|
||||
</style>
|
||||
+429
-310
File diff suppressed because it is too large.
Load diff
+138
-38
@@ -1,16 +1,33 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/OrderProfileBlindTestPage.vue
|
||||
用途:维护订单模板草稿的独立盲测证据,并完成执行和批准。
|
||||
依赖:盲测 API、Profile 详情、Vue Router、统一业务错误提示和四语言文案。
|
||||
依赖:element-plus(el-select/el-checkbox/el-input/el-descriptions/el-tag/el-skeleton,
|
||||
沿用管理端 element-trial 主题)、盲测 API、Profile 详情、Vue Router、统一业务错误提示和四语言文案。
|
||||
逻辑:验证页进入本页;所有模板按统一视觉表候选和字段证据复核;
|
||||
末端值源差异由服务端 adapter 投影,管理员复核后写入真值,再执行并批准;
|
||||
XFA 以 datasets 为正式值:OCR 对照与视觉/镜像指标仅 soft 诊断,不硬拦;
|
||||
业务错误优先用扁平 errors key 翻译,并附带服务端 message 便于定位。
|
||||
视觉层已迁移 Element Plus;文件上传 label 保留原生 input[type=file](事件契约不变)。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import {
|
||||
ElButton,
|
||||
ElCheckbox,
|
||||
ElDescriptions,
|
||||
ElDescriptionsItem,
|
||||
ElInput,
|
||||
ElOption,
|
||||
ElSelect,
|
||||
ElSkeleton,
|
||||
ElTag,
|
||||
} from 'element-plus';
|
||||
import { Refresh } from '@element-plus/icons-vue';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { createRandomUuid } from '@/shared/utils/id';
|
||||
@@ -518,21 +535,31 @@ onBeforeUnmount(() => {
|
||||
<h1 class="section-title">{{ t('admin.shippingOrderProfiles.blindTest.title') }}</h1>
|
||||
<p class="section-desc mt-1">{{ t('admin.shippingOrderProfiles.blindTest.reviewHint') }}</p>
|
||||
</div>
|
||||
<div class="actions"><button type="button" class="btn-secondary" @click="backToValidation">{{ t('admin.shippingOrderProfiles.blindTest.backToValidation') }}</button><button v-if="suite?.status === 'approved'" type="button" class="btn-primary" @click="goToPublishCheck">{{ t('admin.shippingOrderProfiles.blindTest.goPublishCheck') }}</button></div>
|
||||
<div class="actions">
|
||||
<el-button @click="backToValidation">{{ t('admin.shippingOrderProfiles.blindTest.backToValidation') }}</el-button>
|
||||
<el-button v-if="suite?.status === 'approved'" type="primary" @click="goToPublishCheck">{{ t('admin.shippingOrderProfiles.blindTest.goPublishCheck') }}</el-button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<p v-if="loading">{{ t('admin.orderProfileValidation.loading') }}</p>
|
||||
<el-skeleton v-if="loading" :rows="4" animated />
|
||||
<template v-else-if="suite">
|
||||
<section class="card suite-summary"><div><h2>{{ t('admin.shippingOrderProfiles.blindTest.samples', { count: suite.sample_count, required: 1, status: t(`admin.shippingOrderProfiles.versionCenter.testStatus.${suite.status}`) }) }}</h2><p v-if="suite.latest_run">{{ t('admin.shippingOrderProfiles.blindTest.latestResult', { status: suite.latest_run.status, passed: suite.latest_run.passed_sample_count, count: suite.latest_run.sample_count }) }}</p><p v-else>{{ t('admin.shippingOrderProfiles.blindTest.notRun') }}</p></div><span :class="`status ${suite.status}`">{{ t(`admin.shippingOrderProfiles.versionCenter.testStatus.${suite.status}`) }}</span></section>
|
||||
<section class="card suite-summary">
|
||||
<div class="suite-summary__head">
|
||||
<h2>{{ t('admin.shippingOrderProfiles.blindTest.samples', { count: suite.sample_count, required: 1 }) }}</h2>
|
||||
<el-tag size="small" :type="suite.status === 'approved' ? 'success' : suite.status === 'superseded' ? 'danger' : 'warning'">{{ t(`admin.shippingOrderProfiles.versionCenter.testStatus.${suite.status}`) }}</el-tag>
|
||||
</div>
|
||||
<p v-if="suite.latest_run">{{ t('admin.shippingOrderProfiles.blindTest.latestResult', { status: suite.latest_run.status, passed: suite.latest_run.passed_sample_count, count: suite.latest_run.sample_count }) }}</p>
|
||||
<p v-else>{{ t('admin.shippingOrderProfiles.blindTest.notRun') }}</p>
|
||||
</section>
|
||||
|
||||
<section v-if="suite.latest_run?.metrics" class="card metrics-card">
|
||||
<h2>{{ t('admin.shippingOrderProfiles.blindTest.metricsTitle') }}</h2>
|
||||
<dl class="metrics">
|
||||
<div><dt>{{ t('admin.shippingOrderProfiles.blindTest.visualCoverage') }}</dt><dd>{{ formatMetricRate(suite.latest_run.metrics.visual_coverage_rate) }}</dd></div>
|
||||
<div><dt>{{ t('admin.shippingOrderProfiles.blindTest.evidenceRetention') }}</dt><dd>{{ formatMetricRate(suite.latest_run.metrics.evidence_retention_rate) }}</dd></div>
|
||||
<div><dt>{{ t('admin.shippingOrderProfiles.blindTest.mirrorConsistency') }}</dt><dd>{{ formatMetricRate(suite.latest_run.metrics.mirror_consistency_rate) }}</dd></div>
|
||||
<div><dt>{{ t('admin.shippingOrderProfiles.blindTest.keyFieldAccuracy') }}</dt><dd>{{ formatMetricRate(suite.latest_run.metrics.key_field_accuracy_rate) }}</dd></div>
|
||||
</dl>
|
||||
<el-descriptions class="metrics" :column="2" size="small">
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.blindTest.visualCoverage')">{{ formatMetricRate(suite.latest_run.metrics.visual_coverage_rate) }}</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.blindTest.evidenceRetention')">{{ formatMetricRate(suite.latest_run.metrics.evidence_retention_rate) }}</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.blindTest.mirrorConsistency')">{{ formatMetricRate(suite.latest_run.metrics.mirror_consistency_rate) }}</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.blindTest.keyFieldAccuracy')">{{ formatMetricRate(suite.latest_run.metrics.key_field_accuracy_rate) }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</section>
|
||||
|
||||
<section v-if="failureDetails.length" class="card failure-details">
|
||||
@@ -551,9 +578,35 @@ onBeforeUnmount(() => {
|
||||
</section>
|
||||
|
||||
<section v-if="suite.status === 'draft'" class="card">
|
||||
<div class="sample-heading"><h2>{{ t('admin.shippingOrderProfiles.blindTest.selectIndependentSample') }}</h2><label class="btn-secondary upload-sample"><input type="file" accept=".pdf,.eml,application/pdf,message/rfc822" :disabled="uploadingSample" @change="uploadIndependentSample"><span>{{ uploadingSample ? t('admin.shippingOrderProfiles.wizard.uploading') : t('admin.shippingOrderProfiles.blindTest.uploadSample') }}</span></label></div>
|
||||
<div class="sample-heading">
|
||||
<h2>{{ t('admin.shippingOrderProfiles.blindTest.selectIndependentSample') }}</h2>
|
||||
<!-- 保留原生 input[type=file]:uploadIndependentSample 依赖原生 change 事件契约 -->
|
||||
<label class="upload-sample"><input type="file" accept=".pdf,.eml,application/pdf,message/rfc822" :disabled="uploadingSample" @change="uploadIndependentSample"><span>{{ uploadingSample ? t('admin.shippingOrderProfiles.wizard.uploading') : t('admin.shippingOrderProfiles.blindTest.uploadSample') }}</span></label>
|
||||
</div>
|
||||
<p v-if="availableSamplesLoaded && !availableSamples.length">{{ t('admin.shippingOrderProfiles.blindTest.noIndependentSamples') }}</p>
|
||||
<div class="sample-picker"><button v-if="!availableSamplesLoaded" type="button" class="btn-secondary" :disabled="availableSamplesLoading" @click="() => void loadAvailableSamples()">{{ availableSamplesLoading ? t('admin.shippingOrderProfiles.blindTest.loadingIndependentSamples') : t('admin.shippingOrderProfiles.blindTest.loadIndependentSamples') }}</button><template v-else-if="availableSamples.length"><select v-model="selectedSampleKey" class="select-field"><option value="">{{ t('admin.shippingOrderProfiles.blindTest.selectSamplePlaceholder') }}</option><option v-for="sample in availableSamples" :key="`${sample.document_id}:${sample.table_id}`" :value="`${sample.document_id}:${sample.table_id}`">{{ sampleLabel(sample) }}</option></select><button v-if="selectedSample?.review_mode === 'preparing'" type="button" class="btn-primary" :disabled="working" @click="reprocessSelectedSample">{{ t('admin.shippingOrderProfiles.blindTest.reprocessLayout') }}</button><button v-else type="button" class="btn-primary" :disabled="!selectedSample || working" @click="previewSample">{{ selectedSample?.review_mode === 'diagnostic' ? t('admin.shippingOrderProfiles.blindTest.viewDiagnostic') : t('admin.shippingOrderProfiles.blindTest.previewAndReview') }}</button><button type="button" class="btn-secondary" :disabled="availableSamplesLoading || working" @click="() => void loadAvailableSamples(true)">{{ t('admin.shippingOrderProfiles.blindTest.refreshSamples') }}</button></template></div>
|
||||
<div class="sample-picker">
|
||||
<el-button v-if="!availableSamplesLoaded" :disabled="availableSamplesLoading" :loading="availableSamplesLoading" @click="() => void loadAvailableSamples()">{{ availableSamplesLoading ? t('admin.shippingOrderProfiles.blindTest.loadingIndependentSamples') : t('admin.shippingOrderProfiles.blindTest.loadIndependentSamples') }}</el-button>
|
||||
<template v-else-if="availableSamples.length">
|
||||
<el-select
|
||||
v-model="selectedSampleKey"
|
||||
clearable
|
||||
fit-input-width
|
||||
:popper-options="{ strategy: 'fixed' }"
|
||||
:placeholder="t('admin.shippingOrderProfiles.blindTest.selectSamplePlaceholder')"
|
||||
>
|
||||
<el-option value="" :label="t('admin.shippingOrderProfiles.blindTest.selectSamplePlaceholder')" />
|
||||
<el-option
|
||||
v-for="sample in availableSamples"
|
||||
:key="`${sample.document_id}:${sample.table_id}`"
|
||||
:value="`${sample.document_id}:${sample.table_id}`"
|
||||
:label="sampleLabel(sample)"
|
||||
/>
|
||||
</el-select>
|
||||
<el-button v-if="selectedSample?.review_mode === 'preparing'" type="primary" :disabled="working" :loading="working" @click="reprocessSelectedSample">{{ t('admin.shippingOrderProfiles.blindTest.reprocessLayout') }}</el-button>
|
||||
<el-button v-else type="primary" :disabled="!selectedSample || working" :loading="working" @click="previewSample">{{ selectedSample?.review_mode === 'diagnostic' ? t('admin.shippingOrderProfiles.blindTest.viewDiagnostic') : t('admin.shippingOrderProfiles.blindTest.previewAndReview') }}</el-button>
|
||||
<el-button :icon="Refresh" :disabled="availableSamplesLoading || working" :loading="availableSamplesLoading" @click="() => void loadAvailableSamples(true)">{{ t('admin.shippingOrderProfiles.blindTest.refreshSamples') }}</el-button>
|
||||
</template>
|
||||
</div>
|
||||
<p v-if="pendingUpload" class="upload-status" :class="{ failed: pendingUpload.state === 'failed' }">{{ pendingUpload.filename }} · {{ pendingUpload.state === 'materializing' ? t('admin.shippingOrderProfiles.blindTest.sampleMaterializing') : sampleFailureMessage() }}</p>
|
||||
</section>
|
||||
|
||||
@@ -580,46 +633,93 @@ onBeforeUnmount(() => {
|
||||
<article v-for="(row, index) in candidate.rows" :key="index" class="review-item">
|
||||
<template v-if="rowReviews[index]">
|
||||
<h3>{{ t('admin.shippingOrderProfiles.blindTest.row', { index: index + 1 }) }}</h3><code>{{ JSON.stringify(row) }}</code>
|
||||
<label><input v-model="rowReviews[index].correct" type="checkbox">{{ t('admin.shippingOrderProfiles.blindTest.correct') }}</label>
|
||||
<textarea v-if="!rowReviews[index].correct" v-model="rowReviews[index].correction" class="input-field" :placeholder="t('admin.shippingOrderProfiles.blindTest.expectedRowsPlaceholder')" />
|
||||
<el-checkbox v-model="rowReviews[index].correct">{{ t('admin.shippingOrderProfiles.blindTest.correct') }}</el-checkbox>
|
||||
<el-input
|
||||
v-if="!rowReviews[index].correct"
|
||||
v-model="rowReviews[index].correction"
|
||||
type="textarea"
|
||||
:rows="3"
|
||||
class="correction-input"
|
||||
:placeholder="t('admin.shippingOrderProfiles.blindTest.expectedRowsPlaceholder')"
|
||||
/>
|
||||
</template>
|
||||
</article>
|
||||
<article v-for="field in candidate.order_fields" :key="field.field_id" class="review-item">
|
||||
<h3>{{ field.field_code }}</h3><code>{{ field.value ?? t('admin.shippingOrderProfiles.emptyCandidateValue') }}</code>
|
||||
<label><input :checked="orderFieldReview(orderFieldKey(field)).correct" type="checkbox" @change="updateOrderFieldReview(orderFieldKey(field), { correct: ($event.target as HTMLInputElement).checked })">{{ t('admin.shippingOrderProfiles.blindTest.correct') }}</label>
|
||||
<input v-if="!orderFieldReview(orderFieldKey(field)).correct" class="input-field" :value="orderFieldReview(orderFieldKey(field)).value" :placeholder="t('admin.shippingOrderProfiles.blindTest.correctedValue')" @input="updateOrderFieldReview(orderFieldKey(field), { value: ($event.target as HTMLInputElement).value })">
|
||||
<el-checkbox
|
||||
:model-value="orderFieldReview(orderFieldKey(field)).correct"
|
||||
@update:model-value="(checked) => updateOrderFieldReview(orderFieldKey(field), { correct: Boolean(checked) })"
|
||||
>{{ t('admin.shippingOrderProfiles.blindTest.correct') }}</el-checkbox>
|
||||
<el-input
|
||||
v-if="!orderFieldReview(orderFieldKey(field)).correct"
|
||||
class="value-input"
|
||||
:model-value="orderFieldReview(orderFieldKey(field)).value"
|
||||
:placeholder="t('admin.shippingOrderProfiles.blindTest.correctedValue')"
|
||||
@input="(value) => updateOrderFieldReview(orderFieldKey(field), { value: String(value) })"
|
||||
/>
|
||||
</article>
|
||||
<button v-if="candidate.confirmable" type="button" class="btn-primary" :disabled="working || !candidate.rows.length" @click="confirmReview">{{ t('admin.shippingOrderProfiles.blindTest.confirmReview') }}</button>
|
||||
<el-button v-if="candidate.confirmable" type="primary" :disabled="working || !candidate.rows.length" :loading="working" @click="confirmReview">{{ t('admin.shippingOrderProfiles.blindTest.confirmReview') }}</el-button>
|
||||
</section>
|
||||
|
||||
<section class="card"><h2>{{ t('admin.shippingOrderProfiles.blindTest.addedSamples') }}</h2><p>{{ t('admin.shippingOrderProfiles.blindTest.addedSamplesHint') }}</p><ul v-if="suite.samples.length"><li v-for="sample in suite.samples" :key="sample.id"><span>{{ sample.filename }} · P{{ sample.page_no }}</span><button v-if="suite.status === 'draft'" type="button" class="btn-secondary btn-sm" :disabled="working" @click="removeSample(sample.id)">{{ t('admin.shippingOrderProfiles.blindTest.removeSample') }}</button></li></ul><p v-else>{{ t('admin.shippingOrderProfiles.blindTest.noIndependentSamples') }}</p></section>
|
||||
<section class="card">
|
||||
<h2>{{ t('admin.shippingOrderProfiles.blindTest.addedSamples') }}</h2>
|
||||
<p>{{ t('admin.shippingOrderProfiles.blindTest.addedSamplesHint') }}</p>
|
||||
<ul v-if="suite.samples.length"><li v-for="sample in suite.samples" :key="sample.id"><span>{{ sample.filename }} · P{{ sample.page_no }}</span><el-button v-if="suite.status === 'draft'" size="small" :disabled="working" @click="removeSample(sample.id)">{{ t('admin.shippingOrderProfiles.blindTest.removeSample') }}</el-button></li></ul>
|
||||
<p v-else>{{ t('admin.shippingOrderProfiles.blindTest.noIndependentSamples') }}</p>
|
||||
</section>
|
||||
|
||||
<section class="card execution"><div><h2>{{ t('admin.shippingOrderProfiles.blindTest.execution') }}</h2><p>{{ t('admin.shippingOrderProfiles.blindTest.runHint') }}</p><p v-if="!hasTrainingSample" class="training-required">{{ t('admin.shippingOrderProfiles.blindTest.trainingRequired') }}</p></div><div class="actions"><button v-if="suite.status === 'draft'" type="button" class="btn-secondary" :disabled="working || !suite.sample_count" @click="executeSuite">{{ t('admin.shippingOrderProfiles.blindTest.run') }}</button><button v-if="suite.status === 'draft' && !hasTrainingSample" type="button" class="btn-secondary" :disabled="working" @click="goToEditor">{{ t('admin.shippingOrderProfiles.blindTest.goToEditor') }}</button><button v-if="suite.status === 'draft'" type="button" class="btn-primary" :disabled="working || !canApprove" @click="approveSuite">{{ t('admin.shippingOrderProfiles.blindTest.approve') }}</button></div></section>
|
||||
<section class="card execution">
|
||||
<div>
|
||||
<h2>{{ t('admin.shippingOrderProfiles.blindTest.execution') }}</h2>
|
||||
<p>{{ t('admin.shippingOrderProfiles.blindTest.runHint') }}</p>
|
||||
<p v-if="!hasTrainingSample" class="training-required">{{ t('admin.shippingOrderProfiles.blindTest.trainingRequired') }}</p>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<el-button v-if="suite.status === 'draft'" :disabled="working || !suite.sample_count" :loading="working" @click="executeSuite">{{ t('admin.shippingOrderProfiles.blindTest.run') }}</el-button>
|
||||
<el-button v-if="suite.status === 'draft' && !hasTrainingSample" :disabled="working" @click="goToEditor">{{ t('admin.shippingOrderProfiles.blindTest.goToEditor') }}</el-button>
|
||||
<el-button v-if="suite.status === 'draft'" type="primary" :disabled="working || !canApprove" :loading="working" @click="approveSuite">{{ t('admin.shippingOrderProfiles.blindTest.approve') }}</el-button>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.blind-test-page { padding: 24px; color: var(--text-secondary); }
|
||||
/* 根容器不再自带水平 padding:由 Admin 壳层统一持有,页面只保留卡片间距 */
|
||||
.blind-test-page { color: var(--el-text-color-regular); }
|
||||
header, .suite-summary, .execution, .actions, .sample-heading, .sample-picker, li { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
|
||||
header { align-items: flex-start; margin-bottom: 24px; } h1, h2, h3, p { margin: 0; } h2 { font-size: 16px; } h3 { font-size: 14px; } p:not(.section-desc) { margin-top: 6px; color: var(--text-muted); font-size: 13px; line-height: 1.5; }
|
||||
.card { display: grid; gap: 14px; margin-top: 14px; border: 1px solid var(--border-default); border-radius: 12px; background: var(--bg-surface); padding: 18px; }
|
||||
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 0; }
|
||||
.metrics div { display: grid; gap: 4px; }
|
||||
.metrics dt { color: var(--text-muted); font-size: 12px; }
|
||||
.metrics dd { margin: 0; color: var(--text-primary); font-size: 14px; font-weight: 600; }
|
||||
.status { color: var(--status-warning-fg); font-weight: 700; } .status.approved { color: var(--status-success-fg); } .status.superseded { color: var(--status-error-fg); }
|
||||
.sample-heading { align-items: center; }.sample-picker { justify-content: flex-start; }.sample-picker .select-field { flex: 1; min-width: 0; } .sample-picker button, .upload-sample { flex: 0 0 auto; white-space: nowrap; } .candidate-card .input-field { padding: 8px; border-radius: 6px; } textarea.input-field { min-height: 72px; font-family: ui-monospace, monospace; }
|
||||
.upload-sample { position: relative; cursor: pointer; }.upload-sample input { position: absolute; width: 1px; height: 1px; opacity: 0; }.upload-status { margin: 10px 0 0; color: var(--status-info-fg); font-size: .85rem; }.upload-status.failed { color: var(--status-error-fg); }
|
||||
.candidate-card { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); } .candidate-card > h2, .candidate-card > p, .candidate-card > button { grid-column: 1 / -1; }
|
||||
.review-item { display: grid; gap: 8px; border: 1px solid var(--border-default); border-radius: 8px; padding: 12px; } code { overflow-wrap: anywhere; white-space: pre-wrap; color: var(--text-primary); font-size: 12px; } label { display: flex; gap: 6px; align-items: center; }
|
||||
ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; } li { border-top: 1px solid var(--border-default); padding-top: 8px; }
|
||||
.failure-details { border-color: var(--status-error-border); background: var(--status-error-bg); }.failure-details h2 { color: var(--status-error-fg); }.failure-details li { display: grid; gap: 4px; color: var(--status-error-fg); }.failure-details code { color: var(--status-error-fg); }
|
||||
.soft-diagnostics { border-color: var(--status-warning-border, #f59e0b); background: var(--status-warning-bg, #fffbeb); }
|
||||
.soft-diagnostics h2, .soft-diagnostics li, .ocr-diagnostic { color: var(--status-warning-fg) !important; }
|
||||
header { align-items: flex-start; margin-bottom: 24px; } h1, h2, h3, p { margin: 0; } h2 { font-size: 16px; } h3 { font-size: 14px; } p:not(.section-desc) { margin-top: 6px; color: var(--el-text-color-secondary); font-size: 13px; line-height: 1.5; }
|
||||
.card { display: grid; gap: 14px; margin-top: 14px; border: 1px solid var(--el-border-color-lighter); border-radius: 12px; background: var(--el-bg-color); padding: 18px; }
|
||||
.metrics { margin: 0; }
|
||||
.metrics :deep(.el-descriptions__label) { color: var(--el-text-color-secondary); font-size: 12px; }
|
||||
.metrics :deep(.el-descriptions__content) { color: var(--el-text-color-primary); font-size: 13px; font-weight: 600; }
|
||||
.sample-heading { align-items: center; }.suite-summary__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }.sample-picker { justify-content: flex-start; }.sample-picker .el-select { flex: 1 1 auto; min-width: 0; } .sample-picker .el-button, .upload-sample { flex: 0 0 auto; white-space: nowrap; } .candidate-card .correction-input, .candidate-card .value-input { width: 100%; }.correction-input :deep(.el-textarea__inner) { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
|
||||
/* 原生 file input 的外套 label:样式对齐 el-button 默认几何(32px 高),避免遗留 .btn-* 的大尺寸异形按钮 */
|
||||
.upload-sample {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
height: 32px;
|
||||
padding: 0 15px;
|
||||
border: 1px solid var(--el-border-color);
|
||||
border-radius: var(--el-border-radius-base);
|
||||
background: var(--el-bg-color);
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
transition: color .2s, border-color .2s, background-color .2s;
|
||||
}
|
||||
.upload-sample:hover { color: var(--el-color-primary); border-color: var(--el-color-primary-light-7); background: var(--el-color-primary-light-9); }
|
||||
.upload-sample:has(input:disabled) { opacity: .5; cursor: not-allowed; }.upload-sample input { position: absolute; width: 1px; height: 1px; opacity: 0; }.upload-status { margin: 10px 0 0; color: var(--el-color-primary); font-size: 13px; }.upload-status.failed { color: var(--el-color-danger); }
|
||||
.candidate-card { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); } .candidate-card > h2, .candidate-card > p, .candidate-card > .el-button { grid-column: 1 / -1; }
|
||||
.review-item { display: grid; gap: 8px; border: 1px solid var(--el-border-color-lighter); border-radius: 8px; padding: 12px; } code { overflow-wrap: anywhere; white-space: pre-wrap; color: var(--el-text-color-primary); font-size: 12px; }
|
||||
ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; } li { border-top: 1px solid var(--el-border-color-lighter); padding-top: 8px; }
|
||||
.failure-details { border-color: var(--el-color-danger-light-7); background: var(--el-color-danger-light-9); }.failure-details h2 { color: var(--el-color-danger); }.failure-details li { display: grid; gap: 4px; color: var(--el-color-danger); }.failure-details code { color: var(--el-color-danger); }
|
||||
.soft-diagnostics { border-color: var(--el-color-warning-light-7); background: var(--el-color-warning-light-9); }
|
||||
.soft-diagnostics h2, .soft-diagnostics li, .ocr-diagnostic { color: var(--el-color-warning) !important; }
|
||||
.ocr-diagnostic { font-weight: 600; grid-column: 1 / -1; }
|
||||
.ocr-diagnostic-list { grid-column: 1 / -1; margin: 0; padding-left: 1.2rem; color: var(--status-warning-fg); }
|
||||
.ocr-diagnostic-list { grid-column: 1 / -1; margin: 0; padding-left: 1.2rem; color: var(--el-color-warning); }
|
||||
.ocr-diagnostic-list li { margin: 4px 0; }
|
||||
.training-required { color: var(--status-warning-fg) !important; font-weight: 600; }
|
||||
@media (max-width: 700px) { header, .suite-summary, .execution, .sample-heading, .sample-picker { align-items: stretch; flex-direction: column; } .sample-picker .select-field { min-width: 0; width: 100%; } }
|
||||
.training-required { color: var(--el-color-warning) !important; font-weight: 600; }
|
||||
@media (max-width: 700px) { header, .suite-summary, .execution, .sample-heading, .sample-picker { align-items: stretch; flex-direction: column; } .sample-picker .el-select { min-width: 0; width: 100%; } }
|
||||
</style>
|
||||
+51
-20
@@ -1,14 +1,25 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/OrderProfileCreateWizardPage.vue
|
||||
用途:以三步向导创建订单文档模板草稿。
|
||||
依赖:Schema/样本/表格 API、步骤组件和 Vue Router。
|
||||
依赖:element-plus(el-steps 步骤条 / el-button 按钮,沿用管理端 element-trial 主题,图标为 @element-plus/icons-vue)、
|
||||
Schema/样本/表格 API、步骤组件和 Vue Router。
|
||||
逻辑:所有有明细的样本在第三步选择同一视觉主表;XFA datasets/OCR 差异只在编辑器的字段取值映射中配置。
|
||||
视觉层已迁移 Element Plus(手写步骤条→el-steps,btn-*→el-button),业务脚本与三步交互保持原样。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, onMounted, reactive, ref, watch } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ArrowLeft, ArrowRight, Check, FileText, Layers3, Sparkles } from 'lucide-vue-next';
|
||||
import {
|
||||
ElButton,
|
||||
ElIcon,
|
||||
ElStep,
|
||||
ElSteps,
|
||||
} from 'element-plus';
|
||||
import { ArrowLeft, ArrowRight, Check, Document, Files, MagicStick } from '@element-plus/icons-vue';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { createRandomUuid } from '@/shared/utils/id';
|
||||
@@ -45,9 +56,9 @@ const canNext = computed(() => {
|
||||
return Boolean(tableId.value);
|
||||
});
|
||||
const steps = computed(() => [
|
||||
{ number: 1, label: t('admin.shippingOrderProfiles.wizard.identityStep'), icon: FileText },
|
||||
{ number: 2, label: t('admin.shippingOrderProfiles.wizard.sampleStep'), icon: Layers3 },
|
||||
{ number: 3, label: stepThreeLabel.value, icon: Sparkles },
|
||||
{ number: 1, label: t('admin.shippingOrderProfiles.wizard.identityStep'), icon: Document },
|
||||
{ number: 2, label: t('admin.shippingOrderProfiles.wizard.sampleStep'), icon: Files },
|
||||
{ number: 3, label: stepThreeLabel.value, icon: MagicStick },
|
||||
]);
|
||||
|
||||
/** 接收首步身份快照;父级单一状态驱动下一步校验,避免子组件对象替换造成状态不同步。 */
|
||||
@@ -165,12 +176,25 @@ onBeforeUnmount(stopSampleRefresh);
|
||||
<p class="section-desc mt-1">{{ t('admin.shippingOrderProfiles.wizard.description') }}</p>
|
||||
</header>
|
||||
|
||||
<ol class="stepper" :aria-label="t('admin.shippingOrderProfiles.wizard.steps', { step })">
|
||||
<li v-for="item in steps" :key="item.number" :class="{ active: item.number === step, complete: item.number < step }">
|
||||
<span class="stepper-icon"><Check v-if="item.number < step" :size="16" /><component :is="item.icon" v-else :size="16" /></span>
|
||||
<span><small>{{ t('admin.shippingOrderProfiles.wizard.stepLabel', { step: item.number }) }}</small>{{ item.label }}</span>
|
||||
</li>
|
||||
</ol>
|
||||
<!-- 步骤条迁移为 el-steps:active 绑当前步,完成步由 finish-status 出对勾 -->
|
||||
<el-steps
|
||||
:active="step - 1"
|
||||
align-center
|
||||
finish-status="success"
|
||||
class="wizard-steps"
|
||||
:aria-label="t('admin.shippingOrderProfiles.wizard.steps', { step })"
|
||||
>
|
||||
<el-step
|
||||
v-for="item in steps"
|
||||
:key="item.number"
|
||||
:title="item.label"
|
||||
:description="t('admin.shippingOrderProfiles.wizard.stepLabel', { step: item.number })"
|
||||
>
|
||||
<template #icon>
|
||||
<el-icon><Check v-if="item.number < step" /><component :is="item.icon" v-else /></el-icon>
|
||||
</template>
|
||||
</el-step>
|
||||
</el-steps>
|
||||
|
||||
<main class="wizard-card">
|
||||
<div class="wizard-card__heading">
|
||||
@@ -189,13 +213,19 @@ onBeforeUnmount(stopSampleRefresh);
|
||||
</main>
|
||||
|
||||
<footer class="wizard-actions">
|
||||
<button type="button" class="btn-secondary" @click="router.push({ name: 'AdminShippingOrderDocumentProfiles' })">{{ t('admin.cancel') }}</button>
|
||||
<el-button @click="router.push({ name: 'AdminShippingOrderDocumentProfiles' })">{{ t('admin.cancel') }}</el-button>
|
||||
<span class="wizard-actions__spacer" />
|
||||
<button v-if="step > 1" type="button" class="btn-ghost" @click="step -= 1"><ArrowLeft :size="17" />{{ t('admin.shippingOrderProfiles.wizard.previous') }}</button>
|
||||
<button v-if="step < 3" type="button" class="btn-primary" :disabled="!canNext" @click="next">{{ t('admin.shippingOrderProfiles.wizard.next') }}<ArrowRight :size="17" /></button>
|
||||
<el-button v-if="step > 1" :icon="ArrowLeft" @click="step -= 1">{{ t('admin.shippingOrderProfiles.wizard.previous') }}</el-button>
|
||||
<el-button v-if="step < 3" type="primary" :disabled="!canNext" @click="next">
|
||||
{{ t('admin.shippingOrderProfiles.wizard.next') }}
|
||||
<el-icon class="el-icon--right"><ArrowRight /></el-icon>
|
||||
</el-button>
|
||||
<template v-else>
|
||||
<button type="button" class="btn-secondary" :disabled="saving || !canNext" @click="finish(false)">{{ t('admin.shippingOrderProfiles.wizard.createDraft') }}</button>
|
||||
<button type="button" class="btn-primary" :disabled="saving || !canNext" @click="finish(true)">{{ t('admin.shippingOrderProfiles.wizard.createAndEdit') }}<ArrowRight :size="17" /></button>
|
||||
<el-button :disabled="saving || !canNext" @click="finish(false)">{{ t('admin.shippingOrderProfiles.wizard.createDraft') }}</el-button>
|
||||
<el-button type="primary" :disabled="saving || !canNext" @click="finish(true)">
|
||||
{{ t('admin.shippingOrderProfiles.wizard.createAndEdit') }}
|
||||
<el-icon class="el-icon--right"><ArrowRight /></el-icon>
|
||||
</el-button>
|
||||
</template>
|
||||
</footer>
|
||||
</div>
|
||||
@@ -203,11 +233,12 @@ onBeforeUnmount(stopSampleRefresh);
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.wizard-page { min-height: 100%; padding: 24px; background: #f6f8fc; }
|
||||
/* 根容器不再自带水平 padding 与页面底色:由 Admin 壳层统一持有,页面只保留内部块间距 */
|
||||
.wizard-page { min-height: 100%; }
|
||||
.wizard-shell { width: 100%; }
|
||||
.wizard-heading { margin-bottom: 28px; }.wizard-heading h1, .wizard-heading p { margin: 0; }
|
||||
.stepper { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 0 0 18px; padding: 0; list-style: none; }.stepper li { display: flex; align-items: center; gap: 10px; color: #94a3b8; font-size: .86rem; font-weight: 650; }.stepper li:not(:last-child)::after { width: 100%; height: 1px; margin-left: 10px; background: #dbe4f0; content: ''; }/* 步骤状态色统一 Tailwind 标准值:激活=brand-600、完成=green-600 */.stepper li.active { color: #0284c7; }.stepper li.complete { color: #16a34a; }.stepper-icon { display: inline-grid; flex: 0 0 auto; width: 32px; height: 32px; place-items: center; border: 1px solid currentColor; border-radius: 50%; background: #fff; }.stepper .complete .stepper-icon { color: #fff; border-color: #16a34a; background: #16a34a; }.stepper small { display: block; margin-bottom: 1px; color: #94a3b8; font-size: .68rem; font-weight: 700; text-transform: uppercase; }
|
||||
.wizard-card { min-height: 360px; padding: clamp(24px, 4vw, 44px); border: 1px solid #e1e8f2; border-radius: 12px; background: #fff; box-shadow: 0 8px 24px rgb(15 23 42 / .06); }.wizard-card__heading { margin-bottom: 28px; padding-bottom: 18px; border-bottom: 1px solid #edf1f7; }.wizard-card__heading span { color: #0284c7; font-size: .76rem; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }.wizard-card__heading h2 { margin: 6px 0 0; color: #1e293b; font-size: 1.25rem; }
|
||||
.wizard-steps { margin: 0 0 18px; }
|
||||
.wizard-card { min-height: 360px; padding: clamp(24px, 4vw, 44px); border: 1px solid var(--el-border-color-light); border-radius: 12px; background: var(--el-bg-color); box-shadow: var(--el-box-shadow-light); }.wizard-card__heading { margin-bottom: 28px; padding-bottom: 18px; border-bottom: 1px solid var(--el-border-color-lighter); }.wizard-card__heading span { color: var(--el-color-primary); font-size: 12px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }.wizard-card__heading h2 { margin: 6px 0 0; color: var(--el-text-color-primary); font-size: 1.25rem; }
|
||||
.wizard-actions { display: flex; align-items: center; gap: 10px; margin-top: 18px; }.wizard-actions__spacer { flex: 1; }
|
||||
@media (max-width: 640px) { .wizard-page { padding: 24px 16px; }.stepper { grid-template-columns: 1fr; gap: 10px; }.stepper li:not(:last-child)::after { display: none; }.wizard-card { min-height: 300px; border-radius: 14px; }.wizard-actions { flex-wrap: wrap; }.wizard-actions__spacer { display: none; }.btn-secondary:first-child { margin-right: auto; } }
|
||||
@media (max-width: 640px) { .wizard-card { min-height: 300px; border-radius: 14px; }.wizard-actions { flex-wrap: wrap; }.wizard-actions__spacer { display: none; }.wizard-actions > .el-button:first-child { margin-right: auto; } }
|
||||
</style>
|
||||
+212
-261
@@ -15,6 +15,13 @@
|
||||
识别结果区:OCR 表头保留,datasets header_fields/lines 作正式值增量;保存后刷新 validation runs;
|
||||
整页 order-field OCR 可中止+超时,自动保存前取消,避免占满连接池卡在「保存中」;
|
||||
保存飞行中若又选了 datasets path,applySavedDraft 后 restoreConcurrentEdits,禁止冲掉未入库绑定。
|
||||
EP 迁移(定向,业务脚本零改动):页头/横幅/工具动作按钮迁移为 el-button(保存带 :loading);状态
|
||||
徽标迁移为 el-tag;三处自绘遮罩弹窗(datasets 选树 / 拆分规则 / 集合重确认)迁移为 el-dialog
|
||||
(单向 model-value + 关闭回调走原 close*() 函数,焦点陷阱 ref 与 destroy-on-close 保持原
|
||||
v-if 卸载语义,原「×」关闭按钮由 el-dialog 内置关闭键替代);右侧属性区原生 input/select
|
||||
迁移为 el-input / el-select(事件经内联适配保持原 handler 契约,识别结果行/未绑定 chip 保留
|
||||
原生按钮语义,与范式参考的 list-item 模式一致);@element-plus/icons-vue CSS 三件套已引入;
|
||||
画布组件(DocumentCanvas)几何/绘制逻辑未改动。脚本仅新增 import,无其他逻辑变更。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import {
|
||||
@@ -28,6 +35,17 @@ import {
|
||||
} from "vue";
|
||||
import { onBeforeRouteLeave, useRoute, useRouter } from "vue-router";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import {
|
||||
ElButton,
|
||||
ElDialog,
|
||||
ElInput,
|
||||
ElOption,
|
||||
ElSelect,
|
||||
ElTag,
|
||||
} from "element-plus";
|
||||
import "element-plus/dist/index.css";
|
||||
import "element-plus/theme-chalk/dark/css-vars.css";
|
||||
import "@/features/admin/styles/element-trial.css";
|
||||
import { BusinessError } from "@/shared/api/client";
|
||||
import { useMessage } from "@/shared/composables/useMessage";
|
||||
import { createRandomUuid } from "@/shared/utils/id";
|
||||
@@ -3424,41 +3442,37 @@ onBeforeUnmount(() => {
|
||||
<h1 class="section-title">{{ `${form.displayName || t("admin.shippingOrderProfiles.title")} · ${t("admin.shippingOrderProfiles.updateDraft")}` }}</h1>
|
||||
<p>
|
||||
{{ form.profileCode }}
|
||||
<span v-if="hasValueSourceMapping" class="template-mode-badge">{{ t('admin.shippingOrderProfiles.templateModes.xfa_dataset') }}</span>
|
||||
<el-tag v-if="hasValueSourceMapping" class="template-mode-badge" type="info" effect="plain" size="small">{{ t('admin.shippingOrderProfiles.templateModes.xfa_dataset') }}</el-tag>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<output class="save-status" :class="`save-status--${saveState}`">{{ t(`admin.shippingOrderProfiles.workbench.saveStatus.${saveState}`) }}</output>
|
||||
<el-tag class="save-status" :type="saveState === 'saved' ? 'success' : saveState === 'saving' ? 'primary' : 'danger'" effect="light">{{ t(`admin.shippingOrderProfiles.workbench.saveStatus.${saveState}`) }}</el-tag>
|
||||
<div v-if="saveState === 'readonly'" class="header-actions__lease">
|
||||
<button type="button" class="btn-secondary" @click="downloadLocalDraft">{{ t('admin.shippingOrderProfiles.workbench.headerExport') }}</button>
|
||||
<button type="button" class="btn-secondary" @click="() => void recoverEditLease()">{{ t('admin.shippingOrderProfiles.workbench.headerRecoverLease') }}</button>
|
||||
<button type="button" class="btn-secondary" @click="() => void recoverEditLease(true)">{{ t('admin.shippingOrderProfiles.workbench.headerTakeOverLease') }}</button>
|
||||
<el-button @click="downloadLocalDraft">{{ t('admin.shippingOrderProfiles.workbench.headerExport') }}</el-button>
|
||||
<el-button @click="() => void recoverEditLease()">{{ t('admin.shippingOrderProfiles.workbench.headerRecoverLease') }}</el-button>
|
||||
<el-button @click="() => void recoverEditLease(true)">{{ t('admin.shippingOrderProfiles.workbench.headerTakeOverLease') }}</el-button>
|
||||
</div>
|
||||
<output v-if="active && currentSampleIsTraining" class="training-sample-status">{{ t('admin.shippingOrderProfiles.workbench.headerTrainingSample') }}</output>
|
||||
<button
|
||||
<el-tag v-if="active && currentSampleIsTraining" class="training-sample-status" type="success" effect="light">{{ t('admin.shippingOrderProfiles.workbench.headerTrainingSample') }}</el-tag>
|
||||
<el-button
|
||||
v-else-if="active"
|
||||
type="button"
|
||||
class="btn-secondary"
|
||||
:disabled="!deskCanvasDocumentReady || saveState === 'readonly'"
|
||||
:disabled="!deskCanvasDocumentReady || saveState === 'readonly'"
|
||||
@click="() => void addCurrentTrainingSample()"
|
||||
>{{ t('admin.shippingOrderProfiles.workbench.headerAddTrainingSample') }}</button>
|
||||
>{{ t('admin.shippingOrderProfiles.workbench.headerAddTrainingSample') }}</el-button>
|
||||
<div class="header-actions__flow">
|
||||
<button
|
||||
<el-button
|
||||
v-if="active"
|
||||
type="button"
|
||||
type="primary"
|
||||
:disabled="deskSaveButtonDisabled"
|
||||
class="btn-primary"
|
||||
:loading="saving"
|
||||
@click="() => void save()"
|
||||
>{{ saving ? t("admin.shippingOrderProfiles.saving") : t("admin.shippingOrderProfiles.workbench.headerSaveDraft") }}</button>
|
||||
<button
|
||||
>{{ saving ? t("admin.shippingOrderProfiles.saving") : t("admin.shippingOrderProfiles.workbench.headerSaveDraft") }}</el-button>
|
||||
<el-button
|
||||
v-if="active"
|
||||
type="button"
|
||||
class="btn-secondary"
|
||||
:disabled="!draftSaveAdapter.canValidate"
|
||||
@click="validateProfile(active)"
|
||||
>{{ t('admin.shippingOrderProfiles.workbench.headerValidate') }}</button>
|
||||
<button type="button" class="btn-secondary" @click="router.push({ name: 'AdminShippingOrderDocumentProfiles' })">{{ t('admin.shippingOrderProfiles.workbench.headerReturnToLibrary') }}</button>
|
||||
>{{ t('admin.shippingOrderProfiles.workbench.headerValidate') }}</el-button>
|
||||
<el-button @click="router.push({ name: 'AdminShippingOrderDocumentProfiles' })">{{ t('admin.shippingOrderProfiles.workbench.headerReturnToLibrary') }}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
@@ -3467,17 +3481,17 @@ onBeforeUnmount(() => {
|
||||
<template v-if="active">
|
||||
<div v-if="deskCanvasWarningVisible || canvasNeedsLayoutRecovery" class="canvas-warning">
|
||||
<span>{{ deskCanvasWarningVisible ? deskCanvasWarningText : t('admin.shippingOrderProfiles.workbench.noRecognizedTable') }}</span>
|
||||
<button v-if="deskCanvasWarningVisible" type="button" @click="onDeskCanvasRetry">
|
||||
<el-button v-if="deskCanvasWarningVisible" @click="onDeskCanvasRetry">
|
||||
{{ deskCanvasRetryLabel }}
|
||||
</button>
|
||||
<button
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="canvasNeedsLayoutRecovery"
|
||||
type="button"
|
||||
:disabled="reparsingLayout"
|
||||
:loading="reparsingLayout"
|
||||
@click="() => void reprocessCurrentSampleLayout()"
|
||||
>
|
||||
{{ t('admin.shippingOrderProfiles.blindTest.reprocessLayout') }}
|
||||
</button>
|
||||
</el-button>
|
||||
</div>
|
||||
<section v-if="suggestingRegions || pendingSuggestion" class="automark-status-panel" role="status" aria-live="polite">
|
||||
<div class="automark-status-panel__heading">
|
||||
@@ -3493,15 +3507,15 @@ onBeforeUnmount(() => {
|
||||
<div v-if="pendingSuggestion" class="automark-status-panel__body">
|
||||
<div v-if="pendingSuggestionIsOffCanvasPage" class="automark-candidate-page-notice" role="status">
|
||||
<span>{{ t('admin.shippingOrderProfiles.workbench.suggestionOnPage', { page: pendingSuggestionPageNo }) }}</span>
|
||||
<button type="button" class="btn-secondary" @click="returnToPendingSuggestionPage">{{ t('admin.shippingOrderProfiles.workbench.returnToSuggestionPage') }}</button>
|
||||
<el-button @click="returnToPendingSuggestionPage">{{ t('admin.shippingOrderProfiles.workbench.returnToSuggestionPage') }}</el-button>
|
||||
</div>
|
||||
<div v-if="hasAutomarkTableChoice" class="automark-choice-block">
|
||||
<label>
|
||||
{{ t('admin.shippingOrderProfiles.workbench.autoSuggestEvidenceSource') }}
|
||||
<select :value="selectedAutomarkTableSource" class="select-field" :disabled="saveState === 'readonly'" @change="(event) => void chooseAutomarkTableSource((event.target as HTMLSelectElement).value)">
|
||||
<option value="">{{ t('admin.shippingOrderProfiles.workbench.autoSuggestChooseEvidence') }}</option>
|
||||
<option v-for="candidate in automarkTableCandidates" :key="candidate.source" :value="candidate.source">{{ candidate.source }}</option>
|
||||
</select>
|
||||
<el-select :model-value="selectedAutomarkTableSource" :disabled="saveState === 'readonly'" @update:model-value="(value) => void chooseAutomarkTableSource(String(value))">
|
||||
<el-option value="" :label="t('admin.shippingOrderProfiles.workbench.autoSuggestChooseEvidence')" />
|
||||
<el-option v-for="candidate in automarkTableCandidates" :key="candidate.source" :value="candidate.source" :label="candidate.source" />
|
||||
</el-select>
|
||||
</label>
|
||||
<div class="suggestion-evidence-summary" aria-label="automark evidence summaries">
|
||||
<span v-for="summary in automarkTableCandidateSummaries" :key="summary.source" :class="{ 'is-conflict': summary.conflictCodes.length > 0 }">
|
||||
@@ -3513,17 +3527,17 @@ onBeforeUnmount(() => {
|
||||
<div v-if="automarkFieldConflicts.length > 0" class="automark-choice-block automark-choice-block--fields">
|
||||
<label v-for="conflict in automarkFieldConflicts" :key="conflict.field_id">
|
||||
{{ conflict.field_code || conflict.field_id }} · {{ t('admin.shippingOrderProfiles.workbench.autoSuggestEvidenceSource') }}
|
||||
<select :value="selectedAutomarkFieldSources[conflict.field_id] || ''" class="select-field" :disabled="saveState === 'readonly'" @change="(event) => void chooseAutomarkFieldSource(conflict.field_id, (event.target as HTMLSelectElement).value)">
|
||||
<option value="">{{ t('admin.shippingOrderProfiles.workbench.autoSuggestChooseEvidence') }}</option>
|
||||
<option v-for="source in conflict.sources" :key="source" :value="source">{{ source }}</option>
|
||||
</select>
|
||||
<el-select :model-value="selectedAutomarkFieldSources[conflict.field_id] || ''" :disabled="saveState === 'readonly'" @update:model-value="(value) => void chooseAutomarkFieldSource(conflict.field_id, String(value))">
|
||||
<el-option value="" :label="t('admin.shippingOrderProfiles.workbench.autoSuggestChooseEvidence')" />
|
||||
<el-option v-for="source in conflict.sources" :key="source" :value="source" :label="source" />
|
||||
</el-select>
|
||||
</label>
|
||||
</div>
|
||||
<div class="automark-status-panel__actions">
|
||||
<select v-model="suggestionAdjustmentField" class="select-field" :disabled="saveState === 'readonly'" :aria-label="t('admin.shippingOrderProfiles.workbench.suggestionAdjustmentField')"><option value="">{{ t('admin.shippingOrderProfiles.workbench.suggestionAdjustmentField') }}</option><option v-for="field in lineFields" :key="field.field_code" :value="field.field_code">{{ field.display_name }} · {{ field.field_code }}</option></select>
|
||||
<button type="button" class="btn-primary" :disabled="saveState === 'readonly' || automarkTableChoiceRequired || automarkFieldChoiceRequired" @click="() => void decidePendingSuggestion('accepted')">{{ t('admin.shippingOrderProfiles.workbench.acceptSuggestion') }}</button>
|
||||
<button type="button" class="btn-secondary" :disabled="saveState === 'readonly' || !suggestionAdjustmentField" @click="() => void decidePendingSuggestion('accepted_adjusted')">{{ t('admin.shippingOrderProfiles.workbench.acceptAdjustedSuggestion') }}</button>
|
||||
<button type="button" class="btn-secondary" :disabled="saveState === 'readonly'" @click="() => void decidePendingSuggestion('rejected')">{{ t('admin.shippingOrderProfiles.workbench.rejectSuggestion') }}</button>
|
||||
<el-select v-model="suggestionAdjustmentField" :disabled="saveState === 'readonly'" :aria-label="t('admin.shippingOrderProfiles.workbench.suggestionAdjustmentField')"><el-option value="" :label="t('admin.shippingOrderProfiles.workbench.suggestionAdjustmentField')" /><el-option v-for="field in lineFields" :key="field.field_code" :value="field.field_code as string" :label="`${field.display_name} · ${field.field_code}`" /></el-select>
|
||||
<el-button type="primary" :disabled="saveState === 'readonly' || automarkTableChoiceRequired || automarkFieldChoiceRequired" @click="() => void decidePendingSuggestion('accepted')">{{ t('admin.shippingOrderProfiles.workbench.acceptSuggestion') }}</el-button>
|
||||
<el-button :disabled="saveState === 'readonly' || !suggestionAdjustmentField" @click="() => void decidePendingSuggestion('accepted_adjusted')">{{ t('admin.shippingOrderProfiles.workbench.acceptAdjustedSuggestion') }}</el-button>
|
||||
<el-button :disabled="saveState === 'readonly'" @click="() => void decidePendingSuggestion('rejected')">{{ t('admin.shippingOrderProfiles.workbench.rejectSuggestion') }}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -3536,14 +3550,14 @@ onBeforeUnmount(() => {
|
||||
<p>
|
||||
{{ t('admin.shippingOrderProfiles.workbench.unboundRegionsBanner', { count: unboundOrderFieldRegions.length }) }}
|
||||
</p>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-secondary unbound-regions-banner__clear"
|
||||
<el-button
|
||||
class="unbound-regions-banner__clear"
|
||||
size="small"
|
||||
:disabled="saveState === 'readonly'"
|
||||
@click="clearUnboundOrderFieldRegions"
|
||||
>
|
||||
{{ t('admin.shippingOrderProfiles.workbench.clearUnboundRegions') }}
|
||||
</button>
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="unbound-regions-banner__list">
|
||||
<button
|
||||
@@ -3629,22 +3643,19 @@ onBeforeUnmount(() => {
|
||||
|
||||
<section v-if="!hasValueSourceMapping && active" class="reservation-region-config">
|
||||
<strong>Reservation ID 证据区域</strong>
|
||||
<p>只需圈选包含 Reservation ID 的备注区域;系统统一解析:无行号写订单头,带行号写对应明细。</p>
|
||||
<button
|
||||
type="button"
|
||||
:disabled="compactEditor || saveState === 'readonly'"
|
||||
@click="onDeskCanvasDraw('reservation_id_region')"
|
||||
>
|
||||
{{ reservationIdRegion ? '重新标记 Reservation ID 区域' : '标记 Reservation ID 区域' }}
|
||||
</button>
|
||||
<button
|
||||
<p>使用左侧「{{ t('admin.shippingOrderProfiles.workbench.drawReservationIdRegionShortcut') }}」工具,圈选包含 Reservation ID 的备注区域;系统统一解析:无行号写订单头,带行号写对应明细。</p>
|
||||
<!-- 标记入口只在左侧画布工具栏(同一 creationKind 路径),此处不再重复放置长按钮 -->
|
||||
<el-button
|
||||
v-if="reservationIdRegion"
|
||||
type="button"
|
||||
size="small"
|
||||
type="danger"
|
||||
plain
|
||||
class="reservation-region-config__clear"
|
||||
:disabled="compactEditor || saveState === 'readonly'"
|
||||
@click="clearReservationIdRegion"
|
||||
>
|
||||
清除区域
|
||||
</button>
|
||||
</el-button>
|
||||
<small v-if="reservationIdRegion">已标记第 {{ reservationIdRegion.page_no }} 页区域;正式取值按 Vendor Comments→Terms 锚点,与验证/盲测/正式解析一致。</small>
|
||||
<p v-if="reservationIdCandidateState === 'loading'" class="reservation-region-config__status">正在识别 Reservation ID…</p>
|
||||
<p v-else-if="reservationIdCandidateState === 'failed'" class="reservation-region-config__status">区域预览失败;保存后可在盲测/复核中再次确认。</p>
|
||||
@@ -3691,83 +3702,76 @@ onBeforeUnmount(() => {
|
||||
<template v-if="selectedRegion">
|
||||
<label
|
||||
>{{ t("admin.shippingOrderProfiles.workbench.label")
|
||||
}}<input
|
||||
}}<el-input
|
||||
v-model="selectedRegion.label"
|
||||
class="input-field"
|
||||
:disabled="compactEditor || saveState === 'readonly'"
|
||||
@focus="beginFormEdit"
|
||||
@change="finishFormEdit" /></label
|
||||
><label v-if="selectedRegion.kind === 'field'"
|
||||
>{{ t("admin.shippingOrderProfiles.workbench.lineLayout")
|
||||
}}<select
|
||||
}}<el-select
|
||||
v-model="selectedRegion.parentId"
|
||||
class="select-field"
|
||||
:disabled="compactEditor || saveState === 'readonly'"
|
||||
@focus="beginFormEdit"
|
||||
@change="finishFormEdit"
|
||||
>
|
||||
<option
|
||||
<el-option
|
||||
v-for="line in pageRegions.filter(
|
||||
(item) => item.kind === 'line',
|
||||
)"
|
||||
:key="line.id"
|
||||
:value="line.id"
|
||||
>
|
||||
{{ line.label }}
|
||||
</option>
|
||||
</select></label
|
||||
:label="line.label"
|
||||
/>
|
||||
</el-select></label
|
||||
><label v-if="selectedRegion.kind === 'line'"
|
||||
>{{ t('admin.shippingOrderProfiles.workbench.tableRegionRole')
|
||||
}}<select
|
||||
:value="selectedRegion.tableRegionRole || 'business_lines'"
|
||||
class="select-field"
|
||||
}}<el-select
|
||||
:model-value="selectedRegion.tableRegionRole || 'business_lines'"
|
||||
:disabled="compactEditor || saveState === 'readonly'"
|
||||
@focus="beginFormEdit"
|
||||
@change="onSelectedLineTableRegionRoleChange"
|
||||
@update:model-value="(value) => onSelectedLineTableRegionRoleChange({ target: { value: String(value) } } as unknown as Event)"
|
||||
>
|
||||
<option value="business_lines">{{ t('admin.shippingOrderProfiles.workbench.tableRegionRoles.business_lines') }}</option>
|
||||
<option value="line_field_supplement">{{ t('admin.shippingOrderProfiles.workbench.tableRegionRoles.line_field_supplement') }}</option>
|
||||
</select>
|
||||
<el-option value="business_lines" :label="t('admin.shippingOrderProfiles.workbench.tableRegionRoles.business_lines')" />
|
||||
<el-option value="line_field_supplement" :label="t('admin.shippingOrderProfiles.workbench.tableRegionRoles.line_field_supplement')" />
|
||||
</el-select>
|
||||
<small>{{ t('admin.shippingOrderProfiles.workbench.tableRegionRoleHint') }}</small>
|
||||
</label
|
||||
><label v-if="['header_field', 'field', 'order_field'].includes(selectedRegion.kind)"
|
||||
>{{ t("admin.shippingOrderProfiles.workbench.schemaField")
|
||||
}}<select
|
||||
}}<el-select
|
||||
v-model="selectedRegion.fieldCode"
|
||||
class="select-field"
|
||||
:disabled="compactEditor || saveState === 'readonly'"
|
||||
@focus="beginFieldBindingEdit"
|
||||
@change="finishFieldBindingEdit"
|
||||
>
|
||||
<option :value="null">
|
||||
{{ t("admin.shippingOrderProfiles.workbench.selectField") }}
|
||||
</option>
|
||||
<option
|
||||
<el-option :value="null as unknown as string" :label="t('admin.shippingOrderProfiles.workbench.selectField')" />
|
||||
<el-option
|
||||
v-for="field in (selectedRegion.kind === 'order_field' ? selectableOrderHeaderFields : lineFields)"
|
||||
:key="field.field_id"
|
||||
:value="field.field_code"
|
||||
>
|
||||
{{ field.display_name }} · {{ field.field_code }}
|
||||
</option>
|
||||
</select></label
|
||||
:value="field.field_code as string"
|
||||
:label="`${field.display_name} · ${field.field_code}`"
|
||||
/>
|
||||
</el-select></label
|
||||
>
|
||||
<template v-if="selectedRegion.kind === 'order_field'">
|
||||
<label>{{ t("admin.shippingOrderProfiles.workbench.orderFieldValueMode") }}<select v-model="selectedRegion.valueMode" class="select-field" :disabled="compactEditor || saveState === 'readonly'" @focus="beginFormEdit" @change="finishFormEdit">
|
||||
<option value="single_line">{{ t("admin.shippingOrderProfiles.workbench.orderFieldModes.singleLine") }}</option>
|
||||
<option value="right_of_anchor">{{ t("admin.shippingOrderProfiles.workbench.orderFieldModes.rightOfAnchor") }}</option>
|
||||
<option value="below_anchor">{{ t("admin.shippingOrderProfiles.workbench.orderFieldModes.belowAnchor") }}</option>
|
||||
<option value="multi_line">{{ t("admin.shippingOrderProfiles.workbench.orderFieldModes.multiLine") }}</option>
|
||||
</select></label>
|
||||
<label v-if="selectedRegion.valueMode === 'multi_line'">{{ t("admin.shippingOrderProfiles.workbench.orderFieldStopAnchor") }}<input v-model="selectedRegion.stopAnchorText" class="input-field" :disabled="compactEditor || saveState === 'readonly'" :placeholder="t('admin.shippingOrderProfiles.workbench.orderFieldStopAnchorPlaceholder')" @focus="beginFormEdit" @change="finishFormEdit" /></label>
|
||||
<label>{{ t("admin.shippingOrderProfiles.workbench.orderFieldValueMode") }}<el-select v-model="selectedRegion.valueMode" :disabled="compactEditor || saveState === 'readonly'" @focus="beginFormEdit" @change="finishFormEdit">
|
||||
<el-option value="single_line" :label="t('admin.shippingOrderProfiles.workbench.orderFieldModes.singleLine')" />
|
||||
<el-option value="right_of_anchor" :label="t('admin.shippingOrderProfiles.workbench.orderFieldModes.rightOfAnchor')" />
|
||||
<el-option value="below_anchor" :label="t('admin.shippingOrderProfiles.workbench.orderFieldModes.belowAnchor')" />
|
||||
<el-option value="multi_line" :label="t('admin.shippingOrderProfiles.workbench.orderFieldModes.multiLine')" />
|
||||
</el-select></label>
|
||||
<label v-if="selectedRegion.valueMode === 'multi_line'">{{ t("admin.shippingOrderProfiles.workbench.orderFieldStopAnchor") }}<el-input v-model="selectedRegion.stopAnchorText" :disabled="compactEditor || saveState === 'readonly'" :placeholder="t('admin.shippingOrderProfiles.workbench.orderFieldStopAnchorPlaceholder')" @focus="beginFormEdit" @change="finishFormEdit" /></label>
|
||||
</template>
|
||||
<button
|
||||
<el-button
|
||||
v-if="
|
||||
selectedRegion.kind === 'field' &&
|
||||
selectedFieldHeaderSuggestion &&
|
||||
selectedFieldHeaderSuggestion !== selectedRegion.fieldCode
|
||||
"
|
||||
type="button"
|
||||
class="binding-suggestion"
|
||||
type="primary"
|
||||
plain
|
||||
@click="
|
||||
applyFieldBindingSuggestion(
|
||||
selectedRegion.id,
|
||||
@@ -3780,15 +3784,15 @@ onBeforeUnmount(() => {
|
||||
field: previewFieldLabel(selectedFieldHeaderSuggestion),
|
||||
})
|
||||
}}
|
||||
</button>
|
||||
</el-button>
|
||||
<template v-if="selectedRegion.kind === 'header_field'">
|
||||
<button type="button" @click="suggestHeaders(true)">
|
||||
<el-button @click="suggestHeaders(true)">
|
||||
{{ t("admin.shippingOrderProfiles.workbench.matchCurrentHeader") }}
|
||||
</button>
|
||||
<button type="button" @click="suggestHeaders(false)">
|
||||
</el-button>
|
||||
<el-button @click="suggestHeaders(false)">
|
||||
{{ t("admin.shippingOrderProfiles.workbench.matchAllHeaders") }}
|
||||
</button>
|
||||
<button
|
||||
</el-button>
|
||||
<el-button
|
||||
v-for="entry in headerSuggestions
|
||||
.filter(
|
||||
(item) => item.layout_id === selectedHeaderLayoutId,
|
||||
@@ -3804,8 +3808,9 @@ onBeforeUnmount(() => {
|
||||
})),
|
||||
)"
|
||||
:key="`${entry.regionId}-${entry.field.text}`"
|
||||
type="button"
|
||||
class="binding-suggestion"
|
||||
type="primary"
|
||||
plain
|
||||
:disabled="!entry.regionId || !entry.field.field_code"
|
||||
@click="
|
||||
entry.regionId &&
|
||||
@@ -3832,7 +3837,7 @@ onBeforeUnmount(() => {
|
||||
{ text: entry.field.text || "-" },
|
||||
)
|
||||
}}
|
||||
</button>
|
||||
</el-button>
|
||||
</template>
|
||||
<p>{{ t("admin.shippingOrderProfiles.workbench.dragHint") }}</p>
|
||||
</template>
|
||||
@@ -3841,15 +3846,13 @@ onBeforeUnmount(() => {
|
||||
<template v-if="hasValueSourceMapping && ['order_field', 'header_field', 'field'].includes(selectedRegion?.kind || '')">
|
||||
<template v-if="valueAdapterDesk.showDatasetsSection">
|
||||
<label class="xfa-incremental-field">{{ t('admin.shippingOrderProfiles.xfaDesk.datasourceField') }}
|
||||
<button
|
||||
type="button"
|
||||
class="btn-secondary"
|
||||
<el-button
|
||||
:disabled="xfaConfigReadonly || valueAdapterDesk.loading || !valueAdapterDesk.tree"
|
||||
:title="valueAdapterDesk.selectedPathLabel || t('admin.shippingOrderProfiles.xfaDesk.pickDatasetsPath')"
|
||||
@click="valueAdapterDesk.openDatasetsPicker()"
|
||||
>
|
||||
{{ valueAdapterDesk.selectedPathLabel || t('admin.shippingOrderProfiles.xfaDesk.pickDatasetsPath') }}
|
||||
</button>
|
||||
</el-button>
|
||||
</label>
|
||||
<section class="sample-value-card">
|
||||
<span>{{ t('admin.shippingOrderProfiles.xfaDesk.datasetsSampleValue') }}</span>
|
||||
@@ -3867,14 +3870,12 @@ onBeforeUnmount(() => {
|
||||
confirmed: valueAdapterDesk.splitRuleSummary.confirmed,
|
||||
}) }}
|
||||
</span>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-secondary"
|
||||
<el-button
|
||||
:disabled="xfaConfigReadonly || !valueAdapterDesk.selectedPathId"
|
||||
@click="valueAdapterDesk.openSplitRulesForSelection()"
|
||||
>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.editRules') }}
|
||||
</button>
|
||||
</el-button>
|
||||
</label>
|
||||
<p class="xfa-header-inheritance-hint">{{ t('admin.shippingOrderProfiles.xfaSplit.splitVisualReuseHint') }}</p>
|
||||
<section class="xfa-datasource-summary">
|
||||
@@ -3883,14 +3884,12 @@ onBeforeUnmount(() => {
|
||||
authoritative: valueAdapterDesk.collectionSummaryLabel.authoritative,
|
||||
mirrors: valueAdapterDesk.collectionSummaryLabel.mirrors,
|
||||
}) }}</p>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-secondary"
|
||||
<el-button
|
||||
:disabled="saveState === 'readonly'"
|
||||
@click="valueAdapterDesk.openReconfirmCollections()"
|
||||
>
|
||||
{{ t('admin.shippingOrderProfiles.xfaDesk.reconfirmCollections') }}
|
||||
</button>
|
||||
</el-button>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
@@ -3938,34 +3937,33 @@ onBeforeUnmount(() => {
|
||||
<p v-if="!deskLineRecognitionResults.length" class="recognition-empty">{{ t('admin.shippingOrderProfiles.workbench.noRecognitionResults') }}</p>
|
||||
<div v-if="canRepairMainTable" class="main-table-repair">
|
||||
<p>{{ t('admin.shippingOrderProfiles.workbench.mainTableRepairHint') }}</p>
|
||||
<select class="select-field" :disabled="repairingMainTable" @change="(event) => { requestMainTableRepair((event.target as HTMLSelectElement).value); (event.target as HTMLSelectElement).value = ''; }">
|
||||
<option value="">{{ t('admin.shippingOrderProfiles.workbench.mainTableRepairChoose') }}</option>
|
||||
<option v-for="candidate in mainTableRepairCandidates" :key="candidate.table_id" :value="candidate.table_id">
|
||||
{{ t('admin.shippingOrderProfiles.workbench.mainTableRepairCandidate', { page: candidate.page_no, rows: candidate.row_count, columns: candidate.column_count }) }}
|
||||
</option>
|
||||
</select>
|
||||
<el-select :model-value="''" :disabled="repairingMainTable" @update:model-value="(value) => { if (value) requestMainTableRepair(String(value)); }">
|
||||
<el-option value="" :label="t('admin.shippingOrderProfiles.workbench.mainTableRepairChoose')" />
|
||||
<el-option v-for="candidate in mainTableRepairCandidates" :key="candidate.table_id" :value="candidate.table_id" :label="t('admin.shippingOrderProfiles.workbench.mainTableRepairCandidate', { page: candidate.page_no, rows: candidate.row_count, columns: candidate.column_count })" />
|
||||
</el-select>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
</aside>
|
||||
|
||||
<div
|
||||
v-if="hasValueSourceMapping && valueAdapterDesk.datasetsPickerOpen"
|
||||
class="xfa-rule-dialog"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
<!-- EP 迁移:自绘遮罩弹窗 → el-dialog;单向 model-value,关闭统一回调原 close*() 以保留 composable 清理逻辑 -->
|
||||
<el-dialog
|
||||
v-if="hasValueSourceMapping"
|
||||
:model-value="valueAdapterDesk.datasetsPickerOpen"
|
||||
width="min(920px, 96vw)"
|
||||
top="4vh"
|
||||
destroy-on-close
|
||||
class="xfa-picker-dialog"
|
||||
:aria-label="t('admin.shippingOrderProfiles.xfaDesk.pickDatasetsPathTitle')"
|
||||
@keydown.esc.stop.prevent="valueAdapterDesk.closeDatasetsPicker()"
|
||||
@update:model-value="valueAdapterDesk.closeDatasetsPicker()"
|
||||
>
|
||||
<div class="xfa-rule-dialog__backdrop" @click="valueAdapterDesk.closeDatasetsPicker()" />
|
||||
<section :ref="assignXfaDatasetsPickerPanel" class="xfa-rule-dialog__panel xfa-datasets-picker-panel">
|
||||
<header class="xfa-rule-dialog__header">
|
||||
<div>
|
||||
<strong>{{ t('admin.shippingOrderProfiles.xfaDesk.pickDatasetsPathTitle') }}</strong>
|
||||
<p>{{ t('admin.shippingOrderProfiles.xfaDesk.pickDatasetsPathHint') }}</p>
|
||||
</div>
|
||||
<button type="button" class="xfa-rule-dialog__close" :aria-label="t('common.close')" @click="valueAdapterDesk.closeDatasetsPicker()">×</button>
|
||||
</header>
|
||||
<template #header>
|
||||
<div class="xfa-rule-dialog__heading">
|
||||
<strong>{{ t('admin.shippingOrderProfiles.xfaDesk.pickDatasetsPathTitle') }}</strong>
|
||||
<p>{{ t('admin.shippingOrderProfiles.xfaDesk.pickDatasetsPathHint') }}</p>
|
||||
</div>
|
||||
</template>
|
||||
<section :ref="assignXfaDatasetsPickerPanel" class="xfa-datasets-picker-panel">
|
||||
<div class="xfa-datasets-picker-body">
|
||||
<XfaDatasetTree
|
||||
expand-samples
|
||||
@@ -3981,35 +3979,25 @@ onBeforeUnmount(() => {
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<div
|
||||
v-if="hasValueSourceMapping && valueAdapterDesk.splitRuleDialogOpen"
|
||||
class="xfa-rule-dialog"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
@keydown.esc.stop.prevent="valueAdapterDesk.closeSplitRuleDialog()"
|
||||
<el-dialog
|
||||
v-if="hasValueSourceMapping"
|
||||
:model-value="valueAdapterDesk.splitRuleDialogOpen"
|
||||
width="min(860px, 94vw)"
|
||||
top="5vh"
|
||||
destroy-on-close
|
||||
class="xfa-split-dialog"
|
||||
:aria-label="t('admin.shippingOrderProfiles.xfaSplit.title')"
|
||||
@update:model-value="valueAdapterDesk.closeSplitRuleDialog()"
|
||||
>
|
||||
<div class="xfa-rule-dialog__backdrop" @click="valueAdapterDesk.closeSplitRuleDialog()" />
|
||||
<section :ref="assignXfaSplitDialogPanel" class="xfa-rule-dialog__panel">
|
||||
<header class="xfa-rule-dialog__header">
|
||||
<div>
|
||||
<strong>{{ t('admin.shippingOrderProfiles.xfaSplit.title') }}</strong>
|
||||
<p>{{ valueAdapterDesk.selectedPathLabel }}</p>
|
||||
</div>
|
||||
<div class="xfa-rule-dialog__actions">
|
||||
<button type="button" class="btn-secondary" :disabled="saveState === 'readonly'" @click="valueAdapterDesk.splitRulePanel?.addRule()">
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.addRule') }}
|
||||
</button>
|
||||
<button type="button" class="btn-secondary" :disabled="!valueAdapterDesk.dialogHasRules" @click="valueAdapterDesk.splitRulePanel?.runPreview()">
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.preview') }}
|
||||
</button>
|
||||
<button type="button" class="btn-primary" :disabled="saveState === 'readonly' || !valueAdapterDesk.dialogHasRules" @click="valueAdapterDesk.splitRulePanel?.confirmRules()">
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.confirm') }}
|
||||
</button>
|
||||
<button type="button" class="xfa-rule-dialog__close" :aria-label="t('common.close')" @click="valueAdapterDesk.closeSplitRuleDialog()">×</button>
|
||||
</div>
|
||||
</header>
|
||||
<template #header>
|
||||
<div class="xfa-rule-dialog__heading">
|
||||
<strong>{{ t('admin.shippingOrderProfiles.xfaSplit.title') }}</strong>
|
||||
<p>{{ valueAdapterDesk.selectedPathLabel }}</p>
|
||||
</div>
|
||||
</template>
|
||||
<section :ref="assignXfaSplitDialogPanel" class="xfa-split-dialog-panel">
|
||||
<XfaSplitRulePanel
|
||||
v-if="active && (valueAdapterDesk.dialogDefinition || valueAdapterDesk.definition)"
|
||||
:ref="assignXfaSplitRulePanel"
|
||||
@@ -4031,24 +4019,38 @@ onBeforeUnmount(() => {
|
||||
@confirmed="valueAdapterDesk.commitDialogSplitRules"
|
||||
/>
|
||||
</section>
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="xfa-rule-dialog__actions">
|
||||
<el-button :disabled="saveState === 'readonly'" @click="valueAdapterDesk.splitRulePanel?.addRule()">
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.addRule') }}
|
||||
</el-button>
|
||||
<el-button :disabled="!valueAdapterDesk.dialogHasRules" @click="valueAdapterDesk.splitRulePanel?.runPreview()">
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.preview') }}
|
||||
</el-button>
|
||||
<el-button type="primary" :disabled="saveState === 'readonly' || !valueAdapterDesk.dialogHasRules" @click="valueAdapterDesk.splitRulePanel?.confirmRules()">
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.confirm') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<div
|
||||
v-if="hasValueSourceMapping && valueAdapterDesk.reconfirmCollectionsOpen"
|
||||
class="xfa-rule-dialog"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
@keydown.esc.stop.prevent="valueAdapterDesk.closeReconfirmCollections()"
|
||||
<el-dialog
|
||||
v-if="hasValueSourceMapping"
|
||||
:model-value="valueAdapterDesk.reconfirmCollectionsOpen"
|
||||
width="min(720px, 94vw)"
|
||||
top="6vh"
|
||||
destroy-on-close
|
||||
class="xfa-reconfirm-dialog"
|
||||
:aria-label="t('admin.shippingOrderProfiles.xfaDesk.reconfirmCollectionsTitle')"
|
||||
@update:model-value="valueAdapterDesk.closeReconfirmCollections()"
|
||||
>
|
||||
<div class="xfa-rule-dialog__backdrop" @click="valueAdapterDesk.closeReconfirmCollections()" />
|
||||
<section class="xfa-rule-dialog__panel xfa-reconfirm-panel">
|
||||
<header class="xfa-rule-dialog__header">
|
||||
<div>
|
||||
<strong>{{ t('admin.shippingOrderProfiles.xfaDesk.reconfirmCollectionsTitle') }}</strong>
|
||||
<p>{{ t('admin.shippingOrderProfiles.xfaDesk.reconfirmCollectionsHint') }}</p>
|
||||
</div>
|
||||
<button type="button" class="xfa-rule-dialog__close" :aria-label="t('common.close')" @click="valueAdapterDesk.closeReconfirmCollections()">×</button>
|
||||
</header>
|
||||
<template #header>
|
||||
<div class="xfa-rule-dialog__heading">
|
||||
<strong>{{ t('admin.shippingOrderProfiles.xfaDesk.reconfirmCollectionsTitle') }}</strong>
|
||||
<p>{{ t('admin.shippingOrderProfiles.xfaDesk.reconfirmCollectionsHint') }}</p>
|
||||
</div>
|
||||
</template>
|
||||
<div class="xfa-reconfirm-body">
|
||||
<XfaCollectionSelector
|
||||
:candidates="valueAdapterDesk.collections"
|
||||
:authoritative-path-id="valueAdapterDesk.draftAuthoritativePathId"
|
||||
@@ -4057,14 +4059,16 @@ onBeforeUnmount(() => {
|
||||
@update:authoritative-path-id="(id) => { valueAdapterDesk.draftAuthoritativePathId = id; }"
|
||||
@update:mirror-path-ids="(ids) => { valueAdapterDesk.draftMirrorPathIds = ids; }"
|
||||
/>
|
||||
<footer class="xfa-reconfirm-actions">
|
||||
<button type="button" class="btn-secondary" @click="valueAdapterDesk.closeReconfirmCollections()">{{ t('common.cancel') }}</button>
|
||||
<button type="button" class="btn-primary" @click="valueAdapterDesk.confirmReconfirmCollections()">
|
||||
</div>
|
||||
<template #footer>
|
||||
<div class="xfa-reconfirm-actions">
|
||||
<el-button @click="valueAdapterDesk.closeReconfirmCollections()">{{ t('common.cancel') }}</el-button>
|
||||
<el-button type="primary" @click="valueAdapterDesk.confirmReconfirmCollections()">
|
||||
{{ t('admin.shippingOrderProfiles.xfaDesk.reconfirmCollectionsConfirm') }}
|
||||
</button>
|
||||
</footer>
|
||||
</section>
|
||||
</div>
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
<DeleteConfirmDialog
|
||||
v-model="mainTableRepairConfirmOpen"
|
||||
@@ -4105,8 +4109,6 @@ onBeforeUnmount(() => {
|
||||
}
|
||||
.template-mode-badge {
|
||||
margin-left: 0.5rem;
|
||||
color: #0369a1;
|
||||
font-weight: 700;
|
||||
}
|
||||
/* XFA 增量模块样式:禁止改共用 desk 网格/列宽/高度/滚动 */
|
||||
.xfa-candidate-inline {
|
||||
@@ -4191,50 +4193,18 @@ onBeforeUnmount(() => {
|
||||
gap: 8px;
|
||||
margin-top: 0.75rem;
|
||||
}
|
||||
.xfa-rule-dialog { position: fixed; z-index: 50; inset: 0; display: grid; place-items: center; padding: 24px; }
|
||||
.xfa-rule-dialog__backdrop { position: absolute; inset: 0; background: rgb(15 23 42 / .42); }
|
||||
.xfa-rule-dialog__panel {
|
||||
position: relative;
|
||||
display: flex;
|
||||
width: min(860px, 94vw);
|
||||
max-height: min(820px, 90vh);
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 0.75rem;
|
||||
background: #fff;
|
||||
box-shadow: 0 24px 70px rgb(15 23 42 / .24);
|
||||
}
|
||||
.xfa-rule-dialog__header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
padding: 14px 16px;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
}
|
||||
.xfa-rule-dialog__header p { margin: 3px 0 0; color: #64748b; font-size: 0.76rem; }
|
||||
/* EP 迁移:三处自绘遮罩弹窗 → el-dialog;此处仅保留标题副文案、内容滚动尺寸与 footer 布局,
|
||||
遮罩/关闭键/ESC/焦点由 el-dialog 内建(关闭统一回调原 close*() 函数) */
|
||||
.xfa-rule-dialog__heading strong { display: block; font-size: 1rem; }
|
||||
.xfa-rule-dialog__heading p { margin: 3px 0 0; color: var(--el-text-color-secondary); font-size: 0.76rem; font-weight: 400; }
|
||||
.xfa-picker-dialog :deep(.el-dialog__body) { padding-top: 4px; }
|
||||
.xfa-datasets-picker-panel { display: flex; max-height: min(720px, 78vh); flex-direction: column; overflow: hidden; }
|
||||
.xfa-datasets-picker-body { display: flex; min-height: 0; flex: 1; flex-direction: column; overflow: hidden; padding: 12px 0 0; }
|
||||
.xfa-datasets-picker-body :deep(.xfa-tree) { min-height: 420px; }
|
||||
.xfa-split-dialog-panel { display: flex; min-height: 0; max-height: min(640px, 72vh); overflow: auto; flex-direction: column; }
|
||||
.xfa-reconfirm-body { max-height: min(560px, 66vh); overflow: auto; }
|
||||
.xfa-rule-dialog__actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
|
||||
.xfa-rule-dialog__close {
|
||||
display: inline-grid;
|
||||
width: 34px;
|
||||
padding: 0;
|
||||
place-items: center;
|
||||
border: 0;
|
||||
border-radius: 0.45rem;
|
||||
background: transparent;
|
||||
color: #64748b;
|
||||
cursor: pointer;
|
||||
font-size: 1.15rem;
|
||||
}
|
||||
.xfa-reconfirm-panel { width: min(720px, 94vw); padding-bottom: 12px; }
|
||||
.xfa-reconfirm-panel > .xfa-collections { overflow: auto; padding: 12px 16px; min-height: 0; }
|
||||
.xfa-reconfirm-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 8px;
|
||||
padding: 12px 16px;
|
||||
border-top: 1px solid #e2e8f0;
|
||||
}
|
||||
.xfa-reconfirm-actions { display: flex; justify-content: flex-end; gap: 8px; }
|
||||
.link { border: 0; background: transparent; color: #0369a1; cursor: pointer; }
|
||||
.schema-warning,
|
||||
.schema-hint {
|
||||
@@ -4257,10 +4227,9 @@ onBeforeUnmount(() => {
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
.config button,
|
||||
.page-nav button,
|
||||
.blind-test button,
|
||||
.canvas-warning button {
|
||||
/* EP 迁移:动作按钮已迁 el-button(样式交给 element-trial 主题);此规则仅保留
|
||||
识别结果行(recognition-row)这类原生列表按钮的基底外观 */
|
||||
.config button:not(.el-button) {
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 0.45rem;
|
||||
background: white;
|
||||
@@ -4317,22 +4286,15 @@ onBeforeUnmount(() => {
|
||||
color: #b91c1c;
|
||||
font-size: 0.72rem;
|
||||
}
|
||||
/* EP 迁移:原生 input/select → el-input / el-select;label 内控件占满整行 */
|
||||
.editor label {
|
||||
color: #475569;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
.editor .input-field,
|
||||
.editor .select-field {
|
||||
display: block;
|
||||
.editor label :deep(.el-input),
|
||||
.editor label :deep(.el-select) {
|
||||
width: 100%;
|
||||
margin-top: 0.3rem;
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 0.35rem;
|
||||
background: white;
|
||||
padding: 0.45rem;
|
||||
color: #172033;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
.desk {
|
||||
display: grid;
|
||||
@@ -4457,8 +4419,9 @@ onBeforeUnmount(() => {
|
||||
display: grid;
|
||||
gap: 0.45rem;
|
||||
padding: 0.85rem;
|
||||
background: #f8fafc;
|
||||
background: var(--el-fill-color-light);
|
||||
}
|
||||
.reservation-region-config__clear { justify-self: start; }
|
||||
.reservation-region-config p,
|
||||
.reservation-region-config small {
|
||||
margin: 0;
|
||||
@@ -4555,9 +4518,6 @@ onBeforeUnmount(() => {
|
||||
.editor .binding-suggestion {
|
||||
width: 100%;
|
||||
margin-top: 0.5rem;
|
||||
border-color: var(--status-info-border);
|
||||
background: var(--status-info-bg);
|
||||
color: var(--status-info-fg);
|
||||
text-align: left;
|
||||
}
|
||||
.empty {
|
||||
@@ -4642,16 +4602,16 @@ onBeforeUnmount(() => {
|
||||
padding: 1.5rem;
|
||||
}
|
||||
.save-status,
|
||||
.training-sample-status { border-radius: 999px; background: #e2e8f0; padding: .4rem .6rem; color: #334155; font-size: .72rem; }
|
||||
.save-status--saving { background: #dbeafe; color: #1d4ed8; }.save-status--failed,.save-status--readonly { background: #fee2e2; color: #b91c1c; }.save-status--saved { background: #dcfce7; color: #166534; }
|
||||
.training-sample-status { background: #dcfce7; color: #166534; }
|
||||
.editor-workbench { padding: 0; background: #0f172a; }
|
||||
.training-sample-status { margin-right: .25rem; }
|
||||
/* EP 迁移:保存状态/训练样本/模板模式徽标 → el-tag(类型映射:saved=success /
|
||||
saving=primary / failed|readonly=danger;训练样本=success;模板模式=info plain) */
|
||||
.editor-workbench { padding: 0; background: var(--el-fill-color-light); }
|
||||
.editor-mode-error {
|
||||
display: flex; flex-direction: column; gap: 12px; align-items: flex-start;
|
||||
margin: 24px; padding: 20px; border: 1px solid #fecaca; border-radius: 0.75rem; background: #fef2f2; color: #991b1b;
|
||||
}
|
||||
.editor-workbench .bench-header { max-width: none; padding: .7rem 1rem; color: #e2e8f0; }
|
||||
.editor-workbench .bench-header p { color: #94a3b8; }
|
||||
.editor-workbench .bench-header { max-width: none; padding: .7rem 1rem; color: var(--el-text-color-primary); }
|
||||
.editor-workbench .bench-header p { color: var(--el-text-color-secondary); }
|
||||
.editor-title { min-width: 0; }
|
||||
.editor-workbench .desk { max-width: none; min-height: calc(100vh - 7rem); border-inline: 0; box-shadow: none; }
|
||||
.editor-desk { grid-template-columns: minmax(0, 1fr) 20rem; }
|
||||
@@ -4714,7 +4674,7 @@ onBeforeUnmount(() => {
|
||||
.automark-choice-block label { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; color: #334155; font-size: .74rem; font-weight: 700; }
|
||||
.automark-choice-block--fields { grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); }
|
||||
.automark-status-panel__actions { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
|
||||
.automark-status-panel__actions .select-field { min-width: 12rem; }
|
||||
.automark-status-panel__actions .el-select { min-width: 12rem; }
|
||||
@media (max-width: 640px) {
|
||||
.automark-status-panel { top: 0; }
|
||||
.automark-status-panel__actions { align-items: stretch; }
|
||||
@@ -4897,22 +4857,13 @@ onBeforeUnmount(() => {
|
||||
.control-label {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
.config button,
|
||||
.page-nav button,
|
||||
.blind-test button,
|
||||
.canvas-warning button {
|
||||
/* EP 迁移:仅识别结果行等原生按钮仍走应用 token;el-button 由 element-trial 主题接管 */
|
||||
.config button:not(.el-button) {
|
||||
border-color: var(--border-default);
|
||||
border-radius: var(--radius-control);
|
||||
background: var(--bg-surface);
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
.editor input,
|
||||
.editor select {
|
||||
box-sizing: border-box;
|
||||
border-color: var(--border-default);
|
||||
background: var(--bg-surface);
|
||||
color: var(--text-primary);
|
||||
}
|
||||
.sample-control {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
+158
-118
@@ -1,13 +1,32 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/OrderProfileLibraryPage.vue
|
||||
用途:按 profile_code 聚合展示订单文档模板族,是创建和继续编辑的唯一首页。
|
||||
依赖:Profile family API、统一 binding 迁移 scan/dry-run API、Vue Router、Vue I18n。
|
||||
逻辑:列表只选择下一步路由;展示统一 binding 迁移状态与待补框筛选;支持批量 Dry Run。
|
||||
依赖:element-plus(按钮/搜索/筛选/表格/标签/空态/骨架屏,沿用管理端 element-trial 主题)、
|
||||
Profile family API、统一 binding 迁移 scan/dry-run API、DeleteConfirmDialog、
|
||||
Vue Router、Vue I18n。
|
||||
逻辑:列表只选择下一步路由;展示统一 binding 迁移状态与待补框筛选;支持批量 Dry Run;
|
||||
业务脚本(加载/筛选/复制/删除/Dry Run)保持原逻辑不变,仅视觉层迁移 EP
|
||||
(与在途调拨类型页同一范式:搜索+筛选一行、el-table 列语义不变)。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import {
|
||||
ElButton,
|
||||
ElEmpty,
|
||||
ElInput,
|
||||
ElOption,
|
||||
ElSelect,
|
||||
ElSkeleton,
|
||||
ElTable,
|
||||
ElTableColumn,
|
||||
ElTag,
|
||||
} from 'element-plus';
|
||||
import { Plus, Search } from '@element-plus/icons-vue';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||
@@ -176,28 +195,37 @@ onMounted(loadFamilies);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="mx-auto max-w-7xl space-y-6 p-6">
|
||||
<!-- 全宽布局:水平内边距由 AdminLayout 壳层统一持有 -->
|
||||
<section class="space-y-6">
|
||||
<header class="page-header">
|
||||
<div>
|
||||
<h1 class="section-title">{{ t('admin.shippingOrderProfiles.library.title') }}</h1>
|
||||
<p class="section-desc mt-1">{{ t('admin.shippingOrderProfiles.library.subtitle') }}</p>
|
||||
<h1 class="page-title">{{ t('admin.shippingOrderProfiles.library.title') }}</h1>
|
||||
<p class="page-desc">{{ t('admin.shippingOrderProfiles.library.subtitle') }}</p>
|
||||
</div>
|
||||
<button class="btn-primary" type="button" @click="router.push({ name: 'AdminShippingOrderDocumentProfileCreate' })">
|
||||
<el-button type="primary" :icon="Plus" @click="router.push({ name: 'AdminShippingOrderDocumentProfileCreate' })">
|
||||
{{ t('admin.shippingOrderProfiles.library.create') }}
|
||||
</button>
|
||||
</el-button>
|
||||
</header>
|
||||
|
||||
<!-- 筛选与搜索同一行:搜索(回车/清空即过滤,computed 实时生效)+ 迁移筛选 + 批量 Dry Run -->
|
||||
<div class="toolbar">
|
||||
<input v-model="query" class="toolbar-input" :placeholder="t('admin.shippingOrderProfiles.library.search')" type="search">
|
||||
<select v-model="migrationFilter" class="toolbar-select" data-testid="order-profile-unified-migration-filter">
|
||||
<option value="all">{{ t('admin.shippingOrderProfiles.unifiedMigration.filterAll') }}</option>
|
||||
<option value="needs_migration">{{ t('admin.shippingOrderProfiles.unifiedMigration.filterNeedsMigration') }}</option>
|
||||
<option value="pending_visual">{{ t('admin.shippingOrderProfiles.unifiedMigration.filterPendingVisual') }}</option>
|
||||
</select>
|
||||
<button
|
||||
class="btn-secondary btn-sm"
|
||||
type="button"
|
||||
<el-input
|
||||
v-model="query"
|
||||
class="toolbar-search"
|
||||
type="search"
|
||||
:placeholder="t('admin.shippingOrderProfiles.library.search')"
|
||||
:prefix-icon="Search"
|
||||
clearable
|
||||
/>
|
||||
<el-select v-model="migrationFilter" class="toolbar-filter" data-testid="order-profile-unified-migration-filter">
|
||||
<el-option value="all" :label="t('admin.shippingOrderProfiles.unifiedMigration.filterAll')" />
|
||||
<el-option value="needs_migration" :label="t('admin.shippingOrderProfiles.unifiedMigration.filterNeedsMigration')" />
|
||||
<el-option value="pending_visual" :label="t('admin.shippingOrderProfiles.unifiedMigration.filterPendingVisual')" />
|
||||
</el-select>
|
||||
<el-button
|
||||
size="small"
|
||||
data-testid="order-profile-unified-migration-batch-dry-run"
|
||||
:loading="batchDryRunLoading"
|
||||
:disabled="batchDryRunLoading || migrationTotals.needsMigration === 0"
|
||||
@click="runBatchUnifiedMigrationDryRun"
|
||||
>
|
||||
@@ -206,7 +234,7 @@ onMounted(loadFamilies);
|
||||
? t('admin.shippingOrderProfiles.unifiedMigration.batchDryRunRunning')
|
||||
: t('admin.shippingOrderProfiles.unifiedMigration.batchDryRun', { count: migrationTotals.needsMigration })
|
||||
}}
|
||||
</button>
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<p v-if="families.length" class="migration-summary" data-testid="order-profile-unified-migration-summary">
|
||||
@@ -220,69 +248,102 @@ onMounted(loadFamilies);
|
||||
</p>
|
||||
|
||||
<section class="library-card" :aria-busy="loading">
|
||||
<p v-if="loading" class="library-state">{{ t('admin.shippingOrderProfiles.library.loading') }}</p>
|
||||
<p v-else-if="!filteredFamilies.length" class="library-state">{{ t('admin.shippingOrderProfiles.library.empty') }}</p>
|
||||
<div v-else class="table-scroll">
|
||||
<table class="profile-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ t('admin.shippingOrderProfiles.name') }}</th>
|
||||
<th>{{ t('admin.shippingOrderProfiles.code') }}</th>
|
||||
<th>{{ t('admin.shippingOrderProfiles.library.status') }}</th>
|
||||
<th>{{ t('admin.shippingOrderProfiles.unifiedMigration.columnTitle') }}</th>
|
||||
<th class="actions-heading">{{ t('admin.shippingOrderProfiles.library.actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="item in filteredFamilies" :key="item.profile_code">
|
||||
<td class="profile-name">{{ item.display_name }}</td>
|
||||
<td><code>{{ item.profile_code }}</code></td>
|
||||
<td>
|
||||
<span class="status-badge" :class="{ draft: item.draft_profile_id, published: !item.draft_profile_id && item.published_profile_id }">
|
||||
{{ item.draft_profile_id ? t('admin.shippingOrderProfiles.library.draft') : item.published_profile_id ? t('admin.shippingOrderProfiles.library.published', { version: item.published_version }) : t('admin.shippingOrderProfiles.library.retired') }}
|
||||
</span>
|
||||
<small v-if="item.published_profile_id && item.current_schema_version" class="schema-status" :class="{ warning: schemaMigrationRequired(item) }">
|
||||
{{ schemaMigrationRequired(item)
|
||||
? t('admin.shippingOrderProfiles.schemaMigration.versionMismatch', { bound: item.published_schema_version, current: item.current_schema_version })
|
||||
: t('admin.shippingOrderProfiles.schemaMigration.versionMatched', { version: item.current_schema_version }) }}
|
||||
</small>
|
||||
</td>
|
||||
<td>
|
||||
<span
|
||||
v-if="item.unified_binding_status"
|
||||
class="unified-migration-badge"
|
||||
:class="item.unified_binding_status"
|
||||
data-testid="order-profile-unified-migration-status"
|
||||
>
|
||||
{{ t(`admin.shippingOrderProfiles.unifiedMigration.status.${item.unified_binding_status}`) }}
|
||||
</span>
|
||||
<small v-if="(item.unified_pending_visual_count ?? 0) > 0" class="schema-status warning">
|
||||
{{ t('admin.shippingOrderProfiles.unifiedMigration.pendingVisualShort', { count: item.unified_pending_visual_count }) }}
|
||||
</small>
|
||||
</td>
|
||||
<td class="profile-library__actions">
|
||||
<!-- flex 必须放在 td 内层,避免破坏 table-cell 盒模型导致行分隔线错位 -->
|
||||
<div class="profile-library__actions-inner">
|
||||
<button v-if="item.draft_profile_id" class="btn-ghost btn-sm" type="button" @click="continueEditing(item)">{{ t('admin.shippingOrderProfiles.versionCenter.continueEditing') }}</button>
|
||||
<button v-if="item.draft_profile_id" class="btn-danger btn-sm" type="button" @click="requestDeleteDraft(item)">{{ t('admin.delete') }}</button>
|
||||
<button v-else-if="item.published_profile_id && !schemaMigrationRequired(item)" class="btn-secondary btn-sm" type="button" @click="createNewVersion(item)">{{ t('admin.shippingOrderProfiles.newVersion') }}</button>
|
||||
<button v-if="!item.draft_profile_id && item.published_profile_id && schemaMigrationRequired(item)" class="btn-secondary btn-sm" type="button" @click="openSchemaMigration(item)">{{ t('admin.shippingOrderProfiles.schemaMigration.listAction') }}</button>
|
||||
<button class="btn-ghost btn-sm" type="button" @click="viewVersion(item)">{{ t('admin.shippingOrderProfiles.versionCenter.viewVersion') }}</button>
|
||||
<button
|
||||
v-if="item.unified_binding_status === 'needs_migration' || item.unified_needs_migration"
|
||||
class="btn-ghost btn-sm"
|
||||
type="button"
|
||||
data-testid="order-profile-unified-migration-open"
|
||||
@click="openUnifiedMigration(item)"
|
||||
>
|
||||
{{ t('admin.shippingOrderProfiles.unifiedMigration.open') }}
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<el-skeleton v-if="loading" class="library-skeleton" :rows="6" animated />
|
||||
<el-empty
|
||||
v-else-if="!filteredFamilies.length"
|
||||
:description="t('admin.shippingOrderProfiles.library.empty')"
|
||||
:image-size="60"
|
||||
/>
|
||||
<el-table v-else :data="filteredFamilies" row-key="profile_code" class="profile-table">
|
||||
<el-table-column prop="display_name" :label="t('admin.shippingOrderProfiles.name')" min-width="200">
|
||||
<template #default="{ row }">
|
||||
<span class="profile-name">{{ row.display_name }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.shippingOrderProfiles.code')" min-width="170">
|
||||
<template #default="{ row }">
|
||||
<code class="profile-code">{{ row.profile_code }}</code>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.shippingOrderProfiles.library.status')" min-width="210">
|
||||
<template #default="{ row }">
|
||||
<el-tag size="small" :type="row.draft_profile_id ? 'primary' : row.published_profile_id ? 'success' : 'info'">
|
||||
{{ row.draft_profile_id
|
||||
? t('admin.shippingOrderProfiles.library.draft')
|
||||
: row.published_profile_id
|
||||
? t('admin.shippingOrderProfiles.library.published', { version: row.published_version })
|
||||
: t('admin.shippingOrderProfiles.library.retired') }}
|
||||
</el-tag>
|
||||
<small
|
||||
v-if="row.published_profile_id && row.current_schema_version"
|
||||
class="schema-status"
|
||||
:class="{ 'schema-status--warning': schemaMigrationRequired(row as OrderProfileVersionFamilySummary) }"
|
||||
>
|
||||
{{ schemaMigrationRequired(row as OrderProfileVersionFamilySummary)
|
||||
? t('admin.shippingOrderProfiles.schemaMigration.versionMismatch', { bound: row.published_schema_version, current: row.current_schema_version })
|
||||
: t('admin.shippingOrderProfiles.schemaMigration.versionMatched', { version: row.current_schema_version }) }}
|
||||
</small>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.shippingOrderProfiles.unifiedMigration.columnTitle')" min-width="190">
|
||||
<template #default="{ row }">
|
||||
<el-tag
|
||||
v-if="row.unified_binding_status"
|
||||
size="small"
|
||||
:type="row.unified_binding_status === 'needs_migration' ? 'warning' : row.unified_binding_status === 'pending_visual' ? 'danger' : 'success'"
|
||||
data-testid="order-profile-unified-migration-status"
|
||||
>
|
||||
{{ t(`admin.shippingOrderProfiles.unifiedMigration.status.${row.unified_binding_status}`) }}
|
||||
</el-tag>
|
||||
<small v-if="(row.unified_pending_visual_count ?? 0) > 0" class="schema-status schema-status--warning">
|
||||
{{ t('admin.shippingOrderProfiles.unifiedMigration.pendingVisualShort', { count: row.unified_pending_visual_count }) }}
|
||||
</small>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.shippingOrderProfiles.library.actions')" min-width="260">
|
||||
<template #default="{ row }">
|
||||
<div class="row-actions">
|
||||
<el-button v-if="row.draft_profile_id" link type="primary" size="small" @click="continueEditing(row as OrderProfileVersionFamilySummary)">
|
||||
{{ t('admin.shippingOrderProfiles.versionCenter.continueEditing') }}
|
||||
</el-button>
|
||||
<el-button v-if="row.draft_profile_id" link type="danger" size="small" @click="requestDeleteDraft(row as OrderProfileVersionFamilySummary)">
|
||||
{{ t('admin.delete') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-else-if="row.published_profile_id && !schemaMigrationRequired(row as OrderProfileVersionFamilySummary)"
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="createNewVersion(row as OrderProfileVersionFamilySummary)"
|
||||
>
|
||||
{{ t('admin.shippingOrderProfiles.newVersion') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="!row.draft_profile_id && row.published_profile_id && schemaMigrationRequired(row as OrderProfileVersionFamilySummary)"
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="openSchemaMigration(row as OrderProfileVersionFamilySummary)"
|
||||
>
|
||||
{{ t('admin.shippingOrderProfiles.schemaMigration.listAction') }}
|
||||
</el-button>
|
||||
<el-button link type="primary" size="small" @click="viewVersion(row as OrderProfileVersionFamilySummary)">
|
||||
{{ t('admin.shippingOrderProfiles.versionCenter.viewVersion') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="row.unified_binding_status === 'needs_migration' || row.unified_needs_migration"
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
data-testid="order-profile-unified-migration-open"
|
||||
@click="openUnifiedMigration(row as OrderProfileVersionFamilySummary)"
|
||||
>
|
||||
{{ t('admin.shippingOrderProfiles.unifiedMigration.open') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</section>
|
||||
<DeleteConfirmDialog
|
||||
v-model="deleteConfirmOpen"
|
||||
@@ -293,48 +354,27 @@ onMounted(loadFamilies);
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* 全宽布局:水平内边距由 AdminLayout 壳层统一持有,页面只保留内部块间距(根 space-y-6) */
|
||||
.page-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; }
|
||||
.page-header h1 { margin: 0; }
|
||||
.page-header p { margin: 0; }
|
||||
.page-title { margin: 0; font-size: 20px; font-weight: 700; }
|
||||
.page-desc { margin: 4px 0 0; color: var(--el-text-color-secondary); font-size: 13px; }
|
||||
/* 筛选与搜索同一行 */
|
||||
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
||||
.toolbar-select {
|
||||
min-width: 180px; border: 1px solid #d9e2ec; border-radius: 6px; background: #fff;
|
||||
padding: 7px 9px; color: #334155; font: inherit; font-size: 12px;
|
||||
}
|
||||
.migration-summary { margin: 0; color: #64748b; font-size: 12px; }
|
||||
.unified-migration-badge {
|
||||
display: inline-flex; border: 1px solid #cbd5e1; border-radius: 999px; background: #f8fafc;
|
||||
padding: 3px 8px; color: #64748b; font-size: 11px; font-weight: 600; white-space: nowrap;
|
||||
}
|
||||
.unified-migration-badge.needs_migration { border-color: #fde68a; background: #fffbeb; color: #b45309; }
|
||||
.unified-migration-badge.pending_visual { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }
|
||||
.unified-migration-badge.ready { border-color: #bbf7d0; background: #f0fdf4; color: #15803d; }
|
||||
.toolbar-input {
|
||||
min-width: 220px; flex: 1 1 220px; border: 1px solid #d9e2ec; border-radius: 6px; background: #fff;
|
||||
padding: 7px 9px; color: #334155; font: inherit; font-size: 12px; outline: none;
|
||||
}
|
||||
.toolbar-input:focus { border-color: #38bdf8; box-shadow: 0 0 0 2px rgb(56 189 248 / 12%); }
|
||||
.library-card { overflow: hidden; border: 1px solid #dfe7ef; border-radius: 10px; background: #fff; box-shadow: 0 1px 2px rgb(15 23 42 / 3%); }
|
||||
.library-state { margin: 0; padding: 48px 24px; color: #94a3b8; font-size: 13px; text-align: center; }
|
||||
.table-scroll { overflow-x: auto; }
|
||||
.profile-table { width: 100%; min-width: 720px; border-collapse: collapse; color: #475569; font-size: 13px; }
|
||||
.profile-table th { background: #f8fafc; color: #64748b; font-size: 12px; font-weight: 600; }
|
||||
.profile-table th, .profile-table td { padding: 13px 16px; border-bottom: 1px solid #e5ebf1; text-align: left; vertical-align: middle; }
|
||||
.profile-table tbody tr:last-child td { border-bottom: 0; }
|
||||
.profile-table tbody tr:hover { background: #fbfdff; }
|
||||
.profile-name { color: #334155; font-weight: 600; }
|
||||
.profile-table code { color: #64748b; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; white-space: nowrap; }
|
||||
.status-badge { display: inline-flex; border: 1px solid #cbd5e1; border-radius: 999px; background: #f8fafc; padding: 3px 8px; color: #64748b; font-size: 11px; font-weight: 600; white-space: nowrap; }
|
||||
.status-badge.draft { border-color: #bae6fd; background: #f0f9ff; color: #0369a1; }
|
||||
.status-badge.published { border-color: #bbf7d0; background: #f0fdf4; color: #15803d; }
|
||||
.schema-status { display: block; margin-top: 5px; color: #64748b; font-size: 11px; white-space: nowrap; }.schema-status.warning { color: #b45309; }
|
||||
.actions-heading { min-width: 190px; }
|
||||
.profile-library__actions { vertical-align: middle; }
|
||||
.profile-library__actions-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
|
||||
.toolbar-search { width: 260px; }
|
||||
.toolbar-filter { width: 200px; }
|
||||
.migration-summary { margin: 0; color: var(--el-text-color-secondary); font-size: 12px; }
|
||||
.library-card { overflow: hidden; border: 1px solid var(--el-border-color-light); border-radius: 10px; background: var(--el-bg-color); box-shadow: var(--el-box-shadow-lighter); }
|
||||
.library-skeleton { padding: 16px; }
|
||||
.profile-name { color: var(--el-text-color-primary); font-weight: 600; }
|
||||
.profile-code { color: var(--el-text-color-secondary); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; white-space: nowrap; }
|
||||
.schema-status { display: block; margin-top: 5px; color: var(--el-text-color-secondary); font-size: 12px; white-space: nowrap; }
|
||||
.schema-status--warning { color: var(--el-color-warning); }
|
||||
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
|
||||
.row-actions .el-button + .el-button { margin-left: 0; }
|
||||
|
||||
@media (max-width: 700px) {
|
||||
.page-header { flex-direction: column; }
|
||||
.btn-primary { width: 100%; }
|
||||
.toolbar-input { min-width: 0; }
|
||||
.page-header .el-button { width: 100%; }
|
||||
.toolbar-search { width: 100%; }
|
||||
}
|
||||
</style>
|
||||
+82
-54
@@ -1,14 +1,27 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/OrderProfilePublishCheckPage.vue
|
||||
用途:展示版面签名、跨模板唯一性与发布阻断项,并在门禁通过后发布模板。
|
||||
依赖:发布检查 API、验证运行 API、Vue Router 和统一消息提示。
|
||||
依赖:element-plus(el-button/el-descriptions/el-tag/el-checkbox,沿用管理端 element-trial 主题)、
|
||||
发布检查 API、验证运行 API、Vue Router 和统一消息提示。
|
||||
逻辑:自动选择当前样本试读通过运行;服务端生成签名/重叠验证;阻断项不可绕过,语义差异须逐项确认;
|
||||
XFA path 覆盖不全时展示 missing_fields 的 scope.field_code,避免同名 header/line 误判。
|
||||
视觉层已迁移 Element Plus(指标 dl→el-descriptions,警告勾选→el-checkbox,状态→el-tag),业务脚本保持原样。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import {
|
||||
ElButton,
|
||||
ElCheckbox,
|
||||
ElCheckboxGroup,
|
||||
ElDescriptions,
|
||||
ElDescriptionsItem,
|
||||
ElTag,
|
||||
} from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { createRandomUuid } from '@/shared/utils/id';
|
||||
@@ -245,57 +258,69 @@ onMounted(loadRuns);
|
||||
<h1 class="section-title">{{ t('admin.orderProfilePublishCheck.title') }}</h1>
|
||||
<small class="section-desc mt-1">{{ t('admin.orderProfilePublishCheck.description') }}</small>
|
||||
</div>
|
||||
<button type="button" class="btn-secondary" @click="backToValidation">{{ t('admin.orderProfilePublishCheck.back') }}</button>
|
||||
<el-button @click="backToValidation">{{ t('admin.orderProfilePublishCheck.back') }}</el-button>
|
||||
</header>
|
||||
|
||||
<section v-if="!report" class="card">
|
||||
<h2>{{ t('admin.orderProfilePublishCheck.readyTitle') }}</h2>
|
||||
<p>{{ validationRun ? t('admin.orderProfilePublishCheck.readyHint') : t('admin.orderProfilePublishCheck.noRun') }}</p>
|
||||
<button class="btn-primary" :disabled="busy || !validationRun" type="button" @click="createReport">
|
||||
<el-button type="primary" :disabled="busy || !validationRun" :loading="busy" @click="createReport">
|
||||
{{ t('admin.orderProfilePublishCheck.create') }}
|
||||
</button>
|
||||
</el-button>
|
||||
</section>
|
||||
|
||||
<template v-else>
|
||||
<section class="card">
|
||||
<div class="card-head">
|
||||
<h2>{{ t('admin.orderProfilePublishCheck.reportTitle') }}</h2>
|
||||
<button class="btn-secondary" :disabled="busy || !validationRun" type="button" @click="createReport">
|
||||
<el-button :disabled="busy || !validationRun" :loading="busy" @click="createReport">
|
||||
{{ t('admin.orderProfilePublishCheck.rerun') }}
|
||||
</button>
|
||||
</el-button>
|
||||
</div>
|
||||
<p :class="['gate-status', gateStatus]">{{ gateStatus === 'blocked' ? t('admin.orderProfilePublishCheck.blockedHint') : t('admin.orderProfilePublishCheck.reviewHint') }}</p>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h3>{{ t('admin.orderProfilePublishCheck.layoutSignatureTitle') }}</h3>
|
||||
<dl class="metrics">
|
||||
<div><dt>{{ t('admin.orderProfilePublishCheck.signatureStatus') }}</dt><dd :class="`status-${signatureStatusDetail?.status || 'unknown'}`">{{ signatureStatus(signatureStatusDetail?.status) }}</dd></div>
|
||||
<div><dt>{{ t('admin.orderProfilePublishCheck.signatureSampleCount') }}</dt><dd>{{ signatureStatusDetail?.source_sample_count ?? '—' }}</dd></div>
|
||||
<div v-for="metric in signatureIdentityMetrics" :key="metric.label"><dt>{{ metric.label }}</dt><dd>{{ metric.value }}</dd></div>
|
||||
<div><dt>{{ t('admin.orderProfilePublishCheck.matcherPolicyVersion') }}</dt><dd>{{ report.matcher_policy_version || signatureStatusDetail?.matcher_policy_version || '—' }}</dd></div>
|
||||
</dl>
|
||||
<el-descriptions class="metrics" :column="2" size="small">
|
||||
<el-descriptions-item :label="t('admin.orderProfilePublishCheck.signatureStatus')">
|
||||
<el-tag size="small" :type="signatureStatusDetail?.status === 'valid' ? 'success' : signatureStatusDetail?.status === 'stale' ? 'warning' : 'info'">
|
||||
{{ signatureStatus(signatureStatusDetail?.status) }}
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.orderProfilePublishCheck.signatureSampleCount')">{{ signatureStatusDetail?.source_sample_count ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item
|
||||
v-for="metric in signatureIdentityMetrics"
|
||||
:key="metric.label"
|
||||
:label="metric.label"
|
||||
>{{ metric.value }}</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.orderProfilePublishCheck.matcherPolicyVersion')">{{ report.matcher_policy_version || signatureStatusDetail?.matcher_policy_version || '—' }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</section>
|
||||
|
||||
<section class="card">
|
||||
<h3>{{ t('admin.orderProfilePublishCheck.uniquenessTitle') }}</h3>
|
||||
<dl class="metrics">
|
||||
<div><dt>{{ t('admin.orderProfilePublishCheck.trainingUniqueRate') }}</dt><dd>{{ formatRate(report.overlap_summary?.self_unique_hit_rate_training) }}</dd></div>
|
||||
<div><dt>{{ t('admin.orderProfilePublishCheck.blindUniqueRate') }}</dt><dd>{{ formatRate(report.overlap_summary?.self_unique_hit_rate_blind) }}</dd></div>
|
||||
<div><dt>{{ t('admin.orderProfilePublishCheck.falseHitCount') }}</dt><dd>{{ report.overlap_summary?.false_hit_other_count ?? 0 }}</dd></div>
|
||||
<div><dt>{{ t('admin.orderProfilePublishCheck.reverseFalseHitCount') }}</dt><dd>{{ report.overlap_summary?.reverse_false_hit_count ?? 0 }}</dd></div>
|
||||
<div><dt>{{ t('admin.orderProfilePublishCheck.ambiguousCount') }}</dt><dd>{{ report.overlap_summary?.ambiguous_count ?? 0 }}</dd></div>
|
||||
<div><dt>{{ t('admin.orderProfilePublishCheck.minEvidenceCoverage') }}</dt><dd>{{ formatRate(report.overlap_summary?.min_evidence_coverage) }} / ≥ {{ formatRate(report.overlap_summary?.thresholds?.evidence_coverage_minimum) }}</dd></div>
|
||||
<div><dt>{{ t('admin.orderProfilePublishCheck.minMargin') }}</dt><dd>{{ report.overlap_summary?.min_margin ?? '—' }} / ≥ {{ report.overlap_summary?.thresholds?.minimum_margin ?? '—' }}</dd></div>
|
||||
<div><dt>{{ t('admin.orderProfilePublishCheck.parseFailedCount') }}</dt><dd>{{ report.overlap_summary?.parse_validation_failed_count ?? 0 }}</dd></div>
|
||||
</dl>
|
||||
<el-descriptions class="metrics" :column="2" size="small">
|
||||
<el-descriptions-item :label="t('admin.orderProfilePublishCheck.trainingUniqueRate')">{{ formatRate(report.overlap_summary?.self_unique_hit_rate_training) }}</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.orderProfilePublishCheck.blindUniqueRate')">{{ formatRate(report.overlap_summary?.self_unique_hit_rate_blind) }}</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.orderProfilePublishCheck.falseHitCount')">{{ report.overlap_summary?.false_hit_other_count ?? 0 }}</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.orderProfilePublishCheck.reverseFalseHitCount')">{{ report.overlap_summary?.reverse_false_hit_count ?? 0 }}</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.orderProfilePublishCheck.ambiguousCount')">{{ report.overlap_summary?.ambiguous_count ?? 0 }}</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.orderProfilePublishCheck.minEvidenceCoverage')">{{ formatRate(report.overlap_summary?.min_evidence_coverage) }} / ≥ {{ formatRate(report.overlap_summary?.thresholds?.evidence_coverage_minimum) }}</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.orderProfilePublishCheck.minMargin')">{{ report.overlap_summary?.min_margin ?? '—' }} / ≥ {{ report.overlap_summary?.thresholds?.minimum_margin ?? '—' }}</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.orderProfilePublishCheck.parseFailedCount')">{{ report.overlap_summary?.parse_validation_failed_count ?? 0 }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</section>
|
||||
|
||||
<section v-if="adapterValidationMetrics.length" class="card">
|
||||
<h3>{{ t('admin.orderProfilePublishCheck.xfaUnifiedMetricsTitle') }}</h3>
|
||||
<dl class="metrics">
|
||||
<div v-for="metric in adapterValidationMetrics" :key="metric.label"><dt>{{ metric.label }}</dt><dd>{{ formatRate(metric.value) }}</dd></div>
|
||||
</dl>
|
||||
<el-descriptions class="metrics" :column="2" size="small">
|
||||
<el-descriptions-item
|
||||
v-for="metric in adapterValidationMetrics"
|
||||
:key="metric.label"
|
||||
:label="metric.label"
|
||||
>{{ formatRate(metric.value) }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</section>
|
||||
|
||||
<section v-if="conflictProfiles.length" class="card">
|
||||
@@ -304,7 +329,7 @@ onMounted(loadRuns);
|
||||
<strong>{{ conflict.profile_code }} v{{ conflict.version }}</strong>
|
||||
<p class="reasons">{{ conflict.reason_codes.map(conflictReason).join(';') }}</p>
|
||||
<p>{{ conflict.suggestion }}</p>
|
||||
<button type="button" class="btn-secondary" @click="backToEditor">{{ t('admin.orderProfilePublishCheck.backToEditor') }}</button>
|
||||
<el-button @click="backToEditor">{{ t('admin.orderProfilePublishCheck.backToEditor') }}</el-button>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
@@ -316,49 +341,52 @@ onMounted(loadRuns);
|
||||
</ul>
|
||||
|
||||
<h3>{{ t('admin.orderProfilePublishCheck.warnings') }}</h3>
|
||||
<label v-for="item in report.warning_items" :key="String(item.key)">
|
||||
<input v-model="confirmed" type="checkbox" :value="String(item.key)">
|
||||
<span>{{ itemMessage(item) }}</span>
|
||||
</label>
|
||||
<el-checkbox-group v-model="confirmed">
|
||||
<el-checkbox
|
||||
v-for="item in report.warning_items"
|
||||
:key="String(item.key)"
|
||||
:value="String(item.key)"
|
||||
class="warning-item"
|
||||
>
|
||||
{{ itemMessage(item) }}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
<p v-if="report.warning_items.length" class="hint">{{ t('admin.orderProfilePublishCheck.confirmHint') }}</p>
|
||||
<button class="btn-primary" :disabled="busy || !publishable" type="button" @click="publish">
|
||||
<el-button type="primary" class="publish-button" :disabled="busy || !publishable" :loading="busy" @click="publish">
|
||||
{{ t('admin.orderProfilePublishCheck.confirm') }}
|
||||
</button>
|
||||
</el-button>
|
||||
</section>
|
||||
</template>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.page { width: 100%; margin: 0; padding: 24px; color: #334155; }
|
||||
/* 根容器不再自带水平 padding:由 Admin 壳层统一持有,页面只保留卡片间距 */
|
||||
.page { width: 100%; color: var(--el-text-color-regular); }
|
||||
.page header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; }
|
||||
.page h1 { margin: 0; }
|
||||
.page small:not(.section-desc), .card p { color: #64748b; font-size: 13px; line-height: 1.5; }
|
||||
.page small:not(.section-desc), .card p { color: var(--el-text-color-secondary); font-size: 13px; line-height: 1.5; }
|
||||
.page small { display: block; margin-top: 5px; }
|
||||
.card { margin-top: 20px; border: 1px solid #dfe7ef; border-radius: 10px; background: #fff; padding: 16px; box-shadow: 0 1px 2px rgb(15 23 42 / 3%); }
|
||||
.card { margin-top: 20px; border: 1px solid var(--el-border-color-lighter); border-radius: 10px; background: var(--el-bg-color); padding: 16px; box-shadow: var(--el-box-shadow-lighter); }
|
||||
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
|
||||
.card h2 { margin: 0; color: #1e293b; font-size: 15px; font-weight: 600; }
|
||||
.card h3 { margin: 0 0 12px; color: #1e293b; font-size: 14px; }
|
||||
.card label { display: flex; gap: 8px; margin: 10px 0; color: #475569; font-size: 13px; }
|
||||
.card input { accent-color: #0ea5e9; }
|
||||
.card .btn-primary { margin-top: 14px; }
|
||||
.good { color: #15803d; font-size: 13px; }
|
||||
.card h2 { margin: 0; color: var(--el-text-color-primary); font-size: 15px; font-weight: 600; }
|
||||
.card h3 { margin: 0 0 12px; color: var(--el-text-color-primary); font-size: 14px; }
|
||||
.warning-item { display: flex; margin: 10px 0; color: var(--el-text-color-regular); font-size: 13px; }
|
||||
.publish-button { margin-top: 14px; }
|
||||
.good { color: var(--el-color-success); font-size: 13px; }
|
||||
.gate-status { font-weight: 600; }
|
||||
.gate-status.blocked { color: #b91c1c; }
|
||||
.gate-status.pass, .status-valid { color: #15803d; }
|
||||
.status-missing, .status-stale { color: #b45309; }
|
||||
.gate-status.blocked { color: var(--el-color-danger); }
|
||||
.gate-status.pass { color: var(--el-color-success); }
|
||||
.hint { font-size: 13px; }
|
||||
ul { margin: 8px 0; padding-left: 20px; color: #b91c1c; font-size: 13px; }
|
||||
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 0; }
|
||||
.metrics div { display: grid; gap: 4px; }
|
||||
.metrics dt { color: #64748b; font-size: 12px; }
|
||||
.metrics dd { margin: 0; color: #1e293b; font-size: 14px; font-weight: 600; }
|
||||
.conflict-card { border: 1px solid #fecaca; background: #fef2f2; border-radius: 8px; padding: 12px; margin-top: 10px; }
|
||||
.conflict-card strong { color: #991b1b; font-size: 13px; }
|
||||
.conflict-card .reasons { color: #b45309; font-size: 12px; }
|
||||
.card ul { margin: 8px 0; padding-left: 20px; color: var(--el-color-danger); font-size: 13px; }
|
||||
.metrics { margin: 0; }
|
||||
.metrics :deep(.el-descriptions__label) { color: var(--el-text-color-secondary); font-size: 12px; }
|
||||
.metrics :deep(.el-descriptions__content) { color: var(--el-text-color-primary); font-size: 13px; font-weight: 600; }
|
||||
.conflict-card { border: 1px solid var(--el-color-danger-light-7); background: var(--el-color-danger-light-9); border-radius: 8px; padding: 12px; margin-top: 10px; }
|
||||
.conflict-card strong { color: var(--el-color-danger-dark-2); font-size: 13px; }
|
||||
.conflict-card .reasons { color: var(--el-color-warning); font-size: 12px; }
|
||||
@media (max-width: 767px) {
|
||||
.page { padding: 16px; }
|
||||
.page header, .card-head { display: grid; }
|
||||
.page header button, .card-head button { width: 100%; }
|
||||
.page header .el-button, .card-head .el-button { width: 100%; }
|
||||
}
|
||||
</style>
|
||||
+41
-24
@@ -1,14 +1,24 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/OrderProfileValidationPage.vue
|
||||
用途:验证当前订单模板草稿,并按“基础验证、盲测、发布检查”顺序引导管理员。
|
||||
依赖:Profile 验证 API、编辑租约、Vue Router、统一消息提示。
|
||||
依赖:element-plus(el-button/el-tag/el-skeleton,沿用管理端 element-trial 主题)、
|
||||
Profile 验证 API、编辑租约、Vue Router、统一消息提示。
|
||||
逻辑:一次动作依次执行结构检查和当前样本试读;XFA 从验证摘要展示完整字段级结果;
|
||||
盲测批准前不解锁发布检查入口。
|
||||
视觉层已迁移 Element Plus(运行状态→el-tag,加载态→el-skeleton,字段证据卡保留手写结构仅配色走 token),业务脚本保持原样。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import {
|
||||
ElButton,
|
||||
ElSkeleton,
|
||||
ElTag,
|
||||
} from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { createRandomUuid } from '@/shared/utils/id';
|
||||
@@ -274,35 +284,42 @@ onMounted(async () => {
|
||||
<h1 class="section-title">{{ t('admin.orderProfileValidation.title') }}</h1>
|
||||
<p class="section-desc mt-1">{{ t('admin.orderProfileValidation.description') }}</p>
|
||||
</div>
|
||||
<button class="btn-secondary" type="button" @click="backToEditor">{{ t('admin.orderProfileValidation.backToEditor') }}</button>
|
||||
<el-button @click="backToEditor">{{ t('admin.orderProfileValidation.backToEditor') }}</el-button>
|
||||
</header>
|
||||
|
||||
<section class="validation-state" :class="`state-${validationState}`">
|
||||
<div><b>{{ t(`admin.orderProfileValidation.state.${validationState}`) }}</b><p>{{ t(`admin.orderProfileValidation.stateHint.${validationState}`) }}</p></div>
|
||||
<button v-if="canStartBlindTest" type="button" class="btn-primary" :disabled="!canPublish" @click="goToPublishCheck">{{ t('admin.orderProfileValidation.goPublishCheck') }}</button>
|
||||
<el-button v-if="canStartBlindTest" type="primary" :disabled="!canPublish" @click="goToPublishCheck">{{ t('admin.orderProfileValidation.goPublishCheck') }}</el-button>
|
||||
</section>
|
||||
|
||||
<section class="validation-card current-draft-validation">
|
||||
<header>
|
||||
<div><h2>{{ t('admin.orderProfileValidation.currentDraft') }}</h2><p>{{ t('admin.orderProfileValidation.currentDraftHint') }}</p></div>
|
||||
<button type="button" class="btn-primary" :disabled="executing" @click="validateCurrentDraft">{{ executing ? t('admin.orderProfileValidation.validating') : t('admin.orderProfileValidation.validateCurrent') }}</button>
|
||||
<el-button type="primary" :disabled="executing" :loading="executing" @click="validateCurrentDraft">{{ executing ? t('admin.orderProfileValidation.validating') : t('admin.orderProfileValidation.validateCurrent') }}</el-button>
|
||||
</header>
|
||||
<p v-if="loading">{{ t('admin.orderProfileValidation.loading') }}</p>
|
||||
<el-skeleton v-if="loading" :rows="4" animated />
|
||||
<div v-else class="checks" :aria-label="t('admin.orderProfileValidation.currentDraft')">
|
||||
<article>
|
||||
<div><h3>{{ t('admin.orderProfileValidation.structureCheck') }}</h3><p>{{ t('admin.orderProfileValidation.structureCheckHint') }}</p></div>
|
||||
<strong :class="`status ${structureRun?.status || 'pending'}`">{{ t(`admin.orderProfileValidation.runStatus.${structureRun?.status || 'pending'}`) }}</strong>
|
||||
<el-tag size="small" :type="(structureRun?.status || 'pending') === 'passed' ? 'success' : ['failed', 'stale'].includes(structureRun?.status || '') ? 'danger' : 'info'">
|
||||
{{ t(`admin.orderProfileValidation.runStatus.${structureRun?.status || 'pending'}`) }}
|
||||
</el-tag>
|
||||
</article>
|
||||
<article>
|
||||
<div><h3>{{ t('admin.orderProfileValidation.sampleCheck') }}</h3><p>{{ t('admin.orderProfileValidation.sampleCheckHint') }}</p></div>
|
||||
<strong :class="`status ${sampleRun?.status || 'pending'}`">{{ t(`admin.orderProfileValidation.runStatus.${sampleRun?.status || 'pending'}`) }}</strong>
|
||||
<el-tag size="small" :type="(sampleRun?.status || 'pending') === 'passed' ? 'success' : ['failed', 'stale'].includes(sampleRun?.status || '') ? 'danger' : 'info'">
|
||||
{{ t(`admin.orderProfileValidation.runStatus.${sampleRun?.status || 'pending'}`) }}
|
||||
</el-tag>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section v-if="canStartBlindTest" class="blind-test-gate">
|
||||
<div><h2>{{ t('admin.shippingOrderProfiles.blindTest.gateTitle') }}</h2><p>{{ blindTestSuite?.status === 'approved' ? t('admin.shippingOrderProfiles.blindTest.gateApprovedHint') : t('admin.shippingOrderProfiles.blindTest.gateRequiredHint') }}</p></div>
|
||||
<div class="gate-actions"><strong :class="`status ${blindTestSuite?.status || 'pending'}`">{{ t(`admin.shippingOrderProfiles.blindTest.status.${blindTestSuite?.status || 'missing'}`) }}</strong><button type="button" class="btn-secondary" @click="goToBlindTest">{{ t('admin.shippingOrderProfiles.blindTest.title') }}</button></div>
|
||||
<div class="gate-actions">
|
||||
<el-tag size="small" :type="blindTestSuite?.status === 'approved' ? 'success' : 'warning'">{{ t(`admin.shippingOrderProfiles.blindTest.status.${blindTestSuite?.status || 'missing'}`) }}</el-tag>
|
||||
<el-button @click="goToBlindTest">{{ t('admin.shippingOrderProfiles.blindTest.title') }}</el-button>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section v-if="profile && sample" class="results" :aria-label="t('admin.orderProfileValidation.resultsTitle')">
|
||||
@@ -376,23 +393,23 @@ onMounted(async () => {
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.validation-page { width: 100%; margin: 0; padding: 24px; color: #334155; }
|
||||
/* 根容器不再自带水平 padding:由 Admin 壳层统一持有,页面只保留卡片间距 */
|
||||
.validation-page { width: 100%; color: var(--el-text-color-regular); }
|
||||
header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; }
|
||||
h1 { margin: 0; }
|
||||
header p:not(.section-desc), .validation-card p, .checks p, .validation-state p, .blind-test-gate p { margin: 5px 0 0; color: #64748b; font-size: 13px; line-height: 1.5; }
|
||||
button:disabled { cursor: not-allowed; opacity: .55; }
|
||||
.validation-state, .validation-card, .checks article, .blind-test-gate, .results { border: 1px solid #dfe7ef; border-radius: 10px; background: #fff; box-shadow: 0 1px 2px rgb(15 23 42 / 3%); }
|
||||
header p:not(.section-desc), .validation-card p, .checks p, .validation-state p, .blind-test-gate p { margin: 5px 0 0; color: var(--el-text-color-secondary); font-size: 13px; line-height: 1.5; }
|
||||
.validation-state, .validation-card, .checks article, .blind-test-gate, .results { border: 1px solid var(--el-border-color-lighter); border-radius: 10px; background: var(--el-bg-color); box-shadow: var(--el-box-shadow-lighter); }
|
||||
.validation-state { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 20px; padding: 16px; }
|
||||
.validation-state { border-color: #bae6fd; background: #f0f9ff; }.validation-state b { color: #0369a1; font-size: 14px; }.state-ready { border-color: #bbf7d0; background: #f0fdf4; }.state-ready b { color: #15803d; }.state-stale, .state-failed { border-color: #fecaca; background: #fef2f2; }.state-stale b, .state-failed b { color: #b91c1c; }
|
||||
.validation-card h2, .checks h3 { margin: 0; color: #1e293b; font-size: 15px; font-weight: 600; }
|
||||
.current-draft-validation { display: grid; gap: 16px; margin-top: 20px; padding: 16px; }.current-draft-validation > header { align-items: center; }.current-draft-validation > header > div { min-width: 0; }.current-draft-validation > header button { flex: 0 0 auto; }.checks { display: grid; gap: 10px; }.checks article { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-radius: 8px; padding: 15px 16px; }.status { min-width: 72px; text-align: right; font-size: 13px; font-weight: 600; }.passed { color: #15803d; }.failed, .stale { color: #b91c1c; }.pending, .running { color: #64748b; }
|
||||
.blind-test-gate { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 20px; padding: 16px; }.blind-test-gate h2 { margin: 0; color: #1e293b; font-size: 15px; font-weight: 600; }.gate-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }.gate-actions .approved { color: #15803d; }.gate-actions .draft, .gate-actions .missing { color: #b45309; }
|
||||
.results { margin-top: 20px; padding: 16px; }.results-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }.results h2, .results h3 { margin: 0; color: #1e293b; }.results h2 { font-size: 15px; }.results h3 { margin-top: 20px; font-size: 14px; }.results-heading p { margin: 5px 0 0; color: #64748b; font-size: 13px; line-height: 1.5; }.header-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 12px 0 0; }.header-results div { border: 1px solid #e5ebf1; border-radius: 6px; background: #fbfdff; padding: 10px; }.header-results dt { color: #475569; font-size: 13px; font-weight: 600; }.header-results dd { margin: 4px 0 0; overflow-wrap: anywhere; }.header-results .field-code, .line-results th small { color: #94a3b8; font-size: 11px; font-weight: 400; }.line-results { margin-top: 12px; overflow-x: auto; border: 1px solid #e5ebf1; border-radius: 6px; }.line-results table { width: 100%; min-width: 560px; border-collapse: collapse; }.line-results th, .line-results td { padding: 10px 12px; border-bottom: 1px solid #e5ebf1; text-align: left; vertical-align: top; overflow-wrap: anywhere; }.line-results tbody tr:last-child td { border-bottom: 0; }.line-results th { background: #f8fafc; color: #64748b; font-size: 12px; font-weight: 600; }.line-results th span, .line-results th small { display: block; }.deleted-row { color: #94a3b8; text-decoration: line-through; }.result-error { color: #b91c1c; }
|
||||
.header-results .field-needs_review, .header-results .field-unavailable, .header-results .field-failed, .header-results .field-missing { border-color: #fed7aa; background: #fff7ed; }.header-results .field-issues { color: #b45309; font-size: 11px; }
|
||||
.header-results .field-passed { border-color: #bbf7d0; background: #f0fdf4; }
|
||||
.reservation-region-review { margin-top: 16px; padding: 12px; border: 1px solid #fed7aa; border-radius: 8px; background: #fff7ed; }
|
||||
.reservation-region-review h3 { margin: 0; color: #9a3412; font-size: 14px; }
|
||||
.reservation-region-review p { margin: 6px 0 0; color: #b45309; font-size: 13px; }
|
||||
.xfa-line-card { margin-top: 12px; padding: 12px; border: 1px solid #e5ebf1; border-radius: 8px; background: #fbfdff; }.xfa-line-card h4 { margin: 0 0 8px; font-size: 13px; color: #475569; }
|
||||
@media (max-width: 767px) { .validation-page { padding: 16px; } header, .validation-state, .current-draft-validation > header, .checks article, .blind-test-gate, .results-heading { display: grid; }.validation-state button, .current-draft-validation > header button, .blind-test-gate button, .results-heading button { width: 100%; } }
|
||||
.validation-state { border-color: var(--el-color-primary-light-7); background: var(--el-color-primary-light-9); }.validation-state b { color: var(--el-color-primary); font-size: 14px; }.state-ready { border-color: var(--el-color-success-light-7); background: var(--el-color-success-light-9); }.state-ready b { color: var(--el-color-success); }.state-stale, .state-failed { border-color: var(--el-color-danger-light-7); background: var(--el-color-danger-light-9); }.state-stale b, .state-failed b { color: var(--el-color-danger); }
|
||||
.validation-card h2, .checks h3 { margin: 0; color: var(--el-text-color-primary); font-size: 15px; font-weight: 600; }
|
||||
.current-draft-validation { display: grid; gap: 16px; margin-top: 20px; padding: 16px; }.current-draft-validation > header { align-items: center; }.current-draft-validation > header > div { min-width: 0; }.current-draft-validation > header .el-button { flex: 0 0 auto; }.checks { display: grid; gap: 10px; }.checks article { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-radius: 8px; padding: 15px 16px; }
|
||||
.blind-test-gate { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 20px; padding: 16px; }.blind-test-gate h2 { margin: 0; color: var(--el-text-color-primary); font-size: 15px; font-weight: 600; }.gate-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
|
||||
.results { margin-top: 20px; padding: 16px; }.results-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }.results h2, .results h3 { margin: 0; color: var(--el-text-color-primary); }.results h2 { font-size: 15px; }.results h3 { margin-top: 20px; font-size: 14px; }.results-heading p { margin: 5px 0 0; color: var(--el-text-color-secondary); font-size: 13px; line-height: 1.5; }.header-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin: 12px 0 0; }.header-results div { border: 1px solid var(--el-border-color-lighter); border-radius: 6px; background: var(--el-fill-color-lighter); padding: 10px; }.header-results dt { color: var(--el-text-color-secondary); font-size: 13px; font-weight: 600; }.header-results dd { margin: 4px 0 0; overflow-wrap: anywhere; }.header-results .field-code, .line-results th small { color: var(--el-text-color-placeholder); font-size: 12px; font-weight: 400; }.line-results { margin-top: 12px; overflow-x: auto; border: 1px solid var(--el-border-color-lighter); border-radius: 6px; }.line-results table { width: 100%; min-width: 560px; border-collapse: collapse; }.line-results th, .line-results td { padding: 10px 12px; border-bottom: 1px solid var(--el-border-color-lighter); text-align: left; vertical-align: top; overflow-wrap: anywhere; }.line-results tbody tr:last-child td { border-bottom: 0; }.line-results th { background: var(--el-fill-color-light); color: var(--el-text-color-secondary); font-size: 12px; font-weight: 600; }.line-results th span, .line-results th small { display: block; }.deleted-row { color: var(--el-text-color-placeholder); text-decoration: line-through; }.result-error { color: var(--el-color-danger); }
|
||||
.header-results .field-needs_review, .header-results .field-unavailable, .header-results .field-failed, .header-results .field-missing { border-color: var(--el-color-warning-light-7); background: var(--el-color-warning-light-9); }.header-results .field-issues { color: var(--el-color-warning); font-size: 12px; }
|
||||
.header-results .field-passed { border-color: var(--el-color-success-light-7); background: var(--el-color-success-light-9); }
|
||||
.reservation-region-review { margin-top: 16px; padding: 12px; border: 1px solid var(--el-color-warning-light-7); border-radius: 8px; background: var(--el-color-warning-light-9); }
|
||||
.reservation-region-review h3 { margin: 0; color: var(--el-color-warning-dark-2); font-size: 14px; }
|
||||
.reservation-region-review p { margin: 6px 0 0; color: var(--el-color-warning); font-size: 13px; }
|
||||
.xfa-line-card { margin-top: 12px; padding: 12px; border: 1px solid var(--el-border-color-lighter); border-radius: 8px; background: var(--el-fill-color-lighter); }.xfa-line-card h4 { margin: 0 0 8px; font-size: 13px; color: var(--el-text-color-secondary); }
|
||||
@media (max-width: 767px) { header, .validation-state, .current-draft-validation > header, .checks article, .blind-test-gate, .results-heading { display: grid; }.validation-state .el-button, .current-draft-validation > header .el-button, .blind-test-gate .el-button, .results-heading .el-button { width: 100%; } }
|
||||
</style>
|
||||
+68
-57
@@ -1,15 +1,28 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/OrderProfileVersionDetailPage.vue
|
||||
用途:订单模板版本中心详情页,支持刷新恢复与分享。
|
||||
依赖:版本详情 composable、配置概览组件、版本中心 API、统一迁移 API。
|
||||
依赖:element-plus(el-button/el-tag/el-select/el-skeleton,沿用管理端 element-trial 主题)、
|
||||
版本详情 composable、配置概览组件、版本中心 API、统一迁移 API。
|
||||
逻辑:当前已接入配置概览、只读样本画布、服务端语义 diff、审计时间线与实际使用;
|
||||
Schema 迁移弹窗按模态语义提供初始焦点、Tab 陷阱、Escape 关闭与焦点恢复;
|
||||
统一 binding 迁移提供 Dry Run 状态徽章入口。
|
||||
视觉层已迁移 Element Plus(按钮→el-button,徽章→el-tag,弹窗内 select→el-select,加载态→el-skeleton);
|
||||
迁移弹窗保留手写结构:ElButton 不暴露 focus(),cancel 按钮的模板 ref 与 Tab 陷阱/焦点恢复逻辑强耦合,换控件会破坏模态焦点契约。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onBeforeUnmount, onMounted, ref, watch } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import {
|
||||
ElButton,
|
||||
ElOption,
|
||||
ElSelect,
|
||||
ElSkeleton,
|
||||
ElTag,
|
||||
} from "element-plus";
|
||||
import "element-plus/dist/index.css";
|
||||
import "element-plus/theme-chalk/dark/css-vars.css";
|
||||
import "@/features/admin/styles/element-trial.css";
|
||||
import { BusinessError } from "@/shared/api/client";
|
||||
import { useMessage } from "@/shared/composables/useMessage";
|
||||
import {
|
||||
@@ -369,22 +382,21 @@ watch(
|
||||
<p class="header-meta">{{ pageTitle }}</p>
|
||||
</div>
|
||||
<div class="header-actions" v-if="detail">
|
||||
<button type="button" class="btn-secondary" @click="goBackToWorkbench">
|
||||
<el-button @click="goBackToWorkbench">
|
||||
{{ t("admin.shippingOrderProfiles.versionCenter.backToWorkbench") }}
|
||||
</button>
|
||||
<button
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="detail.status === 'draft'"
|
||||
type="button"
|
||||
class="btn-primary"
|
||||
type="primary"
|
||||
@click="continueEditing"
|
||||
>
|
||||
{{ t("admin.shippingOrderProfiles.versionCenter.continueEditing") }}
|
||||
</button>
|
||||
<button
|
||||
</el-button>
|
||||
<el-button
|
||||
v-else
|
||||
type="button"
|
||||
class="btn-primary"
|
||||
type="primary"
|
||||
:disabled="cloning"
|
||||
:loading="cloning"
|
||||
@click="createNewVersion"
|
||||
>
|
||||
{{
|
||||
@@ -392,20 +404,18 @@ watch(
|
||||
? t("admin.shippingOrderProfiles.saving")
|
||||
: t("admin.shippingOrderProfiles.newVersion")
|
||||
}}
|
||||
</button>
|
||||
<button
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="canMigrateSchema"
|
||||
type="button"
|
||||
class="btn-primary"
|
||||
type="primary"
|
||||
@click="openSchemaMigration"
|
||||
>
|
||||
{{ t("admin.shippingOrderProfiles.schemaMigration.action", { version: publishedSchema?.version }) }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-ghost"
|
||||
</el-button>
|
||||
<el-button
|
||||
data-testid="order-profile-unified-migration-dry-run"
|
||||
:disabled="unifiedMigrating"
|
||||
:loading="unifiedMigrating"
|
||||
@click="runUnifiedMigrationDryRun"
|
||||
>
|
||||
{{
|
||||
@@ -413,9 +423,10 @@ watch(
|
||||
? t("admin.shippingOrderProfiles.unifiedMigration.running")
|
||||
: t("admin.shippingOrderProfiles.unifiedMigration.dryRun")
|
||||
}}
|
||||
</button>
|
||||
<span
|
||||
</el-button>
|
||||
<el-tag
|
||||
v-if="unifiedMigrationReport"
|
||||
size="small"
|
||||
class="unified-migration-badge"
|
||||
data-testid="order-profile-unified-migration-badge"
|
||||
>
|
||||
@@ -425,13 +436,13 @@ watch(
|
||||
diff: unifiedMigrationReport.field_diff_count ?? 0,
|
||||
})
|
||||
}}
|
||||
</span>
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div v-if="loading" class="state-card">
|
||||
{{ t("admin.shippingOrderProfiles.versionCenter.loading") }}
|
||||
<el-skeleton :rows="4" animated />
|
||||
</div>
|
||||
<div v-else-if="errorMessage" class="state-card error-card">
|
||||
{{ errorMessage }}
|
||||
@@ -482,6 +493,8 @@ watch(
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
<!-- 迁移弹窗保留手写模态结构:cancel 按钮的模板 ref(原生 button.focus())与 Tab 陷阱/焦点恢复逻辑耦合,
|
||||
data-testid 契约挂在 backdrop/dialog 节点上;仅将其中的 select 换为 el-select、配色走 token。 -->
|
||||
<div
|
||||
v-if="migrationOpen"
|
||||
class="migration-backdrop"
|
||||
@@ -506,15 +519,20 @@ watch(
|
||||
<span>{{ t("admin.shippingOrderProfiles.schemaMigration.reason", { reason: change.reason }) }}</span>
|
||||
<label>
|
||||
{{ t("admin.shippingOrderProfiles.schemaMigration.resolution") }}
|
||||
<select
|
||||
:value="migrationReplacementId(change.field_id)"
|
||||
@change="setMigrationResolution(change.field_id, ($event.target as HTMLSelectElement).value)"
|
||||
<el-select
|
||||
class="migration-select"
|
||||
:model-value="migrationReplacementId(change.field_id)"
|
||||
:placeholder="t('admin.shippingOrderProfiles.schemaMigration.unbind')"
|
||||
@update:model-value="(value) => setMigrationResolution(change.field_id, String(value))"
|
||||
>
|
||||
<option value="">{{ t("admin.shippingOrderProfiles.schemaMigration.unbind") }}</option>
|
||||
<option v-for="candidate in change.replacement_candidates || []" :key="candidate.field_id" :value="candidate.field_id">
|
||||
{{ candidate.display_name || candidate.field_code || candidate.field_id }}
|
||||
</option>
|
||||
</select>
|
||||
<el-option value="" :label="t('admin.shippingOrderProfiles.schemaMigration.unbind')" />
|
||||
<el-option
|
||||
v-for="candidate in change.replacement_candidates || []"
|
||||
:key="candidate.field_id"
|
||||
:value="candidate.field_id"
|
||||
:label="candidate.display_name || candidate.field_code || candidate.field_id"
|
||||
/>
|
||||
</el-select>
|
||||
</label>
|
||||
</article>
|
||||
</div>
|
||||
@@ -549,9 +567,9 @@ watch(
|
||||
.state-card,
|
||||
.version-switcher,
|
||||
.detail-panel {
|
||||
border: 1px solid var(--border-default);
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: 1rem;
|
||||
background: var(--bg-surface);
|
||||
background: var(--el-bg-color);
|
||||
}
|
||||
|
||||
.page-header {
|
||||
@@ -576,7 +594,7 @@ watch(
|
||||
.header-kicker,
|
||||
.header-meta {
|
||||
margin: 0;
|
||||
color: var(--text-muted);
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 0.8125rem;
|
||||
}
|
||||
|
||||
@@ -586,22 +604,15 @@ watch(
|
||||
.header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; align-items: center; }
|
||||
|
||||
.unified-migration-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 999px;
|
||||
padding: 0.25rem 0.7rem;
|
||||
font-size: 0.75rem;
|
||||
color: var(--text-secondary);
|
||||
background: var(--bg-muted, transparent);
|
||||
}
|
||||
|
||||
.tab-button,
|
||||
.version-item {
|
||||
border: 1px solid var(--border-default);
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: 0.75rem;
|
||||
background: var(--bg-surface);
|
||||
color: var(--text-secondary);
|
||||
background: var(--el-bg-color);
|
||||
color: var(--el-text-color-regular);
|
||||
cursor: pointer;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
@@ -621,9 +632,9 @@ watch(
|
||||
}
|
||||
|
||||
.tab-button.active {
|
||||
border-color: #0ea5e9;
|
||||
background: var(--status-info-bg);
|
||||
color: var(--status-info-fg);
|
||||
border-color: var(--el-color-primary);
|
||||
background: var(--el-color-primary-light-9);
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
|
||||
.version-switcher {
|
||||
@@ -639,13 +650,13 @@ watch(
|
||||
gap: 0.1rem;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.version-switcher__label small {
|
||||
max-width: 15rem;
|
||||
overflow: hidden;
|
||||
color: var(--text-muted);
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 0.75rem;
|
||||
font-weight: 400;
|
||||
text-overflow: ellipsis;
|
||||
@@ -668,13 +679,13 @@ watch(
|
||||
}
|
||||
|
||||
.version-item.active {
|
||||
border-color: #0ea5e9;
|
||||
background: var(--status-info-bg);
|
||||
color: var(--status-info-fg);
|
||||
border-color: var(--el-color-primary);
|
||||
background: var(--el-color-primary-light-9);
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
|
||||
.version-item span {
|
||||
color: var(--text-muted);
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
@@ -684,13 +695,13 @@ watch(
|
||||
|
||||
.error-card {
|
||||
padding: 1rem;
|
||||
color: var(--status-error-fg);
|
||||
color: var(--el-color-danger);
|
||||
}
|
||||
|
||||
.migration-backdrop { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 1rem; background: rgb(15 23 42 / 45%); }
|
||||
.migration-dialog { display: grid; grid-auto-rows: max-content; width: min(100%, 42rem); max-height: min(44rem, calc(100vh - 2rem)); gap: 1rem; overflow-y: auto; padding: 1.5rem; border-radius: 1rem; background: var(--bg-surface); box-shadow: 0 20px 40px rgb(15 23 42 / 25%); }
|
||||
.migration-dialog h2,.migration-dialog p { margin: 0; }.migration-note { color: var(--text-muted); font-size: .875rem; }.migration-changes { display: grid; gap: .75rem; }.migration-changes article { display: grid; gap: .45rem; padding: .85rem; border: 1px solid var(--border-default); border-radius: .75rem; }.migration-changes span { color: var(--text-muted); font-size: .8125rem; }.migration-changes label { display: grid; gap: .3rem; color: var(--text-secondary); font-size: .8125rem; font-weight: 600; }.migration-changes select { min-height: 2.25rem; border: 1px solid var(--border-default); border-radius: .5rem; background: var(--bg-surface); color: var(--text-primary); font: inherit; }/* footer 用 sticky 钉在对话框可视底部:breaking changes 列表长时取消/确认迁移按钮始终可见,不需滚回底部 */
|
||||
.migration-dialog footer { position: sticky; bottom: -1.5rem; display: flex; justify-content: flex-end; gap: .5rem; margin: 0 -1.5rem -1.5rem; border-top: 1px solid var(--border-default); background: var(--bg-surface); padding: 1rem 1.5rem 1.25rem; }
|
||||
.migration-backdrop { position: fixed; z-index: 30; inset: 0; display: grid; place-items: center; padding: 1rem; background: var(--el-overlay-color-lighter); }
|
||||
.migration-dialog { display: grid; grid-auto-rows: max-content; width: min(100%, 42rem); max-height: min(44rem, calc(100vh - 2rem)); gap: 1rem; overflow-y: auto; padding: 1.5rem; border-radius: 1rem; background: var(--el-bg-color); box-shadow: var(--el-box-shadow-dark); }
|
||||
.migration-dialog h2,.migration-dialog p { margin: 0; }.migration-note { color: var(--el-text-color-secondary); font-size: .875rem; }.migration-changes { display: grid; gap: .75rem; }.migration-changes article { display: grid; gap: .45rem; padding: .85rem; border: 1px solid var(--el-border-color-lighter); border-radius: .75rem; }.migration-changes span { color: var(--el-text-color-secondary); font-size: .8125rem; }.migration-changes label { display: grid; gap: .3rem; color: var(--el-text-color-regular); font-size: .8125rem; font-weight: 600; }.migration-select { width: 100%; }/* footer 用 sticky 钉在对话框可视底部:breaking changes 列表长时取消/确认迁移按钮始终可见,不需滚回底部 */
|
||||
.migration-dialog footer { position: sticky; bottom: -1.5rem; display: flex; justify-content: flex-end; gap: .5rem; margin: 0 -1.5rem -1.5rem; border-top: 1px solid var(--el-border-color-lighter); background: var(--el-bg-color); padding: 1rem 1.5rem 1.25rem; }
|
||||
|
||||
@media (max-width: 960px) {
|
||||
.header-main,
|
||||
|
||||
+124
-115
@@ -1,14 +1,24 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/components/OrderProfileAuditTimeline.vue
|
||||
用途:展示订单模板版本中心的治理审计时间线(含 XFA operation_id / checksum)。
|
||||
依赖:版本中心审计 API、版本详情 DTO、Vue I18n。
|
||||
依赖:element-plus(el-button / el-input / el-date-picker / el-tag / el-alert / el-empty /
|
||||
el-skeleton / el-timeline,沿用管理端 element-trial 主题)、版本中心审计 API、
|
||||
版本详情 DTO、Vue I18n。
|
||||
逻辑:使用 before_id 游标分页避免新增事件导致翻页重复;只展示安全 detail 摘要,
|
||||
以及 XFA 变更前后 definition checksum 与 operation_id;不展示 PDF、正文或盲测真值;
|
||||
对视觉绑定 / 拆分 / 统一迁移事件渲染分组标签与 visual before/after 摘要。
|
||||
对视觉绑定 / 拆分 / 迁移事件渲染分组标签与 visual before/after 摘要。
|
||||
EP 迁移:工具栏/分页/重试按钮迁移为 el-button(应用=primary);筛选输入迁移为 el-input 与
|
||||
el-date-picker(value-format 保持字符串契约);加载/错误/空态迁移为 el-skeleton /
|
||||
el-alert / el-empty;审计列表迁移为 el-timeline;visual/split 分组标签迁移为 el-tag;
|
||||
颜色统一 --el-* token;业务脚本(游标分页/筛选/错误兜底)零改动。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, reactive, ref, watch } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { ElAlert, ElButton, ElDatePicker, ElEmpty, ElInput, ElSkeleton, ElTag, ElTimeline, ElTimelineItem } from "element-plus";
|
||||
import "element-plus/dist/index.css";
|
||||
import "element-plus/theme-chalk/dark/css-vars.css";
|
||||
import "@/features/admin/styles/element-trial.css";
|
||||
import { BusinessError } from "@/shared/api/client";
|
||||
import { listOrderDocumentProfileAuditEvents } from "@/features/admin/api/shipping-order-document-profile.api";
|
||||
import type {
|
||||
@@ -145,110 +155,123 @@ watch(
|
||||
<p>{{ t("admin.shippingOrderProfiles.versionCenter.audit.subtitle") }}</p>
|
||||
</div>
|
||||
<div class="toolbar-actions">
|
||||
<button type="button" class="btn-ghost btn-sm" :disabled="loading" @click="resetFilters">
|
||||
<el-button size="small" :disabled="loading" @click="resetFilters">
|
||||
{{ t("admin.shippingOrderProfiles.versionCenter.audit.reset") }}
|
||||
</button>
|
||||
<button type="button" class="btn-primary btn-sm" :disabled="loading" @click="applyFilters">
|
||||
</el-button>
|
||||
<el-button size="small" type="primary" :disabled="loading" @click="applyFilters">
|
||||
{{ t("admin.shippingOrderProfiles.versionCenter.audit.apply") }}
|
||||
</button>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="filters">
|
||||
<label>
|
||||
<span>{{ t("admin.shippingOrderProfiles.versionCenter.audit.eventType") }}</span>
|
||||
<input v-model="filters.eventType" class="input-field" type="text" />
|
||||
<el-input v-model="filters.eventType" />
|
||||
</label>
|
||||
<label>
|
||||
<span>{{ t("admin.shippingOrderProfiles.versionCenter.audit.actor") }}</span>
|
||||
<input v-model="filters.actor" class="input-field" type="text" />
|
||||
<el-input v-model="filters.actor" />
|
||||
</label>
|
||||
<label>
|
||||
<span>{{ t("admin.shippingOrderProfiles.versionCenter.audit.requestId") }}</span>
|
||||
<input v-model="filters.requestIdFilter" class="input-field" type="text" />
|
||||
<el-input v-model="filters.requestIdFilter" />
|
||||
</label>
|
||||
<label>
|
||||
<span>{{ t("admin.shippingOrderProfiles.versionCenter.audit.createdFrom") }}</span>
|
||||
<input v-model="filters.createdFrom" class="input-field" type="date" />
|
||||
<el-date-picker
|
||||
v-model="filters.createdFrom"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
<span>{{ t("admin.shippingOrderProfiles.versionCenter.audit.createdTo") }}</span>
|
||||
<input v-model="filters.createdTo" class="input-field" type="date" />
|
||||
<el-date-picker
|
||||
v-model="filters.createdTo"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div v-if="loading" class="state-card">
|
||||
{{ t("admin.shippingOrderProfiles.versionCenter.audit.loading") }}
|
||||
</div>
|
||||
<el-skeleton v-if="loading" class="state-card" :rows="5" animated />
|
||||
<div v-else-if="errorMessage" class="state-card error-card">
|
||||
<p>{{ errorMessage }}</p>
|
||||
<button type="button" class="btn-secondary btn-sm" @click="load">
|
||||
<el-alert :title="errorMessage" type="error" :closable="false" />
|
||||
<el-button class="error-retry" size="small" @click="load">
|
||||
{{ t("admin.shippingOrderProfiles.versionCenter.retry") }}
|
||||
</button>
|
||||
</el-button>
|
||||
</div>
|
||||
<div v-else-if="!page?.items.length" class="state-card">
|
||||
{{ t("admin.shippingOrderProfiles.versionCenter.audit.empty") }}
|
||||
</div>
|
||||
<div v-else class="timeline-list">
|
||||
<article
|
||||
<el-empty
|
||||
v-else-if="!page?.items.length"
|
||||
class="state-card"
|
||||
:description="t('admin.shippingOrderProfiles.versionCenter.audit.empty')"
|
||||
:image-size="60"
|
||||
/>
|
||||
<el-timeline v-else class="timeline-list">
|
||||
<el-timeline-item
|
||||
v-for="item in page.items"
|
||||
:key="item.id"
|
||||
class="timeline-item"
|
||||
:timestamp="formatTime(item.created_at)"
|
||||
placement="top"
|
||||
>
|
||||
<header>
|
||||
<div>
|
||||
<p class="timeline-type">
|
||||
{{ item.event_type }}
|
||||
<span
|
||||
v-if="isUnifiedVisualOrSplitEvent(item.event_type)"
|
||||
class="event-tag"
|
||||
data-testid="order-profile-audit-visual-tag"
|
||||
>visual/split</span>
|
||||
</p>
|
||||
<h4>{{ item.actor.display_name }}</h4>
|
||||
<article class="timeline-item">
|
||||
<header>
|
||||
<div>
|
||||
<p class="timeline-type">
|
||||
{{ item.event_type }}
|
||||
<el-tag
|
||||
v-if="isUnifiedVisualOrSplitEvent(item.event_type)"
|
||||
size="small"
|
||||
type="info"
|
||||
data-testid="order-profile-audit-visual-tag"
|
||||
>visual/split</el-tag>
|
||||
</p>
|
||||
<h4>{{ item.actor.display_name }}</h4>
|
||||
</div>
|
||||
<div class="meta">
|
||||
<span>{{ formatTime(item.created_at) }}</span>
|
||||
<code v-if="item.request_id">{{ item.request_id }}</code>
|
||||
<code
|
||||
v-if="item.operation_id"
|
||||
data-testid="order-profile-audit-operation-id"
|
||||
>{{ item.operation_id }}</code>
|
||||
</div>
|
||||
</header>
|
||||
<dl
|
||||
v-if="item.definition_checksum || item.before_definition_checksum"
|
||||
class="checksum-row"
|
||||
data-testid="order-profile-audit-checksums"
|
||||
>
|
||||
<div v-if="item.before_definition_checksum">
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.audit.beforeChecksum") }}</dt>
|
||||
<dd><code>{{ item.before_definition_checksum }}</code></dd>
|
||||
</div>
|
||||
<div v-if="item.definition_checksum">
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.audit.afterChecksum") }}</dt>
|
||||
<dd><code>{{ item.definition_checksum }}</code></dd>
|
||||
</div>
|
||||
</dl>
|
||||
<div
|
||||
v-if="visualPayload(item.detail as Record<string, unknown>)"
|
||||
class="visual-diff"
|
||||
data-testid="order-profile-audit-visual-diff"
|
||||
>
|
||||
<p class="visual-diff-title">{{ t("admin.shippingOrderProfiles.versionCenter.audit.visualDiff") }}</p>
|
||||
<pre>{{ formatJson(visualPayload(item.detail as Record<string, unknown>)) }}</pre>
|
||||
</div>
|
||||
<div class="meta">
|
||||
<span>{{ formatTime(item.created_at) }}</span>
|
||||
<code v-if="item.request_id">{{ item.request_id }}</code>
|
||||
<code
|
||||
v-if="item.operation_id"
|
||||
data-testid="order-profile-audit-operation-id"
|
||||
>{{ item.operation_id }}</code>
|
||||
</div>
|
||||
</header>
|
||||
<dl
|
||||
v-if="item.definition_checksum || item.before_definition_checksum"
|
||||
class="checksum-row"
|
||||
data-testid="order-profile-audit-checksums"
|
||||
>
|
||||
<div v-if="item.before_definition_checksum">
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.audit.beforeChecksum") }}</dt>
|
||||
<dd><code>{{ item.before_definition_checksum }}</code></dd>
|
||||
</div>
|
||||
<div v-if="item.definition_checksum">
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.audit.afterChecksum") }}</dt>
|
||||
<dd><code>{{ item.definition_checksum }}</code></dd>
|
||||
</div>
|
||||
</dl>
|
||||
<div
|
||||
v-if="visualPayload(item.detail as Record<string, unknown>)"
|
||||
class="visual-diff"
|
||||
data-testid="order-profile-audit-visual-diff"
|
||||
>
|
||||
<p class="visual-diff-title">{{ t("admin.shippingOrderProfiles.versionCenter.audit.visualDiff") }}</p>
|
||||
<pre>{{ formatJson(visualPayload(item.detail as Record<string, unknown>)) }}</pre>
|
||||
</div>
|
||||
<pre>{{ formatJson(item.detail) }}</pre>
|
||||
</article>
|
||||
</div>
|
||||
<pre>{{ formatJson(item.detail) }}</pre>
|
||||
</article>
|
||||
</el-timeline-item>
|
||||
</el-timeline>
|
||||
|
||||
<div class="pager">
|
||||
<button type="button" class="btn-ghost btn-sm" :disabled="loading || !hasPrevious" @click="loadPrevious">
|
||||
<el-button size="small" :disabled="loading || !hasPrevious" @click="loadPrevious">
|
||||
{{ t("admin.shippingOrderProfiles.versionCenter.audit.previous") }}
|
||||
</button>
|
||||
<button type="button" class="btn-ghost btn-sm" :disabled="loading || !hasNext" @click="loadNext">
|
||||
</el-button>
|
||||
<el-button size="small" :disabled="loading || !hasNext" @click="loadNext">
|
||||
{{ t("admin.shippingOrderProfiles.versionCenter.audit.next") }}
|
||||
</button>
|
||||
</el-button>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
@@ -257,11 +280,10 @@ watch(
|
||||
.timeline-panel,
|
||||
.toolbar,
|
||||
.filters,
|
||||
.timeline-item,
|
||||
.state-card {
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 1rem;
|
||||
background: var(--bg-surface);
|
||||
.timeline-item {
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: 12px;
|
||||
background: var(--el-bg-color);
|
||||
}
|
||||
|
||||
.timeline-panel {
|
||||
@@ -286,13 +308,13 @@ watch(
|
||||
.toolbar h3,
|
||||
.timeline-item h4 {
|
||||
margin: 0;
|
||||
color: var(--text-primary);
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.toolbar p {
|
||||
margin: 0.25rem 0 0;
|
||||
color: var(--text-muted);
|
||||
font-size: 0.75rem;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.timeline-type {
|
||||
@@ -301,30 +323,21 @@ watch(
|
||||
align-items: center;
|
||||
gap: 0.4rem;
|
||||
margin: 0.25rem 0 0;
|
||||
color: var(--text-muted);
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.event-tag {
|
||||
display: inline-flex;
|
||||
border: 1px solid var(--border-default);
|
||||
border-radius: 999px;
|
||||
padding: 0.05rem 0.45rem;
|
||||
font-size: 0.65rem;
|
||||
color: var(--text-secondary);
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.visual-diff {
|
||||
margin-top: 0.65rem;
|
||||
padding: 0.65rem 0.75rem;
|
||||
border: 1px dashed var(--border-default);
|
||||
border-radius: 0.75rem;
|
||||
border: 1px dashed var(--el-border-color);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.visual-diff-title {
|
||||
margin: 0 0 0.35rem;
|
||||
font-size: 0.75rem;
|
||||
color: var(--text-secondary);
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-regular);
|
||||
}
|
||||
|
||||
.toolbar-actions,
|
||||
@@ -342,18 +355,18 @@ watch(
|
||||
.filters label {
|
||||
display: grid;
|
||||
gap: 0.3rem;
|
||||
color: var(--text-secondary);
|
||||
font-size: 0.75rem;
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.filters .input-field {
|
||||
padding: 0.5rem 0.75rem;
|
||||
font-size: 0.875rem;
|
||||
.error-card {
|
||||
display: grid;
|
||||
justify-items: start;
|
||||
gap: 0.6rem;
|
||||
}
|
||||
|
||||
.timeline-list {
|
||||
display: grid;
|
||||
gap: 0.8rem;
|
||||
padding: 4px 0 0 4px;
|
||||
}
|
||||
|
||||
.timeline-item header {
|
||||
@@ -367,11 +380,11 @@ watch(
|
||||
display: grid;
|
||||
gap: 0.35rem;
|
||||
margin: 0.5rem 0;
|
||||
font-size: 0.75rem;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.checksum-row dt {
|
||||
color: var(--text-muted);
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
.checksum-row dd {
|
||||
@@ -379,7 +392,7 @@ watch(
|
||||
}
|
||||
|
||||
.checksum-row code {
|
||||
font-size: 0.7rem;
|
||||
font-size: 11px;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
@@ -387,26 +400,22 @@ watch(
|
||||
display: grid;
|
||||
justify-items: end;
|
||||
gap: 0.25rem;
|
||||
color: var(--text-muted);
|
||||
font-size: 0.75rem;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.timeline-item pre {
|
||||
margin: 0.85rem 0 0;
|
||||
border-radius: 0.75rem;
|
||||
background: var(--bg-surface-strong);
|
||||
border-radius: 8px;
|
||||
background: var(--el-fill-color-light);
|
||||
padding: 0.8rem;
|
||||
color: var(--text-primary);
|
||||
font-size: 0.72rem;
|
||||
color: var(--el-text-color-primary);
|
||||
font-size: 11px;
|
||||
line-height: 1.45;
|
||||
overflow: auto;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.error-card {
|
||||
color: var(--status-error-fg);
|
||||
}
|
||||
|
||||
@media (max-width: 1100px) {
|
||||
.filters {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
|
||||
+60
-70
@@ -1,7 +1,8 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/components/OrderProfileDocumentCanvas.vue
|
||||
用途:展示受控 PDF/XFA flatten 单页预览,并以相对坐标框支持选择、拖动和缩放区域。
|
||||
依赖:浏览器 fetch、认证请求头、OrderProfileCanvasRegion、isUnboundOrderFieldCanvasRegion。
|
||||
依赖:element-plus(el-button / el-input,沿用管理端 element-trial 主题)、浏览器 fetch、
|
||||
认证请求头、OrderProfileCanvasRegion、isUnboundOrderFieldCanvasRegion。
|
||||
逻辑:父级签发单页令牌并提供分页动作;mode=readonly 时只允许查看/缩放/切页,不允许写入任何标注改动;
|
||||
PNG 预览 token 为一次性消费,组件内按页缓存 blob,翻页回访不再重新拉 token;
|
||||
原 PDF(pdf-preview)令牌亦为 Redis getdel 单次消费:同 token 字节必须缓存,且仅 HTTP 401/403/404
|
||||
@@ -13,10 +14,19 @@
|
||||
绘制模式下仍允许操作当前选中框;整边 resize 热区便于矮标签拉高;
|
||||
画布区域 aria-label 走四语言 i18n;可选 emptyHint/loadError 区分 XFA page_unavailable 与 PDF 缺样本空态;
|
||||
订单字段标签在已有正式/OCR 值时优先展示,loading 仅在尚无值时显示「读取中」。
|
||||
EP 迁移(定向,仅外围 chrome):顶部工具栏(撤销/重做/复制/删除/保存/翻页/缩放/适配)与
|
||||
左侧绘制工具栏、画布重试按钮迁移为 el-button(lucide 图标保留,置于按钮内);
|
||||
页码输入迁移为 el-input(goToPage 内部本就做 Number 归一,契约不变);
|
||||
画布 stage/区域框/拖拽缩放热区等绘制与几何逻辑、及区域配色一律未改动;
|
||||
预览加载/token 缓存/reauth 业务逻辑零改动。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onBeforeUnmount, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElButton, ElIcon, ElInput } from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import { Anchor, ArrowLeft, ArrowRight, Columns3, Copy, Eraser, MessageSquareText, Minus, Plus, Redo2, RotateCcw, Rows3, Save, TableProperties, Tag, TextCursorInput, Trash2, WandSparkles } from 'lucide-vue-next';
|
||||
import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
import { loadPdfJs } from '@/shared/utils/pdfjs';
|
||||
@@ -504,13 +514,13 @@ onBeforeUnmount(() => {
|
||||
<header v-if="imageUrl || pdfRendered" class="canvas-toolbar">
|
||||
<div class="toolbar-actions">
|
||||
<template v-if="!readonlyMode">
|
||||
<button type="button" :disabled="undoDisabled" :title="t('admin.shippingOrderProfiles.workbench.undo')" @click="emit('undo')"><RotateCcw /></button>
|
||||
<button type="button" :disabled="redoDisabled" :title="t('admin.shippingOrderProfiles.workbench.redo')" @click="emit('redo')"><Redo2 /></button>
|
||||
<el-button :disabled="undoDisabled" :title="t('admin.shippingOrderProfiles.workbench.undo')" :aria-label="t('admin.shippingOrderProfiles.workbench.undo')" @click="emit('undo')"><el-icon><RotateCcw /></el-icon></el-button>
|
||||
<el-button :disabled="redoDisabled" :title="t('admin.shippingOrderProfiles.workbench.redo')" :aria-label="t('admin.shippingOrderProfiles.workbench.redo')" @click="emit('redo')"><el-icon><Redo2 /></el-icon></el-button>
|
||||
<span class="toolbar-divider" aria-hidden="true" />
|
||||
<button type="button" :disabled="duplicateDisabled" :title="t('admin.shippingOrderProfiles.workbench.duplicateRegionShortcut')" @click="emit('duplicate')"><Copy /></button>
|
||||
<button type="button" class="delete-action" :disabled="deleteDisabled" :title="t('admin.shippingOrderProfiles.workbench.deleteRegionShortcut')" @click="emit('delete')"><Trash2 /></button>
|
||||
<el-button :disabled="duplicateDisabled" :title="t('admin.shippingOrderProfiles.workbench.duplicateRegionShortcut')" :aria-label="t('admin.shippingOrderProfiles.workbench.duplicateRegionShortcut')" @click="emit('duplicate')"><el-icon><Copy /></el-icon></el-button>
|
||||
<el-button class="delete-action" type="danger" plain :disabled="deleteDisabled" :title="t('admin.shippingOrderProfiles.workbench.deleteRegionShortcut')" :aria-label="t('admin.shippingOrderProfiles.workbench.deleteRegionShortcut')" @click="emit('delete')"><el-icon><Trash2 /></el-icon></el-button>
|
||||
<span class="toolbar-divider" aria-hidden="true" />
|
||||
<button type="button" class="save-action" :disabled="saveDisabled || saving" :title="t('admin.save')" @click="emit('save')"><Save /><span>{{ saving ? t('admin.shippingOrderProfiles.saving') : t('admin.save') }}</span></button>
|
||||
<el-button class="save-action" type="primary" :disabled="saveDisabled || saving" :title="t('admin.save')" @click="emit('save')"><el-icon><Save /></el-icon><span>{{ saving ? t('admin.shippingOrderProfiles.saving') : t('admin.save') }}</span></el-button>
|
||||
<template v-if="pendingSuggestionCount">
|
||||
<span class="toolbar-divider" aria-hidden="true" />
|
||||
<span class="suggestion-count">{{ pendingSuggestionCount }}</span>
|
||||
@@ -520,37 +530,37 @@ onBeforeUnmount(() => {
|
||||
<span v-else class="readonly-badge">{{ t('admin.shippingOrderProfiles.versionCenter.readonlyCanvasBadge') }}</span>
|
||||
</div>
|
||||
<div class="page-control">
|
||||
<button type="button" :disabled="pageNo <= 1" :title="t('admin.shippingOrderExtractionRuns.previous')" @click="emit('page', pageNo - 1)"><ArrowLeft /></button>
|
||||
<label><input v-model.number="pageInput" class="input-field" type="number" min="1" :max="pageCount" :aria-label="t('admin.shippingOrderProfiles.workbench.pageNavigation')" @change="goToPage" @keydown.enter.prevent="goToPage" /><span>/ {{ pageCount }}</span></label>
|
||||
<button type="button" :disabled="pageNo >= pageCount" :title="t('admin.shippingOrderExtractionRuns.next')" @click="emit('page', pageNo + 1)"><ArrowRight /></button>
|
||||
<el-button :disabled="pageNo <= 1" :title="t('admin.shippingOrderExtractionRuns.previous')" :aria-label="t('admin.shippingOrderExtractionRuns.previous')" @click="emit('page', pageNo - 1)"><el-icon><ArrowLeft /></el-icon></el-button>
|
||||
<label><el-input v-model="pageInput" type="number" min="1" :max="pageCount" :aria-label="t('admin.shippingOrderProfiles.workbench.pageNavigation')" @change="goToPage" @keydown.enter.prevent="goToPage" /><span>/ {{ pageCount }}</span></label>
|
||||
<el-button :disabled="pageNo >= pageCount" :title="t('admin.shippingOrderExtractionRuns.next')" :aria-label="t('admin.shippingOrderExtractionRuns.next')" @click="emit('page', pageNo + 1)"><el-icon><ArrowRight /></el-icon></el-button>
|
||||
</div>
|
||||
<div class="zoom-control">
|
||||
<button type="button" :disabled="zoom <= .5" :title="t('admin.shippingOrderProfiles.workbench.zoomOut')" @click="adjustZoom(-.25)"><Minus /></button>
|
||||
<el-button :disabled="zoom <= .5" :title="t('admin.shippingOrderProfiles.workbench.zoomOut')" :aria-label="t('admin.shippingOrderProfiles.workbench.zoomOut')" @click="adjustZoom(-.25)"><el-icon><Minus /></el-icon></el-button>
|
||||
<output>{{ zoomPercent }}%</output>
|
||||
<button type="button" :disabled="zoom >= 4" :title="t('admin.shippingOrderProfiles.workbench.zoomIn')" @click="adjustZoom(.25)"><Plus /></button>
|
||||
<button type="button" class="fit-action" @click="resetZoom">{{ t('admin.shippingOrderProfiles.workbench.fitPage') }}</button>
|
||||
<el-button :disabled="zoom >= 4" :title="t('admin.shippingOrderProfiles.workbench.zoomIn')" :aria-label="t('admin.shippingOrderProfiles.workbench.zoomIn')" @click="adjustZoom(.25)"><el-icon><Plus /></el-icon></el-button>
|
||||
<el-button class="fit-action" @click="resetZoom">{{ t('admin.shippingOrderProfiles.workbench.fitPage') }}</el-button>
|
||||
</div>
|
||||
</header>
|
||||
<div v-if="loading && !pdfPreview" class="canvas-state">{{ t('admin.shippingOrderProfiles.workbench.loadingPage') }}</div>
|
||||
<!-- PNG 路径仍可用整页错误态;原 PDF 路径必须保留 canvas 挂载,否则 renderPdfPage 必抛 canvas unavailable。 -->
|
||||
<div v-else-if="displayLoadError && !pdfPreview" class="canvas-state canvas-state--error" role="alert">
|
||||
<p>{{ displayLoadError }}</p>
|
||||
<button type="button" class="canvas-retry" @click="onRetryClick">
|
||||
<el-button class="canvas-retry" @click="onRetryClick">
|
||||
{{ t('admin.shippingOrderProfiles.workbench.retryCanvas') }}
|
||||
</button>
|
||||
</el-button>
|
||||
</div>
|
||||
<div v-else-if="!imageUrl && !pdfRendered && !pdfPreview" class="canvas-state">{{ emptyStateText }}</div>
|
||||
<div v-else class="canvas-work-area" :class="{ readonly: readonlyMode }">
|
||||
<aside v-if="!readonlyMode" class="annotation-tools">
|
||||
<button type="button" :aria-label="t('admin.shippingOrderProfiles.workbench.drawDocumentMatchAnchorShortcut')" :title="t('admin.shippingOrderProfiles.workbench.drawDocumentMatchAnchorShortcut')" :class="{ active: creationKind === 'document_anchor_label' || creationKind === 'document_anchor_value' }" @click="emit('draw', 'document_anchor_label')"><Anchor /></button>
|
||||
<button type="button" :aria-label="t('admin.shippingOrderProfiles.workbench.drawOrderAnchorShortcut')" :title="t('admin.shippingOrderProfiles.workbench.drawOrderAnchorShortcut')" :class="{ active: creationKind === 'order_anchor' }" @click="emit('draw', 'order_anchor')"><Tag /></button>
|
||||
<button type="button" :aria-label="t('admin.shippingOrderProfiles.workbench.drawOrderFieldShortcut')" :title="t('admin.shippingOrderProfiles.workbench.drawOrderFieldShortcut')" :class="{ active: creationKind === 'order_field' }" @click="emit('draw', 'order_field')"><TextCursorInput /></button>
|
||||
<button type="button" :aria-label="t('admin.shippingOrderProfiles.workbench.drawHeaderShortcut')" :title="t('admin.shippingOrderProfiles.workbench.drawHeaderShortcut')" :class="{ active: creationKind === 'header_field' }" @click="emit('draw', 'header_field')"><TableProperties /></button>
|
||||
<button type="button" :aria-label="t('admin.shippingOrderProfiles.workbench.drawLineShortcut')" :title="t('admin.shippingOrderProfiles.workbench.drawLineShortcut')" :class="{ active: creationKind === 'line' }" @click="emit('draw', 'line')"><Rows3 /></button>
|
||||
<button type="button" :aria-label="t('admin.shippingOrderProfiles.workbench.drawFieldShortcut')" :title="t('admin.shippingOrderProfiles.workbench.drawFieldShortcut')" :class="{ active: creationKind === 'field' }" @click="emit('draw', 'field')"><Columns3 /></button>
|
||||
<button type="button" :aria-label="t('admin.shippingOrderProfiles.workbench.drawExclusionShortcut')" :title="t('admin.shippingOrderProfiles.workbench.drawExclusionShortcut')" :class="{ active: creationKind === 'exclusion' }" @click="emit('draw', 'exclusion')"><Eraser /></button>
|
||||
<button type="button" :aria-label="t('admin.shippingOrderProfiles.workbench.drawReservationIdRegionShortcut')" :title="t('admin.shippingOrderProfiles.workbench.drawReservationIdRegionShortcut')" :class="{ active: creationKind === 'reservation_id_region' }" @click="emit('draw', 'reservation_id_region')"><MessageSquareText /></button>
|
||||
<button type="button" class="suggest" :aria-label="t('admin.shippingOrderProfiles.workbench.autoSuggestShortcut')" :title="t('admin.shippingOrderProfiles.workbench.autoSuggestShortcut')" :disabled="autoSuggestDisabled || suggesting" @click="emit('suggest')"><WandSparkles /></button>
|
||||
<el-button :aria-label="t('admin.shippingOrderProfiles.workbench.drawDocumentMatchAnchorShortcut')" :title="t('admin.shippingOrderProfiles.workbench.drawDocumentMatchAnchorShortcut')" :class="{ active: creationKind === 'document_anchor_label' || creationKind === 'document_anchor_value' }" @click="emit('draw', 'document_anchor_label')"><el-icon><Anchor /></el-icon></el-button>
|
||||
<el-button :aria-label="t('admin.shippingOrderProfiles.workbench.drawOrderAnchorShortcut')" :title="t('admin.shippingOrderProfiles.workbench.drawOrderAnchorShortcut')" :class="{ active: creationKind === 'order_anchor' }" @click="emit('draw', 'order_anchor')"><el-icon><Tag /></el-icon></el-button>
|
||||
<el-button :aria-label="t('admin.shippingOrderProfiles.workbench.drawOrderFieldShortcut')" :title="t('admin.shippingOrderProfiles.workbench.drawOrderFieldShortcut')" :class="{ active: creationKind === 'order_field' }" @click="emit('draw', 'order_field')"><el-icon><TextCursorInput /></el-icon></el-button>
|
||||
<el-button :aria-label="t('admin.shippingOrderProfiles.workbench.drawHeaderShortcut')" :title="t('admin.shippingOrderProfiles.workbench.drawHeaderShortcut')" :class="{ active: creationKind === 'header_field' }" @click="emit('draw', 'header_field')"><el-icon><TableProperties /></el-icon></el-button>
|
||||
<el-button :aria-label="t('admin.shippingOrderProfiles.workbench.drawLineShortcut')" :title="t('admin.shippingOrderProfiles.workbench.drawLineShortcut')" :class="{ active: creationKind === 'line' }" @click="emit('draw', 'line')"><el-icon><Rows3 /></el-icon></el-button>
|
||||
<el-button :aria-label="t('admin.shippingOrderProfiles.workbench.drawFieldShortcut')" :title="t('admin.shippingOrderProfiles.workbench.drawFieldShortcut')" :class="{ active: creationKind === 'field' }" @click="emit('draw', 'field')"><el-icon><Columns3 /></el-icon></el-button>
|
||||
<el-button :aria-label="t('admin.shippingOrderProfiles.workbench.drawExclusionShortcut')" :title="t('admin.shippingOrderProfiles.workbench.drawExclusionShortcut')" :class="{ active: creationKind === 'exclusion' }" @click="emit('draw', 'exclusion')"><el-icon><Eraser /></el-icon></el-button>
|
||||
<el-button :aria-label="t('admin.shippingOrderProfiles.workbench.drawReservationIdRegionShortcut')" :title="t('admin.shippingOrderProfiles.workbench.drawReservationIdRegionShortcut')" :class="{ active: creationKind === 'reservation_id_region' }" @click="emit('draw', 'reservation_id_region')"><el-icon><MessageSquareText /></el-icon></el-button>
|
||||
<el-button class="suggest" :aria-label="t('admin.shippingOrderProfiles.workbench.autoSuggestShortcut')" :title="t('admin.shippingOrderProfiles.workbench.autoSuggestShortcut')" :disabled="autoSuggestDisabled || suggesting" @click="emit('suggest')"><el-icon><WandSparkles /></el-icon></el-button>
|
||||
<p v-if="suggestionProgress" class="suggestion-progress" :class="{ failed: !suggesting }">{{ suggestionProgress }}</p>
|
||||
</aside>
|
||||
<div ref="viewport" class="canvas-viewport" :class="{ panning: !creationKind || readonlyMode }" @wheel.prevent="handleWheel">
|
||||
@@ -633,53 +643,35 @@ onBeforeUnmount(() => {
|
||||
</div>
|
||||
<div v-if="displayLoadError && pdfPreview" class="canvas-error-overlay" role="alert">
|
||||
<p>{{ displayLoadError }}</p>
|
||||
<button type="button" class="canvas-retry" @click="onRetryClick">
|
||||
<el-button class="canvas-retry" @click="onRetryClick">
|
||||
{{ t('admin.shippingOrderProfiles.workbench.retryCanvas') }}
|
||||
</button>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.canvas-shell { display: flex; height: calc(100vh - 5rem); min-height: 48rem; flex-direction: column; background: #101827; padding: 0 1rem 1rem; overflow: hidden; }
|
||||
.canvas-toolbar { position: sticky; top: 0; z-index: 4; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .75rem; margin: 0 -1rem 1rem; padding: .55rem 1rem; border-bottom: 1px solid #26354b; background: rgb(15 23 42 / .98); color: #cbd5e1; font-size: .75rem; }
|
||||
/* 文档桌台:比界面底色深一档的中性冷灰,与白纸拉开图底关系(Figma/预览器惯例);暗色模式走 EP 深色填充 */
|
||||
.canvas-shell { display: flex; height: calc(100vh - 5rem); min-height: 48rem; flex-direction: column; background: #dfe5ec; padding: 0 1rem 1rem; overflow: hidden; }
|
||||
html.dark .canvas-shell { background: var(--el-fill-color-dark); }
|
||||
.canvas-toolbar { position: sticky; top: 0; z-index: 4; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .75rem; margin: 0 -1rem 1rem; padding: .55rem 1rem; border-bottom: 1px solid var(--el-border-color-lighter); background: var(--el-bg-color); color: var(--el-text-color-regular); font-size: 12px; }
|
||||
.canvas-toolbar > div { display: flex; align-items: center; gap: .35rem; }
|
||||
.canvas-toolbar button { display: inline-flex; min-width: 2rem; height: 2rem; align-items: center; justify-content: center; gap: .35rem; border: 1px solid #475569; border-radius: .35rem; background: #1e293b; padding: .3rem .5rem; color: #e2e8f0; font-size: .72rem; }
|
||||
.canvas-toolbar button:hover { border-color: #60a5fa; background: #26364f; }
|
||||
.canvas-toolbar button:disabled { cursor: not-allowed; opacity: .4; }
|
||||
.suggestion-count { display: inline-grid; min-width: 1.25rem; height: 1.25rem; place-items: center; border-radius: 999px; background: #f59e0b; color: #172033; font-size: .68rem; font-weight: 800; }
|
||||
.canvas-toolbar .suggestion-action { border-color: #22c55e; background: #15803d; }
|
||||
.canvas-toolbar .suggestion-action--reject { border-color: #64748b; background: transparent; }
|
||||
.canvas-toolbar svg, .annotation-tools svg { width: .95rem; height: .95rem; }
|
||||
/* EP 迁移:工具栏/绘制工具按钮统一 el-button 默认尺寸(32px 等高对齐);清除 EP 兄弟按钮默认 margin,间距由容器 gap 唯一控制 */
|
||||
.canvas-toolbar > div > .el-button + .el-button { margin-left: 0; }
|
||||
.canvas-toolbar .el-icon, .annotation-tools .el-icon { width: .95rem; height: .95rem; font-size: .95rem; }
|
||||
.toolbar-actions { justify-self: start; }
|
||||
.toolbar-divider { width: 1px; height: 1.25rem; margin: 0 .15rem; background: #475569; }
|
||||
.toolbar-actions .delete-action:not(:disabled) { color: #fecaca; }
|
||||
.toolbar-actions .delete-action:not(:disabled):hover { border-color: #f87171; background: #7f1d1d; color: #fff; }
|
||||
.toolbar-actions .save-action { border-color: #0284c7; background: #0284c7; padding-inline: .65rem; }
|
||||
.readonly-badge { display: inline-flex; align-items: center; min-height: 2rem; border: 1px solid #475569; border-radius: .35rem; background: #0f172a; padding: 0 .65rem; color: #cbd5e1; }
|
||||
.toolbar-divider { width: 1px; height: 1.25rem; margin: 0 .15rem; background: var(--el-border-color-lighter); }
|
||||
.suggestion-count { display: inline-grid; min-width: 1.25rem; height: 1.25rem; place-items: center; border-radius: 999px; background: var(--el-color-warning); color: #fff; font-size: 12px; font-weight: 800; }
|
||||
.readonly-badge { display: inline-flex; align-items: center; min-height: 2rem; border: 1px solid var(--el-border-color-lighter); border-radius: .35rem; background: var(--el-fill-color-light); padding: 0 .65rem; color: var(--el-text-color-secondary); }
|
||||
.page-control { justify-self: center; }
|
||||
.page-control label { display: flex; height: 2rem; align-items: center; gap: .3rem; border: 1px solid #475569; border-radius: .35rem; background: #0f172a; padding: 0 .45rem; color: #94a3b8; }
|
||||
.page-control .input-field { width: 3rem; border: 0; background: transparent; color: #f8fafc; font: 700 .76rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; text-align: right; outline: 0; }
|
||||
.page-control label { display: flex; height: 2rem; align-items: center; gap: .3rem; border: 1px solid var(--el-border-color-lighter); border-radius: .35rem; background: var(--el-fill-color-light); padding: 0 .45rem; color: var(--el-text-color-secondary); }
|
||||
.page-control .el-input { width: 3.4rem; }
|
||||
.page-control .el-input :deep(.el-input__inner) { color: var(--el-text-color-primary); font: 700 .76rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; text-align: right; }
|
||||
.zoom-control { justify-self: end; }
|
||||
.canvas-toolbar output { min-width: 3.4rem; color: #f8fafc; text-align: center; }
|
||||
.zoom-control .fit-action { padding-inline: .65rem; }
|
||||
.canvas-toolbar output { min-width: 3.4rem; color: var(--el-text-color-primary); font-size: 13px; text-align: center; }
|
||||
.canvas-state { display: grid; min-height: 32rem; place-items: center; color: #94a3b8; font-size: .875rem; gap: .75rem; }
|
||||
.canvas-state--error { color: #fecaca; }
|
||||
.canvas-retry {
|
||||
display: inline-flex;
|
||||
min-height: 2rem;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 1px solid #475569;
|
||||
border-radius: .35rem;
|
||||
background: #1e293b;
|
||||
padding: .35rem .75rem;
|
||||
color: #e2e8f0;
|
||||
font-size: .78rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
.canvas-retry:hover { border-color: #60a5fa; background: #26364f; }
|
||||
.canvas-state--error { color: var(--el-color-danger); }
|
||||
.canvas-work-area { position: relative; display: flex; min-height: 0; flex: 1; gap: .6rem; }
|
||||
.canvas-error-overlay {
|
||||
position: absolute;
|
||||
@@ -698,7 +690,7 @@ onBeforeUnmount(() => {
|
||||
.canvas-viewport { position: relative; min-width: 0; flex: 1; overflow: auto; }
|
||||
.canvas-viewport.panning { cursor: grab; }
|
||||
.canvas-viewport.panning:active { cursor: grabbing; }
|
||||
.canvas-stage { position: relative; margin: auto; width: calc(100% * var(--canvas-zoom)); min-width: 42rem; box-shadow: 0 16px 40px rgba(0,0,0,.35); }
|
||||
.canvas-stage { position: relative; margin: auto; width: calc(100% * var(--canvas-zoom)); min-width: 42rem; box-shadow: var(--el-box-shadow-light); }
|
||||
.canvas-stage img { display: block; width: 100%; user-select: none; }
|
||||
.canvas-stage canvas.pdf-page { display: block; background: white; pointer-events: none; user-select: none; }
|
||||
.canvas-stage.drawing { cursor: crosshair; }
|
||||
@@ -706,14 +698,13 @@ onBeforeUnmount(() => {
|
||||
/* 绘制模式下仍可缩放/移动当前选中框,避免点了标签工具后高度完全拉不动。 */
|
||||
.canvas-stage.drawing .region.selected { pointer-events: auto; }
|
||||
.creation-region { position: absolute; z-index: 5; box-sizing: border-box; border: 2px dashed #34d399; background: rgb(16 185 129 / .18); pointer-events: none; }
|
||||
.annotation-tools { display: grid; align-content: start; gap: .3rem; flex: 0 0 2.65rem; padding: .3rem; border: 1px solid rgb(71 85 105 / .9); border-radius: .5rem; background: rgb(15 23 42 / .94); box-shadow: 0 8px 24px rgb(15 23 42 / .3); }
|
||||
.annotation-tools button { display: grid; min-height: 2rem; place-items: center; border: 1px solid transparent; border-radius: .35rem; background: #1e293b; padding: .35rem; color: #e2e8f0; }
|
||||
.annotation-tools button:hover, .annotation-tools button.active { border-color: #38bdf8; background: #0c4a6e; color: #f0f9ff; }
|
||||
.annotation-tools .suggest { border-color: #0ea5e9; background: #0284c7; }
|
||||
.annotation-tools button:disabled { cursor: not-allowed; opacity: .45; }
|
||||
.suggestion-progress { margin: .1rem; color: #bae6fd; font-size: .66rem; line-height: 1.35; }
|
||||
.suggestion-progress.failed { color: #fca5a5; }
|
||||
.suggestion-preview-badge { color: #fbbf24; font-size: .68rem; }
|
||||
.annotation-tools { display: grid; align-content: start; gap: .3rem; flex: 0 0 auto; width: max-content; padding: .3rem; border: 1px solid var(--el-border-color-lighter); border-radius: .5rem; background: var(--el-bg-color); box-shadow: var(--el-box-shadow-light); }
|
||||
.annotation-tools .el-button { display: grid; place-items: center; width: 100%; margin-left: 0; }
|
||||
.annotation-tools .el-button.active { border-color: var(--el-color-primary); background: var(--el-color-primary); color: #fff; }
|
||||
.annotation-tools .el-button:disabled { cursor: not-allowed; opacity: .45; }
|
||||
.suggestion-progress { margin: .1rem; color: var(--el-color-primary); font-size: 12px; line-height: 1.35; }
|
||||
.suggestion-progress.failed { color: var(--el-color-danger); }
|
||||
.suggestion-preview-badge { color: var(--el-color-warning); font-size: 12px; }
|
||||
.region { position: absolute; box-sizing: border-box; z-index: 2; border: 2px solid #38bdf8; background: rgb(14 165 233 / .10); color: #e0f2fe; cursor: move; text-align: left; touch-action: none; }
|
||||
.region:focus-visible { outline: 3px solid white; outline-offset: 2px; }
|
||||
.region-label { position: absolute; z-index: 2; top: -1.65rem; left: -2px; max-width: min(18rem, 100%); overflow: hidden; border: 1px solid rgb(255 255 255 / .7); border-radius: .25rem .25rem 0 0; background: #0369a1; padding: .2rem .45rem; color: white; font: 700 .7rem/1.15 ui-monospace, SFMono-Regular, Menlo, monospace; text-overflow: ellipsis; white-space: nowrap; }
|
||||
@@ -798,8 +789,7 @@ onBeforeUnmount(() => {
|
||||
@media (max-width: 640px) {
|
||||
.canvas-shell { min-height: 24rem; padding-inline: .5rem; }
|
||||
.canvas-toolbar { margin-inline: -.5rem; padding-inline: .5rem; }
|
||||
.toolbar-actions .save-action span, .fit-action { display: none; }
|
||||
.annotation-tools { flex-basis: 2.45rem; }
|
||||
.annotation-tools button span, .suggestion-progress { display: none; }
|
||||
.toolbar-actions .save-action span span, .fit-action { display: none; }
|
||||
.suggestion-progress { display: none; }
|
||||
}
|
||||
</style>
|
||||
+54
-73
@@ -1,12 +1,19 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/components/OrderProfileFrozenEvidencePanel.vue
|
||||
用途:展示当前只读样本绑定的冻结证据信息。
|
||||
依赖:版本详情样本 DTO、i18n。
|
||||
依赖:element-plus(el-descriptions / el-empty / el-tag,沿用管理端 element-trial 主题)、
|
||||
版本详情样本 DTO、i18n。
|
||||
逻辑:只渲染冻结身份与快照摘要,不泄露正文、对象存储地址或盲测真值。
|
||||
EP 迁移:键值对 dl 迁移为 el-descriptions(:column="2" size=small);缺样本空态迁移为 el-empty;
|
||||
冻结状态以 el-tag 呈现(ready=success / missing=info);颜色统一 --el-* token;业务逻辑零改动。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElDescriptions, ElDescriptionsItem, ElEmpty, ElTag } from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import type { OrderProfileBoundSample } from '@/features/admin/types/shipping-order-document-profile.types';
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -25,93 +32,67 @@ const frozenStatus = computed(() => (
|
||||
<template>
|
||||
<aside class="panel">
|
||||
<h3>{{ t('admin.shippingOrderProfiles.versionCenter.frozenEvidencePanelTitle') }}</h3>
|
||||
<p v-if="!sample" class="empty">{{ t('admin.shippingOrderProfiles.versionCenter.selectSampleHint') }}</p>
|
||||
<dl v-else class="grid">
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingOrderProfiles.versionCenter.statusLabel') }}</dt>
|
||||
<dd>{{ frozenStatus }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingOrderProfiles.versionCenter.sampleFile') }}</dt>
|
||||
<dd>{{ sample.source_filename_snapshot || '-' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingOrderProfiles.versionCenter.layoutVersionId') }}</dt>
|
||||
<dd>{{ sample.layout_version_id || '-' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingOrderProfiles.versionCenter.evidenceFrozenAt') }}</dt>
|
||||
<dd>{{ sample.evidence_frozen_at || '-' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingOrderProfiles.versionCenter.pageCountPlain') }}</dt>
|
||||
<dd>{{ sample.page_count_snapshot || '-' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingOrderProfiles.versionCenter.parserIdentity') }}</dt>
|
||||
<dd>{{ sample.parser_name || sample.parser_key || '-' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingOrderProfiles.versionCenter.parserVersionTitle') }}</dt>
|
||||
<dd>{{ sample.parser_version || '-' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingOrderProfiles.versionCenter.frozenTableId') }}</dt>
|
||||
<dd>{{ sample.table_identity_snapshot?.table_id || sample.table_id || '-' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingOrderProfiles.versionCenter.frozenPageNo') }}</dt>
|
||||
<dd>{{ sample.table_identity_snapshot?.page_no || '-' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingOrderProfiles.versionCenter.frozenRowCount') }}</dt>
|
||||
<dd>{{ sample.table_identity_snapshot?.row_count || '-' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingOrderProfiles.versionCenter.layoutChecksumTitle') }}</dt>
|
||||
<dd><code>{{ sample.layout_payload_checksum || '-' }}</code></dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingOrderProfiles.versionCenter.contentHashTitle') }}</dt>
|
||||
<dd><code>{{ sample.source_content_hash || '-' }}</code></dd>
|
||||
</div>
|
||||
</dl>
|
||||
<el-empty v-if="!sample" :description="t('admin.shippingOrderProfiles.versionCenter.selectSampleHint')" :image-size="60" />
|
||||
<el-descriptions v-else :column="2" size="small" class="grid">
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.statusLabel')">
|
||||
<el-tag :type="sample.frozen_evidence_ready ? 'success' : 'info'" size="small">{{ frozenStatus }}</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.sampleFile')">
|
||||
{{ sample.source_filename_snapshot || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.layoutVersionId')">
|
||||
{{ sample.layout_version_id || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.evidenceFrozenAt')">
|
||||
{{ sample.evidence_frozen_at || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.pageCountPlain')">
|
||||
{{ sample.page_count_snapshot || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.parserIdentity')">
|
||||
{{ sample.parser_name || sample.parser_key || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.parserVersionTitle')">
|
||||
{{ sample.parser_version || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.frozenTableId')">
|
||||
{{ sample.table_identity_snapshot?.table_id || sample.table_id || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.frozenPageNo')">
|
||||
{{ sample.table_identity_snapshot?.page_no || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.frozenRowCount')">
|
||||
{{ sample.table_identity_snapshot?.row_count || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.layoutChecksumTitle')">
|
||||
<code>{{ sample.layout_payload_checksum || '-' }}</code>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.contentHashTitle')">
|
||||
<code>{{ sample.source_content_hash || '-' }}</code>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</aside>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.panel {
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 1rem;
|
||||
background: #fff;
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: 10px;
|
||||
background: var(--el-bg-color);
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.panel h3 {
|
||||
margin: 0;
|
||||
color: #0f172a;
|
||||
}
|
||||
|
||||
.empty {
|
||||
margin: 0.85rem 0 0;
|
||||
color: #64748b;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
gap: 0.85rem;
|
||||
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
||||
margin: 0.9rem 0 0;
|
||||
margin-top: 0.9rem;
|
||||
}
|
||||
|
||||
.grid dt {
|
||||
color: #64748b;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.grid dd {
|
||||
margin: 0.3rem 0 0;
|
||||
color: #0f172a;
|
||||
.grid :deep(code) {
|
||||
color: var(--el-text-color-regular);
|
||||
word-break: break-word;
|
||||
}
|
||||
</style>
|
||||
+18
-4
@@ -1,12 +1,19 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/components/OrderProfileIdentityStep.vue
|
||||
用途:收集模板名称与已发布 Schema。
|
||||
依赖:Schema DTO、Vue I18n。
|
||||
依赖:element-plus(el-input / el-select / el-option,沿用管理端 element-trial 主题)、
|
||||
Schema DTO、Vue I18n。
|
||||
逻辑:系统编码由服务端在创建时生成;父级拥有唯一表单状态,避免 v-model 对象替换丢失首步校验状态。
|
||||
EP 迁移:名称输入迁移为 el-input、Schema 下拉迁移为 el-select(update 快照契约不变);
|
||||
必填星号保留;颜色统一 --el-* token;业务逻辑零改动。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElInput, ElOption, ElSelect } from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import type { ShippingOrderSchemaVersion } from '@/features/admin/types/shipping-order-schema.types';
|
||||
type Identity = { displayName: string; schemaId: number };
|
||||
const props = defineProps<{ modelValue: Identity; schemas: ShippingOrderSchemaVersion[]; schemasResolved: boolean }>();
|
||||
@@ -19,12 +26,19 @@ function update(key: keyof Identity, value: string | number): void { emit('updat
|
||||
|
||||
<template>
|
||||
<div class="identity-step">
|
||||
<label class="field"><span>{{ t('admin.shippingOrderProfiles.name') }}<b>*</b></span><input class="input-field" :value="modelValue.displayName" :placeholder="t('admin.shippingOrderProfiles.wizard.namePlaceholder')" @input="update('displayName', ($event.target as HTMLInputElement).value)" /></label>
|
||||
<label class="field"><span>{{ t('admin.shippingOrderProfiles.name') }}<b>*</b></span><el-input :model-value="modelValue.displayName" :placeholder="t('admin.shippingOrderProfiles.wizard.namePlaceholder')" @update:model-value="(value) => update('displayName', String(value))" /></label>
|
||||
<div class="system-code"><strong>{{ t('admin.shippingOrderProfiles.code') }}</strong><span>{{ t('admin.shippingOrderProfiles.wizard.systemCodeHint') }}</span></div>
|
||||
<label class="field"><span>{{ t('admin.shippingOrderProfiles.schema') }}<b>*</b></span><select class="select-field" :value="modelValue.schemaId" @change="update('schemaId', Number(($event.target as HTMLSelectElement).value))"><option :value="0">{{ t('admin.shippingOrderProfiles.wizard.selectSchema') }}</option><option v-for="schema in publishedSchemas" :key="schema.id" :value="schema.id">v{{ schema.version }}</option></select><small v-if="schemasResolved && !publishedSchemas.length" class="field-warning">{{ t('admin.shippingOrderProfiles.wizard.schemaRequired') }}</small></label>
|
||||
<label class="field"><span>{{ t('admin.shippingOrderProfiles.schema') }}<b>*</b></span><el-select :model-value="modelValue.schemaId" @update:model-value="(value) => update('schemaId', Number(value))"><el-option :value="0" :label="t('admin.shippingOrderProfiles.wizard.selectSchema')" /><el-option v-for="schema in publishedSchemas" :key="schema.id" :value="schema.id" :label="`v${schema.version}`" /></el-select><small v-if="schemasResolved && !publishedSchemas.length" class="field-warning">{{ t('admin.shippingOrderProfiles.wizard.schemaRequired') }}</small></label>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.identity-step { display: grid; gap: 22px; max-width: 560px; }.field { display: grid; gap: 8px; color: var(--text-secondary); font-weight: 700; }.field > span { display: flex; gap: 4px; }.field b { color: var(--status-error-fg); }.field .input-field,.field .select-field { min-height: 44px; box-sizing: border-box; font: inherit; }.field small { color: var(--text-muted); font-size: .8rem; font-weight: 500; }.system-code { display: grid; gap: 4px; padding: 13px 14px; border: 1px solid var(--border-default); border-radius: 9px; color: var(--text-secondary); background: var(--bg-surface-soft); font-size: .86rem; }.system-code strong { color: var(--text-primary); }.field-warning { color: var(--status-warning-fg) !important; }
|
||||
.identity-step { display: grid; gap: 22px; max-width: 560px; }
|
||||
.field { display: grid; gap: 8px; color: var(--el-text-color-regular); font-weight: 700; }
|
||||
.field > span { display: flex; gap: 4px; }
|
||||
.field b { color: var(--el-color-danger); }
|
||||
.field small { color: var(--el-text-color-secondary); font-size: .8rem; font-weight: 500; }
|
||||
.system-code { display: grid; gap: 4px; padding: 13px 14px; border: 1px solid var(--el-border-color-lighter); border-radius: 9px; color: var(--el-text-color-regular); background: var(--el-fill-color-lighter); font-size: .86rem; }
|
||||
.system-code strong { color: var(--el-text-color-primary); }
|
||||
.field-warning { color: var(--el-color-warning) !important; }
|
||||
</style>
|
||||
+12
-8
@@ -1,11 +1,17 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/components/OrderProfileIssuePanel.vue
|
||||
用途:统一呈现工作台保存前的配置问题与局部预览状态。
|
||||
依赖:无。
|
||||
依赖:element-plus(el-tag 状态徽标,沿用管理端 element-trial 主题)。
|
||||
逻辑:父页面计算问题码;本组件只呈现可操作的短提示,不保存样本正文或坐标。
|
||||
EP 迁移:预览状态徽标由手写 chip 迁移为 el-tag(idle=info / updating=primary / ready=success /
|
||||
failed=danger);问题列表与错误文本保留原结构,颜色统一走 --el-* token;业务逻辑零改动。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElTag } from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
const props = defineProps<{ issues: string[]; previewState: 'idle' | 'updating' | 'ready' | 'failed'; previewError?: string }>();
|
||||
const { t } = useI18n();
|
||||
const previewStatusLabel = (state: 'idle' | 'updating' | 'ready' | 'failed') => ({
|
||||
@@ -18,7 +24,7 @@ const previewStatusLabel = (state: 'idle' | 'updating' | 'ready' | 'failed') =>
|
||||
|
||||
<template>
|
||||
<aside class="issue-panel">
|
||||
<div class="issue-title"><span>{{ t('admin.shippingOrderProfiles.workbench.review') }}</span><span :class="`state-${previewState}`">{{ previewStatusLabel(previewState) }}</span></div>
|
||||
<div class="issue-title"><span>{{ t('admin.shippingOrderProfiles.workbench.review') }}</span><el-tag :type="previewState === 'idle' ? 'info' : previewState === 'updating' ? 'primary' : previewState === 'ready' ? 'success' : 'danger'" size="small" effect="light">{{ previewStatusLabel(previewState) }}</el-tag></div>
|
||||
<p v-if="previewState === 'failed' && props.previewError" class="preview-error">{{ props.previewError }}</p>
|
||||
<p v-if="!issues.length" class="issue-empty">{{ t('admin.shippingOrderProfiles.workbench.noIssues') }}</p>
|
||||
<ul v-else><li v-for="issue in issues" :key="issue">{{ issue }}</li></ul>
|
||||
@@ -26,10 +32,8 @@ const previewStatusLabel = (state: 'idle' | 'updating' | 'ready' | 'failed') =>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.issue-panel { border-top: 1px solid #dbe4ef; background: #f8fafc; padding: .75rem 1rem; }
|
||||
.issue-title { display: flex; align-items: center; justify-content: space-between; color: #334155; font: 700 .72rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; text-transform: uppercase; }
|
||||
.issue-title span:last-child { border-radius: 999px; padding: .25rem .5rem; font-size: .65rem; letter-spacing: normal; text-transform: none; }
|
||||
.state-idle { background: #e2e8f0; }.state-updating { background: #dbeafe; color: #1d4ed8; }.state-ready { background: #dcfce7; color: #166534; }.state-failed { background: #fee2e2; color: #b91c1c; }
|
||||
ul { margin: .6rem 0 0; padding-left: 1rem; color: #b45309; font-size: .75rem; line-height: 1.4; }.issue-empty { margin: .5rem 0 0; color: #64748b; font-size: .75rem; }
|
||||
.preview-error { margin: .55rem 0 0; color: #b91c1c; font-size: .75rem; line-height: 1.4; }
|
||||
.issue-panel { border-top: 1px solid var(--el-border-color-lighter); background: var(--el-fill-color-lighter); padding: .75rem 1rem; }
|
||||
.issue-title { display: flex; align-items: center; justify-content: space-between; color: var(--el-text-color-regular); font: 700 .72rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; text-transform: uppercase; }
|
||||
ul { margin: .6rem 0 0; padding-left: 1rem; color: var(--el-color-warning); font-size: .75rem; line-height: 1.4; }.issue-empty { margin: .5rem 0 0; color: var(--el-text-color-secondary); font-size: .75rem; }
|
||||
.preview-error { margin: .55rem 0 0; color: var(--el-color-danger); font-size: .75rem; line-height: 1.4; }
|
||||
</style>
|
||||
+10
-3
@@ -1,14 +1,21 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/components/OrderProfileModelStartStep.vue
|
||||
用途:在多表样本中选择用于订单明细标注的表格。
|
||||
依赖:样本表格预览 DTO、Vue I18n。
|
||||
依赖:element-plus(el-select / el-option / el-alert,沿用管理端 element-trial 主题)、
|
||||
样本表格预览 DTO、Vue I18n。
|
||||
逻辑:只让用户选定服务端已发现的 table_id;预览限制在容器内横向滚动,避免宽表撑破页面。
|
||||
EP 迁移:表格下拉迁移为 el-select(update:modelValue 字符串契约不变);无表警告迁移为
|
||||
el-alert(warning);颜色统一 --el-* token;业务逻辑零改动。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElAlert, ElOption, ElSelect } from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
const props = defineProps<{ tables: Array<{ table_id: string; page_no: number; row_count: number; column_count: number; rows: string[][] }>; modelValue: string }>();
|
||||
const emit = defineEmits<{ 'update:modelValue': [value: string] }>();
|
||||
const { t } = useI18n();
|
||||
</script>
|
||||
<template><div class="wizard-step"><div><label>{{ t('admin.shippingOrderProfiles.wizard.orderLineTable') }}<select class="select-field" :value="modelValue" @change="emit('update:modelValue', ($event.target as HTMLSelectElement).value)"><option value="">{{ t('admin.shippingOrderProfiles.selectTable') }}</option><option v-for="table in tables" :key="table.table_id" :value="table.table_id">{{ t('admin.shippingOrderProfiles.wizard.tableOption', { page: table.page_no, rows: table.row_count, columns: table.column_count }) }}</option></select></label><p class="field-hint">{{ t('admin.shippingOrderProfiles.wizard.orderLineTableHint') }}</p></div><p v-if="!tables.length" class="warning">{{ t('admin.shippingOrderProfiles.wizard.noTable') }}</p><div v-else-if="modelValue" class="table-preview"><table><tbody><tr v-for="row in tables.find((item) => item.table_id === modelValue)?.rows.slice(0, 4) || []" :key="row.join('|')"><td v-for="cell in row" :key="cell">{{ cell }}</td></tr></tbody></table></div></div></template>
|
||||
<style scoped>.wizard-step{display:grid;min-width:0;gap:1rem}.wizard-step label{display:grid;gap:.35rem;font-weight:600}.wizard-step .select-field{min-width:0}.field-hint{margin:.45rem 0 0;color:var(--text-muted);font-size:.875rem}.warning{color:var(--status-warning-fg)}.table-preview{max-width:100%;overflow-x:auto;border:1px solid var(--border-default);border-radius:.5rem}.table-preview table{width:max-content;min-width:100%;border-collapse:collapse}.table-preview td{max-width:16rem;padding:.55rem;border:1px solid var(--border-default);overflow-wrap:anywhere;vertical-align:top}</style>
|
||||
<template><div class="wizard-step"><div><label>{{ t('admin.shippingOrderProfiles.wizard.orderLineTable') }}<el-select :model-value="modelValue" @update:model-value="(value) => emit('update:modelValue', String(value))"><el-option value="" :label="t('admin.shippingOrderProfiles.selectTable')" /><el-option v-for="table in tables" :key="table.table_id" :value="table.table_id" :label="t('admin.shippingOrderProfiles.wizard.tableOption', { page: table.page_no, rows: table.row_count, columns: table.column_count })" /></el-select></label><p class="field-hint">{{ t('admin.shippingOrderProfiles.wizard.orderLineTableHint') }}</p></div><el-alert v-if="!tables.length" class="warning" :title="t('admin.shippingOrderProfiles.wizard.noTable')" type="warning" :closable="false" /><div v-else-if="modelValue" class="table-preview"><table><tbody><tr v-for="row in tables.find((item) => item.table_id === modelValue)?.rows.slice(0, 4) || []" :key="row.join('|')"><td v-for="cell in row" :key="cell">{{ cell }}</td></tr></tbody></table></div></div></template>
|
||||
<style scoped>.wizard-step{display:grid;min-width:0;gap:1rem}.wizard-step label{display:grid;gap:.35rem;font-weight:600}.field-hint{margin:.45rem 0 0;color:var(--el-text-color-secondary);font-size:.875rem}.warning{max-width:100%}.table-preview{max-width:100%;overflow-x:auto;border:1px solid var(--el-border-color-lighter);border-radius:.5rem}.table-preview table{width:max-content;min-width:100%;border-collapse:collapse}.table-preview td{max-width:16rem;padding:.55rem;border:1px solid var(--el-border-color-lighter);overflow-wrap:anywhere;vertical-align:top}</style>
|
||||
+79
-97
@@ -1,13 +1,24 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/components/OrderProfileReadOnlyCanvas.vue
|
||||
用途:在版本详情页展示基于冻结样本绑定的只读画布。
|
||||
依赖:冻结样本预览 API、OrderProfileDocumentCanvas、冻结证据面板。
|
||||
依赖:element-plus(el-select / el-option / el-alert / el-skeleton / el-descriptions / el-tag,
|
||||
沿用管理端 element-trial 主题)、冻结样本预览 API、OrderProfileDocumentCanvas、
|
||||
冻结证据面板。
|
||||
逻辑:所有模板共用 annotation/training 冻结样本画布;XFA datasets 映射仅作为侧栏证据,
|
||||
blind_test 继续留在摘要层,不进入样本选择器。
|
||||
EP 迁移(定向,画布本体不动):样本选择下拉迁移为 el-select(selectedSampleId 数字契约经内联
|
||||
Number 适配保持);加载/错误态迁移为 el-skeleton / el-alert;冻结证据缺失提示迁移为
|
||||
el-alert(warning);区域摘要 dl 迁移为 el-descriptions,匹配结果以 el-tag(success/danger)
|
||||
呈现;颜色统一 --el-* token;OrderProfileDocumentCanvas 的 props/emits 与预览加载、
|
||||
区域诊断业务逻辑零改动。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElAlert, ElDescriptions, ElDescriptionsItem, ElOption, ElSelect, ElSkeleton, ElTag } from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import {
|
||||
authorizeOrderProfileFrozenSamplePreviewPages,
|
||||
@@ -141,29 +152,40 @@ watch([selectedSampleId, pageNo], () => {
|
||||
|
||||
<template>
|
||||
<section class="readonly-layout">
|
||||
<div v-if="!immutable" class="state-card">
|
||||
{{ t('admin.shippingOrderProfiles.versionCenter.draftCanvasHint') }}
|
||||
</div>
|
||||
<div v-else-if="!readonlySamples.length" class="state-card">
|
||||
{{ t('admin.shippingOrderProfiles.versionCenter.noReadableSamples') }}
|
||||
</div>
|
||||
<el-alert
|
||||
v-if="!immutable"
|
||||
:title="t('admin.shippingOrderProfiles.versionCenter.draftCanvasHint')"
|
||||
type="info"
|
||||
:closable="false"
|
||||
/>
|
||||
<el-alert
|
||||
v-else-if="!readonlySamples.length"
|
||||
:title="t('admin.shippingOrderProfiles.versionCenter.noReadableSamples')"
|
||||
type="info"
|
||||
:closable="false"
|
||||
/>
|
||||
<template v-else>
|
||||
<div class="toolbar">
|
||||
<label class="field">
|
||||
<span>{{ t('admin.shippingOrderProfiles.versionCenter.readonlySample') }}</span>
|
||||
<select v-model.number="selectedSampleId" class="select-field">
|
||||
<option v-for="sample in readonlySamples" :key="sample.id" :value="sample.id">
|
||||
{{ sampleLabel(sample) }}
|
||||
</option>
|
||||
</select>
|
||||
<el-select
|
||||
:model-value="selectedSampleId ?? ''"
|
||||
@update:model-value="(value) => { selectedSampleId = Number(value); }"
|
||||
>
|
||||
<el-option v-for="sample in readonlySamples" :key="sample.id" :value="sample.id" :label="sampleLabel(sample)" />
|
||||
</el-select>
|
||||
</label>
|
||||
<p v-if="selectedSample && !selectedSample.frozen_evidence_ready" class="warning-text">
|
||||
{{ t('admin.shippingOrderProfiles.versionCenter.sampleFrozenEvidenceMissing') }}
|
||||
</p>
|
||||
<el-alert
|
||||
v-if="selectedSample && !selectedSample.frozen_evidence_ready"
|
||||
class="warning-text"
|
||||
:title="t('admin.shippingOrderProfiles.versionCenter.sampleFrozenEvidenceMissing')"
|
||||
type="warning"
|
||||
:closable="false"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div v-if="errorMessage" class="state-card error-card">{{ errorMessage }}</div>
|
||||
<div v-else-if="loading" class="state-card">{{ t('admin.shippingOrderProfiles.versionCenter.loadingCanvas') }}</div>
|
||||
<el-alert v-if="errorMessage" :title="errorMessage" type="error" :closable="false" />
|
||||
<el-skeleton v-else-if="loading" :rows="6" animated />
|
||||
<div v-else-if="selectedSample && currentGrant" class="canvas-grid">
|
||||
<OrderProfileDocumentCanvas
|
||||
:profile-id="detail.id"
|
||||
@@ -184,40 +206,33 @@ watch([selectedSampleId, pageNo], () => {
|
||||
<h3>{{ t('admin.shippingOrderProfiles.versionCenter.regionSummaryTitle') }}</h3>
|
||||
<p v-if="diagnosticsLoading" class="diagnostic-state">{{ t('admin.shippingOrderProfiles.versionCenter.regionDiagnosticsLoading') }}</p>
|
||||
<p v-if="!selectedRegion" class="empty">{{ t('admin.shippingOrderProfiles.versionCenter.selectRegionHint') }}</p>
|
||||
<dl v-else class="grid">
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingOrderProfiles.versionCenter.regionLabelTitle') }}</dt>
|
||||
<dd>{{ selectedRegion.label }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingOrderProfiles.versionCenter.regionKindTitle') }}</dt>
|
||||
<dd>{{ selectedRegion.kind }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingOrderProfiles.versionCenter.regionFieldCodeTitle') }}</dt>
|
||||
<dd>{{ selectedRegion.fieldCode || '-' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingOrderProfiles.versionCenter.regionPageTitle') }}</dt>
|
||||
<dd>{{ selectedRegion.pageNo }}</dd>
|
||||
</div>
|
||||
<div class="wide-row">
|
||||
<dt>{{ t('admin.shippingOrderProfiles.versionCenter.recognizedValueTitle') }}</dt>
|
||||
<dd class="diagnostic-value">{{ selectedDiagnostic?.recognized_value || t('admin.shippingOrderProfiles.workbench.sampleValueUnavailable') }}</dd>
|
||||
</div>
|
||||
<div v-if="selectedDiagnostic?.configured_value != null" class="wide-row">
|
||||
<dt>{{ t('admin.shippingOrderProfiles.versionCenter.configuredValueTitle') }}</dt>
|
||||
<dd class="diagnostic-value">{{ selectedDiagnostic.configured_value }}</dd>
|
||||
</div>
|
||||
<div v-if="selectedDiagnostic?.matches_configured != null" class="wide-row">
|
||||
<dt>{{ t('admin.shippingOrderProfiles.versionCenter.matchResultTitle') }}</dt>
|
||||
<dd :class="selectedDiagnostic.matches_configured ? 'match-ok' : 'match-failed'">
|
||||
<el-descriptions v-else :column="2" size="small" class="grid">
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.regionLabelTitle')">
|
||||
{{ selectedRegion.label }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.regionKindTitle')">
|
||||
{{ selectedRegion.kind }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.regionFieldCodeTitle')">
|
||||
{{ selectedRegion.fieldCode || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.regionPageTitle')">
|
||||
{{ selectedRegion.pageNo }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item class="wide-row" :label="t('admin.shippingOrderProfiles.versionCenter.recognizedValueTitle')">
|
||||
<span class="diagnostic-value">{{ selectedDiagnostic?.recognized_value || t('admin.shippingOrderProfiles.workbench.sampleValueUnavailable') }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="selectedDiagnostic?.configured_value != null" class="wide-row" :label="t('admin.shippingOrderProfiles.versionCenter.configuredValueTitle')">
|
||||
<span class="diagnostic-value">{{ selectedDiagnostic.configured_value }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item v-if="selectedDiagnostic?.matches_configured != null" class="wide-row" :label="t('admin.shippingOrderProfiles.versionCenter.matchResultTitle')">
|
||||
<el-tag :type="selectedDiagnostic.matches_configured ? 'success' : 'danger'" size="small">
|
||||
{{ selectedDiagnostic.matches_configured
|
||||
? t('admin.shippingOrderProfiles.versionCenter.matchResultMatched')
|
||||
: t('admin.shippingOrderProfiles.versionCenter.matchResultMismatched') }}
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</el-tag>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
@@ -232,11 +247,10 @@ watch([selectedSampleId, pageNo], () => {
|
||||
}
|
||||
|
||||
.toolbar,
|
||||
.state-card,
|
||||
.panel {
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 1rem;
|
||||
background: #fff;
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: 12px;
|
||||
background: var(--el-bg-color);
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
@@ -251,15 +265,10 @@ watch([selectedSampleId, pageNo], () => {
|
||||
}
|
||||
|
||||
.field span {
|
||||
color: #475569;
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.field .select-field {
|
||||
min-height: 2.5rem;
|
||||
padding: 0 0.75rem;
|
||||
}
|
||||
|
||||
.canvas-grid {
|
||||
display: grid;
|
||||
gap: 1rem;
|
||||
@@ -273,20 +282,16 @@ watch([selectedSampleId, pageNo], () => {
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
gap: 0.75rem;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
margin: 0.85rem 0 0;
|
||||
margin-top: 0.85rem;
|
||||
}
|
||||
|
||||
.grid dt {
|
||||
color: #64748b;
|
||||
font-size: 0.75rem;
|
||||
.grid :deep(.el-descriptions__label) {
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.grid dd {
|
||||
margin: 0.25rem 0 0;
|
||||
color: #0f172a;
|
||||
.grid :deep(.el-descriptions__content) {
|
||||
color: var(--el-text-color-primary);
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
@@ -296,51 +301,28 @@ watch([selectedSampleId, pageNo], () => {
|
||||
|
||||
.diagnostic-state {
|
||||
margin: 0.75rem 0 0;
|
||||
color: #0369a1;
|
||||
color: var(--el-color-primary);
|
||||
font-size: 0.78rem;
|
||||
}
|
||||
|
||||
.diagnostic-value {
|
||||
border-left: 3px solid #0ea5e9;
|
||||
background: #f0f9ff;
|
||||
display: block;
|
||||
border-left: 3px solid var(--el-color-primary);
|
||||
background: var(--el-color-primary-light-9);
|
||||
padding: 0.65rem 0.75rem;
|
||||
color: #0f172a;
|
||||
color: var(--el-text-color-primary);
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
||||
line-height: 1.55;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.match-ok,
|
||||
.match-failed {
|
||||
display: inline-flex;
|
||||
width: fit-content;
|
||||
border-radius: 999px;
|
||||
padding: 0.3rem 0.65rem;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.match-ok {
|
||||
background: #dcfce7;
|
||||
color: #166534;
|
||||
}
|
||||
|
||||
.match-failed {
|
||||
background: #fee2e2;
|
||||
color: #991b1b;
|
||||
}
|
||||
|
||||
.warning-text {
|
||||
margin: 0;
|
||||
color: #b45309;
|
||||
}
|
||||
|
||||
.error-card {
|
||||
color: #b91c1c;
|
||||
}
|
||||
|
||||
.empty {
|
||||
margin: 0.75rem 0 0;
|
||||
color: #64748b;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
@media (max-width: 1180px) {
|
||||
|
||||
+31
-4
@@ -1,13 +1,21 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/components/OrderProfileSampleStep.vue
|
||||
用途:上传新模板样本或复用已解析样本,并自动选择上传后解析完成的文档。
|
||||
依赖:模板样本 Intake 状态 API、文件资产上传 API、Vue I18n。
|
||||
依赖:element-plus(el-button / el-select / el-option,沿用管理端 element-trial 主题)、
|
||||
模板样本 Intake 状态 API、文件资产上传 API、Vue I18n。
|
||||
逻辑:上传后轮询同一 Intake;只有 ready 样本进入父级选择值,避免要求管理员重复选择刚上传的文件。
|
||||
EP 迁移:复用样本下拉迁移为 el-select(Number 契约经内联适配保持);「刷新样本」文字按钮迁移为
|
||||
el-button(link);文件上传保留原生 input[type=file](el-upload 涉及上传链路重构,不在本次
|
||||
定向范围);lucide 状态图标保留;颜色统一 --el-* token;轮询/上传业务逻辑零改动。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, ref, watch } from 'vue';
|
||||
import { CheckCircle2, Clock3, UploadCloud } from 'lucide-vue-next';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElButton, ElOption, ElSelect } from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { uploadFileAsset } from '@/shared/api/file-assets.api';
|
||||
@@ -113,7 +121,7 @@ onBeforeUnmount(stopPolling);
|
||||
<strong>{{ pendingIntake.filename }}</strong>
|
||||
<p v-if="pendingIntake.state === 'failed'">{{ sampleFailureMessage(pendingIntake.errorCode) }}</p>
|
||||
<p v-else>{{ t(`admin.shippingOrderProfiles.wizard.sampleStatus.${pendingIntake.state}`) }}</p>
|
||||
<button v-if="pendingIntake.state !== 'uploading' && pendingIntake.state !== 'failed'" type="button" class="refresh-status" @click="emit('refresh')">{{ t('admin.shippingOrderProfiles.wizard.refreshSamples') }}</button>
|
||||
<el-button v-if="pendingIntake.state !== 'uploading' && pendingIntake.state !== 'failed'" link type="primary" size="small" class="refresh-status" @click="emit('refresh')">{{ t('admin.shippingOrderProfiles.wizard.refreshSamples') }}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -121,11 +129,30 @@ onBeforeUnmount(stopPolling);
|
||||
|
||||
<section class="reuse-panel">
|
||||
<div class="reuse-panel__heading"><h3>{{ t('admin.shippingOrderProfiles.wizard.reuseSample') }}</h3><p>{{ t('admin.shippingOrderProfiles.wizard.reuseSampleHint') }}</p></div>
|
||||
<label class="field"><span>{{ t('admin.shippingOrderProfiles.selectSample') }}</span><select class="select-field" :value="modelValue" @change="emit('update:modelValue', Number(($event.target as HTMLSelectElement).value))"><option :value="0">{{ t('admin.shippingOrderProfiles.selectSample') }}</option><option v-for="sample in samples" :key="sample.document_id" :value="sample.document_id">{{ sample.filename || sample.intake_no }} · {{ sample.table_count }} {{ t('admin.shippingOrderProfiles.tablesUnit') }}</option></select></label>
|
||||
<label class="field"><span>{{ t('admin.shippingOrderProfiles.selectSample') }}</span><el-select :model-value="modelValue" @update:model-value="(value) => emit('update:modelValue', Number(value))"><el-option :value="0" :label="t('admin.shippingOrderProfiles.selectSample')" /><el-option v-for="sample in samples" :key="sample.document_id" :value="sample.document_id" :label="`${sample.filename || sample.intake_no} · ${sample.table_count} ${t('admin.shippingOrderProfiles.tablesUnit')}`" /></el-select></label>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.sample-step { display: grid; gap: 18px; max-width: 640px; }.upload-panel,.reuse-panel,.parse-status,.selected-sample { border: 1px solid var(--border-default); border-radius: 12px; background: var(--bg-surface); }.upload-panel { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 18px; background: var(--bg-surface-soft); }.upload-panel__icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 10px; color: var(--status-info-fg); background: var(--status-info-bg); }.upload-panel h3,.reuse-panel h3,.parse-status p,.selected-sample span { margin: 0; }.upload-panel h3,.reuse-panel h3 { color: var(--text-primary); font-size: 1rem; }.upload-panel p,.reuse-panel p { margin: 5px 0 0; color: var(--text-muted); font-size: .84rem; }.upload-action { display: inline-flex; min-height: 38px; align-items: center; border-radius: 8px; padding: 0 13px; color: #fff; background: #0284c7; font-weight: 700; cursor: pointer; }.upload-action input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }.parse-status,.selected-sample { display: flex; gap: 10px; align-items: center; padding: 13px 15px; color: var(--status-info-fg); background: var(--status-info-bg); }.parse-status strong,.selected-sample strong { display: block; color: var(--text-primary); }.parse-status p,.selected-sample span { display: block; margin-top: 3px; color: var(--text-muted); font-size: .83rem; }.refresh-status { margin-top: 6px; padding: 0; border: 0; color: inherit; background: transparent; font: inherit; font-size: .8rem; font-weight: 700; cursor: pointer; text-decoration: underline; }.parse-status.failed { color: var(--status-error-fg); border-color: var(--status-error-border); background: var(--status-error-bg); }.parse-status.failed > span { display: grid; width: 19px; height: 19px; place-items: center; border-radius: 50%; color: #fff; background: var(--status-error-fg); font-weight: 800; }.selected-sample { color: var(--status-success-fg); border-color: var(--status-success-border); background: var(--status-success-bg); }.reuse-panel { padding: 18px; }.reuse-panel__heading { margin-bottom: 14px; }.field { display: grid; gap: 7px; color: var(--text-secondary); font-size: .88rem; font-weight: 700; }.field .select-field { min-height: 44px; font: inherit; } @media (max-width: 640px) { .upload-panel { grid-template-columns: auto 1fr; }.upload-action { grid-column: 1 / -1; justify-content: center; } }
|
||||
.sample-step { display: grid; gap: 18px; max-width: 640px; }
|
||||
.upload-panel,.reuse-panel,.parse-status,.selected-sample { border: 1px solid var(--el-border-color-lighter); border-radius: 12px; background: var(--el-bg-color); }
|
||||
.upload-panel { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 18px; background: var(--el-fill-color-lighter); }
|
||||
.upload-panel__icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 10px; color: var(--el-color-primary); background: var(--el-color-primary-light-9); }
|
||||
.upload-panel h3,.reuse-panel h3,.parse-status p,.selected-sample span { margin: 0; }
|
||||
.upload-panel h3,.reuse-panel h3 { color: var(--el-text-color-primary); font-size: 1rem; }
|
||||
.upload-panel p,.reuse-panel p { margin: 5px 0 0; color: var(--el-text-color-secondary); font-size: .84rem; }
|
||||
.upload-action { display: inline-flex; min-height: 38px; align-items: center; border-radius: 8px; padding: 0 13px; color: #fff; background: var(--el-color-primary); font-weight: 700; cursor: pointer; }
|
||||
.upload-action input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
|
||||
.parse-status,.selected-sample { display: flex; gap: 10px; align-items: center; padding: 13px 15px; color: var(--el-color-primary); background: var(--el-color-primary-light-9); }
|
||||
.parse-status strong,.selected-sample strong { display: block; color: var(--el-text-color-primary); }
|
||||
.parse-status p,.selected-sample span { display: block; margin-top: 3px; color: var(--el-text-color-secondary); font-size: .83rem; }
|
||||
.refresh-status { margin-top: 6px; }
|
||||
.parse-status.failed { color: var(--el-color-danger); border-color: var(--el-color-danger-light-5); background: var(--el-color-danger-light-9); }
|
||||
.parse-status.failed > span { display: grid; width: 19px; height: 19px; place-items: center; border-radius: 50%; color: #fff; background: var(--el-color-danger); font-weight: 800; }
|
||||
.selected-sample { color: var(--el-color-success); border-color: var(--el-color-success-light-5); background: var(--el-color-success-light-9); }
|
||||
.reuse-panel { padding: 18px; }
|
||||
.reuse-panel__heading { margin-bottom: 14px; }
|
||||
.field { display: grid; gap: 7px; color: var(--el-text-color-regular); font-size: .88rem; font-weight: 700; }
|
||||
@media (max-width: 640px) { .upload-panel { grid-template-columns: auto 1fr; }.upload-action { grid-column: 1 / -1; justify-content: center; } }
|
||||
</style>
|
||||
+49
-51
@@ -1,13 +1,22 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/components/OrderProfileUsageTable.vue
|
||||
用途:展示订单模板版本的实际使用记录,并提供进入只读 Run 审计的入口。
|
||||
依赖:版本中心 usage API、Vue Router。
|
||||
逻辑:只读取每个 Unit 最新 RouteDecision 的安全投影;点击行跳转到管理员 Run 诊断页,不在当前页改动任何业务状态。
|
||||
依赖:element-plus(el-button / el-alert / el-empty / el-skeleton / el-tag,沿用管理端
|
||||
element-trial 主题)、版本中心 usage API、Vue Router。
|
||||
逻辑:只读取每个 Unit 最新 RouteDecision 的安全投影;点击行跳转到管理员 Run 诊断页,
|
||||
不在当前页改动任何业务状态。
|
||||
EP 迁移:刷新/翻页按钮迁移为 el-button(刷新带 :loading)、诊断入口迁移为 el-button(link);
|
||||
加载/错误/空态迁移为 el-skeleton / el-alert / el-empty;使用记录表保留原生 table 结构
|
||||
(列多需横向滚动,暂不迁移 el-table),颜色统一 --el-* token;业务脚本零改动。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useRouter } from "vue-router";
|
||||
import { ElAlert, ElButton, ElEmpty, ElSkeleton, ElTag } from "element-plus";
|
||||
import "element-plus/dist/index.css";
|
||||
import "element-plus/theme-chalk/dark/css-vars.css";
|
||||
import "@/features/admin/styles/element-trial.css";
|
||||
import { BusinessError } from "@/shared/api/client";
|
||||
import { listOrderDocumentProfileUsages } from "@/features/admin/api/shipping-order-document-profile.api";
|
||||
import type {
|
||||
@@ -99,23 +108,24 @@ watch(
|
||||
<h3>{{ t("admin.shippingOrderProfiles.versionCenter.usage.title") }}</h3>
|
||||
<p>{{ t("admin.shippingOrderProfiles.versionCenter.usage.subtitle") }}</p>
|
||||
</div>
|
||||
<button type="button" class="ghost-button" :disabled="loading" @click="load">
|
||||
<el-button :disabled="loading" :loading="loading" @click="load">
|
||||
{{ t("admin.shippingOrderProfiles.versionCenter.usage.refresh") }}
|
||||
</button>
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<div v-if="loading" class="state-card">
|
||||
{{ t("admin.shippingOrderProfiles.versionCenter.usage.loading") }}
|
||||
</div>
|
||||
<el-skeleton v-if="loading" class="state-card" :rows="5" animated />
|
||||
<div v-else-if="errorMessage" class="state-card error-card">
|
||||
<p>{{ errorMessage }}</p>
|
||||
<button type="button" class="btn-secondary btn-sm" @click="load">
|
||||
<el-alert :title="errorMessage" type="error" :closable="false" />
|
||||
<el-button class="error-retry" size="small" @click="load">
|
||||
{{ t("admin.shippingOrderProfiles.versionCenter.retry") }}
|
||||
</button>
|
||||
</div>
|
||||
<div v-else-if="!page?.items.length" class="state-card">
|
||||
{{ t("admin.shippingOrderProfiles.versionCenter.usage.empty") }}
|
||||
</el-button>
|
||||
</div>
|
||||
<el-empty
|
||||
v-else-if="!page?.items.length"
|
||||
class="state-card"
|
||||
:description="t('admin.shippingOrderProfiles.versionCenter.usage.empty')"
|
||||
:image-size="60"
|
||||
/>
|
||||
<div v-else class="table-wrapper">
|
||||
<table>
|
||||
<thead>
|
||||
@@ -141,8 +151,8 @@ watch(
|
||||
<div class="cell-title">{{ item.document_label }}</div>
|
||||
<small>#{{ item.unit_position + 1 }}</small>
|
||||
</td>
|
||||
<td>{{ translateUsageValue("matchStatuses", item.match_status) }}</td>
|
||||
<td>{{ translateUsageValue("executionStatuses", item.execution_status) }}</td>
|
||||
<td><el-tag size="small" effect="plain">{{ translateUsageValue("matchStatuses", item.match_status) }}</el-tag></td>
|
||||
<td><el-tag size="small" :type="item.execution_status === 'succeeded' ? 'success' : item.execution_status === 'failed' ? 'danger' : 'info'" effect="plain">{{ translateUsageValue("executionStatuses", item.execution_status) }}</el-tag></td>
|
||||
<td>{{ translateUsageValue("identityModes", item.identity_match_mode) }}</td>
|
||||
<td>
|
||||
{{
|
||||
@@ -159,9 +169,9 @@ watch(
|
||||
<span v-else>-</span>
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" class="link-button" @click="openDiagnostic(item)">
|
||||
<el-button link type="primary" @click="openDiagnostic(item)">
|
||||
{{ t("admin.shippingOrderProfiles.versionCenter.usage.openDiagnostic") }}
|
||||
</button>
|
||||
</el-button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -169,12 +179,12 @@ watch(
|
||||
</div>
|
||||
|
||||
<div class="pager">
|
||||
<button type="button" class="ghost-button" :disabled="loading || !hasPrevious" @click="loadPrevious">
|
||||
<el-button :disabled="loading || !hasPrevious" @click="loadPrevious">
|
||||
{{ t("admin.shippingOrderProfiles.versionCenter.usage.previous") }}
|
||||
</button>
|
||||
<button type="button" class="ghost-button" :disabled="loading || !hasNext" @click="loadNext">
|
||||
</el-button>
|
||||
<el-button :disabled="loading || !hasNext" @click="loadNext">
|
||||
{{ t("admin.shippingOrderProfiles.versionCenter.usage.next") }}
|
||||
</button>
|
||||
</el-button>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
@@ -182,11 +192,10 @@ watch(
|
||||
<style scoped>
|
||||
.usage-panel,
|
||||
.toolbar,
|
||||
.table-wrapper,
|
||||
.state-card {
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 1rem;
|
||||
background: #fff;
|
||||
.table-wrapper {
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: 12px;
|
||||
background: var(--el-bg-color);
|
||||
}
|
||||
|
||||
.usage-panel {
|
||||
@@ -210,26 +219,19 @@ watch(
|
||||
|
||||
.toolbar h3 {
|
||||
margin: 0;
|
||||
color: #0f172a;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.toolbar p {
|
||||
margin: 0.25rem 0 0;
|
||||
color: #64748b;
|
||||
font-size: 0.75rem;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.ghost-button,
|
||||
.link-button {
|
||||
border: 1px solid #cbd5e1;
|
||||
border-radius: 0.75rem;
|
||||
background: #fff;
|
||||
padding: 0.5rem 0.75rem;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.link-button {
|
||||
color: #2563eb;
|
||||
.error-card {
|
||||
display: grid;
|
||||
justify-items: start;
|
||||
gap: 0.6rem;
|
||||
}
|
||||
|
||||
.table-wrapper {
|
||||
@@ -240,19 +242,19 @@ table {
|
||||
width: 100%;
|
||||
min-width: 980px;
|
||||
border-collapse: collapse;
|
||||
font-size: 0.84rem;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
thead {
|
||||
background: #f8fafc;
|
||||
color: #64748b;
|
||||
font-size: 0.75rem;
|
||||
background: var(--el-fill-color-lighter);
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
th,
|
||||
td {
|
||||
padding: 0.75rem;
|
||||
border-bottom: 1px solid #e2e8f0;
|
||||
border-bottom: 1px solid var(--el-border-color-lighter);
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
}
|
||||
@@ -262,16 +264,12 @@ tbody tr:last-child td {
|
||||
}
|
||||
|
||||
.cell-title {
|
||||
color: #0f172a;
|
||||
color: var(--el-text-color-primary);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
td small {
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.error-card {
|
||||
color: #b91c1c;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
|
||||
+99
-108
@@ -1,13 +1,23 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/components/OrderProfileVersionDiff.vue
|
||||
用途:展示订单模板版本中心的服务端语义 diff。
|
||||
依赖:版本中心 diff API、路由 query、版本摘要列表。
|
||||
依赖:element-plus(el-button / el-select / el-option / el-tag / el-alert / el-empty /
|
||||
el-skeleton / el-collapse,沿用管理端 element-trial 主题)、版本中心 diff API、
|
||||
路由 query、版本摘要列表。
|
||||
逻辑:始终由服务端计算差异;前端只负责选择对比版本、呈现 summary 和折叠原始 JSON 快照。
|
||||
EP 迁移:对比版本下拉迁移为 el-select(change 内联适配原有 Number 解析,保持路由 query 契约);
|
||||
重试迁移为 el-button;added/removed/modified/unchanged 摘要与变更类型迁移为 el-tag;
|
||||
加载/错误/空态迁移为 el-skeleton / el-alert / el-empty;原始 JSON 折叠迁移为 el-collapse;
|
||||
颜色统一 --el-* token;业务脚本(服务端 diff 加载/query 同步)零改动。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { ElAlert, ElButton, ElCollapse, ElCollapseItem, ElEmpty, ElOption, ElSelect, ElSkeleton, ElTag } from "element-plus";
|
||||
import "element-plus/dist/index.css";
|
||||
import "element-plus/theme-chalk/dark/css-vars.css";
|
||||
import "@/features/admin/styles/element-trial.css";
|
||||
import { BusinessError } from "@/shared/api/client";
|
||||
import { getOrderDocumentProfileDiff } from "@/features/admin/api/shipping-order-document-profile.api";
|
||||
import type {
|
||||
@@ -134,44 +144,44 @@ watch(
|
||||
</div>
|
||||
<label class="compare-select">
|
||||
<span>{{ t("admin.shippingOrderProfiles.versionCenter.diff.compareTarget") }}</span>
|
||||
<select
|
||||
class="select-field"
|
||||
:value="explicitAgainstProfileId || ''"
|
||||
@change="handleAgainstChange"
|
||||
<el-select
|
||||
:model-value="explicitAgainstProfileId || ''"
|
||||
class="compare-target"
|
||||
@change="(value) => handleAgainstChange({ target: { value: String(value) } } as unknown as Event)"
|
||||
>
|
||||
<option value="">{{ t("admin.shippingOrderProfiles.versionCenter.diff.defaultPrevious") }}</option>
|
||||
<option
|
||||
<el-option :label="t('admin.shippingOrderProfiles.versionCenter.diff.defaultPrevious')" value="" />
|
||||
<el-option
|
||||
v-for="item in comparableVersions"
|
||||
:key="item.id"
|
||||
:value="item.id"
|
||||
>
|
||||
v{{ item.version }} · {{ t(`admin.shippingOrderProfiles.versionCenter.status.${item.status === "draft" ? "currentDraft" : item.status === "published" ? "currentPublished" : "retired"}`) }}
|
||||
</option>
|
||||
</select>
|
||||
:label="`v${item.version} · ${t(`admin.shippingOrderProfiles.versionCenter.status.${item.status === 'draft' ? 'currentDraft' : item.status === 'published' ? 'currentPublished' : 'retired'}`)}`"
|
||||
/>
|
||||
</el-select>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div v-if="loading" class="state-card">
|
||||
{{ t("admin.shippingOrderProfiles.versionCenter.diff.loading") }}
|
||||
</div>
|
||||
<el-skeleton v-if="loading" class="state-card" :rows="5" animated />
|
||||
<div v-else-if="errorMessage" class="state-card error-card">
|
||||
<p>{{ errorMessage }}</p>
|
||||
<button type="button" class="btn-secondary btn-sm" @click="load">
|
||||
<el-alert :title="errorMessage" type="error" :closable="false" />
|
||||
<el-button class="error-retry" size="small" @click="load">
|
||||
{{ t("admin.shippingOrderProfiles.versionCenter.retry") }}
|
||||
</button>
|
||||
</el-button>
|
||||
</div>
|
||||
<template v-else-if="diff">
|
||||
<div class="summary-bar">
|
||||
<span class="summary-target">{{ t("admin.shippingOrderProfiles.versionCenter.diff.comparedWith", { target: comparisonTargetLabel }) }}</span>
|
||||
<span class="summary-pill added">{{ t("admin.shippingOrderProfiles.versionCenter.diff.summary.added", { count: diff.summary.added }) }}</span>
|
||||
<span class="summary-pill removed">{{ t("admin.shippingOrderProfiles.versionCenter.diff.summary.removed", { count: diff.summary.removed }) }}</span>
|
||||
<span class="summary-pill modified">{{ t("admin.shippingOrderProfiles.versionCenter.diff.summary.modified", { count: diff.summary.modified }) }}</span>
|
||||
<span class="summary-pill unchanged">{{ t("admin.shippingOrderProfiles.versionCenter.diff.summary.unchanged", { count: diff.summary.unchanged }) }}</span>
|
||||
<el-tag type="success" effect="light" round>{{ t("admin.shippingOrderProfiles.versionCenter.diff.summary.added", { count: diff.summary.added }) }}</el-tag>
|
||||
<el-tag type="danger" effect="light" round>{{ t("admin.shippingOrderProfiles.versionCenter.diff.summary.removed", { count: diff.summary.removed }) }}</el-tag>
|
||||
<el-tag type="primary" effect="light" round>{{ t("admin.shippingOrderProfiles.versionCenter.diff.summary.modified", { count: diff.summary.modified }) }}</el-tag>
|
||||
<el-tag type="info" effect="plain" round>{{ t("admin.shippingOrderProfiles.versionCenter.diff.summary.unchanged", { count: diff.summary.unchanged }) }}</el-tag>
|
||||
</div>
|
||||
|
||||
<div v-if="!changedItems.length" class="state-card">
|
||||
{{ t("admin.shippingOrderProfiles.versionCenter.diff.noChanges") }}
|
||||
</div>
|
||||
<el-empty
|
||||
v-if="!changedItems.length"
|
||||
class="state-card"
|
||||
:description="t('admin.shippingOrderProfiles.versionCenter.diff.noChanges')"
|
||||
:image-size="60"
|
||||
/>
|
||||
|
||||
<article
|
||||
v-for="item in changedItems"
|
||||
@@ -184,7 +194,10 @@ watch(
|
||||
<p>{{ entityTypeLabel(item) }}</p>
|
||||
<h4>{{ item.label }}</h4>
|
||||
</div>
|
||||
<span class="change-type">{{ changeTypeLabel(item.change_type) }}</span>
|
||||
<el-tag
|
||||
size="small"
|
||||
:type="item.change_type === 'added' ? 'success' : item.change_type === 'removed' ? 'danger' : item.change_type === 'modified' ? 'primary' : 'info'"
|
||||
>{{ changeTypeLabel(item.change_type) }}</el-tag>
|
||||
</header>
|
||||
|
||||
<dl v-if="item.changes.length" class="change-list">
|
||||
@@ -207,19 +220,20 @@ watch(
|
||||
</div>
|
||||
</dl>
|
||||
|
||||
<details class="raw-json">
|
||||
<summary>{{ t("admin.shippingOrderProfiles.versionCenter.diff.rawJson") }}</summary>
|
||||
<div class="raw-json-grid">
|
||||
<section>
|
||||
<h5>{{ t("admin.shippingOrderProfiles.versionCenter.diff.beforeSnapshot") }}</h5>
|
||||
<pre>{{ valueText(item.before_snapshot) }}</pre>
|
||||
</section>
|
||||
<section>
|
||||
<h5>{{ t("admin.shippingOrderProfiles.versionCenter.diff.afterSnapshot") }}</h5>
|
||||
<pre>{{ valueText(item.after_snapshot) }}</pre>
|
||||
</section>
|
||||
</div>
|
||||
</details>
|
||||
<el-collapse class="raw-json">
|
||||
<el-collapse-item :title="t('admin.shippingOrderProfiles.versionCenter.diff.rawJson')" name="raw">
|
||||
<div class="raw-json-grid">
|
||||
<section>
|
||||
<h5>{{ t("admin.shippingOrderProfiles.versionCenter.diff.beforeSnapshot") }}</h5>
|
||||
<pre>{{ valueText(item.before_snapshot) }}</pre>
|
||||
</section>
|
||||
<section>
|
||||
<h5>{{ t("admin.shippingOrderProfiles.versionCenter.diff.afterSnapshot") }}</h5>
|
||||
<pre>{{ valueText(item.after_snapshot) }}</pre>
|
||||
</section>
|
||||
</div>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
</article>
|
||||
</template>
|
||||
</section>
|
||||
@@ -229,11 +243,10 @@ watch(
|
||||
.diff-panel,
|
||||
.toolbar,
|
||||
.summary-bar,
|
||||
.diff-item,
|
||||
.state-card {
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 1rem;
|
||||
background: #fff;
|
||||
.diff-item {
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: 12px;
|
||||
background: var(--el-bg-color);
|
||||
}
|
||||
|
||||
.diff-panel {
|
||||
@@ -256,30 +269,27 @@ watch(
|
||||
}
|
||||
|
||||
.toolbar h3,
|
||||
.diff-item h4,
|
||||
.raw-json h5 {
|
||||
.diff-item h4 {
|
||||
margin: 0;
|
||||
color: #0f172a;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.toolbar p,
|
||||
.diff-item header p {
|
||||
margin: 0 0 0.3rem;
|
||||
color: #64748b;
|
||||
font-size: 0.75rem;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.compare-select {
|
||||
display: grid;
|
||||
gap: 0.35rem;
|
||||
color: #475569;
|
||||
font-size: 0.75rem;
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.compare-select .select-field {
|
||||
.compare-select .compare-target {
|
||||
min-width: 220px;
|
||||
padding: 0.5rem 0.75rem;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.summary-bar {
|
||||
@@ -291,48 +301,17 @@ watch(
|
||||
|
||||
.summary-target {
|
||||
margin-right: 0.5rem;
|
||||
color: #334155;
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.summary-pill,
|
||||
.change-type {
|
||||
border-radius: 999px;
|
||||
padding: 0.2rem 0.55rem;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.summary-pill.added,
|
||||
.diff-item.added .change-type {
|
||||
background: #dcfce7;
|
||||
color: #166534;
|
||||
}
|
||||
|
||||
.summary-pill.removed,
|
||||
.diff-item.removed .change-type {
|
||||
background: #fee2e2;
|
||||
color: #b91c1c;
|
||||
}
|
||||
|
||||
.summary-pill.modified,
|
||||
.diff-item.modified .change-type {
|
||||
background: #dbeafe;
|
||||
color: #1d4ed8;
|
||||
}
|
||||
|
||||
.summary-pill.unchanged,
|
||||
.diff-item.unchanged .change-type {
|
||||
background: #e2e8f0;
|
||||
color: #475569;
|
||||
}
|
||||
|
||||
.diff-item {
|
||||
border-left-width: 4px;
|
||||
}
|
||||
|
||||
.diff-item.added { border-left-color: #22c55e; }
|
||||
.diff-item.removed { border-left-color: #ef4444; }
|
||||
.diff-item.modified { border-left-color: #3b82f6; }
|
||||
.diff-item.added { border-left-color: var(--el-color-success); }
|
||||
.diff-item.removed { border-left-color: var(--el-color-danger); }
|
||||
.diff-item.modified { border-left-color: var(--el-color-primary); }
|
||||
|
||||
.diff-item header {
|
||||
display: flex;
|
||||
@@ -354,16 +333,16 @@ watch(
|
||||
}
|
||||
|
||||
.change-list dt {
|
||||
color: #475569;
|
||||
font-size: 0.75rem;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.change-list dd {
|
||||
display: grid;
|
||||
gap: 0.3rem;
|
||||
margin: 0;
|
||||
color: #334155;
|
||||
font-size: 0.82rem;
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 13px;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
@@ -373,53 +352,65 @@ watch(
|
||||
}
|
||||
|
||||
del {
|
||||
color: #b91c1c;
|
||||
color: var(--el-color-danger);
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
ins {
|
||||
color: #15803d;
|
||||
color: var(--el-color-success);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.change-list small {
|
||||
color: #64748b;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
.raw-json {
|
||||
margin-top: 0.9rem;
|
||||
border-top: 1px solid #e2e8f0;
|
||||
padding-top: 0.9rem;
|
||||
border-top: 1px solid var(--el-border-color-lighter);
|
||||
}
|
||||
|
||||
.raw-json summary {
|
||||
cursor: pointer;
|
||||
color: #334155;
|
||||
font-size: 0.8rem;
|
||||
.raw-json :deep(.el-collapse-item__header) {
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
background: transparent;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.raw-json :deep(.el-collapse-item__wrap) {
|
||||
background: transparent;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.raw-json-grid {
|
||||
display: grid;
|
||||
gap: 0.85rem;
|
||||
margin-top: 0.75rem;
|
||||
margin-top: 0.35rem;
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.raw-json h5 {
|
||||
margin: 0;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.raw-json pre {
|
||||
margin: 0.45rem 0 0;
|
||||
border-radius: 0.75rem;
|
||||
background: #0f172a;
|
||||
border-radius: 8px;
|
||||
background: var(--el-fill-color-dark);
|
||||
padding: 0.75rem;
|
||||
color: #e2e8f0;
|
||||
font-size: 0.72rem;
|
||||
color: var(--el-text-color-primary);
|
||||
font-size: 11px;
|
||||
line-height: 1.45;
|
||||
overflow: auto;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.error-card {
|
||||
color: #b91c1c;
|
||||
display: grid;
|
||||
justify-items: start;
|
||||
gap: 0.6rem;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
@@ -435,7 +426,7 @@ ins {
|
||||
display: grid;
|
||||
}
|
||||
|
||||
.compare-select .select-field {
|
||||
.compare-select .compare-target {
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
+137
-181
@@ -1,12 +1,20 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/components/OrderProfileVersionOverview.vue
|
||||
用途:展示模板版本详情的配置概览页签。
|
||||
依赖:订单模板详情 DTO、i18n。
|
||||
依赖:element-plus(el-tag / el-descriptions / el-collapse,沿用管理端 element-trial 主题)、
|
||||
订单模板详情 DTO、i18n。
|
||||
逻辑:仅渲染结构化摘要与冻结证据状态,不请求 PDF、Layout payload 或盲测真值。
|
||||
EP 迁移:概览徽标迁移为 el-tag(published=success / draft=warning / retired=danger,其余为
|
||||
info plain);五张摘要卡与源版本卡的 dl 键值对迁移为 el-descriptions;「技术细节」原生
|
||||
details 迁移为 el-collapse;颜色统一 --el-* token;业务逻辑零改动(statusClass 仅保留计算)。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import { ElCollapse, ElCollapseItem, ElDescriptions, ElDescriptionsItem, ElTag } from "element-plus";
|
||||
import "element-plus/dist/index.css";
|
||||
import "element-plus/theme-chalk/dark/css-vars.css";
|
||||
import "@/features/admin/styles/element-trial.css";
|
||||
import type { ShippingOrderDocumentProfile } from "@/features/admin/types/shipping-order-document-profile.types";
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -55,14 +63,18 @@ const testStatusLabel = computed(() => {
|
||||
<p class="profile-identity">{{ detail.profile_code }}</p>
|
||||
</div>
|
||||
<div class="hero-meta">
|
||||
<span class="meta-chip meta-chip--status" :class="statusClass">{{ statusLabel }}</span>
|
||||
<span class="meta-chip">
|
||||
<el-tag
|
||||
class="meta-chip meta-chip--status"
|
||||
:class="statusClass"
|
||||
:type="detail.status === 'published' ? 'success' : detail.status === 'draft' ? 'warning' : 'danger'"
|
||||
>{{ statusLabel }}</el-tag>
|
||||
<el-tag class="meta-chip" type="info" effect="plain">
|
||||
{{ t("admin.shippingOrderProfiles.versionCenter.schemaVersion") }}
|
||||
{{ detail.schema_summary?.version ?? "-" }}
|
||||
</span>
|
||||
<span class="meta-chip">
|
||||
</el-tag>
|
||||
<el-tag class="meta-chip" type="info" effect="plain">
|
||||
{{ t("admin.shippingOrderProfiles.versionCenter.sampleCount", { count: detail.sample_summary?.sample_count || 0 }) }}
|
||||
</span>
|
||||
</el-tag>
|
||||
</div>
|
||||
</div>
|
||||
<p v-if="detail.change_note" class="change-note">{{ detail.change_note }}</p>
|
||||
@@ -71,112 +83,92 @@ const testStatusLabel = computed(() => {
|
||||
<div class="summary-grid">
|
||||
<article class="summary-card">
|
||||
<h3>{{ t("admin.shippingOrderProfiles.versionCenter.definitionStats") }}</h3>
|
||||
<dl>
|
||||
<div>
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.tableRegions") }}</dt>
|
||||
<dd>{{ detail.definition_stats?.table_region_count || 0 }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.headerLayouts") }}</dt>
|
||||
<dd>{{ detail.definition_stats?.header_layout_count || 0 }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.lineLayouts") }}</dt>
|
||||
<dd>{{ detail.definition_stats?.line_layout_count || 0 }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.orderFieldLayouts") }}</dt>
|
||||
<dd>{{ detail.definition_stats?.order_field_layout_count || 0 }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<el-descriptions :column="2" size="small" class="summary-list">
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.tableRegions')">
|
||||
{{ detail.definition_stats?.table_region_count || 0 }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.headerLayouts')">
|
||||
{{ detail.definition_stats?.header_layout_count || 0 }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.lineLayouts')">
|
||||
{{ detail.definition_stats?.line_layout_count || 0 }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.orderFieldLayouts')">
|
||||
{{ detail.definition_stats?.order_field_layout_count || 0 }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</article>
|
||||
|
||||
<article v-if="valueSourceIdentity" class="summary-card">
|
||||
<h3>{{ t("admin.shippingOrderProfiles.versionCenter.xfaStructureIdentity") }}</h3>
|
||||
<dl>
|
||||
<div>
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.xfaTemplateChecksum") }}</dt>
|
||||
<dd>{{ valueSourceIdentity.template_packet_checksum || "-" }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.xfaDatasetFingerprint") }}</dt>
|
||||
<dd>{{ valueSourceIdentity.dataset_structure_fingerprint || "-" }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.xfaAuthoritativeCollection") }}</dt>
|
||||
<dd>{{ valueSourceIdentity.has_authoritative_collection ? t("common.yes") : t("common.no") }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.mirrorCollections") }}</dt>
|
||||
<dd>{{ valueSourceIdentity.mirror_collection_count ?? 0 }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<el-descriptions :column="2" size="small" class="summary-list">
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.xfaTemplateChecksum')">
|
||||
{{ valueSourceIdentity.template_packet_checksum || "-" }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.xfaDatasetFingerprint')">
|
||||
{{ valueSourceIdentity.dataset_structure_fingerprint || "-" }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.xfaAuthoritativeCollection')">
|
||||
{{ valueSourceIdentity.has_authoritative_collection ? t("common.yes") : t("common.no") }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.mirrorCollections')">
|
||||
{{ valueSourceIdentity.mirror_collection_count ?? 0 }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</article>
|
||||
|
||||
<article class="summary-card">
|
||||
<h3>{{ t("admin.shippingOrderProfiles.versionCenter.frozenEvidenceTitle") }}</h3>
|
||||
<dl>
|
||||
<div>
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.statusLabel") }}</dt>
|
||||
<dd>{{ frozenEvidenceLabel }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.blindTestSuiteSampleCount") }}</dt>
|
||||
<dd>{{ detail.frozen_evidence?.sample_count || 0 }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.frozenSampleCount") }}</dt>
|
||||
<dd>{{ detail.frozen_evidence?.frozen_sample_count || 0 }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.auditReady") }}</dt>
|
||||
<dd>{{ detail.frozen_evidence?.audit_ready ? t("common.yes") : t("common.no") }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<el-descriptions :column="2" size="small" class="summary-list">
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.statusLabel')">
|
||||
{{ frozenEvidenceLabel }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.blindTestSuiteSampleCount')">
|
||||
{{ detail.frozen_evidence?.sample_count || 0 }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.frozenSampleCount')">
|
||||
{{ detail.frozen_evidence?.frozen_sample_count || 0 }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.auditReady')">
|
||||
{{ detail.frozen_evidence?.audit_ready ? t("common.yes") : t("common.no") }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</article>
|
||||
|
||||
<article class="summary-card">
|
||||
<h3>{{ t("admin.shippingOrderProfiles.versionCenter.sampleSummaryTitle") }}</h3>
|
||||
<dl>
|
||||
<div>
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.annotationCount") }}</dt>
|
||||
<dd>{{ detail.sample_summary?.annotation_count || 0 }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.trainingCount") }}</dt>
|
||||
<dd>{{ detail.sample_summary?.training_count || 0 }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.boundBlindTestCount") }}</dt>
|
||||
<dd>{{ detail.sample_summary?.blind_test_count || 0 }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.firstSample") }}</dt>
|
||||
<dd>{{ detail.sample_summary?.samples?.[0]?.source_filename_snapshot || "-" }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<el-descriptions :column="2" size="small" class="summary-list">
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.annotationCount')">
|
||||
{{ detail.sample_summary?.annotation_count || 0 }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.trainingCount')">
|
||||
{{ detail.sample_summary?.training_count || 0 }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.boundBlindTestCount')">
|
||||
{{ detail.sample_summary?.blind_test_count || 0 }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.firstSample')">
|
||||
{{ detail.sample_summary?.samples?.[0]?.source_filename_snapshot || "-" }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</article>
|
||||
|
||||
<article class="summary-card">
|
||||
<h3>{{ t("admin.shippingOrderProfiles.versionCenter.testSummaryTitle") }}</h3>
|
||||
<dl>
|
||||
<div>
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.statusLabel") }}</dt>
|
||||
<dd>{{ testStatusLabel }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.sampleCountPlain") }}</dt>
|
||||
<dd>{{ detail.test_summary?.sample_count || 0 }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.approvedAt") }}</dt>
|
||||
<dd>{{ formatDateTime(detail.test_summary?.approved_at) }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.latestRun") }}</dt>
|
||||
<dd>{{ detail.test_summary?.latest_run?.status || "-" }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<el-descriptions :column="2" size="small" class="summary-list">
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.statusLabel')">
|
||||
{{ testStatusLabel }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.sampleCountPlain')">
|
||||
{{ detail.test_summary?.sample_count || 0 }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.approvedAt')">
|
||||
{{ formatDateTime(detail.test_summary?.approved_at) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.latestRun')">
|
||||
{{ detail.test_summary?.latest_run?.status || "-" }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
@@ -189,27 +181,24 @@ const testStatusLabel = computed(() => {
|
||||
<p v-else>{{ t("admin.shippingOrderProfiles.versionCenter.noSourceVersion") }}</p>
|
||||
</article>
|
||||
|
||||
<details class="technical-details">
|
||||
<summary>{{ t("admin.shippingOrderProfiles.versionCenter.technicalDetails") }}</summary>
|
||||
<dl class="technical-grid">
|
||||
<div>
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.publishedAt") }}</dt>
|
||||
<dd>{{ formatDateTime(detail.published_at) }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.retiredAt") }}</dt>
|
||||
<dd>{{ formatDateTime(detail.retired_at) }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.checksum") }}</dt>
|
||||
<dd><code>{{ detail.checksum || "-" }}</code></dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t("admin.shippingOrderProfiles.versionCenter.schemaChecksum") }}</dt>
|
||||
<dd><code>{{ detail.schema_summary?.checksum || "-" }}</code></dd>
|
||||
</div>
|
||||
</dl>
|
||||
</details>
|
||||
<el-collapse class="technical-details">
|
||||
<el-collapse-item :title="t('admin.shippingOrderProfiles.versionCenter.technicalDetails')" name="technical">
|
||||
<el-descriptions :column="2" size="small" class="technical-grid">
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.publishedAt')">
|
||||
{{ formatDateTime(detail.published_at) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.retiredAt')">
|
||||
{{ formatDateTime(detail.retired_at) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.checksum')">
|
||||
<code>{{ detail.checksum || "-" }}</code>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.versionCenter.schemaChecksum')">
|
||||
<code>{{ detail.schema_summary?.checksum || "-" }}</code>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
@@ -221,9 +210,9 @@ const testStatusLabel = computed(() => {
|
||||
|
||||
.hero-card,
|
||||
.summary-card {
|
||||
border: 1px solid var(--border-default);
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: 0.9rem;
|
||||
background: var(--bg-surface);
|
||||
background: var(--el-bg-color);
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
@@ -236,8 +225,8 @@ const testStatusLabel = computed(() => {
|
||||
|
||||
.eyebrow {
|
||||
margin: 0 0 0.35rem;
|
||||
color: var(--text-muted);
|
||||
font-size: 0.75rem;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
@@ -245,19 +234,19 @@ const testStatusLabel = computed(() => {
|
||||
.hero-card h2,
|
||||
.summary-card h3 {
|
||||
margin: 0;
|
||||
color: var(--text-primary);
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.profile-identity,
|
||||
.change-note {
|
||||
margin: 0.65rem 0 0;
|
||||
color: var(--text-secondary);
|
||||
color: var(--el-text-color-regular);
|
||||
}
|
||||
|
||||
.profile-identity { font-size: 0.875rem; }
|
||||
|
||||
.change-note {
|
||||
border-left: 3px solid var(--border-default);
|
||||
border-left: 3px solid var(--el-border-color);
|
||||
padding-left: 0.75rem;
|
||||
}
|
||||
|
||||
@@ -268,44 +257,19 @@ const testStatusLabel = computed(() => {
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.meta-chip {
|
||||
border-radius: 999px;
|
||||
background: var(--bg-surface-soft);
|
||||
color: var(--text-secondary);
|
||||
padding: 0.35rem 0.65rem;
|
||||
font-size: 0.75rem;
|
||||
.summary-list {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.meta-chip--status {
|
||||
background: var(--status-success-bg);
|
||||
color: var(--status-success-fg);
|
||||
.summary-list :deep(.el-descriptions__label),
|
||||
.technical-grid :deep(.el-descriptions__label) {
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.meta-chip--draft {
|
||||
background: var(--status-warning-bg);
|
||||
color: var(--status-warning-fg);
|
||||
}
|
||||
|
||||
.meta-chip--retired {
|
||||
background: var(--status-error-bg);
|
||||
color: var(--status-error-fg);
|
||||
}
|
||||
|
||||
.summary-card dl {
|
||||
display: grid;
|
||||
gap: 0.75rem;
|
||||
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
||||
margin: 1rem 0 0;
|
||||
}
|
||||
|
||||
.summary-card dt {
|
||||
color: var(--text-muted);
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.summary-card dd {
|
||||
margin: 0.25rem 0 0;
|
||||
color: var(--text-primary);
|
||||
.summary-list :deep(.el-descriptions__content),
|
||||
.technical-grid :deep(.el-descriptions__content) {
|
||||
color: var(--el-text-color-primary);
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
@@ -317,40 +281,32 @@ const testStatusLabel = computed(() => {
|
||||
|
||||
.source-card p {
|
||||
margin: 0.75rem 0 0;
|
||||
color: var(--text-secondary);
|
||||
color: var(--el-text-color-regular);
|
||||
}
|
||||
|
||||
.technical-details {
|
||||
border-top: 1px solid var(--border-subtle);
|
||||
padding-top: 1rem;
|
||||
border-top: 1px solid var(--el-border-color-lighter);
|
||||
}
|
||||
|
||||
.technical-details summary {
|
||||
cursor: pointer;
|
||||
color: var(--text-secondary);
|
||||
.technical-details :deep(.el-collapse-item__header) {
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 0.875rem;
|
||||
font-weight: 600;
|
||||
background: transparent;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.technical-details :deep(.el-collapse-item__wrap) {
|
||||
background: transparent;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.technical-grid {
|
||||
display: grid;
|
||||
gap: 0.75rem;
|
||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
margin: 0.85rem 0 0;
|
||||
margin-top: 0.35rem;
|
||||
}
|
||||
|
||||
.technical-grid dt {
|
||||
color: var(--text-muted);
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
|
||||
.technical-grid dd {
|
||||
margin: 0.25rem 0 0;
|
||||
color: var(--text-secondary);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.technical-grid code {
|
||||
font-size: 0.75rem;
|
||||
.technical-grid :deep(code) {
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
+56
-42
@@ -1,13 +1,22 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/components/XfaCollectionSelector.vue
|
||||
用途:权威明细集合与镜像对账集合选择。
|
||||
依赖:vue-i18n、XfaCollectionCandidate。
|
||||
依赖:element-plus(el-checkbox / el-collapse / el-tag,沿用管理端 element-trial 主题)、
|
||||
vue-i18n、XfaCollectionCandidate。
|
||||
逻辑:以候选卡片直接展示完整路径、字段覆盖与样本证据;权威单选强制,镜像多选仅用于对账;
|
||||
selectable=false 的无效集合禁选;全部候选被排除时仍展示排除原因。
|
||||
EP 迁移:镜像多选原生 checkbox 迁移为 el-checkbox(toggleMirror 契约不变);推荐/已选角色徽标
|
||||
迁移为 el-tag(info);「排除集合」原生 details 迁移为 el-collapse(全排除时默认展开);
|
||||
权威单选保留原生 radio 卡片(整卡点击选择语义,不在本次控件替换范围);
|
||||
颜色统一 --el-* token;业务逻辑零改动。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElCheckbox, ElCollapse, ElCollapseItem, ElTag } from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import type { XfaCollectionCandidate } from '@/features/admin/types/shipping-order-document-profile.types';
|
||||
import { listMirrorCollectionCandidates } from '../xfaProfileMapping.utils';
|
||||
|
||||
@@ -91,9 +100,9 @@ function reasonLabels(reasons?: string[]): string {
|
||||
<span class="candidate-body">
|
||||
<span class="candidate-title">
|
||||
<strong>{{ item.path_label || item.local_name }}</strong>
|
||||
<span v-if="item.recommended_role === 'authoritative'" class="role-badge">
|
||||
<el-tag v-if="item.recommended_role === 'authoritative'" size="small" type="info" effect="plain">
|
||||
{{ t('admin.shippingOrderProfiles.xfaWorkbench.recommendedAuthoritative') }}
|
||||
</span>
|
||||
</el-tag>
|
||||
<span>{{ t('admin.shippingOrderProfiles.xfaWorkbench.rowCount', { count: item.row_count }) }}</span>
|
||||
</span>
|
||||
<small>{{ t('admin.shippingOrderProfiles.xfaWorkbench.nonEmptyCoverage', {
|
||||
@@ -115,7 +124,7 @@ function reasonLabels(reasons?: string[]): string {
|
||||
<header>
|
||||
<div>
|
||||
<strong>{{ selectedAuthoritative.path_label || selectedAuthoritative.local_name }}</strong>
|
||||
<span class="role-badge">{{ t('admin.shippingOrderProfiles.xfaWorkbench.selectedAuthoritative') }}</span>
|
||||
<el-tag size="small" type="info">{{ t('admin.shippingOrderProfiles.xfaWorkbench.selectedAuthoritative') }}</el-tag>
|
||||
</div>
|
||||
<span>{{ t('admin.shippingOrderProfiles.xfaWorkbench.rowCount', { count: selectedAuthoritative.row_count }) }}</span>
|
||||
</header>
|
||||
@@ -134,12 +143,13 @@ function reasonLabels(reasons?: string[]): string {
|
||||
|
||||
<fieldset v-if="mirrors.length" class="mirror-fieldset">
|
||||
<legend>{{ t('admin.shippingOrderProfiles.xfaWorkbench.mirrorCollections') }}</legend>
|
||||
<label v-for="item in mirrors" :key="item.path_id" class="mirror">
|
||||
<input
|
||||
type="checkbox"
|
||||
:checked="mirrorPathIds.includes(item.path_id)"
|
||||
@change="toggleMirror(item.path_id, ($event.target as HTMLInputElement).checked)"
|
||||
/>
|
||||
<el-checkbox
|
||||
v-for="item in mirrors"
|
||||
:key="item.path_id"
|
||||
class="mirror"
|
||||
:model-value="mirrorPathIds.includes(item.path_id)"
|
||||
@change="(checked) => toggleMirror(item.path_id, Boolean(checked))"
|
||||
>
|
||||
<span class="mirror-copy">
|
||||
<strong>{{ item.path_label || item.local_name }}</strong>
|
||||
<small>{{ t('admin.shippingOrderProfiles.xfaWorkbench.nonEmptyCoverage', {
|
||||
@@ -149,50 +159,54 @@ function reasonLabels(reasons?: string[]): string {
|
||||
}) }}</small>
|
||||
<span>{{ (item.sample_fields || []).map((field) => `${field.field_name} ${field.display_value}`).join(' · ') }}</span>
|
||||
</span>
|
||||
</label>
|
||||
</el-checkbox>
|
||||
</fieldset>
|
||||
|
||||
<details v-if="excludedCandidates?.length" class="excluded" :open="hasExcludedOnly">
|
||||
<summary>{{ t('admin.shippingOrderProfiles.xfaWorkbench.excludedCollections', { count: excludedCandidates.length }) }}</summary>
|
||||
<ul>
|
||||
<li v-for="item in excludedCandidates" :key="item.path_id">
|
||||
<span>{{ item.path_label || item.local_name }}</span>
|
||||
<small>{{ reasonLabels(item.exclusion_reasons || item.recommendation_reasons) || t('admin.shippingOrderProfiles.xfaWorkbench.emptyStructureReason') }}</small>
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
<el-collapse
|
||||
v-if="excludedCandidates?.length"
|
||||
class="excluded"
|
||||
:model-value="hasExcludedOnly ? ['excluded'] : []"
|
||||
>
|
||||
<el-collapse-item :name="'excluded'" :title="t('admin.shippingOrderProfiles.xfaWorkbench.excludedCollections', { count: excludedCandidates.length })">
|
||||
<ul>
|
||||
<li v-for="item in excludedCandidates" :key="item.path_id">
|
||||
<span>{{ item.path_label || item.local_name }}</span>
|
||||
<small>{{ reasonLabels(item.exclusion_reasons || item.recommendation_reasons) || t('admin.shippingOrderProfiles.xfaWorkbench.emptyStructureReason') }}</small>
|
||||
</li>
|
||||
</ul>
|
||||
</el-collapse-item>
|
||||
</el-collapse>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.xfa-collections { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(320px, 1fr); gap: 12px 16px; align-items: start; width: 100%; }
|
||||
.collection-heading { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 3px; color: var(--text-primary); }
|
||||
.collection-heading span { color: var(--text-muted); font-size: .82rem; }
|
||||
.empty-selectable { grid-column: 1 / -1; margin: 0; padding: 10px 12px; border: 1px solid var(--status-warning-border); border-radius: var(--radius-control); background: var(--status-warning-bg); color: var(--status-warning-fg); }
|
||||
.collection-heading { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 3px; color: var(--el-text-color-primary); }
|
||||
.collection-heading span { color: var(--el-text-color-secondary); font-size: .82rem; }
|
||||
.empty-selectable { grid-column: 1 / -1; margin: 0; padding: 10px 12px; border: 1px solid var(--el-color-warning-light-5); border-radius: var(--el-border-radius-base); background: var(--el-color-warning-light-9); color: var(--el-color-warning); }
|
||||
.auth-cards { grid-column: 1 / -1; display: grid; gap: 10px; margin: 0; padding: 0; border: 0; }
|
||||
.auth-cards[aria-invalid='true'] .candidate-card { border-color: var(--status-error-border); }
|
||||
.candidate-card { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border-default); border-radius: var(--radius-control); background: var(--bg-surface); cursor: pointer; }
|
||||
.candidate-card.selected, .candidate-card.recommended.selected { border-color: var(--status-info-border); background: var(--status-info-bg); }
|
||||
.candidate-body { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 4px; color: var(--text-secondary); }
|
||||
.candidate-title { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--text-primary); }
|
||||
.role-badge { color: var(--status-info-fg); font-size: .75rem; }
|
||||
.fields, .samples { color: var(--text-muted); font-size: .78rem; }
|
||||
.auth-cards[aria-invalid='true'] .candidate-card { border-color: var(--el-color-danger); }
|
||||
.candidate-card { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--el-border-color-lighter); border-radius: var(--el-border-radius-base); background: var(--el-bg-color); cursor: pointer; }
|
||||
.candidate-card.selected, .candidate-card.recommended.selected { border-color: var(--el-color-primary-light-5); background: var(--el-color-primary-light-9); }
|
||||
.candidate-body { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 4px; color: var(--el-text-color-regular); }
|
||||
.candidate-title { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--el-text-color-primary); }
|
||||
.fields, .samples { color: var(--el-text-color-secondary); font-size: .78rem; }
|
||||
.samples { display: flex; flex-wrap: wrap; gap: 6px 12px; }
|
||||
.samples b { color: var(--text-primary); }
|
||||
.collection-card, .mirror-fieldset, .excluded { border: 1px solid var(--border-default); border-radius: var(--radius-control); padding: 12px; background: var(--bg-surface); }
|
||||
.collection-card.authoritative { border-color: var(--status-info-border); background: var(--status-info-bg); }
|
||||
.collection-card header { display: flex; justify-content: space-between; gap: 12px; color: var(--text-primary); }
|
||||
.samples b { color: var(--el-text-color-primary); }
|
||||
.collection-card, .mirror-fieldset, .excluded { border: 1px solid var(--el-border-color-lighter); border-radius: var(--el-border-radius-base); padding: 12px; background: var(--el-bg-color); }
|
||||
.collection-card.authoritative { border-color: var(--el-color-primary-light-5); background: var(--el-color-primary-light-9); }
|
||||
.collection-card header { display: flex; justify-content: space-between; gap: 12px; color: var(--el-text-color-primary); }
|
||||
.collection-card header div { display: flex; align-items: center; gap: 8px; }
|
||||
.collection-card p, .collection-card small { color: var(--text-muted); }
|
||||
.sample-grid { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 8px 0; color: var(--text-secondary); font-size: .82rem; }
|
||||
.sample-grid b { color: var(--text-primary); }
|
||||
.collection-card p, .collection-card small { color: var(--el-text-color-secondary); }
|
||||
.sample-grid { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 8px 0; color: var(--el-text-color-regular); font-size: .82rem; }
|
||||
.sample-grid b { color: var(--el-text-color-primary); }
|
||||
.mirror-fieldset { grid-column: 1 / -1; }
|
||||
.mirror { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; }
|
||||
.mirror-copy { display: flex; flex-direction: column; gap: 2px; color: var(--text-secondary); }
|
||||
.mirror-copy small, .mirror-copy span { color: var(--text-muted); font-size: .78rem; }
|
||||
.excluded { grid-column: 1 / -1; color: var(--text-secondary); }
|
||||
.mirror { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; width: 100%; }
|
||||
.mirror-copy { display: flex; flex-direction: column; gap: 2px; color: var(--el-text-color-regular); }
|
||||
.mirror-copy small, .mirror-copy span { color: var(--el-text-color-secondary); font-size: .78rem; }
|
||||
.excluded { grid-column: 1 / -1; color: var(--el-text-color-regular); }
|
||||
.excluded ul { margin: 8px 0 0; padding-left: 18px; }
|
||||
.excluded li { display: flex; flex-wrap: wrap; gap: 10px; }
|
||||
.excluded small { color: var(--status-warning-fg); }
|
||||
.excluded small { color: var(--el-color-warning); }
|
||||
@media (max-width: 900px) { .xfa-collections { grid-template-columns: 1fr; } }
|
||||
</style>
|
||||
+39
-32
@@ -1,14 +1,23 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/components/XfaDatasetTree.vue
|
||||
用途:XFA 受控数据树;主工作台用于绑定导航,高级诊断抽屉内只读展示。
|
||||
依赖:vue-i18n、xfaProfileMapping.utils。
|
||||
依赖:element-plus(el-input / el-empty,@element-plus/icons-vue Plus/Close,沿用管理端
|
||||
element-trial 主题)、vue-i18n、xfaProfileMapping.utils。
|
||||
逻辑:支持展开折叠、方向键导航与完整样本值展示;readonly 时隐藏增删改规则动作;
|
||||
expandSamples 用于弹窗选型场景,放宽样本列宽度并允许换行。
|
||||
EP 迁移:路径搜索迁移为 el-input(clearable);「+」新增规则与「×」删除规则的文字符号迁移为
|
||||
@element-plus/icons-vue 的 Plus / Close(el-icon 包裹,保留原 hover 显示与 24px 热区);
|
||||
树空态迁移为 el-empty;树展开折叠/编辑图标(lucide)与 WAI-ARIA 树键盘导航逻辑零改动。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, ref } from 'vue';
|
||||
import { ChevronDown, ChevronRight, Pencil } from 'lucide-vue-next';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElButton, ElEmpty, ElIcon, ElInput } from 'element-plus';
|
||||
import { Close, Plus } from '@element-plus/icons-vue';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import type { XfaFieldTreeNode } from '@/features/admin/types/shipping-order-document-profile.types';
|
||||
import type { XfaSplitRuleSet } from '@/features/admin/types/shipping-order-document-profile.types';
|
||||
import {
|
||||
@@ -164,7 +173,7 @@ async function onKeydown(event: KeyboardEvent, pathId: string): Promise<void> {
|
||||
>
|
||||
<label class="xfa-tree__search">
|
||||
<span class="sr-only">{{ t('admin.shippingOrderProfiles.xfaWorkbench.searchPaths') }}</span>
|
||||
<input v-model="query" type="search" :placeholder="t('admin.shippingOrderProfiles.xfaWorkbench.searchPaths')" />
|
||||
<el-input v-model="query" :placeholder="t('admin.shippingOrderProfiles.xfaWorkbench.searchPaths')" clearable />
|
||||
</label>
|
||||
<ul class="xfa-tree__list" role="tree">
|
||||
<li v-for="(node, index) in visible" :key="node.pathId" role="none">
|
||||
@@ -199,15 +208,15 @@ async function onKeydown(event: KeyboardEvent, pathId: string): Promise<void> {
|
||||
<span v-if="node.isLeaf && parentPathHint(node)" class="path-hint">{{ parentPathHint(node) }}</span>
|
||||
</span>
|
||||
<span v-if="node.isCollectionCandidate" class="badge">{{ t('admin.shippingOrderProfiles.xfaWorkbench.collectionBadge') }}</span>
|
||||
<button
|
||||
<el-button
|
||||
v-if="node.isLeaf && !isReadonly"
|
||||
type="button"
|
||||
text
|
||||
class="add-rule"
|
||||
:class="{ 'add-rule--active': selectedPathId === node.pathId }"
|
||||
:title="t('admin.shippingOrderProfiles.xfaSplit.addRule')"
|
||||
:aria-label="t('admin.shippingOrderProfiles.xfaSplit.addRule')"
|
||||
@click.stop="emit('add-rule', node.pathId)"
|
||||
>+</button>
|
||||
><el-icon><Plus /></el-icon></el-button>
|
||||
<span v-if="node.sampleValueDisplay" class="sample" :title="node.sampleValueDisplay">
|
||||
{{ node.sampleValueDisplay }}
|
||||
</span>
|
||||
@@ -224,42 +233,41 @@ async function onKeydown(event: KeyboardEvent, pathId: string): Promise<void> {
|
||||
class="xfa-tree__rule"
|
||||
:class="{ selected: selectedRuleId === rule.rule_id }"
|
||||
>
|
||||
<button type="button" class="xfa-tree__rule-main" @click="emit('select-rule', node.pathId, rule.rule_id)">
|
||||
<el-button text class="xfa-tree__rule-main" @click="emit('select-rule', node.pathId, rule.rule_id)">
|
||||
<span class="rule-glyph">↳</span>
|
||||
<span class="rule-label">{{ t('admin.shippingOrderProfiles.xfaSplit.ruleLabel', { index: ruleIndex + 1 }) }} · {{ rule.segment.display_name || rule.segment.segment_code || t('admin.shippingOrderProfiles.xfaSplit.unnamedRule') }}</span>
|
||||
</button>
|
||||
<button
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="!isReadonly"
|
||||
type="button"
|
||||
text
|
||||
class="rule-edit"
|
||||
:title="t('common.edit')"
|
||||
:aria-label="t('common.edit')"
|
||||
@click.stop="emit('edit-rule', node.pathId, rule.rule_id)"
|
||||
><Pencil :size="12" aria-hidden="true" /></button>
|
||||
<button v-if="!isReadonly" type="button" class="rule-delete" :title="t('admin.shippingOrderProfiles.xfaSplit.deleteRule')" @click.stop="emit('delete-rule', node.pathId, rule.rule_id)">×</button>
|
||||
><Pencil :size="12" aria-hidden="true" /></el-button>
|
||||
<el-button v-if="!isReadonly" text class="rule-delete" :title="t('admin.shippingOrderProfiles.xfaSplit.deleteRule')" :aria-label="t('admin.shippingOrderProfiles.xfaSplit.deleteRule')" @click.stop="emit('delete-rule', node.pathId, rule.rule_id)"><el-icon><Close /></el-icon></el-button>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<p v-if="!visible.length" class="xfa-tree__empty">{{ t('admin.shippingOrderProfiles.xfaWorkbench.treeEmpty') }}</p>
|
||||
<el-empty v-if="!visible.length" :description="t('admin.shippingOrderProfiles.xfaWorkbench.treeEmpty')" :image-size="48" />
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.xfa-tree { display: flex; flex-direction: column; min-height: 0; height: 100%; }
|
||||
.xfa-tree__search input { width: 100%; padding: 8px 10px; border: 1px solid var(--border-default); border-radius: var(--radius-control); background: var(--bg-surface); color: var(--text-primary); }
|
||||
.xfa-tree__list { margin: 8px -6px 0 0; padding: 0 6px 0 0; list-style: none; overflow: auto; flex: 1; scrollbar-gutter: stable; }
|
||||
.xfa-tree__node { position: relative; display: flex; width: 100%; min-width: 0; gap: 5px; align-items: center; min-height: 34px; padding-block: 4px; padding-right: 6px; border: 0; border-radius: var(--radius-control); background: transparent; color: var(--text-secondary); text-align: left; cursor: pointer; }
|
||||
.xfa-tree__node::before { content: ''; position: absolute; top: 0; bottom: 0; left: max(13px, calc(var(--tree-guide-offset, 0px))); width: 1px; background: var(--border-default); opacity: .65; pointer-events: none; }
|
||||
.xfa-tree__node { position: relative; display: flex; width: 100%; min-width: 0; gap: 5px; align-items: center; min-height: 34px; padding-block: 4px; padding-right: 6px; border: 0; border-radius: var(--el-border-radius-base); background: transparent; color: var(--el-text-color-regular); text-align: left; cursor: pointer; }
|
||||
.xfa-tree__node::before { content: ''; position: absolute; top: 0; bottom: 0; left: max(13px, calc(var(--tree-guide-offset, 0px))); width: 1px; background: var(--el-border-color-lighter); opacity: .65; pointer-events: none; }
|
||||
.xfa-tree__node[aria-level='1']::before { display: none; }
|
||||
.xfa-tree__node:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
|
||||
.xfa-tree__node.selected { background: var(--status-info-bg); color: var(--status-info-fg); }
|
||||
.xfa-tree__node.mapped .name::after { content: ' ✓'; color: var(--status-success-fg); }
|
||||
.xfa-tree__node:focus-visible { outline: 2px solid var(--el-color-primary); outline-offset: 1px; }
|
||||
.xfa-tree__node.selected { background: var(--el-color-primary-light-9); color: var(--el-color-primary); }
|
||||
.xfa-tree__node.mapped .name::after { content: ' ✓'; color: var(--el-color-success); }
|
||||
.name-block { display: grid; min-width: 0; flex: 1; gap: 0; }
|
||||
.xfa-tree__node:not(.leaf) .name { font-weight: 650; }
|
||||
.xfa-tree__node .name { min-width: 0; overflow: hidden; font-size: .82rem; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.xfa-tree__node .path-hint { min-width: 0; overflow: hidden; color: var(--text-muted); font-size: .64rem; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.xfa-tree__node .sample { min-width: 3.2rem; margin-left: auto; max-width: 30%; overflow: hidden; color: var(--text-muted); font-size: .68rem; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.xfa-tree__node .path-hint { min-width: 0; overflow: hidden; color: var(--el-text-color-secondary); font-size: .64rem; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.xfa-tree__node .sample { min-width: 3.2rem; margin-left: auto; max-width: 30%; overflow: hidden; color: var(--el-text-color-secondary); font-size: .68rem; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.xfa-tree--expand-samples .xfa-tree__node { align-items: flex-start; }
|
||||
.xfa-tree--expand-samples .xfa-tree__node .sample {
|
||||
max-width: 48%;
|
||||
@@ -269,22 +277,21 @@ async function onKeydown(event: KeyboardEvent, pathId: string): Promise<void> {
|
||||
line-height: 1.25;
|
||||
text-align: left;
|
||||
}
|
||||
.xfa-tree__node .badge { color: var(--status-warning-fg); font-size: .72rem; font-weight: 700; }
|
||||
.xfa-tree__node .badge { color: var(--el-color-warning); font-size: .72rem; font-weight: 700; }
|
||||
.toggle, .toggle-spacer { display: inline-flex; width: 16px; flex: 0 0 16px; }
|
||||
.add-rule { display: none; position: relative; z-index: 1; min-width: 24px; min-height: 24px; align-items: center; justify-content: center; margin-left: 2px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--status-info-fg); font-size: 1rem; line-height: 1; cursor: pointer; }
|
||||
.add-rule--active { display: inline-flex; border-color: var(--status-info-border); background: var(--status-info-bg); }
|
||||
.add-rule { display: none; position: relative; z-index: 1; min-width: 24px; min-height: 24px; margin-left: 2px; }
|
||||
.add-rule--active { display: inline-flex; }
|
||||
.xfa-tree__node:hover .add-rule, .xfa-tree__node:focus-within .add-rule { display: inline-flex; }
|
||||
.xfa-tree__rules { position: relative; margin: 0; padding: 1px 0 5px var(--rule-indent); list-style: none; }
|
||||
.xfa-tree__rules::before { content: ''; position: absolute; top: 0; bottom: 8px; left: var(--rule-guide-offset); width: 1px; background: var(--border-default); }
|
||||
.xfa-tree__rules::before { content: ''; position: absolute; top: 0; bottom: 8px; left: var(--rule-guide-offset); width: 1px; background: var(--el-border-color-lighter); }
|
||||
.xfa-tree__rule { display: flex; min-width: 0; align-items: center; gap: 3px; border-radius: 4px; }
|
||||
.xfa-tree__rule.selected { background: var(--status-info-bg); }
|
||||
.xfa-tree__rule-main { display: flex; min-width: 0; flex: 1; gap: 4px; padding: 3px 2px; border: 0; background: transparent; color: var(--text-muted); text-align: left; font-size: .68rem; cursor: pointer; }
|
||||
.xfa-tree__rule.selected { background: var(--el-color-primary-light-9); }
|
||||
.xfa-tree__rule-main { display: flex; min-width: 0; flex: 1; gap: 4px; text-align: left; }
|
||||
.xfa-tree__rule-main > span { padding: 0; }
|
||||
.rule-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.rule-glyph { color: var(--status-info-fg); }
|
||||
.rule-edit, .rule-delete { display: inline-flex; width: 20px; height: 20px; flex: 0 0 20px; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: 4px; background: transparent; cursor: pointer; }
|
||||
.rule-edit { color: var(--status-info-fg); }
|
||||
.rule-delete { color: var(--status-error-fg); font-size: .9rem; }
|
||||
.rule-edit:hover, .rule-delete:hover { background: var(--bg-page); }
|
||||
.xfa-tree__empty { color: var(--text-muted); font-size: .85rem; }
|
||||
.rule-glyph { color: var(--el-color-primary); }
|
||||
.rule-edit, .rule-delete { flex: 0 0 20px; width: 20px; height: 20px; padding: 0; }
|
||||
.rule-delete { color: var(--el-color-danger); }
|
||||
.xfa-tree__empty { color: var(--el-text-color-secondary); font-size: .85rem; }
|
||||
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
|
||||
</style>
|
||||
+46
-33
@@ -1,13 +1,20 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/components/XfaReadOnlyMapping.vue
|
||||
用途:版本详情页统一值源 adapter 的只读证据面板。
|
||||
依赖:vue-i18n、Profile readonly mapping DTO。
|
||||
依赖:element-plus(el-alert / el-descriptions,沿用管理端 element-trial 主题)、vue-i18n、
|
||||
Profile readonly mapping DTO。
|
||||
逻辑:所有模板均挂载该面板;coordinate 没有额外值源证据时展示空态,
|
||||
XFA 才显示 datasets 结构身份、Header/Line 路径映射与集合策略;不请求 PDF 预览页。
|
||||
EP 迁移:结构身份 dl 迁移为 el-descriptions;无 PDF 提示迁移为 el-alert(info)、值源证据缺失
|
||||
迁移为 el-alert(warning);颜色统一 --el-* token;业务逻辑零改动。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElAlert, ElDescriptions, ElDescriptionsItem } from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import type { ShippingOrderDocumentProfile } from '@/features/admin/types/shipping-order-document-profile.types';
|
||||
|
||||
const props = defineProps<{
|
||||
@@ -35,33 +42,40 @@ const lineMaps = computed(() => mapping.value?.line_mappings || []);
|
||||
|
||||
<template>
|
||||
<section class="xfa-readonly" :aria-label="t('admin.shippingOrderProfiles.xfaReadonly.title')">
|
||||
<p v-if="hasValueSourceEvidence" class="hint">{{ t('admin.shippingOrderProfiles.xfaReadonly.noPdfHint') }}</p>
|
||||
<div v-if="!mapping" class="empty">{{ t('admin.shippingOrderProfiles.xfaReadonly.missing') }}</div>
|
||||
<el-alert
|
||||
v-if="hasValueSourceEvidence"
|
||||
:title="t('admin.shippingOrderProfiles.xfaReadonly.noPdfHint')"
|
||||
type="info"
|
||||
:closable="false"
|
||||
class="hint"
|
||||
/>
|
||||
<el-alert
|
||||
v-if="!mapping"
|
||||
:title="t('admin.shippingOrderProfiles.xfaReadonly.missing')"
|
||||
type="warning"
|
||||
:closable="false"
|
||||
class="hint"
|
||||
/>
|
||||
<template v-else>
|
||||
<div class="identity">
|
||||
<h3>{{ t('admin.shippingOrderProfiles.xfaReadonly.identityTitle') }}</h3>
|
||||
<dl>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingOrderProfiles.xfaReadonly.templateChecksum') }}</dt>
|
||||
<dd>{{ source.template_packet_checksum || '-' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingOrderProfiles.xfaReadonly.structureFingerprint') }}</dt>
|
||||
<dd>{{ source.dataset_structure_fingerprint || '-' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingOrderProfiles.xfaReadonly.authoritativeCollection') }}</dt>
|
||||
<dd>{{ source.authoritative_line_collection_path || '-' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingOrderProfiles.xfaReadonly.mirrorCollections') }}</dt>
|
||||
<dd>{{ (source.mirror_collection_paths as string[] | undefined)?.join(', ') || '-' }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingOrderProfiles.xfaReadonly.signatureChecksum') }}</dt>
|
||||
<dd>{{ mapping.matching_signature_checksum || '-' }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<el-descriptions :column="1" size="small" class="identity-grid">
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.xfaReadonly.templateChecksum')">
|
||||
{{ source.template_packet_checksum || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.xfaReadonly.structureFingerprint')">
|
||||
{{ source.dataset_structure_fingerprint || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.xfaReadonly.authoritativeCollection')">
|
||||
{{ source.authoritative_line_collection_path || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.xfaReadonly.mirrorCollections')">
|
||||
{{ (source.mirror_collection_paths as string[] | undefined)?.join(', ') || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderProfiles.xfaReadonly.signatureChecksum')">
|
||||
{{ mapping.matching_signature_checksum || '-' }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</div>
|
||||
<div class="maps">
|
||||
<div>
|
||||
@@ -86,14 +100,13 @@ const lineMaps = computed(() => mapping.value?.line_mappings || []);
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.xfa-readonly { border: 1px solid #dfe7ef; border-radius: 10px; background: #fff; padding: 16px; }
|
||||
.hint { margin: 0 0 12px; color: #64748b; font-size: 13px; }
|
||||
.identity dl { display: grid; gap: 8px; margin: 8px 0 0; }
|
||||
.identity dt { color: #64748b; font-size: 12px; }
|
||||
.identity dd { margin: 2px 0 0; overflow-wrap: anywhere; font-size: 13px; }
|
||||
.xfa-readonly { border: 1px solid var(--el-border-color-lighter); border-radius: 10px; background: var(--el-bg-color); padding: 16px; }
|
||||
.hint { margin: 0 0 12px; }
|
||||
.identity-grid { margin-top: 8px; }
|
||||
.identity-grid :deep(.el-descriptions__label) { color: var(--el-text-color-secondary); font-size: 12px; }
|
||||
.identity-grid :deep(.el-descriptions__content) { overflow-wrap: anywhere; font-size: 13px; }
|
||||
.maps { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
|
||||
.maps h3, .identity h3 { margin: 0; font-size: 14px; color: #1e293b; }
|
||||
.maps ul { margin: 8px 0 0; padding-left: 18px; color: #334155; font-size: 13px; }
|
||||
.empty { color: #b45309; }
|
||||
.maps h3, .identity h3 { margin: 0; font-size: 14px; color: var(--el-text-color-primary); }
|
||||
.maps ul { margin: 8px 0 0; padding-left: 18px; color: var(--el-text-color-regular); font-size: 13px; }
|
||||
@media (max-width: 767px) { .maps { grid-template-columns: 1fr; } }
|
||||
</style>
|
||||
+223
-205
@@ -1,16 +1,28 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-document-profiles/components/XfaSplitRulePanel.vue
|
||||
用途:XFA 字段拆分规则编辑——matcher 优先(prefix/regex/position),兼容历史 stages[] 投影。
|
||||
依赖:shipping-order-document-profile API、vue-i18n、Schema 字段列表。
|
||||
依赖:element-plus(el-button / el-input / el-select / el-option / el-checkbox / el-alert /
|
||||
el-empty / ElMessageBox,沿用管理端 element-trial 主题)、shipping-order-document-profile
|
||||
API、vue-i18n、Schema 字段列表。
|
||||
逻辑:编辑 definition.split_rules;新增/改提取方式同步写入 matcher;stages 仅保留编辑态;
|
||||
预览和确认统一投影为正式 matcher DTO,确认前须校验同一正式 DTO 哈希;
|
||||
连续多行提取投影为 position.line_end + join_with,引擎合并多行文本;
|
||||
预览优先 reveal 完整分段值(与映射台侧栏/数据源弹窗一致),权限不足再回退脱敏;
|
||||
确认门禁仅阻断真正影响取值可信度的诊断(与后端 informational 白名单对齐)。
|
||||
EP 迁移(定向):确认弹窗 window.confirm 迁移为 ElMessageBox.confirm(confirmRules 因等待用户
|
||||
确认改为 async,取消即 reject 返回;确认后逻辑语句顺序不变);规则工具栏/阶段工具栏按钮
|
||||
迁移为 el-button(删除=danger,高级折叠=link);segment/提取/阶段输入迁移为 el-input 与
|
||||
el-select/el-checkbox(事件经内联适配保持原 handler 契约,data-testid 保留);
|
||||
未保存确认横幅迁移为 el-alert(warning)、未选叶子空态迁移为 el-empty;
|
||||
其余规则计算/预览/确认门禁业务逻辑零改动。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElAlert, ElButton, ElCheckbox, ElEmpty, ElInput, ElMessageBox, ElOption, ElSelect } from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { createRandomUuid } from '@/shared/utils/id';
|
||||
@@ -382,8 +394,9 @@ async function runPreview(): Promise<void> {
|
||||
* 管理员确认规则:须已预览当前 rule_set;阻断性诊断或 needs_review 时阻断。
|
||||
* 核心逻辑:确认事件携带完整规则数组与 preview_token,由父页面保存时交服务端校验;
|
||||
* line_match_candidates 与未匹配行(evidence_only)不视为阻断。
|
||||
* EP 迁移:window.confirm 换为 ElMessageBox.confirm,取消即返回;其余语句顺序不变。
|
||||
*/
|
||||
function confirmRules(): void {
|
||||
async function confirmRules(): Promise<void> {
|
||||
if (!activeRuleSet.value || isReadonly.value) return;
|
||||
if (activeRuleSet.value.rules.some((rule) => (
|
||||
rule.segment.handling === 'mapped'
|
||||
@@ -409,7 +422,19 @@ function confirmRules(): void {
|
||||
segments: segmentCount,
|
||||
diagnostics: diagCount,
|
||||
});
|
||||
if (!window.confirm(summary)) return;
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
summary,
|
||||
t('admin.shippingOrderProfiles.xfaSplit.confirm'),
|
||||
{
|
||||
type: 'warning',
|
||||
confirmButtonText: t('common.deleteDialog.confirm'),
|
||||
cancelButtonText: t('common.deleteDialog.cancel'),
|
||||
},
|
||||
);
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
const confirmedRuleSet = {
|
||||
...(toFormalRuleSet(activeRuleSet.value) || {}),
|
||||
source: 'user',
|
||||
@@ -887,13 +912,20 @@ watch(activeRuleSet, (current, previous) => {
|
||||
class="xfa-split"
|
||||
:aria-label="t('admin.shippingOrderProfiles.xfaSplit.title')"
|
||||
>
|
||||
<div v-if="showUnsavedConfirmBanner" class="xfa-split__banner" role="status">
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.unsavedAfterConfirm') }}
|
||||
</div>
|
||||
<el-alert
|
||||
v-if="showUnsavedConfirmBanner"
|
||||
class="xfa-split__banner"
|
||||
:title="t('admin.shippingOrderProfiles.xfaSplit.unsavedAfterConfirm')"
|
||||
type="warning"
|
||||
:closable="false"
|
||||
role="status"
|
||||
/>
|
||||
|
||||
<div v-if="!selectedPathId" class="xfa-split__empty">
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.selectLeafHint') }}
|
||||
</div>
|
||||
<el-empty
|
||||
v-if="!selectedPathId"
|
||||
:description="t('admin.shippingOrderProfiles.xfaSplit.selectLeafHint')"
|
||||
:image-size="60"
|
||||
/>
|
||||
<div v-else class="xfa-split__body">
|
||||
<p v-if="!activeRuleSet" class="hint">{{ t('admin.shippingOrderProfiles.xfaSplit.noRules') }}</p>
|
||||
|
||||
@@ -902,43 +934,39 @@ watch(activeRuleSet, (current, previous) => {
|
||||
<legend>{{ t('admin.shippingOrderProfiles.xfaSplit.ruleSetSettings') }}</legend>
|
||||
<label class="xfa-split__policy">
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.unmatchedPolicy') }}
|
||||
<select
|
||||
<el-select
|
||||
:disabled="isReadonly"
|
||||
:value="activeRuleSet.unmatched_line_policy || 'evidence_only'"
|
||||
@change="updateUnmatchedPolicy(($event.target as HTMLSelectElement).value as 'evidence_only' | 'needs_review')"
|
||||
:model-value="activeRuleSet.unmatched_line_policy || 'evidence_only'"
|
||||
@update:model-value="(value) => updateUnmatchedPolicy(value as 'evidence_only' | 'needs_review')"
|
||||
>
|
||||
<option value="evidence_only">{{ t('admin.shippingOrderProfiles.xfaSplit.evidenceOnly') }}</option>
|
||||
<option value="needs_review">{{ t('admin.shippingOrderProfiles.xfaSplit.needsReview') }}</option>
|
||||
</select>
|
||||
<el-option value="evidence_only" :label="t('admin.shippingOrderProfiles.xfaSplit.evidenceOnly')" />
|
||||
<el-option value="needs_review" :label="t('admin.shippingOrderProfiles.xfaSplit.needsReview')" />
|
||||
</el-select>
|
||||
</label>
|
||||
|
||||
<div class="xfa-split__normalization">
|
||||
<span>{{ t('admin.shippingOrderProfiles.xfaSplit.normalization') }}</span>
|
||||
<label class="xfa-split__checkbox">
|
||||
<input
|
||||
type="checkbox"
|
||||
:disabled="isReadonly"
|
||||
:checked="activeRuleSet.normalization?.trim ?? true"
|
||||
@change="updateNormalization({ trim: ($event.target as HTMLInputElement).checked })"
|
||||
/>
|
||||
<el-checkbox
|
||||
:disabled="isReadonly"
|
||||
:model-value="activeRuleSet.normalization?.trim ?? true"
|
||||
@change="(checked) => updateNormalization({ trim: Boolean(checked) })"
|
||||
>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.stageTrim') }}
|
||||
</label>
|
||||
<label class="xfa-split__checkbox">
|
||||
<input
|
||||
type="checkbox"
|
||||
:disabled="isReadonly"
|
||||
:checked="activeRuleSet.normalization?.remove_empty_lines ?? true"
|
||||
@change="updateNormalization({ remove_empty_lines: ($event.target as HTMLInputElement).checked })"
|
||||
/>
|
||||
</el-checkbox>
|
||||
<el-checkbox
|
||||
:disabled="isReadonly"
|
||||
:model-value="activeRuleSet.normalization?.remove_empty_lines ?? true"
|
||||
@change="(checked) => updateNormalization({ remove_empty_lines: Boolean(checked) })"
|
||||
>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.stageRemoveEmptyLines') }}
|
||||
</label>
|
||||
</el-checkbox>
|
||||
<label>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.lineBreaks') }}
|
||||
<input
|
||||
<el-input
|
||||
:disabled="isReadonly"
|
||||
:value="lineBreaksToDisplay(activeRuleSet.normalization?.line_breaks)"
|
||||
:model-value="lineBreaksToDisplay(activeRuleSet.normalization?.line_breaks)"
|
||||
:placeholder="t('admin.shippingOrderProfiles.xfaSplit.lineBreaksPlaceholder')"
|
||||
@change="updateNormalization({ line_breaks: parseLineBreaks(($event.target as HTMLInputElement).value) })"
|
||||
@change="(value) => updateNormalization({ line_breaks: parseLineBreaks(String(value)) })"
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
@@ -995,30 +1023,30 @@ watch(activeRuleSet, (current, previous) => {
|
||||
<span class="rule-summary">{{ rule.segment.display_name || rule.segment.segment_code || t('admin.shippingOrderProfiles.xfaSplit.unnamedRule') }}</span>
|
||||
</button>
|
||||
<div class="xfa-split__rule-actions">
|
||||
<button type="button" :disabled="isReadonly || index === 0" @click="moveRule(rule.rule_id, -1)">
|
||||
<el-button size="small" :disabled="isReadonly || index === 0" @click="moveRule(rule.rule_id, -1)">
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.moveUp') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
:disabled="isReadonly || index === sortedRules.length - 1"
|
||||
@click="moveRule(rule.rule_id, 1)"
|
||||
>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.moveDown') }}
|
||||
</button>
|
||||
<button type="button" class="danger" :disabled="isReadonly" @click="deleteRule(rule.rule_id)">
|
||||
</el-button>
|
||||
<el-button size="small" type="danger" plain :disabled="isReadonly" @click="deleteRule(rule.rule_id)">
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.deleteRule') }}
|
||||
</button>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="!collapsedRules.has(rule.rule_id)" class="xfa-split__rule-detail">
|
||||
<label>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.segmentCode') }}
|
||||
<input
|
||||
<el-input
|
||||
:disabled="isReadonly"
|
||||
:value="rule.segment.segment_code"
|
||||
:model-value="rule.segment.segment_code"
|
||||
:class="{ 'xfa-split__invalid': segmentCodeHint(rule.segment.segment_code) }"
|
||||
@input="updateRule(rule.rule_id, { segment: { segment_code: ($event.target as HTMLInputElement).value } })"
|
||||
@input="(value) => updateRule(rule.rule_id, { segment: { segment_code: String(value) } })"
|
||||
/>
|
||||
<small v-if="segmentCodeHint(rule.segment.segment_code)" class="xfa-split__hint-error">
|
||||
{{ segmentCodeHint(rule.segment.segment_code) }}
|
||||
@@ -1026,11 +1054,11 @@ watch(activeRuleSet, (current, previous) => {
|
||||
</label>
|
||||
<label>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.displayName') }}
|
||||
<input
|
||||
<el-input
|
||||
:disabled="isReadonly"
|
||||
:value="rule.segment.display_name"
|
||||
:model-value="rule.segment.display_name"
|
||||
:class="{ 'xfa-split__invalid': displayNameHint(rule.segment.display_name) }"
|
||||
@input="updateRule(rule.rule_id, { segment: { display_name: ($event.target as HTMLInputElement).value } })"
|
||||
@input="(value) => updateRule(rule.rule_id, { segment: { display_name: String(value) } })"
|
||||
/>
|
||||
<small v-if="displayNameHint(rule.segment.display_name)" class="xfa-split__hint-error">
|
||||
{{ displayNameHint(rule.segment.display_name) }}
|
||||
@@ -1038,38 +1066,36 @@ watch(activeRuleSet, (current, previous) => {
|
||||
</label>
|
||||
<label>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.note') }}
|
||||
<input
|
||||
<el-input
|
||||
:disabled="isReadonly"
|
||||
:value="rule.segment.note || ''"
|
||||
@input="updateRule(rule.rule_id, { segment: { note: ($event.target as HTMLInputElement).value || null } })"
|
||||
:model-value="rule.segment.note || ''"
|
||||
@input="(value) => updateRule(rule.rule_id, { segment: { note: (String(value) || null) } })"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.handling') }}
|
||||
<select
|
||||
<el-select
|
||||
data-testid="xfa-split-handling"
|
||||
:disabled="isReadonly"
|
||||
:value="rule.segment.handling"
|
||||
@change="updateSegmentHandling(rule.rule_id, ($event.target as HTMLSelectElement).value as XfaSplitSegment['handling'])"
|
||||
:model-value="rule.segment.handling"
|
||||
@update:model-value="(value) => updateSegmentHandling(rule.rule_id, value as XfaSplitSegment['handling'])"
|
||||
>
|
||||
<option value="evidence_only">{{ t('admin.shippingOrderProfiles.xfaSplit.evidenceOnly') }}</option>
|
||||
<option value="mapped">{{ t('admin.shippingOrderProfiles.xfaSplit.mapped') }}</option>
|
||||
</select>
|
||||
<el-option value="evidence_only" :label="t('admin.shippingOrderProfiles.xfaSplit.evidenceOnly')" />
|
||||
<el-option value="mapped" :label="t('admin.shippingOrderProfiles.xfaSplit.mapped')" />
|
||||
</el-select>
|
||||
</label>
|
||||
<label v-if="rule.segment.handling === 'mapped'">
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.targetField') }}
|
||||
<select
|
||||
<el-select
|
||||
data-testid="xfa-split-target-field"
|
||||
:disabled="isReadonly"
|
||||
:value="rule.segment.target_field_id || ''"
|
||||
:model-value="rule.segment.target_field_id || ''"
|
||||
:class="{ 'xfa-split__invalid': !rule.segment.target_field_id }"
|
||||
@change="updateSegmentTarget(rule.rule_id, ($event.target as HTMLSelectElement).value)"
|
||||
@update:model-value="(value) => updateSegmentTarget(rule.rule_id, String(value))"
|
||||
>
|
||||
<option value="">{{ t('admin.shippingOrderProfiles.xfaSplit.selectField') }}</option>
|
||||
<option v-for="field in splitTargetFields" :key="field.field_id" :value="field.field_id">
|
||||
{{ field.display_name }} ({{ field.field_code }})
|
||||
</option>
|
||||
</select>
|
||||
<el-option value="" :label="t('admin.shippingOrderProfiles.xfaSplit.selectField')" />
|
||||
<el-option v-for="field in splitTargetFields" :key="field.field_id" :value="field.field_id" :label="`${field.display_name} (${field.field_code})`" />
|
||||
</el-select>
|
||||
<small v-if="!rule.segment.target_field_id" class="xfa-split__hint-error">
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.validationMappedTarget') }}
|
||||
</small>
|
||||
@@ -1078,89 +1104,89 @@ watch(activeRuleSet, (current, previous) => {
|
||||
<div class="xfa-split__extraction">
|
||||
<label>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.extractionMode') }}
|
||||
<select
|
||||
<el-select
|
||||
:disabled="isReadonly"
|
||||
:value="extractionMode(rule)"
|
||||
@change="changeExtractionMode(rule, ($event.target as HTMLSelectElement).value as ExtractionMode)"
|
||||
:model-value="extractionMode(rule)"
|
||||
@update:model-value="(value) => changeExtractionMode(rule, value as ExtractionMode)"
|
||||
>
|
||||
<option value="select_line">{{ t('admin.shippingOrderProfiles.xfaSplit.extractionByLine') }}</option>
|
||||
<option value="select_line_range">{{ t('admin.shippingOrderProfiles.xfaSplit.extractionByLineRange') }}</option>
|
||||
<option value="extract_prefix">{{ t('admin.shippingOrderProfiles.xfaSplit.extractionByLabel') }}</option>
|
||||
<option value="regex_capture">{{ t('admin.shippingOrderProfiles.xfaSplit.extractionByRegex') }}</option>
|
||||
<option value="substring">{{ t('admin.shippingOrderProfiles.xfaSplit.extractionBySubstring') }}</option>
|
||||
</select>
|
||||
<el-option value="select_line" :label="t('admin.shippingOrderProfiles.xfaSplit.extractionByLine')" />
|
||||
<el-option value="select_line_range" :label="t('admin.shippingOrderProfiles.xfaSplit.extractionByLineRange')" />
|
||||
<el-option value="extract_prefix" :label="t('admin.shippingOrderProfiles.xfaSplit.extractionByLabel')" />
|
||||
<el-option value="regex_capture" :label="t('admin.shippingOrderProfiles.xfaSplit.extractionByRegex')" />
|
||||
<el-option value="substring" :label="t('admin.shippingOrderProfiles.xfaSplit.extractionBySubstring')" />
|
||||
</el-select>
|
||||
</label>
|
||||
|
||||
<label v-if="extractionMode(rule) === 'select_line'">
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.extractLineNumber') }}
|
||||
<input
|
||||
<el-input
|
||||
type="number"
|
||||
min="1"
|
||||
:disabled="isReadonly"
|
||||
:value="extractionStage(rule).line_index ?? (rule.order ?? 1)"
|
||||
@input="updateExtraction(rule, { line_index: Number(($event.target as HTMLInputElement).value) || 1 })"
|
||||
:model-value="extractionStage(rule).line_index ?? (rule.order ?? 1)"
|
||||
@input="(value) => updateExtraction(rule, { line_index: Number(value) || 1 })"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<template v-if="extractionMode(rule) === 'select_line_range'">
|
||||
<label>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.extractStartLine') }}
|
||||
<input
|
||||
<el-input
|
||||
type="number"
|
||||
min="1"
|
||||
:disabled="isReadonly"
|
||||
:value="extractionStage(rule).line_start ?? (rule.order ?? 1)"
|
||||
@input="updateExtraction(rule, { line_start: Number(($event.target as HTMLInputElement).value) || 1 })"
|
||||
:model-value="extractionStage(rule).line_start ?? (rule.order ?? 1)"
|
||||
@input="(value) => updateExtraction(rule, { line_start: Number(value) || 1 })"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.extractEndLine') }}
|
||||
<input
|
||||
<el-input
|
||||
type="number"
|
||||
min="1"
|
||||
:disabled="isReadonly"
|
||||
:value="extractionStage(rule).line_end ?? (rule.order ?? 1) + 1"
|
||||
@input="updateExtraction(rule, { line_end: Number(($event.target as HTMLInputElement).value) || 1 })"
|
||||
:model-value="extractionStage(rule).line_end ?? (rule.order ?? 1) + 1"
|
||||
@input="(value) => updateExtraction(rule, { line_end: Number(value) || 1 })"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.joinLinesWith') }}
|
||||
<select
|
||||
<el-select
|
||||
:disabled="isReadonly"
|
||||
:value="extractionStage(rule).join_with || 'newline'"
|
||||
@change="updateExtraction(rule, { join_with: ($event.target as HTMLSelectElement).value as 'newline' | 'space' | 'comma' })"
|
||||
:model-value="extractionStage(rule).join_with || 'newline'"
|
||||
@update:model-value="(value) => updateExtraction(rule, { join_with: value as 'newline' | 'space' | 'comma' })"
|
||||
>
|
||||
<option value="newline">{{ t('admin.shippingOrderProfiles.xfaSplit.joinWithNewline') }}</option>
|
||||
<option value="space">{{ t('admin.shippingOrderProfiles.xfaSplit.joinWithSpace') }}</option>
|
||||
<option value="comma">{{ t('admin.shippingOrderProfiles.xfaSplit.joinWithComma') }}</option>
|
||||
</select>
|
||||
<el-option value="newline" :label="t('admin.shippingOrderProfiles.xfaSplit.joinWithNewline')" />
|
||||
<el-option value="space" :label="t('admin.shippingOrderProfiles.xfaSplit.joinWithSpace')" />
|
||||
<el-option value="comma" :label="t('admin.shippingOrderProfiles.xfaSplit.joinWithComma')" />
|
||||
</el-select>
|
||||
</label>
|
||||
</template>
|
||||
|
||||
<template v-if="extractionMode(rule) === 'extract_prefix'">
|
||||
<label>{{ t('admin.shippingOrderProfiles.xfaSplit.prefix') }}
|
||||
<input :disabled="isReadonly" :value="extractionStage(rule).value || ''" @input="updateExtraction(rule, { value: ($event.target as HTMLInputElement).value })" />
|
||||
<el-input :disabled="isReadonly" :model-value="extractionStage(rule).value || ''" @input="(value) => updateExtraction(rule, { value: String(value) })" />
|
||||
</label>
|
||||
<label>{{ t('admin.shippingOrderProfiles.xfaSplit.separators') }}
|
||||
<input :disabled="isReadonly" :value="separatorsToString(extractionStage(rule).separators)" @input="updateExtraction(rule, { separators: parseSeparators(($event.target as HTMLInputElement).value) })" />
|
||||
<el-input :disabled="isReadonly" :model-value="separatorsToString(extractionStage(rule).separators)" @input="(value) => updateExtraction(rule, { separators: parseSeparators(String(value)) })" />
|
||||
</label>
|
||||
</template>
|
||||
|
||||
<template v-if="extractionMode(rule) === 'regex_capture'">
|
||||
<label>{{ t('admin.shippingOrderProfiles.xfaSplit.regex') }}
|
||||
<input :disabled="isReadonly" :value="extractionStage(rule).pattern || ''" @input="updateExtraction(rule, { pattern: ($event.target as HTMLInputElement).value })" />
|
||||
<el-input :disabled="isReadonly" :model-value="extractionStage(rule).pattern || ''" @input="(value) => updateExtraction(rule, { pattern: String(value) })" />
|
||||
</label>
|
||||
<label>{{ t('admin.shippingOrderProfiles.xfaSplit.captureGroup') }}
|
||||
<input type="number" min="0" :disabled="isReadonly" :value="extractionStage(rule).capture_group ?? 1" @input="updateExtraction(rule, { capture_group: Number(($event.target as HTMLInputElement).value) || 0 })" />
|
||||
<el-input type="number" min="0" :disabled="isReadonly" :model-value="extractionStage(rule).capture_group ?? 1" @input="(value) => updateExtraction(rule, { capture_group: Number(value) || 0 })" />
|
||||
</label>
|
||||
</template>
|
||||
|
||||
<template v-if="extractionMode(rule) === 'substring'">
|
||||
<label>{{ t('admin.shippingOrderProfiles.xfaSplit.substringStart') }}
|
||||
<input type="number" min="0" :disabled="isReadonly" :value="extractionStage(rule).start ?? 0" @input="updateExtraction(rule, { start: Number(($event.target as HTMLInputElement).value) || 0 })" />
|
||||
<el-input type="number" min="0" :disabled="isReadonly" :model-value="extractionStage(rule).start ?? 0" @input="(value) => updateExtraction(rule, { start: Number(value) || 0 })" />
|
||||
</label>
|
||||
<label>{{ t('admin.shippingOrderProfiles.xfaSplit.substringEnd') }}
|
||||
<input type="number" min="0" :disabled="isReadonly" :value="extractionStage(rule).end ?? ''" @input="updateExtraction(rule, { end: ($event.target as HTMLInputElement).value === '' ? null : Number(($event.target as HTMLInputElement).value) })" />
|
||||
<el-input type="number" min="0" :disabled="isReadonly" :model-value="extractionStage(rule).end ?? ''" @input="(value) => updateExtraction(rule, { end: (String(value) === '' ? null : Number(value)) })" />
|
||||
</label>
|
||||
</template>
|
||||
|
||||
@@ -1171,27 +1197,28 @@ watch(activeRuleSet, (current, previous) => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="button" class="xfa-split__advanced-toggle" @click="toggleAdvanced(rule.rule_id)">
|
||||
<el-button link type="primary" size="small" class="xfa-split__advanced-toggle" @click="toggleAdvanced(rule.rule_id)">
|
||||
{{ advancedRules.has(rule.rule_id)
|
||||
? t('admin.shippingOrderProfiles.xfaSplit.hideAdvanced')
|
||||
: t('admin.shippingOrderProfiles.xfaSplit.showAdvanced') }}
|
||||
</button>
|
||||
</el-button>
|
||||
|
||||
<div v-if="advancedRules.has(rule.rule_id)" class="xfa-split__stages">
|
||||
<div class="xfa-split__stages-header">
|
||||
<strong>{{ t('admin.shippingOrderProfiles.xfaSplit.advancedProcessing') }}</strong>
|
||||
<select
|
||||
<el-select
|
||||
:disabled="isReadonly"
|
||||
:model-value="''"
|
||||
class="xfa-split__add-stage-select"
|
||||
@change="(e) => { addAdvancedStage(rule.rule_id, (e.target as HTMLSelectElement).value as XfaSplitStageType); (e.target as HTMLSelectElement).value = ''; }"
|
||||
:placeholder="t('admin.shippingOrderProfiles.xfaSplit.addAdvancedStep')"
|
||||
@update:model-value="(value) => { if (value) addAdvancedStage(rule.rule_id, value as XfaSplitStageType); }"
|
||||
>
|
||||
<option value="">{{ t('admin.shippingOrderProfiles.xfaSplit.addAdvancedStep') }}</option>
|
||||
<option value="extract_prefix">{{ t('admin.shippingOrderProfiles.xfaSplit.advancedExtractAfterLabel') }}</option>
|
||||
<option value="regex_capture">{{ t('admin.shippingOrderProfiles.xfaSplit.extractionByRegex') }}</option>
|
||||
<option value="substring">{{ t('admin.shippingOrderProfiles.xfaSplit.extractionBySubstring') }}</option>
|
||||
<option value="replace">{{ stageTypeLabel('replace') }}</option>
|
||||
<option value="normalize">{{ stageTypeLabel('normalize') }}</option>
|
||||
</select>
|
||||
<el-option value="extract_prefix" :label="t('admin.shippingOrderProfiles.xfaSplit.advancedExtractAfterLabel')" />
|
||||
<el-option value="regex_capture" :label="t('admin.shippingOrderProfiles.xfaSplit.extractionByRegex')" />
|
||||
<el-option value="substring" :label="t('admin.shippingOrderProfiles.xfaSplit.extractionBySubstring')" />
|
||||
<el-option value="replace" :label="stageTypeLabel('replace')" />
|
||||
<el-option value="normalize" :label="stageTypeLabel('normalize')" />
|
||||
</el-select>
|
||||
</div>
|
||||
|
||||
<ul class="xfa-split__stage-list">
|
||||
@@ -1199,135 +1226,130 @@ watch(activeRuleSet, (current, previous) => {
|
||||
<div class="xfa-split__stage-toolbar">
|
||||
<span>{{ stageTypeLabel(stage.type) }}</span>
|
||||
<div class="xfa-split__rule-actions">
|
||||
<button
|
||||
type="button"
|
||||
<el-button
|
||||
size="small"
|
||||
:disabled="isReadonly || stageIndex === 0"
|
||||
@click="moveStage(rule.rule_id, stage.stage_id, -1)"
|
||||
>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.moveUp') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
:disabled="isReadonly || stageIndex === advancedStages(rule).length - 1"
|
||||
@click="moveStage(rule.rule_id, stage.stage_id, 1)"
|
||||
>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.moveDown') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="danger"
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
type="danger"
|
||||
plain
|
||||
:disabled="isReadonly || (rule.stages || []).length <= 1"
|
||||
@click="deleteStage(rule.rule_id, stage.stage_id)"
|
||||
>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.deleteStage') }}
|
||||
</button>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.stageType') }}
|
||||
<select
|
||||
<el-select
|
||||
:disabled="isReadonly"
|
||||
:value="stage.type"
|
||||
@change="changeStageType(rule.rule_id, stage.stage_id, ($event.target as HTMLSelectElement).value as XfaSplitStageType)"
|
||||
:model-value="stage.type"
|
||||
@update:model-value="(value) => changeStageType(rule.rule_id, stage.stage_id, value as XfaSplitStageType)"
|
||||
>
|
||||
<option value="extract_prefix">{{ t('admin.shippingOrderProfiles.xfaSplit.advancedExtractAfterLabel') }}</option>
|
||||
<option value="regex_capture">{{ t('admin.shippingOrderProfiles.xfaSplit.extractionByRegex') }}</option>
|
||||
<option value="substring">{{ t('admin.shippingOrderProfiles.xfaSplit.extractionBySubstring') }}</option>
|
||||
<option value="replace">{{ stageTypeLabel('replace') }}</option>
|
||||
<option value="normalize">{{ stageTypeLabel('normalize') }}</option>
|
||||
</select>
|
||||
<el-option value="extract_prefix" :label="t('admin.shippingOrderProfiles.xfaSplit.advancedExtractAfterLabel')" />
|
||||
<el-option value="regex_capture" :label="t('admin.shippingOrderProfiles.xfaSplit.extractionByRegex')" />
|
||||
<el-option value="substring" :label="t('admin.shippingOrderProfiles.xfaSplit.extractionBySubstring')" />
|
||||
<el-option value="replace" :label="stageTypeLabel('replace')" />
|
||||
<el-option value="normalize" :label="stageTypeLabel('normalize')" />
|
||||
</el-select>
|
||||
</label>
|
||||
|
||||
<small v-if="stageHint(stage)" class="xfa-split__hint-error">{{ stageHint(stage) }}</small>
|
||||
|
||||
<template v-if="stage.type === 'split_lines' || stage.type === 'normalize'">
|
||||
<label class="xfa-split__checkbox">
|
||||
<input
|
||||
type="checkbox"
|
||||
:disabled="isReadonly"
|
||||
:checked="stage.trim ?? true"
|
||||
@change="updateStage(rule.rule_id, stage.stage_id, { trim: ($event.target as HTMLInputElement).checked })"
|
||||
/>
|
||||
<el-checkbox
|
||||
:disabled="isReadonly"
|
||||
:model-value="stage.trim ?? true"
|
||||
@change="(checked) => updateStage(rule.rule_id, stage.stage_id, { trim: Boolean(checked) })"
|
||||
>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.stageTrim') }}
|
||||
</label>
|
||||
<label class="xfa-split__checkbox">
|
||||
<input
|
||||
type="checkbox"
|
||||
:disabled="isReadonly"
|
||||
:checked="stage.remove_empty_lines ?? true"
|
||||
@change="updateStage(rule.rule_id, stage.stage_id, { remove_empty_lines: ($event.target as HTMLInputElement).checked })"
|
||||
/>
|
||||
</el-checkbox>
|
||||
<el-checkbox
|
||||
:disabled="isReadonly"
|
||||
:model-value="stage.remove_empty_lines ?? true"
|
||||
@change="(checked) => updateStage(rule.rule_id, stage.stage_id, { remove_empty_lines: Boolean(checked) })"
|
||||
>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.stageRemoveEmptyLines') }}
|
||||
</label>
|
||||
</el-checkbox>
|
||||
</template>
|
||||
|
||||
<label v-if="stage.type === 'split_lines'">
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.lineBreaks') }}
|
||||
<input
|
||||
<el-input
|
||||
:disabled="isReadonly"
|
||||
:value="lineBreaksToDisplay(stage.line_breaks)"
|
||||
:model-value="lineBreaksToDisplay(stage.line_breaks)"
|
||||
:placeholder="t('admin.shippingOrderProfiles.xfaSplit.lineBreaksPlaceholder')"
|
||||
@change="updateStage(rule.rule_id, stage.stage_id, { line_breaks: parseLineBreaks(($event.target as HTMLInputElement).value) })"
|
||||
@change="(value) => updateStage(rule.rule_id, stage.stage_id, { line_breaks: parseLineBreaks(String(value)) })"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<label v-if="stage.type === 'select_line'">
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.lineIndex') }}
|
||||
<input
|
||||
<el-input
|
||||
type="number"
|
||||
min="1"
|
||||
:disabled="isReadonly"
|
||||
:value="stage.line_index ?? 1"
|
||||
@input="updateStage(rule.rule_id, stage.stage_id, { line_index: Number(($event.target as HTMLInputElement).value) || 1 })"
|
||||
:model-value="stage.line_index ?? 1"
|
||||
@input="(value) => updateStage(rule.rule_id, stage.stage_id, { line_index: Number(value) || 1 })"
|
||||
/>
|
||||
</label>
|
||||
|
||||
<template v-if="stage.type === 'extract_prefix'">
|
||||
<label>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.prefix') }}
|
||||
<input
|
||||
<el-input
|
||||
:disabled="isReadonly"
|
||||
:value="stage.value || ''"
|
||||
@input="updateStage(rule.rule_id, stage.stage_id, { value: ($event.target as HTMLInputElement).value })"
|
||||
:model-value="stage.value || ''"
|
||||
@input="(value) => updateStage(rule.rule_id, stage.stage_id, { value: String(value) })"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.separators') }}
|
||||
<input
|
||||
<el-input
|
||||
:disabled="isReadonly"
|
||||
:value="separatorsToString(stage.separators)"
|
||||
@input="updateStage(rule.rule_id, stage.stage_id, { separators: parseSeparators(($event.target as HTMLInputElement).value) })"
|
||||
:model-value="separatorsToString(stage.separators)"
|
||||
@input="(value) => updateStage(rule.rule_id, stage.stage_id, { separators: parseSeparators(String(value)) })"
|
||||
/>
|
||||
</label>
|
||||
<label class="xfa-split__checkbox">
|
||||
<input
|
||||
type="checkbox"
|
||||
:disabled="isReadonly"
|
||||
:checked="stage.case_sensitive ?? false"
|
||||
@change="updateStage(rule.rule_id, stage.stage_id, { case_sensitive: ($event.target as HTMLInputElement).checked })"
|
||||
/>
|
||||
<el-checkbox
|
||||
:disabled="isReadonly"
|
||||
:model-value="stage.case_sensitive ?? false"
|
||||
@change="(checked) => updateStage(rule.rule_id, stage.stage_id, { case_sensitive: Boolean(checked) })"
|
||||
>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.caseSensitive') }}
|
||||
</label>
|
||||
</el-checkbox>
|
||||
</template>
|
||||
|
||||
<template v-if="stage.type === 'regex_capture'">
|
||||
<label>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.regex') }}
|
||||
<input
|
||||
<el-input
|
||||
:disabled="isReadonly"
|
||||
:value="stage.pattern || ''"
|
||||
@input="updateStage(rule.rule_id, stage.stage_id, { pattern: ($event.target as HTMLInputElement).value })"
|
||||
:model-value="stage.pattern || ''"
|
||||
@input="(value) => updateStage(rule.rule_id, stage.stage_id, { pattern: String(value) })"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.captureGroup') }}
|
||||
<input
|
||||
<el-input
|
||||
type="number"
|
||||
min="0"
|
||||
:disabled="isReadonly"
|
||||
:value="stage.capture_group ?? 1"
|
||||
@input="updateStage(rule.rule_id, stage.stage_id, { capture_group: Number(($event.target as HTMLInputElement).value) || 0 })"
|
||||
:model-value="stage.capture_group ?? 1"
|
||||
@input="(value) => updateStage(rule.rule_id, stage.stage_id, { capture_group: Number(value) || 0 })"
|
||||
/>
|
||||
</label>
|
||||
</template>
|
||||
@@ -1335,18 +1357,18 @@ watch(activeRuleSet, (current, previous) => {
|
||||
<template v-if="stage.type === 'replace'">
|
||||
<label>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.find') }}
|
||||
<input
|
||||
<el-input
|
||||
:disabled="isReadonly"
|
||||
:value="stage.find || ''"
|
||||
@input="updateStage(rule.rule_id, stage.stage_id, { find: ($event.target as HTMLInputElement).value })"
|
||||
:model-value="stage.find || ''"
|
||||
@input="(value) => updateStage(rule.rule_id, stage.stage_id, { find: String(value) })"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.replaceWith') }}
|
||||
<input
|
||||
<el-input
|
||||
:disabled="isReadonly"
|
||||
:value="stage.replace_with || ''"
|
||||
@input="updateStage(rule.rule_id, stage.stage_id, { replace_with: ($event.target as HTMLInputElement).value })"
|
||||
:model-value="stage.replace_with || ''"
|
||||
@input="(value) => updateStage(rule.rule_id, stage.stage_id, { replace_with: String(value) })"
|
||||
/>
|
||||
</label>
|
||||
</template>
|
||||
@@ -1354,22 +1376,22 @@ watch(activeRuleSet, (current, previous) => {
|
||||
<template v-if="stage.type === 'substring'">
|
||||
<label>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.substringStart') }}
|
||||
<input
|
||||
<el-input
|
||||
type="number"
|
||||
min="0"
|
||||
:disabled="isReadonly"
|
||||
:value="stage.start ?? 0"
|
||||
@input="updateStage(rule.rule_id, stage.stage_id, { start: Number(($event.target as HTMLInputElement).value) || 0 })"
|
||||
:model-value="stage.start ?? 0"
|
||||
@input="(value) => updateStage(rule.rule_id, stage.stage_id, { start: Number(value) || 0 })"
|
||||
/>
|
||||
</label>
|
||||
<label>
|
||||
{{ t('admin.shippingOrderProfiles.xfaSplit.substringEnd') }}
|
||||
<input
|
||||
<el-input
|
||||
type="number"
|
||||
min="0"
|
||||
:disabled="isReadonly"
|
||||
:value="stage.end ?? ''"
|
||||
@input="updateStage(rule.rule_id, stage.stage_id, { end: ($event.target as HTMLInputElement).value === '' ? null : Number(($event.target as HTMLInputElement).value) })"
|
||||
:model-value="stage.end ?? ''"
|
||||
@input="(value) => updateStage(rule.rule_id, stage.stage_id, { end: (String(value) === '' ? null : Number(value)) })"
|
||||
/>
|
||||
</label>
|
||||
</template>
|
||||
@@ -1387,46 +1409,42 @@ watch(activeRuleSet, (current, previous) => {
|
||||
|
||||
<style scoped>
|
||||
.xfa-split { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow: auto; }
|
||||
.xfa-split__banner { padding: 8px 10px; border-radius: 6px; background: var(--status-warning-bg); color: var(--status-warning-fg); font-size: 0.85rem; }
|
||||
.xfa-split__banner { border-radius: 6px; }
|
||||
.xfa-split__body { display: flex; flex-direction: column; gap: 8px; }
|
||||
.xfa-split__reveal { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; }
|
||||
.xfa-split__policy { display: grid; gap: 4px; font-size: 0.8rem; }
|
||||
.xfa-split__fieldset { border: 1px solid var(--border-default); border-radius: 6px; padding: 8px 10px; margin: 0; display: grid; gap: 6px; }
|
||||
.xfa-split__fieldset { border: 1px solid var(--el-border-color-lighter); border-radius: 6px; padding: 8px 10px; margin: 0; display: grid; gap: 6px; }
|
||||
.xfa-split__fieldset legend { font-size: 0.8rem; font-weight: 600; padding: 0 4px; }
|
||||
.xfa-split__normalization { display: grid; gap: 4px; font-size: 0.8rem; }
|
||||
.xfa-split__status-line { margin: 0; font-size: 0.75rem; color: var(--text-muted); }
|
||||
.xfa-split__status-line { margin: 0; font-size: 0.75rem; color: var(--el-text-color-secondary); }
|
||||
.xfa-split__rules { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
|
||||
.xfa-split__rules > li { padding: 10px; border: 1px solid var(--border-default); border-radius: 6px; display: grid; gap: 6px; }
|
||||
.xfa-split__rules > li { padding: 10px; border: 1px solid var(--el-border-color-lighter); border-radius: 6px; display: grid; gap: 6px; }
|
||||
.xfa-split__rule-toolbar { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
|
||||
.xfa-split__rule-title { display: flex; min-width: 0; align-items: center; gap: 6px; padding: 2px 0; border: 0; background: transparent; color: var(--text-primary); cursor: pointer; text-align: left; }
|
||||
.xfa-split__rule-title .rule-summary { overflow: hidden; color: var(--text-muted); font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.xfa-split__rule-title .rule-chevron { width: 12px; color: var(--status-info-fg); font-size: 1rem; }
|
||||
.xfa-split__rule-title { display: flex; min-width: 0; align-items: center; gap: 6px; padding: 2px 0; border: 0; background: transparent; color: var(--el-text-color-primary); cursor: pointer; text-align: left; }
|
||||
.xfa-split__rule-title .rule-summary { overflow: hidden; color: var(--el-text-color-secondary); font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.xfa-split__rule-title .rule-chevron { width: 12px; color: var(--el-color-primary); font-size: 1rem; }
|
||||
.xfa-split__rule-detail { display: grid; gap: 6px; }
|
||||
.xfa-split__extraction { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(160px, .7fr); gap: 8px 12px; padding: 10px; border: 1px solid var(--status-info-border); border-radius: 6px; background: var(--status-info-bg); }
|
||||
.xfa-split__inline-preview { grid-column: 1 / -1; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-top: 7px; border-top: 1px solid var(--status-info-border); color: var(--text-muted); font-size: .75rem; }
|
||||
.xfa-split__inline-preview strong { max-width: 70%; overflow: hidden; color: var(--status-success-fg); white-space: pre-wrap; overflow-wrap: anywhere; }
|
||||
.xfa-split__advanced-toggle { justify-self: start; padding: 3px 0; border: 0; background: transparent; color: var(--status-info-fg); cursor: pointer; font-size: .75rem; }
|
||||
.xfa-split__extraction { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(160px, .7fr); gap: 8px 12px; padding: 10px; border: 1px solid var(--el-color-primary-light-5); border-radius: 6px; background: var(--el-color-primary-light-9); }
|
||||
.xfa-split__inline-preview { grid-column: 1 / -1; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-top: 7px; border-top: 1px solid var(--el-color-primary-light-5); color: var(--el-text-color-secondary); font-size: .75rem; }
|
||||
.xfa-split__inline-preview strong { max-width: 70%; overflow: hidden; color: var(--el-color-success); white-space: pre-wrap; overflow-wrap: anywhere; }
|
||||
.xfa-split__advanced-toggle { justify-self: start; }
|
||||
.xfa-split__rule-actions { display: flex; flex-wrap: wrap; gap: 4px; }
|
||||
.xfa-split__rule-actions button { padding: 2px 6px; font-size: 0.72rem; border: 1px solid var(--border-default); border-radius: 4px; background: var(--bg-page); cursor: pointer; }
|
||||
.xfa-split__rule-actions button.danger { color: var(--status-error-fg); }
|
||||
.xfa-split__stages { margin-top: 4px; padding-top: 6px; border-top: 1px dashed var(--border-default); display: grid; gap: 6px; }
|
||||
.xfa-split__stages { margin-top: 4px; padding-top: 6px; border-top: 1px dashed var(--el-border-color-lighter); display: grid; gap: 6px; }
|
||||
.xfa-split__stages-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
|
||||
.xfa-split__add-stage-select { font-size: 0.75rem; padding: 2px 4px; }
|
||||
.xfa-split__add-stage-select { width: 11rem; }
|
||||
.xfa-split__stage-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
|
||||
.xfa-split__stage-list > li { padding: 8px; background: var(--bg-subtle, rgba(0,0,0,0.02)); border-radius: 4px; display: grid; gap: 4px; }
|
||||
.xfa-split__stage-list > li { padding: 8px; background: var(--el-fill-color-lighter); border-radius: 4px; display: grid; gap: 4px; }
|
||||
.xfa-split__stage-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 0.75rem; }
|
||||
.xfa-split__preview { max-height: 240px; margin: 0; padding: 10px; overflow: auto; border: 1px solid var(--status-info-border); border-radius: 6px; background: var(--status-info-bg); }
|
||||
.xfa-split__preview { max-height: 240px; margin: 0; padding: 10px; overflow: auto; border: 1px solid var(--el-color-primary-light-5); border-radius: 6px; background: var(--el-color-primary-light-9); }
|
||||
.xfa-split__preview h4, .xfa-split__preview h5 { margin: 8px 0 4px; font-size: 0.85rem; }
|
||||
.xfa-split__table { width: 100%; border-collapse: collapse; font-size: 0.75rem; }
|
||||
.xfa-split__table th, .xfa-split__table td { border: 1px solid var(--border-default); padding: 4px 6px; text-align: left; vertical-align: top; }
|
||||
.xfa-split__table th, .xfa-split__table td { border: 1px solid var(--el-border-color-lighter); padding: 4px 6px; text-align: left; vertical-align: top; }
|
||||
.xfa-split__table td:nth-child(4) { white-space: pre-wrap; overflow-wrap: anywhere; }
|
||||
.xfa-split__diagnostics li { font-size: 0.8rem; color: var(--status-warning-fg); }
|
||||
.xfa-split__hint-error { color: var(--status-error-fg); font-size: 0.72rem; }
|
||||
.xfa-split__invalid { border-color: var(--status-error-border); }
|
||||
.hint { color: var(--text-muted); font-size: 0.85rem; }
|
||||
.xfa-split__diagnostics li { font-size: 0.8rem; color: var(--el-color-warning); }
|
||||
.xfa-split__hint-error { color: var(--el-color-danger); font-size: 0.72rem; }
|
||||
.xfa-split__invalid :deep(.el-input__wrapper) { box-shadow: 0 0 0 1px var(--el-color-danger) inset; }
|
||||
.hint { color: var(--el-text-color-secondary); font-size: 0.85rem; }
|
||||
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
|
||||
.link { border: 0; background: transparent; color: var(--status-info-fg); cursor: pointer; }
|
||||
label { display: grid; gap: 2px; font-size: 0.8rem; }
|
||||
.xfa-split__checkbox { display: flex; align-items: center; gap: 6px; }
|
||||
input, select { padding: 4px 6px; font-size: 0.8rem; }
|
||||
label :deep(.el-select) { width: 100%; }
|
||||
label :deep(.el-input) { width: 100%; }
|
||||
</style>
|
||||
+524
-220
@@ -1,13 +1,37 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-extraction-runs/ShippingOrderExtractionRunsPage.vue
|
||||
用途:管理员订单识别运行诊断——健康聚合、积压/取消中筛选、只读详情与活跃 Run 取消。
|
||||
依赖:admin.api 脱敏诊断/健康/取消 DTO、Vue Composition API、Vue I18n。
|
||||
逻辑:健康面板 + 列表筛选;详情仍只读;取消走 admin cancel API 且强制填写原因。
|
||||
依赖:element-plus(表格/抽屉/分页/描述列表/骨架屏,沿用管理端 element-trial 主题)、
|
||||
admin.api 脱敏诊断/健康/取消 DTO、Vue Composition API、Vue I18n。
|
||||
逻辑:健康面板 + 列表筛选(与范式页同款:筛选一行、刷新带 loading);详情改为 el-drawer
|
||||
只读(键值对走 el-descriptions);取消仍走 admin cancel API 且强制填写原因;
|
||||
业务脚本(加载/筛选/取消/路由 runNo 联动)保持原逻辑不变,仅视觉层迁移 EP。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import {
|
||||
ElAlert,
|
||||
ElButton,
|
||||
ElCheckbox,
|
||||
ElDescriptions,
|
||||
ElDescriptionsItem,
|
||||
ElDrawer,
|
||||
ElInput,
|
||||
ElOption,
|
||||
ElPagination,
|
||||
ElSelect,
|
||||
ElSkeleton,
|
||||
ElTable,
|
||||
ElTableColumn,
|
||||
ElTag,
|
||||
vLoading,
|
||||
} from 'element-plus';
|
||||
import { Refresh } from '@element-plus/icons-vue';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import {
|
||||
cancelShippingOrderExtractionRun,
|
||||
getShippingOrderExtractionDiagnosticRun,
|
||||
@@ -172,254 +196,534 @@ watch(
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="space-y-5 p-5 md:p-7">
|
||||
<header class="flex flex-wrap items-start justify-between gap-4">
|
||||
<section class="extraction-runs-page">
|
||||
<header class="page-header">
|
||||
<div>
|
||||
<h1 class="section-title">{{ t('admin.shippingOrderExtractionRuns.title') }}</h1>
|
||||
<p class="section-desc mt-1 max-w-3xl">{{ t('admin.shippingOrderExtractionRuns.subtitle') }}</p>
|
||||
<h1 class="page-title">{{ t('admin.shippingOrderExtractionRuns.title') }}</h1>
|
||||
<p class="page-desc">{{ t('admin.shippingOrderExtractionRuns.subtitle') }}</p>
|
||||
</div>
|
||||
<button type="button" class="btn-secondary btn-sm" :disabled="loading || healthLoading" @click="refreshAll">
|
||||
<el-button :icon="Refresh" :loading="loading || healthLoading" @click="refreshAll">
|
||||
{{ t('admin.shippingOrderExtractionRuns.refresh') }}
|
||||
</button>
|
||||
</el-button>
|
||||
</header>
|
||||
|
||||
<div
|
||||
class="grid gap-3 rounded-xl border border-default bg-surface p-4 md:grid-cols-4"
|
||||
data-testid="shipping-order-extraction-health"
|
||||
>
|
||||
<div v-if="healthLoading" class="md:col-span-4 text-sm text-muted">{{ t('admin.shippingOrderExtractionRuns.loading') }}</div>
|
||||
<div class="health-panel" data-testid="shipping-order-extraction-health">
|
||||
<el-skeleton v-if="healthLoading" class="health-panel__skeleton" :rows="3" animated />
|
||||
<template v-else-if="health">
|
||||
<div>
|
||||
<div class="text-xs text-muted">{{ t('admin.shippingOrderExtractionRuns.healthStatus') }}</div>
|
||||
<div class="mt-1 text-lg font-semibold" :class="health.health_status === 'healthy' ? 'text-emerald-700' : 'text-amber-700'">
|
||||
<div class="health-stat">
|
||||
<div class="health-stat__label">{{ t('admin.shippingOrderExtractionRuns.healthStatus') }}</div>
|
||||
<div class="health-stat__value" :class="health.health_status === 'healthy' ? 'is-healthy' : 'is-degraded'">
|
||||
{{ t(`admin.shippingOrderExtractionRuns.healthStatuses.${health.health_status}`, health.health_status) }}
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-xs text-muted">{{ t('admin.shippingOrderExtractionRuns.activeCount') }}</div>
|
||||
<div class="mt-1 text-lg font-semibold">{{ health.counts.active || 0 }}</div>
|
||||
<div class="health-stat">
|
||||
<div class="health-stat__label">{{ t('admin.shippingOrderExtractionRuns.activeCount') }}</div>
|
||||
<div class="health-stat__value">{{ health.counts.active || 0 }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-xs text-muted">{{ t('admin.shippingOrderExtractionRuns.staleCount') }}</div>
|
||||
<div class="mt-1 text-lg font-semibold">{{ health.counts.stale || 0 }}</div>
|
||||
<div class="health-stat">
|
||||
<div class="health-stat__label">{{ t('admin.shippingOrderExtractionRuns.staleCount') }}</div>
|
||||
<div class="health-stat__value">{{ health.counts.stale || 0 }}</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="text-xs text-muted">{{ t('admin.shippingOrderExtractionRuns.failureRate') }}</div>
|
||||
<div class="mt-1 text-lg font-semibold">{{ Math.round((health.failure_rate || 0) * 100) }}%</div>
|
||||
<div class="health-stat">
|
||||
<div class="health-stat__label">{{ t('admin.shippingOrderExtractionRuns.failureRate') }}</div>
|
||||
<div class="health-stat__value">{{ Math.round((health.failure_rate || 0) * 100) }}%</div>
|
||||
</div>
|
||||
<div class="md:col-span-4 text-xs text-secondary">
|
||||
<div class="health-panel__footnote">
|
||||
{{ t('admin.shippingOrderExtractionRuns.latencySummary', {
|
||||
p50: formatDuration(health.latency?.total?.p50_ms),
|
||||
p95: formatDuration(health.latency?.total?.p95_ms),
|
||||
max: formatDuration(health.latency?.total?.max_ms),
|
||||
}) }}
|
||||
<span v-if="health.stale_run_nos?.length" class="ml-2">
|
||||
<span v-if="health.stale_run_nos?.length" class="health-panel__stale">
|
||||
{{ t('admin.shippingOrderExtractionRuns.staleRuns', { runs: health.stale_run_nos.slice(0, 5).join(', ') }) }}
|
||||
</span>
|
||||
</div>
|
||||
</template>
|
||||
<div v-else class="md:col-span-4 text-sm text-muted">{{ t('admin.shippingOrderExtractionRuns.healthUnavailable') }}</div>
|
||||
<p v-else class="health-panel__unavailable">{{ t('admin.shippingOrderExtractionRuns.healthUnavailable') }}</p>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-3 rounded-xl border border-default bg-surface p-3">
|
||||
<label class="flex items-center gap-2 text-sm text-secondary">
|
||||
{{ t('admin.shippingOrderExtractionRuns.status') }}
|
||||
<select v-model="status" class="select-field py-1.5" @change="applyFilters">
|
||||
<option value="">{{ t('admin.shippingOrderExtractionRuns.allStatuses') }}</option>
|
||||
<option v-for="value in ['queued', 'processing', 'completed', 'partially_completed', 'review_required', 'failed', 'cancelled']" :key="value" :value="value">
|
||||
{{ t(`admin.shippingOrderExtractionRuns.statuses.${value}`) }}
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="flex items-center gap-2 text-sm text-secondary">
|
||||
<input v-model="staleOnly" type="checkbox" class="rounded border-default" @change="applyFilters">
|
||||
{{ t('admin.shippingOrderExtractionRuns.staleOnly') }}
|
||||
</label>
|
||||
<label class="flex items-center gap-2 text-sm text-secondary">
|
||||
<input v-model="cancellationInFlight" type="checkbox" class="rounded border-default" @change="applyFilters">
|
||||
{{ t('admin.shippingOrderExtractionRuns.cancellationInFlight') }}
|
||||
</label>
|
||||
<span class="text-xs text-muted">{{ t('admin.shippingOrderExtractionRuns.total', { count: total }) }}</span>
|
||||
<!-- 筛选一行化:状态下拉 + 两个开关复选 + 总数,@change 即查 -->
|
||||
<div class="filter-bar">
|
||||
<span class="filter-bar__label">{{ t('admin.shippingOrderExtractionRuns.status') }}</span>
|
||||
<el-select v-model="status" class="filter-bar__select" @change="applyFilters">
|
||||
<el-option value="" :label="t('admin.shippingOrderExtractionRuns.allStatuses')" />
|
||||
<el-option
|
||||
v-for="value in ['queued', 'processing', 'completed', 'partially_completed', 'review_required', 'failed', 'cancelled']"
|
||||
:key="value"
|
||||
:value="value"
|
||||
:label="t(`admin.shippingOrderExtractionRuns.statuses.${value}`)"
|
||||
/>
|
||||
</el-select>
|
||||
<el-checkbox v-model="staleOnly" @change="applyFilters">{{ t('admin.shippingOrderExtractionRuns.staleOnly') }}</el-checkbox>
|
||||
<el-checkbox v-model="cancellationInFlight" @change="applyFilters">{{ t('admin.shippingOrderExtractionRuns.cancellationInFlight') }}</el-checkbox>
|
||||
<span class="filter-bar__total">{{ t('admin.shippingOrderExtractionRuns.total', { count: total }) }}</span>
|
||||
</div>
|
||||
|
||||
<p v-if="error" class="rounded-lg border border-rose-200 bg-rose-50 p-3 text-sm text-rose-700">{{ error }}</p>
|
||||
<div class="overflow-x-auto rounded-xl border border-default bg-surface">
|
||||
<table class="min-w-[1040px] w-full text-left text-sm">
|
||||
<thead class="border-b border-default bg-surface-soft text-xs text-muted"><tr>
|
||||
<th class="px-4 py-3">{{ t('admin.shippingOrderExtractionRuns.runNo') }}</th>
|
||||
<th class="px-4 py-3">{{ t('admin.shippingOrderExtractionRuns.status') }}</th>
|
||||
<th class="px-4 py-3">{{ t('admin.shippingOrderExtractionRuns.stage') }}</th>
|
||||
<th class="px-4 py-3">{{ t('admin.shippingOrderExtractionRuns.cancellation') }}</th>
|
||||
<th class="px-4 py-3">{{ t('admin.shippingOrderExtractionRuns.attempts') }}</th>
|
||||
<th class="px-4 py-3">{{ t('admin.shippingOrderExtractionRuns.createdAt') }}</th>
|
||||
<th class="px-4 py-3">{{ t('admin.shippingOrderExtractionRuns.totalDuration') }}</th>
|
||||
<th class="px-4 py-3">{{ t('admin.shippingOrderExtractionRuns.actions') }}</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
<tr v-if="loading"><td colspan="9" class="px-4 py-8 text-center text-muted">{{ t('admin.shippingOrderExtractionRuns.loading') }}</td></tr>
|
||||
<tr v-else-if="!rows.length"><td colspan="9" class="px-4 py-8 text-center text-muted">{{ t('admin.shippingOrderExtractionRuns.empty') }}</td></tr>
|
||||
<tr v-for="row in rows" :key="row.run_no" class="border-b border-default last:border-0">
|
||||
<td class="px-4 py-3 font-mono text-xs">{{ row.run_no }}</td>
|
||||
<td class="px-4 py-3">{{ t(`admin.shippingOrderExtractionRuns.statuses.${row.status}`) }}</td>
|
||||
<td class="px-4 py-3">{{ row.current_event_code || '-' }}</td>
|
||||
<td class="px-4 py-3">
|
||||
<span v-if="row.cancellation?.in_flight" class="rounded-full bg-amber-100 px-2 py-0.5 text-xs text-amber-800">
|
||||
{{ t('admin.shippingOrderExtractionRuns.cancellationStates.in_flight') }}
|
||||
</span>
|
||||
<span v-else-if="row.cancellation?.completed" class="text-xs text-muted">
|
||||
{{ t('admin.shippingOrderExtractionRuns.cancellationStates.completed') }}
|
||||
</span>
|
||||
<span v-else class="text-xs text-muted">—</span>
|
||||
</td>
|
||||
<td class="px-4 py-3">{{ row.attempt_count }}</td>
|
||||
<td class="px-4 py-3">{{ formatTime(row.created_at) }}</td>
|
||||
<td class="px-4 py-3">{{ formatDuration(row.durations_ms.total ?? row.durations_ms.elapsed_active) }}</td>
|
||||
<td class="px-4 py-3">
|
||||
<div class="flex flex-col gap-2">
|
||||
<button type="button" class="text-left text-brand-600 hover:underline" @click="openDetail(row.run_no)">{{ t('admin.shippingOrderExtractionRuns.viewDetail') }}</button>
|
||||
<template v-if="canCancelRun(row)">
|
||||
<div
|
||||
v-if="pendingCancelRunNo === row.run_no"
|
||||
class="min-w-[220px] space-y-1.5 rounded-md border border-rose-200 bg-rose-50/60 p-2 dark:border-rose-900/40 dark:bg-rose-950/20"
|
||||
<el-alert v-if="error" :title="error" type="error" :closable="false" />
|
||||
|
||||
<el-table v-loading="loading" :data="rows" class="runs-table" row-key="run_no">
|
||||
<el-table-column prop="run_no" :label="t('admin.shippingOrderExtractionRuns.runNo')" min-width="210">
|
||||
<template #default="{ row }">
|
||||
<span class="mono-cell">{{ row.run_no }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.shippingOrderExtractionRuns.status')" min-width="150">
|
||||
<template #default="{ row }">{{ t(`admin.shippingOrderExtractionRuns.statuses.${row.status}`) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.shippingOrderExtractionRuns.stage')" min-width="150">
|
||||
<template #default="{ row }">{{ row.current_event_code || '-' }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.shippingOrderExtractionRuns.cancellation')" min-width="130">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row.cancellation?.in_flight" type="warning" size="small">
|
||||
{{ t('admin.shippingOrderExtractionRuns.cancellationStates.in_flight') }}
|
||||
</el-tag>
|
||||
<span v-else-if="row.cancellation?.completed" class="muted-cell">
|
||||
{{ t('admin.shippingOrderExtractionRuns.cancellationStates.completed') }}
|
||||
</span>
|
||||
<span v-else class="muted-cell">—</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="attempt_count" :label="t('admin.shippingOrderExtractionRuns.attempts')" width="90" />
|
||||
<el-table-column :label="t('admin.shippingOrderExtractionRuns.createdAt')" min-width="170">
|
||||
<template #default="{ row }">{{ formatTime(row.created_at) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.shippingOrderExtractionRuns.totalDuration')" width="110">
|
||||
<template #default="{ row }">{{ formatDuration(row.durations_ms.total ?? row.durations_ms.elapsed_active) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="t('admin.shippingOrderExtractionRuns.actions')" min-width="270">
|
||||
<template #default="{ row }">
|
||||
<div class="run-actions">
|
||||
<el-button link type="primary" size="small" @click="openDetail(row.run_no)">
|
||||
{{ t('admin.shippingOrderExtractionRuns.viewDetail') }}
|
||||
</el-button>
|
||||
<template v-if="canCancelRun(row as ShippingOrderExtractionDiagnosticRun)">
|
||||
<div v-if="pendingCancelRunNo === row.run_no" class="cancel-form">
|
||||
<span class="cancel-form__label">{{ t('chat.shippingOrderExtractionCancel.reasonRequired') }}</span>
|
||||
<el-input v-model="cancelReason" type="textarea" :rows="2" />
|
||||
<div class="cancel-form__buttons">
|
||||
<el-button
|
||||
type="danger"
|
||||
link
|
||||
size="small"
|
||||
:loading="cancellingRunNo === row.run_no"
|
||||
:disabled="cancellingRunNo === row.run_no || !cancelReason.trim()"
|
||||
@click="submitCancelRun(row.run_no)"
|
||||
>
|
||||
<label class="block text-[11px] text-secondary">{{ t('chat.shippingOrderExtractionCancel.reasonRequired') }}</label>
|
||||
<textarea v-model="cancelReason" rows="2" class="input-field w-full py-1 text-xs" />
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="text-xs font-medium text-rose-700 hover:underline"
|
||||
:disabled="cancellingRunNo === row.run_no || !cancelReason.trim()"
|
||||
@click="submitCancelRun(row.run_no)"
|
||||
>
|
||||
{{ cancellingRunNo === row.run_no
|
||||
? t('chat.shippingOrderExtractionCancel.submitting')
|
||||
: t('admin.shippingOrderExtractionRuns.cancelRun') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="text-xs text-muted hover:underline"
|
||||
:disabled="cancellingRunNo === row.run_no"
|
||||
@click="pendingCancelRunNo = ''; cancelReason = ''"
|
||||
>
|
||||
{{ t('admin.cancel') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<button
|
||||
v-else
|
||||
type="button"
|
||||
class="text-left text-xs font-medium text-rose-700 hover:underline"
|
||||
:disabled="Boolean(cancellingRunNo)"
|
||||
@click="beginCancelRun(row.run_no)"
|
||||
{{ cancellingRunNo === row.run_no
|
||||
? t('chat.shippingOrderExtractionCancel.submitting')
|
||||
: t('admin.shippingOrderExtractionRuns.cancelRun') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
:disabled="cancellingRunNo === row.run_no"
|
||||
@click="pendingCancelRunNo = ''; cancelReason = ''"
|
||||
>
|
||||
{{ t('admin.shippingOrderExtractionRuns.cancelRun') }}
|
||||
</button>
|
||||
</template>
|
||||
{{ t('admin.cancel') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="flex items-center justify-end gap-3 text-sm">
|
||||
<button type="button" class="rounded border border-default px-3 py-1.5 disabled:opacity-50" :disabled="page <= 1 || loading" @click="page -= 1; load()">{{ t('admin.shippingOrderExtractionRuns.previous') }}</button>
|
||||
<span>{{ page }}</span>
|
||||
<button type="button" class="rounded border border-default px-3 py-1.5 disabled:opacity-50" :disabled="page * pageSize >= total || loading" @click="page += 1; load()">{{ t('admin.shippingOrderExtractionRuns.next') }}</button>
|
||||
</div>
|
||||
|
||||
<div v-if="detail || detailLoading" class="fixed inset-0 z-50 flex justify-end bg-overlay" @click.self="closeDetail">
|
||||
<aside class="h-full w-full max-w-2xl overflow-y-auto bg-surface p-6 shadow-2xl">
|
||||
<div class="flex items-center justify-between"><h2 class="text-lg font-bold">{{ t('admin.shippingOrderExtractionRuns.detailTitle') }}</h2><button type="button" class="text-secondary" @click="closeDetail">{{ t('admin.close') }}</button></div>
|
||||
<p v-if="detailLoading" class="mt-6 text-muted">{{ t('admin.shippingOrderExtractionRuns.loading') }}</p>
|
||||
<template v-else-if="detail">
|
||||
<dl class="mt-5 grid grid-cols-2 gap-3 text-sm">
|
||||
<dt>{{ t('admin.shippingOrderExtractionRuns.runNo') }}</dt><dd class="font-mono text-xs">{{ detail.run.run_no }}</dd>
|
||||
<dt>{{ t('admin.shippingOrderExtractionRuns.currentEvent') }}</dt><dd class="font-mono text-xs">{{ detail.run.current_event_code || '-' }}</dd>
|
||||
<dt>{{ t('admin.shippingOrderExtractionRuns.cancellation') }}</dt>
|
||||
<dd>
|
||||
<template v-if="detail.run.cancellation?.in_flight">{{ t('admin.shippingOrderExtractionRuns.cancellationStates.in_flight') }}</template>
|
||||
<template v-else-if="detail.run.cancellation?.completed">{{ t('admin.shippingOrderExtractionRuns.cancellationStates.completed') }}</template>
|
||||
<template v-else>—</template>
|
||||
</dd>
|
||||
<dt>{{ t('admin.shippingOrderExtractionRuns.candidateMaterializedAt') }}</dt><dd>{{ formatTime(detail.run.candidate_materialized_at) }}</dd>
|
||||
<dt>{{ t('admin.shippingOrderExtractionRuns.errorCode') }}</dt><dd>{{ detail.run.error_code || '-' }}</dd>
|
||||
<dt>{{ t('admin.shippingOrderExtractionRuns.totalDuration') }}</dt><dd>{{ formatDuration(detail.run.durations_ms.total) }}</dd>
|
||||
</dl>
|
||||
<section class="mt-6 rounded-lg border border-default p-4 text-sm">
|
||||
<div class="font-semibold">{{ t('admin.shippingOrderExtractionRuns.autoFreezePolicy') }}</div>
|
||||
<dl class="mt-3 grid grid-cols-2 gap-x-3 gap-y-2">
|
||||
<dt>{{ t('admin.shippingOrderExtractionRuns.autoFreezeEnabled') }}</dt>
|
||||
<dd>{{ t(detail.run.auto_freeze_policy.enabled ? 'admin.shippingOrderExtractionRuns.yes' : 'admin.shippingOrderExtractionRuns.no') }}</dd>
|
||||
<dt>{{ t('admin.shippingOrderExtractionRuns.autoFreezeMode') }}</dt>
|
||||
<dd>{{ t(`admin.shippingOrderExtractionRuns.autoFreezeModes.${detail.run.auto_freeze_policy.mode}`) }}</dd>
|
||||
<dt>{{ t('admin.shippingOrderExtractionRuns.autoFreezeQualificationStatus') }}</dt>
|
||||
<dd>{{ detail.run.auto_freeze_policy.qualification_status ? t(`admin.shippingOrderExtractionRuns.autoFreezeQualificationStatuses.${detail.run.auto_freeze_policy.qualification_status}`) : '-' }}</dd>
|
||||
<dt>{{ t('admin.shippingOrderExtractionRuns.autoFreezeProfile') }}</dt>
|
||||
<dd>{{ detail.run.auto_freeze_policy.selected_profile_code || '-' }}</dd>
|
||||
<dt>{{ t('admin.shippingOrderExtractionRuns.autoFreezeCustomerScopeStatus') }}</dt>
|
||||
<dd>{{ detail.run.auto_freeze_policy.customer_scope_status ? t(`admin.shippingOrderExtractionRuns.autoFreezeCustomerScopeStatuses.${detail.run.auto_freeze_policy.customer_scope_status}`) : '-' }}</dd>
|
||||
<dt>{{ t('admin.shippingOrderExtractionRuns.autoFreezeBusinessScenarioStatus') }}</dt>
|
||||
<dd>{{ detail.run.auto_freeze_policy.business_scenario_status ? t(`admin.shippingOrderExtractionRuns.autoFreezeBusinessScenarioStatuses.${detail.run.auto_freeze_policy.business_scenario_status}`) : '-' }}</dd>
|
||||
<dt>{{ t('admin.shippingOrderExtractionRuns.autoFreezeCustomerConfirmation') }}</dt>
|
||||
<dd>{{ t(detail.run.auto_freeze_policy.customer_confirmation_required ? 'admin.shippingOrderExtractionRuns.yes' : 'admin.shippingOrderExtractionRuns.no') }}</dd>
|
||||
</dl>
|
||||
<div class="mt-3">
|
||||
<div class="text-xs font-medium text-secondary">{{ t('admin.shippingOrderExtractionRuns.autoFreezeBlockingReasons') }}</div>
|
||||
<div v-if="detail.run.auto_freeze_policy.blocking_reason_codes.length" class="mt-2 flex flex-wrap gap-2">
|
||||
<span
|
||||
v-for="code in detail.run.auto_freeze_policy.blocking_reason_codes"
|
||||
:key="code"
|
||||
class="rounded-full border border-default px-2 py-1 text-xs text-secondary"
|
||||
>
|
||||
{{ translateAutoFreezeReason(code) }}
|
||||
</span>
|
||||
</div>
|
||||
<div v-else class="mt-2 text-xs text-muted">{{ t('admin.shippingOrderExtractionRuns.autoFreezeNoBlockingReasons') }}</div>
|
||||
</div>
|
||||
</section>
|
||||
<h3 class="mt-7 font-semibold">{{ t('admin.shippingOrderExtractionRuns.jobAttempts') }}</h3>
|
||||
<div class="mt-2 space-y-2">
|
||||
<div v-for="job in detail.job_attempts" :key="job.job_id" class="rounded-lg border border-default p-3 text-sm">
|
||||
<b>#{{ job.job_id }}</b> · {{ job.status }} · {{ t('admin.shippingOrderExtractionRuns.attempts') }} {{ job.attempts }}/{{ job.max_attempts }} · {{ formatDuration(job.duration_ms) }}
|
||||
</div>
|
||||
<p v-if="!detail.job_attempts.length" class="text-sm text-muted">{{ t('admin.shippingOrderExtractionRuns.empty') }}</p>
|
||||
</div>
|
||||
<h3 class="mt-7 font-semibold">{{ t('admin.shippingOrderExtractionRuns.units') }}</h3>
|
||||
<div class="mt-2 space-y-2">
|
||||
<div v-for="unit in detail.units" :key="unit.unit_id" class="rounded-lg border border-default p-3 text-sm">
|
||||
<b>#{{ unit.position + 1 }} {{ unit.unit_type }}</b> · {{ unit.status }} · {{ t('admin.shippingOrderExtractionRuns.attempts') }} {{ unit.attempt_count }} · {{ formatDuration(unit.duration_ms) }}
|
||||
<span v-if="unit.error_code" class="ml-2 font-mono text-xs text-danger">{{ unit.error_code }}</span>
|
||||
<section v-for="routeItem in unit.route_decisions" :key="`${unit.unit_id}:${routeItem.attempt_no}`" class="mt-3 rounded border border-default bg-surface-soft p-3 text-xs">
|
||||
<h4 class="font-semibold text-primary">{{ t('admin.shippingOrderExtractionRuns.routeDecision') }} #{{ routeItem.attempt_no }}</h4>
|
||||
<dl class="mt-2 grid grid-cols-2 gap-x-3 gap-y-1">
|
||||
<dt>{{ t('admin.shippingOrderExtractionRuns.executionMode') }}</dt>
|
||||
<dd>{{ t(`admin.shippingOrderExtractionRuns.executionModes.${routeItem.execution_mode}`) }}</dd>
|
||||
<dt>{{ t('admin.shippingOrderExtractionRuns.matchStatus') }}</dt>
|
||||
<dd>{{ t(`admin.shippingOrderExtractionRuns.matchStatuses.${routeItem.match_status}`) }}</dd>
|
||||
<dt>{{ t('admin.shippingOrderExtractionRuns.selectedProfile') }}</dt>
|
||||
<dd>{{ routeItem.selected_profile_code ? `${routeItem.selected_profile_code} V${routeItem.selected_profile_version}` : '-' }}</dd>
|
||||
<dt>{{ t('admin.shippingOrderExtractionRuns.autoCreateApproved') }}</dt>
|
||||
<dd>{{ routeItem.auto_create_approved == null ? '-' : t(routeItem.auto_create_approved ? 'admin.shippingOrderExtractionRuns.yes' : 'admin.shippingOrderExtractionRuns.no') }}</dd>
|
||||
<dt>{{ t('admin.shippingOrderExtractionRuns.fallbackReasons') }}</dt>
|
||||
<dd>{{ routeItem.fallback_reason_codes.length ? routeItem.fallback_reason_codes.map(code => t(`admin.shippingOrderExtractionRuns.reasonCodes.${code}`)).join(';') : '-' }}</dd>
|
||||
</dl>
|
||||
</section>
|
||||
</div>
|
||||
<p v-if="!detail.units.length" class="text-sm text-muted">{{ t('admin.shippingOrderExtractionRuns.empty') }}</p>
|
||||
</div>
|
||||
<h3 class="mt-7 font-semibold">{{ t('admin.shippingOrderExtractionRuns.lifecycle') }}</h3>
|
||||
<div class="mt-2 space-y-2">
|
||||
<div v-for="event in detail.progress_events" :key="`${event.sequence_no}:${event.event_code}`" class="rounded-lg border border-default p-3 text-sm">
|
||||
<b>{{ event.event_code }}</b>
|
||||
<span class="ml-2 text-secondary">{{ event.status || '-' }}</span>
|
||||
<span class="ml-2 font-mono text-xs text-muted">{{ t(`admin.shippingOrderExtractionRuns.visibilities.${event.visibility}`) }}</span>
|
||||
<span v-if="event.reason_code" class="ml-2 font-mono text-xs text-muted">{{ event.reason_code }}</span>
|
||||
<time class="ml-2 text-xs text-muted">{{ formatTime(event.occurred_at) }}</time>
|
||||
</div>
|
||||
<p v-if="!detail.progress_events.length" class="text-sm text-muted">{{ t('admin.shippingOrderExtractionRuns.empty') }}</p>
|
||||
<el-button
|
||||
v-else
|
||||
type="danger"
|
||||
link
|
||||
size="small"
|
||||
:disabled="Boolean(cancellingRunNo)"
|
||||
@click="beginCancelRun(row.run_no)"
|
||||
>
|
||||
{{ t('admin.shippingOrderExtractionRuns.cancelRun') }}
|
||||
</el-button>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
</aside>
|
||||
</el-table-column>
|
||||
<template #empty>{{ t('admin.shippingOrderExtractionRuns.empty') }}</template>
|
||||
</el-table>
|
||||
|
||||
<div class="runs-pager">
|
||||
<el-pagination
|
||||
layout="prev, pager, next"
|
||||
:page-size="pageSize"
|
||||
:total="total"
|
||||
:current-page="page"
|
||||
:disabled="loading"
|
||||
@current-change="(value) => { page = value; load(); }"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<el-drawer
|
||||
:model-value="detail != null || detailLoading"
|
||||
:title="t('admin.shippingOrderExtractionRuns.detailTitle')"
|
||||
size="640px"
|
||||
resizable
|
||||
destroy-on-close
|
||||
class="run-drawer"
|
||||
@close="closeDetail"
|
||||
>
|
||||
<el-skeleton v-if="detailLoading" :rows="8" animated />
|
||||
<template v-else-if="detail">
|
||||
<el-descriptions :column="2" size="small">
|
||||
<el-descriptions-item :label="t('admin.shippingOrderExtractionRuns.runNo')">
|
||||
<span class="mono-cell">{{ detail.run.run_no }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderExtractionRuns.currentEvent')">
|
||||
<span class="mono-cell">{{ detail.run.current_event_code || '-' }}</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderExtractionRuns.cancellation')">
|
||||
<template v-if="detail.run.cancellation?.in_flight">{{ t('admin.shippingOrderExtractionRuns.cancellationStates.in_flight') }}</template>
|
||||
<template v-else-if="detail.run.cancellation?.completed">{{ t('admin.shippingOrderExtractionRuns.cancellationStates.completed') }}</template>
|
||||
<template v-else>—</template>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderExtractionRuns.candidateMaterializedAt')">
|
||||
{{ formatTime(detail.run.candidate_materialized_at) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderExtractionRuns.errorCode')">
|
||||
{{ detail.run.error_code || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderExtractionRuns.totalDuration')">
|
||||
{{ formatDuration(detail.run.durations_ms.total) }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
|
||||
<section class="drawer-section">
|
||||
<h3 class="drawer-section__title">{{ t('admin.shippingOrderExtractionRuns.autoFreezePolicy') }}</h3>
|
||||
<el-descriptions :column="2" size="small">
|
||||
<el-descriptions-item :label="t('admin.shippingOrderExtractionRuns.autoFreezeEnabled')">
|
||||
{{ t(detail.run.auto_freeze_policy.enabled ? 'admin.shippingOrderExtractionRuns.yes' : 'admin.shippingOrderExtractionRuns.no') }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderExtractionRuns.autoFreezeMode')">
|
||||
{{ t(`admin.shippingOrderExtractionRuns.autoFreezeModes.${detail.run.auto_freeze_policy.mode}`) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderExtractionRuns.autoFreezeQualificationStatus')">
|
||||
{{ detail.run.auto_freeze_policy.qualification_status ? t(`admin.shippingOrderExtractionRuns.autoFreezeQualificationStatuses.${detail.run.auto_freeze_policy.qualification_status}`) : '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderExtractionRuns.autoFreezeProfile')">
|
||||
{{ detail.run.auto_freeze_policy.selected_profile_code || '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderExtractionRuns.autoFreezeCustomerScopeStatus')">
|
||||
{{ detail.run.auto_freeze_policy.customer_scope_status ? t(`admin.shippingOrderExtractionRuns.autoFreezeCustomerScopeStatuses.${detail.run.auto_freeze_policy.customer_scope_status}`) : '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderExtractionRuns.autoFreezeBusinessScenarioStatus')">
|
||||
{{ detail.run.auto_freeze_policy.business_scenario_status ? t(`admin.shippingOrderExtractionRuns.autoFreezeBusinessScenarioStatuses.${detail.run.auto_freeze_policy.business_scenario_status}`) : '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderExtractionRuns.autoFreezeCustomerConfirmation')">
|
||||
{{ t(detail.run.auto_freeze_policy.customer_confirmation_required ? 'admin.shippingOrderExtractionRuns.yes' : 'admin.shippingOrderExtractionRuns.no') }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<div class="drawer-section__sub">{{ t('admin.shippingOrderExtractionRuns.autoFreezeBlockingReasons') }}</div>
|
||||
<div v-if="detail.run.auto_freeze_policy.blocking_reason_codes.length" class="reason-tags">
|
||||
<el-tag v-for="code in detail.run.auto_freeze_policy.blocking_reason_codes" :key="code" size="small">
|
||||
{{ translateAutoFreezeReason(code) }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<p v-else class="muted-cell">{{ t('admin.shippingOrderExtractionRuns.autoFreezeNoBlockingReasons') }}</p>
|
||||
</section>
|
||||
|
||||
<h3 class="drawer-heading">{{ t('admin.shippingOrderExtractionRuns.jobAttempts') }}</h3>
|
||||
<div class="stack-list">
|
||||
<div v-for="job in detail.job_attempts" :key="job.job_id" class="stack-card">
|
||||
<b>#{{ job.job_id }}</b> · {{ job.status }} · {{ t('admin.shippingOrderExtractionRuns.attempts') }} {{ job.attempts }}/{{ job.max_attempts }} · {{ formatDuration(job.duration_ms) }}
|
||||
</div>
|
||||
<p v-if="!detail.job_attempts.length" class="muted-cell">{{ t('admin.shippingOrderExtractionRuns.empty') }}</p>
|
||||
</div>
|
||||
|
||||
<h3 class="drawer-heading">{{ t('admin.shippingOrderExtractionRuns.units') }}</h3>
|
||||
<div class="stack-list">
|
||||
<div v-for="unit in detail.units" :key="unit.unit_id" class="stack-card">
|
||||
<div class="stack-card__line">
|
||||
<b>#{{ unit.position + 1 }} {{ unit.unit_type }}</b>
|
||||
<span>· {{ unit.status }} · {{ t('admin.shippingOrderExtractionRuns.attempts') }} {{ unit.attempt_count }} · {{ formatDuration(unit.duration_ms) }}</span>
|
||||
<span v-if="unit.error_code" class="mono-cell danger-cell">{{ unit.error_code }}</span>
|
||||
</div>
|
||||
<section
|
||||
v-for="routeItem in unit.route_decisions"
|
||||
:key="`${unit.unit_id}:${routeItem.attempt_no}`"
|
||||
class="nested-section"
|
||||
>
|
||||
<h4 class="nested-section__title">{{ t('admin.shippingOrderExtractionRuns.routeDecision') }} #{{ routeItem.attempt_no }}</h4>
|
||||
<el-descriptions :column="2" size="small">
|
||||
<el-descriptions-item :label="t('admin.shippingOrderExtractionRuns.executionMode')">
|
||||
{{ t(`admin.shippingOrderExtractionRuns.executionModes.${routeItem.execution_mode}`) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderExtractionRuns.matchStatus')">
|
||||
{{ t(`admin.shippingOrderExtractionRuns.matchStatuses.${routeItem.match_status}`) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderExtractionRuns.selectedProfile')">
|
||||
{{ routeItem.selected_profile_code ? `${routeItem.selected_profile_code} V${routeItem.selected_profile_version}` : '-' }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderExtractionRuns.autoCreateApproved')">
|
||||
{{ routeItem.auto_create_approved == null ? '-' : t(routeItem.auto_create_approved ? 'admin.shippingOrderExtractionRuns.yes' : 'admin.shippingOrderExtractionRuns.no') }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderExtractionRuns.fallbackReasons')">
|
||||
{{ routeItem.fallback_reason_codes.length ? routeItem.fallback_reason_codes.map(code => t(`admin.shippingOrderExtractionRuns.reasonCodes.${code}`)).join(';') : '-' }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</section>
|
||||
</div>
|
||||
<p v-if="!detail.units.length" class="muted-cell">{{ t('admin.shippingOrderExtractionRuns.empty') }}</p>
|
||||
</div>
|
||||
|
||||
<h3 class="drawer-heading">{{ t('admin.shippingOrderExtractionRuns.lifecycle') }}</h3>
|
||||
<div class="stack-list">
|
||||
<div
|
||||
v-for="event in detail.progress_events"
|
||||
:key="`${event.sequence_no}:${event.event_code}`"
|
||||
class="stack-card stack-card__line"
|
||||
>
|
||||
<b>{{ event.event_code }}</b>
|
||||
<span class="muted-cell">{{ event.status || '-' }}</span>
|
||||
<span class="mono-cell muted-cell">{{ t(`admin.shippingOrderExtractionRuns.visibilities.${event.visibility}`) }}</span>
|
||||
<span v-if="event.reason_code" class="mono-cell muted-cell">{{ event.reason_code }}</span>
|
||||
<time class="muted-cell">{{ formatTime(event.occurred_at) }}</time>
|
||||
</div>
|
||||
<p v-if="!detail.progress_events.length" class="muted-cell">{{ t('admin.shippingOrderExtractionRuns.empty') }}</p>
|
||||
</div>
|
||||
</template>
|
||||
</el-drawer>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* 全宽布局:水平内边距由 AdminLayout 壳层统一持有,页面只保留内部块间距 */
|
||||
.extraction-runs-page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.page-header {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.page-title {
|
||||
margin: 0;
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.page-desc {
|
||||
margin: 4px 0 0;
|
||||
max-width: 48rem;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 13px;
|
||||
line-height: 1.55;
|
||||
}
|
||||
|
||||
/* 健康聚合面板:md 及以上 4 列,之下逐列堆叠 */
|
||||
.health-panel {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 12px;
|
||||
padding: 16px;
|
||||
border: 1px solid var(--el-border-color-light);
|
||||
border-radius: 10px;
|
||||
background: var(--el-bg-color);
|
||||
}
|
||||
|
||||
.health-panel__skeleton,
|
||||
.health-panel__footnote,
|
||||
.health-panel__unavailable {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.health-stat__label {
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.health-stat__value {
|
||||
margin-top: 4px;
|
||||
color: var(--el-text-color-primary);
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.health-stat__value.is-healthy {
|
||||
color: var(--el-color-success);
|
||||
}
|
||||
|
||||
.health-stat__value.is-degraded {
|
||||
color: var(--el-color-warning);
|
||||
}
|
||||
|
||||
.health-panel__footnote {
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.health-panel__stale {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.health-panel__unavailable {
|
||||
margin: 0;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
/* 筛选一行化:下拉 + 复选 + 总数,@change 即查 */
|
||||
.filter-bar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 12px;
|
||||
border: 1px solid var(--el-border-color-light);
|
||||
border-radius: 10px;
|
||||
background: var(--el-bg-color);
|
||||
}
|
||||
|
||||
.filter-bar__label {
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.filter-bar__select {
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
.filter-bar__total {
|
||||
margin-left: auto;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.mono-cell {
|
||||
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.muted-cell {
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.danger-cell {
|
||||
color: var(--el-color-danger);
|
||||
}
|
||||
|
||||
/* 行内动作:详情 + 行内取消小表单(danger 淡底卡片) */
|
||||
.run-actions {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.cancel-form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
width: 240px;
|
||||
padding: 8px;
|
||||
border: 1px solid var(--el-color-danger-light-5);
|
||||
border-radius: 8px;
|
||||
background: var(--el-color-danger-light-9);
|
||||
}
|
||||
|
||||
.cancel-form__label {
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.cancel-form__buttons {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.cancel-form__buttons .el-button + .el-button {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.runs-pager {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
/* 详情抽屉:键值对 el-descriptions + 卡片式清单 */
|
||||
.drawer-section {
|
||||
margin-top: 20px;
|
||||
padding: 14px;
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.drawer-section__title {
|
||||
margin: 0 0 12px;
|
||||
color: var(--el-text-color-primary);
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.drawer-section__sub {
|
||||
margin-top: 12px;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.reason-tags {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.drawer-heading {
|
||||
margin: 24px 0 8px;
|
||||
color: var(--el-text-color-primary);
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.stack-list {
|
||||
display: grid;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.stack-card {
|
||||
padding: 10px 12px;
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: 8px;
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 13px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.stack-card b {
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
|
||||
.stack-card__line > span {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.stack-card__line > b + span {
|
||||
margin-left: 4px;
|
||||
}
|
||||
|
||||
.nested-section {
|
||||
margin-top: 12px;
|
||||
padding: 10px;
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: 8px;
|
||||
background: var(--el-fill-color-lighter);
|
||||
}
|
||||
|
||||
.nested-section__title {
|
||||
margin: 0 0 8px;
|
||||
color: var(--el-color-primary);
|
||||
font-size: 12px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.health-panel {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
+387
-397
File diff suppressed because it is too large.
Load diff
+47
-21
@@ -1,11 +1,17 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-schema/components/SchemaAuditTimeline.vue
|
||||
用途:展示订单 Schema 配置的追加式审计时间线。
|
||||
依赖:ShippingOrderSchemaAuditEvent DTO、Vue I18n。
|
||||
依赖:element-plus(el-timeline 时间线/el-tag 徽标/el-button 加载更多/el-empty 空态,
|
||||
沿用管理端 element-trial 主题)、ShippingOrderSchemaAuditEvent DTO、Vue I18n。
|
||||
逻辑:父组件分页读取最小审计摘要;展示字段集合变更与自动建单策略变更,不展示完整快照。
|
||||
视觉层已迁移 Element Plus,props/emit 契约保持不变。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElButton, ElEmpty, ElTag, ElTimeline, ElTimelineItem } from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import type { ShippingOrderSchemaAuditEvent } from '@/features/admin/types/shipping-order-schema.types';
|
||||
|
||||
defineProps<{ events: ShippingOrderSchemaAuditEvent[]; total: number; loading: boolean }>();
|
||||
@@ -82,28 +88,48 @@ const autoCreationSummary = (event: ShippingOrderSchemaAuditEvent): string => {
|
||||
|
||||
<template>
|
||||
<section class="audit-timeline" :aria-label="t('admin.shippingOrderSchema.auditTitle')">
|
||||
<div class="audit-heading"><span>{{ t('admin.shippingOrderSchema.auditTitle') }}</span><small>{{ total }}</small></div>
|
||||
<p v-if="!events.length && !loading" class="audit-empty">{{ t('admin.shippingOrderSchema.auditEmpty') }}</p>
|
||||
<article v-for="event in events" :key="event.id" class="audit-event">
|
||||
<strong>{{ eventLabel(event.event_type) }}</strong><span v-if="event.version">V{{ event.version.version }}</span>
|
||||
<p>{{ formatDate(event.created_at) }} · {{ event.actor?.display_name || t('admin.shippingOrderSchema.historyUnknownActor') }}</p>
|
||||
<small v-if="hasFieldChanges(event)">{{ t('admin.shippingOrderSchema.auditFieldSummary', { added: (event.change_summary.added_field_ids as string[] | undefined)?.length || 0, removed: (event.change_summary.removed_field_ids as string[] | undefined)?.length || 0, changed: (event.change_summary.changed_field_ids as string[] | undefined)?.length || 0 }) }}</small>
|
||||
<small v-if="hasAutoCreationChange(event) && autoCreationSummary(event)" class="audit-auto-creation">{{ autoCreationSummary(event) }}</small>
|
||||
</article>
|
||||
<button v-if="events.length < total" type="button" :disabled="loading" @click="emit('loadMore')">{{ loading ? t('common.loading') : t('admin.shippingOrderSchema.auditLoadMore') }}</button>
|
||||
<div class="audit-heading">
|
||||
<span>{{ t('admin.shippingOrderSchema.auditTitle') }}</span>
|
||||
<el-tag size="small" effect="plain" round>{{ total }}</el-tag>
|
||||
</div>
|
||||
<el-empty
|
||||
v-if="!events.length && !loading"
|
||||
:description="t('admin.shippingOrderSchema.auditEmpty')"
|
||||
:image-size="60"
|
||||
/>
|
||||
<el-timeline v-else class="audit-events">
|
||||
<el-timeline-item
|
||||
v-for="event in events"
|
||||
:key="event.id"
|
||||
:timestamp="formatDate(event.created_at)"
|
||||
placement="top"
|
||||
>
|
||||
<article class="audit-event">
|
||||
<strong>{{ eventLabel(event.event_type) }}</strong>
|
||||
<el-tag v-if="event.version" size="small" effect="plain">V{{ event.version.version }}</el-tag>
|
||||
<p>{{ event.actor?.display_name || t('admin.shippingOrderSchema.historyUnknownActor') }}</p>
|
||||
<small v-if="hasFieldChanges(event)">{{ t('admin.shippingOrderSchema.auditFieldSummary', { added: (event.change_summary.added_field_ids as string[] | undefined)?.length || 0, removed: (event.change_summary.removed_field_ids as string[] | undefined)?.length || 0, changed: (event.change_summary.changed_field_ids as string[] | undefined)?.length || 0 }) }}</small>
|
||||
<small v-if="hasAutoCreationChange(event) && autoCreationSummary(event)" class="audit-auto-creation">{{ autoCreationSummary(event) }}</small>
|
||||
</article>
|
||||
</el-timeline-item>
|
||||
</el-timeline>
|
||||
<el-button
|
||||
v-if="events.length < total"
|
||||
class="audit-more"
|
||||
:disabled="loading"
|
||||
@click="emit('loadMore')"
|
||||
>
|
||||
{{ loading ? t('common.loading') : t('admin.shippingOrderSchema.auditLoadMore') }}
|
||||
</el-button>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.audit-timeline { margin-top: 22px; border-top: 1px solid #e5ebf1; padding-top: 18px; }
|
||||
.audit-heading { display: flex; align-items: center; gap: 8px; color: #64748b; font-size: 12px; font-weight: 700; }
|
||||
.audit-heading small { border-radius: 999px; background: #e0f2fe; padding: 2px 7px; color: #0369a1; }
|
||||
.audit-event { position: relative; margin: 10px 0 0 6px; border-left: 2px solid #bae6fd; padding: 0 0 10px 13px; }
|
||||
.audit-event::before { position: absolute; top: 3px; left: -5px; width: 8px; height: 8px; border-radius: 50%; background: #0ea5e9; content: ''; }
|
||||
.audit-event strong { color: #334155; font-size: 12px; }
|
||||
.audit-event > span { margin-left: 6px; color: #0369a1; font-size: 11px; }
|
||||
.audit-event p, .audit-event small { display: block; margin: 4px 0 0; color: #94a3b8; font-size: 11px; }
|
||||
.audit-auto-creation { color: #0f766e !important; }
|
||||
.audit-timeline > button { width: 100%; border: 1px dashed #cbd5e1; border-radius: 7px; background: transparent; padding: 8px; color: #0284c7; font: inherit; font-size: 12px; cursor: pointer; }
|
||||
.audit-empty { color: #94a3b8; font-size: 12px; }
|
||||
.audit-timeline { margin-top: 22px; border-top: 1px solid var(--el-border-color-lighter); padding-top: 18px; }
|
||||
.audit-heading { display: flex; align-items: center; gap: 8px; color: var(--el-text-color-secondary); font-size: 12px; font-weight: 700; }
|
||||
.audit-events { padding-left: 2px; }
|
||||
.audit-event strong { margin-right: 6px; color: var(--el-text-color-regular); font-size: 12px; }
|
||||
.audit-event p, .audit-event small { display: block; margin: 4px 0 0; color: var(--el-text-color-placeholder); font-size: 12px; }
|
||||
.audit-auto-creation { color: var(--el-color-success) !important; }
|
||||
.audit-more { width: 100%; margin-top: 12px; }
|
||||
</style>
|
||||
+66
-21
@@ -1,12 +1,19 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-schema/components/SchemaExtractionAuditDrawer.vue
|
||||
用途:以只读方式展示一条订单解析的冻结输入、LLM 输出、裁决和字段证据。
|
||||
依赖:ShippingOrderExtractionAudit DTO、Vue I18n。
|
||||
依赖:element-plus(el-drawer 抽屉/el-descriptions 键值对/el-tag 状态徽标/el-alert 缺快照横幅/
|
||||
el-skeleton 骨架/el-empty 空态,沿用管理端 element-trial 主题)、
|
||||
ShippingOrderExtractionAudit DTO、Vue I18n。
|
||||
逻辑:复杂运行数据由服务端完整组装;组件使用 JSON 预格式化展示,禁止在审计视图编辑或重放解析。
|
||||
视觉层已迁移 Element Plus,v-model 对外契约保持不变。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElAlert, ElDescriptions, ElDescriptionsItem, ElDrawer, ElEmpty, ElSkeleton, ElTag } from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import type { ShippingOrderExtractionAudit } from '@/features/admin/types/shipping-order-schema.types';
|
||||
|
||||
const props = defineProps<{ modelValue: boolean; audit: ShippingOrderExtractionAudit | null; loading: boolean }>();
|
||||
@@ -19,27 +26,65 @@ const documents = computed(() => Array.isArray(props.audit?.input_snapshot.docum
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<div v-if="modelValue" class="audit-detail-layer" role="presentation" @click.self="emit('update:modelValue', false)">
|
||||
<aside class="audit-detail-drawer" role="dialog" aria-modal="true" :aria-label="t('admin.shippingOrderSchema.runtimeAuditTitle')">
|
||||
<header><div><p>{{ t('admin.shippingOrderSchema.runtimeAuditEyebrow') }}</p><h2>{{ t('admin.shippingOrderSchema.runtimeAuditTitle') }}</h2></div><button type="button" :aria-label="t('common.close')" @click="emit('update:modelValue', false)">×</button></header>
|
||||
<main v-if="loading" class="audit-detail-empty">{{ t('common.loading') }}</main>
|
||||
<main v-else-if="audit">
|
||||
<dl class="audit-meta"><div><dt>{{ t('admin.shippingOrderSchema.runtimeAuditExtraction') }}</dt><dd>#{{ audit.extraction.id }}</dd></div><div><dt>{{ t('admin.shippingOrderSchema.runtimeAuditVersion') }}</dt><dd>V{{ audit.schema_version.version }}</dd></div><div><dt>{{ t('admin.shippingOrderSchema.runtimeAuditStatus') }}</dt><dd>{{ t(`admin.shippingOrderSchema.extractionStatus.${audit.extraction.status}`) }}</dd></div><div><dt>{{ t('admin.shippingOrderSchema.runtimeAuditHash') }}</dt><dd><code>{{ audit.extraction.input_snapshot_hash }}</code></dd></div></dl>
|
||||
<section><h3>{{ t('admin.shippingOrderSchema.runtimeAuditInput') }}</h3><p v-if="audit.input_snapshot.snapshot_available === false" class="snapshot-unavailable">{{ t('admin.shippingOrderSchema.runtimeAuditInputUnavailable') }}</p><article v-for="document in documents" :key="String(document.id)" class="audit-document"><strong>{{ String(document.filename || document.id) }}</strong><pre>{{ String(document.extracted_text || '') }}</pre></article></section>
|
||||
<section><h3>{{ t('admin.shippingOrderSchema.runtimeAuditLlm') }}</h3><pre>{{ json(audit.raw_llm_output) }}</pre></section>
|
||||
<section><h3>{{ t('admin.shippingOrderSchema.runtimeAuditNormalized') }}</h3><pre>{{ json(audit.normalized_result) }}</pre></section>
|
||||
<section><h3>{{ t('admin.shippingOrderSchema.runtimeAuditValidation') }}</h3><pre>{{ json(audit.validation_result) }}</pre></section>
|
||||
<section><h3>{{ t('admin.shippingOrderSchema.runtimeAuditDecisions') }} ({{ audit.decisions.length }})</h3><pre>{{ json(audit.decisions) }}</pre></section>
|
||||
<section><h3>{{ t('admin.shippingOrderSchema.runtimeAuditEvidence') }} ({{ audit.observations.length }})</h3><pre>{{ json(audit.observations) }}</pre></section>
|
||||
<section><h3>{{ t('admin.shippingOrderSchema.runtimeAuditValues') }} ({{ audit.field_values.length }})</h3><pre>{{ json(audit.field_values) }}</pre></section>
|
||||
</main>
|
||||
<main v-else class="audit-detail-empty">{{ t('admin.shippingOrderSchema.runtimeAuditEmpty') }}</main>
|
||||
</aside>
|
||||
</div>
|
||||
</Teleport>
|
||||
<el-drawer
|
||||
:model-value="modelValue"
|
||||
size="min(900px, 97vw)"
|
||||
resizable
|
||||
destroy-on-close
|
||||
@update:model-value="emit('update:modelValue', $event)"
|
||||
>
|
||||
<template #header>
|
||||
<div class="drawer-heading">
|
||||
<p>{{ t('admin.shippingOrderSchema.runtimeAuditEyebrow') }}</p>
|
||||
<h2>{{ t('admin.shippingOrderSchema.runtimeAuditTitle') }}</h2>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-skeleton v-if="loading" :rows="6" animated />
|
||||
<template v-else-if="audit">
|
||||
<el-descriptions class="audit-meta" :column="2" size="small">
|
||||
<el-descriptions-item :label="t('admin.shippingOrderSchema.runtimeAuditExtraction')">#{{ audit.extraction.id }}</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderSchema.runtimeAuditVersion')">V{{ audit.schema_version.version }}</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderSchema.runtimeAuditStatus')">
|
||||
<el-tag size="small">{{ t(`admin.shippingOrderSchema.extractionStatus.${audit.extraction.status}`) }}</el-tag>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderSchema.runtimeAuditHash')">
|
||||
<code>{{ audit.extraction.input_snapshot_hash }}</code>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<section>
|
||||
<h3>{{ t('admin.shippingOrderSchema.runtimeAuditInput') }}</h3>
|
||||
<el-alert
|
||||
v-if="audit.input_snapshot.snapshot_available === false"
|
||||
:title="t('admin.shippingOrderSchema.runtimeAuditInputUnavailable')"
|
||||
type="warning"
|
||||
:closable="false"
|
||||
/>
|
||||
<article v-for="document in documents" :key="String(document.id)" class="audit-document">
|
||||
<strong>{{ String(document.filename || document.id) }}</strong>
|
||||
<pre>{{ String(document.extracted_text || '') }}</pre>
|
||||
</article>
|
||||
</section>
|
||||
<section><h3>{{ t('admin.shippingOrderSchema.runtimeAuditLlm') }}</h3><pre>{{ json(audit.raw_llm_output) }}</pre></section>
|
||||
<section><h3>{{ t('admin.shippingOrderSchema.runtimeAuditNormalized') }}</h3><pre>{{ json(audit.normalized_result) }}</pre></section>
|
||||
<section><h3>{{ t('admin.shippingOrderSchema.runtimeAuditValidation') }}</h3><pre>{{ json(audit.validation_result) }}</pre></section>
|
||||
<section><h3>{{ t('admin.shippingOrderSchema.runtimeAuditDecisions') }} ({{ audit.decisions.length }})</h3><pre>{{ json(audit.decisions) }}</pre></section>
|
||||
<section><h3>{{ t('admin.shippingOrderSchema.runtimeAuditEvidence') }} ({{ audit.observations.length }})</h3><pre>{{ json(audit.observations) }}</pre></section>
|
||||
<section><h3>{{ t('admin.shippingOrderSchema.runtimeAuditValues') }} ({{ audit.field_values.length }})</h3><pre>{{ json(audit.field_values) }}</pre></section>
|
||||
</template>
|
||||
<el-empty v-else :description="t('admin.shippingOrderSchema.runtimeAuditEmpty')" :image-size="60" />
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.audit-detail-layer { position: fixed; z-index: 90; inset: 0; display: flex; justify-content: flex-end; background: rgb(15 23 42 / 40%); backdrop-filter: blur(2px); }.audit-detail-drawer { display: flex; width: min(900px, 97vw); height: 100%; flex-direction: column; overflow: hidden; background: #f8fafc; box-shadow: -18px 0 48px rgb(15 23 42 / 22%); }.audit-detail-drawer > header { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #e2e8f0; background: #fff; padding: 22px 26px; }.audit-detail-drawer header p { margin: 0 0 4px; color: #0284c7; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }.audit-detail-drawer h2 { margin: 0; color: #1e293b; font-size: 20px; }.audit-detail-drawer > header button { width: 32px; height: 32px; border: 1px solid #dbe5ee; border-radius: 50%; background: #fff; color: #475569; font-size: 22px; line-height: 1; cursor: pointer; }.audit-detail-drawer main { overflow-y: auto; padding: 24px 26px; }.audit-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 20px; }.audit-meta div { border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; padding: 10px; }.audit-meta dt { color: #94a3b8; font-size: 10px; }.audit-meta dd { margin: 5px 0 0; color: #334155; font-size: 12px; overflow-wrap: anywhere; }.audit-detail-drawer section { margin-top: 18px; }.audit-detail-drawer h3 { margin: 0 0 8px; color: #64748b; font-size: 12px; }.audit-detail-drawer pre { overflow: auto; max-height: 340px; margin: 0; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; padding: 12px; color: #334155; font: 11px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }.audit-document { margin-top: 8px; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; padding: 12px; }.audit-document strong { color: #334155; font-size: 12px; }.audit-document pre { max-height: 220px; margin-top: 8px; border: 0; background: #f8fafc; }.snapshot-unavailable { margin: 0; border: 1px solid #fde68a; border-radius: 7px; background: #fffbeb; padding: 9px; color: #a16207; font-size: 12px; }.audit-detail-empty { display: grid; min-height: 240px; place-items: center; color: #94a3b8; font-size: 13px; }@media (max-width: 640px) { .audit-detail-drawer main { padding: 18px; }.audit-meta { grid-template-columns: 1fr; } }
|
||||
.drawer-heading p { margin: 0 0 4px; color: var(--el-color-primary); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
|
||||
.drawer-heading h2 { margin: 0; color: var(--el-text-color-primary); font-size: 20px; }
|
||||
.audit-meta { margin: 0 0 20px; }
|
||||
.audit-meta code { color: var(--el-color-primary); font-size: 12px; }
|
||||
section { margin-top: 18px; }
|
||||
section > h3 { margin: 0 0 8px; color: var(--el-text-color-secondary); font-size: 12px; }
|
||||
pre { overflow: auto; max-height: 340px; margin: 0; border: 1px solid var(--el-border-color-lighter); border-radius: 8px; background: var(--el-bg-color); padding: 12px; color: var(--el-text-color-regular); font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
|
||||
.audit-document { margin-top: 8px; border: 1px solid var(--el-border-color-lighter); border-radius: 8px; background: var(--el-bg-color); padding: 12px; }
|
||||
.audit-document strong { color: var(--el-text-color-regular); font-size: 12px; }
|
||||
.audit-document pre { max-height: 220px; margin-top: 8px; border: 0; background: var(--el-fill-color-light); }
|
||||
</style>
|
||||
+71
-22
@@ -1,12 +1,18 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-schema/components/SchemaVersionDiffDrawer.vue
|
||||
用途:只读展示两个订单 Schema 版本的服务端语义化字段差异。
|
||||
依赖:ShippingOrderSchemaVersionDiff DTO、Vue I18n。
|
||||
依赖:element-plus(el-drawer 抽屉/el-tag 差异徽标/el-skeleton 骨架/el-empty 空态,
|
||||
沿用管理端 element-trial 主题)、ShippingOrderSchemaVersionDiff DTO、Vue I18n。
|
||||
逻辑:父组件负责加载差异;本组件只根据后端 field_id 差异结构渲染,绝不自行推断字段是否重命名。
|
||||
视觉层已迁移 Element Plus,v-model 对外契约保持不变。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElDrawer, ElEmpty, ElSkeleton, ElTag } from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import type {
|
||||
ShippingOrderSchemaFieldChange,
|
||||
ShippingOrderSchemaFieldDiff,
|
||||
@@ -41,28 +47,71 @@ const valueText = (value: unknown): string => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<div v-if="modelValue" class="diff-layer" role="presentation" @click.self="emit('update:modelValue', false)">
|
||||
<aside class="diff-drawer" role="dialog" aria-modal="true" :aria-label="t('admin.shippingOrderSchema.diffTitle')">
|
||||
<header><div><p>{{ t('admin.shippingOrderSchema.diffEyebrow') }}</p><h2>{{ t('admin.shippingOrderSchema.diffTitle') }}</h2></div><button type="button" :aria-label="t('common.close')" @click="emit('update:modelValue', false)">×</button></header>
|
||||
<main v-if="loading" class="empty">{{ t('common.loading') }}</main>
|
||||
<main v-else-if="diff">
|
||||
<p class="comparison">V{{ diff.base_version.version }} {{ t('admin.shippingOrderSchema.diffComparedWith') }} V{{ diff.compare_version.version }}</p>
|
||||
<div class="summary"><span v-for="key in ['added', 'removed', 'modified']" :key="key">{{ t(`admin.shippingOrderSchema.diffStatus.${key}`) }} <b>{{ diff.summary[key as 'added' | 'removed' | 'modified'] }}</b></span></div>
|
||||
<article v-for="field in changedFields" :key="field.field_id" class="diff-field" :class="field.change_type">
|
||||
<header><div><strong>{{ fieldLabel(field) }}</strong><code>{{ field.after?.field_code || field.before?.field_code }}</code></div><span>{{ t(`admin.shippingOrderSchema.diffStatus.${field.change_type}`) }}</span></header>
|
||||
<template v-if="field.change_type === 'added'"><p>{{ t('admin.shippingOrderSchema.diffAddedField') }}</p></template>
|
||||
<template v-else-if="field.change_type === 'removed'"><p>{{ t('admin.shippingOrderSchema.diffRemovedField') }}</p></template>
|
||||
<dl v-else><div v-for="change in field.changes" :key="change.key"><dt>{{ changeLabel(change) }}</dt><dd><del>{{ valueText(change.before) }}</del><ins>{{ valueText(change.after) }}</ins><small v-if="change.order_changed">{{ t('admin.shippingOrderSchema.diffOrderChanged') }}</small></dd></div></dl>
|
||||
</article>
|
||||
<p v-if="!changedFields.length" class="empty">{{ t('admin.shippingOrderSchema.diffNoChanges') }}</p>
|
||||
</main>
|
||||
<main v-else class="empty">{{ t('admin.shippingOrderSchema.diffNoChanges') }}</main>
|
||||
</aside>
|
||||
</div>
|
||||
</Teleport>
|
||||
<el-drawer
|
||||
:model-value="modelValue"
|
||||
size="min(760px, 96vw)"
|
||||
resizable
|
||||
destroy-on-close
|
||||
@update:model-value="emit('update:modelValue', $event)"
|
||||
>
|
||||
<template #header>
|
||||
<div class="drawer-heading">
|
||||
<p>{{ t('admin.shippingOrderSchema.diffEyebrow') }}</p>
|
||||
<h2>{{ t('admin.shippingOrderSchema.diffTitle') }}</h2>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-skeleton v-if="loading" :rows="6" animated />
|
||||
<template v-else-if="diff">
|
||||
<p class="comparison">V{{ diff.base_version.version }} {{ t('admin.shippingOrderSchema.diffComparedWith') }} V{{ diff.compare_version.version }}</p>
|
||||
<div class="summary">
|
||||
<el-tag size="small" type="success">{{ t('admin.shippingOrderSchema.diffStatus.added') }} {{ diff.summary.added }}</el-tag>
|
||||
<el-tag size="small" type="danger">{{ t('admin.shippingOrderSchema.diffStatus.removed') }} {{ diff.summary.removed }}</el-tag>
|
||||
<el-tag size="small">{{ t('admin.shippingOrderSchema.diffStatus.modified') }} {{ diff.summary.modified }}</el-tag>
|
||||
</div>
|
||||
<article v-for="field in changedFields" :key="field.field_id" class="diff-field" :class="field.change_type">
|
||||
<header>
|
||||
<div>
|
||||
<strong>{{ fieldLabel(field) }}</strong>
|
||||
<code>{{ field.after?.field_code || field.before?.field_code }}</code>
|
||||
</div>
|
||||
<el-tag size="small" :type="field.change_type === 'added' ? 'success' : field.change_type === 'removed' ? 'danger' : 'primary'">
|
||||
{{ t(`admin.shippingOrderSchema.diffStatus.${field.change_type}`) }}
|
||||
</el-tag>
|
||||
</header>
|
||||
<template v-if="field.change_type === 'added'"><p>{{ t('admin.shippingOrderSchema.diffAddedField') }}</p></template>
|
||||
<template v-else-if="field.change_type === 'removed'"><p>{{ t('admin.shippingOrderSchema.diffRemovedField') }}</p></template>
|
||||
<dl v-else><div v-for="change in field.changes" :key="change.key"><dt>{{ changeLabel(change) }}</dt><dd><del>{{ valueText(change.before) }}</del><ins>{{ valueText(change.after) }}</ins><small v-if="change.order_changed">{{ t('admin.shippingOrderSchema.diffOrderChanged') }}</small></dd></div></dl>
|
||||
</article>
|
||||
<el-empty
|
||||
v-if="!changedFields.length"
|
||||
:description="t('admin.shippingOrderSchema.diffNoChanges')"
|
||||
:image-size="60"
|
||||
/>
|
||||
</template>
|
||||
<el-empty v-else :description="t('admin.shippingOrderSchema.diffNoChanges')" :image-size="60" />
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.diff-layer { position: fixed; z-index: 80; inset: 0; display: flex; justify-content: flex-end; background: rgb(15 23 42 / 35%); backdrop-filter: blur(2px); }.diff-drawer { display: flex; width: min(760px, 96vw); height: 100%; flex-direction: column; overflow: hidden; background: #f8fafc; box-shadow: -18px 0 48px rgb(15 23 42 / 18%); }.diff-drawer > header { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #e2e8f0; background: #fff; padding: 22px 26px; }.diff-drawer header p { margin: 0 0 4px; color: #0284c7; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }.diff-drawer h2 { margin: 0; color: #1e293b; font-size: 20px; }.diff-drawer > header button { width: 32px; height: 32px; border: 1px solid #dbe5ee; border-radius: 50%; background: #fff; color: #475569; font-size: 22px; line-height: 1; cursor: pointer; }.diff-drawer main { overflow-y: auto; padding: 24px 26px; }.comparison { margin: 0 0 10px; color: #64748b; font-size: 13px; }.summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }.summary span, .diff-field > header > span { border-radius: 999px; background: #e0f2fe; padding: 3px 7px; color: #0369a1; font-size: 11px; }.summary b { margin-left: 3px; }.diff-field { margin-top: 10px; border: 1px solid #e2e8f0; border-left-width: 3px; border-radius: 8px; background: #fff; padding: 13px; }.diff-field.added { border-left-color: #22c55e; }.diff-field.removed { border-left-color: #ef4444; }.diff-field.modified { border-left-color: #0ea5e9; }.diff-field > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }.diff-field strong { display: block; color: #1e293b; font-size: 13px; }.diff-field code { color: #64748b; font-size: 11px; }.diff-field > p { margin: 10px 0 0; color: #64748b; font-size: 12px; }.diff-field dl { display: grid; gap: 8px; margin: 12px 0 0; }.diff-field dl div { display: grid; grid-template-columns: 145px minmax(0, 1fr); gap: 8px; }.diff-field dt { color: #64748b; font-size: 11px; }.diff-field dd { display: grid; gap: 4px; margin: 0; color: #475569; font-size: 12px; overflow-wrap: anywhere; }.diff-field del { color: #b91c1c; text-decoration: line-through; }.diff-field ins { color: #15803d; text-decoration: none; }.diff-field small { color: #a16207; font-size: 10px; }.empty { display: grid; min-height: 240px; place-items: center; color: #94a3b8; font-size: 13px; }@media (max-width: 640px) { .diff-drawer main { padding: 18px; }.diff-field dl div { grid-template-columns: 1fr; gap: 3px; } }
|
||||
.drawer-heading p { margin: 0 0 4px; color: var(--el-color-primary); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
|
||||
.drawer-heading h2 { margin: 0; color: var(--el-text-color-primary); font-size: 20px; }
|
||||
.comparison { margin: 0 0 10px; color: var(--el-text-color-secondary); font-size: 13px; }
|
||||
.summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
|
||||
.diff-field { margin-top: 10px; border: 1px solid var(--el-border-color-lighter); border-left-width: 3px; border-radius: 8px; background: var(--el-bg-color); padding: 13px; }
|
||||
.diff-field.added { border-left-color: var(--el-color-success); }
|
||||
.diff-field.removed { border-left-color: var(--el-color-danger); }
|
||||
.diff-field.modified { border-left-color: var(--el-color-primary); }
|
||||
.diff-field > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
|
||||
.diff-field strong { display: block; color: var(--el-text-color-primary); font-size: 13px; }
|
||||
.diff-field code { color: var(--el-text-color-secondary); font-size: 12px; }
|
||||
.diff-field > p { margin: 10px 0 0; color: var(--el-text-color-secondary); font-size: 12px; }
|
||||
.diff-field dl { display: grid; gap: 8px; margin: 12px 0 0; }
|
||||
.diff-field dl div { display: grid; grid-template-columns: 145px minmax(0, 1fr); gap: 8px; }
|
||||
.diff-field dt { color: var(--el-text-color-secondary); font-size: 12px; }
|
||||
.diff-field dd { display: grid; gap: 4px; margin: 0; color: var(--el-text-color-regular); font-size: 12px; overflow-wrap: anywhere; }
|
||||
.diff-field del { color: var(--el-color-danger); text-decoration: line-through; }
|
||||
.diff-field ins { color: var(--el-color-success); text-decoration: none; }
|
||||
.diff-field small { color: var(--el-color-warning); font-size: 12px; }
|
||||
@media (max-width: 640px) { .diff-field dl div { grid-template-columns: 1fr; gap: 3px; } }
|
||||
</style>
|
||||
+141
-90
@@ -1,12 +1,19 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-schema/components/SchemaVersionHistoryDrawer.vue
|
||||
用途:以时间线和完整只读快照浏览订单 Schema 的草稿、发布及退役版本。
|
||||
依赖:ShippingOrderSchemaVersion DTO、Vue I18n。
|
||||
依赖:element-plus(el-drawer 抽屉/el-tag 状态徽标/el-descriptions 键值对/el-skeleton 骨架/
|
||||
el-button 动作与加载更多/el-empty 空态,沿用管理端 element-trial 主题)、
|
||||
ShippingOrderSchemaVersion DTO、Vue I18n、SchemaAuditTimeline。
|
||||
逻辑:父页面加载版本概要和按需详情;本组件仅展示并发出选择/关闭事件,不修改任何版本配置。
|
||||
视觉层已迁移 Element Plus,model-value 与 select/load-more/compare/usage/copy 事件契约保持不变。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElButton, ElDescriptions, ElDescriptionsItem, ElDrawer, ElEmpty, ElSkeleton, ElTag } from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import SchemaAuditTimeline from '@/features/admin/modules/shipping-order-schema/components/SchemaAuditTimeline.vue';
|
||||
import type { ShippingOrderField, ShippingOrderSchemaVersion } from '@/features/admin/types/shipping-order-schema.types';
|
||||
import type { ShippingOrderSchemaAuditEvent } from '@/features/admin/types/shipping-order-schema.types';
|
||||
@@ -67,100 +74,144 @@ const close = (): void => emit('update:modelValue', false);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<div v-if="modelValue" class="history-layer" role="presentation" @click.self="close">
|
||||
<aside class="history-drawer" role="dialog" aria-modal="true" :aria-label="t('admin.shippingOrderSchema.historyTitle')">
|
||||
<header class="history-header">
|
||||
<div><p>{{ t('admin.shippingOrderSchema.historyEyebrow') }}</p><h2>{{ t('admin.shippingOrderSchema.historyTitle') }}</h2></div>
|
||||
<button type="button" class="history-close" :aria-label="t('common.close')" @click="close">×</button>
|
||||
</header>
|
||||
<el-drawer
|
||||
:model-value="modelValue"
|
||||
size="min(1060px, 96vw)"
|
||||
resizable
|
||||
destroy-on-close
|
||||
@update:model-value="!$event && close()"
|
||||
>
|
||||
<template #header>
|
||||
<div class="drawer-heading">
|
||||
<p>{{ t('admin.shippingOrderSchema.historyEyebrow') }}</p>
|
||||
<h2>{{ t('admin.shippingOrderSchema.historyTitle') }}</h2>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<div class="history-content">
|
||||
<nav class="history-timeline" :aria-label="t('admin.shippingOrderSchema.historyTitle')">
|
||||
<button
|
||||
v-for="item in versions"
|
||||
:key="item.id"
|
||||
type="button"
|
||||
class="history-item"
|
||||
:class="{ selected: selectedVersion?.id === item.id }"
|
||||
@click="emit('select', item.id)"
|
||||
<div class="history-content">
|
||||
<nav class="history-timeline" :aria-label="t('admin.shippingOrderSchema.historyTitle')">
|
||||
<button
|
||||
v-for="item in versions"
|
||||
:key="item.id"
|
||||
type="button"
|
||||
class="history-item"
|
||||
:class="{ selected: selectedVersion?.id === item.id }"
|
||||
@click="emit('select', item.id)"
|
||||
>
|
||||
<span class="history-version">V{{ item.version }}</span>
|
||||
<el-tag size="small" :type="item.status === 'published' ? 'success' : item.status === 'draft' ? 'warning' : 'info'">
|
||||
{{ statusLabel(item.status) }}
|
||||
</el-tag>
|
||||
<strong>{{ item.change_note || t('admin.shippingOrderSchema.historyNoNote') }}</strong>
|
||||
<small>{{ formatDate(item.published_at || item.created_at) }}</small>
|
||||
<small>{{ item.published_by?.display_name || item.created_by?.display_name || t('admin.shippingOrderSchema.historyUnknownActor') }}</small>
|
||||
</button>
|
||||
<el-button
|
||||
v-if="versions.length < total"
|
||||
class="history-more"
|
||||
:disabled="loading"
|
||||
@click="emit('loadMore')"
|
||||
>
|
||||
{{ loading ? t('common.loading') : t('admin.shippingOrderSchema.historyLoadMore') }}
|
||||
</el-button>
|
||||
</nav>
|
||||
|
||||
<section class="history-detail">
|
||||
<el-skeleton v-if="detailLoading" class="detail-skeleton" :rows="6" animated />
|
||||
<template v-else-if="selectedVersion">
|
||||
<header class="detail-heading">
|
||||
<div><p>{{ t('admin.shippingOrderSchema.historyViewing') }}</p><h3>V{{ selectedVersion.version }}</h3></div>
|
||||
<el-tag size="small" type="info">{{ t('admin.shippingOrderSchema.readOnly') }}</el-tag>
|
||||
</header>
|
||||
<el-descriptions class="detail-meta" :column="2" size="small">
|
||||
<el-descriptions-item :label="t('admin.shippingOrderSchema.historyPublishedAt')">{{ formatDate(selectedVersion.published_at || selectedVersion.created_at) }}</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderSchema.historyPublisher')">{{ selectedVersion.published_by?.display_name || selectedVersion.created_by?.display_name || t('admin.shippingOrderSchema.historyUnknownActor') }}</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderSchema.historyChecksum')">
|
||||
<code>{{ selectedVersion.checksum || '-' }}</code>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderSchema.changeNote')">{{ selectedVersion.change_note || t('admin.shippingOrderSchema.historyNoNote') }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<div class="history-actions">
|
||||
<el-button
|
||||
v-if="comparisonTarget"
|
||||
type="primary"
|
||||
plain
|
||||
size="small"
|
||||
@click="emit('compare', selectedVersion.id)"
|
||||
>
|
||||
<span class="history-version">V{{ item.version }}</span>
|
||||
<span class="history-status" :class="item.status">{{ statusLabel(item.status) }}</span>
|
||||
<strong>{{ item.change_note || t('admin.shippingOrderSchema.historyNoNote') }}</strong>
|
||||
<small>{{ formatDate(item.published_at || item.created_at) }}</small>
|
||||
<small>{{ item.published_by?.display_name || item.created_by?.display_name || t('admin.shippingOrderSchema.historyUnknownActor') }}</small>
|
||||
</button>
|
||||
<button v-if="versions.length < total" type="button" class="history-more" :disabled="loading" @click="emit('loadMore')">
|
||||
{{ loading ? t('common.loading') : t('admin.shippingOrderSchema.historyLoadMore') }}
|
||||
</button>
|
||||
</nav>
|
||||
|
||||
<section class="history-detail">
|
||||
<div v-if="detailLoading" class="history-empty">{{ t('common.loading') }}</div>
|
||||
<template v-else-if="selectedVersion">
|
||||
<header class="detail-heading">
|
||||
<div><p>{{ t('admin.shippingOrderSchema.historyViewing') }}</p><h3>V{{ selectedVersion.version }}</h3></div>
|
||||
<span class="detail-readonly">{{ t('admin.shippingOrderSchema.readOnly') }}</span>
|
||||
</header>
|
||||
<dl class="detail-meta">
|
||||
<div><dt>{{ t('admin.shippingOrderSchema.historyPublishedAt') }}</dt><dd>{{ formatDate(selectedVersion.published_at || selectedVersion.created_at) }}</dd></div>
|
||||
<div><dt>{{ t('admin.shippingOrderSchema.historyPublisher') }}</dt><dd>{{ selectedVersion.published_by?.display_name || selectedVersion.created_by?.display_name || t('admin.shippingOrderSchema.historyUnknownActor') }}</dd></div>
|
||||
<div><dt>{{ t('admin.shippingOrderSchema.historyChecksum') }}</dt><dd><code>{{ selectedVersion.checksum || '-' }}</code></dd></div>
|
||||
<div><dt>{{ t('admin.shippingOrderSchema.changeNote') }}</dt><dd>{{ selectedVersion.change_note || t('admin.shippingOrderSchema.historyNoNote') }}</dd></div>
|
||||
</dl>
|
||||
<button v-if="comparisonTarget" type="button" class="compare-button" @click="emit('compare', selectedVersion.id)">
|
||||
{{ t('admin.shippingOrderSchema.diffWithCurrent', { version: comparisonTarget.version }) }}
|
||||
</button>
|
||||
<div class="history-actions">
|
||||
<button type="button" class="compare-button" @click="emit('usage', selectedVersion.id)">{{ t('admin.shippingOrderSchema.usageOpen') }}</button>
|
||||
<button v-if="selectedVersion.status !== 'draft'" type="button" class="compare-button" :disabled="copying" @click="emit('copy', selectedVersion.id)">{{ t('admin.shippingOrderSchema.copyToDraft') }}</button>
|
||||
</div>
|
||||
<div class="snapshot-heading"><span>{{ t('admin.shippingOrderSchema.historySnapshotFields') }}</span><b>{{ fields.length }}</b></div>
|
||||
<article v-for="field in fields" :key="field.field_id" class="snapshot-field" :class="{ excluded: field.enabled === false }">
|
||||
<div class="snapshot-field-title"><strong>{{ field.display_name }}</strong><code>{{ field.field_code }}</code><span v-if="field.enabled === false">{{ t('admin.shippingOrderSchema.historyExcluded') }}</span></div>
|
||||
<p>{{ field.scope === 'header' ? t('admin.shippingOrderSchema.placementHeader') : t('admin.shippingOrderSchema.placementLine') }} · {{ t(`admin.shippingOrderSchema.fieldType.${field.value_type}`) }}</p>
|
||||
<dl v-if="field.field_category === 'general_context'"><div><dt>{{ t('admin.shippingOrderSchema.contextSource') }}</dt><dd>{{ contextSourceLabel(field) }}</dd></div><div><dt>{{ t('admin.shippingOrderSchema.deterministicCollection') }}</dt><dd>{{ t('admin.shippingOrderSchema.deterministicCollectionHint') }}</dd></div></dl>
|
||||
<dl v-else><div><dt>{{ t('admin.shippingOrderSchema.aliases') }}</dt><dd>{{ field.aliases.join(', ') || '-' }}</dd></div><div><dt>{{ t('admin.shippingOrderSchema.extractionInstruction') }}</dt><dd>{{ field.extraction_instruction || '-' }}</dd></div></dl>
|
||||
</article>
|
||||
<SchemaAuditTimeline
|
||||
:events="auditEvents"
|
||||
:total="auditTotal"
|
||||
:loading="auditLoading"
|
||||
@load-more="emit('loadMoreAudit')"
|
||||
/>
|
||||
</template>
|
||||
<div v-else class="history-empty">{{ t('admin.shippingOrderSchema.historySelectVersion') }}</div>
|
||||
</section>
|
||||
</div>
|
||||
</aside>
|
||||
{{ t('admin.shippingOrderSchema.diffWithCurrent', { version: comparisonTarget.version }) }}
|
||||
</el-button>
|
||||
<el-button size="small" @click="emit('usage', selectedVersion.id)">
|
||||
{{ t('admin.shippingOrderSchema.usageOpen') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="selectedVersion.status !== 'draft'"
|
||||
size="small"
|
||||
:loading="copying"
|
||||
@click="emit('copy', selectedVersion.id)"
|
||||
>
|
||||
{{ t('admin.shippingOrderSchema.copyToDraft') }}
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="snapshot-heading">
|
||||
<span>{{ t('admin.shippingOrderSchema.historySnapshotFields') }}</span>
|
||||
<el-tag size="small" effect="plain" round>{{ fields.length }}</el-tag>
|
||||
</div>
|
||||
<article v-for="field in fields" :key="field.field_id" class="snapshot-field" :class="{ excluded: field.enabled === false }">
|
||||
<div class="snapshot-field-title">
|
||||
<strong>{{ field.display_name }}</strong>
|
||||
<code>{{ field.field_code }}</code>
|
||||
<el-tag v-if="field.enabled === false" size="small" type="warning">{{ t('admin.shippingOrderSchema.historyExcluded') }}</el-tag>
|
||||
</div>
|
||||
<p>{{ field.scope === 'header' ? t('admin.shippingOrderSchema.placementHeader') : t('admin.shippingOrderSchema.placementLine') }} · {{ t(`admin.shippingOrderSchema.fieldType.${field.value_type}`) }}</p>
|
||||
<el-descriptions v-if="field.field_category === 'general_context'" :column="2" size="small">
|
||||
<el-descriptions-item :label="t('admin.shippingOrderSchema.contextSource')">{{ contextSourceLabel(field) }}</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderSchema.deterministicCollection')">{{ t('admin.shippingOrderSchema.deterministicCollectionHint') }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-descriptions v-else :column="2" size="small">
|
||||
<el-descriptions-item :label="t('admin.shippingOrderSchema.aliases')">{{ field.aliases.join(', ') || '-' }}</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderSchema.extractionInstruction')">{{ field.extraction_instruction || '-' }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</article>
|
||||
<SchemaAuditTimeline
|
||||
:events="auditEvents"
|
||||
:total="auditTotal"
|
||||
:loading="auditLoading"
|
||||
@load-more="emit('loadMoreAudit')"
|
||||
/>
|
||||
</template>
|
||||
<el-empty v-else :description="t('admin.shippingOrderSchema.historySelectVersion')" :image-size="60" />
|
||||
</section>
|
||||
</div>
|
||||
</Teleport>
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.history-layer { position: fixed; z-index: 70; inset: 0; display: flex; justify-content: flex-end; background: rgb(15 23 42 / 30%); backdrop-filter: blur(2px); }
|
||||
.history-drawer { display: flex; width: min(1060px, 96vw); height: 100%; flex-direction: column; background: #f8fafc; box-shadow: -18px 0 48px rgb(15 23 42 / 18%); }
|
||||
.history-header { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #e2e8f0; background: #fff; padding: 22px 26px; }
|
||||
.history-header p, .detail-heading p { margin: 0 0 4px; color: #0284c7; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
|
||||
.history-header h2, .detail-heading h3 { margin: 0; color: #1e293b; font-size: 20px; }
|
||||
.history-close { width: 32px; height: 32px; border: 1px solid #dbe5ee; border-radius: 50%; background: #fff; color: #475569; font-size: 22px; line-height: 1; cursor: pointer; }
|
||||
.drawer-heading p { margin: 0 0 4px; color: var(--el-color-primary); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
|
||||
.drawer-heading h2 { margin: 0; color: var(--el-text-color-primary); font-size: 20px; }
|
||||
.history-content { display: grid; min-height: 0; flex: 1; grid-template-columns: 290px minmax(0, 1fr); }
|
||||
.history-timeline { overflow-y: auto; border-right: 1px solid #e2e8f0; background: #f1f5f9; padding: 14px 10px; }
|
||||
.history-item { display: grid; width: 100%; gap: 5px; margin-bottom: 6px; border: 1px solid transparent; border-radius: 8px; background: transparent; padding: 12px; color: #475569; font: inherit; text-align: left; cursor: pointer; }
|
||||
.history-item:hover { background: #fff; }
|
||||
.history-item.selected { border-color: #bae6fd; background: #fff; box-shadow: inset 3px 0 #0ea5e9; }
|
||||
.history-version { color: #0f172a; font-size: 16px; font-weight: 700; }
|
||||
.history-status { width: fit-content; border-radius: 999px; padding: 2px 6px; font-size: 10px; font-weight: 700; }
|
||||
.history-status.published { background: #dcfce7; color: #15803d; }.history-status.retired { background: #e2e8f0; color: #475569; }.history-status.draft { background: #fef3c7; color: #a16207; }
|
||||
.history-item strong { overflow: hidden; color: #334155; font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }.history-item small { color: #94a3b8; font-size: 11px; }
|
||||
.history-more { width: 100%; border: 1px dashed #cbd5e1; border-radius: 7px; background: transparent; padding: 8px; color: #0284c7; font: inherit; font-size: 12px; cursor: pointer; }
|
||||
.history-detail { overflow-y: auto; background: #fff; padding: 26px; }.history-empty { display: grid; min-height: 300px; place-items: center; color: #94a3b8; font-size: 13px; }
|
||||
.detail-heading { display: flex; align-items: flex-start; justify-content: space-between; }.detail-readonly { border: 1px solid #cbd5e1; border-radius: 999px; background: #f8fafc; padding: 4px 9px; color: #64748b; font-size: 11px; font-weight: 700; }
|
||||
.detail-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 22px 0; }.detail-meta div { border: 1px solid #e5ebf1; border-radius: 8px; background: #fbfdff; padding: 10px; }.detail-meta dt, .snapshot-field dt { color: #94a3b8; font-size: 10px; }.detail-meta dd, .snapshot-field dd { margin: 5px 0 0; color: #334155; font-size: 12px; overflow-wrap: anywhere; }.detail-meta code { color: #0369a1; font-size: 10px; }
|
||||
.snapshot-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: #64748b; font-size: 12px; font-weight: 700; }.snapshot-heading b { border-radius: 999px; background: #e0f2fe; padding: 2px 7px; color: #0369a1; }
|
||||
.compare-button { margin: -8px 0 16px; border: 1px solid #7dd3fc; border-radius: 6px; background: #f0f9ff; padding: 7px 10px; color: #0369a1; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
|
||||
.history-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: -8px 0 16px; }.history-actions .compare-button { margin: 0; }.compare-button:disabled { cursor: not-allowed; opacity: .55; }
|
||||
.snapshot-field { margin-top: 8px; border: 1px solid #e5ebf1; border-radius: 8px; padding: 13px; }.snapshot-field.excluded { border-style: dashed; opacity: .68; }.snapshot-field-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }.snapshot-field-title strong { color: #1e293b; font-size: 13px; }.snapshot-field-title code { color: #64748b; font-size: 11px; }.snapshot-field-title span { border-radius: 999px; background: #fef3c7; padding: 2px 6px; color: #a16207; font-size: 10px; }.snapshot-field p { margin: 6px 0 10px; color: #94a3b8; font-size: 11px; }.snapshot-field dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
|
||||
@media (max-width: 760px) { .history-drawer { width: 100vw; }.history-content { grid-template-columns: 1fr; }.history-timeline { max-height: 38vh; border-right: 0; border-bottom: 1px solid #e2e8f0; }.detail-meta, .snapshot-field dl { grid-template-columns: 1fr; }.history-detail { padding: 18px; } }
|
||||
.history-timeline { overflow-y: auto; border-right: 1px solid var(--el-border-color-lighter); background: var(--el-fill-color-light); padding: 14px 10px; }
|
||||
.history-item { display: grid; width: 100%; gap: 5px; justify-items: start; margin-bottom: 6px; border: 1px solid transparent; border-radius: 8px; background: transparent; padding: 12px; color: var(--el-text-color-regular); font: inherit; text-align: left; cursor: pointer; }
|
||||
.history-item:hover { background: var(--el-bg-color); }
|
||||
.history-item.selected { border-color: var(--el-color-primary-light-7); background: var(--el-bg-color); box-shadow: inset 3px 0 var(--el-color-primary); }
|
||||
.history-version { color: var(--el-text-color-primary); font-size: 16px; font-weight: 700; }
|
||||
.history-item strong { overflow: hidden; color: var(--el-text-color-regular); font-size: 12px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.history-item small { color: var(--el-text-color-placeholder); font-size: 12px; }
|
||||
.history-more { width: 100%; }
|
||||
.history-detail { overflow-y: auto; background: var(--el-bg-color); padding: 26px; }
|
||||
.detail-skeleton { padding: 8px; }
|
||||
.detail-heading { display: flex; align-items: flex-start; justify-content: space-between; }
|
||||
.detail-heading p { margin: 0 0 4px; color: var(--el-color-primary); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
|
||||
.detail-heading h3 { margin: 0; color: var(--el-text-color-primary); font-size: 20px; }
|
||||
.detail-meta { margin: 22px 0; }
|
||||
.detail-meta code { color: var(--el-color-primary); font-size: 12px; }
|
||||
.snapshot-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; color: var(--el-text-color-secondary); font-size: 12px; font-weight: 700; }
|
||||
.history-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
|
||||
.snapshot-field { margin-top: 8px; border: 1px solid var(--el-border-color-lighter); border-radius: 8px; padding: 13px; }
|
||||
.snapshot-field.excluded { border-style: dashed; opacity: .68; }
|
||||
.snapshot-field-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
|
||||
.snapshot-field-title strong { color: var(--el-text-color-primary); font-size: 13px; }
|
||||
.snapshot-field-title code { color: var(--el-text-color-secondary); font-size: 12px; }
|
||||
.snapshot-field p { margin: 6px 0 10px; color: var(--el-text-color-placeholder); font-size: 12px; }
|
||||
@media (max-width: 760px) { .history-content { grid-template-columns: 1fr; } .history-timeline { max-height: 38vh; border-right: 0; border-bottom: 1px solid var(--el-border-color-lighter); } .history-detail { padding: 18px; } }
|
||||
</style>
|
||||
+66
-22
@@ -1,11 +1,18 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-schema/components/SchemaVersionUsageDrawer.vue
|
||||
用途:展示一个订单 Schema 版本实际参与解析的使用统计和分页运行记录。
|
||||
依赖:ShippingOrderSchemaVersionUsage DTO、Vue I18n。
|
||||
依赖:element-plus(el-drawer 抽屉/el-descriptions 键值对/el-tag 状态徽标/el-skeleton 骨架/
|
||||
el-button 加载更多/el-empty 空态,沿用管理端 element-trial 主题)、
|
||||
ShippingOrderSchemaVersionUsage DTO、Vue I18n。
|
||||
逻辑:父页面负责请求数据和打开单次审计,本组件只展示摘要并发出选择/翻页事件。
|
||||
视觉层已迁移 Element Plus,v-model 与 select/load-more 事件契约保持不变。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElButton, ElDescriptions, ElDescriptionsItem, ElDrawer, ElEmpty, ElSkeleton, ElTag } from 'element-plus';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import type { ShippingOrderSchemaVersionUsage } from '@/features/admin/types/shipping-order-schema.types';
|
||||
|
||||
defineProps<{ modelValue: boolean; usage: ShippingOrderSchemaVersionUsage | null; loading: boolean }>();
|
||||
@@ -19,28 +26,65 @@ const formatDate = (value?: string | null): string => value
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Teleport to="body">
|
||||
<div v-if="modelValue" class="usage-layer" role="presentation" @click.self="emit('update:modelValue', false)">
|
||||
<aside class="usage-drawer" role="dialog" aria-modal="true" :aria-label="t('admin.shippingOrderSchema.usageTitle')">
|
||||
<header><div><p>{{ t('admin.shippingOrderSchema.usageEyebrow') }}</p><h2>{{ t('admin.shippingOrderSchema.usageTitle') }}</h2></div><button type="button" :aria-label="t('common.close')" @click="emit('update:modelValue', false)">×</button></header>
|
||||
<main v-if="loading" class="usage-empty">{{ t('common.loading') }}</main>
|
||||
<main v-else-if="usage">
|
||||
<p class="usage-version">V{{ usage.version.version }}</p>
|
||||
<dl class="usage-summary"><div><dt>{{ t('admin.shippingOrderSchema.usageTotal') }}</dt><dd>{{ usage.summary.total }}</dd></div><div><dt>{{ t('admin.shippingOrderSchema.usageFirst') }}</dt><dd>{{ formatDate(usage.summary.first_used_at) }}</dd></div><div><dt>{{ t('admin.shippingOrderSchema.usageLast') }}</dt><dd>{{ formatDate(usage.summary.last_used_at) }}</dd></div></dl>
|
||||
<div class="usage-statuses"><span v-for="(count, status) in usage.summary.status_counts" :key="status">{{ t(`admin.shippingOrderSchema.extractionStatus.${status}`) }} <b>{{ count }}</b></span></div>
|
||||
<h3>{{ t('admin.shippingOrderSchema.usageRecords') }}</h3>
|
||||
<p v-if="!usage.items.length" class="usage-empty">{{ t('admin.shippingOrderSchema.usageEmpty') }}</p>
|
||||
<button v-for="item in usage.items" :key="item.id" type="button" class="usage-record" @click="emit('select', item.id)">
|
||||
<strong>#{{ item.id }}</strong><span>{{ t(`admin.shippingOrderSchema.extractionStatus.${item.status}`) }}</span><small>{{ formatDate(item.created_at) }} · {{ item.input_snapshot_hash.slice(0, 12) }}</small>
|
||||
</button>
|
||||
<button v-if="usage.items.length < usage.total" type="button" class="usage-more" :disabled="loading" @click="emit('loadMore')">{{ t('admin.shippingOrderSchema.usageLoadMore') }}</button>
|
||||
</main>
|
||||
<main v-else class="usage-empty">{{ t('admin.shippingOrderSchema.usageEmpty') }}</main>
|
||||
</aside>
|
||||
</div>
|
||||
</Teleport>
|
||||
<el-drawer
|
||||
:model-value="modelValue"
|
||||
size="min(680px, 96vw)"
|
||||
resizable
|
||||
destroy-on-close
|
||||
@update:model-value="emit('update:modelValue', $event)"
|
||||
>
|
||||
<template #header>
|
||||
<div class="drawer-heading">
|
||||
<p>{{ t('admin.shippingOrderSchema.usageEyebrow') }}</p>
|
||||
<h2>{{ t('admin.shippingOrderSchema.usageTitle') }}</h2>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-skeleton v-if="loading" :rows="6" animated />
|
||||
<template v-else-if="usage">
|
||||
<p class="usage-version">V{{ usage.version.version }}</p>
|
||||
<el-descriptions class="usage-summary" :column="3" size="small">
|
||||
<el-descriptions-item :label="t('admin.shippingOrderSchema.usageTotal')">{{ usage.summary.total }}</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderSchema.usageFirst')">{{ formatDate(usage.summary.first_used_at) }}</el-descriptions-item>
|
||||
<el-descriptions-item :label="t('admin.shippingOrderSchema.usageLast')">{{ formatDate(usage.summary.last_used_at) }}</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<div class="usage-statuses">
|
||||
<el-tag v-for="(count, status) in usage.summary.status_counts" :key="status" size="small" effect="plain">
|
||||
{{ t(`admin.shippingOrderSchema.extractionStatus.${status}`) }} {{ count }}
|
||||
</el-tag>
|
||||
</div>
|
||||
<h3 class="usage-records-title">{{ t('admin.shippingOrderSchema.usageRecords') }}</h3>
|
||||
<el-empty
|
||||
v-if="!usage.items.length"
|
||||
:description="t('admin.shippingOrderSchema.usageEmpty')"
|
||||
:image-size="60"
|
||||
/>
|
||||
<button v-for="item in usage.items" :key="item.id" type="button" class="usage-record" @click="emit('select', item.id)">
|
||||
<strong>#{{ item.id }}</strong>
|
||||
<el-tag size="small" effect="plain">{{ t(`admin.shippingOrderSchema.extractionStatus.${item.status}`) }}</el-tag>
|
||||
<small>{{ formatDate(item.created_at) }} · {{ item.input_snapshot_hash.slice(0, 12) }}</small>
|
||||
</button>
|
||||
<el-button
|
||||
v-if="usage.items.length < usage.total"
|
||||
class="usage-more"
|
||||
:disabled="loading"
|
||||
@click="emit('loadMore')"
|
||||
>
|
||||
{{ t('admin.shippingOrderSchema.usageLoadMore') }}
|
||||
</el-button>
|
||||
</template>
|
||||
<el-empty v-else :description="t('admin.shippingOrderSchema.usageEmpty')" :image-size="60" />
|
||||
</el-drawer>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.usage-layer { position: fixed; z-index: 80; inset: 0; display: flex; justify-content: flex-end; background: rgb(15 23 42 / 35%); backdrop-filter: blur(2px); }.usage-drawer { display: flex; width: min(680px, 96vw); height: 100%; flex-direction: column; overflow: hidden; background: #f8fafc; box-shadow: -18px 0 48px rgb(15 23 42 / 18%); }.usage-drawer > header { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #e2e8f0; background: #fff; padding: 22px 26px; }.usage-drawer header p { margin: 0 0 4px; color: #0284c7; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }.usage-drawer h2 { margin: 0; color: #1e293b; font-size: 20px; }.usage-drawer > header button { width: 32px; height: 32px; border: 1px solid #dbe5ee; border-radius: 50%; background: #fff; color: #475569; font-size: 22px; line-height: 1; cursor: pointer; }.usage-drawer main { overflow-y: auto; padding: 24px 26px; }.usage-version { margin: 0 0 12px; color: #0369a1; font-weight: 700; }.usage-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; }.usage-summary div { border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; padding: 10px; }.usage-summary dt { color: #94a3b8; font-size: 10px; }.usage-summary dd { margin: 5px 0 0; color: #334155; font-size: 12px; overflow-wrap: anywhere; }.usage-statuses { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }.usage-statuses span { border-radius: 999px; background: #e0f2fe; padding: 3px 7px; color: #0369a1; font-size: 11px; }.usage-drawer h3 { margin: 22px 0 10px; color: #64748b; font-size: 12px; }.usage-record { display: grid; width: 100%; grid-template-columns: 70px 1fr; gap: 5px 10px; margin-top: 7px; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; padding: 11px; color: #475569; font: inherit; text-align: left; cursor: pointer; }.usage-record:hover { border-color: #7dd3fc; background: #f0f9ff; }.usage-record strong { color: #1e293b; font-size: 12px; }.usage-record span { color: #0369a1; font-size: 12px; }.usage-record small { grid-column: 1 / -1; color: #94a3b8; font-size: 10px; }.usage-empty { display: grid; min-height: 220px; place-items: center; color: #94a3b8; font-size: 13px; }.usage-more { width: 100%; margin-top: 10px; border: 1px dashed #cbd5e1; border-radius: 7px; background: transparent; padding: 8px; color: #0284c7; font: inherit; font-size: 12px; cursor: pointer; }@media (max-width: 640px) { .usage-drawer main { padding: 18px; }.usage-summary { grid-template-columns: 1fr; } }
|
||||
.drawer-heading p { margin: 0 0 4px; color: var(--el-color-primary); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
|
||||
.drawer-heading h2 { margin: 0; color: var(--el-text-color-primary); font-size: 20px; }
|
||||
.usage-version { margin: 0 0 12px; color: var(--el-color-primary); font-weight: 700; }
|
||||
.usage-statuses { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
|
||||
.usage-records-title { margin: 22px 0 10px; color: var(--el-text-color-secondary); font-size: 12px; }.usage-record { display: grid; width: 100%; grid-template-columns: 70px 1fr; gap: 5px 10px; justify-items: start; margin-top: 7px; border: 1px solid var(--el-border-color-lighter); border-radius: 8px; background: var(--el-bg-color); padding: 11px; color: var(--el-text-color-regular); font: inherit; text-align: left; cursor: pointer; }
|
||||
.usage-record:hover { border-color: var(--el-color-primary-light-5); background: var(--el-color-primary-light-9); }
|
||||
.usage-record strong { color: var(--el-text-color-primary); font-size: 12px; }
|
||||
.usage-record small { grid-column: 1 / -1; color: var(--el-text-color-placeholder); font-size: 12px; }
|
||||
.usage-more { width: 100%; margin-top: 10px; }
|
||||
</style>
|
||||
+863
-316
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
+222
-91
@@ -3,12 +3,16 @@
|
||||
* 用途:锁定在途调拨「调拨类型」管理页的列表渲染、编辑抽屉四块(基本信息/范围规则/仓库定义/
|
||||
* 转换规则)、保存 payload 结构(规则间 AND)、onBlur 校验 + aria-describedby、顶部错误
|
||||
* 摘要锚点跳字段、保存 loading/成功/失败反馈、范围重叠与映射档未命中的黄色不拦截提示、
|
||||
* 空范围显式确认、tag 删除点击区 ≥24px、四语言 admin.json 键集一致与模块四处注册契约。
|
||||
* 依赖:@vue/test-utils、vitest、@/i18n、transferTypes.api(mock)、constants/modules、admin.routes。
|
||||
* 逻辑:mock transferTypes.api 控制列表/写入返回;交互按框线图与可用性规则逐条断言。
|
||||
* 空范围与未保存关闭的 ElMessageBox 显式确认、四语言 admin.json 键集一致与模块四处注册契约。
|
||||
* 依赖:@vue/test-utils、vitest、@/i18n、element-plus(组件断言与 ElMessageBox mock)、
|
||||
* transferTypes.api(mock)、constants/modules、admin.routes。
|
||||
* 逻辑:mock transferTypes.api 控制列表/写入返回;页面已迁移 Element Plus,DOM 交互按 EP
|
||||
* 组件结构适配(setValue 走组件 v-model、输入取内部 input、tag 取 el-input-tag 结构),
|
||||
* 行为断言(payload/错误摘要/aria 关联/黄色不拦截)与迁移前保持一致。
|
||||
*/
|
||||
import { enableAutoUnmount, flushPromises, mount } from '@vue/test-utils';
|
||||
import { enableAutoUnmount, flushPromises, mount, type VueWrapper } from '@vue/test-utils';
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { ElMessageBox } from 'element-plus';
|
||||
import i18n from '@/i18n';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import { config } from '@/config';
|
||||
@@ -21,6 +25,17 @@ import thAdmin from '@/locales/th/admin.json';
|
||||
import { TRANSFER_SCOPE_FIELDS } from '../transferTypes.api';
|
||||
import TransferTypesPage from '../TransferTypesPage.vue';
|
||||
|
||||
// el-table 布局依赖 ResizeObserver,jsdom 缺失需补齐桩实现
|
||||
class ResizeObserverStub {
|
||||
observe(): void {}
|
||||
|
||||
unobserve(): void {}
|
||||
|
||||
disconnect(): void {}
|
||||
}
|
||||
(globalThis as Record<string, unknown>).ResizeObserver
|
||||
= (globalThis as Record<string, unknown>).ResizeObserver || ResizeObserverStub;
|
||||
|
||||
const apiMocks = vi.hoisted(() => ({
|
||||
listTransferTypes: vi.fn(),
|
||||
createTransferType: vi.fn(),
|
||||
@@ -41,6 +56,14 @@ vi.mock('../transferTypes.api', async () => {
|
||||
|
||||
enableAutoUnmount(afterEach);
|
||||
|
||||
// EP 重型页面(表格+抽屉+20 余控件、attachTo 真实挂载)在全量并行渲染时较慢,放宽本文件超时
|
||||
vi.setConfig({ testTimeout: 20000 });
|
||||
|
||||
// ElMessageBox 默认拒绝(=取消),避免测试路径意外走进确认分支;需确认的用例再覆盖实现
|
||||
const mockMessageBoxCancel = (): void => {
|
||||
vi.spyOn(ElMessageBox, 'confirm').mockRejectedValue('cancelled');
|
||||
};
|
||||
|
||||
// ---- 测试夹具:两条类型(一条启用带 1 条范围规则,一条停用空规则) ----
|
||||
const mappedRole = { mode: 'mapped', warehouse_code: null, external_org: null };
|
||||
const rowEnabled = {
|
||||
@@ -76,44 +99,83 @@ const mountPage = async () => {
|
||||
return wrapper;
|
||||
};
|
||||
|
||||
const openCreateDrawer = async (wrapper: Awaited<ReturnType<typeof mountPage>>) => {
|
||||
const openCreateDrawer = async (wrapper: VueWrapper) => {
|
||||
await wrapper.find('[data-testid="create-type"]').trigger('click');
|
||||
// 打开抽屉会异步懒加载仓库映射档(存在性校验数据源),统一冲刷后再断言
|
||||
await flushPromises();
|
||||
};
|
||||
|
||||
/** 取 EP 输入类组件的原生 input:el-input/el-input-tag 的 testid 直接落在 input 上,
|
||||
* el-input-number 的 testid 在根 div 上,两种落点统一兜底。 */
|
||||
const innerInput = (wrapper: VueWrapper, testId: string) => {
|
||||
const root = wrapper.find(`[data-testid="${testId}"]`);
|
||||
return root.element.tagName === 'INPUT' ? root : root.find('input');
|
||||
};
|
||||
|
||||
/** DIV 根组件(el-select/el-radio-group/el-segmented 等)的 v-model 赋值:
|
||||
* DOMWrapper.setValue 对 DIV 会抛错,必须走 VueWrapper 的 update:modelValue。 */
|
||||
const setControl = (wrapper: VueWrapper, testId: string, value: unknown) => (
|
||||
wrapper.getComponent(`[data-testid="${testId}"]`).setValue(value)
|
||||
);
|
||||
|
||||
/** 抽屉开关状态:el-drawer 关闭后面板节点仍留在 DOM(v-show),以 open class 为准。 */
|
||||
const isDrawerOpen = (wrapper: VueWrapper): boolean => {
|
||||
const panel = wrapper.find('[data-testid="type-drawer"]');
|
||||
return panel.exists() && panel.classes().includes('open');
|
||||
};
|
||||
|
||||
/**
|
||||
* 取字段的 aria-describedby 值:EP 组件的 aria 属性可能落在组件根或内部 input 上,
|
||||
* 逐层兜底,保证「错误文本与字段无障碍关联」这一行为契约与实现细节解耦。
|
||||
*/
|
||||
const getAriaDescribedBy = (wrapper: VueWrapper, testId: string): string | undefined => {
|
||||
const root = wrapper.find(`[data-testid="${testId}"]`);
|
||||
const fromRoot = root.attributes('aria-describedby');
|
||||
if (fromRoot) return fromRoot;
|
||||
const inner = root.find('[aria-describedby]');
|
||||
return inner.exists() ? inner.attributes('aria-describedby') : undefined;
|
||||
};
|
||||
|
||||
/** 读取 el-input-tag 中已提交的 tag 文本列表(tag 挂在字段容器下,是 input 的兄弟节点)。 */
|
||||
const scopeTagTexts = (wrapper: VueWrapper, index: number): string[] => (
|
||||
wrapper.find(`[data-testid="scope-values-root-${index}"]`).findAll('.el-tag')
|
||||
.map((tag) => tag.text().trim())
|
||||
);
|
||||
|
||||
/**
|
||||
* 在新建抽屉里填齐必填项并配置一条范围规则(field/match/value),供保存类测试复用。
|
||||
* 关键断言意图:value 通过「输入 + Enter」提交为 tag,模拟真实多值编辑路径。
|
||||
* 关键断言意图:value 通过「内部 input 输入 + Enter」提交为 tag,模拟真实多值编辑路径。
|
||||
*/
|
||||
const fillCreateFormWithRule = async (wrapper: Awaited<ReturnType<typeof mountPage>>, code = 'wtp_to_how') => {
|
||||
const fillCreateFormWithRule = async (wrapper: VueWrapper, code = 'wtp_to_how') => {
|
||||
await openCreateDrawer(wrapper);
|
||||
await wrapper.find('[data-testid="type-code"]').setValue(code);
|
||||
await wrapper.find('[data-testid="name-zh-CN"]').setValue('WTP转HOW');
|
||||
await wrapper.find('[data-testid="add-scope-rule"]').trigger('click');
|
||||
await wrapper.find('[data-testid="scope-field-0"]').setValue('doc_no');
|
||||
await wrapper.find('[data-testid="scope-match-0"]').setValue('prefix');
|
||||
await wrapper.find('[data-testid="scope-value-input-0"]').setValue('HOM');
|
||||
await wrapper.find('[data-testid="scope-value-input-0"]').trigger('keydown.enter');
|
||||
await setControl(wrapper, 'scope-field-0', 'doc_no');
|
||||
await setControl(wrapper, 'scope-match-0', 'prefix');
|
||||
await innerInput(wrapper, 'scope-value-input-0').setValue('HOM');
|
||||
await innerInput(wrapper, 'scope-value-input-0').trigger('keydown.enter');
|
||||
await flushPromises();
|
||||
};
|
||||
|
||||
describe('TransferTypesPage 列表渲染', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
mockMessageBoxCancel();
|
||||
apiMocks.listTransferTypes.mockResolvedValue([rowEnabled, rowDisabled]);
|
||||
apiMocks.listExternalWarehouseMappings.mockResolvedValue(mappingRows);
|
||||
});
|
||||
|
||||
it('渲染列表行:编码/名称/规则数/状态/编辑', async () => {
|
||||
const wrapper = await mountPage();
|
||||
const rows = wrapper.findAll('[data-testid="type-row"]');
|
||||
// 关键断言:两行数据齐全,启用行规则数=1、状态=启用;停用行规则数=0、状态=停用
|
||||
const rows = wrapper.findAll('tr.type-row');
|
||||
// 关键断言:两行数据齐全,启用行规则数=1、状态=启用;停用行零规则显示「无规则」tag、状态=停用
|
||||
expect(rows).toHaveLength(2);
|
||||
expect(rows[0].text()).toContain('in_transit_to_hub');
|
||||
expect(rows[0].text()).toContain('在途仓至HUB仓');
|
||||
expect(rows[0].find('[data-testid="rule-count-0"]').text()).toBe('1');
|
||||
expect(rows[0].text()).toContain('启用');
|
||||
expect(rows[1].find('[data-testid="rule-count-1"]').text()).toBe('0');
|
||||
expect(rows[1].find('[data-testid="rule-count-1"]').text()).toBe('无规则');
|
||||
expect(rows[1].text()).toContain('停用');
|
||||
expect(wrapper.findAll('[data-testid="edit-type"]')).toHaveLength(2);
|
||||
});
|
||||
@@ -128,23 +190,34 @@ describe('TransferTypesPage 列表渲染', () => {
|
||||
expect(empty.find('[data-testid="empty-create"]').exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('筛选无结果空态与无数据空态区分,清除筛选可恢复列表', async () => {
|
||||
const wrapper = await mountPage();
|
||||
// 关键断言:搜索无命中时给出「无匹配 + 清除筛选」出路(不产生死胡同)
|
||||
await wrapper.find('[data-testid="search-input"]').setValue('不存在的关键字');
|
||||
expect(wrapper.find('[data-testid="empty-state"]').text()).toContain('无匹配的调拨类型');
|
||||
await wrapper.find('[data-testid="clear-filters"]').trigger('click');
|
||||
expect(wrapper.findAll('tr.type-row')).toHaveLength(2);
|
||||
expect(wrapper.find('[data-testid="empty-state"]').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('搜索编码/名称与状态筛选联动过滤列表', async () => {
|
||||
const wrapper = await mountPage();
|
||||
// 按中文名称搜索「维修」只命中停用行
|
||||
await wrapper.find('[data-testid="search-input"]').setValue('维修');
|
||||
expect(wrapper.findAll('[data-testid="type-row"]')).toHaveLength(1);
|
||||
expect(wrapper.find('[data-testid="type-row"]').text()).toContain('hub_repair_out');
|
||||
expect(wrapper.findAll('tr.type-row')).toHaveLength(1);
|
||||
expect(wrapper.find('tr.type-row').text()).toContain('hub_repair_out');
|
||||
// 状态筛选=启用 时清空搜索,只命中启用行
|
||||
await wrapper.find('[data-testid="search-input"]').setValue('');
|
||||
await wrapper.find('[data-testid="status-filter"]').setValue('enabled');
|
||||
expect(wrapper.findAll('[data-testid="type-row"]')).toHaveLength(1);
|
||||
expect(wrapper.find('[data-testid="type-row"]').text()).toContain('in_transit_to_hub');
|
||||
await setControl(wrapper, 'status-filter', 'enabled');
|
||||
expect(wrapper.findAll('tr.type-row')).toHaveLength(1);
|
||||
expect(wrapper.find('tr.type-row').text()).toContain('in_transit_to_hub');
|
||||
});
|
||||
});
|
||||
|
||||
describe('TransferTypesPage 编辑抽屉基础块', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
mockMessageBoxCancel();
|
||||
apiMocks.listTransferTypes.mockResolvedValue([rowEnabled, rowDisabled]);
|
||||
apiMocks.listExternalWarehouseMappings.mockResolvedValue(mappingRows);
|
||||
});
|
||||
@@ -152,20 +225,41 @@ describe('TransferTypesPage 编辑抽屉基础块', () => {
|
||||
it('编辑态打开抽屉:dialog 语义、编码只读且回显、名称四语言输入框齐全', async () => {
|
||||
const wrapper = await mountPage();
|
||||
await wrapper.findAll('[data-testid="edit-type"]')[0].trigger('click');
|
||||
const drawer = wrapper.find('[data-testid="type-drawer"]');
|
||||
await flushPromises();
|
||||
const dialog = wrapper.find('[data-testid="type-drawer"]');
|
||||
// 关键断言:抽屉是 dialog 且编码创建后不可变(disabled + 回显)
|
||||
expect(drawer.exists()).toBe(true);
|
||||
expect(drawer.attributes('role')).toBe('dialog');
|
||||
const code = wrapper.find('[data-testid="type-code"]');
|
||||
expect(dialog.exists()).toBe(true);
|
||||
expect(dialog.attributes('role')).toBe('dialog');
|
||||
const code = innerInput(wrapper, 'type-code');
|
||||
expect(code.exists()).toBe(true);
|
||||
expect((code.element as HTMLInputElement).disabled).toBe(true);
|
||||
expect((code.element as HTMLInputElement).value).toBe('in_transit_to_hub');
|
||||
// 名称四语言(zh-CN 必填)+ 排序 + 启用开关
|
||||
// 名称四语言(zh-CN 必填)+ 排序 + 启用开关(其余语言折叠渲染但存在)
|
||||
for (const key of ['name-zh-CN', 'name-zh-TW', 'name-en', 'name-th']) {
|
||||
expect(wrapper.find(`[data-testid="${key}"]`).exists()).toBe(true);
|
||||
}
|
||||
expect((wrapper.find('[data-testid="name-zh-CN"]').element as HTMLInputElement).value).toBe('在途仓至HUB仓');
|
||||
expect((wrapper.find('[data-testid="sort-order"]').element as HTMLInputElement).value).toBe('10');
|
||||
expect(wrapper.find('[data-testid="enabled-switch"]').attributes('aria-checked')).toBe('true');
|
||||
expect((innerInput(wrapper, 'name-zh-CN').element as HTMLInputElement).value).toBe('在途仓至HUB仓');
|
||||
expect((innerInput(wrapper, 'sort-order').element as HTMLInputElement).value).toBe('10');
|
||||
// aria-checked 由 EP 渲染在内部 role=switch 元素上
|
||||
expect(wrapper.find('[data-testid="enabled-switch"] [role="switch"]').attributes('aria-checked')).toBe('true');
|
||||
});
|
||||
|
||||
it('抽屉原生 resizable:渲染拖拽手柄且拖动后宽度变化', async () => {
|
||||
const wrapper = await mountPage();
|
||||
await openCreateDrawer(wrapper);
|
||||
const panel = wrapper.find('[data-testid="type-drawer"]');
|
||||
expect(panel.attributes('style')).toContain('width: 640px');
|
||||
const dragger = wrapper.find('.el-drawer__dragger');
|
||||
// 关键断言:原生 dragger 存在,mousedown + 向左 mousemove 后宽度脱离默认值
|
||||
//(jsdom 无布局,EP 以 offsetWidth 为起点,这里不断言精确尺寸只验证联动生效)
|
||||
expect(dragger.exists()).toBe(true);
|
||||
await dragger.trigger('mousedown', { clientX: 800, pageY: 300 });
|
||||
window.dispatchEvent(new MouseEvent('mousemove', { clientX: 720, pageY: 300 }));
|
||||
window.dispatchEvent(new MouseEvent('mouseup'));
|
||||
await flushPromises();
|
||||
const styleAfter = panel.attributes('style') || '';
|
||||
expect(styleAfter).toContain('width:');
|
||||
expect(styleAfter).not.toContain('width: 640px');
|
||||
});
|
||||
|
||||
it('仓库定义 mode 切换:fixed 才显示仓库编码与法人覆盖输入', async () => {
|
||||
@@ -173,29 +267,29 @@ describe('TransferTypesPage 编辑抽屉基础块', () => {
|
||||
await openCreateDrawer(wrapper);
|
||||
// 关键断言:默认映射档不渲染固定仓库输入;切 fixed 出现,切回 mapped 消失
|
||||
expect(wrapper.find('[data-testid="warehouse-from-code"]').exists()).toBe(false);
|
||||
await wrapper.find('[data-testid="warehouse-from-mode"]').setValue('fixed');
|
||||
await setControl(wrapper, 'warehouse-from-mode', 'fixed');
|
||||
expect(wrapper.find('[data-testid="warehouse-from-code"]').exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="warehouse-from-org"]').exists()).toBe(true);
|
||||
await wrapper.find('[data-testid="warehouse-from-mode"]').setValue('mapped');
|
||||
await setControl(wrapper, 'warehouse-from-mode', 'mapped');
|
||||
expect(wrapper.find('[data-testid="warehouse-from-code"]').exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('映射档存在性校验:命中=✓ 提示、未命中=黄色✕ 提示,且均不拦截保存', async () => {
|
||||
it('映射档存在性校验:命中=成功提示、未命中=黄色警告提示,且均不拦截保存', async () => {
|
||||
// 本测试聚焦仓库校验,不放范围规则;空范围确认放行(默认拒绝语义不在此验证)
|
||||
const confirmSpy = vi.spyOn(window, 'confirm').mockReturnValue(true);
|
||||
vi.spyOn(ElMessageBox, 'confirm').mockResolvedValue('confirm');
|
||||
const wrapper = await mountPage();
|
||||
await openCreateDrawer(wrapper);
|
||||
await wrapper.find('[data-testid="type-code"]').setValue('wtp_to_how');
|
||||
await wrapper.find('[data-testid="name-zh-CN"]').setValue('WTP转HOW');
|
||||
await wrapper.find('[data-testid="warehouse-from-mode"]').setValue('fixed');
|
||||
await setControl(wrapper, 'warehouse-from-mode', 'fixed');
|
||||
// 未命中:黄色提示但不拦截
|
||||
await wrapper.find('[data-testid="warehouse-from-code"]').setValue('WH-REPAIR');
|
||||
await setControl(wrapper, 'warehouse-from-code', 'WH-REPAIR');
|
||||
const missing = wrapper.find('[data-testid="warehouse-from-check"]');
|
||||
expect(missing.exists()).toBe(true);
|
||||
expect(missing.text()).toContain('映射档未找到');
|
||||
// 拨入仓命中:✓ 提示
|
||||
await wrapper.find('[data-testid="warehouse-to-mode"]').setValue('fixed');
|
||||
await wrapper.find('[data-testid="warehouse-to-code"]').setValue('WH-HUB');
|
||||
// 拨入仓命中:成功提示
|
||||
await setControl(wrapper, 'warehouse-to-mode', 'fixed');
|
||||
await setControl(wrapper, 'warehouse-to-code', 'WH-HUB');
|
||||
expect(wrapper.find('[data-testid="warehouse-to-check"]').text()).toContain('映射档已包含');
|
||||
// 关键断言:映射档未命中不拦截保存(D6/D10),payload 固定仓 + 法人覆盖正确
|
||||
await wrapper.find('[data-testid="save-type"]').trigger('click');
|
||||
@@ -208,19 +302,19 @@ describe('TransferTypesPage 编辑抽屉基础块', () => {
|
||||
await openCreateDrawer(wrapper);
|
||||
await wrapper.find('[data-testid="type-code"]').setValue('wtp_to_how2');
|
||||
await wrapper.find('[data-testid="name-zh-CN"]').setValue('WTP转HOW2');
|
||||
await wrapper.find('[data-testid="warehouse-from-mode"]').setValue('fixed');
|
||||
await wrapper.find('[data-testid="warehouse-from-code"]').setValue('WH-REPAIR');
|
||||
await setControl(wrapper, 'warehouse-from-mode', 'fixed');
|
||||
await setControl(wrapper, 'warehouse-from-code', 'WH-REPAIR');
|
||||
await wrapper.find('[data-testid="warehouse-from-org"]').setValue('ORG-X');
|
||||
await wrapper.find('[data-testid="save-type"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(apiMocks.createTransferType.mock.calls[1][0].warehouse_config.from).toEqual({ mode: 'fixed', warehouse_code: 'WH-REPAIR', external_org: 'ORG-X' });
|
||||
confirmSpy.mockRestore();
|
||||
});
|
||||
});
|
||||
|
||||
describe('TransferTypesPage 范围规则与转换规则编辑器', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
mockMessageBoxCancel();
|
||||
apiMocks.listTransferTypes.mockResolvedValue([rowEnabled, rowDisabled]);
|
||||
apiMocks.listExternalWarehouseMappings.mockResolvedValue(mappingRows);
|
||||
});
|
||||
@@ -229,55 +323,62 @@ describe('TransferTypesPage 范围规则与转换规则编辑器', () => {
|
||||
const wrapper = await mountPage();
|
||||
await openCreateDrawer(wrapper);
|
||||
await wrapper.find('[data-testid="add-scope-rule"]').trigger('click');
|
||||
const fieldOptions = wrapper.find('[data-testid="scope-field-0"]').findAll('option');
|
||||
// 关键断言:占位项 + 后端受控词表 18 字段,label 走 i18n(收料单号等)
|
||||
expect(fieldOptions).toHaveLength(1 + TRANSFER_SCOPE_FIELDS.length);
|
||||
const optionTexts = fieldOptions.map((o) => o.text());
|
||||
expect(optionTexts).toContain('收料单号');
|
||||
expect(optionTexts).toContain('供应商·客户编号');
|
||||
const matchTexts = wrapper.find('[data-testid="scope-match-0"]').findAll('option').map((o) => o.text());
|
||||
expect(matchTexts).toEqual(['前缀', '等于', '包含', '属于']);
|
||||
// Enter 提交 tag;重复值去重
|
||||
await wrapper.find('[data-testid="scope-field-0"]').setValue('doc_no');
|
||||
await wrapper.find('[data-testid="scope-value-input-0"]').setValue('HOM');
|
||||
await wrapper.find('[data-testid="scope-value-input-0"]').trigger('keydown.enter');
|
||||
expect(wrapper.find('[data-testid="scope-tag-0-0"]').exists()).toBe(true);
|
||||
await wrapper.find('[data-testid="scope-value-input-0"]').setValue('HOM, HOX');
|
||||
await wrapper.find('[data-testid="scope-value-input-0"]').trigger('keydown.enter');
|
||||
expect(wrapper.findAll('[data-testid="scope-tag-0-0"], [data-testid="scope-tag-0-1"]')).toHaveLength(2);
|
||||
const fieldOptions = wrapper.getComponent('[data-testid="scope-field-0"]')
|
||||
.findAllComponents({ name: 'ElOption' });
|
||||
// 关键断言:后端受控词表 18 字段(占位走 placeholder 不再占 option),label 走 i18n(收料单号等)
|
||||
expect(fieldOptions).toHaveLength(TRANSFER_SCOPE_FIELDS.length);
|
||||
const optionLabels = fieldOptions.map((option) => String(option.props('label')));
|
||||
expect(optionLabels).toContain('收料单号');
|
||||
expect(optionLabels).toContain('供应商·客户编号');
|
||||
const matchLabels = wrapper.getComponent('[data-testid="scope-match-0"]')
|
||||
.findAllComponents({ name: 'ElOption' })
|
||||
.map((option) => String(option.props('label')));
|
||||
expect(matchLabels).toEqual(['前缀', '等于', '包含', '属于']);
|
||||
// Enter 提交 tag;逗号分隔多值拆分且重复值去重
|
||||
await setControl(wrapper, 'scope-field-0', 'doc_no');
|
||||
await innerInput(wrapper, 'scope-value-input-0').setValue('HOM');
|
||||
await innerInput(wrapper, 'scope-value-input-0').trigger('keydown.enter');
|
||||
await flushPromises();
|
||||
expect(scopeTagTexts(wrapper, 0)).toEqual(['HOM']);
|
||||
await innerInput(wrapper, 'scope-value-input-0').setValue('HOM, HOX');
|
||||
await innerInput(wrapper, 'scope-value-input-0').trigger('keydown.enter');
|
||||
await flushPromises();
|
||||
expect(scopeTagTexts(wrapper, 0)).toEqual(['HOM', 'HOX']);
|
||||
});
|
||||
|
||||
it('tag 删除按钮点击区 ≥24px 且可删除值', async () => {
|
||||
it('tag 可通过关闭按钮删除', async () => {
|
||||
const wrapper = await mountPage();
|
||||
await openCreateDrawer(wrapper);
|
||||
await wrapper.find('[data-testid="add-scope-rule"]').trigger('click');
|
||||
await wrapper.find('[data-testid="scope-field-0"]').setValue('doc_no');
|
||||
await wrapper.find('[data-testid="scope-value-input-0"]').setValue('HOM');
|
||||
await wrapper.find('[data-testid="scope-value-input-0"]').trigger('keydown.enter');
|
||||
const remove = wrapper.find('[data-testid="scope-tag-remove-0-0"]');
|
||||
// 关键断言:点击区最小 24px(可用性规则④),删除后 tag 消失
|
||||
expect(remove.attributes('style')).toContain('24px');
|
||||
await setControl(wrapper, 'scope-field-0', 'doc_no');
|
||||
await innerInput(wrapper, 'scope-value-input-0').setValue('HOM');
|
||||
await innerInput(wrapper, 'scope-value-input-0').trigger('keydown.enter');
|
||||
await flushPromises();
|
||||
const remove = wrapper.find('[data-testid="scope-values-root-0"] .el-tag__close');
|
||||
// 关键断言:tag 自带可访问的删除按钮,删除后 tag 消失
|
||||
expect(remove.exists()).toBe(true);
|
||||
await remove.trigger('click');
|
||||
expect(wrapper.find('[data-testid="scope-tag-0-0"]').exists()).toBe(false);
|
||||
await flushPromises();
|
||||
expect(scopeTagTexts(wrapper, 0)).toEqual([]);
|
||||
});
|
||||
|
||||
it('失焦提交值草稿为 tag,且空值规则失焦后行内报错并 aria-describedby 关联', async () => {
|
||||
it('失焦提交值草稿为 tag;清空全部值后行内报错并 aria-describedby 关联', async () => {
|
||||
const wrapper = await mountPage();
|
||||
await openCreateDrawer(wrapper);
|
||||
await wrapper.find('[data-testid="add-scope-rule"]').trigger('click');
|
||||
await wrapper.find('[data-testid="scope-field-0"]').setValue('doc_no');
|
||||
// 未输入值直接失焦 → 字段正下方行内错误(可用性规则①)
|
||||
await wrapper.find('[data-testid="scope-value-input-0"]').setValue('HOM');
|
||||
await wrapper.find('[data-testid="scope-value-input-0"]').trigger('blur');
|
||||
// 失焦先提交草稿 → 有值不报错
|
||||
expect(wrapper.find('[data-testid="scope-tag-0-0"]').exists()).toBe(true);
|
||||
await setControl(wrapper, 'scope-field-0', 'doc_no');
|
||||
// 失焦提交草稿(el-input-tag save-on-blur 默认开启)→ 有值不报错
|
||||
await innerInput(wrapper, 'scope-value-input-0').setValue('HOM');
|
||||
await innerInput(wrapper, 'scope-value-input-0').trigger('blur');
|
||||
await flushPromises();
|
||||
expect(scopeTagTexts(wrapper, 0)).toEqual(['HOM']);
|
||||
expect(wrapper.find('[data-testid="scope-values-error-0"]').exists()).toBe(false);
|
||||
// 删掉 tag 后失焦 → 行内错误 + aria-describedby
|
||||
await wrapper.find('[data-testid="scope-tag-remove-0-0"]').trigger('click');
|
||||
await wrapper.find('[data-testid="scope-value-input-0"]').trigger('blur');
|
||||
// 关键断言:删掉唯一 tag → 行内错误立即出现,aria-describedby 指向错误元素 id
|
||||
await wrapper.find('[data-testid="scope-values-root-0"] .el-tag__close').trigger('click');
|
||||
await flushPromises();
|
||||
const error = wrapper.find('[data-testid="scope-values-error-0"]');
|
||||
expect(error.exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="scope-value-input-0"]').attributes('aria-describedby')).toBe(error.attributes('id'));
|
||||
expect(getAriaDescribedBy(wrapper, 'scope-value-input-0')).toBe(error.attributes('id'));
|
||||
});
|
||||
|
||||
it('保存 payload:scope_rules 为规则对象数组(规则间 AND),多值为 OR 数组', async () => {
|
||||
@@ -285,10 +386,11 @@ describe('TransferTypesPage 范围规则与转换规则编辑器', () => {
|
||||
await fillCreateFormWithRule(wrapper);
|
||||
// 第二条规则(规则间 AND)
|
||||
await wrapper.find('[data-testid="add-scope-rule"]').trigger('click');
|
||||
await wrapper.find('[data-testid="scope-field-1"]').setValue('source_code');
|
||||
await wrapper.find('[data-testid="scope-match-1"]').setValue('in');
|
||||
await wrapper.find('[data-testid="scope-value-input-1"]').setValue('SRC-A, SRC-B');
|
||||
await wrapper.find('[data-testid="scope-value-input-1"]').trigger('keydown.enter');
|
||||
await setControl(wrapper, 'scope-field-1', 'source_code');
|
||||
await setControl(wrapper, 'scope-match-1', 'in');
|
||||
await innerInput(wrapper, 'scope-value-input-1').setValue('SRC-A, SRC-B');
|
||||
await innerInput(wrapper, 'scope-value-input-1').trigger('keydown.enter');
|
||||
await flushPromises();
|
||||
await wrapper.find('[data-testid="save-type"]').trigger('click');
|
||||
await flushPromises();
|
||||
// 关键断言:payload.scope_rules 保序两条规则,多值成数组(或关系),即 AND-of-OR 结构
|
||||
@@ -308,6 +410,7 @@ describe('TransferTypesPage 范围规则与转换规则编辑器', () => {
|
||||
it('编辑保存走 PUT,转换规则行可添加并写入 payload', async () => {
|
||||
const wrapper = await mountPage();
|
||||
await wrapper.findAll('[data-testid="edit-type"]')[0].trigger('click');
|
||||
await flushPromises();
|
||||
await wrapper.find('[data-testid="add-transform-rule"]').trigger('click');
|
||||
expect(wrapper.find('[data-testid="transform-row-0"]').exists()).toBe(true);
|
||||
await wrapper.find('[data-testid="transform-source-0"]').setValue('WTP');
|
||||
@@ -338,6 +441,7 @@ describe('TransferTypesPage 范围规则与转换规则编辑器', () => {
|
||||
it('编辑自身不与自身重叠;与停用类型不提示', async () => {
|
||||
const wrapper = await mountPage();
|
||||
await wrapper.findAll('[data-testid="edit-type"]')[0].trigger('click');
|
||||
await flushPromises();
|
||||
// 自身规则就是 [HOM, HOX],编辑自身不应把自身算入冲突
|
||||
expect(wrapper.find('[data-testid="scope-overlap-warning"]').exists()).toBe(false);
|
||||
});
|
||||
@@ -346,6 +450,7 @@ describe('TransferTypesPage 范围规则与转换规则编辑器', () => {
|
||||
describe('TransferTypesPage 校验、错误摘要与保存反馈', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
mockMessageBoxCancel();
|
||||
apiMocks.listTransferTypes.mockResolvedValue([rowEnabled, rowDisabled]);
|
||||
apiMocks.listExternalWarehouseMappings.mockResolvedValue(mappingRows);
|
||||
});
|
||||
@@ -354,13 +459,13 @@ describe('TransferTypesPage 校验、错误摘要与保存反馈', () => {
|
||||
const wrapper = await mountPage();
|
||||
await openCreateDrawer(wrapper);
|
||||
await wrapper.find('[data-testid="type-code"]').setValue('');
|
||||
await wrapper.find('[data-testid="type-code"]').trigger('blur');
|
||||
await innerInput(wrapper, 'type-code').trigger('blur');
|
||||
const error = wrapper.find('[data-testid="code-error"]');
|
||||
// 关键断言:行内错误(非只弹 toast)且 aria-describedby 指向错误元素 id
|
||||
expect(error.exists()).toBe(true);
|
||||
expect(wrapper.find('[data-testid="type-code"]').attributes('aria-describedby')).toBe(error.attributes('id'));
|
||||
expect(getAriaDescribedBy(wrapper, 'type-code')).toBe(error.attributes('id'));
|
||||
await wrapper.find('[data-testid="type-code"]').setValue('ABC');
|
||||
await wrapper.find('[data-testid="type-code"]').trigger('blur');
|
||||
await innerInput(wrapper, 'type-code').trigger('blur');
|
||||
expect(wrapper.find('[data-testid="code-error"]').text()).toContain('小写字母');
|
||||
});
|
||||
|
||||
@@ -368,7 +473,7 @@ describe('TransferTypesPage 校验、错误摘要与保存反馈', () => {
|
||||
const wrapper = await mountPage();
|
||||
await openCreateDrawer(wrapper);
|
||||
await wrapper.find('[data-testid="name-zh-CN"]').setValue('');
|
||||
await wrapper.find('[data-testid="name-zh-CN"]').trigger('blur');
|
||||
await innerInput(wrapper, 'name-zh-CN').trigger('blur');
|
||||
expect(wrapper.find('[data-testid="name-error"]').exists()).toBe(true);
|
||||
});
|
||||
|
||||
@@ -383,7 +488,7 @@ describe('TransferTypesPage 校验、错误摘要与保存反馈', () => {
|
||||
expect(summary.text()).toContain('请输入调拨类型编码');
|
||||
// 点击摘要条目 → 焦点跳到编码输入框;行内错误保留
|
||||
await summary.find('button').trigger('click');
|
||||
expect(document.activeElement).toBe(wrapper.find('[data-testid="type-code"]').element);
|
||||
expect(document.activeElement).toBe(innerInput(wrapper, 'type-code').element);
|
||||
expect(wrapper.find('[data-testid="code-error"]').exists()).toBe(true);
|
||||
expect(apiMocks.createTransferType).not.toHaveBeenCalled();
|
||||
});
|
||||
@@ -394,9 +499,10 @@ describe('TransferTypesPage 校验、错误摘要与保存反馈', () => {
|
||||
apiMocks.createTransferType.mockImplementation(() => new Promise(() => {}));
|
||||
await wrapper.find('[data-testid="save-type"]').trigger('click');
|
||||
const save = wrapper.find('[data-testid="save-type"]');
|
||||
// 关键断言:loading 态文案切换 + 禁用防重复提交(可用性规则③)
|
||||
// 关键断言:loading 态文案切换 + 禁用防重复提交(可用性规则③;EP 以 aria-disabled/is-loading 表达)
|
||||
expect(save.text()).toContain('保存中');
|
||||
expect(save.attributes('disabled')).toBeDefined();
|
||||
expect(save.classes()).toContain('is-loading');
|
||||
expect(save.attributes('aria-disabled')).toBe('true');
|
||||
});
|
||||
|
||||
it('保存成功:提示反馈、抽屉关闭并刷新列表', async () => {
|
||||
@@ -407,7 +513,7 @@ describe('TransferTypesPage 校验、错误摘要与保存反馈', () => {
|
||||
await wrapper.find('[data-testid="save-type"]').trigger('click');
|
||||
await flushPromises();
|
||||
// 关键断言:成功后抽屉关闭 + 列表重新拉取(成功反馈)
|
||||
expect(wrapper.find('[data-testid="type-drawer"]').exists()).toBe(false);
|
||||
expect(isDrawerOpen(wrapper)).toBe(false);
|
||||
expect(apiMocks.listTransferTypes).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
@@ -420,34 +526,59 @@ describe('TransferTypesPage 校验、错误摘要与保存反馈', () => {
|
||||
await wrapper.find('[data-testid="save-type"]').trigger('click');
|
||||
await flushPromises();
|
||||
// 关键断言:失败后抽屉不关闭、错误码本地化文案进摘要(四语言 errors.json 契约)
|
||||
expect(wrapper.find('[data-testid="type-drawer"]').exists()).toBe(true);
|
||||
expect(isDrawerOpen(wrapper)).toBe(true);
|
||||
expect(wrapper.find('[data-testid="error-summary"]').text()).toContain('编码已存在');
|
||||
expect((wrapper.find('[data-testid="save-type"]').element as HTMLButtonElement).disabled).toBe(false);
|
||||
});
|
||||
|
||||
it('空范围规则保存需显式确认:拒绝不发请求,确认则携带 allow_empty_scope_rules', async () => {
|
||||
const confirmSpy = vi.spyOn(window, 'confirm');
|
||||
const confirmSpy = vi.spyOn(ElMessageBox, 'confirm');
|
||||
const wrapper = await mountPage();
|
||||
await openCreateDrawer(wrapper);
|
||||
await wrapper.find('[data-testid="type-code"]').setValue('no_scope');
|
||||
await wrapper.find('[data-testid="name-zh-CN"]').setValue('无范围类型');
|
||||
confirmSpy.mockReturnValue(false);
|
||||
confirmSpy.mockRejectedValueOnce('cancelled');
|
||||
await wrapper.find('[data-testid="save-type"]').trigger('click');
|
||||
await flushPromises();
|
||||
// 关键断言:拒绝确认 → 不发请求(对齐后端 fail-closed 门禁)
|
||||
expect(confirmSpy).toHaveBeenCalledTimes(1);
|
||||
expect(apiMocks.createTransferType).not.toHaveBeenCalled();
|
||||
confirmSpy.mockReturnValue(true);
|
||||
confirmSpy.mockResolvedValueOnce('confirm');
|
||||
await wrapper.find('[data-testid="save-type"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(apiMocks.createTransferType).toHaveBeenCalledTimes(1);
|
||||
expect(apiMocks.createTransferType.mock.calls[0][0].allow_empty_scope_rules).toBe(true);
|
||||
confirmSpy.mockRestore();
|
||||
});
|
||||
|
||||
it('有未保存改动时关闭抽屉需确认:取消留在抽屉,确认后关闭', async () => {
|
||||
const confirmSpy = vi.spyOn(ElMessageBox, 'confirm');
|
||||
const wrapper = await mountPage();
|
||||
await openCreateDrawer(wrapper);
|
||||
// 未做任何修改:脏检测为假,直接关,不弹确认
|
||||
await wrapper.find('[data-testid="cancel-save"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(confirmSpy).not.toHaveBeenCalled();
|
||||
expect(isDrawerOpen(wrapper)).toBe(false);
|
||||
// 有改动:取消确认 → 抽屉保留不丢数据
|
||||
await openCreateDrawer(wrapper);
|
||||
await wrapper.find('[data-testid="type-code"]').setValue('dirty_close');
|
||||
confirmSpy.mockRejectedValueOnce('cancelled');
|
||||
await wrapper.find('[data-testid="cancel-save"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(confirmSpy).toHaveBeenCalledTimes(1);
|
||||
expect(isDrawerOpen(wrapper)).toBe(true);
|
||||
// 确认放弃 → 抽屉关闭
|
||||
confirmSpy.mockResolvedValueOnce('confirm');
|
||||
await wrapper.find('[data-testid="cancel-save"]').trigger('click');
|
||||
await flushPromises();
|
||||
expect(isDrawerOpen(wrapper)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('TransferTypesPage i18n 与模块注册契约', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
mockMessageBoxCancel();
|
||||
apiMocks.listTransferTypes.mockResolvedValue([]);
|
||||
apiMocks.listExternalWarehouseMappings.mockResolvedValue([]);
|
||||
});
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
/**
|
||||
* features/admin/modules/transfer-types/useTransferTypesAdmin.ts
|
||||
* 用途:调拨类型管理页的状态与动作编排——列表筛选、编辑抽屉表单、onBlur 校验、
|
||||
* 用途:调拨类型管理页的状态与动作编排——列表筛选排序、编辑抽屉表单、onBlur 校验、
|
||||
* 顶部错误摘要、范围重叠提示、映射档存在性校验与保存流程(ADR 0002 类型配置化)。
|
||||
* 依赖:transferTypes.api、useMessage、vue-i18n。
|
||||
* 依赖:transferTypes.api、useMessage、vue-i18n、element-plus(ElMessageBox)。
|
||||
* 逻辑:TransferTypesPage 调用本 composable 驱动列表与抽屉。校验失败时行内错误
|
||||
* (aria-describedby)+ 顶部错误摘要(role=alert,锚点跳字段);范围重叠与固定仓库
|
||||
* 未命中映射档仅黄色提示、不拦截保存(D10/D6);空范围规则保存前经 window.confirm
|
||||
* 显式确认后携带 allow_empty_scope_rules(对齐后端 fail-closed 门禁)。
|
||||
* (el-form-item :error 承接)+ 顶部错误摘要(role=alert,锚点跳字段);范围重叠与
|
||||
* 固定仓库未命中映射档仅黄色提示、不拦截保存(D10/D6);关抽屉前做脏检测,有未保存
|
||||
* 改动经 ElMessageBox 确认;空范围规则保存前经 ElMessageBox 显式确认后携带
|
||||
* allow_empty_scope_rules(对齐后端 fail-closed 门禁)。
|
||||
*/
|
||||
|
||||
import { computed, nextTick, reactive, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ElMessageBox } from 'element-plus';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import {
|
||||
@@ -122,14 +124,22 @@ export function useTransferTypesAdmin() {
|
||||
const form = reactive<TransferTypeFormState>(createEmptyTransferTypeForm());
|
||||
const fieldErrors = reactive<Record<string, string>>({});
|
||||
const errorSummary = ref<TransferTypeErrorItem[]>([]);
|
||||
/** 各范围规则行的值输入草稿(Enter/失焦提交为 tag)。 */
|
||||
const scopeDrafts = ref<string[]>([]);
|
||||
/** 打开抽屉时的表单快照(JSON 串),用于关闭前脏检测。 */
|
||||
const formSnapshot = ref('');
|
||||
|
||||
/** 仓库映射档缓存(打开抽屉时懒加载一次),用于固定仓存在性提示。 */
|
||||
/** 记录当前表单快照(openCreate/openEdit 装填完成后调用)。 */
|
||||
const snapshotForm = (): void => {
|
||||
formSnapshot.value = JSON.stringify(form);
|
||||
};
|
||||
|
||||
/** 仓库映射档缓存(打开抽屉时懒加载一次),用于固定仓存在性提示与编码候选项。 */
|
||||
const mappings = ref<Array<Record<string, unknown>>>([]);
|
||||
let mappingsRequested = false;
|
||||
|
||||
/** 列表过滤:编码/任意语言名称命中关键字 + 启停状态筛选。 */
|
||||
/** 表单相对打开快照是否有未保存改动(仅抽屉打开期间有意义)。 */
|
||||
const isFormDirty = computed(() => drawerOpen.value && formSnapshot.value !== JSON.stringify(form));
|
||||
|
||||
/** 列表过滤:编码/任意语言名称命中关键字 + 启停状态筛选,按 sort_order 升序、编码次序稳定排序。 */
|
||||
const filteredTypes = computed(() => {
|
||||
const keyword = search.value.trim().toLowerCase();
|
||||
return types.value.filter((row) => {
|
||||
@@ -138,7 +148,24 @@ export function useTransferTypesAdmin() {
|
||||
if (!keyword) return true;
|
||||
const names = Object.values(row.names || {}).join(' ').toLowerCase();
|
||||
return row.code.toLowerCase().includes(keyword) || names.includes(keyword);
|
||||
});
|
||||
})
|
||||
.sort((a, b) => (a.sort_order - b.sort_order) || a.code.localeCompare(b.code));
|
||||
});
|
||||
|
||||
/**
|
||||
* 固定仓编码候选项(来自映射档缓存):拨出仓取映射档在途仓、拨入仓取映射仓,去重升序,
|
||||
* 供 el-select 可搜索下拉(allow-create 保留自由输入兜底)。
|
||||
*/
|
||||
const warehouseOptions = computed<{ from: string[]; to: string[] }>(() => {
|
||||
const collect = (key: string) => {
|
||||
const set = new Set<string>();
|
||||
mappings.value.forEach((row) => {
|
||||
const value = String(row[key] ?? '').trim();
|
||||
if (value) set.add(value);
|
||||
});
|
||||
return [...set].sort((a, b) => a.localeCompare(b));
|
||||
};
|
||||
return { from: collect('in_transit_warehouse_code'), to: collect('external_warehouse_code') };
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -329,8 +356,20 @@ export function useTransferTypesAdmin() {
|
||||
// [STEP 2] 空范围规则需显式确认:后端 fail-closed 默认拒绝,确认后才携带 allow_empty_scope_rules
|
||||
let allowEmptyScopeRules = false;
|
||||
if (!form.scopeRules.length) {
|
||||
allowEmptyScopeRules = window.confirm(t('admin.transferTypes.emptyScopeConfirm'));
|
||||
if (!allowEmptyScopeRules) return;
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
t('admin.transferTypes.emptyScopeConfirm'),
|
||||
t('admin.transferTypes.emptyScopeTitle'),
|
||||
{
|
||||
type: 'warning',
|
||||
confirmButtonText: t('common.deleteDialog.confirm'),
|
||||
cancelButtonText: t('common.deleteDialog.cancel'),
|
||||
},
|
||||
);
|
||||
allowEmptyScopeRules = true;
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// [STEP 3] 提交:范围重叠/映射档未命中仅黄条提示,不在此拦截(D10/D6);失败落顶部摘要
|
||||
saving.value = true;
|
||||
@@ -351,20 +390,45 @@ export function useTransferTypesAdmin() {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 关闭请求:无未保存改动直接关;有改动先经 ElMessageBox 确认,放弃改动才关。
|
||||
* 供 el-drawer before-close(ESC/遮罩/×)与底部「取消」按钮共用;保存成功路径不经此函数。
|
||||
*/
|
||||
const requestClose = async (): Promise<void> => {
|
||||
if (!isFormDirty.value) {
|
||||
closeDrawer();
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await ElMessageBox.confirm(
|
||||
t('admin.transferTypes.unsavedConfirm'),
|
||||
t('admin.transferTypes.unsavedTitle'),
|
||||
{
|
||||
type: 'warning',
|
||||
confirmButtonText: t('common.deleteDialog.confirm'),
|
||||
cancelButtonText: t('common.deleteDialog.cancel'),
|
||||
},
|
||||
);
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
closeDrawer();
|
||||
};
|
||||
|
||||
const openCreate = (): void => {
|
||||
Object.assign(form, createEmptyTransferTypeForm());
|
||||
scopeDrafts.value = [];
|
||||
editingCode.value = null;
|
||||
resetErrors();
|
||||
snapshotForm();
|
||||
drawerOpen.value = true;
|
||||
void ensureMappings();
|
||||
};
|
||||
|
||||
const openEdit = (row: TransferTypeRow): void => {
|
||||
Object.assign(form, rowToForm(row));
|
||||
scopeDrafts.value = form.scopeRules.map(() => '');
|
||||
editingCode.value = row.code;
|
||||
resetErrors();
|
||||
snapshotForm();
|
||||
drawerOpen.value = true;
|
||||
void ensureMappings();
|
||||
};
|
||||
@@ -374,44 +438,39 @@ export function useTransferTypesAdmin() {
|
||||
resetErrors();
|
||||
};
|
||||
|
||||
/** 新增空范围规则(默认前缀匹配),草稿数组同步对齐。 */
|
||||
/** 新增空范围规则(默认前缀匹配)。 */
|
||||
const addScopeRule = (): void => {
|
||||
form.scopeRules.push({ field: '', match: 'prefix', values: [] });
|
||||
scopeDrafts.value.push('');
|
||||
};
|
||||
|
||||
const removeScopeRule = (index: number): void => {
|
||||
form.scopeRules.splice(index, 1);
|
||||
scopeDrafts.value.splice(index, 1);
|
||||
resetErrors();
|
||||
};
|
||||
|
||||
/**
|
||||
* 值草稿提交为 tag:按逗号(中英文)/空白拆分、去重追加,然后清空草稿。
|
||||
* el-input-tag 值变更归一:拆分逗号(中英文)/空白、去重后写回,保留「一次粘贴多值」体验;
|
||||
* 清空全部值时立即行内报错,非空则清除错误。
|
||||
* @param index - 范围规则行下标
|
||||
* @param values - el-input-tag 回传的原始值数组
|
||||
*/
|
||||
const commitScopeDraft = (index: number): void => {
|
||||
const onScopeValuesChange = (index: number, rawValues?: Array<string | number>): void => {
|
||||
const rule = form.scopeRules[index];
|
||||
if (!rule) return;
|
||||
const draft = scopeDrafts.value[index] || '';
|
||||
draft
|
||||
.split(/[,,\s]+/)
|
||||
.map((value) => value.trim())
|
||||
.filter(Boolean)
|
||||
.forEach((value) => {
|
||||
if (!rule.values.includes(value)) rule.values.push(value);
|
||||
});
|
||||
scopeDrafts.value[index] = '';
|
||||
};
|
||||
|
||||
const removeScopeValue = (index: number, valueIndex: number): void => {
|
||||
form.scopeRules[index]?.values.splice(valueIndex, 1);
|
||||
};
|
||||
|
||||
/** 值输入失焦:先提交草稿再校验(保证「失焦即落 tag」与错误判定基于已提交值)。 */
|
||||
const onScopeDraftBlur = (index: number): void => {
|
||||
commitScopeDraft(index);
|
||||
validateField(`scope-values-${index}`);
|
||||
const normalized: string[] = [];
|
||||
(rawValues ?? []).forEach((value) => {
|
||||
String(value)
|
||||
.split(/[,,\s]+/)
|
||||
.map((part) => part.trim())
|
||||
.filter(Boolean)
|
||||
.forEach((part) => {
|
||||
if (!normalized.includes(part)) normalized.push(part);
|
||||
});
|
||||
});
|
||||
rule.values = normalized;
|
||||
const key = `scope-values-${index}`;
|
||||
if (rule.values.length) delete fieldErrors[key];
|
||||
else fieldErrors[key] = t('admin.transferTypes.errors.ruleValuesRequired');
|
||||
};
|
||||
|
||||
/** 新增转换规则行(受控词表当前仅批号前缀替换)。 */
|
||||
@@ -439,24 +498,24 @@ export function useTransferTypesAdmin() {
|
||||
drawerOpen,
|
||||
editingCode,
|
||||
form,
|
||||
scopeDrafts,
|
||||
isFormDirty,
|
||||
openCreate,
|
||||
openEdit,
|
||||
closeDrawer,
|
||||
requestClose,
|
||||
// 校验与提示
|
||||
fieldErrors,
|
||||
errorSummary,
|
||||
overlapCodes,
|
||||
warehouseChecks,
|
||||
warehouseOptions,
|
||||
validateField,
|
||||
clearFieldError,
|
||||
focusField,
|
||||
// 范围规则编辑
|
||||
addScopeRule,
|
||||
removeScopeRule,
|
||||
commitScopeDraft,
|
||||
removeScopeValue,
|
||||
onScopeDraftBlur,
|
||||
onScopeValuesChange,
|
||||
// 转换规则编辑
|
||||
addTransformRule,
|
||||
removeTransformRule,
|
||||
|
||||
@@ -45,6 +45,8 @@ describe('shipping configuration navigation contract', () => {
|
||||
{ id: 'inventory_sites', routeName: 'AdminShippingInventory', path: 'shipping-notice', labelKey: 'admin.shippingInventory.sources', groupKey: 'admin.nav.shippingInventoryManagement', query: { section: 'sources' } },
|
||||
{ id: 'warehouse_mappings', routeName: 'AdminShippingInventory', path: 'shipping-notice', labelKey: 'admin.shippingInventory.externalMappings', groupKey: 'admin.nav.shippingInventoryManagement', query: { section: 'mappings' } },
|
||||
{ id: 'routing_rules', routeName: 'AdminShippingInventory', path: 'shipping-notice', labelKey: 'admin.shippingInventory.rules', groupKey: 'admin.nav.shippingInventoryManagement', query: { section: 'rules' } },
|
||||
// 调拨类型(原顶级入口移入,路由独立注册于 AdminTransferTypes,故不在 shippingRoutes 深链集合内)
|
||||
{ id: 'transfer_types', routeName: 'AdminTransferTypes', path: 'transfer-types', labelKey: 'admin.nav.transferTypes', groupKey: 'admin.nav.shippingInventoryManagement' },
|
||||
{ id: 'shipping_templates', routeName: 'AdminShippingInventory', path: 'shipping-notice', labelKey: 'admin.shippingInventory.excelTemplates', groupKey: 'admin.nav.shippingInventoryManagement', query: { section: 'templates' } },
|
||||
{ id: 'shipping_audit', routeName: 'AdminShippingAudit', path: 'shipping-audit', labelKey: 'admin.nav.shippingAudit', groupKey: 'admin.nav.shippingRunAudit' },
|
||||
{ id: 'process_gates', routeName: 'AdminShippingProcessGates', path: 'shipping-process-gates', labelKey: 'admin.nav.shippingProcessGates', groupKey: 'admin.nav.shippingRunAudit' },
|
||||
|
||||
@@ -38,6 +38,7 @@ export type ShippingConfigSubModuleId =
|
||||
| 'inventory_sites'
|
||||
| 'warehouse_mappings'
|
||||
| 'routing_rules'
|
||||
| 'transfer_types'
|
||||
| 'shipping_templates'
|
||||
| 'inventory_snapshots'
|
||||
| 'export_records';
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
/**
|
||||
* features/admin/views/AdminLayout.vue
|
||||
* 管理后台壳层:顶栏 + AdminNav + 子路由出口。
|
||||
* 逻辑:桌面端将导航与业务内容拆成独立纵向滚动区,任一侧滚动不会带动另一侧。
|
||||
* 依赖:AdminNav、admin-nav.store、AppHeaderTools。
|
||||
* 逻辑:桌面端导航与业务内容为独立纵向滚动区,任一侧滚动不带动另一侧。
|
||||
* 【间距所有权】布局间距统一由本壳层持有:导航↔内容 gap 16px(gap-4)、
|
||||
* 内容区左内边距 20px(md:pl-5,与外层 8px 栅格对齐),各业务页面根容器
|
||||
* 不得自带水平 padding / max-w 居中,页面只负责内部块间距与内容样式。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { ArrowLeft } from 'lucide-vue-next';
|
||||
@@ -37,11 +41,11 @@ const navStore = useAdminNavStore();
|
||||
<AppHeaderTools />
|
||||
</header>
|
||||
|
||||
<main class="flex min-h-0 flex-1 w-full mx-auto flex-col gap-8 overflow-hidden px-4 py-6 md:flex-row md:items-stretch md:px-8 md:py-8">
|
||||
<main class="flex min-h-0 flex-1 w-full flex-col gap-4 overflow-hidden px-4 py-6 md:flex-row md:items-stretch md:px-8 md:py-8">
|
||||
<aside class="min-h-0 shrink-0 overflow-y-auto md:pr-1">
|
||||
<AdminNav />
|
||||
</aside>
|
||||
<section class="min-h-0 w-full flex-1 space-y-8 overflow-y-auto md:pr-1">
|
||||
<section class="min-h-0 w-full flex-1 space-y-8 overflow-y-auto md:pl-5 md:pr-1">
|
||||
<router-view />
|
||||
</section>
|
||||
</main>
|
||||
|
||||
@@ -2,8 +2,14 @@
|
||||
/**
|
||||
* features/chat/views/ChatView.vue
|
||||
* 单个 Agent 对话页入口:provide 编排上下文,子组件 inject 消费。
|
||||
* 依赖:useChatPage、ChatViewContent/ChatViewOverlays。
|
||||
* 逻辑:在途调拨业务面板(Transfer* 组件)已 EP 组件化(el-dialog/el-table/el-select),
|
||||
* EP 样式随本页入口全量引入(亮色 + 暗色变量,模式同 admin 页面内引入),
|
||||
* 保证 chat 直达时样式就绪、不依赖 admin 路由先行加载。
|
||||
*/
|
||||
import { provide, reactive } from 'vue';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import { useChatPage } from '@/features/chat/composables/useChatPage';
|
||||
import { CHAT_PAGE_KEY, type ChatPageContextProvided } from '@/features/chat/composables/chat.context';
|
||||
import ChatViewContent from '@/features/chat/components/ChatViewContent.vue';
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"edit": "Edit",
|
||||
"delete": "Delete",
|
||||
"nav": {
|
||||
"transferTypes": "In-Transit Transfer Types",
|
||||
"transferTypes": "Transfer Types",
|
||||
"dashboard": "Dashboard",
|
||||
"approvals": "User Approvals",
|
||||
"users": "User Maintenance",
|
||||
@@ -637,9 +637,27 @@
|
||||
"pathSectionConfigured": "Configured",
|
||||
"pathSectionNotConfigured": "Not configured",
|
||||
"parsingProfiles": "Inventory Parsing",
|
||||
"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" },
|
||||
"parsingProfilesHelp": "Maintain reusable file parsing rules: inventory parsing targets the inventory field catalog and order match keys; inbound parsing 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": "Inbound Sample File",
|
||||
"sampleFileHint": "Upload an Excel or CSV file. The system reads worksheets, headers, and a small sample for inbound parsing confirmation.",
|
||||
"sampleRequired": "Upload an inbound 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",
|
||||
@@ -695,21 +713,38 @@
|
||||
"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" },
|
||||
"parsingPurposeHint": "Purpose cannot be changed after creation: on-hand parsing uses the inventory field catalog, inbound parsing uses the standard movement fields (read-only contract).",
|
||||
"parsingPurpose": {
|
||||
"onhand": "On Hand",
|
||||
"inbound": "Inbound",
|
||||
"outbound": "Outbound"
|
||||
},
|
||||
"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",
|
||||
"movementBindingLabel": "Inbound Parsing Rule",
|
||||
"movementBindingNone": "Not bound",
|
||||
"movementBindingHint": "With a published movement rule bound, matching reuses archived receipt files; when unbound, matching will not trigger a fetch (fail-closed).",
|
||||
"movementBindingHint": "With a published inbound rule bound, matching reuses archived receipt files; when unbound, matching will not trigger a fetch (fail-closed).",
|
||||
"movementFields": {
|
||||
"doc_no": "Doc No.", "line_no": "Line No.", "in_out_flag": "In/Out Flag", "material_code": "Material Code",
|
||||
"material_name": "Material Name", "warehouse_code": "Warehouse", "storage_code": "Storage Bin", "lot_no": "Lot No.",
|
||||
"quantity": "Quantity", "movement_date": "Movement Date", "unit": "Unit",
|
||||
"line_seq": "Line Seq.", "specification": "Specification", "order_type": "Order Type",
|
||||
"odm_id": "ODM ID", "odm_name": "ODM Name", "carton_id": "Carton No.", "pallet_id": "Pallet No."
|
||||
"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",
|
||||
"unit": "Unit",
|
||||
"line_seq": "Line Seq.",
|
||||
"specification": "Specification",
|
||||
"order_type": "Order Type",
|
||||
"odm_id": "ODM ID",
|
||||
"odm_name": "ODM Name",
|
||||
"carton_id": "Carton No.",
|
||||
"pallet_id": "Pallet No."
|
||||
},
|
||||
"inventoryAnalysisFailed": "Inventory file structure recognition failed.",
|
||||
"inventoryAnalysisPreview": "Recognition Preview",
|
||||
@@ -2563,8 +2598,8 @@
|
||||
"platformJobFileAssetCleanup": "Temporary file asset cleanup",
|
||||
"transferSourceCodes": "Source instances",
|
||||
"transferRecoverHistory": "Recover retryable history",
|
||||
"transferReceiptDateFrom": "Receipt date from (T-N)",
|
||||
"transferReceiptDateTo": "Receipt date to (T-N)",
|
||||
"transferReceiptDateFrom": "Movement date from (T-N)",
|
||||
"transferReceiptDateTo": "Movement date to (T-N)",
|
||||
"platformJobFixedAssetsSnapshot": "Fixed assets snapshot",
|
||||
"shippingInventoryJobHint": "Fetches inventory data from configured sources on schedule; exported asynchronously by the RPA worker.",
|
||||
"shippingInventoryJobParams": "Job parameters (optional)",
|
||||
@@ -3819,7 +3854,7 @@
|
||||
"approved": "Approved",
|
||||
"superseded": "Superseded"
|
||||
},
|
||||
"samples": "Confirmed blind-test samples: {count}/{required} · {status}",
|
||||
"samples": "Confirmed blind-test samples: {count}/{required}",
|
||||
"notRun": "not run",
|
||||
"approvedHint": "This blind test is approved; no further run or approval is needed.",
|
||||
"selectIndependentSample": "Select independent sample",
|
||||
@@ -5131,11 +5166,256 @@
|
||||
}
|
||||
},
|
||||
"contractPayment": {
|
||||
"title": "Contract Payment Alerts", "subtitle": "Sync OA contract, acceptance, and vendor prepayment requests; notify procurement roles through three escalation rounds.", "sessionHint": "Chat and history are hidden in this phase. Use the tabs above to open the ledger.", "sync": "Sync OA data", "moreActions": "More", "forceSync": "Force overwrite OA fields", "forceSyncConfirm": "This will overwrite existing OA data with non-empty fields returned this time and record an audit trail. Continue?", "reparseExisting": "Reparse existing contracts", "reparseExistingConfirm": "This will refresh all existing contract parsing results from archived attachments using the current rules. OA fields will not be synced or overwritten. Continue?", "scanAlerts": "Scan to generate alerts", "jobSubmitted": "Job submitted", "actionFailed": "Action failed", "loadFailed": "Failed to load contracts", "searchPlaceholder": "Search contract number, purchase order, supplier, or applicant", "allStatus": "All", "search": "Search", "ledger": "Contract ledger", "items": "items", "empty": "No contract data", "purchaseOrder": "Purchase order", "supplier": "Supplier", "amount": "Contract amount", "deliveryDate": "Delivery due date", "timeline": "Payment plan timeline", "notAvailable": "—", "stats": {"contracts": "Contracts", "pendingParse": "Pending contracts", "readyPlans": "Plans ready", "alerts": "Alert nodes"}, "ledgerFocus": {"due": "Due soon", "dueHint": "within 7 days", "overdue": "Overdue unpaid", "active": "Not yet due", "activeHint": "beyond 7 days", "dueThisMonth": "Due this month", "dueThisMonthHint": "this calendar month"}, "status": {"completed": "Completed", "needs_review": "Needs review", "pending": "Pending parse"}, "stateLabel": {"parsed": "Parsed", "needs_review": "Needs review", "pending": "Pending parse", "active": "Active"}, "nodeType": {"prepayment": "Prepayment", "shipment": "Shipment payment", "acceptance": "Acceptance payment", "warranty": "Warranty payment"}, "ruleConfirmed": "Confirmed", "prepaymentRule": "Alerts at 7/14/21 days after contract archival; request status comes from OA vendor prepayment requests.", "shipmentRule": "Alerts 7 days before delivery, on the due date, and 14 days after; request status comes from OA vendor prepayment requests.", "acceptanceRule": "Alerts at 30/40/60 days after acceptance archival; warranty alerts are 7 days before, on, and 14 days after maturity.", "pendingAlerts": "Pending alerts", "processing": "Payment initiated", "dataPending": "Data pending", "paid": "Paid", "stagePaid": "Paid", "amountRatioDate": "Amount / ratio · date", "applicant": "Applicant", "company": "Company", "erpSchema": "Payment ledger", "statusLabel": "Status", "contractPrefix": "Contract", "datePending": "Date pending", "dateMissing": {"prepayment": "Archive date missing", "shipment": "Delivery date missing", "acceptance": "Acceptance not archived", "warranty": "Warranty end date unknown"}, "dateMissingHint": {"prepayment": "Prepayment is counted from the contract archive date, which is still missing", "shipment": "Shipment payment follows the delivery date, which is still missing", "acceptance": "Acceptance payment starts after the acceptance form is archived", "warranty": "The warranty end date is calculated after acceptance is archived and the warranty period is confirmed"}, "statusNormal": "Normal", "statusNeedsCompletion": "Needs completion", "statusOverdue": "Overdue", "statusUpcoming": "Due soon", "statusActive": "Not yet due", "statusCompleted": "Completed", "totalPrefix": "Total", "contractSupplier": "Contract / supplier", "nextAlert": "Next alert", "triggerBasis": "Trigger basis", "alertDate": "Alert date", "alertRuleHint": "Each stage has three reminders on calendar days. Due items go out in the next Friday 18:00 digest. If the date is missing, no reminder is sent.\nPrepayment: day 7, 14, and 21 after contract archive (the page shows the first round)\nShipment payment: 7 days before the delivery date, on that date, and 14 days after\nAcceptance payment: day 30, 40, and 60 after the acceptance is archived\nWarranty payment: 7 days before warranty expiry, on that date, and 14 days after", "alertFirstRound": "Round 1", "payDate": "Payment date", "markPaid": "Mark as paid", "markPaidTitle": "Mark as paid", "markPaidHint": "{stage} · {amount} / {percent}%. Only this stage is updated. Unsent alerts are closed; sent records stay.", "markPaidDate": "Payment date", "markPaidRemark": "Note (optional)", "markPaidRemarkPlaceholder": "For example: finance confirmed payment, ERP number did not match", "markPaidConfirm": "Confirm paid", "markPaidSource": "Source: marked manually", "markPaidSuccess": "Marked as paid", "markPaidFailed": "Could not mark as paid", "processStatus": "Status", "owner": "Procurement owner", "oaData": "OA data", "contractRule": "Contract rule", "ownerDefault": "Procurement owner", "workflowNo": "Contract application workflow number", "contractNoPending": "Contract number pending Line truncated
|
||||
, "syncConfirm": "This syncs OA contract and acceptance data and only fills empty ledger fields. Existing values stay as they are. Continue?", "weeklySendConfirm": "This sends this week's pending payment-alert digest to recipients. Continue?", "scanAlertsConfirm": "This scans the current payment plan and creates pending alerts. It does not send them yet. Continue?"},
|
||||
"contractPaymentReview": {"title": "Contracts for Confirmation", "subtitle": "Contracts that do not match the equipment procurement synonym title groups, fail payment-ratio validation, or conflict with OA fields are excluded from payment alerts. Download the original contract to verify it.", "searchPlaceholder": "Contract number, purchase order, supplier, or applicant", "loadFailed": "Failed to load contracts for confirmation", "contractWorkflow": "Contract / application workflow number", "reason": "Reason for confirmation", "fallbackIssue": "Parsing result requires manual confirmation", "empty": "No contracts need confirmation", "manualTitle": "Review payment stages", "manualSubtitle": "{supplier} · PO {purchaseOrder}. Recognized stages are filled in and can be edited.", "backToReview": "Back to pending", "confirmLedger": "Add to ledger", "confirmSuccess": "Added to the contract ledger", "issueTitle": "Parse notes", "contractNoOptional": "Contract number (optional)", "contractNoPlaceholder": "Not found in the attachment", "percentage": "Percent %", "stageAmount": "Amount", "basisDate": "Date basis", "noStage": "No such stage", "ruleIdentity": "Purchase order and contract amount are valid", "rulePercent": "Enabled percentages total 100%. A blank percentage is not zero", "ruleAmount": "Each enabled amount equals the contract amount times its percentage", "ruleDate": "Prepayment and shipment payment need a date basis", "hintPrepayment": "Date basis is the contract archive date. Enter the deposit or prepayment percentage from the contract.", "hintShipment": "Date basis is the delivery date. If the contract only says “N days after the deposit”, enter a calendar date.", "hintAcceptance": "Date basis is the acceptance archive date. Leave it empty if acceptance is not archived yet.", "hintWarranty": "Check “No such stage” when there is no warranty payment share. A warranty period is not a percentage.", "formLoadFailed": "Failed to load the review form", "submitFailed": "Failed to submit the review", "manualAction": "Manual review", "fillHintTitle": "How to fill in"},
|
||||
"contractPaymentReparse": {"action": "Reparse contract original", "success": "Reparsed with attachment “{attachment}”", "failed": "Failed to reparse contract"},
|
||||
"contractPaymentReview": {"title": "Contracts for Confirmation", "subtitle": "Contracts that do not match the equipment procurement synonym title groups, fail payment-ratio validation, or conflict with OA fields are excluded from payment alerts. Download the original contract to verify it.", "searchPlaceholder": "Contract number, purchase order, supplier, or applicant", "loadFailed": "Failed to load contracts for confirmation", "contractWorkflow": "Contract / application workflow number", "reason": "Reason for confirmation", "fallbackIssue": "Parsing result requires manual confirmation", "empty": "No contracts need confirmation", "manualTitle": "Review payment stages", "manualSubtitle": "{supplier} · PO {purchaseOrder}. Recognized stages are filled in and can be edited.", "backToReview": "Back to pending", "confirmLedger": "Add to ledger", "confirmSuccess": "Added to the contract ledger", "issueTitle": "Parse notes", "contractNoOptional": "Contract number (optional)", "contractNoPlaceholder": "Not found in the attachment", "percentage": "Percent %", "stageAmount": "Amount", "basisDate": "Date basis", "noStage": "No such stage", "ruleIdentity": "Purchase order and contract amount are valid", "rulePercent": "Enabled percentages total 100%. A blank percentage is not zero", "ruleAmount": "Each enabled amount equals the contract amount times its percentage", "ruleDate": "Prepayment and shipment payment need a date basis", "hintPrepayment": "Date basis is the contract archive date. Enter the deposit or prepayment percentage from the contract.", "hintShipment": "Date basis is the delivery date. If the contract only says “N days after the deposit”, enter a calendar date.", "hintAcceptance": "Date basis is the acceptance archive date. Leave it empty if acceptance is not archived yet.", "hintWarranty": "Check “No such stage” when there is no warranty payment share. A warranty period is not a percentage.", "formLoadFailed": "Failed to load the review form", "submitFailed": "Failed to submit the review", "manualAction": "Manual review", "fillHintTitle": "How to fill in"},
|
||||
"title": "Contract Payment Alerts",
|
||||
"subtitle": "Sync OA contract, acceptance, and vendor prepayment requests; notify procurement roles through three escalation rounds.",
|
||||
"sessionHint": "Chat and history are hidden in this phase. Use the tabs above to open the ledger.",
|
||||
"sync": "Sync OA data",
|
||||
"moreActions": "More",
|
||||
"forceSync": "Force overwrite OA fields",
|
||||
"forceSyncConfirm": "This will overwrite existing OA data with non-empty fields returned this time and record an audit trail. Continue?",
|
||||
"reparseExisting": "Reparse existing contracts",
|
||||
"reparseExistingConfirm": "This will refresh all existing contract parsing results from archived attachments using the current rules. OA fields will not be synced or overwritten. Continue?",
|
||||
"scanAlerts": "Scan to generate alerts",
|
||||
"jobSubmitted": "Job submitted",
|
||||
"actionFailed": "Action failed",
|
||||
"loadFailed": "Failed to load contracts",
|
||||
"searchPlaceholder": "Search contract number, purchase order, supplier, or applicant",
|
||||
"allStatus": "All",
|
||||
"search": "Search",
|
||||
"ledger": "Contract ledger",
|
||||
"items": "items",
|
||||
"empty": "No contract data",
|
||||
"purchaseOrder": "Purchase order",
|
||||
"supplier": "Supplier",
|
||||
"amount": "Contract amount",
|
||||
"deliveryDate": "Delivery due date",
|
||||
"timeline": "Payment plan timeline",
|
||||
"notAvailable": "—",
|
||||
"stats": {
|
||||
"contracts": "Contracts",
|
||||
"pendingParse": "Pending contracts",
|
||||
"readyPlans": "Plans ready",
|
||||
"alerts": "Alert nodes"
|
||||
},
|
||||
"ledgerFocus": {
|
||||
"due": "Due soon",
|
||||
"dueHint": "within 7 days",
|
||||
"overdue": "Overdue unpaid",
|
||||
"active": "Not yet due",
|
||||
"activeHint": "beyond 7 days",
|
||||
"dueThisMonth": "Due this month",
|
||||
"dueThisMonthHint": "this calendar month"
|
||||
},
|
||||
"status": {
|
||||
"completed": "Completed",
|
||||
"needs_review": "Needs review",
|
||||
"pending": "Pending parse"
|
||||
},
|
||||
"stateLabel": {
|
||||
"parsed": "Parsed",
|
||||
"needs_review": "Needs review",
|
||||
"pending": "Pending parse",
|
||||
"active": "Active"
|
||||
},
|
||||
"nodeType": {
|
||||
"prepayment": "Prepayment",
|
||||
"shipment": "Shipment payment",
|
||||
"acceptance": "Acceptance payment",
|
||||
"warranty": "Warranty payment"
|
||||
},
|
||||
"ruleConfirmed": "Confirmed",
|
||||
"prepaymentRule": "Alerts at 7/14/21 days after contract archival; request status comes from OA vendor prepayment requests.",
|
||||
"shipmentRule": "Alerts 7 days before delivery, on the due date, and 14 days after; request status comes from OA vendor prepayment requests.",
|
||||
"acceptanceRule": "Alerts at 30/40/60 days after acceptance archival; warranty alerts are 7 days before, on, and 14 days after maturity.",
|
||||
"pendingAlerts": "Pending alerts",
|
||||
"processing": "Payment initiated",
|
||||
"dataPending": "Data pending",
|
||||
"paid": "Paid",
|
||||
"stagePaid": "Paid",
|
||||
"amountRatioDate": "Amount / ratio · date",
|
||||
"applicant": "Applicant",
|
||||
"company": "Company",
|
||||
"erpSchema": "Payment ledger",
|
||||
"statusLabel": "Status",
|
||||
"contractPrefix": "Contract",
|
||||
"datePending": "Date pending",
|
||||
"dateMissing": {
|
||||
"prepayment": "Archive date missing",
|
||||
"shipment": "Delivery date missing",
|
||||
"acceptance": "Acceptance not archived",
|
||||
"warranty": "Warranty end date unknown"
|
||||
},
|
||||
"dateMissingHint": {
|
||||
"prepayment": "Prepayment is counted from the contract archive date, which is still missing",
|
||||
"shipment": "Shipment payment follows the delivery date, which is still missing",
|
||||
"acceptance": "Acceptance payment starts after the acceptance form is archived",
|
||||
"warranty": "The warranty end date is calculated after acceptance is archived and the warranty period is confirmed"
|
||||
},
|
||||
"statusNormal": "Normal",
|
||||
"statusNeedsCompletion": "Needs completion",
|
||||
"statusOverdue": "Overdue",
|
||||
"statusUpcoming": "Due soon",
|
||||
"statusActive": "Not yet due",
|
||||
"statusCompleted": "Completed",
|
||||
"totalPrefix": "Total",
|
||||
"contractSupplier": "Contract / supplier",
|
||||
"nextAlert": "Next alert",
|
||||
"triggerBasis": "Trigger basis",
|
||||
"alertDate": "Alert date",
|
||||
"alertRuleHint": "Each stage has three reminders on calendar days. Due items go out in the next Friday 18:00 digest. If the date is missing, no reminder is sent.\nPrepayment: day 7, 14, and 21 after contract archive (the page shows the first round)\nShipment payment: 7 days before the delivery date, on that date, and 14 days after\nAcceptance payment: day 30, 40, and 60 after the acceptance is archived\nWarranty payment: 7 days before warranty expiry, on that date, and 14 days after",
|
||||
"alertFirstRound": "Round 1",
|
||||
"payDate": "Payment date",
|
||||
"markPaid": "Mark as paid",
|
||||
"markPaidTitle": "Mark as paid",
|
||||
"markPaidHint": "{stage} · {amount} / {percent}%. Only this stage is updated. Unsent alerts are closed; sent records stay.",
|
||||
"markPaidDate": "Payment date",
|
||||
"markPaidRemark": "Note (optional)",
|
||||
"markPaidRemarkPlaceholder": "For example: finance confirmed payment, ERP number did not match",
|
||||
"markPaidConfirm": "Confirm paid",
|
||||
"markPaidSource": "Source: marked manually",
|
||||
"markPaidSuccess": "Marked as paid",
|
||||
"markPaidFailed": "Could not mark as paid",
|
||||
"processStatus": "Status",
|
||||
"owner": "Procurement owner",
|
||||
"oaData": "OA data",
|
||||
"contractRule": "Contract rule",
|
||||
"ownerDefault": "Procurement owner",
|
||||
"workflowNo": "Contract application workflow number",
|
||||
"contractNoPending": "Contract number pending attachment parsing",
|
||||
"synced": "Synced",
|
||||
"detailSubtitle": "OA data, payment nodes, and WeCom alert records",
|
||||
"backToOverview": "Back to overview",
|
||||
"contractInfo": "OA contract details",
|
||||
"alertHistory": "Alert history",
|
||||
"alertRound": "Alert round {round}",
|
||||
"alertAudit": "Alert delivery record",
|
||||
"alertAuditEmpty": "No alert records",
|
||||
"alertNode": "Payment stage",
|
||||
"alertScheduledAt": "Scheduled date",
|
||||
"alertSentAt": "Sent at",
|
||||
"alertStatus": {
|
||||
"pending": "Pending",
|
||||
"sent": "Sent",
|
||||
"failed": "Failed"
|
||||
},
|
||||
"roundValue": "Round {round}",
|
||||
"weeklyBatchesTitle": "Weekly Summary Batches",
|
||||
"weeklyBatchesSubtitle": "Review recipient-level payment-alert summaries, Excel attachments, and delivery records.",
|
||||
"weeklySend": "Send alerts",
|
||||
"weeklyBatchSubmitted": "Send alert job submitted",
|
||||
"weeklyJobSent": "Sent {sent} batch(es)",
|
||||
"weeklyJobFailed": "{failed} batch(es) failed. The list has been refreshed; open the failure icon for the reason.",
|
||||
"weeklyJobPartial": "Sent {sent} batch(es); {failed} failed",
|
||||
"weeklyJobEmpty": "There are no pending alerts, so the batch list will not change",
|
||||
"weeklyJobTimeout": "The send task is still running in the background. Reopen this page later to see the result.",
|
||||
"weeklyJobError": "The send task failed",
|
||||
"weeklyBatchesLoadFailed": "Failed to load weekly summary batches",
|
||||
"batchNo": "Batch no.",
|
||||
"weekKey": "Week",
|
||||
"batchStatusLabel": "Delivery status",
|
||||
"batchFailureReason": "Failure reason",
|
||||
"batchFailureReasonEmpty": "No specific failure reason was recorded",
|
||||
"batchFailureReasonAria": "View the send failure reason",
|
||||
"batchFailureReasonLine": "{reason}: {detail}",
|
||||
"batchFailureReasonCode": {
|
||||
"notify_disabled": "WeCom notifications are disabled",
|
||||
"event_disabled": "The contract payment alert event is disabled",
|
||||
"user_unbound": "The recipient has no WeCom account",
|
||||
"textcard_failed": "Failed to send the WeCom card",
|
||||
"file_upload_failed": "Failed to upload the WeCom attachment",
|
||||
"file_failed": "Failed to send the WeCom attachment",
|
||||
"unknown": "Send failed"
|
||||
},
|
||||
"batchTotal": "Summary count",
|
||||
"batchExcel": "Excel attachment",
|
||||
"batchSentAt": "Sent at",
|
||||
"weeklyBatchesEmpty": "No weekly summary batches",
|
||||
"weeklyPendingSummary": "{count} pending this week · next send {datetime}",
|
||||
"weeklyPendingCountOnly": "{count} pending this week",
|
||||
"downloadExcel": "Download Excel",
|
||||
"excelDownloadFailed": "Failed to download the alert attachment",
|
||||
"batchStatus": {
|
||||
"pending": "Pending",
|
||||
"sent": "Sent",
|
||||
"failed": "Failed",
|
||||
"processing": "Processing",
|
||||
"resolved": "Alerts stopped"
|
||||
},
|
||||
"backToLedger": "Back",
|
||||
"detailLoadFailed": "Failed to load contract details",
|
||||
"detailLoading": "Loading contract details…",
|
||||
"detailOverview": "Contract Overview",
|
||||
"detailAttachments": "Original Attachments",
|
||||
"detailPaymentPlan": "Payment Plan",
|
||||
"detailAlertHistory": "Alert History",
|
||||
"archiveDate": "Contract archive date",
|
||||
"archiveDateHint": "This date is when the contract application form was archived",
|
||||
"parseStatus": "Parsing status",
|
||||
"parseIssueTitle": "Parse issues",
|
||||
"planStatus": "Plan status",
|
||||
"attachmentsEmpty": "No archived original contract attachments",
|
||||
"downloadAttachment": "Download",
|
||||
"previewAttachment": "Preview",
|
||||
"attachmentPreviewFailed": "Failed to preview the attachment",
|
||||
"attachmentPreviewUnsupported": "This format cannot be previewed online. Download the file to view it.",
|
||||
"attachmentDownloadFailed": "Failed to download contract attachment",
|
||||
"paymentPlanEmpty": "No payment plan to display",
|
||||
"anchorDate": "Date basis",
|
||||
"nodeStatus": {
|
||||
"pending": "Pending",
|
||||
"active": "Active",
|
||||
"paid": "Paid",
|
||||
"processing": "Processing",
|
||||
"resolved": "Alerts stopped",
|
||||
"upcoming": "Due soon",
|
||||
"notStarted": "Not started",
|
||||
"overdue": "Overdue",
|
||||
"review": "Needs review",
|
||||
"notApplicable": "Not applicable"
|
||||
},
|
||||
"syncConfirm": "This syncs OA contract and acceptance data and only fills empty ledger fields. Existing values stay as they are. Continue?",
|
||||
"weeklySendConfirm": "This sends this week's pending payment-alert digest to recipients. Continue?",
|
||||
"scanAlertsConfirm": "This scans the current payment plan and creates pending alerts. It does not send them yet. Continue?"
|
||||
},
|
||||
"contractPaymentReview": {
|
||||
"title": "Contracts for Confirmation",
|
||||
"subtitle": "Contracts that do not match the equipment procurement synonym title groups, fail payment-ratio validation, or conflict with OA fields are excluded from payment alerts. Download the original contract to verify it.",
|
||||
"searchPlaceholder": "Contract number, purchase order, supplier, or applicant",
|
||||
"loadFailed": "Failed to load contracts for confirmation",
|
||||
"contractWorkflow": "Contract / application workflow number",
|
||||
"reason": "Reason for confirmation",
|
||||
"fallbackIssue": "Parsing result requires manual confirmation",
|
||||
"empty": "No contracts need confirmation",
|
||||
"manualTitle": "Review payment stages",
|
||||
"manualSubtitle": "{supplier} · PO {purchaseOrder}. Recognized stages are filled in and can be edited.",
|
||||
"backToReview": "Back to pending",
|
||||
"confirmLedger": "Add to ledger",
|
||||
"confirmSuccess": "Added to the contract ledger",
|
||||
"issueTitle": "Parse notes",
|
||||
"contractNoOptional": "Contract number (optional)",
|
||||
"contractNoPlaceholder": "Not found in the attachment",
|
||||
"percentage": "Percent %",
|
||||
"stageAmount": "Amount",
|
||||
"basisDate": "Date basis",
|
||||
"noStage": "No such stage",
|
||||
"ruleIdentity": "Purchase order and contract amount are valid",
|
||||
"rulePercent": "Enabled percentages total 100%. A blank percentage is not zero",
|
||||
"ruleAmount": "Each enabled amount equals the contract amount times its percentage",
|
||||
"ruleDate": "Prepayment and shipment payment need a date basis",
|
||||
"hintPrepayment": "Date basis is the contract archive date. Enter the deposit or prepayment percentage from the contract.",
|
||||
"hintShipment": "Date basis is the delivery date. If the contract only says “N days after the deposit”, enter a calendar date.",
|
||||
"hintAcceptance": "Date basis is the acceptance archive date. Leave it empty if acceptance is not archived yet.",
|
||||
"hintWarranty": "Check “No such stage” when there is no warranty payment share. A warranty period is not a percentage.",
|
||||
"formLoadFailed": "Failed to load the review form",
|
||||
"submitFailed": "Failed to submit the review",
|
||||
"manualAction": "Manual review",
|
||||
"fillHintTitle": "How to fill in"
|
||||
},
|
||||
"contractPaymentReparse": {
|
||||
"action": "Reparse contract original",
|
||||
"success": "Reparsed with attachment “{attachment}”",
|
||||
"failed": "Failed to reparse contract"
|
||||
},
|
||||
"procurementContract": {
|
||||
"title": "Procurement Contract Review",
|
||||
"subtitle": "Manage templates, risk red-line rules, and review history",
|
||||
@@ -5520,8 +5800,14 @@
|
||||
"verify_duplicate": "Duplicate check"
|
||||
}
|
||||
},
|
||||
"writeLabels": { "yes": "Yes", "no": "No" },
|
||||
"idempotencyLabels": { "none": "None", "invoice": "Idempotent by document no." },
|
||||
"writeLabels": {
|
||||
"yes": "Yes",
|
||||
"no": "No"
|
||||
},
|
||||
"idempotencyLabels": {
|
||||
"none": "None",
|
||||
"invoice": "Idempotent by document no."
|
||||
},
|
||||
"credentialTypeLabels": {
|
||||
"password": "Username + Password",
|
||||
"token": "Token",
|
||||
@@ -5655,6 +5941,7 @@
|
||||
"formatJson": "Format",
|
||||
"invalidJsonHint": "Invalid JSON — fix it before saving",
|
||||
"testOkBadge": "Connected",
|
||||
"testNotRun": "Not tested",
|
||||
"testFailBadge": "Failed",
|
||||
"testDetailToggle": "Click to expand/collapse details",
|
||||
"advancedHints": {
|
||||
@@ -5850,7 +6137,6 @@
|
||||
"back": "Back to dwell list",
|
||||
"canAccept": "Can accept",
|
||||
"cannotAcceptNote": "Reason it cannot be accepted",
|
||||
"cannotAcceptNote": "Reason it cannot be accepted",
|
||||
"returnFlag": "Returned",
|
||||
"unspecified": "Not specified",
|
||||
"flowStatus": "Flow status",
|
||||
@@ -5892,6 +6178,14 @@
|
||||
"loading": "Loading…",
|
||||
"empty": "No transfer types yet",
|
||||
"emptyHint": "Click \"New Type\" to create the first in-transit transfer type.",
|
||||
"noMatch": "No matching transfer types",
|
||||
"noMatchHint": "Try adjusting the keyword, or clear the filters.",
|
||||
"clearFilters": "Clear filters",
|
||||
"noRules": "No rules",
|
||||
"otherNames": "Names in other languages (optional)",
|
||||
"unsavedTitle": "Unsaved changes",
|
||||
"unsavedConfirm": "Your changes have not been saved and will be lost. Close anyway?",
|
||||
"emptyScopeTitle": "Save type without scope rules",
|
||||
"colCode": "Code",
|
||||
"colName": "Name",
|
||||
"colRules": "Rules",
|
||||
@@ -5929,6 +6223,7 @@
|
||||
"modeMapped": "Mapped",
|
||||
"modeFixed": "Fixed",
|
||||
"fixedCodeLabel": "Warehouse Code",
|
||||
"fixedCodePlaceholder": "Select or enter a warehouse code",
|
||||
"orgLabel": "External Org Override",
|
||||
"orgHint": "Leave empty to inherit the mapped external org",
|
||||
"mappingCheckOk": "Warehouse code exists in the mapping archive",
|
||||
|
||||
@@ -44,6 +44,9 @@
|
||||
"prevPage": "Previous",
|
||||
"nextPage": "Next"
|
||||
},
|
||||
"filter": {
|
||||
"all": "All"
|
||||
},
|
||||
"sort": {
|
||||
"unsorted": "Click to sort",
|
||||
"asc": "Ascending, click for descending",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"edit": "แก้ไข",
|
||||
"delete": "ลบ",
|
||||
"nav": {
|
||||
"transferTypes": "ประเภทการโอนระหว่างทาง",
|
||||
"transferTypes": "ประเภทการโอน",
|
||||
"dashboard": "แดชบอร์ด",
|
||||
"approvals": "การอนุมัติผู้ใช้",
|
||||
"users": "การจัดการผู้ใช้",
|
||||
@@ -637,9 +637,27 @@
|
||||
"pathSectionConfigured": "ตั้งค่าแล้ว",
|
||||
"pathSectionNotConfigured": "ยังไม่ได้ตั้งค่า",
|
||||
"parsingProfiles": "แผนการแยกวิเคราะห์ไฟล์สต็อก",
|
||||
"parsingProfilesHelp": "จัดการกฎการอ่านไฟล์ที่ใช้ร่วมกันได้ระหว่างไซต์: การแยกวิเคราะห์สต็อกใช้สารบัญฟิลด์สต็อกและคีย์จับคู่คำสั่งซื้อ ส่วนการรับ-เคลื่อนไหวใช้ฟิลด์มาตรฐาน (สัญญาแบบอ่านอย่างเดียว)",
|
||||
"inventoryParsing": { "code": "รหัสแผนการอ่านสต็อก", "name": "ชื่อแผนการอ่านสต็อก", "sampleFile": "ไฟล์ตัวอย่างสต็อก", "sampleFileHint": "อัปโหลด Excel หรือ CSV แล้วระบบจะอ่านชีต หัวตาราง และตัวอย่างเล็กน้อยเพื่อยืนยันแผนการอ่านสต็อก", "sampleRequired": "โปรดอัปโหลดไฟล์ตัวอย่างสต็อกและทำการระบุโครงสร้างให้เสร็จก่อน", "sourceHeader": "หัวตารางไฟล์สต็อก", "fieldMappings": "การจับคู่ฟิลด์มาตรฐานสต็อก", "analysisPreview": "ภาพรวมการวิเคราะห์สต็อก" },
|
||||
"movementParsing": { "code": "รหัสแผนการอ่านการเคลื่อนไหว", "name": "ชื่อแผนการอ่านการเคลื่อนไหว", "sampleFile": "ไฟล์ตัวอย่างการรับ", "sampleFileHint": "อัปโหลด Excel หรือ CSV แล้วระบบจะอ่านชีต หัวตาราง และตัวอย่างเล็กน้อยเพื่อยืนยันการอ่านการรับ-เคลื่อนไหว", "sampleRequired": "โปรดอัปโหลดไฟล์ตัวอย่างการรับ-เคลื่อนไหวและทำการระบุโครงสร้างให้เสร็จก่อน", "sourceHeader": "หัวตารางไฟล์การเคลื่อนไหว", "fieldMappings": "การจับคู่ฟิลด์มาตรฐานการเคลื่อนไหว", "analysisPreview": "ภาพรวมการวิเคราะห์การเคลื่อนไหว" },
|
||||
"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": "รายการฟิลด์สต็อก",
|
||||
@@ -695,21 +713,38 @@
|
||||
"inventorySampleRequired": "โปรดอัปโหลดไฟล์ตัวอย่างสต็อกและทำการระบุโครงสร้างให้เสร็จก่อน",
|
||||
"parsingProfileName": "ชื่อแผนการอ่านไฟล์",
|
||||
"parsingPurposeLabel": "วัตถุประสงค์ของกฎ",
|
||||
"parsingPurposeHint": "เปลี่ยนวัตถุประสงค์ไม่ได้หลังสร้าง: การแยกวิเคราะห์สินค้าคงเหลือใช้สารบัญฟิลด์สินค้าคงเหลือ ส่วนการรับ-เคลื่อนไหวใช้ฟิลด์มาตรฐาน (สัญญาแบบอ่านอย่างเดียว)",
|
||||
"parsingPurpose": { "inventory": "แยกวิเคราะห์สินค้าคงเหลือ", "movement": "การรับ-เคลื่อนไหว" },
|
||||
"parsingPurposeHint": "เปลี่ยนวัตถุประสงค์ไม่ได้หลังสร้าง: การแยกวิเคราะห์สินค้าคงเหลือใช้สารบัญฟิลด์สินค้าคงเหลือ ส่วนการแยกวิเคราะห์ขาเข้าใช้ฟิลด์มาตรฐาน (สัญญาแบบอ่านอย่างเดียว)",
|
||||
"parsingPurpose": {
|
||||
"onhand": "สต็อก",
|
||||
"inbound": "เข้า",
|
||||
"outbound": "ออก"
|
||||
},
|
||||
"movementMappingHint": "ฟิลด์มาตรฐานเป็นสัญญาแบบอ่านอย่างเดียว (✱ จำเป็น, 🔑 ตัวตนสำหรับจับคู่) เพียงเลือกหัวคอลัมน์รายงานให้แต่ละฟิลด์",
|
||||
"movementRequiredMark": "จำเป็น",
|
||||
"movementIdentityMark": "ตัวตนจับคู่",
|
||||
"movementStandardField": "ฟิลด์มาตรฐานการเคลื่อนไหว",
|
||||
"movementBindingLabel": "กฎการแยกวิเคราะห์การเคลื่อนไหว",
|
||||
"movementBindingLabel": "กฎการแยกวิเคราะห์ขาเข้า",
|
||||
"movementBindingNone": "ยังไม่ผูก",
|
||||
"movementBindingHint": "เมื่อผูกกฎที่เผยแพร่แล้ว การจับคู่จะใช้ไฟล์ที่เก็บถาวรซ้ำ หากไม่ผูก การจับคู่จะไม่เรียกดึงข้อมูล (fail-closed)",
|
||||
"movementBindingHint": "เมื่อผูกกฎขาเข้าที่เผยแพร่แล้ว การจับคู่จะใช้ไฟล์ที่เก็บถาวรซ้ำ หากไม่ผูก การจับคู่จะไม่เรียกดึงข้อมูล (fail-closed)",
|
||||
"movementFields": {
|
||||
"doc_no": "เลขที่เอกสาร", "line_no": "ลำดับรายการ", "in_out_flag": "เข้า/ออก", "material_code": "รหัสวัสดุ",
|
||||
"material_name": "ชื่อวัสดุ", "warehouse_code": "คลังสินค้า", "storage_code": "ตำแหน่งจัดเก็บ", "lot_no": "เลขล็อต",
|
||||
"quantity": "จำนวน", "movement_date": "วันที่เคลื่อนไหว", "unit": "หน่วย",
|
||||
"line_seq": "ลำดับรายการย่อย", "specification": "สเปคสินค้า", "order_type": "ประเภทคำสั่งซื้อ",
|
||||
"odm_id": "รหัส ODM", "odm_name": "ชื่อ ODM", "carton_id": "หมายเลขกล่อง", "pallet_id": "หมายเลขพาเลท"
|
||||
"doc_no": "เลขที่เอกสาร",
|
||||
"line_no": "ลำดับรายการ",
|
||||
"in_out_flag": "เข้า/ออก",
|
||||
"material_code": "รหัสวัสดุ",
|
||||
"material_name": "ชื่อวัสดุ",
|
||||
"warehouse_code": "คลังสินค้า",
|
||||
"storage_code": "ตำแหน่งจัดเก็บ",
|
||||
"lot_no": "เลขล็อต",
|
||||
"quantity": "จำนวน",
|
||||
"movement_date": "วันที่เคลื่อนไหว",
|
||||
"unit": "หน่วย",
|
||||
"line_seq": "ลำดับรายการย่อย",
|
||||
"specification": "สเปคสินค้า",
|
||||
"order_type": "ประเภทคำสั่งซื้อ",
|
||||
"odm_id": "รหัส ODM",
|
||||
"odm_name": "ชื่อ ODM",
|
||||
"carton_id": "หมายเลขกล่อง",
|
||||
"pallet_id": "หมายเลขพาเลท"
|
||||
},
|
||||
"inventoryAnalysisFailed": "การระบุโครงสร้างไฟล์สต็อกล้มเหลว",
|
||||
"inventoryAnalysisPreview": "ตัวอย่างผลการระบุ",
|
||||
@@ -2468,8 +2503,8 @@
|
||||
"platformJobFileAssetCleanup": "Temporary file asset cleanup",
|
||||
"transferSourceCodes": "Source instances",
|
||||
"transferRecoverHistory": "Recover retryable history",
|
||||
"transferReceiptDateFrom": "Receipt date from (T-N)",
|
||||
"transferReceiptDateTo": "Receipt date to (T-N)",
|
||||
"transferReceiptDateFrom": "วันที่เคลื่อนไหวเริ่ม (T-N)",
|
||||
"transferReceiptDateTo": "วันที่เคลื่อนไหวสิ้นสุด (T-N)",
|
||||
"platformJobFixedAssetsSnapshot": "Fixed assets snapshot",
|
||||
"shippingInventoryJobHint": "ดึงข้อมูลสต็อกจากแหล่งที่กำหนดตามกำหนดเวลา โดย RPA worker ส่งออกแบบอะซิงโครนัส",
|
||||
"shippingInventoryJobParams": "พารามิเตอร์ Job (ไม่บังคับ)",
|
||||
@@ -2684,19 +2719,19 @@
|
||||
"receiptRawZip": "ใบรับดิบ",
|
||||
"columns": {
|
||||
"skippedCount": "ข้าม",
|
||||
"runNo": "Run ID",
|
||||
"startedAt": "Started at",
|
||||
"finishedAt": "Finished at",
|
||||
"status": "Status",
|
||||
"totalCount": "Processed",
|
||||
"successCount": "Success",
|
||||
"failedCount": "Failed",
|
||||
"excelExportFailedHint": "Inventory sources succeeded, but schedule Excel export failed",
|
||||
"wecomNotified": "WeCom notify",
|
||||
"detail": "Detail",
|
||||
"log": "Log",
|
||||
"skippedCountReceipt": "ไม่มีใบรับ/ข้าม",
|
||||
"skippedCountInventory": "ไม่มีสต็อก/ข้าม"
|
||||
"runNo": "Run ID",
|
||||
"startedAt": "Started at",
|
||||
"finishedAt": "Finished at",
|
||||
"status": "Status",
|
||||
"totalCount": "Processed",
|
||||
"successCount": "Success",
|
||||
"failedCount": "Failed",
|
||||
"excelExportFailedHint": "Inventory sources succeeded, but schedule Excel export failed",
|
||||
"wecomNotified": "WeCom notify",
|
||||
"detail": "Detail",
|
||||
"log": "Log",
|
||||
"skippedCountReceipt": "ไม่มีใบรับ/ข้าม",
|
||||
"skippedCountInventory": "ไม่มีสต็อก/ข้าม"
|
||||
},
|
||||
"deleteConfirmMessage": "ยืนยันการลบตารางเวลา \"{name}\"?",
|
||||
"msg": {
|
||||
@@ -2710,9 +2745,9 @@
|
||||
"runNowWaitTimeout": "รอการรันเสร็จสิ้นเกินเวลาที่กำหนด (ประมาณ 15 นาที) หยุดรีเฟรชอัตโนมัติแล้ว โปรดค้นหาบันทึกด้วยตนเอง",
|
||||
"downloadExcelFailed": "ดาวน์โหลด Excel ล้มเหลว",
|
||||
"downloadInventoryRawZipFailed": "ดาวน์โหลด ZIP สต็อกดิบล้มเหลว",
|
||||
"deleteFailed": "ลบตารางเวลาล้มเหลว",
|
||||
"testQueryFailed": "Test query failed",
|
||||
"downloadReceiptRawZipFailed": "ดาวน์โหลด ZIP ใบรับดิบล้มเหลว"
|
||||
"deleteFailed": "ลบตารางเวลาล้มเหลว",
|
||||
"testQueryFailed": "Test query failed",
|
||||
"downloadReceiptRawZipFailed": "ดาวน์โหลด ZIP ใบรับดิบล้มเหลว"
|
||||
},
|
||||
"difySnapshot": {
|
||||
"title": "สแนปช็อตการทำงาน Dify (ตรวจสอบ)",
|
||||
@@ -3819,7 +3854,7 @@
|
||||
"approved": "อนุมัติแล้ว",
|
||||
"superseded": "หมดอายุแล้ว"
|
||||
},
|
||||
"samples": "ตัวอย่าง blind test ที่ยืนยันแล้ว: {count}/{required} · {status}",
|
||||
"samples": "ตัวอย่าง blind test ที่ยืนยันแล้ว: {count}/{required}",
|
||||
"notRun": "ยังไม่ดำเนินการ",
|
||||
"approvedHint": "การทดสอบแบบปิดบังนี้ได้รับอนุมัติแล้ว ไม่ต้องดำเนินการหรืออนุมัติซ้ำ",
|
||||
"selectIndependentSample": "เลือกตัวอย่างอิสระ",
|
||||
@@ -5131,11 +5166,256 @@
|
||||
}
|
||||
},
|
||||
"contractPayment": {
|
||||
"title": "แจ้งเตือนการชำระเงินตามสัญญา", "subtitle": "ซิงก์สัญญา OA การรับมอบ และคำขอเบิกเงินล่วงหน้าของผู้ขาย พร้อมแจ้งเตือน 3 ระดับ", "sessionHint": "ระยะนี้ยังไม่ใช้แชทและประวัติการสนทนา เปิดบัญชีจากแท็บด้านบน", "sync": "ซิงก์ข้อมูล OA", "moreActions": "เพิ่มเติม", "forceSync": "เขียนทับฟิลด์ OA แบบบังคับ", "forceSyncConfirm": "ระบบจะเขียนทับข้อมูล OA เดิมด้วยฟิลด์ที่ไม่ว่างจาก OA ครั้งนี้และบันทึกการตรวจสอบ ต้องการดำเนินการต่อหรือไม่?", "reparseExisting": "แยกวิเคราะห์สัญญาเดิมทั้งหมดใหม่", "reparseExistingConfirm": "ระบบจะรีเฟรชผลการแยกข้อมูลของสัญญาเดิมทั้งหมดจากไฟล์แนบที่จัดเก็บตามกฎปัจจุบัน โดยจะไม่ซิงก์หรือเขียนทับฟิลด์ OA ต้องการดำเนินการต่อหรือไม่?", "scanAlerts": "สแกนเพื่อสร้างแจ้งเตือน", "jobSubmitted": "ส่งงานแล้ว", "actionFailed": "ดำเนินการไม่สำเร็จ", "loadFailed": "โหลดสัญญาไม่สำเร็จ", "searchPlaceholder": "ค้นหาเลขที่สัญญา ใบสั่งซื้อ ผู้ขาย หรือผู้ขอ", "allStatus": "ทั้งหมด", "search": "ค้นหา", "ledger": "ทะเบียนสัญญา", "items": "รายการ", "empty": "ไม่มีข้อมูลสัญญา", "purchaseOrder": "ใบสั่งซื้อ", "supplier": "ผู้ขาย", "amount": "มูลค่าสัญญา", "deliveryDate": "กำหนดส่งมอบ", "timeline": "ไทม์ไลน์แผนการชำระเงิน", "notAvailable": "—", "stats": {"contracts": "สัญญา", "pendingParse": "สัญญาที่รอดำเนินการ", "readyPlans": "แผนพร้อมใช้", "alerts": "จุดแจ้งเตือน"}, "ledgerFocus": {"due": "ใกล้ครบกำหนด", "dueHint": "ใน 7 วัน", "overdue": "ค้างชำระเกินกำหนด", "active": "ยังไม่ถึงกำหนด", "activeHint": "เกิน 7 วัน", "dueThisMonth": "ถึงกำหนดเดือนนี้", "dueThisMonthHint": "เดือนปฏิทินนี้"}, "status": {"completed": "เสร็จสิ้น", "needs_review": "ต้องตรวจสอบ", "pending": "รอแยกข้อมูล"}, "stateLabel": {"parsed": "แยกข้อมูลแล้ว", "needs_review": "ต้องตรวจสอบ", "pending": "รอแยกข้อมูล", "active": "ใช้งานอยู่"}, "nodeType": {"prepayment": "เงินล่วงหน้า", "shipment": "เงินก่อนส่ง", "acceptance": "เงินรับมอบ", "warranty": "เงินประกัน"}, "ruleConfirmed": "ยืนยันแล้ว", "prepaymentRule": "แจ้งเตือนวันที่ 7/14/21 หลังจัดเก็บสัญญา; สถานะคำขออ้างอิง OA.", "shipmentRule": "แจ้งเตือนก่อนกำหนดส่ง 7 วัน วันครบกำหนด และหลังครบกำหนด 14 วัน; สถานะคำขออ้างอิง OA.", "acceptanceRule": "แจ้งเตือนวันที่ 30/40/60 หลังจัดเก็บใบรับมอบ; เงินประกันแจ้งก่อนครบกำหนด 7 วัน วันครบกำหนด และหลังครบกำหนด 14 วัน.", "pendingAlerts": "แจ้งเตือนที่รอดำเนินการ", "processing": "เริ่มชำระแล้ว", "dataPending": "รอข้อมูล", "paid": "ชำระแล้ว", "stagePaid": "ชำระแล้ว", "amountRatioDate": "จำนวนเงิน / สัดส่วน · วันที่", "applicant": "ผู้ขอ", "company": "บริษัท", "erpSchema": "ชุดบัญชี", "statuLine truncated
|
||||
, "syncConfirm": "ระบบจะซิงก์ข้อมูลสัญญาและการรับมอบจาก OA และเติมเฉพาะช่องที่ว่างในบัญชี โดยไม่เขียนทับข้อมูลที่มีอยู่ ต้องการดำเนินการต่อหรือไม่?", "weeklySendConfirm": "ระบบจะส่งสรุปการแจ้งเตือนการชำระที่รอส่งของสัปดาห์นี้ให้ผู้รับ ต้องการดำเนินการต่อหรือไม่?", "scanAlertsConfirm": "ระบบจะสแกนแผนการชำระปัจจุบันและสร้างรายการแจ้งเตือนที่รอส่ง โดยยังไม่ส่งทันที ต้องการดำเนินการต่อหรือไม่?"},
|
||||
"contractPaymentReview": {"title": "สัญญาที่รอยืนยัน", "subtitle": "สัญญาที่ไม่ตรงกับกลุ่มหัวข้อคำพ้องของสัญญาจัดซื้ออุปกรณ์ ตรวจสอบสัดส่วนการชำระเงินไม่ผ่าน หรือขัดแย้งกับฟิลด์ OA จะไม่เข้าสู่การแจ้งเตือนการชำระเงิน โปรดดาวน์โหลดต้นฉบับเพื่อตรวจสอบ", "searchPlaceholder": "เลขที่สัญญา ใบสั่งซื้อ ผู้ขาย หรือผู้ขอ", "loadFailed": "โหลดสัญญาที่รอยืนยันไม่สำเร็จ", "contractWorkflow": "เลขที่สัญญา / เวิร์กโฟลว์ใบสมัคร", "reason": "เหตุผลที่ต้องยืนยัน", "fallbackIssue": "ผลการแยกข้อมูลต้องยืนยันโดยผู้ใช้", "empty": "ไม่มีสัญญาที่รอยืนยัน", "manualTitle": "ตรวจสอบงวดชำระ", "manualSubtitle": "{supplier} · ใบสั่งซื้อ {purchaseOrder} งวดที่ระบบอ่านได้ถูกเติมไว้แล้วและแก้ไขได้", "backToReview": "กลับไปรายการรอยืนยัน", "confirmLedger": "บันทึกเข้าบัญชีสัญญา", "confirmSuccess": "เข้าบัญชีสัญญาแล้ว", "issueTitle": "หมายเหตุจากการอ่านสัญญา", "contractNoOptional": "เลขที่สัญญา (ไม่บังคับ)", "contractNoPlaceholder": "ไม่พบเลขที่สัญญาในไฟล์แนบ", "percentage": "สัดส่วน %", "stageAmount": "จำนวนเงิน", "basisDate": "วันที่อ้างอิง", "noStage": "ไม่มีงวดนี้", "ruleIdentity": "เลขที่ใบสั่งซื้อและยอดสัญญาถูกต้อง", "rulePercent": "สัดส่วนของงวดที่เปิดใช้รวมกันต้องเป็น 100% ช่องว่างไม่นับเป็น 0", "ruleAmount": "จำนวนเงินของแต่ละงวดเท่ากับยอดสัญญาคูณสัดส่วน", "ruleDate": "เงินมัดจำและเงินค่าสินค้าต้องระบุวันที่อ้างอิง", "hintPrepayment": "วันที่อ้างอิงคือวันจัดเก็บสัญญา หากสัญญาระบุสัดส่วนเงินมัดจำ ให้กรอกที่นี่", "hintShipment": "วันที่อ้างอิงคือกำหนดส่งมอบ หากสัญญาเขียนเพียง “หลังรับเงินมัดจำ N วัน” ให้กรอกวันที่จริง", "hintAcceptance": "วันที่อ้างอิงคือวันจัดเก็บใบตรวจรับ ถ้ายังไม่จัดเก็บให้เว้นว่าง", "hintWarranty": "หากไม่มีสัดส่วนเงินประกันผลงาน ให้เลือกไม่มีงวดนี้ ระยะประกันไม่ใช่สัดส่วนการชำระ", "formLoadFailed": "เปิดแบบฟอร์มตรวจสอบไม่สำเร็จ", "submitFailed": "ส่งผลการตรวจสอบไม่สำเร็จ", "manualAction": "ตรวจสอบด้วยตนเอง", "fillHintTitle": "วิธีกรอก"},
|
||||
"contractPaymentReparse": {"action": "แยกข้อมูลจากต้นฉบับอีกครั้ง", "success": "แยกข้อมูลใหม่ด้วยไฟล์แนบ “{attachment}” แล้ว", "failed": "แยกข้อมูลสัญญาใหม่ไม่สำเร็จ"},
|
||||
"contractPaymentReview": {"title": "สัญญาที่รอยืนยัน", "subtitle": "สัญญาที่ไม่ตรงกับกลุ่มหัวข้อคำพ้องของสัญญาจัดซื้ออุปกรณ์ ตรวจสอบสัดส่วนการชำระเงินไม่ผ่าน หรือขัดแย้งกับฟิลด์ OA จะไม่เข้าสู่การแจ้งเตือนการชำระเงิน โปรดดาวน์โหลดต้นฉบับเพื่อตรวจสอบ", "searchPlaceholder": "เลขที่สัญญา ใบสั่งซื้อ ผู้ขาย หรือผู้ขอ", "loadFailed": "โหลดสัญญาที่รอยืนยันไม่สำเร็จ", "contractWorkflow": "เลขที่สัญญา / เวิร์กโฟลว์ใบสมัคร", "reason": "เหตุผลที่ต้องยืนยัน", "fallbackIssue": "ผลการแยกข้อมูลต้องยืนยันโดยผู้ใช้", "empty": "ไม่มีสัญญาที่รอยืนยัน", "manualTitle": "ตรวจสอบงวดชำระ", "manualSubtitle": "{supplier} · ใบสั่งซื้อ {purchaseOrder} งวดที่ระบบอ่านได้ถูกเติมไว้แล้วและแก้ไขได้", "backToReview": "กลับไปรายการรอยืนยัน", "confirmLedger": "บันทึกเข้าบัญชีสัญญา", "confirmSuccess": "เข้าบัญชีสัญญาแล้ว", "issueTitle": "หมายเหตุจากการอ่านสัญญา", "contractNoOptional": "เลขที่สัญญา (ไม่บังคับ)", "contractNoPlaceholder": "ไม่พบเลขที่สัญญาในไฟล์แนบ", "percentage": "สัดส่วน %", "stageAmount": "จำนวนเงิน", "basisDate": "วันที่อ้างอิง", "noStage": "ไม่มีงวดนี้", "ruleIdentity": "เลขที่ใบสั่งซื้อและยอดสัญญาถูกต้อง", "rulePercent": "สัดส่วนของงวดที่เปิดใช้รวมกันต้องเป็น 100% ช่องว่างไม่นับเป็น 0", "ruleAmount": "จำนวนเงินของแต่ละงวดเท่ากับยอดสัญญาคูณสัดส่วน", "ruleDate": "เงินมัดจำและเงินค่าสินค้าต้องระบุวันที่อ้างอิง", "hintPrepayment": "วันที่อ้างอิงคือวันจัดเก็บสัญญา หากสัญญาระบุสัดส่วนเงินมัดจำ ให้กรอกที่นี่", "hintShipment": "วันที่อ้างอิงคือกำหนดส่งมอบ หากสัญญาเขียนเพียง “หลังรับเงินมัดจำ N วัน” ให้กรอกวันที่จริง", "hintAcceptance": "วันที่อ้างอิงคือวันจัดเก็บใบตรวจรับ ถ้ายังไม่จัดเก็บให้เว้นว่าง", "hintWarranty": "หากไม่มีสัดส่วนเงินประกันผลงาน ให้เลือกไม่มีงวดนี้ ระยะประกันไม่ใช่สัดส่วนการชำระ", "formLoadFailed": "เปิดแบบฟอร์มตรวจสอบไม่สำเร็จ", "submitFailed": "ส่งผลการตรวจสอบไม่สำเร็จ", "manualAction": "ตรวจสอบด้วยตนเอง", "fillHintTitle": "วิธีกรอก"},
|
||||
"title": "แจ้งเตือนการชำระเงินตามสัญญา",
|
||||
"subtitle": "ซิงก์สัญญา OA การรับมอบ และคำขอเบิกเงินล่วงหน้าของผู้ขาย พร้อมแจ้งเตือน 3 ระดับ",
|
||||
"sessionHint": "ระยะนี้ยังไม่ใช้แชทและประวัติการสนทนา เปิดบัญชีจากแท็บด้านบน",
|
||||
"sync": "ซิงก์ข้อมูล OA",
|
||||
"moreActions": "เพิ่มเติม",
|
||||
"forceSync": "เขียนทับฟิลด์ OA แบบบังคับ",
|
||||
"forceSyncConfirm": "ระบบจะเขียนทับข้อมูล OA เดิมด้วยฟิลด์ที่ไม่ว่างจาก OA ครั้งนี้และบันทึกการตรวจสอบ ต้องการดำเนินการต่อหรือไม่?",
|
||||
"reparseExisting": "แยกวิเคราะห์สัญญาเดิมทั้งหมดใหม่",
|
||||
"reparseExistingConfirm": "ระบบจะรีเฟรชผลการแยกข้อมูลของสัญญาเดิมทั้งหมดจากไฟล์แนบที่จัดเก็บตามกฎปัจจุบัน โดยจะไม่ซิงก์หรือเขียนทับฟิลด์ OA ต้องการดำเนินการต่อหรือไม่?",
|
||||
"scanAlerts": "สแกนเพื่อสร้างแจ้งเตือน",
|
||||
"jobSubmitted": "ส่งงานแล้ว",
|
||||
"actionFailed": "ดำเนินการไม่สำเร็จ",
|
||||
"loadFailed": "โหลดสัญญาไม่สำเร็จ",
|
||||
"searchPlaceholder": "ค้นหาเลขที่สัญญา ใบสั่งซื้อ ผู้ขาย หรือผู้ขอ",
|
||||
"allStatus": "ทั้งหมด",
|
||||
"search": "ค้นหา",
|
||||
"ledger": "ทะเบียนสัญญา",
|
||||
"items": "รายการ",
|
||||
"empty": "ไม่มีข้อมูลสัญญา",
|
||||
"purchaseOrder": "ใบสั่งซื้อ",
|
||||
"supplier": "ผู้ขาย",
|
||||
"amount": "มูลค่าสัญญา",
|
||||
"deliveryDate": "กำหนดส่งมอบ",
|
||||
"timeline": "ไทม์ไลน์แผนการชำระเงิน",
|
||||
"notAvailable": "—",
|
||||
"stats": {
|
||||
"contracts": "สัญญา",
|
||||
"pendingParse": "สัญญาที่รอดำเนินการ",
|
||||
"readyPlans": "แผนพร้อมใช้",
|
||||
"alerts": "จุดแจ้งเตือน"
|
||||
},
|
||||
"ledgerFocus": {
|
||||
"due": "ใกล้ครบกำหนด",
|
||||
"dueHint": "ใน 7 วัน",
|
||||
"overdue": "ค้างชำระเกินกำหนด",
|
||||
"active": "ยังไม่ถึงกำหนด",
|
||||
"activeHint": "เกิน 7 วัน",
|
||||
"dueThisMonth": "ถึงกำหนดเดือนนี้",
|
||||
"dueThisMonthHint": "เดือนปฏิทินนี้"
|
||||
},
|
||||
"status": {
|
||||
"completed": "เสร็จสิ้น",
|
||||
"needs_review": "ต้องตรวจสอบ",
|
||||
"pending": "รอแยกข้อมูล"
|
||||
},
|
||||
"stateLabel": {
|
||||
"parsed": "แยกข้อมูลแล้ว",
|
||||
"needs_review": "ต้องตรวจสอบ",
|
||||
"pending": "รอแยกข้อมูล",
|
||||
"active": "ใช้งานอยู่"
|
||||
},
|
||||
"nodeType": {
|
||||
"prepayment": "เงินล่วงหน้า",
|
||||
"shipment": "เงินก่อนส่ง",
|
||||
"acceptance": "เงินรับมอบ",
|
||||
"warranty": "เงินประกัน"
|
||||
},
|
||||
"ruleConfirmed": "ยืนยันแล้ว",
|
||||
"prepaymentRule": "แจ้งเตือนวันที่ 7/14/21 หลังจัดเก็บสัญญา; สถานะคำขออ้างอิง OA.",
|
||||
"shipmentRule": "แจ้งเตือนก่อนกำหนดส่ง 7 วัน วันครบกำหนด และหลังครบกำหนด 14 วัน; สถานะคำขออ้างอิง OA.",
|
||||
"acceptanceRule": "แจ้งเตือนวันที่ 30/40/60 หลังจัดเก็บใบรับมอบ; เงินประกันแจ้งก่อนครบกำหนด 7 วัน วันครบกำหนด และหลังครบกำหนด 14 วัน.",
|
||||
"pendingAlerts": "แจ้งเตือนที่รอดำเนินการ",
|
||||
"processing": "เริ่มชำระแล้ว",
|
||||
"dataPending": "รอข้อมูล",
|
||||
"paid": "ชำระแล้ว",
|
||||
"stagePaid": "ชำระแล้ว",
|
||||
"amountRatioDate": "จำนวนเงิน / สัดส่วน · วันที่",
|
||||
"applicant": "ผู้ขอ",
|
||||
"company": "บริษัท",
|
||||
"erpSchema": "ชุดบัญชี",
|
||||
"statusLabel": "สถานะ",
|
||||
"contractPrefix": "สัญญา",
|
||||
"datePending": "รอระบุวันที่",
|
||||
"dateMissing": {
|
||||
"prepayment": "ยังไม่มีวันจัดเก็บสัญญา",
|
||||
"shipment": "ยังไม่มีวันส่งมอบ",
|
||||
"acceptance": "ยังไม่จัดเก็บใบตรวจรับ",
|
||||
"warranty": "ยังไม่ทราบวันสิ้นสุดการรับประกัน"
|
||||
},
|
||||
"dateMissingHint": {
|
||||
"prepayment": "เงินมัดจำนับจากวันจัดเก็บสัญญา ซึ่งยังไม่มีวันที่นี้",
|
||||
"shipment": "เงินงวดส่งมอบอิงวันส่งมอบ ซึ่งยังไม่มีวันที่นี้",
|
||||
"acceptance": "เงินงวดตรวจรับจะเริ่มนับหลังจัดเก็บใบตรวจรับ",
|
||||
"warranty": "วันสิ้นสุดการรับประกันจะคำนวณได้หลังจัดเก็บใบตรวจรับและยืนยันระยะรับประกัน"
|
||||
},
|
||||
"statusNormal": "ปกติ",
|
||||
"statusNeedsCompletion": "ต้องเติมข้อมูล",
|
||||
"statusOverdue": "เกินกำหนดชำระ",
|
||||
"statusUpcoming": "ใกล้ถึงกำหนด",
|
||||
"statusActive": "ยังไม่ถึงกำหนด",
|
||||
"statusCompleted": "เสร็จสิ้น",
|
||||
"totalPrefix": "รวม",
|
||||
"contractSupplier": "สัญญา / ผู้ขาย",
|
||||
"nextAlert": "แจ้งเตือนถัดไป",
|
||||
"triggerBasis": "เกณฑ์เริ่ม",
|
||||
"alertDate": "วันที่แจ้งเตือน",
|
||||
"alertRuleHint": "แต่ละงวดเตือน 3 ครั้งตามวันปฏิทิน รายการที่ถึงกำหนดจะรวมส่งในวันศุกร์ 18:00 รอบถัดไป หากไม่มีวันที่อ้างอิงจะไม่เตือน\nเงินล่วงหน้า: วันที่ 7, 14 และ 21 หลังจัดเก็บสัญญา (หน้านี้แสดงรอบแรก)\nเงินงวดส่งของ: ก่อนกำหนดส่ง 7 วัน, วันกำหนดส่ง และหลังกำหนด 14 วัน\nเงินงวดตรวจรับ: วันที่ 30, 40 และ 60 หลังจัดเก็บใบตรวจรับ\nเงินประกัน: ก่อนครบประกัน 7 วัน, วันครบกำหนด และหลังครบ 14 วัน",
|
||||
"alertFirstRound": "รอบ 1",
|
||||
"payDate": "วันที่ชำระเงิน",
|
||||
"markPaid": "ทำเครื่องหมายว่าชำระแล้ว",
|
||||
"markPaidTitle": "ทำเครื่องหมายว่าชำระแล้ว",
|
||||
"markPaidHint": "{stage} · {amount} / {percent}% อัปเดตเฉพาะงวดนี้ การแจ้งเตือนที่ยังไม่ส่งจะถูกปิด รายการที่ส่งแล้วจะคงอยู่",
|
||||
"markPaidDate": "วันที่ชำระ",
|
||||
"markPaidRemark": "หมายเหตุ (ไม่บังคับ)",
|
||||
"markPaidRemarkPlaceholder": "เช่น การเงินยืนยันแล้ว แต่เลขที่ใน ERP ไม่ตรง",
|
||||
"markPaidConfirm": "ยืนยันว่าชำระแล้ว",
|
||||
"markPaidSource": "แหล่งที่มา: ทำเครื่องหมายเอง",
|
||||
"markPaidSuccess": "ทำเครื่องหมายว่าชำระแล้ว",
|
||||
"markPaidFailed": "ทำเครื่องหมายไม่สำเร็จ",
|
||||
"processStatus": "สถานะ",
|
||||
"owner": "ผู้รับผิดชอบจัดซื้อ",
|
||||
"oaData": "ข้อมูล OA",
|
||||
"contractRule": "กฎสัญญา",
|
||||
"ownerDefault": "ผู้รับผิดชอบจัดซื้อ",
|
||||
"workflowNo": "เลขที่เวิร์กโฟลว์ใบสมัครสัญญา",
|
||||
"contractNoPending": "รอแยกเลขที่สัญญาจากไฟล์แนบ",
|
||||
"synced": "ซิงก์แล้ว",
|
||||
"detailSubtitle": "ข้อมูล OA จุดชำระเงิน และประวัติแจ้งเตือน WeCom",
|
||||
"backToOverview": "กลับภาพรวม",
|
||||
"contractInfo": "ข้อมูลสัญญา OA",
|
||||
"alertHistory": "ประวัติแจ้งเตือน",
|
||||
"alertRound": "รอบแจ้งเตือน {round}",
|
||||
"alertAudit": "บันทึกการส่งแจ้งเตือน",
|
||||
"alertAuditEmpty": "ยังไม่มีบันทึกการแจ้งเตือน",
|
||||
"alertNode": "ขั้นตอนการชำระเงิน",
|
||||
"alertScheduledAt": "วันที่กำหนดส่ง",
|
||||
"alertSentAt": "เวลาที่ส่ง",
|
||||
"alertStatus": {
|
||||
"pending": "รอส่ง",
|
||||
"sent": "ส่งแล้ว",
|
||||
"failed": "ส่งไม่สำเร็จ"
|
||||
},
|
||||
"roundValue": "ครั้งที่ {round}",
|
||||
"weeklyBatchesTitle": "ชุดสรุปรายสัปดาห์",
|
||||
"weeklyBatchesSubtitle": "ดูสรุปการแจ้งเตือนการชำระเงินตามผู้รับ ไฟล์ Excel และบันทึกการส่ง",
|
||||
"weeklySend": "ส่งแจ้งเตือน",
|
||||
"weeklyBatchSubmitted": "ส่งงานส่งแจ้งเตือนแล้ว",
|
||||
"weeklyJobSent": "ส่งแล้ว {sent} ชุด",
|
||||
"weeklyJobFailed": "ส่งไม่สำเร็จ {failed} ชุด รายการถูกอัปเดตแล้ว กดไอคอนเพื่อดูสาเหตุ",
|
||||
"weeklyJobPartial": "ส่งแล้ว {sent} ชุด และไม่สำเร็จ {failed} ชุด",
|
||||
"weeklyJobEmpty": "ไม่มีรายการที่รอส่ง บันทึกชุดจึงไม่เปลี่ยนแปลง",
|
||||
"weeklyJobTimeout": "งานส่งยังทำงานอยู่เบื้องหลัง เปิดหน้านี้ใหม่ภายหลังเพื่อดูผล",
|
||||
"weeklyJobError": "งานส่งดำเนินการไม่สำเร็จ",
|
||||
"weeklyBatchesLoadFailed": "โหลดชุดสรุปรายสัปดาห์ไม่สำเร็จ",
|
||||
"batchNo": "หมายเลขชุด",
|
||||
"weekKey": "สัปดาห์",
|
||||
"batchStatusLabel": "สถานะการส่ง",
|
||||
"batchFailureReason": "สาเหตุที่ส่งไม่สำเร็จ",
|
||||
"batchFailureReasonEmpty": "ไม่ได้บันทึกสาเหตุที่ส่งไม่สำเร็จ",
|
||||
"batchFailureReasonAria": "ดูสาเหตุที่ส่งไม่สำเร็จ",
|
||||
"batchFailureReasonLine": "{reason}: {detail}",
|
||||
"batchFailureReasonCode": {
|
||||
"notify_disabled": "ยังไม่ได้เปิดการแจ้งเตือน WeCom",
|
||||
"event_disabled": "ยังไม่ได้เปิดเหตุการณ์แจ้งเตือนการชำระเงินตามสัญญา",
|
||||
"user_unbound": "ผู้รับยังไม่ได้ผูกบัญชี WeCom",
|
||||
"textcard_failed": "ส่งการ์ด WeCom ไม่สำเร็จ",
|
||||
"file_upload_failed": "อัปโหลดไฟล์แนบ WeCom ไม่สำเร็จ",
|
||||
"file_failed": "ส่งไฟล์แนบ WeCom ไม่สำเร็จ",
|
||||
"unknown": "ส่งไม่สำเร็จ"
|
||||
},
|
||||
"batchTotal": "จำนวนสรุป",
|
||||
"batchExcel": "ไฟล์แนบ Excel",
|
||||
"batchSentAt": "เวลาที่ส่ง",
|
||||
"weeklyBatchesEmpty": "ยังไม่มีชุดสรุปรายสัปดาห์",
|
||||
"weeklyPendingSummary": "รอส่ง {count} รายการในสัปดาห์นี้ · ส่งครั้งถัดไป {datetime}",
|
||||
"weeklyPendingCountOnly": "รอส่ง {count} รายการในสัปดาห์นี้",
|
||||
"downloadExcel": "ดาวน์โหลด Excel",
|
||||
"excelDownloadFailed": "ดาวน์โหลดไฟล์แนบการแจ้งเตือนไม่สำเร็จ",
|
||||
"batchStatus": {
|
||||
"pending": "รอส่ง",
|
||||
"sent": "ส่งแล้ว",
|
||||
"failed": "ส่งไม่สำเร็จ",
|
||||
"processing": "กำลังดำเนินการ",
|
||||
"resolved": "หยุดการแจ้งเตือนแล้ว"
|
||||
},
|
||||
"backToLedger": "กลับ",
|
||||
"detailLoadFailed": "โหลดรายละเอียดสัญญาไม่สำเร็จ",
|
||||
"detailLoading": "กำลังโหลดรายละเอียดสัญญา…",
|
||||
"detailOverview": "ภาพรวมสัญญา",
|
||||
"detailAttachments": "ไฟล์แนบต้นฉบับ",
|
||||
"detailPaymentPlan": "แผนการชำระเงิน",
|
||||
"detailAlertHistory": "ประวัติการแจ้งเตือน",
|
||||
"archiveDate": "วันที่จัดเก็บสัญญา",
|
||||
"archiveDateHint": "วันที่นี้คือวันที่เก็บถาวรของแบบฟอร์มคำขอสัญญา",
|
||||
"parseStatus": "สถานะการแยกข้อมูล",
|
||||
"parseIssueTitle": "ปัญหาการแยกข้อมูล",
|
||||
"planStatus": "สถานะแผน",
|
||||
"attachmentsEmpty": "ยังไม่มีไฟล์สัญญาต้นฉบับที่จัดเก็บ",
|
||||
"downloadAttachment": "ดาวน์โหลด",
|
||||
"previewAttachment": "ดูตัวอย่าง",
|
||||
"attachmentPreviewFailed": "เปิดตัวอย่างไฟล์แนบไม่สำเร็จ",
|
||||
"attachmentPreviewUnsupported": "รูปแบบนี้ยังไม่รองรับการดูออนไลน์ กรุณาดาวน์โหลดเพื่อเปิดดู",
|
||||
"attachmentDownloadFailed": "ดาวน์โหลดไฟล์แนบสัญญาไม่สำเร็จ",
|
||||
"paymentPlanEmpty": "ไม่มีแผนการชำระเงินที่แสดงได้",
|
||||
"anchorDate": "เกณฑ์วันที่",
|
||||
"nodeStatus": {
|
||||
"pending": "รอดำเนินการ",
|
||||
"active": "กำลังดำเนินการ",
|
||||
"paid": "ชำระแล้ว",
|
||||
"processing": "กำลังประมวลผล",
|
||||
"resolved": "หยุดการแจ้งเตือนแล้ว",
|
||||
"upcoming": "ใกล้ถึงกำหนด",
|
||||
"notStarted": "รอเริ่ม",
|
||||
"overdue": "เกินกำหนดชำระ",
|
||||
"review": "ต้องตรวจสอบ",
|
||||
"notApplicable": "ไม่มีงวดนี้"
|
||||
},
|
||||
"syncConfirm": "ระบบจะซิงก์ข้อมูลสัญญาและการรับมอบจาก OA และเติมเฉพาะช่องที่ว่างในบัญชี โดยไม่เขียนทับข้อมูลที่มีอยู่ ต้องการดำเนินการต่อหรือไม่?",
|
||||
"weeklySendConfirm": "ระบบจะส่งสรุปการแจ้งเตือนการชำระที่รอส่งของสัปดาห์นี้ให้ผู้รับ ต้องการดำเนินการต่อหรือไม่?",
|
||||
"scanAlertsConfirm": "ระบบจะสแกนแผนการชำระปัจจุบันและสร้างรายการแจ้งเตือนที่รอส่ง โดยยังไม่ส่งทันที ต้องการดำเนินการต่อหรือไม่?"
|
||||
},
|
||||
"contractPaymentReview": {
|
||||
"title": "สัญญาที่รอยืนยัน",
|
||||
"subtitle": "สัญญาที่ไม่ตรงกับกลุ่มหัวข้อคำพ้องของสัญญาจัดซื้ออุปกรณ์ ตรวจสอบสัดส่วนการชำระเงินไม่ผ่าน หรือขัดแย้งกับฟิลด์ OA จะไม่เข้าสู่การแจ้งเตือนการชำระเงิน โปรดดาวน์โหลดต้นฉบับเพื่อตรวจสอบ",
|
||||
"searchPlaceholder": "เลขที่สัญญา ใบสั่งซื้อ ผู้ขาย หรือผู้ขอ",
|
||||
"loadFailed": "โหลดสัญญาที่รอยืนยันไม่สำเร็จ",
|
||||
"contractWorkflow": "เลขที่สัญญา / เวิร์กโฟลว์ใบสมัคร",
|
||||
"reason": "เหตุผลที่ต้องยืนยัน",
|
||||
"fallbackIssue": "ผลการแยกข้อมูลต้องยืนยันโดยผู้ใช้",
|
||||
"empty": "ไม่มีสัญญาที่รอยืนยัน",
|
||||
"manualTitle": "ตรวจสอบงวดชำระ",
|
||||
"manualSubtitle": "{supplier} · ใบสั่งซื้อ {purchaseOrder} งวดที่ระบบอ่านได้ถูกเติมไว้แล้วและแก้ไขได้",
|
||||
"backToReview": "กลับไปรายการรอยืนยัน",
|
||||
"confirmLedger": "บันทึกเข้าบัญชีสัญญา",
|
||||
"confirmSuccess": "เข้าบัญชีสัญญาแล้ว",
|
||||
"issueTitle": "หมายเหตุจากการอ่านสัญญา",
|
||||
"contractNoOptional": "เลขที่สัญญา (ไม่บังคับ)",
|
||||
"contractNoPlaceholder": "ไม่พบเลขที่สัญญาในไฟล์แนบ",
|
||||
"percentage": "สัดส่วน %",
|
||||
"stageAmount": "จำนวนเงิน",
|
||||
"basisDate": "วันที่อ้างอิง",
|
||||
"noStage": "ไม่มีงวดนี้",
|
||||
"ruleIdentity": "เลขที่ใบสั่งซื้อและยอดสัญญาถูกต้อง",
|
||||
"rulePercent": "สัดส่วนของงวดที่เปิดใช้รวมกันต้องเป็น 100% ช่องว่างไม่นับเป็น 0",
|
||||
"ruleAmount": "จำนวนเงินของแต่ละงวดเท่ากับยอดสัญญาคูณสัดส่วน",
|
||||
"ruleDate": "เงินมัดจำและเงินค่าสินค้าต้องระบุวันที่อ้างอิง",
|
||||
"hintPrepayment": "วันที่อ้างอิงคือวันจัดเก็บสัญญา หากสัญญาระบุสัดส่วนเงินมัดจำ ให้กรอกที่นี่",
|
||||
"hintShipment": "วันที่อ้างอิงคือกำหนดส่งมอบ หากสัญญาเขียนเพียง “หลังรับเงินมัดจำ N วัน” ให้กรอกวันที่จริง",
|
||||
"hintAcceptance": "วันที่อ้างอิงคือวันจัดเก็บใบตรวจรับ ถ้ายังไม่จัดเก็บให้เว้นว่าง",
|
||||
"hintWarranty": "หากไม่มีสัดส่วนเงินประกันผลงาน ให้เลือกไม่มีงวดนี้ ระยะประกันไม่ใช่สัดส่วนการชำระ",
|
||||
"formLoadFailed": "เปิดแบบฟอร์มตรวจสอบไม่สำเร็จ",
|
||||
"submitFailed": "ส่งผลการตรวจสอบไม่สำเร็จ",
|
||||
"manualAction": "ตรวจสอบด้วยตนเอง",
|
||||
"fillHintTitle": "วิธีกรอก"
|
||||
},
|
||||
"contractPaymentReparse": {
|
||||
"action": "แยกข้อมูลจากต้นฉบับอีกครั้ง",
|
||||
"success": "แยกข้อมูลใหม่ด้วยไฟล์แนบ “{attachment}” แล้ว",
|
||||
"failed": "แยกข้อมูลสัญญาใหม่ไม่สำเร็จ"
|
||||
},
|
||||
"procurementContract": {
|
||||
"title": "ตรวจสอบสัญญาจัดซื้อ",
|
||||
"subtitle": "จัดการเทมเพลต กฎเส้นแดงความเสี่ยง และประวัติการตรวจสอบ",
|
||||
@@ -5520,8 +5800,14 @@
|
||||
"verify_duplicate": "ตรวจสอบข้อมูลซ้ำ"
|
||||
}
|
||||
},
|
||||
"writeLabels": { "yes": "ใช่", "no": "ไม่ใช่" },
|
||||
"idempotencyLabels": { "none": "ไม่มี", "invoice": "กันซ้ำด้วยเลขเอกสาร" },
|
||||
"writeLabels": {
|
||||
"yes": "ใช่",
|
||||
"no": "ไม่ใช่"
|
||||
},
|
||||
"idempotencyLabels": {
|
||||
"none": "ไม่มี",
|
||||
"invoice": "กันซ้ำด้วยเลขเอกสาร"
|
||||
},
|
||||
"credentialTypeLabels": {
|
||||
"password": "บัญชี+รหัสผ่าน",
|
||||
"token": "โทเคน",
|
||||
@@ -5655,6 +5941,7 @@
|
||||
"formatJson": "จัดรูปแบบ",
|
||||
"invalidJsonHint": "รูปแบบ JSON ไม่ถูกต้อง โปรดแก้ไขก่อนบันทึก",
|
||||
"testOkBadge": "เชื่อมต่อได้",
|
||||
"testNotRun": "ยังไม่ได้ทดสอบ",
|
||||
"testFailBadge": "เชื่อมต่อล้มเหลว",
|
||||
"testDetailToggle": "คลิกเพื่อขยาย/ย่อรายละเอียด",
|
||||
"advancedHints": {
|
||||
@@ -5849,7 +6136,6 @@
|
||||
"detail": "ดูรายละเอียด",
|
||||
"back": "กลับไปรายการค้าง",
|
||||
"canAccept": "ตรวจรับได้",
|
||||
"cannotAcceptNote": "เหตุผลที่ตรวจรับไม่ได้",
|
||||
"cannotAcceptNote": "คำอธิบายที่ตรวจรับไม่ได้",
|
||||
"returnFlag": "ถูกส่งกลับ",
|
||||
"unspecified": "ยังไม่ระบุ",
|
||||
@@ -5892,6 +6178,14 @@
|
||||
"loading": "กำลังโหลด…",
|
||||
"empty": "ยังไม่มีประเภทการโอน",
|
||||
"emptyHint": "คลิก \"สร้างประเภทใหม่\" เพื่อสร้างประเภทการโอนระหว่างทางรายการแรก",
|
||||
"noMatch": "ไม่มีประเภทการโอนที่ตรงกับเงื่อนไข",
|
||||
"noMatchHint": "ลองปรับคำค้นหา หรือล้างเงื่อนไขการกรอง",
|
||||
"clearFilters": "ล้างตัวกรอง",
|
||||
"noRules": "ไม่มีกฎ",
|
||||
"otherNames": "ชื่อในภาษาอื่น (ไม่บังคับ)",
|
||||
"unsavedTitle": "มีการเปลี่ยนแปลงที่ยังไม่ได้บันทึก",
|
||||
"unsavedConfirm": "การแก้ไขปัจจุบันยังไม่ได้บันทึกและจะสูญหายเมื่อปิด ต้องการปิดหรือไม่?",
|
||||
"emptyScopeTitle": "บันทึกประเภทที่ไม่มีกฎขอบเขต",
|
||||
"colCode": "รหัส",
|
||||
"colName": "ชื่อ",
|
||||
"colRules": "จำนวนกฎ",
|
||||
@@ -5929,6 +6223,7 @@
|
||||
"modeMapped": "ตาม mapping",
|
||||
"modeFixed": "กำหนดคงที่",
|
||||
"fixedCodeLabel": "รหัสคลังสินค้า",
|
||||
"fixedCodePlaceholder": "เลือกหรือพิมพ์รหัสคลังสินค้า",
|
||||
"orgLabel": "บริษัทที่ทับ (นิติบุคคล)",
|
||||
"orgHint": "เว้นว่าง=ใช้ตาม mapping",
|
||||
"mappingCheckOk": "พบรหัสคลังสินค้าใน mapping แล้ว",
|
||||
|
||||
@@ -44,6 +44,9 @@
|
||||
"prevPage": "ก่อนหน้า",
|
||||
"nextPage": "ถัดไป"
|
||||
},
|
||||
"filter": {
|
||||
"all": "ทั้งหมด"
|
||||
},
|
||||
"sort": {
|
||||
"unsorted": "คลิกเพื่อเรียงลำดับ",
|
||||
"asc": "เรียงจากน้อยไปมาก คลิกเพื่อสลับ",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"edit": "编辑",
|
||||
"delete": "删除",
|
||||
"nav": {
|
||||
"transferTypes": "在途调拨类型",
|
||||
"transferTypes": "调拨类型",
|
||||
"dashboard": "仪表盘",
|
||||
"approvals": "用户审批",
|
||||
"users": "用户管理",
|
||||
@@ -177,8 +177,11 @@
|
||||
"identity_definition": "客户识别定义",
|
||||
"identity_rule_set": "客户识别规则集",
|
||||
"identity_rule": "客户识别规则"
|
||||
}
|
||||
, "syncConfirm": "将从 OA 同步合同与验收数据,只补全台账中的空字段,不会覆盖已有内容。是否继续?", "weeklySendConfirm": "将把本周待发送的付款预警汇总发给收件人。是否继续?", "scanAlertsConfirm": "将按当前付款计划扫描并生成待发送预警,不会立即发送。是否继续?"},
|
||||
},
|
||||
"syncConfirm": "将从 OA 同步合同与验收数据,只补全台账中的空字段,不会覆盖已有内容。是否继续?",
|
||||
"weeklySendConfirm": "将把本周待发送的付款预警汇总发给收件人。是否继续?",
|
||||
"scanAlertsConfirm": "将按当前付款计划扫描并生成待发送预警,不会立即发送。是否继续?"
|
||||
},
|
||||
"shippingOrderExtractionRuns": {
|
||||
"eyebrow": "只读运行诊断",
|
||||
"title": "识别任务",
|
||||
@@ -765,9 +768,27 @@
|
||||
"pathSectionConfigured": "已配置",
|
||||
"pathSectionNotConfigured": "未配置",
|
||||
"parsingProfiles": "库存解析",
|
||||
"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": "异动分析预览" },
|
||||
"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": "库存字段目录",
|
||||
@@ -823,21 +844,38 @@
|
||||
"inventorySampleRequired": "请先上传库存样本文件并完成结构识别。",
|
||||
"parsingProfileName": "库存解析名称",
|
||||
"parsingPurposeLabel": "规则用途",
|
||||
"parsingPurposeHint": "用途创建后不可变更:库存解析面向库存字段目录,收料异动面向标准异动字段(只读契约)。",
|
||||
"parsingPurpose": { "inventory": "库存解析", "movement": "收料异动" },
|
||||
"parsingPurposeHint": "用途创建后不可变更:库存解析面向库存字段目录,入站解析面向标准异动字段(只读契约)。",
|
||||
"parsingPurpose": {
|
||||
"onhand": "库存",
|
||||
"inbound": "入站",
|
||||
"outbound": "出站"
|
||||
},
|
||||
"movementMappingHint": "标准异动字段为只读业务契约(✱ 必填、🔑 匹配身份),只需为每个字段选择报表表头别名。",
|
||||
"movementRequiredMark": "必填",
|
||||
"movementIdentityMark": "匹配身份",
|
||||
"movementStandardField": "标准异动字段",
|
||||
"movementBindingLabel": "异动解析规则",
|
||||
"movementBindingLabel": "入站解析规则",
|
||||
"movementBindingNone": "未绑定",
|
||||
"movementBindingHint": "绑定已发布异动规则后,匹配将复用已归档收料文件;未绑定时匹配不会触发抓取(fail-closed)。",
|
||||
"movementBindingHint": "绑定已发布入站规则后,匹配将复用已归档收料文件;未绑定时匹配不会触发抓取(fail-closed)。",
|
||||
"movementFields": {
|
||||
"doc_no": "单号", "line_no": "项次", "in_out_flag": "进出库别", "material_code": "料号",
|
||||
"material_name": "品名", "warehouse_code": "仓库", "storage_code": "储位", "lot_no": "批号",
|
||||
"quantity": "数量", "movement_date": "异动日期", "unit": "单位",
|
||||
"line_seq": "项序", "specification": "规格", "order_type": "订单类型",
|
||||
"odm_id": "ODM编号", "odm_name": "ODM名称", "carton_id": "箱号", "pallet_id": "栈板号"
|
||||
"doc_no": "单号",
|
||||
"line_no": "项次",
|
||||
"in_out_flag": "进出库别",
|
||||
"material_code": "料号",
|
||||
"material_name": "品名",
|
||||
"warehouse_code": "仓库",
|
||||
"storage_code": "储位",
|
||||
"lot_no": "批号",
|
||||
"quantity": "数量",
|
||||
"movement_date": "异动日期",
|
||||
"unit": "单位",
|
||||
"line_seq": "项序",
|
||||
"specification": "规格",
|
||||
"order_type": "订单类型",
|
||||
"odm_id": "ODM编号",
|
||||
"odm_name": "ODM名称",
|
||||
"carton_id": "箱号",
|
||||
"pallet_id": "栈板号"
|
||||
},
|
||||
"inventoryAnalysisFailed": "库存文件结构识别失败。",
|
||||
"inventoryAnalysisPreview": "识别结果预览",
|
||||
@@ -2691,8 +2729,8 @@
|
||||
"platformJobFileAssetCleanup": "临时文件资产清理",
|
||||
"transferSourceCodes": "来源实例",
|
||||
"transferRecoverHistory": "历史可恢复异常复核",
|
||||
"transferReceiptDateFrom": "收料日期起(T-N)",
|
||||
"transferReceiptDateTo": "收料日期止(T-N)",
|
||||
"transferReceiptDateFrom": "异动日期起(T-N)",
|
||||
"transferReceiptDateTo": "异动日期止(T-N)",
|
||||
"platformJobFixedAssetsSnapshot": "固资快照",
|
||||
"shippingInventoryJobHint": "按计划从配置的库存源抓取库存数据,由 RPA Worker 异步导出。",
|
||||
"shippingInventoryJobParams": "Job 参数(可选)",
|
||||
@@ -3947,7 +3985,7 @@
|
||||
"approved": "已批准",
|
||||
"superseded": "已失效"
|
||||
},
|
||||
"samples": "已确认盲测样本:{count}/{required} · {status}",
|
||||
"samples": "已确认盲测样本:{count}/{required}",
|
||||
"notRun": "未执行",
|
||||
"approvedHint": "盲测已批准,无需重复执行或批准。",
|
||||
"selectIndependentSample": "选择独立样本",
|
||||
@@ -5156,19 +5194,242 @@
|
||||
"deliveryDate": "交货期限",
|
||||
"timeline": "付款计划时间线",
|
||||
"notAvailable": "—",
|
||||
"stats": {"contracts": "合同总数", "pendingParse": "待处理合同", "readyPlans": "计划已生成", "alerts": "待预警节点"},
|
||||
"ledgerFocus": {"due": "即将到期", "dueHint": "7日内", "overdue": "逾期未付", "active": "未到期", "activeHint": "7日外", "dueThisMonth": "本月应付", "dueThisMonthHint": "本自然月"},
|
||||
"status": {"completed": "已完成", "needs_review": "待复核", "pending": "待解析"}, "stateLabel": {"parsed": "已解析", "needs_review": "待复核", "pending": "待解析", "active": "已生效"},
|
||||
"nodeType": {"prepayment": "预付款", "shipment": "出货款", "acceptance": "验收款", "warranty": "质保款"},
|
||||
"stats": {
|
||||
"contracts": "合同总数",
|
||||
"pendingParse": "待处理合同",
|
||||
"readyPlans": "计划已生成",
|
||||
"alerts": "待预警节点"
|
||||
},
|
||||
"ledgerFocus": {
|
||||
"due": "即将到期",
|
||||
"dueHint": "7日内",
|
||||
"overdue": "逾期未付",
|
||||
"active": "未到期",
|
||||
"activeHint": "7日外",
|
||||
"dueThisMonth": "本月应付",
|
||||
"dueThisMonthHint": "本自然月"
|
||||
},
|
||||
"status": {
|
||||
"completed": "已完成",
|
||||
"needs_review": "待复核",
|
||||
"pending": "待解析"
|
||||
},
|
||||
"stateLabel": {
|
||||
"parsed": "已解析",
|
||||
"needs_review": "待复核",
|
||||
"pending": "待解析",
|
||||
"active": "已生效"
|
||||
},
|
||||
"nodeType": {
|
||||
"prepayment": "预付款",
|
||||
"shipment": "出货款",
|
||||
"acceptance": "验收款",
|
||||
"warranty": "质保款"
|
||||
},
|
||||
"ruleConfirmed": "已确定",
|
||||
"prepaymentRule": "合同归档后第 7/14/21 天预警;请款以 OA 厂商预付款请款作业为准。",
|
||||
"shipmentRule": "交货期限前 7 天、到期日、到期后 14 天预警;请款以 OA 厂商预付款请款作业为准。",
|
||||
"acceptanceRule": "验收归档后第 30/40/60 天预警;质保款在质保到期前 7 天、到期日、到期后 14 天预警。",
|
||||
"pendingAlerts": "待处理预警", "processing": "已发起付款", "dataPending": "数据待确认", "paid": "已付款", "stagePaid": "已付", "amountRatioDate": "金额 / 比例 · 日期", "applicant": "申请人", "company": "公司", "erpSchema": "付款账套", "statusLabel": "状态", "contractPrefix": "合同", "datePending": "待补充日期", "dateMissing": {"prepayment": "合同归档日未填", "shipment": "交货日期未填", "acceptance": "验收单未归档", "warranty": "质保到期日未定"}, "dateMissingHint": {"prepayment": "预付款从合同归档日起算,这里还没有归档日", "shipment": "出货款按交货期限判断,这里还没有交货日期", "acceptance": "验收款从验收单归档日起算,这份验收单还没归档", "warranty": "质保款要等验收归档并确认质保期后,才能算出到期日"}, "statusNormal": "正常", "statusNeedsCompletion": "待补充", "statusOverdue": "已逾期", "statusUpcoming": "即将到期", "statusActive": "未到期", "statusCompleted": "已完成",
|
||||
"totalPrefix": "共", "contractSupplier": "合同号 / 供应商", "nextAlert": "下一预警", "triggerBasis": "触发依据", "alertDate": "预警日期", "alertRuleHint": "每阶段按自然日提醒三轮,到日后并入最近的周五 18:00 汇总发送。没有对应日期则不提醒。\n预付款:合同归档日后第 7、14、21 天(页面显示首轮)\n出货款:交货期限前 7 天、当天、后 14 天\n验收款:验收单归档后第 30、40、60 天\n质保款:质保到期前 7 天、当天、后 14 天", "alertFirstRound": "首轮", "payDate": "付款日期", "markPaid": "标为已付", "markPaidTitle": "标为已付", "markPaidHint": "{stage} · {amount} / {percent}%。只标记这一阶段。尚未发送的预警会关闭,已经发出的记录保留。", "markPaidDate": "付款日期", "markPaidRemark": "说明(可选)", "markPaidRemarkPlaceholder": "例如:财务已确认付款,ERP 单号未对上", "markPaidConfirm": "确认已付", "markPaidSource": "来源:手动标记", "markPaidSuccess": "已标为已付", "markPaidFailed": "标记失败", "processStatus": "处理状态", "owner": "采购负责人", "oaData": "OA 数据", "contractRule": "合同规则", "ownerDefault": "采购负责人", "workflowNo": "合同申请单流程编号", "contractNoPending": "合同号待从附件解析", "synced": "已同步", "detailSubtitle": "OA 数据、付款节点与企业微信提醒记录", "backToOverview": "返回总览", "contractInfo": "OA 合同信息", "alertHistory": "预警记录", "alertRound": "第 {round} 次预警", "alertAudit": "预警发送记录", "alertAuditEmpty": "暂无预警记录", "alertNode": "付款节点", "alertScheduledAt": "计划日期", "alertSentAt": "发送时间", "alertStatus": {"pending": "待发送", "sent": "已发送", "failed": "发送失败"}, "roundValue": "第 {round} 次", "weeklyBatchesTitle": "周汇总批次", "weeklyBatchesSubtitle": "查看按收件人生成的付款预警周汇总、Excel 附件及发送记录。", "weeklySend": "发送预警", "weeklyBatchSubmitted": "发送预警任务已提交", "weeklyJobSent": "已发送 {sent} 个批次", "weeklyJobFailed": "{failed} 个批次发送失败,列表已更新,可点击失败图标查看原因", "weeklyJobPartial": "已发送 {sent} 个批次,另有 {failed} 个失败", "weeklyJobEmpty": "没有待发送的预警,批次记录不会变化", "weeklyJobTimeout": "发送任务仍在后台执行,请稍后重新打开本页查看", "weeklyJobError": "发送任务执行失败", "weeklyBatchesLoadFailed": "加载周汇总批次失败", "batchNo": "批次号", "weekKey": "周次", "batchStatusLabel": "发送状态", "batchFailureReason": "失败原因", "batchFailureReasonEmpty": "未记录具体失败原因", "batchFailureReasonAria": "查看发送失败原因", "batchFailureReasonLine": "{reason}:{detail}", "batchFailureReasonCode": {"notify_disabled": "企业微信通知未启用", "event_disabled": "合同付款预警通知事件未启用", "user_unbound": "收件人未绑定企业微信账号", "textcard_failed": "企业微信卡片发送失败", "file_upload_failed": "企业微信附件上传失败", "file_failed": "企业微信附件发送失败", "unknown": "发送失败"}, "batchTotal": "汇总笔数", "batchExcel": "Excel 附件", "batchSentAt": "发送时间", "weeklyBatchesEmpty": "暂无周汇总批次", "weeklyPendingSummary": "本周待发送 {count} 笔 · 下次发送 {datetime}", "weeklyPendingCountOnly": "本周待发送 {count} 笔", "downloadExcel": "下载 Excel", "excelDownloadFailed": "下载预警附件失败", "batchStatus": {"pending": "待发送", "sent": "已发送", "failed": "发送失败", "processing": "处理中", "resolved": "已停止提醒"}, "backToLedger": "返回", "detailLoadFailed": "加载合同详情失败", "detailLoading": "正在加载合同详情…", "detailOverview": "合同概览", "detailAttachments": "原文附件", "detailPaymentPlan": "付款计划", "detailAlertHistory": "预警记录", "archiveDate": "合同归档日期", "archiveDateHint": "该日期为合同申请单的归档日期", "parseStatus": "解析状态", "parseIssueTitle": "解析提示", "planStatus": "计划状态", "attachmentsEmpty": "暂无已归档的合同原文附件", "downloadAttachment": "下载附件", "previewAttachment": "预览", "attachmentPreviewFailed": "附件预览失败", "attachmentPreviewUnsupported": "该格式暂不支持在线预览,请下载后查看", "attachmentDownloadFailed": "下载合同附件失败", "paymentPlanEmpty": "暂无可展示的付款计划", "anchorDate": "日期依据", "nodeStatus": {"pending": "待处理", "active": "进行中", "paid": "已付", "processing": "处理中", "resolved": "已停止提醒", "upcoming": "即将到期", "notStarted": "待起算", "overdue": "已逾期", "review": "待复核", "notApplicable": "无此阶段"}, "reparse": "重新解析合同原文", "reparseSuccess": "已Line truncated
|
||||
, "syncConfirm": "将从 OA 同步合同与验收数据,只补全台账中的空字段,不会覆盖已有内容。是否继续?", "weeklySendConfirm": "将把本周待发送的付款预警汇总发给收件人。是否继续?", "scanAlertsConfirm": "将按当前付款计划扫描并生成待发送预警,不会立即发送。是否继续?"},
|
||||
"contractPaymentReview": {"title": "待确认合同", "subtitle": "未匹配设备采购合同同义标题组、付款比例校验失败或关键字段冲突的合同不会进入付款预警,请下载原文核对。", "searchPlaceholder": "合同编号、采购编号、供应商或申请人", "loadFailed": "待确认合同加载失败", "contractWorkflow": "合同号 / 合同申请单流程编号", "reason": "待确认原因", "fallbackIssue": "解析结果待人工确认", "empty": "暂无待确认合同", "manualTitle": "复核付款阶段", "manualSubtitle": "{supplier} · 采购单号 {purchaseOrder}。已识别的阶段已填入,可改。", "backToReview": "返回待确认", "confirmLedger": "确认进入台账", "confirmSuccess": "已进入合同台账", "issueTitle": "解析提示", "contractNoOptional": "合同编号(可空)", "contractNoPlaceholder": "附件未识别出合同号", "percentage": "比例 %", "stageAmount": "金额", "basisDate": "日期依据", "noStage": "无此阶段", "ruleIdentity": "采购单号和合同金额有效", "rulePercent": "启用阶段的比例合计为 100%,空比例不算 0", "ruleAmount": "每个启用阶段的金额等于合同金额乘以比例", "ruleDate": "预付款、出货款须填写日期依据", "hintPrepayment": "日期依据是合同归档日。正文写了定金或预付款比例时填在这里。", "hintShipment": "日期依据是交货期限。正文只有“收到定金后 N 天”时,请填写具体日期。", "hintAcceptance": "日期依据是验收单归档日。还没归档可以留空。", "hintWarranty": "没有质保款比例时勾选无此阶段。质保期不是付款比例。", "formLoadFailed": "复核表单加载失败", "submitFailed": "复核提交失败", "manualAction": "人工复核", "fillHintTitle": "填写提示"},
|
||||
"contractPaymentReparse": {"action": "重新解析合同原文", "success": "已使用附件“{attachment}”重新解析", "failed": "重新解析合同失败"},
|
||||
"pendingAlerts": "待处理预警",
|
||||
"processing": "已发起付款",
|
||||
"dataPending": "数据待确认",
|
||||
"paid": "已付款",
|
||||
"stagePaid": "已付",
|
||||
"amountRatioDate": "金额 / 比例 · 日期",
|
||||
"applicant": "申请人",
|
||||
"company": "公司",
|
||||
"erpSchema": "付款账套",
|
||||
"statusLabel": "状态",
|
||||
"contractPrefix": "合同",
|
||||
"datePending": "待补充日期",
|
||||
"dateMissing": {
|
||||
"prepayment": "合同归档日未填",
|
||||
"shipment": "交货日期未填",
|
||||
"acceptance": "验收单未归档",
|
||||
"warranty": "质保到期日未定"
|
||||
},
|
||||
"dateMissingHint": {
|
||||
"prepayment": "预付款从合同归档日起算,这里还没有归档日",
|
||||
"shipment": "出货款按交货期限判断,这里还没有交货日期",
|
||||
"acceptance": "验收款从验收单归档日起算,这份验收单还没归档",
|
||||
"warranty": "质保款要等验收归档并确认质保期后,才能算出到期日"
|
||||
},
|
||||
"statusNormal": "正常",
|
||||
"statusNeedsCompletion": "待补充",
|
||||
"statusOverdue": "已逾期",
|
||||
"statusUpcoming": "即将到期",
|
||||
"statusActive": "未到期",
|
||||
"statusCompleted": "已完成",
|
||||
"totalPrefix": "共",
|
||||
"contractSupplier": "合同号 / 供应商",
|
||||
"nextAlert": "下一预警",
|
||||
"triggerBasis": "触发依据",
|
||||
"alertDate": "预警日期",
|
||||
"alertRuleHint": "每阶段按自然日提醒三轮,到日后并入最近的周五 18:00 汇总发送。没有对应日期则不提醒。\n预付款:合同归档日后第 7、14、21 天(页面显示首轮)\n出货款:交货期限前 7 天、当天、后 14 天\n验收款:验收单归档后第 30、40、60 天\n质保款:质保到期前 7 天、当天、后 14 天",
|
||||
"alertFirstRound": "首轮",
|
||||
"payDate": "付款日期",
|
||||
"markPaid": "标为已付",
|
||||
"markPaidTitle": "标为已付",
|
||||
"markPaidHint": "{stage} · {amount} / {percent}%。只标记这一阶段。尚未发送的预警会关闭,已经发出的记录保留。",
|
||||
"markPaidDate": "付款日期",
|
||||
"markPaidRemark": "说明(可选)",
|
||||
"markPaidRemarkPlaceholder": "例如:财务已确认付款,ERP 单号未对上",
|
||||
"markPaidConfirm": "确认已付",
|
||||
"markPaidSource": "来源:手动标记",
|
||||
"markPaidSuccess": "已标为已付",
|
||||
"markPaidFailed": "标记失败",
|
||||
"processStatus": "处理状态",
|
||||
"owner": "采购负责人",
|
||||
"oaData": "OA 数据",
|
||||
"contractRule": "合同规则",
|
||||
"ownerDefault": "采购负责人",
|
||||
"workflowNo": "合同申请单流程编号",
|
||||
"contractNoPending": "合同号待从附件解析",
|
||||
"synced": "已同步",
|
||||
"detailSubtitle": "OA 数据、付款节点与企业微信提醒记录",
|
||||
"backToOverview": "返回总览",
|
||||
"contractInfo": "OA 合同信息",
|
||||
"alertHistory": "预警记录",
|
||||
"alertRound": "第 {round} 次预警",
|
||||
"alertAudit": "预警发送记录",
|
||||
"alertAuditEmpty": "暂无预警记录",
|
||||
"alertNode": "付款节点",
|
||||
"alertScheduledAt": "计划日期",
|
||||
"alertSentAt": "发送时间",
|
||||
"alertStatus": {
|
||||
"pending": "待发送",
|
||||
"sent": "已发送",
|
||||
"failed": "发送失败"
|
||||
},
|
||||
"roundValue": "第 {round} 次",
|
||||
"weeklyBatchesTitle": "周汇总批次",
|
||||
"weeklyBatchesSubtitle": "查看按收件人生成的付款预警周汇总、Excel 附件及发送记录。",
|
||||
"weeklySend": "发送预警",
|
||||
"weeklyBatchSubmitted": "发送预警任务已提交",
|
||||
"weeklyJobSent": "已发送 {sent} 个批次",
|
||||
"weeklyJobFailed": "{failed} 个批次发送失败,列表已更新,可点击失败图标查看原因",
|
||||
"weeklyJobPartial": "已发送 {sent} 个批次,另有 {failed} 个失败",
|
||||
"weeklyJobEmpty": "没有待发送的预警,批次记录不会变化",
|
||||
"weeklyJobTimeout": "发送任务仍在后台执行,请稍后重新打开本页查看",
|
||||
"weeklyJobError": "发送任务执行失败",
|
||||
"weeklyBatchesLoadFailed": "加载周汇总批次失败",
|
||||
"batchNo": "批次号",
|
||||
"weekKey": "周次",
|
||||
"batchStatusLabel": "发送状态",
|
||||
"batchFailureReason": "失败原因",
|
||||
"batchFailureReasonEmpty": "未记录具体失败原因",
|
||||
"batchFailureReasonAria": "查看发送失败原因",
|
||||
"batchFailureReasonLine": "{reason}:{detail}",
|
||||
"batchFailureReasonCode": {
|
||||
"notify_disabled": "企业微信通知未启用",
|
||||
"event_disabled": "合同付款预警通知事件未启用",
|
||||
"user_unbound": "收件人未绑定企业微信账号",
|
||||
"textcard_failed": "企业微信卡片发送失败",
|
||||
"file_upload_failed": "企业微信附件上传失败",
|
||||
"file_failed": "企业微信附件发送失败",
|
||||
"unknown": "发送失败"
|
||||
},
|
||||
"batchTotal": "汇总笔数",
|
||||
"batchExcel": "Excel 附件",
|
||||
"batchSentAt": "发送时间",
|
||||
"weeklyBatchesEmpty": "暂无周汇总批次",
|
||||
"weeklyPendingSummary": "本周待发送 {count} 笔 · 下次发送 {datetime}",
|
||||
"weeklyPendingCountOnly": "本周待发送 {count} 笔",
|
||||
"downloadExcel": "下载 Excel",
|
||||
"excelDownloadFailed": "下载预警附件失败",
|
||||
"batchStatus": {
|
||||
"pending": "待发送",
|
||||
"sent": "已发送",
|
||||
"failed": "发送失败",
|
||||
"processing": "处理中",
|
||||
"resolved": "已停止提醒"
|
||||
},
|
||||
"backToLedger": "返回",
|
||||
"detailLoadFailed": "加载合同详情失败",
|
||||
"detailLoading": "正在加载合同详情…",
|
||||
"detailOverview": "合同概览",
|
||||
"detailAttachments": "原文附件",
|
||||
"detailPaymentPlan": "付款计划",
|
||||
"detailAlertHistory": "预警记录",
|
||||
"archiveDate": "合同归档日期",
|
||||
"archiveDateHint": "该日期为合同申请单的归档日期",
|
||||
"parseStatus": "解析状态",
|
||||
"parseIssueTitle": "解析提示",
|
||||
"planStatus": "计划状态",
|
||||
"attachmentsEmpty": "暂无已归档的合同原文附件",
|
||||
"downloadAttachment": "下载附件",
|
||||
"previewAttachment": "预览",
|
||||
"attachmentPreviewFailed": "附件预览失败",
|
||||
"attachmentPreviewUnsupported": "该格式暂不支持在线预览,请下载后查看",
|
||||
"attachmentDownloadFailed": "下载合同附件失败",
|
||||
"paymentPlanEmpty": "暂无可展示的付款计划",
|
||||
"anchorDate": "日期依据",
|
||||
"nodeStatus": {
|
||||
"pending": "待处理",
|
||||
"active": "进行中",
|
||||
"paid": "已付",
|
||||
"processing": "处理中",
|
||||
"resolved": "已停止提醒",
|
||||
"upcoming": "即将到期",
|
||||
"notStarted": "待起算",
|
||||
"overdue": "已逾期",
|
||||
"review": "待复核",
|
||||
"notApplicable": "无此阶段"
|
||||
},
|
||||
"reparse": "重新解析合同原文",
|
||||
"reparseSuccess": "已使用附件“{attachment}”重新解析",
|
||||
"reparseFailed": "重新解析合同失败",
|
||||
"reviewTitle": "待确认合同",
|
||||
"reviewSubtitle": "未匹配设备采购合同同义标题组、付款比例校验失败或关键字段冲突的合同不会进入付款预警,请下载原文核对。",
|
||||
"reviewSearchPlaceholder": "合同编号、采购编号或供应商",
|
||||
"reviewLoadFailed": "待确认合同加载失败",
|
||||
"reviewContractWorkflow": "合同号 / 合同申请单流程编号",
|
||||
"reviewReason": "待确认原因",
|
||||
"reviewFallbackIssue": "解析结果待人工确认",
|
||||
"reviewEmpty": "暂无待确认合同",
|
||||
"syncConfirm": "将从 OA 同步合同与验收数据,只补全台账中的空字段,不会覆盖已有内容。是否继续?",
|
||||
"weeklySendConfirm": "将把本周待发送的付款预警汇总发给收件人。是否继续?",
|
||||
"scanAlertsConfirm": "将按当前付款计划扫描并生成待发送预警,不会立即发送。是否继续?"
|
||||
},
|
||||
"contractPaymentReview": {
|
||||
"title": "待确认合同",
|
||||
"subtitle": "未匹配设备采购合同同义标题组、付款比例校验失败或关键字段冲突的合同不会进入付款预警,请下载原文核对。",
|
||||
"searchPlaceholder": "合同编号、采购编号、供应商或申请人",
|
||||
"loadFailed": "待确认合同加载失败",
|
||||
"contractWorkflow": "合同号 / 合同申请单流程编号",
|
||||
"reason": "待确认原因",
|
||||
"fallbackIssue": "解析结果待人工确认",
|
||||
"empty": "暂无待确认合同",
|
||||
"manualTitle": "复核付款阶段",
|
||||
"manualSubtitle": "{supplier} · 采购单号 {purchaseOrder}。已识别的阶段已填入,可改。",
|
||||
"backToReview": "返回待确认",
|
||||
"confirmLedger": "确认进入台账",
|
||||
"confirmSuccess": "已进入合同台账",
|
||||
"issueTitle": "解析提示",
|
||||
"contractNoOptional": "合同编号(可空)",
|
||||
"contractNoPlaceholder": "附件未识别出合同号",
|
||||
"percentage": "比例 %",
|
||||
"stageAmount": "金额",
|
||||
"basisDate": "日期依据",
|
||||
"noStage": "无此阶段",
|
||||
"ruleIdentity": "采购单号和合同金额有效",
|
||||
"rulePercent": "启用阶段的比例合计为 100%,空比例不算 0",
|
||||
"ruleAmount": "每个启用阶段的金额等于合同金额乘以比例",
|
||||
"ruleDate": "预付款、出货款须填写日期依据",
|
||||
"hintPrepayment": "日期依据是合同归档日。正文写了定金或预付款比例时填在这里。",
|
||||
"hintShipment": "日期依据是交货期限。正文只有“收到定金后 N 天”时,请填写具体日期。",
|
||||
"hintAcceptance": "日期依据是验收单归档日。还没归档可以留空。",
|
||||
"hintWarranty": "没有质保款比例时勾选无此阶段。质保期不是付款比例。",
|
||||
"formLoadFailed": "复核表单加载失败",
|
||||
"submitFailed": "复核提交失败",
|
||||
"manualAction": "人工复核",
|
||||
"fillHintTitle": "填写提示"
|
||||
},
|
||||
"contractPaymentReparse": {
|
||||
"action": "重新解析合同原文",
|
||||
"success": "已使用附件“{attachment}”重新解析",
|
||||
"failed": "重新解析合同失败"
|
||||
},
|
||||
"procurementContract": {
|
||||
"title": "采购合同审查",
|
||||
"subtitle": "维护标准合同模板、风险红线规则并查看审查历史",
|
||||
@@ -5553,8 +5814,14 @@
|
||||
"verify_duplicate": "防重校验"
|
||||
}
|
||||
},
|
||||
"writeLabels": { "yes": "是", "no": "否" },
|
||||
"idempotencyLabels": { "none": "无", "invoice": "按单据号幂等" },
|
||||
"writeLabels": {
|
||||
"yes": "是",
|
||||
"no": "否"
|
||||
},
|
||||
"idempotencyLabels": {
|
||||
"none": "无",
|
||||
"invoice": "按单据号幂等"
|
||||
},
|
||||
"credentialTypeLabels": {
|
||||
"password": "账密",
|
||||
"token": "令牌",
|
||||
@@ -5688,6 +5955,7 @@
|
||||
"formatJson": "格式化",
|
||||
"invalidJsonHint": "JSON 格式无效,请修正后再保存",
|
||||
"testOkBadge": "连接正常",
|
||||
"testNotRun": "未测试",
|
||||
"testFailBadge": "连接失败",
|
||||
"testDetailToggle": "点击展开/收起详情",
|
||||
"advancedHints": {
|
||||
@@ -5883,7 +6151,6 @@
|
||||
"back": "返回停留情况",
|
||||
"canAccept": "是否可以验收",
|
||||
"cannotAcceptNote": "无法验收说明",
|
||||
"cannotAcceptNote": "无法验收说明",
|
||||
"returnFlag": "是否退回",
|
||||
"unspecified": "未标明",
|
||||
"flowStatus": "流程状态",
|
||||
@@ -5925,6 +6192,14 @@
|
||||
"loading": "加载中…",
|
||||
"empty": "暂无调拨类型",
|
||||
"emptyHint": "点击「新建类型」创建第一条在途调拨类型。",
|
||||
"noMatch": "无匹配的调拨类型",
|
||||
"noMatchHint": "试试调整搜索关键字,或清除筛选条件。",
|
||||
"clearFilters": "清除筛选",
|
||||
"noRules": "无规则",
|
||||
"otherNames": "其他语言名称(选填)",
|
||||
"unsavedTitle": "未保存的更改",
|
||||
"unsavedConfirm": "当前修改尚未保存,关闭后将丢失。确定要关闭吗?",
|
||||
"emptyScopeTitle": "保存无范围规则的类型",
|
||||
"colCode": "编码",
|
||||
"colName": "名称",
|
||||
"colRules": "规则数",
|
||||
@@ -5962,6 +6237,7 @@
|
||||
"modeMapped": "映射档",
|
||||
"modeFixed": "固定",
|
||||
"fixedCodeLabel": "仓库编码",
|
||||
"fixedCodePlaceholder": "选择或输入仓库编码",
|
||||
"orgLabel": "法人覆盖",
|
||||
"orgHint": "空=沿用映射档法人",
|
||||
"mappingCheckOk": "映射档已包含该仓库编码",
|
||||
|
||||
@@ -44,6 +44,9 @@
|
||||
"prevPage": "上一页",
|
||||
"nextPage": "下一页"
|
||||
},
|
||||
"filter": {
|
||||
"all": "全部"
|
||||
},
|
||||
"sort": {
|
||||
"unsorted": "点击排序",
|
||||
"asc": "升序,点击切换为降序",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"edit": "編輯",
|
||||
"delete": "刪除",
|
||||
"nav": {
|
||||
"transferTypes": "在途調撥類型",
|
||||
"transferTypes": "調撥類型",
|
||||
"dashboard": "儀表盤",
|
||||
"approvals": "用戶審批",
|
||||
"users": "用戶管理",
|
||||
@@ -637,9 +637,27 @@
|
||||
"pathSectionConfigured": "已設定",
|
||||
"pathSectionNotConfigured": "未設定",
|
||||
"parsingProfiles": "庫存解析",
|
||||
"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": "異動分析預覽" },
|
||||
"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": "庫存欄位目錄",
|
||||
@@ -695,21 +713,38 @@
|
||||
"inventorySampleRequired": "請先上傳庫存樣本檔案並完成結構識別。",
|
||||
"parsingProfileName": "庫存解析名稱",
|
||||
"parsingPurposeLabel": "規則用途",
|
||||
"parsingPurposeHint": "用途建立後不可變更:庫存解析面向庫存欄位目錄,收料異動面向標準異動欄位(唯讀契約)。",
|
||||
"parsingPurpose": { "inventory": "庫存解析", "movement": "收料異動" },
|
||||
"parsingPurposeHint": "用途建立後不可變更:庫存解析面向庫存欄位目錄,入站解析面向標準異動欄位(唯讀契約)。",
|
||||
"parsingPurpose": {
|
||||
"onhand": "庫存",
|
||||
"inbound": "入站",
|
||||
"outbound": "出站"
|
||||
},
|
||||
"movementMappingHint": "標準異動欄位為唯讀業務契約(✱ 必填、🔑 匹配身份),只需為每個欄位選擇報表表頭別名。",
|
||||
"movementRequiredMark": "必填",
|
||||
"movementIdentityMark": "匹配身份",
|
||||
"movementStandardField": "標準異動欄位",
|
||||
"movementBindingLabel": "異動解析規則",
|
||||
"movementBindingLabel": "入站解析規則",
|
||||
"movementBindingNone": "未綁定",
|
||||
"movementBindingHint": "綁定已發布異動規則後,匹配將複用已歸檔收料文件;未綁定時匹配不會觸發抓取(fail-closed)。",
|
||||
"movementBindingHint": "綁定已發布入站規則後,匹配將複用已歸檔收料文件;未綁定時匹配不會觸發抓取(fail-closed)。",
|
||||
"movementFields": {
|
||||
"doc_no": "單號", "line_no": "項次", "in_out_flag": "進出庫別", "material_code": "料號",
|
||||
"material_name": "品名", "warehouse_code": "倉庫", "storage_code": "儲位", "lot_no": "批號",
|
||||
"quantity": "數量", "movement_date": "異動日期", "unit": "單位",
|
||||
"line_seq": "項序", "specification": "規格", "order_type": "訂單類型",
|
||||
"odm_id": "ODM編號", "odm_name": "ODM名稱", "carton_id": "箱號", "pallet_id": "棧板號"
|
||||
"doc_no": "單號",
|
||||
"line_no": "項次",
|
||||
"in_out_flag": "進出庫別",
|
||||
"material_code": "料號",
|
||||
"material_name": "品名",
|
||||
"warehouse_code": "倉庫",
|
||||
"storage_code": "儲位",
|
||||
"lot_no": "批號",
|
||||
"quantity": "數量",
|
||||
"movement_date": "異動日期",
|
||||
"unit": "單位",
|
||||
"line_seq": "項序",
|
||||
"specification": "規格",
|
||||
"order_type": "訂單類型",
|
||||
"odm_id": "ODM編號",
|
||||
"odm_name": "ODM名稱",
|
||||
"carton_id": "箱號",
|
||||
"pallet_id": "棧板號"
|
||||
},
|
||||
"inventoryAnalysisFailed": "庫存檔案結構識別失敗。",
|
||||
"inventoryAnalysisPreview": "識別結果預覽",
|
||||
@@ -2468,8 +2503,8 @@
|
||||
"platformJobFileAssetCleanup": "暫存檔案資產清理",
|
||||
"transferSourceCodes": "來源實例",
|
||||
"transferRecoverHistory": "歷史可復原異常複核",
|
||||
"transferReceiptDateFrom": "收料日期起(T-N)",
|
||||
"transferReceiptDateTo": "收料日期止(T-N)",
|
||||
"transferReceiptDateFrom": "異動日期起(T-N)",
|
||||
"transferReceiptDateTo": "異動日期止(T-N)",
|
||||
"platformJobFixedAssetsSnapshot": "固資快照",
|
||||
"shippingInventoryJobHint": "按計畫從配置的庫存來源抓取庫存資料,由 RPA Worker 非同步匯出。",
|
||||
"shippingInventoryJobParams": "Job 參數(可選)",
|
||||
@@ -2684,19 +2719,19 @@
|
||||
"receiptRawZip": "原始收料",
|
||||
"columns": {
|
||||
"skippedCount": "跳過",
|
||||
"runNo": "Run ID",
|
||||
"startedAt": "Started at",
|
||||
"finishedAt": "Finished at",
|
||||
"status": "Status",
|
||||
"totalCount": "Processed",
|
||||
"successCount": "Success",
|
||||
"failedCount": "Failed",
|
||||
"excelExportFailedHint": "Inventory sources succeeded, but schedule Excel export failed",
|
||||
"wecomNotified": "WeCom notify",
|
||||
"detail": "Detail",
|
||||
"log": "Log",
|
||||
"skippedCountReceipt": "無收料/跳過",
|
||||
"skippedCountInventory": "無庫存/跳過"
|
||||
"runNo": "Run ID",
|
||||
"startedAt": "Started at",
|
||||
"finishedAt": "Finished at",
|
||||
"status": "Status",
|
||||
"totalCount": "Processed",
|
||||
"successCount": "Success",
|
||||
"failedCount": "Failed",
|
||||
"excelExportFailedHint": "Inventory sources succeeded, but schedule Excel export failed",
|
||||
"wecomNotified": "WeCom notify",
|
||||
"detail": "Detail",
|
||||
"log": "Log",
|
||||
"skippedCountReceipt": "無收料/跳過",
|
||||
"skippedCountInventory": "無庫存/跳過"
|
||||
},
|
||||
"deleteConfirmMessage": "確認刪除排程「{name}」?",
|
||||
"msg": {
|
||||
@@ -2710,9 +2745,9 @@
|
||||
"runNowWaitTimeout": "等待執行完成逾時(約 15 分鐘),已停止自動重新整理,可手動查詢記錄",
|
||||
"downloadExcelFailed": "下載 Excel 失敗",
|
||||
"downloadInventoryRawZipFailed": "下載原始庫存包失敗",
|
||||
"deleteFailed": "刪除排程失敗",
|
||||
"testQueryFailed": "Test query failed",
|
||||
"downloadReceiptRawZipFailed": "下載原始收料包失敗"
|
||||
"deleteFailed": "刪除排程失敗",
|
||||
"testQueryFailed": "Test query failed",
|
||||
"downloadReceiptRawZipFailed": "下載原始收料包失敗"
|
||||
},
|
||||
"difySnapshot": {
|
||||
"title": "Dify 執行快照(審計)",
|
||||
@@ -3819,7 +3854,7 @@
|
||||
"approved": "已批准",
|
||||
"superseded": "已失效"
|
||||
},
|
||||
"samples": "已確認盲測樣本:{count}/{required} · {status}",
|
||||
"samples": "已確認盲測樣本:{count}/{required}",
|
||||
"notRun": "尚未執行",
|
||||
"approvedHint": "盲測已批准,無須重複執行或批准。",
|
||||
"selectIndependentSample": "選擇獨立樣本",
|
||||
@@ -5131,11 +5166,256 @@
|
||||
}
|
||||
},
|
||||
"contractPayment": {
|
||||
"title": "合約付款預警", "subtitle": "同步 OA 合約、驗收和廠商預付款請款作業,按三輪規則通知採購職位", "sessionHint": "本期不使用對話和歷史會話,請從上方 Tab 查看台帳。", "sync": "同步 OA 資料", "moreActions": "更多", "forceSync": "強制覆蓋 OA 欄位", "forceSyncConfirm": "將以本次 OA 回傳的非空欄位覆蓋既有 OA 資料,並記錄變更稽核。是否繼續?", "reparseExisting": "批量重新解析既有合約", "reparseExistingConfirm": "將使用已歸檔的合約附件依目前規則更新所有既有合約的解析結果,不會同步或覆蓋 OA 欄位。是否繼續?", "scanAlerts": "掃描產生預警", "jobSubmitted": "工作已提交", "actionFailed": "操作失敗", "loadFailed": "載入合約失敗", "searchPlaceholder": "搜尋合約編號、採購單號、供應商或申請人", "allStatus": "全部", "search": "查詢", "ledger": "合約台帳", "items": "筆", "empty": "暫無合約資料", "purchaseOrder": "採購單號", "supplier": "供應商", "amount": "合約金額", "deliveryDate": "交貨期限", "timeline": "付款計畫時間線", "notAvailable": "—", "stats": {"contracts": "合約總數", "pendingParse": "待處理合約", "readyPlans": "計畫已產生", "alerts": "待預警節點"}, "ledgerFocus": {"due": "即將到期", "dueHint": "7日內", "overdue": "逾期未付", "active": "未到期", "activeHint": "7日外", "dueThisMonth": "本月應付", "dueThisMonthHint": "本自然月"}, "status": {"completed": "已完成", "needs_review": "待覆核", "pending": "待解析"}, "stateLabel": {"parsed": "已解析", "needs_review": "待複核", "pending": "待解析", "active": "已生效"}, "nodeType": {"prepayment": "預付款", "shipment": "出貨款", "acceptance": "驗收款", "warranty": "質保款"}, "ruleConfirmed": "已確定", "prepaymentRule": "合約歸檔後第 7/14/21 天預警;請款以 OA 廠商預付款請款作業為準。", "shipmentRule": "交貨期限前 7 天、到期日、到期後 14 天預警;請款以 OA 廠商預付款請款作業為準。", "acceptanceRule": "驗收歸檔後第 30/40/60 天預警;質保款在質保到期前 7 天、到期日、到期後 14 天預警。", "pendingAlerts": "待處理預警", "processing": "已發起付款", "dataPending": "資料待確認", "paid": "已付款", "stagePaid": "已付", "amountRatioDate": "金額 / 比例 · 日期", "applicant": "申請人", "company": "公司", "erpSchema": "付款帳套", "statusLabel": "狀態", "contractPrefix": "合約", "datePending": "待補充日期", "dateMissing": {"prepayment": "合約歸檔日未填", "shipment": "交貨日期未填", "acceptance": "驗收單未歸檔", "warranty": "質保到期日未定"}, "dateMissingHint": {"prepayment": "預付款從合約歸檔日起算,這裡還沒有歸檔日", "shipment": "出貨款按交貨期限判斷,這裡還沒有交貨日期", "acceptance": "驗收款從驗收單歸檔日起算,這份驗收單還沒歸檔", "warranty": "質保款要等驗收歸檔並確認質保期後,才能算出到期日"}, "statusNormal": "正常", "statusNeedsCompletion": "待補充", "statusOverdue": "已逾期", "statusUpcoming": "即將到期", "statusActive": "未到期", "statusCompleted": "已完成", "totalPrefix": "共", "contractSupplier": "合約號 / 供應商", "nextAlert": "下一預警", "triggerBasis": "觸發依據", "alertDate": "預警日期", "alertRuleHint": "每階段按自然日提醒三輪,到期後併入最近的週五 18:00 彙總發送。沒有對應日期則不提醒。\n預付款:合約歸檔日後第 7、14、21 天(頁面顯示首輪)\n出貨款:交貨期限前 7 天、當天、後 14 天\n驗收款:驗收單歸檔後第 30、40、60 天\n質保款:質保到期前 7 天、當天、後 14 天", "alertFirstRound": "首輪", "payDate": "付款日期", "markPaid": "標為已付", "markPaidTitle": "標為已付", "markPaidHint": "{stage} · {amount} / {percent}%。只標記這一階段。尚未發送的預警會關閉,已經發出的記錄保留。", "markPaidDate": "付款日期", "markPaidRemark": "說明(可選)", "markPaidRemarkPlaceholder": "例如:財務已確認付款,ERP 單號未對上", "markPaidConfirm": "確認已付", "markPaidSource": "來源:手動標記", "markPaidSuccess": "已標為已付", "markPaidFailed": "標記失敗", "processStatus": "處理狀態", "owner": "採購負責人", "oaData": "OA 資料", "contractRule": "合約規則", "ownerDefault": "採購負責人", "workflowNo": "合約申請單流程編號", "contractNoPending": "合約號待從附件解析", "synced": "已同步", "detailSubtitle": "OA 資料、付款節點與企業微信提醒記錄", "backToOverview": "返回總覽", "contractInfo": "OA 合約資訊", "alertHistory": "預警記錄", "alertRound": "第 {round} 次預警", "alertAudit": "預警發送記錄", "alertAuditEmpty": "暫無預警記錄", "alertNode": "付款Line truncated
|
||||
, "syncConfirm": "將從 OA 同步合約與驗收資料,只補齊台帳中的空白欄位,不會覆蓋已有內容。是否繼續?", "weeklySendConfirm": "將把本週待發送的付款預警彙總發給收件人。是否繼續?", "scanAlertsConfirm": "將依目前付款計畫掃描並產生待發送預警,不會立即發送。是否繼續?"},
|
||||
"contractPaymentReview": {"title": "待確認合約", "subtitle": "未符合設備採購合約同義標題組、付款比例驗證失敗或關鍵欄位衝突的合約,不會進入付款預警,請下載原文核對。", "searchPlaceholder": "合約編號、採購單號、供應商或申請人", "loadFailed": "待確認合約載入失敗", "contractWorkflow": "合約號 / 合約申請單流程編號", "reason": "待確認原因", "fallbackIssue": "解析結果待人工確認", "empty": "暫無待確認合約", "manualTitle": "複核付款階段", "manualSubtitle": "{supplier} · 採購單號 {purchaseOrder}。已識別的階段已填入,可改。", "backToReview": "返回待確認", "confirmLedger": "確認進入台帳", "confirmSuccess": "已進入合同台帳", "issueTitle": "解析提示", "contractNoOptional": "合同編號(可空)", "contractNoPlaceholder": "附件未識別出合同號", "percentage": "比例 %", "stageAmount": "金額", "basisDate": "日期依據", "noStage": "無此階段", "ruleIdentity": "採購單號和合同金額有效", "rulePercent": "啟用階段的比例合計為 100%,空白比例不算 0", "ruleAmount": "每個啟用階段的金額等於合同金額乘以比例", "ruleDate": "預付款、出貨款須填寫日期依據", "hintPrepayment": "日期依據是合同歸檔日。正文寫了定金或預付款比例時填在這裡。", "hintShipment": "日期依據是交貨期限。正文只有「收到定金後 N 天」時,請填寫具體日期。", "hintAcceptance": "日期依據是驗收單歸檔日。尚未歸檔可以留空。", "hintWarranty": "沒有質保款比例時勾選無此階段。質保期不是付款比例。", "formLoadFailed": "複核表單載入失敗", "submitFailed": "複核提交失敗", "manualAction": "人工複核", "fillHintTitle": "填寫提示"},
|
||||
"contractPaymentReparse": {"action": "重新解析合約原文", "success": "已使用附件“{attachment}”重新解析", "failed": "重新解析合約失敗"},
|
||||
"contractPaymentReview": {"title": "待確認合約", "subtitle": "未符合設備採購合約同義標題組、付款比例驗證失敗或關鍵欄位衝突的合約,不會進入付款預警,請下載原文核對。", "searchPlaceholder": "合約編號、採購單號、供應商或申請人", "loadFailed": "待確認合約載入失敗", "contractWorkflow": "合約號 / 合約申請單流程編號", "reason": "待確認原因", "fallbackIssue": "解析結果待人工確認", "empty": "暫無待確認合約", "manualTitle": "複核付款階段", "manualSubtitle": "{supplier} · 採購單號 {purchaseOrder}。已識別的階段已填入,可改。", "backToReview": "返回待確認", "confirmLedger": "確認進入台帳", "confirmSuccess": "已進入合同台帳", "issueTitle": "解析提示", "contractNoOptional": "合同編號(可空)", "contractNoPlaceholder": "附件未識別出合同號", "percentage": "比例 %", "stageAmount": "金額", "basisDate": "日期依據", "noStage": "無此階段", "ruleIdentity": "採購單號和合同金額有效", "rulePercent": "啟用階段的比例合計為 100%,空白比例不算 0", "ruleAmount": "每個啟用階段的金額等於合同金額乘以比例", "ruleDate": "預付款、出貨款須填寫日期依據", "hintPrepayment": "日期依據是合同歸檔日。正文寫了定金或預付款比例時填在這裡。", "hintShipment": "日期依據是交貨期限。正文只有「收到定金後 N 天」時,請填寫具體日期。", "hintAcceptance": "日期依據是驗收單歸檔日。尚未歸檔可以留空。", "hintWarranty": "沒有質保款比例時勾選無此階段。質保期不是付款比例。", "formLoadFailed": "複核表單載入失敗", "submitFailed": "複核提交失敗", "manualAction": "人工複核", "fillHintTitle": "填寫提示"},
|
||||
"title": "合約付款預警",
|
||||
"subtitle": "同步 OA 合約、驗收和廠商預付款請款作業,按三輪規則通知採購職位",
|
||||
"sessionHint": "本期不使用對話和歷史會話,請從上方 Tab 查看台帳。",
|
||||
"sync": "同步 OA 資料",
|
||||
"moreActions": "更多",
|
||||
"forceSync": "強制覆蓋 OA 欄位",
|
||||
"forceSyncConfirm": "將以本次 OA 回傳的非空欄位覆蓋既有 OA 資料,並記錄變更稽核。是否繼續?",
|
||||
"reparseExisting": "批量重新解析既有合約",
|
||||
"reparseExistingConfirm": "將使用已歸檔的合約附件依目前規則更新所有既有合約的解析結果,不會同步或覆蓋 OA 欄位。是否繼續?",
|
||||
"scanAlerts": "掃描產生預警",
|
||||
"jobSubmitted": "工作已提交",
|
||||
"actionFailed": "操作失敗",
|
||||
"loadFailed": "載入合約失敗",
|
||||
"searchPlaceholder": "搜尋合約編號、採購單號、供應商或申請人",
|
||||
"allStatus": "全部",
|
||||
"search": "查詢",
|
||||
"ledger": "合約台帳",
|
||||
"items": "筆",
|
||||
"empty": "暫無合約資料",
|
||||
"purchaseOrder": "採購單號",
|
||||
"supplier": "供應商",
|
||||
"amount": "合約金額",
|
||||
"deliveryDate": "交貨期限",
|
||||
"timeline": "付款計畫時間線",
|
||||
"notAvailable": "—",
|
||||
"stats": {
|
||||
"contracts": "合約總數",
|
||||
"pendingParse": "待處理合約",
|
||||
"readyPlans": "計畫已產生",
|
||||
"alerts": "待預警節點"
|
||||
},
|
||||
"ledgerFocus": {
|
||||
"due": "即將到期",
|
||||
"dueHint": "7日內",
|
||||
"overdue": "逾期未付",
|
||||
"active": "未到期",
|
||||
"activeHint": "7日外",
|
||||
"dueThisMonth": "本月應付",
|
||||
"dueThisMonthHint": "本自然月"
|
||||
},
|
||||
"status": {
|
||||
"completed": "已完成",
|
||||
"needs_review": "待覆核",
|
||||
"pending": "待解析"
|
||||
},
|
||||
"stateLabel": {
|
||||
"parsed": "已解析",
|
||||
"needs_review": "待複核",
|
||||
"pending": "待解析",
|
||||
"active": "已生效"
|
||||
},
|
||||
"nodeType": {
|
||||
"prepayment": "預付款",
|
||||
"shipment": "出貨款",
|
||||
"acceptance": "驗收款",
|
||||
"warranty": "質保款"
|
||||
},
|
||||
"ruleConfirmed": "已確定",
|
||||
"prepaymentRule": "合約歸檔後第 7/14/21 天預警;請款以 OA 廠商預付款請款作業為準。",
|
||||
"shipmentRule": "交貨期限前 7 天、到期日、到期後 14 天預警;請款以 OA 廠商預付款請款作業為準。",
|
||||
"acceptanceRule": "驗收歸檔後第 30/40/60 天預警;質保款在質保到期前 7 天、到期日、到期後 14 天預警。",
|
||||
"pendingAlerts": "待處理預警",
|
||||
"processing": "已發起付款",
|
||||
"dataPending": "資料待確認",
|
||||
"paid": "已付款",
|
||||
"stagePaid": "已付",
|
||||
"amountRatioDate": "金額 / 比例 · 日期",
|
||||
"applicant": "申請人",
|
||||
"company": "公司",
|
||||
"erpSchema": "付款帳套",
|
||||
"statusLabel": "狀態",
|
||||
"contractPrefix": "合約",
|
||||
"datePending": "待補充日期",
|
||||
"dateMissing": {
|
||||
"prepayment": "合約歸檔日未填",
|
||||
"shipment": "交貨日期未填",
|
||||
"acceptance": "驗收單未歸檔",
|
||||
"warranty": "質保到期日未定"
|
||||
},
|
||||
"dateMissingHint": {
|
||||
"prepayment": "預付款從合約歸檔日起算,這裡還沒有歸檔日",
|
||||
"shipment": "出貨款按交貨期限判斷,這裡還沒有交貨日期",
|
||||
"acceptance": "驗收款從驗收單歸檔日起算,這份驗收單還沒歸檔",
|
||||
"warranty": "質保款要等驗收歸檔並確認質保期後,才能算出到期日"
|
||||
},
|
||||
"statusNormal": "正常",
|
||||
"statusNeedsCompletion": "待補充",
|
||||
"statusOverdue": "已逾期",
|
||||
"statusUpcoming": "即將到期",
|
||||
"statusActive": "未到期",
|
||||
"statusCompleted": "已完成",
|
||||
"totalPrefix": "共",
|
||||
"contractSupplier": "合約號 / 供應商",
|
||||
"nextAlert": "下一預警",
|
||||
"triggerBasis": "觸發依據",
|
||||
"alertDate": "預警日期",
|
||||
"alertRuleHint": "每階段按自然日提醒三輪,到期後併入最近的週五 18:00 彙總發送。沒有對應日期則不提醒。\n預付款:合約歸檔日後第 7、14、21 天(頁面顯示首輪)\n出貨款:交貨期限前 7 天、當天、後 14 天\n驗收款:驗收單歸檔後第 30、40、60 天\n質保款:質保到期前 7 天、當天、後 14 天",
|
||||
"alertFirstRound": "首輪",
|
||||
"payDate": "付款日期",
|
||||
"markPaid": "標為已付",
|
||||
"markPaidTitle": "標為已付",
|
||||
"markPaidHint": "{stage} · {amount} / {percent}%。只標記這一階段。尚未發送的預警會關閉,已經發出的記錄保留。",
|
||||
"markPaidDate": "付款日期",
|
||||
"markPaidRemark": "說明(可選)",
|
||||
"markPaidRemarkPlaceholder": "例如:財務已確認付款,ERP 單號未對上",
|
||||
"markPaidConfirm": "確認已付",
|
||||
"markPaidSource": "來源:手動標記",
|
||||
"markPaidSuccess": "已標為已付",
|
||||
"markPaidFailed": "標記失敗",
|
||||
"processStatus": "處理狀態",
|
||||
"owner": "採購負責人",
|
||||
"oaData": "OA 資料",
|
||||
"contractRule": "合約規則",
|
||||
"ownerDefault": "採購負責人",
|
||||
"workflowNo": "合約申請單流程編號",
|
||||
"contractNoPending": "合約號待從附件解析",
|
||||
"synced": "已同步",
|
||||
"detailSubtitle": "OA 資料、付款節點與企業微信提醒記錄",
|
||||
"backToOverview": "返回總覽",
|
||||
"contractInfo": "OA 合約資訊",
|
||||
"alertHistory": "預警記錄",
|
||||
"alertRound": "第 {round} 次預警",
|
||||
"alertAudit": "預警發送記錄",
|
||||
"alertAuditEmpty": "暫無預警記錄",
|
||||
"alertNode": "付款節點",
|
||||
"alertScheduledAt": "計畫日期",
|
||||
"alertSentAt": "發送時間",
|
||||
"alertStatus": {
|
||||
"pending": "待發送",
|
||||
"sent": "已發送",
|
||||
"failed": "發送失敗"
|
||||
},
|
||||
"roundValue": "第 {round} 次",
|
||||
"weeklyBatchesTitle": "週彙總批次",
|
||||
"weeklyBatchesSubtitle": "查看依收件人產生的付款預警週彙總、Excel 附件與發送記錄。",
|
||||
"weeklySend": "傳送預警",
|
||||
"weeklyBatchSubmitted": "發送預警任務已提交",
|
||||
"weeklyJobSent": "已發送 {sent} 個批次",
|
||||
"weeklyJobFailed": "{failed} 個批次發送失敗,列表已更新,可點擊失敗圖示查看原因",
|
||||
"weeklyJobPartial": "已發送 {sent} 個批次,另有 {failed} 個失敗",
|
||||
"weeklyJobEmpty": "沒有待發送的預警,批次記錄不會變化",
|
||||
"weeklyJobTimeout": "發送任務仍在背景執行,請稍後重新開啟本頁查看",
|
||||
"weeklyJobError": "發送任務執行失敗",
|
||||
"weeklyBatchesLoadFailed": "載入週彙總批次失敗",
|
||||
"batchNo": "批次號",
|
||||
"weekKey": "週次",
|
||||
"batchStatusLabel": "發送狀態",
|
||||
"batchFailureReason": "失敗原因",
|
||||
"batchFailureReasonEmpty": "未記錄具體失敗原因",
|
||||
"batchFailureReasonAria": "查看發送失敗原因",
|
||||
"batchFailureReasonLine": "{reason}:{detail}",
|
||||
"batchFailureReasonCode": {
|
||||
"notify_disabled": "企業微信通知未啟用",
|
||||
"event_disabled": "合約付款預警通知事件未啟用",
|
||||
"user_unbound": "收件人未綁定企業微信帳號",
|
||||
"textcard_failed": "企業微信卡片發送失敗",
|
||||
"file_upload_failed": "企業微信附件上傳失敗",
|
||||
"file_failed": "企業微信附件發送失敗",
|
||||
"unknown": "發送失敗"
|
||||
},
|
||||
"batchTotal": "彙總筆數",
|
||||
"batchExcel": "Excel 附件",
|
||||
"batchSentAt": "發送時間",
|
||||
"weeklyBatchesEmpty": "暫無週彙總批次",
|
||||
"weeklyPendingSummary": "本週待發送 {count} 筆 · 下次發送 {datetime}",
|
||||
"weeklyPendingCountOnly": "本週待發送 {count} 筆",
|
||||
"downloadExcel": "下載 Excel",
|
||||
"excelDownloadFailed": "下載預警附件失敗",
|
||||
"batchStatus": {
|
||||
"pending": "待發送",
|
||||
"sent": "已發送",
|
||||
"failed": "發送失敗",
|
||||
"processing": "處理中",
|
||||
"resolved": "已停止提醒"
|
||||
},
|
||||
"backToLedger": "返回",
|
||||
"detailLoadFailed": "載入合約詳情失敗",
|
||||
"detailLoading": "正在載入合約詳情…",
|
||||
"detailOverview": "合約概覽",
|
||||
"detailAttachments": "原文附件",
|
||||
"detailPaymentPlan": "付款計畫",
|
||||
"detailAlertHistory": "預警記錄",
|
||||
"archiveDate": "合約歸檔日期",
|
||||
"archiveDateHint": "該日期為合約申請單的歸檔日期",
|
||||
"parseStatus": "解析狀態",
|
||||
"parseIssueTitle": "解析提示",
|
||||
"planStatus": "計畫狀態",
|
||||
"attachmentsEmpty": "暫無已歸檔的合約原文附件",
|
||||
"downloadAttachment": "下載附件",
|
||||
"previewAttachment": "預覽",
|
||||
"attachmentPreviewFailed": "附件預覽失敗",
|
||||
"attachmentPreviewUnsupported": "此格式暫不支援線上預覽,請下載後查看",
|
||||
"attachmentDownloadFailed": "下載合約附件失敗",
|
||||
"paymentPlanEmpty": "暫無可展示的付款計畫",
|
||||
"anchorDate": "日期依據",
|
||||
"nodeStatus": {
|
||||
"pending": "待處理",
|
||||
"active": "進行中",
|
||||
"paid": "已付",
|
||||
"processing": "處理中",
|
||||
"resolved": "已停止提醒",
|
||||
"upcoming": "即將到期",
|
||||
"notStarted": "待起算",
|
||||
"overdue": "已逾期",
|
||||
"review": "待複核",
|
||||
"notApplicable": "無此階段"
|
||||
},
|
||||
"syncConfirm": "將從 OA 同步合約與驗收資料,只補齊台帳中的空白欄位,不會覆蓋已有內容。是否繼續?",
|
||||
"weeklySendConfirm": "將把本週待發送的付款預警彙總發給收件人。是否繼續?",
|
||||
"scanAlertsConfirm": "將依目前付款計畫掃描並產生待發送預警,不會立即發送。是否繼續?"
|
||||
},
|
||||
"contractPaymentReview": {
|
||||
"title": "待確認合約",
|
||||
"subtitle": "未符合設備採購合約同義標題組、付款比例驗證失敗或關鍵欄位衝突的合約,不會進入付款預警,請下載原文核對。",
|
||||
"searchPlaceholder": "合約編號、採購單號、供應商或申請人",
|
||||
"loadFailed": "待確認合約載入失敗",
|
||||
"contractWorkflow": "合約號 / 合約申請單流程編號",
|
||||
"reason": "待確認原因",
|
||||
"fallbackIssue": "解析結果待人工確認",
|
||||
"empty": "暫無待確認合約",
|
||||
"manualTitle": "複核付款階段",
|
||||
"manualSubtitle": "{supplier} · 採購單號 {purchaseOrder}。已識別的階段已填入,可改。",
|
||||
"backToReview": "返回待確認",
|
||||
"confirmLedger": "確認進入台帳",
|
||||
"confirmSuccess": "已進入合同台帳",
|
||||
"issueTitle": "解析提示",
|
||||
"contractNoOptional": "合同編號(可空)",
|
||||
"contractNoPlaceholder": "附件未識別出合同號",
|
||||
"percentage": "比例 %",
|
||||
"stageAmount": "金額",
|
||||
"basisDate": "日期依據",
|
||||
"noStage": "無此階段",
|
||||
"ruleIdentity": "採購單號和合同金額有效",
|
||||
"rulePercent": "啟用階段的比例合計為 100%,空白比例不算 0",
|
||||
"ruleAmount": "每個啟用階段的金額等於合同金額乘以比例",
|
||||
"ruleDate": "預付款、出貨款須填寫日期依據",
|
||||
"hintPrepayment": "日期依據是合同歸檔日。正文寫了定金或預付款比例時填在這裡。",
|
||||
"hintShipment": "日期依據是交貨期限。正文只有「收到定金後 N 天」時,請填寫具體日期。",
|
||||
"hintAcceptance": "日期依據是驗收單歸檔日。尚未歸檔可以留空。",
|
||||
"hintWarranty": "沒有質保款比例時勾選無此階段。質保期不是付款比例。",
|
||||
"formLoadFailed": "複核表單載入失敗",
|
||||
"submitFailed": "複核提交失敗",
|
||||
"manualAction": "人工複核",
|
||||
"fillHintTitle": "填寫提示"
|
||||
},
|
||||
"contractPaymentReparse": {
|
||||
"action": "重新解析合約原文",
|
||||
"success": "已使用附件“{attachment}”重新解析",
|
||||
"failed": "重新解析合約失敗"
|
||||
},
|
||||
"procurementContract": {
|
||||
"title": "採購合同審查",
|
||||
"subtitle": "維護標準合同模板、風險紅線規則並查看審查歷史",
|
||||
@@ -5520,8 +5800,14 @@
|
||||
"verify_duplicate": "防重校驗"
|
||||
}
|
||||
},
|
||||
"writeLabels": { "yes": "是", "no": "否" },
|
||||
"idempotencyLabels": { "none": "無", "invoice": "按單據號冪等" },
|
||||
"writeLabels": {
|
||||
"yes": "是",
|
||||
"no": "否"
|
||||
},
|
||||
"idempotencyLabels": {
|
||||
"none": "無",
|
||||
"invoice": "按單據號冪等"
|
||||
},
|
||||
"credentialTypeLabels": {
|
||||
"password": "帳密",
|
||||
"token": "權杖",
|
||||
@@ -5655,6 +5941,7 @@
|
||||
"formatJson": "格式化",
|
||||
"invalidJsonHint": "JSON 格式無效,請修正後再儲存",
|
||||
"testOkBadge": "連線正常",
|
||||
"testNotRun": "未測試",
|
||||
"testFailBadge": "連線失敗",
|
||||
"testDetailToggle": "點擊展開/收起詳情",
|
||||
"advancedHints": {
|
||||
@@ -5850,7 +6137,6 @@
|
||||
"back": "返回停留情況",
|
||||
"canAccept": "是否可以驗收",
|
||||
"cannotAcceptNote": "無法驗收說明",
|
||||
"cannotAcceptNote": "無法驗收說明",
|
||||
"returnFlag": "是否退回",
|
||||
"unspecified": "未標明",
|
||||
"flowStatus": "流程狀態",
|
||||
@@ -5892,6 +6178,14 @@
|
||||
"loading": "載入中…",
|
||||
"empty": "暫無調撥類型",
|
||||
"emptyHint": "點擊「新建類型」建立第一筆在途調撥類型。",
|
||||
"noMatch": "無符合條件的調撥類型",
|
||||
"noMatchHint": "試試調整搜尋關鍵字,或清除篩選條件。",
|
||||
"clearFilters": "清除篩選",
|
||||
"noRules": "無規則",
|
||||
"otherNames": "其他語言名稱(選填)",
|
||||
"unsavedTitle": "未儲存的變更",
|
||||
"unsavedConfirm": "目前修改尚未儲存,關閉後將遺失。確定要關閉嗎?",
|
||||
"emptyScopeTitle": "儲存無範圍規則的類型",
|
||||
"colCode": "編碼",
|
||||
"colName": "名稱",
|
||||
"colRules": "規則數",
|
||||
@@ -5929,6 +6223,7 @@
|
||||
"modeMapped": "映射檔",
|
||||
"modeFixed": "固定",
|
||||
"fixedCodeLabel": "倉庫編碼",
|
||||
"fixedCodePlaceholder": "選擇或輸入倉庫編碼",
|
||||
"orgLabel": "法人覆蓋",
|
||||
"orgHint": "空=沿用映射檔法人",
|
||||
"mappingCheckOk": "映射檔已包含該倉庫編碼",
|
||||
|
||||
@@ -44,6 +44,9 @@
|
||||
"prevPage": "上一頁",
|
||||
"nextPage": "下一頁"
|
||||
},
|
||||
"filter": {
|
||||
"all": "全部"
|
||||
},
|
||||
"sort": {
|
||||
"unsorted": "點擊排序",
|
||||
"asc": "升序,點擊切換為降序",
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/**
|
||||
* frontend/vitest.setup.ts
|
||||
* 用途:为 jsdom 测试环境补齐 Web Crypto(subtle / randomUUID),与浏览器行为对齐。
|
||||
* 用途:为 jsdom 测试环境补齐浏览器 API(Web Crypto、ResizeObserver),与浏览器行为对齐。
|
||||
* 依赖:node:crypto webcrypto。
|
||||
* 逻辑:vitest.config 通过 setupFiles 注入;供 XFA 路径哈希等单测使用。
|
||||
* 逻辑:vitest.config 通过 setupFiles 注入;供 XFA 路径哈希等单测与
|
||||
* Element Plus 组件(el-table 布局依赖 ResizeObserver)挂载使用。
|
||||
*/
|
||||
import { webcrypto } from 'node:crypto';
|
||||
|
||||
@@ -20,4 +21,20 @@ function ensureWebCrypto(): void {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 补 ResizeObserver 桩:jsdom 未实现,el-table 依赖它计算列布局,缺失时行不渲染单元格。
|
||||
* 全局桩兜底 chat 域及后续 EP 组件单测;admin 既有 spec 内的本地桩保留不动(行为一致)。
|
||||
*/
|
||||
function ensureResizeObserver(): void {
|
||||
const target = globalThis as Record<string, unknown>;
|
||||
if (target.ResizeObserver) return;
|
||||
class ResizeObserverStub {
|
||||
observe(): void {}
|
||||
unobserve(): void {}
|
||||
disconnect(): void {}
|
||||
}
|
||||
target.ResizeObserver = ResizeObserverStub;
|
||||
}
|
||||
|
||||
ensureWebCrypto();
|
||||
ensureResizeObserver();
|
||||
Reference in new issue
Block a user