refactor: 拆分档案详情与追溯码管理

This commit is contained in:
Nixevol
2026-07-03 04:28:18 +08:00
parent b95e9f8949
commit 9eda1b722a
8 changed files with 121 additions and 29 deletions
+1 -1
View File
@@ -102,7 +102,7 @@ const menuOptions = computed<MenuOption[]>(() => {
);
});
const activeKey = computed(() => (['artwork-detail', 'traceCodes'].includes(route.name as string) ? 'artworks' : (route.name as string)));
const activeKey = computed(() => (['artwork-detail', 'artwork-trace-codes', 'traceCodes'].includes(route.name as string) ? 'artworks' : (route.name as string)));
const currentTitle = computed(() => (activeKey.value ? t(`menu.${activeKey.value}`) : ''));
const userOptions = computed(() => [
+4 -1
View File
@@ -220,7 +220,10 @@
"certType": "Type",
"originFile": "Original File",
"watermarkPreview": "Watermark",
"watermarkPending": "Generating watermark…"
"watermarkPending": "Generating watermark…",
"editDetail": "Edit Details",
"dataManage": "Data Management",
"traceCodeManage": "Batches & Trace Code Management"
},
"traceCode": {
"batches": "Batches",
+4 -1
View File
@@ -220,7 +220,10 @@
"certType": "类型",
"originFile": "原始文件",
"watermarkPreview": "水印预览",
"watermarkPending": "水印生成中…"
"watermarkPending": "水印生成中…",
"editDetail": "编辑详情",
"dataManage": "数据管理",
"traceCodeManage": "批次与追溯码管理"
},
"traceCode": {
"batches": "批次列表",
+1
View File
@@ -19,6 +19,7 @@ export const routes: RouteRecordRaw[] = [
{ path: 'templates', name: 'templates', component: () => import('@/views/Templates.vue') },
{ path: 'artworks', name: 'artworks', component: () => import('@/views/Artworks.vue') },
{ path: 'artworks/:id', name: 'artwork-detail', component: () => import('@/views/ArtworkEdit.vue') },
{ path: 'artworks/:id/trace-codes', name: 'artwork-trace-codes', component: () => import('@/views/ArtworkTraceCodes.vue') },
{ path: 'trace-codes', name: 'traceCodes', component: () => import('@/views/TraceCodes.vue') },
{ path: 'outbound', name: 'outbound', component: () => import('@/views/Outbound.vue') },
{ path: 'audit', name: 'audit', component: () => import('@/views/Audit.vue'), meta: { roles: ['SUPER_ADMIN', 'AUDITOR'] } },
-18
View File
@@ -185,20 +185,6 @@
</n-card>
</n-grid-item>
<!-- 批次与追溯码:每件实物一码 -->
<n-grid-item>
<n-card :title="t('pages.artwork.traceCodes')" :bordered="false">
<n-descriptions :column="4" label-placement="top" bordered size="small">
<n-descriptions-item :label="t('pages.artwork.archiveNo')">{{ artwork?.archiveNo || '-' }}</n-descriptions-item>
<n-descriptions-item :label="t('pages.artwork.codeCount')">{{ artwork?.codeStats?.total ?? 0 }}</n-descriptions-item>
<n-descriptions-item :label="t('pages.artwork.activeCount')">{{ artwork?.codeStats?.active ?? 0 }}</n-descriptions-item>
<n-descriptions-item :label="t('pages.artwork.queryTotal')">{{ artwork?.codeStats?.queryTotal ?? 0 }}</n-descriptions-item>
</n-descriptions>
<div class="trace-panel-wrap">
<trace-code-panel :artwork-id="artworkId" embedded />
</div>
</n-card>
</n-grid-item>
</template>
</n-grid>
@@ -271,7 +257,6 @@ import { artworkApi, templateApi } from '@/api';
import { useAuthStore } from '@/stores/auth';
import MediaUpload from '@/components/MediaUpload.vue';
import MediaSorter from '@/components/MediaSorter.vue';
import TraceCodePanel from '@/components/TraceCodePanel.vue';
import { message, dialog } from '@/utils/feedback';
import { fmtDate } from '@/utils/format';
@@ -490,9 +475,6 @@ onMounted(async () => {
.mr8 {
margin-right: 8px;
}
.trace-panel-wrap {
margin-top: 14px;
}
.node-head {
display: flex;
justify-content: space-between;
@@ -0,0 +1,75 @@
<template>
<div class="page">
<div class="page-toolbar">
<n-button quaternary @click="router.back()">
<template #icon><n-icon :component="ArrowBackOutline" /></template>
{{ t('common.action.back') }}
</n-button>
<div class="page-title">{{ t('pages.artwork.traceCodeManage') }}</div>
</div>
<n-card :bordered="false" class="summary-card">
<template #header>
<div class="summary-title">
<span>{{ artwork?.title || '-' }}</span>
<n-tag v-if="artwork?.auditStatus" size="small" :type="auditTagType(artwork.auditStatus)">
{{ t(`common.auditStatus.${artwork.auditStatus}`) }}
</n-tag>
</div>
</template>
<n-descriptions :column="4" label-placement="top" bordered size="small">
<n-descriptions-item :label="t('pages.artwork.archiveNo')">{{ artwork?.archiveNo || '-' }}</n-descriptions-item>
<n-descriptions-item :label="t('pages.artwork.codeCount')">{{ artwork?.codeStats?.total ?? 0 }}</n-descriptions-item>
<n-descriptions-item :label="t('pages.artwork.activeCount')">{{ artwork?.codeStats?.active ?? 0 }}</n-descriptions-item>
<n-descriptions-item :label="t('pages.artwork.queryTotal')">{{ artwork?.codeStats?.queryTotal ?? 0 }}</n-descriptions-item>
</n-descriptions>
</n-card>
<n-card :title="t('pages.artwork.traceCodes')" :bordered="false">
<trace-code-panel :artwork-id="artworkId" />
</n-card>
</div>
</template>
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { NIcon } from 'naive-ui';
import { ArrowBackOutline } from '@vicons/ionicons5';
import { artworkApi } from '@/api';
import TraceCodePanel from '@/components/TraceCodePanel.vue';
const route = useRoute();
const router = useRouter();
const { t } = useI18n();
const artworkId = computed(() => Number(route.params.id));
const artwork = ref<any>(null);
function auditTagType(s?: string) {
return s === 'APPROVED' ? 'success' : s === 'REJECTED' ? 'error' : 'warning';
}
async function loadArtwork() {
artwork.value = await artworkApi.get(artworkId.value);
}
onMounted(loadArtwork);
</script>
<style scoped>
.page-title {
font-size: 16px;
font-weight: 600;
}
.summary-card {
margin-bottom: 16px;
}
.summary-title {
display: flex;
align-items: center;
gap: 10px;
min-width: 0;
}
</style>
+34 -7
View File
@@ -44,7 +44,7 @@ import { h, onMounted, reactive, ref } from 'vue';
import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { NButton, NIcon, NTag, NAvatar, type DataTableColumns } from 'naive-ui';
import { SearchOutline, AddOutline, CreateOutline } from '@vicons/ionicons5';
import { SearchOutline, AddOutline, CreateOutline, BarChartOutline } from '@vicons/ionicons5';
import { ArtworkStatus } from '@artveris/shared';
import { artworkApi } from '@/api';
import { useAuthStore } from '@/stores/auth';
@@ -102,13 +102,32 @@ const columns: DataTableColumns<any> = [
{
title: () => t('common.label.operation'),
key: 'ops',
width: 90,
width: 112,
render: (r) =>
h(
NButton,
{ quaternary: true, circle: true, size: 'small', onClick: () => router.push(`/artworks/${r.id}`) },
{ icon: () => h(NIcon, null, { default: () => h(CreateOutline) }) },
),
h('div', { class: 'row-actions' }, [
h(
NButton,
{
quaternary: true,
circle: true,
size: 'small',
title: t('pages.artwork.editDetail'),
onClick: () => router.push(`/artworks/${r.id}`),
},
{ icon: () => h(NIcon, null, { default: () => h(CreateOutline) }) },
),
h(
NButton,
{
quaternary: true,
circle: true,
size: 'small',
title: t('pages.artwork.dataManage'),
onClick: () => router.push(`/artworks/${r.id}/trace-codes`),
},
{ icon: () => h(NIcon, null, { default: () => h(BarChartOutline) }) },
),
]),
},
];
@@ -142,3 +161,11 @@ function goCreate() {
onMounted(load);
</script>
<style scoped>
.row-actions {
display: inline-flex;
align-items: center;
gap: 6px;
}
</style>