feat: 追溯码列表列重排并做追溯码/档案编号/名称关联跳转
This commit is contained in:
@@ -250,6 +250,7 @@
|
||||
- 出库/上链防重复(2026-07-10):按「一物一码只能出库一次、已上链不可再上」补齐幂等校验。① 出库:`outbound.service.updateSingle`(单件)、`import-preview.processor`(导入预览)、`import.processor`(导入提交,防预览→提交竞态)三处均对 `code.outTime` 已存在拒绝「该追溯码已登记出库,不可重复出库」。② 上链:`attestation.service.trigger` 新增查重——存在 ONCHAIN/CONFIRMING/PENDING 的 proof 即拒绝(已上链→「不可重复上链」,处理中→「请稍候」);仅 FAILED 可通过独立 `retry` 接口重试(retry 原地更新既有 proof、不走 trigger,不受影响)。实测重复上链/重复出库均返回 400 拒绝。
|
||||
- 天河链确认节奏调整(2026-07-10):`onchain.processor` 确认查询改为「提交完立即查 1 次 → 未到 10s → 再 30s」共 3 次自动尝试,之后停等手动重新确认(原为 30s/60s 两次)。用延迟数组 `AUTO_CONFIRM_DELAYS_MS=[0,10_000,30_000]`、`MAX_AUTO_CONFIRM_ATTEMPTS=数组长度`,第 attempt 次延迟取 `[attempt-1]`。实测:提交同秒即查到 mint 已进块(status 0x0、blockHeight、tokenId),直接 ONCHAIN。
|
||||
- 天河链方案 B 落地(存证+发行+轮换,2026-07-10,dev/refine):按甲方决策「其余全做、媒体待定」实现。① 数据模型:`blockchain_proof` 加 `token_id`/`contract_address`(迁移 `20260710110000_add_proof_token_fields`);schema 补 `@db.VarChar` 注解消除历史 drift(operation_log.path 512 / outbound_import_session.file_key 512 / backup_record.file_path 1024)。② `TianheProvider` 新增 `publish`(接口2,operateId≤20,name≤42,author≤120,feature≤500)与 `updateUserKey`(接口7)。③ `BlockchainService.attestWithTianhe`:upload 存证→publish 铸 1 NFT(productId=追溯码、feature=存证链接)→ 主 txHash 切为 mint 交易、confirmationRequired=true 走接口9确认→ONCHAIN;合约地址存 `tianheContractAddress`、已发行最大 tokenId 存 `tianheMaxTokenId`(指定合约时作 baseTokenId,队列串行无争用);缺 product 时退化纯存证。`confirmTransaction` 确认成功回填 tokenId、更新 maxTokenId。④ `rotateTianheUserKey`:生成新随机 key→接口7链上改→持久化→接口8校验地址,`/settings/tianhe/identity/rotate` + 设置页「轮换密钥」(二次确认+回显强提示)。⑤ C 端:public-trace + Trace.vue 区块链卡增 tokenId/合约地址展示(i18n chain.tokenId/chain.contract)。⑥ 实测(测试环境):追溯码 412680781069 走通 upload→publish(合约 0xc96ae8a4... tokenId=0)→确认(区块高度 5820347)→ONCHAIN,C 端展示数字藏品编号 0/合约地址/区块高度;轮换 UserKey 成功(钱包地址不变),新 key 回填测试文档。验证:4 包构建 + 27 单测通过。**唯一待定:媒体上链层级 L1/L2/L3 待甲方确认「链上放什么」,当前维持 JSON 存证。**
|
||||
- 追溯码列表列重排+关联跳转(2026-07-12,分支 `dev/tianhe-no-metadata-upload`,两页共用 `TraceCodePanel` 同时生效):列顺序改为 追溯码→名称→档案编号→批次编号→分组→出库状态→上链状态→出库时间→激活状态→查询次数→激活时间→链接→创建时间→操作;名称/档案编号仅全局页显示(`fixedArtworkId` 时隐藏,档案内为同一作品)。关联:追溯码列渲染为 `<a target=_blank href=r.url>` 点击开 C 端溯源页;名称/档案编号渲染为 `.cell-link` 点击 `goArtwork(id)` → `router.push({name:'artwork-detail'})`。`status` 列标题改用 `pages.traceCode.activationStatus`(激活状态),`firstActivatedAt` 标签改为「激活时间」,新增 `openTrace` i18n。追溯码列 `fixed:'left'`、操作列 `fixed:'right'`。浏览器双页实测通过。
|
||||
- 出库/上链弹窗 UI 打磨(2026-07-10,分支 `dev/tianhe-no-metadata-upload`):① 出库时间加红星必填标识(`n-form-item-gi :required="!outboundReadonly"`);② 修复「关闭」按钮显示字面量——`common.action` 原缺 `close` 键,已补中英;③「区块链存证」详情用 `n-descriptions` 的 `label-style` 设 `whiteSpace:nowrap + verticalAlign:middle`,标题不再折行、垂直居中;④ 除「上链状态」外每项(数据哈希/交易哈希/tokenId/合约/区块高度/上链时间/存证查询)加复制按钮(`CopyOutline` + `navigator.clipboard`,`copyValue` 提示 `common.msg.copied/copyFailed`)。浏览器实测通过。
|
||||
- 出库/上链一致性强化(2026-07-10,分支 `dev/tianhe-no-metadata-upload`):按甲方口径补三条不变量。① 确认中即已上链:前端 `rowIsOnchain` 由仅认 ONCHAIN 改为认 `ONCHAIN/CONFIRMING/PENDING`(这些状态菜单均显示「上链信息」、不给再触发;仅 FAILED 显示「上链」可重试),与后端 `attestation.trigger` 早有的防重复拦截对齐(天河 publish 一返回 mint 哈希即已广播上链、必进块,除非明确失败,故确认中不可重复上链);`targetProof` 回退用 `latestAnyProof` 使确认中也能展示上链信息。② 出库时间必填默认此刻:弹窗未出库时默认 `dayjs()` 此刻、前端空值拦截、后端 `outbound.updateSingle` 强制 `outTime` 非空。③ 上链必先出库:后端 `attestation.trigger` 增 `isOutbound(code)` 校验,未出库拒绝「请先登记出库再上链」,杜绝「已上链未登记」不一致(防直连 API 绕过)。注:这些为通用改进,暂随本分支;方案二合并时一并进 dev/refine,若方案二被否再单独回植。
|
||||
- 天河链去掉元数据上链存证、改为仅发行(2026-07-10,分支 `dev/tianhe-no-metadata-upload`,待甲方展示确认后再合并):甲方定「不上传元数据、作品详情/媒体存我方 OSS」。上链链路由「upload 存证 + publish 发行」精简为「仅 publish 发行」,每件省一次上链调用(按次计费更省)。改动:① `AttestPayload.product` 增 `feature`;② `attestation.service` 注入 `StorageService`,`product.feature=作品主图公开URL`(天河 feature 语义=作品媒体地址,正是甲方放 OSS 的图,藏品/交易详情页可展示);③ `onchain.processor.productInfo` 透传 feature;④ `blockchain.service.attestWithTianhe` 删除 `provider.attest(upload)` 调用,直接 publish(feature),raw 去掉 upload 痕迹。`TianheProvider.attest`(upload) 方法保留(AttestationProvider 接口所需 + 便于甲方后续加回,仅需在 attestWithTianhe 恢复两步调用)。dataHash 仍本地计算并展示(作品数据指纹,非天河链上存证)。构建+11 单测通过。分支未合并。
|
||||
|
||||
@@ -235,7 +235,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, h, onMounted, onUnmounted, reactive, ref, watch } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { NButton, NDropdown, NIcon, NTag, NText, type DataTableColumns, type DropdownOption } from 'naive-ui';
|
||||
import { SearchOutline, AddOutline, DownloadOutline, QrCodeOutline, FolderOutline, OpenOutline, EllipsisHorizontalOutline, FilterOutline, CopyOutline } from '@vicons/ionicons5';
|
||||
@@ -260,6 +260,7 @@ const emit = defineEmits<{
|
||||
|
||||
const { t } = useI18n();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const auth = useAuthStore();
|
||||
|
||||
const fixedArtworkId = computed(() => props.artworkId || null);
|
||||
@@ -363,8 +364,52 @@ const targetProof = computed<any>(() => outboundTarget.value?.latestProof ?? out
|
||||
const outboundModalTitle = computed(() => outboundMenuLabel(outboundTarget.value));
|
||||
|
||||
const columns = computed<DataTableColumns<any>>(() => {
|
||||
const base: DataTableColumns<any> = [
|
||||
const cols: DataTableColumns<any> = [
|
||||
{ type: 'selection' },
|
||||
// 追溯码:点击打开该码的 C 端溯源页
|
||||
{
|
||||
title: () => t('pages.traceCode.shortCode'),
|
||||
key: 'shortCode',
|
||||
width: 140,
|
||||
align: 'center',
|
||||
fixed: 'left',
|
||||
render: (r) =>
|
||||
h(
|
||||
'a',
|
||||
{ href: r.url, target: '_blank', rel: 'noopener', class: 'cell-link', title: t('pages.traceCode.openTrace') },
|
||||
r.shortCode,
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
// 名称 + 档案编号:点击跳到艺术品档案详情;档案内页(固定 artworkId)为同一作品,无需展示
|
||||
if (!fixedArtworkId.value) {
|
||||
cols.push(
|
||||
{
|
||||
title: () => t('pages.artwork.title'),
|
||||
key: 'artwork',
|
||||
minWidth: 180,
|
||||
ellipsis: { tooltip: true },
|
||||
render: (r) =>
|
||||
r.artwork
|
||||
? h('a', { class: 'cell-link', onClick: () => goArtwork(r.artwork.id) }, r.artwork.title || '-')
|
||||
: '-',
|
||||
},
|
||||
{
|
||||
title: () => t('pages.artwork.archiveNo'),
|
||||
key: 'archiveNo',
|
||||
width: 140,
|
||||
align: 'center',
|
||||
render: (r) =>
|
||||
r.artwork?.archiveNo
|
||||
? h('a', { class: 'cell-link', onClick: () => goArtwork(r.artwork.id) }, r.artwork.archiveNo)
|
||||
: '-',
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
cols.push(
|
||||
// 批次编号
|
||||
{
|
||||
title: () => renderFilterTitle(t('pages.traceCode.batchNo'), query.batchId, batchOptions.value, (value) => setHeaderFilter('batchId', value)),
|
||||
key: 'batch',
|
||||
@@ -372,6 +417,15 @@ const columns = computed<DataTableColumns<any>>(() => {
|
||||
align: 'center',
|
||||
render: (r) => r.batch?.batchNo || '-',
|
||||
},
|
||||
// 分组
|
||||
{
|
||||
title: () => renderFilterTitle(t('pages.traceCode.group'), query.groupId, groupFilterOptions.value, (value) => setHeaderFilter('groupId', value)),
|
||||
key: 'group',
|
||||
width: 110,
|
||||
align: 'center',
|
||||
render: (r) => r.group?.name || h(NText, { depth: 3 }, { default: () => t('pages.traceCode.noGroup') }),
|
||||
},
|
||||
// 出库状态
|
||||
{
|
||||
title: () =>
|
||||
renderFilterTitle(t('pages.traceCode.outboundStatus'), query.outboundStatus, outboundStatusOptions.value, (value) =>
|
||||
@@ -385,7 +439,7 @@ const columns = computed<DataTableColumns<any>>(() => {
|
||||
? h(NTag, { size: 'small', type: 'success' }, { default: () => t('pages.traceCode.outRegistered') })
|
||||
: h(NText, { depth: 3 }, { default: () => t('pages.traceCode.notOutbound') }),
|
||||
},
|
||||
{ title: () => t('pages.outbound.outTime'), key: 'outTime', width: 150, align: 'center', render: (r) => fmt(r.outTime), ...sortProps('outTime') },
|
||||
// 上链状态
|
||||
{
|
||||
title: () => t('pages.traceCode.onchainStatus'),
|
||||
key: 'onchainStatus',
|
||||
@@ -396,12 +450,25 @@ const columns = computed<DataTableColumns<any>>(() => {
|
||||
? h(NTag, { size: 'small', type: proofStatusType(r.latestAnyProof) }, { default: () => proofStatusText(r.latestAnyProof) })
|
||||
: h(NText, { depth: 3 }, { default: () => t('pages.traceCode.noOnchain') }),
|
||||
},
|
||||
{ title: () => t('pages.traceCode.shortCode'), key: 'shortCode', width: 120, align: 'center', ellipsis: { tooltip: true } },
|
||||
{ title: () => t('common.label.createdAt'), key: 'createdAt', width: 150, align: 'center', render: (r) => fmt(r.createdAt), ...sortProps('createdAt') },
|
||||
// 出库时间
|
||||
{ title: () => t('pages.outbound.outTime'), key: 'outTime', width: 150, align: 'center', render: (r) => fmt(r.outTime), ...sortProps('outTime') },
|
||||
// 激活状态
|
||||
{
|
||||
title: () => renderFilterTitle(t('pages.traceCode.activationStatus'), query.status, statusOptions, (value) => setHeaderFilter('status', value)),
|
||||
key: 'status',
|
||||
width: 108,
|
||||
align: 'center',
|
||||
render: (r) => h(NTag, { size: 'small', type: statusType(r.status) }, { default: () => t(`common.status.${r.status}`) }),
|
||||
},
|
||||
// 查询次数
|
||||
{ title: () => t('pages.traceCode.queryCount'), key: 'queryCount', width: 100, align: 'center' },
|
||||
// 激活时间
|
||||
{ title: () => t('pages.traceCode.firstActivatedAt'), key: 'firstActivatedAt', width: 150, align: 'center', render: (r) => fmt(r.firstActivatedAt), ...sortProps('firstActivatedAt') },
|
||||
// 链接
|
||||
{
|
||||
title: () => t('pages.traceCode.url'),
|
||||
key: 'url',
|
||||
minWidth: 420,
|
||||
minWidth: 360,
|
||||
ellipsis: { tooltip: true },
|
||||
render: (r) =>
|
||||
h(
|
||||
@@ -410,22 +477,9 @@ const columns = computed<DataTableColumns<any>>(() => {
|
||||
[r.url, h(NIcon, { component: OpenOutline, style: 'vertical-align:-2px;margin-left:4px' })],
|
||||
),
|
||||
},
|
||||
{
|
||||
title: () => renderFilterTitle(t('pages.traceCode.group'), query.groupId, groupFilterOptions.value, (value) => setHeaderFilter('groupId', value)),
|
||||
key: 'group',
|
||||
width: 110,
|
||||
align: 'center',
|
||||
render: (r) => r.group?.name || h(NText, { depth: 3 }, { default: () => t('pages.traceCode.noGroup') }),
|
||||
},
|
||||
{
|
||||
title: () => renderFilterTitle(t('common.label.status'), query.status, statusOptions, (value) => setHeaderFilter('status', value)),
|
||||
key: 'status',
|
||||
width: 108,
|
||||
align: 'center',
|
||||
render: (r) => h(NTag, { size: 'small', type: statusType(r.status) }, { default: () => t(`common.status.${r.status}`) }),
|
||||
},
|
||||
{ title: () => t('pages.traceCode.queryCount'), key: 'queryCount', width: 100, align: 'center' },
|
||||
{ title: () => t('pages.traceCode.firstActivatedAt'), key: 'firstActivatedAt', width: 150, align: 'center', render: (r) => fmt(r.firstActivatedAt), ...sortProps('firstActivatedAt') },
|
||||
// 创建时间
|
||||
{ title: () => t('common.label.createdAt'), key: 'createdAt', width: 150, align: 'center', render: (r) => fmt(r.createdAt), ...sortProps('createdAt') },
|
||||
// 操作
|
||||
{
|
||||
title: () => t('common.label.operation'),
|
||||
key: 'ops',
|
||||
@@ -451,19 +505,15 @@ const columns = computed<DataTableColumns<any>>(() => {
|
||||
: null,
|
||||
]),
|
||||
},
|
||||
];
|
||||
|
||||
if (!fixedArtworkId.value) {
|
||||
base.splice(
|
||||
4,
|
||||
0,
|
||||
{ title: () => t('pages.artwork.archiveNo'), key: 'archiveNo', width: 130, align: 'center', render: (r) => r.artwork?.archiveNo || '-' },
|
||||
{ title: () => t('pages.artwork.title'), key: 'artwork', minWidth: 180, ellipsis: { tooltip: true }, render: (r) => r.artwork?.title || '-' },
|
||||
);
|
||||
}
|
||||
return base;
|
||||
);
|
||||
return cols;
|
||||
});
|
||||
|
||||
function goArtwork(id?: number) {
|
||||
if (!id) return;
|
||||
router.push({ name: 'artwork-detail', params: { id: String(id) } });
|
||||
}
|
||||
|
||||
type HeaderFilterField = 'batchId' | 'groupId' | 'status' | 'outboundStatus';
|
||||
type HeaderFilterValue = string | number | null;
|
||||
type HeaderFilterOption = { label: string; value: string | number };
|
||||
@@ -1045,6 +1095,14 @@ onUnmounted(() => {
|
||||
.onchain-tip {
|
||||
margin-top: 4px;
|
||||
}
|
||||
.cell-link {
|
||||
color: var(--brand);
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
}
|
||||
.cell-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.onchain-mono {
|
||||
font-family: 'JetBrains Mono', Consolas, monospace;
|
||||
font-size: 12px;
|
||||
|
||||
@@ -383,7 +383,9 @@
|
||||
"url": "Link",
|
||||
"keywordPlaceholder": "Trace code / link / archive no. / name / artist / batch / group / note",
|
||||
"queryCount": "Queries",
|
||||
"firstActivatedAt": "First Activated",
|
||||
"firstActivatedAt": "Activated At",
|
||||
"activationStatus": "Activation",
|
||||
"openTrace": "Open trace page",
|
||||
"exportBatch": "Export Batch",
|
||||
"exportCurrent": "Current filter",
|
||||
"bindArtwork": "Link Artwork File",
|
||||
|
||||
@@ -383,7 +383,9 @@
|
||||
"url": "链接",
|
||||
"keywordPlaceholder": "追溯码 / 链接 / 档案编号 / 名称 / 艺术家 / 批次 / 分组 / 备注",
|
||||
"queryCount": "查询次数",
|
||||
"firstActivatedAt": "首次激活时间",
|
||||
"firstActivatedAt": "激活时间",
|
||||
"activationStatus": "激活状态",
|
||||
"openTrace": "打开溯源页",
|
||||
"exportBatch": "导出本批",
|
||||
"exportCurrent": "当前筛选",
|
||||
"bindArtwork": "关联作品档案",
|
||||
|
||||
Reference in New Issue
Block a user