refactor: 拆分档案详情与追溯码管理
This commit is contained in:
@@ -90,12 +90,13 @@
|
||||
- 查询日志瘦身(2026-07-03):对照甲方原版 PRD,后台只要求查看产品查询次数和日志,未要求地区解析;按用户确认移除地区字段与 Geo 链路。`QueryLog.region` 从 Prisma schema 移除并新增迁移 `20260703000100_drop_query_log_region`,`PublicTraceService` 写日志只记录访问 IP(由 `extractIp` 从代理头取公网 IP)与 UA 解析结果;删除 `GeoModule/GeoService`、`GEO_DRIVER` 配置和后台“IP / 地区”拼接展示,后台查询日志 IP 列仅展示访问 IP。
|
||||
- TypeScript 后端配置修复(2026-07-03):`apps/api/tsconfig.json` 在已有 `outDir: ./dist` 的基础上显式补充 `rootDir: ./src`,消除 VS Code / TypeScript 7 关于 `outDir` 应配套 `rootDir` 的诊断提示;API 编译输入仍只包含 `src`,Prisma seed 与测试文件继续排除。
|
||||
- 后台信息架构合并(2026-07-03):根据甲方微信口径重新校准“一款多码”的含义:一款是款式/档案层,可分批生产多套;每套实物仍独立编码,符合一物一码。后台取消侧边栏平级“追溯码管理”入口,将追溯码主流程内聚到“艺术品档案”详情的“批次与追溯码”区域;新增复用组件 `TraceCodePanel`,在档案详情固定当前 `artworkId` 管理生码、筛选、分组、导出、批量启停和二维码预览;隐藏路由 `/trace-codes` 仍保留为全局明细页。后端 `GET /batches` 支持 `artworkId` 过滤,避免详情页混入其他档案批次。整理版 PRD 与技术方案已同步说明 `Artwork -> Batch -> TraceCode`,其中 `TraceCode` 是单件实物的一物一码载体。
|
||||
- 后台交互拆分(2026-07-03):艺术品档案列表操作列拆为两个图标入口:编辑详情(进入 `/artworks/:id`,只维护基础信息、图片、溯源节点、认证文件)和数据管理(进入 `/artworks/:id/trace-codes`,专门管理该档案下的批次与追溯码)。`ArtworkEdit.vue` 不再内嵌追溯码表,新增 `ArtworkTraceCodes.vue` 复用 `TraceCodePanel` 并展示档案编号、追溯码数、已激活数、查询总数摘要;侧边栏仍只高亮“艺术品档案”。
|
||||
|
||||
## 当前代码基准与注意事项
|
||||
|
||||
- 代码优先级:后续开发以 `apps/api/prisma/schema.prisma`、后端服务实现、admin/client 当前页面为准;PRD 与技术方案中仍可能有旧“一物一码/绑定防伪码/SKU”表述,仅作需求背景参考。
|
||||
- 当前核心模型:一款/一个档案 `Artwork` 多个批次 `Batch`,每批次多个实物追溯码 `TraceCode`;`archiveNo` 是款级唯一档案编号,`TraceCode` 是每套实物的一物一码载体,查询统计按档案聚合。
|
||||
- 生码入口:主入口在艺术品档案详情的“批次与追溯码”;隐藏全局明细页也可生码但必须指定作品档案/款式。不存在“未绑定码池 → 绑定作品”的旧流程。
|
||||
- 生码入口:主入口在艺术品档案列表的“数据管理”进入“批次与追溯码管理”;隐藏全局明细页也可生码但必须指定作品档案/款式。不存在“未绑定码池 → 绑定作品”的旧流程。
|
||||
- 出库导入:以短码定位具体一套码,导入列不再包含 SKU 或手填档案编号;档案编号由作品自动生成并在日志/导出/C 端展示。
|
||||
- 客户端:当前 `Trace.vue` 依赖 `openMediaViewer.ts` + PhotoSwipe,不再使用旧 `MediaViewer.vue`;顶部语言菜单和追溯码复制是用户当前未提交改动的一部分,后续若继续修改客户端,需保护这些改动。
|
||||
- 文案残留:`apps/client/src/locales/*` 仍保留 `privacy.note`,但当前页面不显示底部隐私说明;若按合规要求恢复,需要在 `Trace.vue` 重新渲染对应文案。
|
||||
|
||||
@@ -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(() => [
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -220,7 +220,10 @@
|
||||
"certType": "类型",
|
||||
"originFile": "原始文件",
|
||||
"watermarkPreview": "水印预览",
|
||||
"watermarkPending": "水印生成中…"
|
||||
"watermarkPending": "水印生成中…",
|
||||
"editDetail": "编辑详情",
|
||||
"dataManage": "数据管理",
|
||||
"traceCodeManage": "批次与追溯码管理"
|
||||
},
|
||||
"traceCode": {
|
||||
"batches": "批次列表",
|
||||
|
||||
@@ -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'] } },
|
||||
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user