feat(shipping-notice): 增强订单抽取与审计功能,支持取消与保留策略
- 在环境配置中新增进度细化、订单提取取消与审计导出相关的开关 - 实现订单抽取运行的取消功能,允许管理员在运行中进行操作 - 引入审计事件的保留策略,支持三年保留期的自动清理 - 更新相关模型与服务,确保新功能的完整性与可追溯性 - 增强文档与代码注释,反映新的业务逻辑与审计要求
This commit is contained in:
1 parent
c85997884b
commit
95cdfe66b0
158 files changed
+19005
-1201
No files matched your search
@@ -0,0 +1,316 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-audit/ShippingAuditCenterPage.vue
|
||||
用途:管理员货代统一审计中心——筛选、详情 Diff、受控导出。
|
||||
依赖:shipping-audit.api、Vue I18n、Vue Router。
|
||||
逻辑:列表展示会话/工作项/Case 关联字段;不含快照全文;打开详情才拉取白名单前后差异;导出写服务端访问审计。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import {
|
||||
exportShippingAuditEvents,
|
||||
getShippingAuditEvent,
|
||||
listShippingAuditEvents,
|
||||
type ShippingAuditEventDetail,
|
||||
type ShippingAuditEventSummary,
|
||||
type ShippingAuditFilters,
|
||||
} from '@/features/admin/api/shipping-audit.api';
|
||||
|
||||
const { t } = useI18n();
|
||||
const loading = ref(false);
|
||||
const detailLoading = ref(false);
|
||||
const exporting = ref(false);
|
||||
const error = ref('');
|
||||
const page = ref(1);
|
||||
const pageSize = 25;
|
||||
const total = ref(0);
|
||||
const rows = ref<ShippingAuditEventSummary[]>([]);
|
||||
const detail = ref<ShippingAuditEventDetail | null>(null);
|
||||
const filters = ref<ShippingAuditFilters>({
|
||||
event_type: '',
|
||||
actor_type: '',
|
||||
actor_id: '',
|
||||
run_no: '',
|
||||
task_no: '',
|
||||
document_id: '',
|
||||
conversation_id: '',
|
||||
session_item_id: '',
|
||||
review_case_no: '',
|
||||
owner_user_id: '',
|
||||
operation_id: '',
|
||||
request_id: '',
|
||||
result: '',
|
||||
created_from: '',
|
||||
created_to: '',
|
||||
q: '',
|
||||
});
|
||||
|
||||
/**
|
||||
* 将 datetime-local 值规范为 ISO 字符串供 API 查询。
|
||||
*/
|
||||
function normalizeDateTimeFilter(value?: string): string {
|
||||
const raw = String(value || '').trim();
|
||||
if (!raw) return '';
|
||||
const date = new Date(raw);
|
||||
if (Number.isNaN(date.getTime())) return raw;
|
||||
return date.toISOString();
|
||||
}
|
||||
|
||||
const formatTime = (value?: string | null) => (value ? new Date(value).toLocaleString() : '—');
|
||||
|
||||
/**
|
||||
* 加载审计列表;服务端已做管理员鉴权与访问留痕。
|
||||
*/
|
||||
async function load() {
|
||||
loading.value = true;
|
||||
error.value = '';
|
||||
try {
|
||||
const payload: ShippingAuditFilters = {
|
||||
...filters.value,
|
||||
created_from: normalizeDateTimeFilter(filters.value.created_from),
|
||||
created_to: normalizeDateTimeFilter(filters.value.created_to),
|
||||
};
|
||||
const response = await listShippingAuditEvents(page.value, pageSize, payload);
|
||||
rows.value = response.items;
|
||||
total.value = response.total;
|
||||
} catch {
|
||||
error.value = t('admin.shippingAudit.loadFailed');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 应用筛选并回到第一页。
|
||||
*/
|
||||
async function applyFilters() {
|
||||
page.value = 1;
|
||||
await load();
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开详情抽屉并加载白名单 Diff。
|
||||
*/
|
||||
async function openDetail(eventId: number) {
|
||||
detailLoading.value = true;
|
||||
error.value = '';
|
||||
try {
|
||||
detail.value = await getShippingAuditEvent(eventId);
|
||||
} catch {
|
||||
error.value = t('admin.shippingAudit.detailFailed');
|
||||
} finally {
|
||||
detailLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出当前筛选条件下的 CSV。
|
||||
*/
|
||||
async function exportCsv() {
|
||||
exporting.value = true;
|
||||
error.value = '';
|
||||
try {
|
||||
const payload: ShippingAuditFilters = {
|
||||
...filters.value,
|
||||
created_from: normalizeDateTimeFilter(filters.value.created_from),
|
||||
created_to: normalizeDateTimeFilter(filters.value.created_to),
|
||||
};
|
||||
await exportShippingAuditEvents(payload, 'csv');
|
||||
} catch {
|
||||
error.value = t('admin.shippingAudit.exportFailed');
|
||||
} finally {
|
||||
exporting.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
void load();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="space-y-5 p-5 md:p-7" data-testid="shipping-audit-center">
|
||||
<header class="flex flex-wrap items-start justify-between gap-4">
|
||||
<div>
|
||||
<h1 class="section-title">{{ t('admin.shippingAudit.title') }}</h1>
|
||||
<p class="section-desc mt-1 max-w-3xl">{{ t('admin.shippingAudit.subtitle') }}</p>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<button type="button" class="btn-secondary btn-sm" :disabled="exporting" @click="exportCsv">
|
||||
{{ exporting ? t('admin.shippingAudit.exporting') : t('admin.shippingAudit.export') }}
|
||||
</button>
|
||||
<button type="button" class="btn-secondary btn-sm" :disabled="loading" @click="load">
|
||||
{{ t('admin.shippingAudit.refresh') }}
|
||||
</button>
|
||||
</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">
|
||||
<span>{{ t('admin.shippingAudit.filters.eventType') }}</span>
|
||||
<input v-model="filters.event_type" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<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">user</option>
|
||||
<option value="admin">admin</option>
|
||||
<option value="system">system</option>
|
||||
<option value="rpa">rpa</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<span>{{ t('admin.shippingAudit.filters.actorId') }}</span>
|
||||
<input v-model="filters.actor_id" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<span>{{ t('admin.shippingAudit.filters.runNo') }}</span>
|
||||
<input v-model="filters.run_no" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<span>{{ t('admin.shippingAudit.filters.taskNo') }}</span>
|
||||
<input v-model="filters.task_no" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<span>{{ t('admin.shippingAudit.filters.documentId') }}</span>
|
||||
<input v-model="filters.document_id" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<span>{{ t('admin.shippingAudit.filters.conversationId') }}</span>
|
||||
<input v-model="filters.conversation_id" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<span>{{ t('admin.shippingAudit.filters.sessionItemId') }}</span>
|
||||
<input v-model="filters.session_item_id" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<span>{{ t('admin.shippingAudit.filters.reviewCaseNo') }}</span>
|
||||
<input v-model="filters.review_case_no" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<span>{{ t('admin.shippingAudit.filters.ownerUserId') }}</span>
|
||||
<input v-model="filters.owner_user_id" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<span>{{ t('admin.shippingAudit.filters.operationId') }}</span>
|
||||
<input v-model="filters.operation_id" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<span>{{ t('admin.shippingAudit.filters.requestId') }}</span>
|
||||
<input v-model="filters.request_id" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<span>{{ t('admin.shippingAudit.filters.result') }}</span>
|
||||
<input v-model="filters.result" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<span>{{ t('admin.shippingAudit.filters.createdFrom') }}</span>
|
||||
<input v-model="filters.created_from" type="datetime-local" class="input-field text-sm" @change="applyFilters">
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<span>{{ t('admin.shippingAudit.filters.createdTo') }}</span>
|
||||
<input v-model="filters.created_to" type="datetime-local" class="input-field text-sm" @change="applyFilters">
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary md:col-span-2 lg:col-span-1">
|
||||
<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>
|
||||
</label>
|
||||
</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-[1280px] w-full text-left text-sm">
|
||||
<thead class="border-b border-default bg-surface-soft text-xs text-muted">
|
||||
<tr>
|
||||
<th class="px-3 py-2">{{ t('admin.shippingAudit.columns.time') }}</th>
|
||||
<th class="px-3 py-2">{{ t('admin.shippingAudit.columns.event') }}</th>
|
||||
<th class="px-3 py-2">{{ t('admin.shippingAudit.columns.actor') }}</th>
|
||||
<th class="px-3 py-2">{{ t('admin.shippingAudit.columns.conversation') }}</th>
|
||||
<th class="px-3 py-2">{{ t('admin.shippingAudit.columns.sessionItem') }}</th>
|
||||
<th class="px-3 py-2">{{ t('admin.shippingAudit.columns.reviewCase') }}</th>
|
||||
<th class="px-3 py-2">{{ t('admin.shippingAudit.columns.run') }}</th>
|
||||
<th class="px-3 py-2">{{ t('admin.shippingAudit.columns.task') }}</th>
|
||||
<th class="px-3 py-2">{{ t('admin.shippingAudit.columns.result') }}</th>
|
||||
<th class="px-3 py-2"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-if="loading">
|
||||
<td colspan="10" class="px-3 py-8 text-center text-muted">{{ t('admin.shippingAudit.loading') }}</td>
|
||||
</tr>
|
||||
<tr v-else-if="!rows.length">
|
||||
<td colspan="10" 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 text-xs">{{ formatTime(row.created_at) }}</td>
|
||||
<td class="px-3 py-2">
|
||||
<div class="font-medium">{{ row.event_type }}</div>
|
||||
<div class="text-[11px] text-muted">{{ row.action || '—' }}</div>
|
||||
</td>
|
||||
<td class="px-3 py-2 text-xs">{{ row.actor_type }}<span v-if="row.actor_id"> / {{ row.actor_id }}</span></td>
|
||||
<td class="px-3 py-2 font-mono text-xs">{{ row.conversation_id || '—' }}</td>
|
||||
<td class="px-3 py-2 font-mono text-xs">{{ row.session_item_id || '—' }}</td>
|
||||
<td class="px-3 py-2 font-mono text-xs">{{ row.review_case_no || '—' }}</td>
|
||||
<td class="px-3 py-2 font-mono text-xs">{{ row.run_no || '—' }}</td>
|
||||
<td class="px-3 py-2 font-mono text-xs">{{ row.task_no || '—' }}</td>
|
||||
<td class="px-3 py-2">{{ row.result || '—' }}</td>
|
||||
<td class="px-3 py-2">
|
||||
<button type="button" class="text-brand-600 hover:underline" @click="openDetail(row.id)">
|
||||
{{ t('admin.shippingAudit.diff') }}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</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>{{ 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.shippingAudit.next') }}</button>
|
||||
</div>
|
||||
|
||||
<div v-if="detail || detailLoading" class="fixed inset-0 z-50 flex justify-end bg-overlay" @click.self="detail = null">
|
||||
<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="detail = null">{{ t('admin.close') }}</button>
|
||||
</div>
|
||||
<p v-if="detailLoading" class="mt-6 text-muted">{{ t('admin.shippingAudit.loading') }}</p>
|
||||
<template v-else-if="detail">
|
||||
<dl class="mt-5 grid grid-cols-2 gap-3 text-sm">
|
||||
<dt>{{ t('admin.shippingAudit.columns.event') }}</dt><dd>{{ detail.event_type }}</dd>
|
||||
<dt>{{ t('admin.shippingAudit.columns.actor') }}</dt><dd>{{ detail.actor_type }} / {{ detail.actor_id || '—' }}</dd>
|
||||
<dt>{{ t('admin.shippingAudit.columns.run') }}</dt><dd class="font-mono text-xs">{{ detail.run_no || '—' }}</dd>
|
||||
<dt>{{ t('admin.shippingAudit.columns.task') }}</dt><dd class="font-mono text-xs">{{ detail.task_no || '—' }}</dd>
|
||||
<dt>{{ t('admin.shippingAudit.filters.conversationId') }}</dt><dd class="font-mono text-xs">{{ detail.conversation_id || '—' }}</dd>
|
||||
<dt>{{ t('admin.shippingAudit.filters.sessionItemId') }}</dt><dd class="font-mono text-xs">{{ detail.session_item_id || '—' }}</dd>
|
||||
<dt>{{ t('admin.shippingAudit.filters.reviewCaseNo') }}</dt><dd class="font-mono text-xs">{{ detail.review_case_no || '—' }}</dd>
|
||||
<dt>{{ t('admin.shippingAudit.filters.ownerUserId') }}</dt><dd class="font-mono text-xs">{{ detail.owner_user_id || '—' }}</dd>
|
||||
<dt>operation_id</dt><dd class="font-mono text-xs">{{ detail.operation_id || '—' }}</dd>
|
||||
<dt>request_id</dt><dd class="font-mono text-xs">{{ detail.request_id || '—' }}</dd>
|
||||
</dl>
|
||||
<h3 class="mt-6 font-semibold">{{ t('admin.shippingAudit.diff') }}</h3>
|
||||
<div v-if="detail.diff?.length" class="mt-2 space-y-2">
|
||||
<div
|
||||
v-for="row in detail.diff"
|
||||
:key="row.key"
|
||||
class="rounded-lg border border-default p-3 text-xs"
|
||||
>
|
||||
<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>
|
||||
</div>
|
||||
<p v-else class="mt-2 text-sm text-muted">{{ t('admin.shippingAudit.noDiff') }}</p>
|
||||
</template>
|
||||
</aside>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
+107
-7
@@ -5,7 +5,7 @@
|
||||
逻辑:验证页进入本页;管理员选择未参与建模的样本、复核候选后写入真值,再执行并批准,最后回到发布检查。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { computed, onBeforeUnmount, onMounted, ref } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
@@ -15,11 +15,15 @@ import {
|
||||
confirmOrderProfileBlindTestReviews,
|
||||
createOrderProfileTestSuite,
|
||||
executeOrderProfileTestSuite,
|
||||
createOrderProfileSample,
|
||||
getOrderProfileSampleStatus,
|
||||
listOrderProfileBlindTestAvailableSamples,
|
||||
listOrderProfileBoundSamples,
|
||||
listOrderProfileSamples,
|
||||
previewOrderProfileBlindTestCandidate,
|
||||
removeOrderProfileTestSample,
|
||||
} from '@/features/admin/api/shipping-order-document-profile.api';
|
||||
import { uploadFileAsset } from '@/shared/api/file-assets.api';
|
||||
import type {
|
||||
OrderProfileBlindTestAvailableSample,
|
||||
OrderProfileBlindTestCandidate,
|
||||
@@ -43,9 +47,22 @@ const working = ref(false);
|
||||
const hasTrainingSample = ref(false);
|
||||
const availableSamplesLoaded = ref(false);
|
||||
const availableSamplesLoading = ref(false);
|
||||
const uploadingSample = ref(false);
|
||||
const pendingUpload = ref<{ intakeNo: string; filename: string; state: 'parsing' | 'failed' } | null>(null);
|
||||
let uploadPollingTimer: number | null = null;
|
||||
let availableSamplesController: AbortController | null = null;
|
||||
let availableSamplesTimeout: number | null = null;
|
||||
|
||||
/** 当前选择仅以 API 列表中的 document/table 组合为准,避免浏览器提交伪造样本。 */
|
||||
const selectedSample = computed(() => availableSamples.value.find((item) => `${item.document_id}:${item.table_id}` === selectedSampleKey.value) || null);
|
||||
/** 用安全表格摘要区分同页多表;内部 table_id 仅作为请求身份,绝不展示给管理员。 */
|
||||
function sampleLabel(sample: OrderProfileBlindTestAvailableSample): string {
|
||||
const header = sample.header_preview.join(' / ');
|
||||
return t('admin.shippingOrderProfiles.blindTest.sampleOption', {
|
||||
filename: sample.filename, page: sample.page_no, table: sample.table_index,
|
||||
rows: sample.row_count, columns: sample.column_count, header,
|
||||
});
|
||||
}
|
||||
/** 盲测执行成功且尚未批准时才允许批准;批准后证据在服务端保持不可变。 */
|
||||
const canApprove = computed(() => hasTrainingSample.value && suite.value?.status === 'draft' && suite.value.latest_run?.status === 'passed');
|
||||
/** 将服务端安全失败码转为管理员可定位的摘要;不回显订单正文或人工真值。 */
|
||||
@@ -100,17 +117,93 @@ async function loadSuite(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
/** 仅在管理员需要挑选盲测样本时加载候选摘要,避免页面首屏等待历史样本逐份证据校验。 */
|
||||
async function loadAvailableSamples(): Promise<void> {
|
||||
if (!suite.value || suite.value.status !== 'draft' || availableSamplesLoaded.value || availableSamplesLoading.value) return;
|
||||
/** 按需读取独立样本摘要;上传解析完成时可强制刷新并定位刚上传的文档。 */
|
||||
async function loadAvailableSamples(force = false): Promise<void> {
|
||||
if (!suite.value || suite.value.status !== 'draft' || (!force && availableSamplesLoaded.value) || availableSamplesLoading.value) return;
|
||||
availableSamplesController?.abort();
|
||||
if (availableSamplesTimeout) window.clearTimeout(availableSamplesTimeout);
|
||||
const controller = new AbortController();
|
||||
availableSamplesController = controller;
|
||||
availableSamplesLoading.value = true;
|
||||
let timedOut = false;
|
||||
availableSamplesTimeout = window.setTimeout(() => {
|
||||
timedOut = true;
|
||||
controller.abort();
|
||||
}, 15_000);
|
||||
try {
|
||||
availableSamples.value = (await listOrderProfileBlindTestAvailableSamples(suite.value.id)).samples;
|
||||
availableSamples.value = (await listOrderProfileBlindTestAvailableSamples(suite.value.id, controller.signal)).samples;
|
||||
availableSamplesLoaded.value = true;
|
||||
} catch (error) {
|
||||
if (timedOut) {
|
||||
message.error(t('admin.shippingOrderProfiles.blindTest.loadIndependentSamplesTimedOut'));
|
||||
} else if (!controller.signal.aborted) {
|
||||
report(error);
|
||||
}
|
||||
} finally {
|
||||
if (availableSamplesController === controller) {
|
||||
availableSamplesController = null;
|
||||
availableSamplesLoading.value = false;
|
||||
}
|
||||
if (availableSamplesTimeout) window.clearTimeout(availableSamplesTimeout);
|
||||
availableSamplesTimeout = null;
|
||||
}
|
||||
}
|
||||
|
||||
/** 停止上传样本的后台轮询,避免离开盲测页后继续向已卸载页面写入状态。 */
|
||||
function stopUploadPolling(): void {
|
||||
if (uploadPollingTimer) window.clearTimeout(uploadPollingTimer);
|
||||
uploadPollingTimer = null;
|
||||
}
|
||||
|
||||
/** 上传完成后精确选中同一 Intake 的首个可盲测表格,仍必须经过管理员预览和复核。 */
|
||||
async function pollUploadedSample(intakeNo: string): Promise<void> {
|
||||
try {
|
||||
const result = await getOrderProfileSampleStatus(intakeNo);
|
||||
if (result.parse_status === 'parsed' && result.document_count > 0) {
|
||||
const uploaded = (await listOrderProfileSamples()).find((item) => item.intake_no === intakeNo);
|
||||
await loadAvailableSamples(true);
|
||||
const selected = uploaded && availableSamples.value.find((item) => item.document_id === uploaded.document_id);
|
||||
if (selected) {
|
||||
selectedSampleKey.value = `${selected.document_id}:${selected.table_id}`;
|
||||
pendingUpload.value = null;
|
||||
message.success(t('admin.shippingOrderProfiles.wizard.sampleReady'));
|
||||
} else {
|
||||
pendingUpload.value = { intakeNo, filename: pendingUpload.value?.filename || '', state: 'failed' };
|
||||
message.error(t('admin.shippingOrderProfiles.blindTest.noIndependentSamples'));
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (['failed', 'error'].includes(result.parse_status)) {
|
||||
pendingUpload.value = { intakeNo, filename: pendingUpload.value?.filename || '', state: 'failed' };
|
||||
return;
|
||||
}
|
||||
uploadPollingTimer = window.setTimeout(() => void pollUploadedSample(intakeNo), 1500);
|
||||
} catch {
|
||||
uploadPollingTimer = window.setTimeout(() => void pollUploadedSample(intakeNo), 2000);
|
||||
}
|
||||
}
|
||||
|
||||
/** 上传 PDF/EML 到隔离模板样本池;上传后不会自动写入盲测真值。 */
|
||||
async function uploadIndependentSample(event: Event): Promise<void> {
|
||||
const input = event.target as HTMLInputElement;
|
||||
const file = input.files?.[0];
|
||||
input.value = '';
|
||||
if (!file || uploadingSample.value) return;
|
||||
if (!/\.(pdf|eml)$/i.test(file.name)) {
|
||||
message.error(t('admin.shippingOrderProfiles.sampleFileTypeInvalid'));
|
||||
return;
|
||||
}
|
||||
stopUploadPolling();
|
||||
uploadingSample.value = true;
|
||||
try {
|
||||
const asset = await uploadFileAsset(file);
|
||||
const intake = await createOrderProfileSample(asset.asset_no);
|
||||
pendingUpload.value = { intakeNo: intake.intake_no, filename: file.name, state: 'parsing' };
|
||||
void pollUploadedSample(intake.intake_no);
|
||||
} catch (error) {
|
||||
report(error);
|
||||
} finally {
|
||||
availableSamplesLoading.value = false;
|
||||
uploadingSample.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,6 +332,11 @@ function goToPublishCheck(): void {
|
||||
}
|
||||
|
||||
onMounted(loadSuite);
|
||||
onBeforeUnmount(() => {
|
||||
stopUploadPolling();
|
||||
availableSamplesController?.abort();
|
||||
if (availableSamplesTimeout) window.clearTimeout(availableSamplesTimeout);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -261,7 +359,8 @@ onMounted(loadSuite);
|
||||
<h2>{{ t('admin.shippingOrderProfiles.blindTest.selectIndependentSample') }}</h2>
|
||||
<p v-if="!availableSamplesLoaded">{{ t('admin.shippingOrderProfiles.blindTest.loadIndependentSamplesHint') }}</p>
|
||||
<p v-else-if="!availableSamples.length">{{ t('admin.shippingOrderProfiles.blindTest.noIndependentSamples') }}</p>
|
||||
<div class="sample-picker"><button v-if="!availableSamplesLoaded" type="button" class="btn-secondary" :disabled="availableSamplesLoading" @click="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}`">{{ sample.filename }} · P{{ sample.page_no }}</option></select><button type="button" class="btn-primary" :disabled="!selectedSample || working" @click="previewSample">{{ t('admin.shippingOrderProfiles.blindTest.addCurrentSample') }}</button></template></div>
|
||||
<div class="sample-picker"><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.wizard.uploadNewSample') }}</span></label><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 type="button" class="btn-primary" :disabled="!selectedSample || working" @click="previewSample">{{ t('admin.shippingOrderProfiles.blindTest.addCurrentSample') }}</button></template></div>
|
||||
<p v-if="pendingUpload" class="upload-status" :class="{ failed: pendingUpload.state === 'failed' }">{{ pendingUpload.filename }} · {{ pendingUpload.state === 'parsing' ? t('admin.shippingOrderProfiles.wizard.sampleParsing') : t('admin.shippingOrderProfiles.wizard.sampleParseFailed') }}</p>
|
||||
</section>
|
||||
|
||||
<section v-if="candidate" class="card candidate-card">
|
||||
@@ -296,6 +395,7 @@ header { align-items: flex-start; margin-bottom: 24px; } h1, h2, h3, p { margin:
|
||||
.card { display: grid; gap: 14px; margin-top: 14px; border: 1px solid var(--border-default); border-radius: 12px; background: var(--bg-surface); padding: 18px; }
|
||||
.status { color: var(--status-warning-fg); font-weight: 700; } .status.approved { color: var(--status-success-fg); } .status.superseded { color: var(--status-error-fg); }
|
||||
.sample-picker .select-field { min-width: 260px; } .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; }
|
||||
|
||||
+205
-12
@@ -32,6 +32,7 @@ import {
|
||||
previewOrderProfileOrderFieldValues,
|
||||
releaseOrderDocumentProfileEditLease,
|
||||
renewOrderDocumentProfileEditLease,
|
||||
readOrderProfilePreviewPageRegionText,
|
||||
suggestOrderProfileHeader,
|
||||
suggestOrderProfileOrderFields,
|
||||
saveOrderDocumentProfileDraft,
|
||||
@@ -41,6 +42,7 @@ import type {
|
||||
CoordinateReconstructionPreview,
|
||||
OrderFieldValuePreview,
|
||||
OrderProfileCanvasRegion,
|
||||
OrderProfileDocumentMatchAnchor,
|
||||
OrderProfileFieldRegion,
|
||||
OrderProfileRelativeRegion,
|
||||
OrderProfileBoundSample,
|
||||
@@ -120,6 +122,9 @@ let resolveRouteLeave: ((allowed: boolean) => void) | null = null;
|
||||
const suggestingRegions = ref(false);
|
||||
const suggestionProgress = ref("");
|
||||
const creationKind = ref<OrderProfileCanvasRegion["kind"] | null>(null);
|
||||
const pendingDocumentAnchorLabel = ref<OrderProfileCanvasRegion | null>(null);
|
||||
const pendingOrderFieldAnchor = ref<OrderProfileCanvasRegion | null>(null);
|
||||
const documentAnchorNotice = ref('');
|
||||
const history = ref<OrderProfileCanvasRegion[][]>([]);
|
||||
const future = ref<OrderProfileCanvasRegion[][]>([]);
|
||||
const editLeaseToken = ref<string | null>(null);
|
||||
@@ -146,6 +151,14 @@ const form = reactive({
|
||||
changeNote: "",
|
||||
});
|
||||
const regions = ref<OrderProfileCanvasRegion[]>([]);
|
||||
/** 文档匹配锚点独立于字段坐标;必须以固定标签和固定值关系区分模板。 */
|
||||
const documentMatch = reactive({
|
||||
requiredAnchors: [] as OrderProfileDocumentMatchAnchor[],
|
||||
optionalAnchors: [] as OrderProfileDocumentMatchAnchor[],
|
||||
minimumScore: 0.9,
|
||||
minimumMargin: 0.15,
|
||||
});
|
||||
const documentMatchDirty = ref(false);
|
||||
const lineFields = computed<ShippingOrderFieldConfig[]>(
|
||||
() =>
|
||||
schemas.value
|
||||
@@ -180,7 +193,9 @@ const selectedRegion = computed(
|
||||
/** 当前样本值只能来自本次按画布坐标回读的结果,禁止回退到旧的自动建议缓存。 */
|
||||
const selectedRegionSampleValue = computed(() => {
|
||||
const region = selectedRegion.value;
|
||||
if (region?.kind !== 'order_field' || !region.fieldCode) return null;
|
||||
if (!region || !['order_field', 'header_field'].includes(region.kind)) return null;
|
||||
if (region.suggestedValue) return region.suggestedValue;
|
||||
if (!region.fieldCode) return null;
|
||||
return orderFieldValuePreviews.value.find((item) => item.field_code === region.fieldCode)?.value || null;
|
||||
});
|
||||
/** 右侧选区值与画布标签共享同一个读取状态,禁止以旧建议值回退。 */
|
||||
@@ -199,6 +214,7 @@ const selectedRegionKindLabel = computed(() => {
|
||||
const translationKeys: Record<NonNullable<OrderProfileCanvasRegion['kind']>, string> = {
|
||||
order_anchor: 'orderAnchor', order_field: 'orderField', header_field: 'header',
|
||||
header: 'header', line: 'line', field: 'field', exclusion: 'exclusion',
|
||||
document_anchor_label: 'documentMatchAnchorLabel', document_anchor_value: 'documentMatchAnchorValue',
|
||||
};
|
||||
const translationKey = translationKeys[kind];
|
||||
return t(`admin.shippingOrderProfiles.workbench.${translationKey}`);
|
||||
@@ -260,7 +276,7 @@ const selectedFieldHeaderSuggestion = computed(() => {
|
||||
)
|
||||
: null;
|
||||
});
|
||||
const dirty = computed(() => history.value.length > 0);
|
||||
const dirty = computed(() => history.value.length > 0 || documentMatchDirty.value);
|
||||
/** 当前标注样本可同时作为训练证据;盲测样本仍由独立工作台维护。 */
|
||||
const currentSampleIsTraining = computed(() => boundSamples.value.some(
|
||||
(item) => item.sample_role === 'training' && item.document_id === form.documentId && item.table_id === form.tableId,
|
||||
@@ -362,6 +378,7 @@ const redo = () => {
|
||||
const addRegion = (
|
||||
kind: OrderProfileCanvasRegion["kind"],
|
||||
drawnRegion?: OrderProfileRelativeRegion,
|
||||
selectedText?: string | null,
|
||||
) => {
|
||||
checkpoint();
|
||||
const effectiveKind = kind === "header" ? "header_field" : kind;
|
||||
@@ -432,7 +449,7 @@ const addRegion = (
|
||||
const item: OrderProfileCanvasRegion = {
|
||||
id: `${effectiveKind}_${pageNo.value}_${sequence}`,
|
||||
kind: effectiveKind,
|
||||
label: t(`admin.shippingOrderProfiles.workbench.regionLabels.${effectiveKind}`, {
|
||||
label: selectedText || t(`admin.shippingOrderProfiles.workbench.regionLabels.${effectiveKind}`, {
|
||||
count: sequence,
|
||||
}),
|
||||
region,
|
||||
@@ -444,6 +461,7 @@ const addRegion = (
|
||||
? `order_field_${pageNo.value}_${sequence}`
|
||||
: null,
|
||||
fieldCode: null,
|
||||
suggestedValue: selectedText || null,
|
||||
pageNo: pageNo.value,
|
||||
};
|
||||
if (effectiveKind === "order_field" && selectedOrderAnchor) {
|
||||
@@ -456,14 +474,124 @@ const addRegion = (
|
||||
};
|
||||
/** 进入画布绘制模式;下一次拖拽创建对应区域,避免先生成默认框再反复移动。 */
|
||||
const startDrawing = (kind: OrderProfileCanvasRegion["kind"]) => {
|
||||
if (kind === 'document_anchor_label') pendingDocumentAnchorLabel.value = null;
|
||||
if (kind === 'order_anchor') pendingOrderFieldAnchor.value = null;
|
||||
creationKind.value = creationKind.value === kind ? null : kind;
|
||||
};
|
||||
/** 应用画布拖出的区域并退出绘制模式;字段自动归属当前或首个物理行。 */
|
||||
const createDrawnRegion = (region: OrderProfileRelativeRegion) => {
|
||||
/** 读取画布框内的冻结文字;空框只保留在本地,绝不触发一个必填项不完整的自动保存。 */
|
||||
const readDocumentAnchorText = async (region: OrderProfileRelativeRegion): Promise<string | null> => {
|
||||
if (!active.value || !form.documentId) return null;
|
||||
try {
|
||||
const result = await readOrderProfilePreviewPageRegionText(active.value.id, form.documentId, pageNo.value, region);
|
||||
return result.text.trim() || null;
|
||||
} catch (error) {
|
||||
fail(error);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
/** 应用画布拖出的区域并退出绘制模式;匹配锚点从框内坐标文本建立,字段自动归属当前或首个物理行。 */
|
||||
const createDrawnRegion = async (region: OrderProfileRelativeRegion) => {
|
||||
const kind = creationKind.value;
|
||||
creationKind.value = null;
|
||||
if (kind === 'document_anchor_label') {
|
||||
const label = await readDocumentAnchorText(region);
|
||||
if (!label) {
|
||||
documentAnchorNotice.value = t('admin.shippingOrderProfiles.workbench.documentMatchAnchorTextMissing');
|
||||
creationKind.value = 'document_anchor_label';
|
||||
return;
|
||||
}
|
||||
// The first box is only a pending local gesture. Do not autosave a half-built
|
||||
// anchor because the v2 contract correctly requires both label and fixed value.
|
||||
history.value.push(snapshot());
|
||||
future.value = [];
|
||||
const id = `document_anchor_${pageNo.value}_${documentMatch.requiredAnchors.length + 1}`;
|
||||
const labelRegion: OrderProfileCanvasRegion = {
|
||||
id: `${id}_label`, kind, label, region, parentId: id, pageNo: pageNo.value,
|
||||
};
|
||||
regions.value.push(labelRegion);
|
||||
documentAnchorNotice.value = '';
|
||||
pendingDocumentAnchorLabel.value = labelRegion;
|
||||
selectedId.value = labelRegion.id;
|
||||
creationKind.value = 'document_anchor_value';
|
||||
return;
|
||||
}
|
||||
if (kind === 'document_anchor_value' && pendingDocumentAnchorLabel.value) {
|
||||
const value = await readDocumentAnchorText(region);
|
||||
if (!value) {
|
||||
documentAnchorNotice.value = t('admin.shippingOrderProfiles.workbench.documentMatchAnchorTextMissing');
|
||||
creationKind.value = 'document_anchor_value';
|
||||
return;
|
||||
}
|
||||
const labelRegion = pendingDocumentAnchorLabel.value;
|
||||
const anchorId = labelRegion.parentId!;
|
||||
const valueRegion: OrderProfileCanvasRegion = {
|
||||
id: `${anchorId}_value`, kind, label: value, region, parentId: anchorId, pageNo: pageNo.value,
|
||||
};
|
||||
regions.value.push(valueRegion);
|
||||
documentAnchorNotice.value = '';
|
||||
documentMatch.requiredAnchors.push({
|
||||
anchor_id: anchorId,
|
||||
label: labelRegion.label, value, value_position: region.y0 >= labelRegion.region.y1 ? 'below' : 'right',
|
||||
page_no: pageNo.value,
|
||||
label_region: labelRegion.region,
|
||||
value_region: valueRegion.region,
|
||||
minimum_evidence_level: 'coordinate',
|
||||
});
|
||||
pendingDocumentAnchorLabel.value = null;
|
||||
documentMatchDirty.value = true;
|
||||
selectedId.value = valueRegion.id;
|
||||
markLocalChange();
|
||||
schedulePreview();
|
||||
scheduleAutosave();
|
||||
return;
|
||||
}
|
||||
if (kind === 'order_anchor') {
|
||||
const label = await readDocumentAnchorText(region);
|
||||
if (!label) {
|
||||
documentAnchorNotice.value = t('admin.shippingOrderProfiles.workbench.documentMatchAnchorTextMissing');
|
||||
creationKind.value = 'order_anchor';
|
||||
return;
|
||||
}
|
||||
history.value.push(snapshot());
|
||||
future.value = [];
|
||||
const sequence = pageRegions.value.filter((item) => item.kind === 'order_anchor').length + 1;
|
||||
const orderFieldId = `order_field_${pageNo.value}_${sequence}`;
|
||||
const anchor: OrderProfileCanvasRegion = {
|
||||
id: `${orderFieldId}_anchor`, kind, label, region, orderFieldId, pageNo: pageNo.value,
|
||||
};
|
||||
regions.value.push(anchor);
|
||||
pendingOrderFieldAnchor.value = anchor;
|
||||
selectedId.value = anchor.id;
|
||||
documentAnchorNotice.value = t('admin.shippingOrderProfiles.workbench.orderFieldAnchorNext');
|
||||
creationKind.value = 'order_field';
|
||||
return;
|
||||
}
|
||||
if (kind === 'order_field' && pendingOrderFieldAnchor.value) {
|
||||
const value = await readDocumentAnchorText(region);
|
||||
if (!value) {
|
||||
documentAnchorNotice.value = t('admin.shippingOrderProfiles.workbench.documentMatchAnchorTextMissing');
|
||||
creationKind.value = 'order_field';
|
||||
return;
|
||||
}
|
||||
const anchor = pendingOrderFieldAnchor.value;
|
||||
const valueRegion: OrderProfileCanvasRegion = {
|
||||
id: anchor.orderFieldId!, kind, label: value, region, parentId: anchor.id,
|
||||
orderFieldId: anchor.orderFieldId, valueMode: 'single_line', suggestedValue: value, pageNo: pageNo.value,
|
||||
};
|
||||
regions.value.push(valueRegion);
|
||||
pendingOrderFieldAnchor.value = null;
|
||||
documentAnchorNotice.value = '';
|
||||
selectedId.value = valueRegion.id;
|
||||
markLocalChange();
|
||||
schedulePreview();
|
||||
scheduleAutosave();
|
||||
return;
|
||||
}
|
||||
if (kind) {
|
||||
addRegion(kind, region);
|
||||
const selectedText = kind === 'header_field'
|
||||
? await readDocumentAnchorText(region)
|
||||
: null;
|
||||
addRegion(kind, region, selectedText);
|
||||
schedulePreview();
|
||||
}
|
||||
};
|
||||
@@ -501,12 +629,20 @@ const removeSelected = () => {
|
||||
checkpoint();
|
||||
const removedId = selectedRegion.value.id;
|
||||
const removesSharedAnchor = selectedRegion.value.kind === "order_anchor";
|
||||
const documentAnchorId = ['document_anchor_label', 'document_anchor_value'].includes(selectedRegion.value.kind)
|
||||
? selectedRegion.value.parentId
|
||||
: null;
|
||||
// Removing a shared label removes dependent value boxes; removing one value box
|
||||
// preserves the label and any sibling customer/address field.
|
||||
regions.value = regions.value.filter(
|
||||
(item) => item.id !== removedId && item.parentId !== removedId &&
|
||||
(!removesSharedAnchor || item.parentId !== removedId),
|
||||
(!removesSharedAnchor || item.parentId !== removedId) && item.parentId !== documentAnchorId,
|
||||
);
|
||||
if (documentAnchorId) {
|
||||
documentMatch.requiredAnchors = documentMatch.requiredAnchors.filter((item) => item.anchor_id !== documentAnchorId);
|
||||
documentMatch.optionalAnchors = documentMatch.optionalAnchors.filter((item) => item.anchor_id !== documentAnchorId);
|
||||
documentMatchDirty.value = true;
|
||||
}
|
||||
selectedId.value = null;
|
||||
schedulePreview();
|
||||
};
|
||||
@@ -535,6 +671,15 @@ const updateRegion = (id: string, region: OrderProfileRelativeRegion) => {
|
||||
const normalized = normalizedCanvasRegion(region);
|
||||
if (!normalized) return;
|
||||
item.region = normalized;
|
||||
if (item.parentId && ['document_anchor_label', 'document_anchor_value'].includes(item.kind)) {
|
||||
const anchor = documentMatch.requiredAnchors.find((entry) => entry.anchor_id === item.parentId)
|
||||
|| documentMatch.optionalAnchors.find((entry) => entry.anchor_id === item.parentId);
|
||||
if (anchor) {
|
||||
if (item.kind === 'document_anchor_label') anchor.label_region = normalized;
|
||||
else anchor.value_region = normalized;
|
||||
documentMatchDirty.value = true;
|
||||
}
|
||||
}
|
||||
schedulePreview();
|
||||
scheduleOrderFieldSuggestionValues();
|
||||
};
|
||||
@@ -670,10 +815,10 @@ const definition = () => {
|
||||
document_match: {
|
||||
document_type: "purchase_order" as const,
|
||||
page_pattern: "one_or_more" as const,
|
||||
required_anchors: [],
|
||||
optional_anchors: [],
|
||||
minimum_score: 0.9,
|
||||
minimum_margin: 0.15,
|
||||
required_anchors: documentMatch.requiredAnchors.map((item) => ({ ...item })),
|
||||
optional_anchors: documentMatch.optionalAnchors.map((item) => ({ ...item })),
|
||||
minimum_score: documentMatch.minimumScore,
|
||||
minimum_margin: documentMatch.minimumMargin,
|
||||
},
|
||||
table_regions: tableRegions,
|
||||
order_field_layouts: regions.value
|
||||
@@ -807,6 +952,7 @@ const save = async (automatic = false) => {
|
||||
if (localChangeVersion === savingChangeVersion) {
|
||||
history.value = [];
|
||||
future.value = [];
|
||||
documentMatchDirty.value = false;
|
||||
}
|
||||
saveState.value = 'saved';
|
||||
autosaveFailures = 0;
|
||||
@@ -1248,6 +1394,16 @@ const mergeEquivalentOrderAnchors = (items: OrderProfileCanvasRegion[]) => {
|
||||
/** 从 v2 定义恢复区域,供草稿重开后继续在画布上编辑。 */
|
||||
const restoreRegions = (profile: ShippingOrderDocumentProfile) => {
|
||||
const restored: OrderProfileCanvasRegion[] = [
|
||||
...(profile.definition.document_match.required_anchors || []).flatMap<OrderProfileCanvasRegion>((anchor) => {
|
||||
if (!anchor.label_region || !anchor.value_region || !anchor.page_no) return [];
|
||||
return [{
|
||||
id: `${anchor.anchor_id}_label`, kind: 'document_anchor_label', label: anchor.label,
|
||||
region: anchor.label_region, parentId: anchor.anchor_id, pageNo: anchor.page_no,
|
||||
}, {
|
||||
id: `${anchor.anchor_id}_value`, kind: 'document_anchor_value', label: anchor.value,
|
||||
region: anchor.value_region, parentId: anchor.anchor_id, pageNo: anchor.page_no,
|
||||
}];
|
||||
}),
|
||||
...(profile.definition.draft_unbound_order_field_layouts || []).flatMap<OrderProfileCanvasRegion>((item) => {
|
||||
const pageNo = item.page_scope === "exact_page" ? item.page_no || 1 : 1;
|
||||
if (!item.anchor?.region || (!item.value_region && !item.absolute_value_region)) {
|
||||
@@ -1436,6 +1592,11 @@ const edit = async (profile: ShippingOrderDocumentProfile) => {
|
||||
form.displayName = profile.display_name;
|
||||
form.schemaId = profile.schema_version_id;
|
||||
form.changeNote = profile.change_note || "";
|
||||
documentMatch.requiredAnchors = (profile.definition.document_match.required_anchors || []).map((item) => ({ ...item }));
|
||||
documentMatch.optionalAnchors = (profile.definition.document_match.optional_anchors || []).map((item) => ({ ...item }));
|
||||
documentMatch.minimumScore = profile.definition.document_match.minimum_score;
|
||||
documentMatch.minimumMargin = profile.definition.document_match.minimum_margin;
|
||||
documentMatchDirty.value = false;
|
||||
regions.value = restoreRegions(profile);
|
||||
history.value = [];
|
||||
future.value = [];
|
||||
@@ -1604,7 +1765,13 @@ const handleShortcut = (event: KeyboardEvent) => {
|
||||
documentCanvas.value?.resetZoom();
|
||||
return;
|
||||
}
|
||||
if (event.key.toLowerCase() === "g") {
|
||||
event.preventDefault();
|
||||
void suggestRegions();
|
||||
return;
|
||||
}
|
||||
const kindByKey: Record<string, OrderProfileCanvasRegion["kind"]> = {
|
||||
m: "document_anchor_label",
|
||||
h: "header_field",
|
||||
l: "line",
|
||||
f: "field",
|
||||
@@ -1768,13 +1935,27 @@ onBeforeUnmount(() => {
|
||||
<header>
|
||||
<span>{{ t("admin.shippingOrderProfiles.workbench.currentConfiguration") }}</span>
|
||||
</header>
|
||||
<section class="document-match-editor">
|
||||
<div class="document-match-editor__heading">
|
||||
<div>
|
||||
<strong>{{ t('admin.shippingOrderProfiles.workbench.documentMatchAnchorTool') }}</strong>
|
||||
<p>{{ t('admin.shippingOrderProfiles.workbench.documentMatchAnchorHint') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
<p v-if="!documentMatch.requiredAnchors.length" class="document-match-editor__warning">{{ t('admin.shippingOrderProfiles.workbench.documentMatchAnchorEmpty') }}</p>
|
||||
<p v-if="documentAnchorNotice" class="document-match-editor__warning">{{ documentAnchorNotice }}</p>
|
||||
<article v-for="(anchor, index) in documentMatch.requiredAnchors" :key="`required-${index}`" class="document-match-editor__row">
|
||||
<b>{{ t('common.required') }}</b>
|
||||
<span>{{ anchor.label }}</span><span>{{ anchor.value }}</span>
|
||||
</article>
|
||||
</section>
|
||||
<section v-if="selectedRegion" class="editor">
|
||||
<div class="selected-region-meta">
|
||||
<span>{{ t('admin.shippingOrderProfiles.workbench.selectedRegion') }}</span>
|
||||
<strong>{{ selectedRegionKindLabel }}</strong>
|
||||
<small>{{ selectedRegionGeometry }}</small>
|
||||
</div>
|
||||
<section v-if="selectedRegion.kind === 'order_field'" class="sample-value-card">
|
||||
<section v-if="['order_field', 'header_field'].includes(selectedRegion.kind)" class="sample-value-card">
|
||||
<span>{{ t('admin.shippingOrderProfiles.workbench.currentSampleValue') }}</span>
|
||||
<strong :class="{ empty: !selectedRegionSampleValue }">
|
||||
{{ selectedRegionSampleDisplay }}
|
||||
@@ -2187,6 +2368,18 @@ onBeforeUnmount(() => {
|
||||
margin: 0 0.8rem;
|
||||
padding: 0.8rem 0;
|
||||
}
|
||||
.document-match-editor {
|
||||
border-bottom: 1px solid #cbd5e1;
|
||||
padding: 0.85rem;
|
||||
background: #f8fafc;
|
||||
}
|
||||
.document-match-editor__heading { display: flex; gap: 0.5rem; align-items: start; }
|
||||
.document-match-editor__heading strong { font-size: 0.84rem; }
|
||||
.document-match-editor__heading p { margin: 0.3rem 0 0; font-size: 0.72rem; color: #64748b; }
|
||||
.document-match-editor__warning { margin: 0.6rem 0; color: #b45309; font-size: 0.75rem; }
|
||||
.document-match-editor__row { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.4fr); gap: 0.35rem; align-items: center; margin-top: 0.45rem; }
|
||||
.document-match-editor__row b { font-size: 0.7rem; color: #0f766e; }
|
||||
.document-match-editor__row span { overflow: hidden; color: #475569; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.selected-region-meta { display: grid; gap: .2rem; margin-bottom: .8rem; border-bottom: 1px solid #dbe4ef; padding-bottom: .75rem; }
|
||||
.selected-region-meta span { color: #64748b; font-size: .7rem; font-weight: 700; }
|
||||
.selected-region-meta strong { color: #0f172a; font-size: .82rem; }
|
||||
|
||||
+36
-2
@@ -2,7 +2,7 @@
|
||||
features/admin/modules/shipping-order-document-profiles/OrderProfileLibraryPage.vue
|
||||
用途:按 profile_code 聚合展示订单文档模板族,是创建和继续编辑的唯一首页。
|
||||
依赖:Profile family API、Vue Router、Vue I18n。
|
||||
逻辑:列表只选择下一步路由;草稿进入编辑页,已发布版本创建新草稿,历史版本进入只读版本中心。
|
||||
逻辑:列表只选择下一步路由;草稿可继续编辑或删除,已发布版本创建新草稿,历史版本进入只读版本中心。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
@@ -10,7 +10,8 @@ import { useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { cloneOrderDocumentProfile, listOrderDocumentProfileFamilies } from '@/features/admin/api/shipping-order-document-profile.api';
|
||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||
import { cloneOrderDocumentProfile, deleteOrderDocumentProfile, listOrderDocumentProfileFamilies } from '@/features/admin/api/shipping-order-document-profile.api';
|
||||
import type { OrderProfileVersionFamilySummary } from '@/features/admin/types/shipping-order-document-profile.types';
|
||||
|
||||
const { t } = useI18n();
|
||||
@@ -19,6 +20,13 @@ const message = useMessage();
|
||||
const loading = ref(false);
|
||||
const query = ref('');
|
||||
const families = ref<OrderProfileVersionFamilySummary[]>([]);
|
||||
const deletingDraft = ref<OrderProfileVersionFamilySummary | null>(null);
|
||||
const deleteConfirmOpen = computed({
|
||||
get: () => deletingDraft.value !== null,
|
||||
set: (visible: boolean) => {
|
||||
if (!visible) deletingDraft.value = null;
|
||||
},
|
||||
});
|
||||
|
||||
const filteredFamilies = computed(() => {
|
||||
const keyword = query.value.trim().toLowerCase();
|
||||
@@ -55,6 +63,26 @@ async function createNewVersion(item: OrderProfileVersionFamilySummary): Promise
|
||||
}
|
||||
}
|
||||
|
||||
/** 打开系统内确认框,避免浏览器原生弹窗中断管理员的模板管理流程。 */
|
||||
function requestDeleteDraft(item: OrderProfileVersionFamilySummary): void {
|
||||
if (item.draft_profile_id) deletingDraft.value = item;
|
||||
}
|
||||
|
||||
/** 删除已确认的草稿;服务端仍拒绝删除已发布或退役的历史版本。 */
|
||||
async function confirmDeleteDraft(): Promise<void> {
|
||||
const item = deletingDraft.value;
|
||||
if (!item?.draft_profile_id) return;
|
||||
try {
|
||||
await deleteOrderDocumentProfile(item.draft_profile_id);
|
||||
message.success(t('admin.shippingOrderProfiles.deleted'));
|
||||
await loadFamilies();
|
||||
} catch (error) {
|
||||
message.error(error instanceof BusinessError ? error.message : t('admin.shippingOrderProfiles.library.loadFailed'));
|
||||
} finally {
|
||||
deletingDraft.value = null;
|
||||
}
|
||||
}
|
||||
|
||||
/** 进入不可变历史详情,不允许在此页面把版本伪装成新草稿。 */
|
||||
function viewVersion(item: OrderProfileVersionFamilySummary): void {
|
||||
router.push({ name: 'AdminShippingOrderDocumentProfileVersionDetail', params: { profileCode: item.profile_code, version: item.default_version } });
|
||||
@@ -103,6 +131,7 @@ onMounted(loadFamilies);
|
||||
</td>
|
||||
<td class="profile-library__actions">
|
||||
<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" class="btn-secondary btn-sm" type="button" @click="createNewVersion(item)">{{ t('admin.shippingOrderProfiles.newVersion') }}</button>
|
||||
<button class="btn-ghost btn-sm" type="button" @click="viewVersion(item)">{{ t('admin.shippingOrderProfiles.versionCenter.viewVersion') }}</button>
|
||||
</td>
|
||||
@@ -111,6 +140,11 @@ onMounted(loadFamilies);
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
<DeleteConfirmDialog
|
||||
v-model="deleteConfirmOpen"
|
||||
:message="t('admin.shippingOrderProfiles.deleteConfirm')"
|
||||
@confirm="confirmDeleteDraft"
|
||||
/>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
|
||||
+18
-21
@@ -7,7 +7,7 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ArrowLeft, ArrowRight, BoxSelect, Copy, Eraser, Minus, Plus, Redo2, RotateCcw, Save, ScanLine, Sparkles, TableProperties, Trash2 } from 'lucide-vue-next';
|
||||
import { Anchor, ArrowLeft, ArrowRight, Columns3, Copy, Eraser, Minus, Plus, Redo2, RotateCcw, Rows3, Save, TableProperties, Tag, TextCursorInput, Trash2, WandSparkles } from 'lucide-vue-next';
|
||||
import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
import type { OrderProfileCanvasRegion, OrderProfilePreviewPageGrant } from '@/features/admin/types/shipping-order-document-profile.types';
|
||||
|
||||
@@ -59,7 +59,6 @@ const loading = ref(false);
|
||||
const canvas = ref<HTMLElement | null>(null);
|
||||
const viewport = ref<HTMLElement | null>(null);
|
||||
const zoom = ref(1);
|
||||
const toolsOpen = ref(true);
|
||||
const zoomPercent = computed(() => Math.round(zoom.value * 100));
|
||||
const pageInput = ref(props.pageNo);
|
||||
type ResizeHandle = 'n' | 'ne' | 'e' | 'se' | 's' | 'sw' | 'w' | 'nw';
|
||||
@@ -238,18 +237,16 @@ onBeforeUnmount(() => { endMove(); endPan(); endCreation(); URL.revokeObjectURL(
|
||||
<div v-if="loading" class="canvas-state">{{ t('admin.shippingOrderProfiles.workbench.loadingPage') }}</div>
|
||||
<div v-else-if="!imageUrl" class="canvas-state">{{ t('admin.shippingOrderProfiles.workbench.selectBoundPdf') }}</div>
|
||||
<div v-else class="canvas-work-area" :class="{ readonly: readonlyMode }">
|
||||
<aside v-if="!readonlyMode" class="annotation-tools" :class="{ collapsed: !toolsOpen }">
|
||||
<button type="button" class="tools-toggle" :aria-expanded="toolsOpen" :aria-label="toolsOpen ? t('admin.shippingOrderProfiles.workbench.hideAnnotationTools') : t('admin.shippingOrderProfiles.workbench.showAnnotationTools')" @click="toolsOpen = !toolsOpen"><BoxSelect /><span v-if="toolsOpen">{{ t('admin.shippingOrderProfiles.workbench.annotationTools') }}</span></button>
|
||||
<template v-if="toolsOpen">
|
||||
<button type="button" :title="t('admin.shippingOrderProfiles.workbench.drawOrderAnchor')" :class="{ active: creationKind === 'order_anchor' }" @click="emit('draw', 'order_anchor')"><BoxSelect /><span>{{ t('admin.shippingOrderProfiles.workbench.orderAnchorTool') }}</span></button>
|
||||
<button type="button" :title="t('admin.shippingOrderProfiles.workbench.drawOrderField')" :class="{ active: creationKind === 'order_field' }" @click="emit('draw', 'order_field')"><BoxSelect /><span>{{ t('admin.shippingOrderProfiles.workbench.orderField') }}</span></button>
|
||||
<button type="button" :title="t('admin.shippingOrderProfiles.workbench.drawHeader')" :class="{ active: creationKind === 'header_field' }" @click="emit('draw', 'header_field')"><TableProperties /><span>{{ t('admin.shippingOrderProfiles.workbench.headerTool') }}</span></button>
|
||||
<button type="button" :title="t('admin.shippingOrderProfiles.workbench.drawLine')" :class="{ active: creationKind === 'line' }" @click="emit('draw', 'line')"><ScanLine /><span>{{ t('admin.shippingOrderProfiles.workbench.lineTool') }}</span></button>
|
||||
<button type="button" :title="t('admin.shippingOrderProfiles.workbench.drawField')" :class="{ active: creationKind === 'field' }" @click="emit('draw', 'field')"><BoxSelect /><span>{{ t('admin.shippingOrderProfiles.workbench.fieldTool') }}</span></button>
|
||||
<button type="button" :title="t('admin.shippingOrderProfiles.workbench.drawExclusion')" :class="{ active: creationKind === 'exclusion' }" @click="emit('draw', 'exclusion')"><Eraser /><span>{{ t('admin.shippingOrderProfiles.workbench.exclusionTool') }}</span></button>
|
||||
<button type="button" class="suggest" :disabled="autoSuggestDisabled || suggesting" @click="emit('suggest')"><Sparkles /><span>{{ suggesting ? t('admin.shippingOrderProfiles.workbench.autoSuggestRunning') : t('admin.shippingOrderProfiles.workbench.autoSuggest') }}</span></button>
|
||||
<p v-if="suggestionProgress" class="suggestion-progress" :class="{ failed: !suggesting }">{{ suggestionProgress }}</p>
|
||||
</template>
|
||||
<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" class="suggest" :aria-label="t('admin.shippingOrderProfiles.workbench.autoSuggestShortcut')" :title="t('admin.shippingOrderProfiles.workbench.autoSuggestShortcut')" :disabled="autoSuggestDisabled || suggesting" @click="emit('suggest')"><WandSparkles /></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">
|
||||
<div ref="canvas" class="canvas-stage" :class="{ drawing: creationKind && !readonlyMode }" :style="{ '--canvas-zoom': zoom }" @pointerdown="beginCreation">
|
||||
@@ -312,13 +309,10 @@ onBeforeUnmount(() => { endMove(); endPan(); endCreation(); URL.revokeObjectURL(
|
||||
.canvas-stage img { display: block; width: 100%; user-select: none; }
|
||||
.canvas-stage.drawing { cursor: crosshair; }
|
||||
.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 7rem; padding: .35rem; 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.collapsed { flex-basis: 2.45rem; padding: .3rem; }
|
||||
.annotation-tools button { display: flex; min-height: 2rem; align-items: center; gap: .4rem; border: 1px solid transparent; border-radius: .35rem; background: #1e293b; padding: .35rem .45rem; color: #e2e8f0; font-size: .7rem; text-align: left; white-space: nowrap; }
|
||||
.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 .tools-toggle { justify-content: center; }
|
||||
.annotation-tools.collapsed .tools-toggle { padding-inline: 0; }
|
||||
.annotation-tools .suggest { border-color: #0ea5e9; background: #0284c7; font-weight: 700; }
|
||||
.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; }
|
||||
@@ -340,6 +334,10 @@ onBeforeUnmount(() => { endMove(); endPan(); endCreation(); URL.revokeObjectURL(
|
||||
.region-order_field .region-label, .region-order_field .resize-handle { background: #15803d; }
|
||||
.region-order_anchor { z-index: 2; border: 1.5px solid #a855f7; background: rgb(168 85 247 / .08); }
|
||||
.region-order_anchor .region-label, .region-order_anchor .resize-handle { background: #7e22ce; }
|
||||
.region-document_anchor_label { z-index: 2; border: 1.5px solid #0ea5e9; background: rgb(14 165 233 / .1); }
|
||||
.region-document_anchor_label .region-label, .region-document_anchor_label .resize-handle { background: #0369a1; }
|
||||
.region-document_anchor_value { z-index: 2; border: 1.5px solid #f97316; background: rgb(249 115 22 / .1); }
|
||||
.region-document_anchor_value .region-label, .region-document_anchor_value .resize-handle { background: #c2410c; }
|
||||
.region-line { z-index: 0; border-color: #a78bfa; background: rgb(167 139 250 / .1); pointer-events: none; }
|
||||
.region-line .region-label, .region-line .line-hit-edge, .region-line.selected .resize-handle { pointer-events: auto; }
|
||||
.region-line .region-label, .region-line .resize-handle { background: #6d28d9; }
|
||||
@@ -370,5 +368,4 @@ onBeforeUnmount(() => { endMove(); endPan(); endCreation(); URL.revokeObjectURL(
|
||||
.annotation-tools { flex-basis: 2.45rem; }
|
||||
.annotation-tools button span, .suggestion-progress { display: none; }
|
||||
}
|
||||
.tools-toggle span { display: none; }
|
||||
</style>
|
||||
+260
-20
@@ -1,30 +1,40 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-order-extraction-runs/ShippingOrderExtractionRunsPage.vue
|
||||
用途:为所有管理员提供订单识别异步 Run 的只读诊断视图。
|
||||
依赖:admin.api 的脱敏诊断 DTO、Vue Composition API、Vue I18n。
|
||||
逻辑:列表按状态筛选并按需加载单条详情;页面不提供重试、取消或任何业务数据修改入口。
|
||||
用途:管理员订单识别运行诊断——健康聚合、积压/取消中筛选、只读详情与活跃 Run 取消。
|
||||
依赖:admin.api 脱敏诊断/健康/取消 DTO、Vue Composition API、Vue I18n。
|
||||
逻辑:健康面板 + 列表筛选;详情仍只读;取消走 admin cancel API 且强制填写原因。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import {
|
||||
cancelShippingOrderExtractionRun,
|
||||
getShippingOrderExtractionDiagnosticRun,
|
||||
getShippingOrderExtractionHealth,
|
||||
listShippingOrderExtractionDiagnosticRuns,
|
||||
type ShippingOrderExtractionDiagnosticDetail,
|
||||
type ShippingOrderExtractionDiagnosticRun,
|
||||
type ShippingOrderExtractionHealth,
|
||||
} from '@/features/admin/api/admin.api';
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const loading = ref(false);
|
||||
const healthLoading = ref(false);
|
||||
const detailLoading = ref(false);
|
||||
const cancellingRunNo = ref('');
|
||||
const pendingCancelRunNo = ref('');
|
||||
const cancelReason = ref('');
|
||||
const page = ref(1);
|
||||
const pageSize = 25;
|
||||
const total = ref(0);
|
||||
const status = ref('');
|
||||
const staleOnly = ref(false);
|
||||
const cancellationInFlight = ref(false);
|
||||
const rows = ref<ShippingOrderExtractionDiagnosticRun[]>([]);
|
||||
const health = ref<ShippingOrderExtractionHealth | null>(null);
|
||||
const detail = ref<ShippingOrderExtractionDiagnosticDetail | null>(null);
|
||||
const error = ref('');
|
||||
|
||||
@@ -33,12 +43,72 @@ const formatDuration = (value?: number | null) => value == null ? '-' : `${(valu
|
||||
const translateAutoFreezeReason = (code: string) =>
|
||||
t(`admin.shippingOrderExtractionRuns.autoFreezeReasonCodes.${code}`, code);
|
||||
|
||||
/**
|
||||
* 判断管理员是否可对 Run 发起取消(活跃且未完成取消)。
|
||||
*/
|
||||
const canCancelRun = (row: ShippingOrderExtractionDiagnosticRun) => (
|
||||
['queued', 'processing'].includes(row.status)
|
||||
&& !row.cancellation?.completed
|
||||
&& !row.cancellation?.in_flight
|
||||
);
|
||||
|
||||
/** 展开/收起列表行取消表单。 */
|
||||
const beginCancelRun = (runNo: string) => {
|
||||
if (pendingCancelRunNo.value === runNo) {
|
||||
pendingCancelRunNo.value = '';
|
||||
cancelReason.value = '';
|
||||
return;
|
||||
}
|
||||
pendingCancelRunNo.value = runNo;
|
||||
cancelReason.value = '';
|
||||
};
|
||||
|
||||
/**
|
||||
* 管理员取消 Run;后端强制要求 reason。
|
||||
*/
|
||||
const submitCancelRun = async (runNo: string) => {
|
||||
const reason = String(cancelReason.value || '').trim();
|
||||
if (!reason || cancellingRunNo.value) return;
|
||||
cancellingRunNo.value = runNo;
|
||||
error.value = '';
|
||||
try {
|
||||
await cancelShippingOrderExtractionRun(runNo, { reason, reason_code: 'admin_cancelled' });
|
||||
pendingCancelRunNo.value = '';
|
||||
cancelReason.value = '';
|
||||
await refreshAll();
|
||||
} catch {
|
||||
error.value = t('admin.shippingOrderExtractionRuns.cancelFailed');
|
||||
} finally {
|
||||
cancellingRunNo.value = '';
|
||||
}
|
||||
};
|
||||
|
||||
/** 加载健康聚合;失败不阻断列表。 */
|
||||
const loadHealth = async () => {
|
||||
healthLoading.value = true;
|
||||
try {
|
||||
health.value = await getShippingOrderExtractionHealth(24);
|
||||
} catch {
|
||||
health.value = null;
|
||||
} finally {
|
||||
healthLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/** 加载安全摘要;服务端已完成管理员鉴权、审计及敏感字段剔除。 */
|
||||
const load = async () => {
|
||||
loading.value = true;
|
||||
error.value = '';
|
||||
try {
|
||||
const response = await listShippingOrderExtractionDiagnosticRuns(page.value, pageSize, status.value);
|
||||
const response = await listShippingOrderExtractionDiagnosticRuns(
|
||||
page.value,
|
||||
pageSize,
|
||||
status.value,
|
||||
{
|
||||
staleOnly: staleOnly.value,
|
||||
cancellationInFlight: cancellationInFlight.value,
|
||||
},
|
||||
);
|
||||
rows.value = response.items;
|
||||
total.value = response.total;
|
||||
} catch {
|
||||
@@ -48,6 +118,10 @@ const load = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const refreshAll = async () => {
|
||||
await Promise.all([loadHealth(), load()]);
|
||||
};
|
||||
|
||||
/** 按需打开一条 Run 的脱敏执行尝试和节点生命周期,不预取详情以减少诊断审计噪声。 */
|
||||
const openDetail = async (runNo: string) => {
|
||||
detailLoading.value = true;
|
||||
@@ -73,13 +147,13 @@ const closeDetail = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const applyStatus = async () => {
|
||||
const applyFilters = async () => {
|
||||
page.value = 1;
|
||||
await load();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
void load();
|
||||
void refreshAll();
|
||||
const runNo = String(route.query.runNo || '').trim();
|
||||
if (runNo) void openDetail(runNo);
|
||||
});
|
||||
@@ -104,43 +178,173 @@ watch(
|
||||
<h1 class="section-title">{{ t('admin.shippingOrderExtractionRuns.title') }}</h1>
|
||||
<p class="section-desc mt-1 max-w-3xl">{{ t('admin.shippingOrderExtractionRuns.subtitle') }}</p>
|
||||
</div>
|
||||
<button type="button" class="btn-secondary btn-sm" :disabled="loading" @click="load">
|
||||
<button type="button" class="btn-secondary btn-sm" :disabled="loading || healthLoading" @click="refreshAll">
|
||||
{{ t('admin.shippingOrderExtractionRuns.refresh') }}
|
||||
</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>
|
||||
<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'">
|
||||
{{ 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>
|
||||
<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>
|
||||
<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>
|
||||
<div class="md:col-span-4 text-xs text-secondary">
|
||||
{{ 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">
|
||||
{{ 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>
|
||||
</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="applyStatus">
|
||||
<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>
|
||||
</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-[940px] w-full text-left text-sm">
|
||||
<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.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"></th>
|
||||
<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="7" class="px-4 py-8 text-center text-muted">{{ t('admin.shippingOrderExtractionRuns.loading') }}</td></tr>
|
||||
<tr v-else-if="!rows.length"><td colspan="7" 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">{{ 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) }}</td><td class="px-4 py-3"><button type="button" class="text-brand-600 hover:underline" @click="openDetail(row.run_no)">{{ t('admin.shippingOrderExtractionRuns.viewDetail') }}</button></td></tr>
|
||||
<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"
|
||||
>
|
||||
<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)"
|
||||
>
|
||||
{{ t('admin.shippingOrderExtractionRuns.cancelRun') }}
|
||||
</button>
|
||||
</template>
|
||||
</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 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.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>
|
||||
<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">
|
||||
@@ -173,11 +377,47 @@ watch(
|
||||
<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="route in unit.route_decisions" :key="`${unit.unit_id}:${route.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') }} #{{ route.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.${route.execution_mode}`) }}</dd><dt>{{ t('admin.shippingOrderExtractionRuns.matchStatus') }}</dt><dd>{{ t(`admin.shippingOrderExtractionRuns.matchStatuses.${route.match_status}`) }}</dd><dt>{{ t('admin.shippingOrderExtractionRuns.selectedProfile') }}</dt><dd>{{ route.selected_profile_code ? `${route.selected_profile_code} V${route.selected_profile_version}` : '-' }}</dd><dt>{{ t('admin.shippingOrderExtractionRuns.autoCreateApproved') }}</dt><dd>{{ route.auto_create_approved == null ? '-' : t(route.auto_create_approved ? 'admin.shippingOrderExtractionRuns.yes' : 'admin.shippingOrderExtractionRuns.no') }}</dd><dt>{{ t('admin.shippingOrderExtractionRuns.fallbackReasons') }}</dt><dd>{{ route.fallback_reason_codes.length ? route.fallback_reason_codes.map(code => t(`admin.shippingOrderExtractionRuns.reasonCodes.${code}`)).join(';') : '-' }}</dd></dl><div v-if="route.candidates.length" class="mt-3"><p class="font-medium">{{ t('admin.shippingOrderExtractionRuns.candidates') }}</p><div v-for="candidate in route.candidates" :key="`${candidate.profile_code}:${candidate.version}`" class="mt-1 flex flex-wrap gap-x-2 text-muted"><span>{{ candidate.profile_code }} V{{ candidate.version }}</span><span>{{ candidate.score.toFixed(2) }}</span><span>{{ candidate.hard_match ? t('admin.shippingOrderExtractionRuns.hardMatch') : t('admin.shippingOrderExtractionRuns.hardMismatch') }}</span><span v-if="candidate.missing_required_anchor_ids?.length">{{ t('admin.shippingOrderExtractionRuns.missingAnchors', { ids: candidate.missing_required_anchor_ids.join(', ') }) }}</span></div></div></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></div>
|
||||
<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>
|
||||
</div>
|
||||
</template>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
+339
@@ -0,0 +1,339 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-review-supervision/ShippingReviewSupervisionPage.vue
|
||||
用途:管理员跨用户会话 PDF 工作项监管台——筛选、终止、撤销确认。
|
||||
依赖:shipping-review-supervision.api、Vue I18n、useMessage。
|
||||
逻辑:终止/撤销须填写理由与 confirm_token;成功后刷新列表。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import type { ShippingSessionWorkItem } from '@/features/chat/types/shipping.api.types';
|
||||
import {
|
||||
SUPERVISION_CONFIRM_REVOKE,
|
||||
SUPERVISION_CONFIRM_TERMINATE,
|
||||
listShippingReviewSupervisionItems,
|
||||
revokeShippingReviewSupervisionConfirmation,
|
||||
terminateShippingReviewSupervisionItem,
|
||||
type ShippingReviewSupervisionFilters,
|
||||
} from '@/features/admin/api/shipping-review-supervision.api';
|
||||
|
||||
type SupervisionAction = 'terminate' | 'revoke';
|
||||
|
||||
const { t, te } = useI18n();
|
||||
const msg = useMessage();
|
||||
const loading = ref(false);
|
||||
const submitting = ref(false);
|
||||
const error = ref('');
|
||||
const page = ref(1);
|
||||
const pageSize = 20;
|
||||
const total = ref(0);
|
||||
const rows = ref<ShippingSessionWorkItem[]>([]);
|
||||
const filters = ref<ShippingReviewSupervisionFilters>({
|
||||
lifecycle_status: '',
|
||||
owner_user_id: '',
|
||||
conversation_id: '',
|
||||
q: '',
|
||||
});
|
||||
const actionDialogOpen = ref(false);
|
||||
const actionKind = ref<SupervisionAction>('terminate');
|
||||
const actionTarget = ref<ShippingSessionWorkItem | null>(null);
|
||||
const actionReason = ref('');
|
||||
const actionConfirmChecked = ref(false);
|
||||
const reasonMissing = ref(false);
|
||||
const confirmMissing = ref(false);
|
||||
|
||||
const formatTime = (value?: string | null) => (value ? new Date(value).toLocaleString() : '—');
|
||||
|
||||
/**
|
||||
* 解析生命周期状态文案。
|
||||
*/
|
||||
function lifecycleLabel(status: string): string {
|
||||
const key = `chat.shippingSessionWorkItem.status.${status}`;
|
||||
return te(key) ? t(key) : status;
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载监管列表。
|
||||
*/
|
||||
async function load() {
|
||||
loading.value = true;
|
||||
error.value = '';
|
||||
try {
|
||||
const response = await listShippingReviewSupervisionItems(page.value, pageSize, filters.value);
|
||||
rows.value = response.items;
|
||||
total.value = response.total;
|
||||
} catch {
|
||||
error.value = t('admin.shippingReviewSupervision.loadFailed');
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function applyFilters() {
|
||||
page.value = 1;
|
||||
await load();
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开终止或撤销确认弹窗。
|
||||
*/
|
||||
function openAction(kind: SupervisionAction, item: ShippingSessionWorkItem) {
|
||||
actionKind.value = kind;
|
||||
actionTarget.value = item;
|
||||
actionReason.value = '';
|
||||
actionConfirmChecked.value = false;
|
||||
reasonMissing.value = false;
|
||||
confirmMissing.value = false;
|
||||
actionDialogOpen.value = true;
|
||||
}
|
||||
|
||||
function closeActionDialog() {
|
||||
actionDialogOpen.value = false;
|
||||
actionTarget.value = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交监管写操作;校验理由与 confirm_token。
|
||||
*/
|
||||
async function submitAction() {
|
||||
const item = actionTarget.value;
|
||||
if (!item?.item_no) return;
|
||||
const reason = actionReason.value.trim();
|
||||
if (!reason) {
|
||||
reasonMissing.value = true;
|
||||
return;
|
||||
}
|
||||
if (!actionConfirmChecked.value) {
|
||||
confirmMissing.value = true;
|
||||
return;
|
||||
}
|
||||
submitting.value = true;
|
||||
error.value = '';
|
||||
try {
|
||||
if (actionKind.value === 'terminate') {
|
||||
await terminateShippingReviewSupervisionItem(item.item_no, {
|
||||
reason,
|
||||
confirm_token: SUPERVISION_CONFIRM_TERMINATE,
|
||||
});
|
||||
msg.success(t('admin.shippingReviewSupervision.terminateSuccess'));
|
||||
} else {
|
||||
await revokeShippingReviewSupervisionConfirmation(item.item_no, {
|
||||
reason,
|
||||
confirm_token: SUPERVISION_CONFIRM_REVOKE,
|
||||
});
|
||||
msg.success(t('admin.shippingReviewSupervision.revokeSuccess'));
|
||||
}
|
||||
closeActionDialog();
|
||||
await load();
|
||||
} catch (err) {
|
||||
const message = err instanceof BusinessError ? err.message : t('admin.shippingReviewSupervision.actionFailed');
|
||||
msg.error(message);
|
||||
} finally {
|
||||
submitting.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
const canTerminate = (item: ShippingSessionWorkItem) =>
|
||||
item.lifecycle_status !== 'closed' && (item.available_actions || []).includes('admin_terminate');
|
||||
|
||||
const canRevoke = (item: ShippingSessionWorkItem) =>
|
||||
item.lifecycle_status === 'closed'
|
||||
&& item.closed_reason === 'confirmed'
|
||||
&& (item.available_actions || []).includes('admin_revoke_confirmation');
|
||||
|
||||
onMounted(() => {
|
||||
void load();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="space-y-5 p-5 md:p-7" data-testid="shipping-review-supervision-page">
|
||||
<header class="flex flex-wrap items-start justify-between gap-4">
|
||||
<div>
|
||||
<h1 class="section-title">{{ t('admin.shippingReviewSupervision.title') }}</h1>
|
||||
<p class="section-desc mt-1 max-w-3xl">{{ t('admin.shippingReviewSupervision.subtitle') }}</p>
|
||||
</div>
|
||||
<button type="button" class="btn-secondary btn-sm" :disabled="loading" @click="load">
|
||||
{{ t('admin.shippingReviewSupervision.refresh') }}
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<div class="grid gap-3 rounded-xl border border-default bg-surface p-3 md:grid-cols-2 lg:grid-cols-4">
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<span>{{ t('admin.shippingReviewSupervision.filters.lifecycleStatus') }}</span>
|
||||
<select v-model="filters.lifecycle_status" class="input-field text-sm">
|
||||
<option value="">{{ t('admin.shippingReviewSupervision.filters.all') }}</option>
|
||||
<option value="pending_review">{{ lifecycleLabel('pending_review') }}</option>
|
||||
<option value="extracting">{{ lifecycleLabel('extracting') }}</option>
|
||||
<option value="reparse_failed">{{ lifecycleLabel('reparse_failed') }}</option>
|
||||
<option value="closed">{{ lifecycleLabel('closed') }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<span>{{ t('admin.shippingReviewSupervision.filters.ownerUserId') }}</span>
|
||||
<input v-model="filters.owner_user_id" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<span>{{ t('admin.shippingReviewSupervision.filters.conversationId') }}</span>
|
||||
<input v-model="filters.conversation_id" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<span>{{ t('admin.shippingReviewSupervision.filters.q') }}</span>
|
||||
<input v-model="filters.q" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="flex gap-2">
|
||||
<button type="button" class="btn-primary btn-sm" :disabled="loading" @click="applyFilters">
|
||||
{{ t('admin.shippingReviewSupervision.apply') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<p v-if="error" class="text-sm text-rose-600 dark:text-rose-400">{{ error }}</p>
|
||||
|
||||
<div class="overflow-x-auto rounded-xl border border-default bg-surface">
|
||||
<table class="min-w-full text-left text-sm">
|
||||
<thead class="border-b border-default bg-muted/40 text-xs text-secondary">
|
||||
<tr>
|
||||
<th class="px-3 py-2 font-medium">{{ t('admin.shippingReviewSupervision.columns.itemNo') }}</th>
|
||||
<th class="px-3 py-2 font-medium">{{ t('admin.shippingReviewSupervision.columns.owner') }}</th>
|
||||
<th class="px-3 py-2 font-medium">{{ t('admin.shippingReviewSupervision.columns.conversation') }}</th>
|
||||
<th class="px-3 py-2 font-medium">{{ t('admin.shippingReviewSupervision.columns.document') }}</th>
|
||||
<th class="px-3 py-2 font-medium">{{ t('admin.shippingReviewSupervision.columns.status') }}</th>
|
||||
<th class="px-3 py-2 font-medium">{{ t('admin.shippingReviewSupervision.columns.updated') }}</th>
|
||||
<th class="px-3 py-2 font-medium">{{ t('admin.shippingReviewSupervision.columns.actions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-if="loading">
|
||||
<td colspan="7" class="px-3 py-6 text-center text-secondary">{{ t('admin.shippingReviewSupervision.loading') }}</td>
|
||||
</tr>
|
||||
<tr v-else-if="!rows.length">
|
||||
<td colspan="7" class="px-3 py-6 text-center text-secondary">{{ t('admin.shippingReviewSupervision.empty') }}</td>
|
||||
</tr>
|
||||
<tr v-for="item in rows" :key="item.item_no" class="border-b border-default last:border-0">
|
||||
<td class="px-3 py-2 font-mono text-xs">{{ item.item_no }}</td>
|
||||
<td class="px-3 py-2">{{ item.owner_user_id }}</td>
|
||||
<td class="max-w-40 truncate px-3 py-2 font-mono text-xs" :title="item.conversation_id">{{ item.conversation_id }}</td>
|
||||
<td class="max-w-48 truncate px-3 py-2" :title="item.current_document_filename || ''">
|
||||
{{ item.current_document_filename || '—' }}
|
||||
</td>
|
||||
<td class="px-3 py-2">
|
||||
<span class="rounded-full bg-muted px-2 py-0.5 text-xs">{{ lifecycleLabel(String(item.lifecycle_status)) }}</span>
|
||||
</td>
|
||||
<td class="px-3 py-2 text-xs text-secondary">{{ formatTime(item.updated_at) }}</td>
|
||||
<td class="px-3 py-2">
|
||||
<div class="flex flex-wrap gap-1">
|
||||
<button
|
||||
v-if="canTerminate(item)"
|
||||
type="button"
|
||||
class="btn-danger btn-xs"
|
||||
data-testid="supervision-terminate-btn"
|
||||
@click="openAction('terminate', item)"
|
||||
>
|
||||
{{ t('admin.shippingReviewSupervision.terminate') }}
|
||||
</button>
|
||||
<button
|
||||
v-if="canRevoke(item)"
|
||||
type="button"
|
||||
class="btn-secondary btn-xs"
|
||||
data-testid="supervision-revoke-btn"
|
||||
@click="openAction('revoke', item)"
|
||||
>
|
||||
{{ t('admin.shippingReviewSupervision.revoke') }}
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<footer class="flex items-center justify-between text-sm text-secondary">
|
||||
<span>{{ t('admin.shippingReviewSupervision.total', { count: total }) }}</span>
|
||||
<div class="flex gap-2">
|
||||
<button type="button" class="btn-secondary btn-sm" :disabled="loading || page <= 1" @click="page -= 1; load()">
|
||||
{{ t('admin.shippingReviewSupervision.previous') }}
|
||||
</button>
|
||||
<button type="button" class="btn-secondary btn-sm" :disabled="loading || page * pageSize >= total" @click="page += 1; load()">
|
||||
{{ t('admin.shippingReviewSupervision.next') }}
|
||||
</button>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<Teleport to="body">
|
||||
<div
|
||||
v-if="actionDialogOpen && actionTarget"
|
||||
class="dialog-overlay z-50 flex items-center justify-center p-4"
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
data-testid="supervision-action-dialog"
|
||||
@click.self="closeActionDialog"
|
||||
>
|
||||
<div class="dialog-panel w-full max-w-md space-y-4 p-5">
|
||||
<header>
|
||||
<h2 class="text-base font-semibold text-primary">
|
||||
{{ actionKind === 'terminate'
|
||||
? t('admin.shippingReviewSupervision.terminateTitle')
|
||||
: t('admin.shippingReviewSupervision.revokeTitle') }}
|
||||
</h2>
|
||||
<p class="mt-2 text-sm text-secondary">
|
||||
{{ actionKind === 'terminate'
|
||||
? t('admin.shippingReviewSupervision.terminateImpact', { itemNo: actionTarget.item_no })
|
||||
: t('admin.shippingReviewSupervision.revokeImpact', { itemNo: actionTarget.item_no }) }}
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<label class="block space-y-1 text-sm">
|
||||
<span class="text-secondary">{{ t('admin.shippingReviewSupervision.reasonLabel') }}</span>
|
||||
<textarea
|
||||
v-model="actionReason"
|
||||
rows="3"
|
||||
class="input-field w-full resize-y text-sm"
|
||||
data-testid="supervision-reason-input"
|
||||
@input="reasonMissing = false"
|
||||
/>
|
||||
<p v-if="reasonMissing" class="text-xs text-rose-600 dark:text-rose-400">
|
||||
{{ t('admin.shippingReviewSupervision.reasonRequired') }}
|
||||
</p>
|
||||
</label>
|
||||
|
||||
<label class="flex items-start gap-2 text-sm">
|
||||
<input
|
||||
v-model="actionConfirmChecked"
|
||||
type="checkbox"
|
||||
class="mt-0.5"
|
||||
data-testid="supervision-confirm-checkbox"
|
||||
@change="confirmMissing = false"
|
||||
>
|
||||
<span class="text-secondary">
|
||||
{{ actionKind === 'terminate'
|
||||
? t('admin.shippingReviewSupervision.confirmTerminate')
|
||||
: t('admin.shippingReviewSupervision.confirmRevoke') }}
|
||||
</span>
|
||||
</label>
|
||||
<p v-if="confirmMissing" class="text-xs text-rose-600 dark:text-rose-400">
|
||||
{{ t('admin.shippingReviewSupervision.confirmRequired') }}
|
||||
</p>
|
||||
|
||||
<footer class="flex justify-end gap-2">
|
||||
<button type="button" class="btn-secondary btn-sm" :disabled="submitting" @click="closeActionDialog">
|
||||
{{ t('common.deleteDialog.cancel') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
:class="actionKind === 'terminate' ? 'btn-danger btn-sm' : 'btn-primary btn-sm'"
|
||||
:disabled="submitting"
|
||||
data-testid="supervision-action-submit"
|
||||
@click="submitAction"
|
||||
>
|
||||
{{ submitting ? t('admin.shippingReviewSupervision.submitting') : t('admin.shippingReviewSupervision.submit') }}
|
||||
</button>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
</section>
|
||||
</template>
|
||||
Reference in new issue
Block a user