refactor(admin): 管理端组件库迁移 Element Plus
- App/ChatView 接入 ElConfigProvider 多语言(zh-CN/zh-TW/en),AdminLayout 间距壳层统一持有 - OrderProfile 全家 22 文件迁移:页头/按钮/徽标/自绘弹窗/表单控件统一 element-trial 范式 - schema/审计中心/字段资产/身份规则/库存源/连接器/调拨类型页面同步迁移,新增 __tests__ 回归 - 迁移遵循「业务脚本零改动」:事件内联适配保持原 handler 契约,焦点陷阱与关闭语义不变 - i18n admin/common 四语言补充组件文案,架构文档记录迁移范式
This commit is contained in:
1 parent
8102a1fe44
commit
bf3154033b
66 files changed
+10766
-5934
No files matched your search
@@ -1,14 +1,34 @@
|
||||
<!--
|
||||
features/admin/modules/shipping-audit/ShippingAuditCenterPage.vue
|
||||
用途:管理员货代统一审计中心——按 Conversation/Run/Candidate/Task/Gate/节点分组筛选、详情 Diff、关联链、哈希校验、受控导出。
|
||||
依赖:shipping-audit.api、shippingAuditDisplay、ShippingAuditEventDetailDrawer、Vue I18n、BusinessError、useMessage。
|
||||
依赖:element-plus(工具栏/筛选面板/提示横幅/时间线/分页,沿用管理端 element-trial 主题)、
|
||||
@element-plus/icons-vue、shipping-audit.api、shippingAuditDisplay、
|
||||
ShippingAuditEventDetailDrawer(el-drawer 版)、BusinessError、useMessage、Vue I18n。
|
||||
逻辑:列表不含快照全文;详情抽屉按权限脱敏;导出/校验写服务端访问审计;
|
||||
事件分组含复核/对话/Process Gate/资格/节点;支持 candidate_no / gate_code;
|
||||
窄屏用卡片列表;桌面表无横滚,Case/Task 在业务关联列,WF/Item/Run 芯片可复制。
|
||||
EP 迁移:按钮/筛选控件/横幅/空态/加载迁移为 el-button / el-input / el-select / el-date-picker /
|
||||
el-alert / el-empty / el-skeleton,审计事件列表迁移为 el-timeline(窄屏/桌面双容器保留
|
||||
原响应式断点与全部 data-testid 契约);业务脚本(筛选/关联链/哈希校验/导出)零改动。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import {
|
||||
ElAlert,
|
||||
ElButton,
|
||||
ElDatePicker,
|
||||
ElEmpty,
|
||||
ElInput,
|
||||
ElOption,
|
||||
ElSelect,
|
||||
ElSkeleton,
|
||||
ElTimeline,
|
||||
ElTimelineItem,
|
||||
} from 'element-plus';
|
||||
import { Refresh, Search } from '@element-plus/icons-vue';
|
||||
import 'element-plus/dist/index.css';
|
||||
import 'element-plus/theme-chalk/dark/css-vars.css';
|
||||
import '@/features/admin/styles/element-trial.css';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import {
|
||||
@@ -264,304 +284,347 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="space-y-5 p-5 md:p-7" data-testid="shipping-audit-center">
|
||||
<header class="flex flex-col gap-3 sm:flex-row sm:flex-wrap sm:items-start sm:justify-between">
|
||||
<div class="min-w-0">
|
||||
<h1 class="section-title">{{ t('admin.shippingAudit.title') }}</h1>
|
||||
<p class="section-desc mt-1 max-w-3xl">{{ t('admin.shippingAudit.subtitle') }}</p>
|
||||
<section class="shipping-audit-page" data-testid="shipping-audit-center">
|
||||
<header class="page-header">
|
||||
<div class="page-heading-copy">
|
||||
<h1>{{ t('admin.shippingAudit.title') }}</h1>
|
||||
<!-- 段落行宽限制(原 max-w-3xl)保留,页面根限宽/内边距由壳层持有 -->
|
||||
<p class="page-desc">{{ t('admin.shippingAudit.subtitle') }}</p>
|
||||
</div>
|
||||
<!-- [STEP] 窄屏主操作:刷新/导出;校验与关联链收入“更多”。 -->
|
||||
<div class="flex w-full flex-wrap items-center gap-2 sm:w-auto sm:justify-end">
|
||||
<button type="button" class="btn-secondary btn-sm" :disabled="loading" data-testid="shipping-audit-refresh" @click="load">
|
||||
<div class="page-actions">
|
||||
<el-button
|
||||
size="small"
|
||||
:icon="Refresh"
|
||||
:loading="loading"
|
||||
data-testid="shipping-audit-refresh"
|
||||
@click="load"
|
||||
>
|
||||
{{ t('admin.shippingAudit.refresh') }}
|
||||
</button>
|
||||
<button type="button" class="btn-secondary btn-sm" :disabled="exporting" data-testid="shipping-audit-export" @click="exportCsv">
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
:loading="exporting"
|
||||
:disabled="exporting"
|
||||
data-testid="shipping-audit-export"
|
||||
@click="exportCsv"
|
||||
>
|
||||
{{ exporting ? t('admin.shippingAudit.exporting') : t('admin.shippingAudit.export') }}
|
||||
</button>
|
||||
<div class="relative">
|
||||
<button
|
||||
type="button"
|
||||
class="btn-secondary btn-sm md:hidden"
|
||||
</el-button>
|
||||
<div class="more-wrap">
|
||||
<el-button
|
||||
size="small"
|
||||
class="more-toggle"
|
||||
data-testid="shipping-audit-more"
|
||||
@click="moreOpen = !moreOpen"
|
||||
>
|
||||
{{ t('admin.shippingAudit.moreActions') }}
|
||||
</button>
|
||||
<div
|
||||
class="absolute right-0 z-10 mt-1 w-44 rounded-lg border border-default bg-surface p-1 shadow-md md:static md:mt-0 md:flex md:w-auto md:items-center md:gap-2 md:border-0 md:bg-transparent md:p-0 md:shadow-none"
|
||||
:class="moreOpen ? 'block' : 'hidden md:flex'"
|
||||
>
|
||||
<button type="button" class="btn-secondary btn-sm w-full justify-start md:w-auto" :disabled="verifying" @click="runHashVerify">
|
||||
</el-button>
|
||||
<div class="more-panel" :class="{ 'more-panel--open': moreOpen }">
|
||||
<el-button size="small" :loading="verifying" :disabled="verifying" @click="runHashVerify">
|
||||
{{ verifying ? t('admin.shippingAudit.verifying') : t('admin.shippingAudit.verifyChain') }}
|
||||
</button>
|
||||
<button type="button" class="btn-secondary btn-sm w-full justify-start md:w-auto" @click="loadAssociationChain">
|
||||
</el-button>
|
||||
<el-button size="small" @click="loadAssociationChain">
|
||||
{{ t('admin.shippingAudit.loadChain') }}
|
||||
</button>
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div class="grid gap-3 rounded-xl border border-default bg-surface p-3 md:grid-cols-3 lg:grid-cols-4">
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<div class="filters-panel">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.workflowId') }}</span>
|
||||
<input v-model="filters.workflow_id" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
<el-input v-model="filters.workflow_id" @keyup.enter="applyFilters" />
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.workflowItemId') }}</span>
|
||||
<input v-model="filters.workflow_item_id" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
<el-input v-model="filters.workflow_item_id" @keyup.enter="applyFilters" />
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.runNo') }}</span>
|
||||
<input v-model="filters.run_no" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
<el-input v-model="filters.run_no" @keyup.enter="applyFilters" />
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.documentId') }}</span>
|
||||
<input v-model="filters.document_id" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
<el-input v-model="filters.document_id" @keyup.enter="applyFilters" />
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.reviewCaseNo') }}</span>
|
||||
<input v-model="filters.review_case_no" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
<el-input v-model="filters.review_case_no" @keyup.enter="applyFilters" />
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.taskNo') }}</span>
|
||||
<input v-model="filters.task_no" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
<el-input v-model="filters.task_no" @keyup.enter="applyFilters" />
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.candidateNo') }}</span>
|
||||
<input
|
||||
<el-input
|
||||
v-model="filters.candidate_no"
|
||||
class="input-field text-sm"
|
||||
data-testid="shipping-audit-filter-candidate-no"
|
||||
@keyup.enter="applyFilters"
|
||||
>
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.gateCode') }}</span>
|
||||
<input
|
||||
<el-input
|
||||
v-model="filters.gate_code"
|
||||
class="input-field text-sm"
|
||||
data-testid="shipping-audit-filter-gate-code"
|
||||
@keyup.enter="applyFilters"
|
||||
>
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.actorType') }}</span>
|
||||
<select v-model="filters.actor_type" class="select-field text-sm" @change="applyFilters">
|
||||
<option value="">{{ t('admin.shippingAudit.filters.all') }}</option>
|
||||
<option value="user">{{ t('admin.shippingAudit.labels.actorTypes.user') }}</option>
|
||||
<option value="admin">{{ t('admin.shippingAudit.labels.actorTypes.admin') }}</option>
|
||||
<option value="system">{{ t('admin.shippingAudit.labels.actorTypes.system') }}</option>
|
||||
<option value="rpa">{{ t('admin.shippingAudit.labels.actorTypes.rpa') }}</option>
|
||||
</select>
|
||||
<el-select v-model="filters.actor_type" @change="applyFilters">
|
||||
<el-option :label="t('admin.shippingAudit.filters.all')" value="" />
|
||||
<el-option :label="t('admin.shippingAudit.labels.actorTypes.user')" value="user" />
|
||||
<el-option :label="t('admin.shippingAudit.labels.actorTypes.admin')" value="admin" />
|
||||
<el-option :label="t('admin.shippingAudit.labels.actorTypes.system')" value="system" />
|
||||
<el-option :label="t('admin.shippingAudit.labels.actorTypes.rpa')" value="rpa" />
|
||||
</el-select>
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.actorId') }}</span>
|
||||
<input v-model="filters.actor_id" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
<el-input v-model="filters.actor_id" @keyup.enter="applyFilters" />
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.eventTypeGroup') }}</span>
|
||||
<select
|
||||
<el-select
|
||||
v-model="filters.event_type_group"
|
||||
class="select-field text-sm"
|
||||
data-testid="shipping-audit-filter-event-type-group"
|
||||
@change="applyFilters"
|
||||
>
|
||||
<option value="">{{ t('admin.shippingAudit.filters.all') }}</option>
|
||||
<option value="review_workbench">{{ t('admin.shippingAudit.filters.eventTypeGroupReviewWorkbench') }}</option>
|
||||
<option value="formal_task_edit">{{ t('admin.shippingAudit.filters.eventTypeGroupFormalTaskEdit') }}</option>
|
||||
<option value="chat_workbench">{{ t('admin.shippingAudit.filters.eventTypeGroupChatWorkbench') }}</option>
|
||||
<option value="process_gate">{{ t('admin.shippingAudit.filters.eventTypeGroupProcessGate') }}</option>
|
||||
<option value="candidate_qualification">{{ t('admin.shippingAudit.filters.eventTypeGroupQualification') }}</option>
|
||||
<option value="workflow_node">{{ t('admin.shippingAudit.filters.eventTypeGroupWorkflowNode') }}</option>
|
||||
<option value="xfa_visual">{{ t('admin.shippingAudit.filters.eventTypeGroupXfaVisual') }}</option>
|
||||
<option value="xfa_split">{{ t('admin.shippingAudit.filters.eventTypeGroupXfaSplit') }}</option>
|
||||
<option value="xfa_unified">{{ t('admin.shippingAudit.filters.eventTypeGroupXfaUnified') }}</option>
|
||||
</select>
|
||||
<el-option :label="t('admin.shippingAudit.filters.all')" value="" />
|
||||
<el-option :label="t('admin.shippingAudit.filters.eventTypeGroupReviewWorkbench')" value="review_workbench" />
|
||||
<el-option :label="t('admin.shippingAudit.filters.eventTypeGroupFormalTaskEdit')" value="formal_task_edit" />
|
||||
<el-option :label="t('admin.shippingAudit.filters.eventTypeGroupChatWorkbench')" value="chat_workbench" />
|
||||
<el-option :label="t('admin.shippingAudit.filters.eventTypeGroupProcessGate')" value="process_gate" />
|
||||
<el-option :label="t('admin.shippingAudit.filters.eventTypeGroupQualification')" value="candidate_qualification" />
|
||||
<el-option :label="t('admin.shippingAudit.filters.eventTypeGroupWorkflowNode')" value="workflow_node" />
|
||||
<el-option :label="t('admin.shippingAudit.filters.eventTypeGroupXfaVisual')" value="xfa_visual" />
|
||||
<el-option :label="t('admin.shippingAudit.filters.eventTypeGroupXfaSplit')" value="xfa_split" />
|
||||
<el-option :label="t('admin.shippingAudit.filters.eventTypeGroupXfaUnified')" value="xfa_unified" />
|
||||
</el-select>
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.profileId') }}</span>
|
||||
<input
|
||||
<el-input
|
||||
v-model="filters.profile_id"
|
||||
class="input-field text-sm"
|
||||
data-testid="shipping-audit-filter-profile-id"
|
||||
@keyup.enter="applyFilters"
|
||||
>
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.bindingId') }}</span>
|
||||
<input
|
||||
<el-input
|
||||
v-model="filters.binding_id"
|
||||
class="input-field text-sm"
|
||||
data-testid="shipping-audit-filter-binding-id"
|
||||
@keyup.enter="applyFilters"
|
||||
>
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.eventType') }}</span>
|
||||
<input v-model="filters.event_type" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
<el-input v-model="filters.event_type" @keyup.enter="applyFilters" />
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.reasonCode') }}</span>
|
||||
<input v-model="filters.reason_code" class="input-field text-sm" data-testid="shipping-audit-filter-reason-code" @keyup.enter="applyFilters">
|
||||
<el-input
|
||||
v-model="filters.reason_code"
|
||||
data-testid="shipping-audit-filter-reason-code"
|
||||
@keyup.enter="applyFilters"
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.result') }}</span>
|
||||
<input v-model="filters.result" class="input-field text-sm" @keyup.enter="applyFilters">
|
||||
<el-input v-model="filters.result" @keyup.enter="applyFilters" />
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.createdFrom') }}</span>
|
||||
<input v-model="filters.created_from" type="datetime-local" class="input-field text-sm" @change="applyFilters">
|
||||
<!-- value-format 保持字符串契约,normalizeDateTimeFilter 逻辑不变 -->
|
||||
<el-date-picker
|
||||
v-model="filters.created_from"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DDTHH:mm"
|
||||
@change="applyFilters"
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary">
|
||||
<label class="filter-field">
|
||||
<span>{{ t('admin.shippingAudit.filters.createdTo') }}</span>
|
||||
<input v-model="filters.created_to" type="datetime-local" class="input-field text-sm" @change="applyFilters">
|
||||
<el-date-picker
|
||||
v-model="filters.created_to"
|
||||
type="datetime"
|
||||
value-format="YYYY-MM-DDTHH:mm"
|
||||
@change="applyFilters"
|
||||
/>
|
||||
</label>
|
||||
<label class="space-y-1 text-xs text-secondary md:col-span-2 lg:col-span-1">
|
||||
<label class="filter-field filter-field--wide">
|
||||
<span>{{ t('admin.shippingAudit.filters.q') }}</span>
|
||||
<div class="flex gap-2">
|
||||
<input v-model="filters.q" class="input-field text-sm flex-1" @keyup.enter="applyFilters">
|
||||
<button type="button" class="btn-secondary btn-sm" @click="applyFilters">{{ t('admin.shippingAudit.apply') }}</button>
|
||||
<div class="filter-q-row">
|
||||
<el-input
|
||||
v-model="filters.q"
|
||||
:prefix-icon="Search"
|
||||
clearable
|
||||
@keyup.enter="applyFilters"
|
||||
@clear="applyFilters"
|
||||
/>
|
||||
<el-button size="small" @click="applyFilters">{{ t('admin.shippingAudit.apply') }}</el-button>
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<p v-if="chainHint" class="rounded-lg border border-default bg-surface-soft px-3 py-2 text-xs text-secondary">{{ chainHint }}</p>
|
||||
<p
|
||||
<el-alert v-if="chainHint" type="info" :closable="false" :title="chainHint" />
|
||||
<el-alert
|
||||
v-if="verifyResult"
|
||||
class="rounded-lg border border-default bg-surface-soft px-3 py-2 text-xs text-secondary"
|
||||
data-testid="shipping-audit-verify-result"
|
||||
>
|
||||
{{ t('admin.shippingAudit.verifySummary', {
|
||||
type="info"
|
||||
:closable="false"
|
||||
:title="t('admin.shippingAudit.verifySummary', {
|
||||
ok: verifyResult.ok ? t('admin.shippingAudit.verifyOk') : t('admin.shippingAudit.verifyFailedShort'),
|
||||
checked: verifyResult.checked_chains,
|
||||
failed: verifyResult.failed_chains,
|
||||
}) }}
|
||||
</p>
|
||||
<p v-if="error" class="rounded-lg border border-rose-200 bg-rose-50 p-3 text-sm text-rose-700">{{ error }}</p>
|
||||
})"
|
||||
data-testid="shipping-audit-verify-result"
|
||||
/>
|
||||
<el-alert v-if="error" type="error" :closable="false" :title="error" />
|
||||
|
||||
<!-- 窄屏卡片列表:避免 1360px 表强制横向滚动才能点到 Diff -->
|
||||
<div class="space-y-3 lg:hidden" data-testid="shipping-audit-card-list">
|
||||
<p v-if="loading" class="rounded-xl border border-default bg-surface px-3 py-8 text-center text-sm text-muted">
|
||||
{{ t('admin.shippingAudit.loading') }}
|
||||
</p>
|
||||
<p v-else-if="!rows.length" class="rounded-xl border border-default bg-surface px-3 py-8 text-center text-sm text-muted">
|
||||
{{ t('admin.shippingAudit.empty') }}
|
||||
</p>
|
||||
<article
|
||||
v-for="row in rows"
|
||||
:key="row.id"
|
||||
class="rounded-xl border border-default bg-surface p-3"
|
||||
>
|
||||
<div class="flex items-start justify-between gap-2">
|
||||
<div class="min-w-0">
|
||||
<div class="text-sm font-medium text-secondary">{{ businessLabel('eventTypes', row.event_type) }}</div>
|
||||
<div class="mt-0.5 text-xs text-muted">{{ businessLabel('actions', row.action) }}</div>
|
||||
</div>
|
||||
<button type="button" class="shrink-0 text-sm text-brand-600 hover:underline" @click="openDetail(row.id)">
|
||||
{{ t('admin.shippingAudit.diff') }}
|
||||
</button>
|
||||
</div>
|
||||
<dl class="mt-2 grid gap-1 text-xs text-secondary">
|
||||
<div><dt class="inline text-muted">{{ t('admin.shippingAudit.columns.time') }}:</dt><dd class="inline">{{ formatTime(row.created_at) }}</dd></div>
|
||||
<div><dt class="inline text-muted">{{ t('admin.shippingAudit.columns.actor') }}:</dt><dd class="inline">{{ businessLabel('actorTypes', row.actor_type) }}</dd></div>
|
||||
<div><dt class="inline text-muted">{{ t('admin.shippingAudit.columns.reasonCode') }}:</dt><dd class="inline font-medium">{{ businessLabel('reasonCodes', row.reason_code) }}</dd></div>
|
||||
<div><dt class="inline text-muted">{{ t('admin.shippingAudit.columns.result') }}:</dt><dd class="inline">{{ businessLabel('results', row.result) }}</dd></div>
|
||||
<div v-if="primaryBusinessRefs(row) !== '—'">
|
||||
<dt class="inline text-muted">{{ t('admin.shippingAudit.columns.businessRefs') }}:</dt>
|
||||
<dd class="inline">{{ primaryBusinessRefs(row) }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<div
|
||||
v-if="techRefChips(row).length"
|
||||
class="mt-2 flex flex-wrap items-center gap-1.5"
|
||||
data-testid="shipping-audit-tech-ref-chips"
|
||||
<div class="audit-panel audit-panel--mobile" data-testid="shipping-audit-card-list">
|
||||
<el-skeleton v-if="loading" :rows="5" animated />
|
||||
<el-empty
|
||||
v-else-if="!rows.length"
|
||||
:description="t('admin.shippingAudit.empty')"
|
||||
:image-size="60"
|
||||
/>
|
||||
<el-timeline v-else class="audit-timeline">
|
||||
<el-timeline-item
|
||||
v-for="row in rows"
|
||||
:key="row.id"
|
||||
:timestamp="formatTime(row.created_at)"
|
||||
placement="top"
|
||||
>
|
||||
<span class="text-[10px] text-muted">{{ t('admin.shippingAudit.techRefs') }}</span>
|
||||
<button
|
||||
v-for="item in techRefChips(row)"
|
||||
:key="`${row.id}-m-tech-${item.label}`"
|
||||
type="button"
|
||||
class="rounded border border-default px-2 py-1 font-mono text-[11px] text-muted"
|
||||
:title="item.value"
|
||||
@click="copyTechId(item.value)"
|
||||
>
|
||||
{{ item.label }}
|
||||
</button>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
<!-- 桌面表:table-fixed + 无横滚;技术编号行内次要芯片,无需额外展开 -->
|
||||
<div class="hidden overflow-x-hidden rounded-xl border border-default bg-surface lg:block" data-testid="shipping-audit-desktop-table">
|
||||
<table class="w-full table-fixed text-left text-sm">
|
||||
<thead class="border-b border-default bg-surface-soft text-xs text-muted">
|
||||
<tr>
|
||||
<th class="w-[16%] px-3 py-2">{{ t('admin.shippingAudit.columns.time') }}</th>
|
||||
<th class="w-[20%] px-3 py-2">{{ t('admin.shippingAudit.columns.event') }}</th>
|
||||
<th class="w-[10%] px-3 py-2">{{ t('admin.shippingAudit.columns.actor') }}</th>
|
||||
<th class="w-[18%] px-3 py-2">{{ t('admin.shippingAudit.columns.reasonCode') }}</th>
|
||||
<th class="w-[10%] px-3 py-2">{{ t('admin.shippingAudit.columns.result') }}</th>
|
||||
<th class="w-[16%] px-3 py-2">{{ t('admin.shippingAudit.columns.businessRefs') }}</th>
|
||||
<th class="w-[10%] px-3 py-2"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-if="loading">
|
||||
<td colspan="7" class="px-3 py-8 text-center text-muted">{{ t('admin.shippingAudit.loading') }}</td>
|
||||
</tr>
|
||||
<tr v-else-if="!rows.length">
|
||||
<td colspan="7" class="px-3 py-8 text-center text-muted">{{ t('admin.shippingAudit.empty') }}</td>
|
||||
</tr>
|
||||
<tr
|
||||
v-for="row in rows"
|
||||
:key="row.id"
|
||||
class="border-b border-default last:border-0"
|
||||
>
|
||||
<td class="px-3 py-2 align-top text-xs">{{ formatTime(row.created_at) }}</td>
|
||||
<td class="px-3 py-2 align-top">
|
||||
<div class="font-medium break-words">{{ businessLabel('eventTypes', row.event_type) }}</div>
|
||||
<div class="text-[11px] text-muted break-words">{{ businessLabel('actions', row.action) }}</div>
|
||||
</td>
|
||||
<td class="px-3 py-2 align-top text-xs">{{ businessLabel('actorTypes', row.actor_type) }}</td>
|
||||
<td class="px-3 py-2 align-top text-xs break-words font-medium text-secondary">
|
||||
{{ businessLabel('reasonCodes', row.reason_code) }}
|
||||
</td>
|
||||
<td class="px-3 py-2 align-top">{{ businessLabel('results', row.result) }}</td>
|
||||
<td class="px-3 py-2 align-top text-[11px] text-secondary break-words">
|
||||
<div>{{ primaryBusinessRefs(row) }}</div>
|
||||
<div
|
||||
v-if="techRefChips(row).length"
|
||||
class="mt-1 flex flex-wrap gap-1"
|
||||
data-testid="shipping-audit-tech-ref-chips"
|
||||
>
|
||||
<button
|
||||
v-for="item in techRefChips(row)"
|
||||
:key="`${row.id}-tech-${item.label}`"
|
||||
type="button"
|
||||
class="rounded border border-default bg-surface-soft px-1 py-0.5 font-mono text-[10px] text-muted"
|
||||
:title="item.value"
|
||||
@click="copyTechId(item.value)"
|
||||
>
|
||||
{{ item.label }}
|
||||
</button>
|
||||
<div class="audit-event">
|
||||
<div class="audit-event-head">
|
||||
<div class="audit-event-name">
|
||||
<strong>{{ businessLabel('eventTypes', row.event_type) }}</strong>
|
||||
<span class="audit-event-action">{{ businessLabel('actions', row.action) }}</span>
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-3 py-2 align-top">
|
||||
<button type="button" class="text-brand-600 hover:underline" @click="openDetail(row.id)">
|
||||
<el-button link type="primary" @click="openDetail(row.id)">
|
||||
{{ t('admin.shippingAudit.diff') }}
|
||||
</el-button>
|
||||
</div>
|
||||
<dl class="audit-event-meta">
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingAudit.columns.actor') }}:</dt>
|
||||
<dd>{{ businessLabel('actorTypes', row.actor_type) }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingAudit.columns.reasonCode') }}:</dt>
|
||||
<dd class="audit-event-reason">{{ businessLabel('reasonCodes', row.reason_code) }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingAudit.columns.result') }}:</dt>
|
||||
<dd>{{ businessLabel('results', row.result) }}</dd>
|
||||
</div>
|
||||
<div v-if="primaryBusinessRefs(row) !== '—'">
|
||||
<dt>{{ t('admin.shippingAudit.columns.businessRefs') }}:</dt>
|
||||
<dd>{{ primaryBusinessRefs(row) }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<div
|
||||
v-if="techRefChips(row).length"
|
||||
class="tech-chips"
|
||||
data-testid="shipping-audit-tech-ref-chips"
|
||||
>
|
||||
<span class="tech-chips-label">{{ t('admin.shippingAudit.techRefs') }}</span>
|
||||
<button
|
||||
v-for="item in techRefChips(row)"
|
||||
:key="`${row.id}-m-tech-${item.label}`"
|
||||
type="button"
|
||||
class="tech-chip"
|
||||
:title="item.value"
|
||||
@click="copyTechId(item.value)"
|
||||
>
|
||||
{{ item.label }}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</el-timeline-item>
|
||||
</el-timeline>
|
||||
</div>
|
||||
|
||||
<div class="flex items-center justify-end gap-3 text-sm">
|
||||
<span class="text-xs text-muted">{{ t('admin.shippingAudit.total', { count: total }) }}</span>
|
||||
<button type="button" class="rounded border border-default px-3 py-1.5 disabled:opacity-50" :disabled="page <= 1 || loading" @click="page -= 1; load()">{{ t('admin.shippingAudit.previous') }}</button>
|
||||
<span>{{ pageLabel }}</span>
|
||||
<button type="button" class="rounded border border-default px-3 py-1.5 disabled:opacity-50" :disabled="page * pageSize >= total || loading" @click="page += 1; load()">{{ t('admin.shippingAudit.next') }}</button>
|
||||
<!-- 桌面列表:与窄屏同一时间线内容,仅断点切换;技术编号行内次要芯片 -->
|
||||
<div class="audit-panel audit-panel--desktop" data-testid="shipping-audit-desktop-table">
|
||||
<el-skeleton v-if="loading" :rows="5" animated />
|
||||
<el-empty
|
||||
v-else-if="!rows.length"
|
||||
:description="t('admin.shippingAudit.empty')"
|
||||
:image-size="60"
|
||||
/>
|
||||
<el-timeline v-else class="audit-timeline">
|
||||
<el-timeline-item
|
||||
v-for="row in rows"
|
||||
:key="row.id"
|
||||
:timestamp="formatTime(row.created_at)"
|
||||
placement="top"
|
||||
>
|
||||
<div class="audit-event">
|
||||
<div class="audit-event-head">
|
||||
<div class="audit-event-name">
|
||||
<strong>{{ businessLabel('eventTypes', row.event_type) }}</strong>
|
||||
<span class="audit-event-action">{{ businessLabel('actions', row.action) }}</span>
|
||||
</div>
|
||||
<el-button link type="primary" @click="openDetail(row.id)">
|
||||
{{ t('admin.shippingAudit.diff') }}
|
||||
</el-button>
|
||||
</div>
|
||||
<dl class="audit-event-meta">
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingAudit.columns.actor') }}:</dt>
|
||||
<dd>{{ businessLabel('actorTypes', row.actor_type) }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingAudit.columns.reasonCode') }}:</dt>
|
||||
<dd class="audit-event-reason">{{ businessLabel('reasonCodes', row.reason_code) }}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>{{ t('admin.shippingAudit.columns.result') }}:</dt>
|
||||
<dd>{{ businessLabel('results', row.result) }}</dd>
|
||||
</div>
|
||||
<div v-if="primaryBusinessRefs(row) !== '—'">
|
||||
<dt>{{ t('admin.shippingAudit.columns.businessRefs') }}:</dt>
|
||||
<dd>{{ primaryBusinessRefs(row) }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<div
|
||||
v-if="techRefChips(row).length"
|
||||
class="tech-chips"
|
||||
data-testid="shipping-audit-tech-ref-chips"
|
||||
>
|
||||
<span class="tech-chips-label">{{ t('admin.shippingAudit.techRefs') }}</span>
|
||||
<button
|
||||
v-for="item in techRefChips(row)"
|
||||
:key="`${row.id}-tech-${item.label}`"
|
||||
type="button"
|
||||
class="tech-chip"
|
||||
:title="item.value"
|
||||
@click="copyTechId(item.value)"
|
||||
>
|
||||
{{ item.label }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</el-timeline-item>
|
||||
</el-timeline>
|
||||
</div>
|
||||
|
||||
<div class="pagination-row">
|
||||
<span class="pagination-total">{{ t('admin.shippingAudit.total', { count: total }) }}</span>
|
||||
<el-button size="small" :disabled="page <= 1 || loading" @click="page -= 1; load()">
|
||||
{{ t('admin.shippingAudit.previous') }}
|
||||
</el-button>
|
||||
<span class="pagination-page">{{ pageLabel }}</span>
|
||||
<el-button size="small" :disabled="page * pageSize >= total || loading" @click="page += 1; load()">
|
||||
{{ t('admin.shippingAudit.next') }}
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<ShippingAuditEventDetailDrawer
|
||||
@@ -571,3 +634,283 @@ onMounted(() => {
|
||||
/>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
/* 全宽布局:水平内边距由 AdminLayout 壳层统一持有,页面只保留内部块间距 */
|
||||
.shipping-audit-page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.page-header {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.page-heading-copy {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.page-header h1 {
|
||||
margin: 0;
|
||||
color: var(--el-text-color-primary);
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.page-desc {
|
||||
margin: 4px 0 0;
|
||||
max-width: 48rem;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
/* 页头操作区:相邻 el-button 间距统一交给 flex gap */
|
||||
.page-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.page-actions .el-button + .el-button,
|
||||
.more-panel .el-button + .el-button {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
/* “更多”操作区:窄屏为下拉面板,md+ 常驻内联(与原 md:hidden / md:static 语义一致) */
|
||||
.more-wrap {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.more-panel {
|
||||
position: absolute;
|
||||
z-index: 10;
|
||||
top: calc(100% + 4px);
|
||||
right: 0;
|
||||
display: none;
|
||||
min-width: 176px;
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 4px;
|
||||
border: 1px solid var(--el-border-color-light);
|
||||
border-radius: 10px;
|
||||
background: var(--el-bg-color);
|
||||
padding: 4px;
|
||||
box-shadow: var(--el-box-shadow-light);
|
||||
}
|
||||
|
||||
.more-panel.more-panel--open {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.more-panel .el-button {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.more-toggle {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.more-panel,
|
||||
.more-panel.more-panel--open {
|
||||
position: static;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
gap: 8px;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.more-panel .el-button {
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
|
||||
/* 筛选面板:md 3 列 / lg 4 列(原 md:grid-cols-3 lg:grid-cols-4) */
|
||||
.filters-panel {
|
||||
display: grid;
|
||||
gap: 12px;
|
||||
border: 1px solid var(--el-border-color-light);
|
||||
border-radius: 12px;
|
||||
background: var(--el-bg-color);
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.filter-field {
|
||||
display: flex;
|
||||
min-width: 0;
|
||||
flex-direction: column;
|
||||
gap: 4px;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.filter-field :deep(.el-select),
|
||||
.filter-field :deep(.el-date-editor.el-input) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.filter-q-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.filter-q-row :deep(.el-input) {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.filter-q-row .el-button {
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
.filters-panel {
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.filter-field--wide {
|
||||
grid-column: span 2;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
.filters-panel {
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
}
|
||||
|
||||
.filter-field--wide {
|
||||
grid-column: auto;
|
||||
}
|
||||
}
|
||||
|
||||
/* 窄屏/桌面双列表容器:结构与 data-testid 契约保持,仅按 lg 断点切换可见性 */
|
||||
.audit-panel {
|
||||
border: 1px solid var(--el-border-color-light);
|
||||
border-radius: 12px;
|
||||
background: var(--el-bg-color);
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
.audit-panel--desktop {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
.audit-panel--mobile {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.audit-panel--desktop {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.audit-timeline {
|
||||
padding: 4px 0 0 4px;
|
||||
}
|
||||
|
||||
.audit-event-head {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.audit-event-name {
|
||||
display: grid;
|
||||
min-width: 0;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.audit-event-name strong {
|
||||
color: var(--el-text-color-primary);
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.audit-event-action {
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.audit-event-meta {
|
||||
display: grid;
|
||||
gap: 4px;
|
||||
margin: 8px 0 0;
|
||||
color: var(--el-text-color-regular);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.audit-event-meta dt {
|
||||
display: inline;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
.audit-event-meta dd {
|
||||
display: inline;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.audit-event-reason {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.tech-chips {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
.tech-chips-label {
|
||||
color: var(--el-text-color-placeholder);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.tech-chip {
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
border-radius: 6px;
|
||||
background: var(--el-fill-color-lighter);
|
||||
padding: 2px 8px;
|
||||
color: var(--el-text-color-secondary);
|
||||
font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
|
||||
font-size: 12px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.tech-chip:hover {
|
||||
border-color: var(--el-color-primary-light-5);
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
|
||||
.pagination-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.pagination-total {
|
||||
color: var(--el-text-color-secondary);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.pagination-page {
|
||||
color: var(--el-text-color-primary);
|
||||
font-size: 13px;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user