refactor: 合并追溯码上链入口
This commit is contained in:
@@ -97,7 +97,7 @@
|
||||
- 后台全局页脚(2026-07-03):`MainLayout.vue` 在登录后的管理后台底部统一增加页脚,先放置版权年份和“备案信息待补充”占位,后续版权/ICP备案/公安备案只改全局布局即可;全局 CSS 新增 `--admin-header-height` / `--admin-footer-height`,内容区和 `table-page` 高度统一扣除页脚高度,避免列表分页被页脚遮挡或挤出。
|
||||
- 查询日志列表单行展示(2026-07-04):`QueryLogs.vue` 中短码、档案编号、批次编号、IP、设备信息列使用 Naive UI `ellipsis: { tooltip: true }`,列表内保持单行省略,鼠标悬浮查看完整内容;已浏览器测量设备信息列为 `white-space: nowrap` / `text-overflow: ellipsis`,避免设备信息换行拉高行高。
|
||||
- 批次与追溯码管理增强(2026-07-04):艺术品批次管理页上方摘要新增批次数量统计(`ArtworkService.get` 的 `codeStats.batchTotal`);`TraceCodePanel` 操作列固定为二维码按钮 + 悬停操作菜单,单码支持修改分组、移动到同作品其他批次、启用/禁用、删除。后端新增 `PUT /trace-codes/:id` 与 `DELETE /trace-codes/:id`;移动批次会维护源/目标批次 `generatedCount`,删除单码会先把查询日志的 `traceCodeId` 置空保留日志快照,再删除码并扣减批次生成数。
|
||||
- 追溯码管理闭环增强(2026-07-04):根据 PRD §6.4,将“出库/上链”内聚到艺术品档案下的追溯码管理页。`TraceCodePanel` 列表新增出库状态、出库时间、上链状态列;行操作菜单新增“登记出库/上链”和“触发上链”,批量条新增批量上链。登记弹窗复用现有出库单条录入能力(出库时间、实况图、备注、手工上链哈希/时间/区块高度),仍写入 `TraceCode` 与 `BlockchainProof`;触发上链仍走 `POST /trace-codes/:id/onchain`。批次修改弹窗合并为一个 `n-select tag` 控件,可下拉选择已有批次或直接输入新批次编号自动创建;后端 `PUT /trace-codes/:id` 与 `PUT /trace-codes/batch/move` 支持 `batchNo` 并维护源/目标批次 `quantity/generatedCount`。艺术品追溯码页下方表格卡片去掉重复标题,仅保留页面顶部“追溯码管理”。
|
||||
- 追溯码管理闭环增强(2026-07-04):根据 PRD §6.4,将“出库/上链”内聚到艺术品档案下的追溯码管理页。`TraceCodePanel` 列表新增出库状态、出库时间、上链状态列;行操作菜单只保留“登记出库/上链”,避免“触发上链”作为孤立动作散落在列表。登记弹窗复用现有出库单条录入能力(出库时间、实况图、备注、手工上链哈希/时间/区块高度),底部提供“保存登记”和“保存并触发上链”:前者仅保存出库/手工存证结果,后者保存后再走 `POST /trace-codes/:id/onchain` 创建队列存证任务。批次修改弹窗合并为一个 `n-select tag` 控件,可下拉选择已有批次或直接输入新批次编号自动创建;后端 `PUT /trace-codes/:id` 与 `PUT /trace-codes/batch/move` 支持 `batchNo` 并维护源/目标批次 `quantity/generatedCount`。艺术品追溯码页下方表格卡片去掉重复标题,仅保留页面顶部“追溯码管理”。
|
||||
- 后台最小工作区尺寸(2026-07-04):为避免浏览器窗口过小时后台页面被压缩到表格不可见,`MainLayout.vue` 与全局 `styles.css` 新增 `--admin-min-width: 1120px`、`--admin-min-height: 680px` 和 `--admin-content-height`。管理后台根布局设置最小宽高,小于该尺寸时由浏览器外层滚动承载;正常尺寸下列表页仍保持“工具栏/表格内部滚动/底部分页”的固定布局。
|
||||
- 后台列表横向滚动(2026-07-04):主数据表(艺术品档案、模板、内容审核、查询日志、用户、追溯码面板)统一给 `n-data-table` 设置 `scroll-x`,并为弹性文本列补明确宽度与必要的 `ellipsis`,避免浏览器宽度不足或字段过多时列被强行压缩、操作列消失;横向滚动发生在列表内部,纵向仍保持表体内滚动与底部分页固定。
|
||||
- 后台操作列约定(2026-07-04):主列表的操作列统一 `fixed: 'right'` 且 `align: 'center'`,表头和内容居中;全局 `.table-fill` 为 Naive UI 右固定列补不透明表头/单元格背景与左侧阴影分隔,避免横向滚动时固定操作列透明叠在其他字段上。
|
||||
|
||||
@@ -63,7 +63,6 @@
|
||||
</n-button>
|
||||
</n-dropdown>
|
||||
<n-button size="small" @click="openBatchModal()">{{ t('pages.traceCode.batchMove') }}</n-button>
|
||||
<n-button size="small" @click="batchOnchain">{{ t('pages.traceCode.batchOnchain') }}</n-button>
|
||||
<n-button size="small" @click="batchStatus(false)">{{ t('pages.traceCode.batchEnable') }}</n-button>
|
||||
<n-button size="small" type="warning" @click="batchStatus(true)">{{ t('pages.traceCode.batchDisable') }}</n-button>
|
||||
</n-space>
|
||||
@@ -197,7 +196,8 @@
|
||||
<template #footer>
|
||||
<div style="text-align: right">
|
||||
<n-button class="mr8" @click="outboundModal = false">{{ t('common.action.cancel') }}</n-button>
|
||||
<n-button type="primary" :loading="outboundSaving" @click="saveOutbound">{{ t('common.action.save') }}</n-button>
|
||||
<n-button class="mr8" :loading="outboundSaving" @click="saveOutbound(false)">{{ t('pages.outbound.saveRecord') }}</n-button>
|
||||
<n-button type="primary" :loading="outboundTriggering" @click="saveOutbound(true)">{{ t('pages.outbound.saveAndTriggerOnchain') }}</n-button>
|
||||
</div>
|
||||
</template>
|
||||
</n-modal>
|
||||
@@ -293,6 +293,7 @@ const batchTarget = ref<any | null>(null);
|
||||
const batchForm = reactive<{ batchValue: number | string | null }>({ batchValue: null });
|
||||
const outboundModal = ref(false);
|
||||
const outboundSaving = ref(false);
|
||||
const outboundTriggering = ref(false);
|
||||
const outboundTarget = ref<any | null>(null);
|
||||
const outImages = ref<any[]>([]);
|
||||
const outboundForm = reactive<any>({
|
||||
@@ -529,22 +530,11 @@ async function batchStatus(disabled: boolean) {
|
||||
emit('changed');
|
||||
}
|
||||
|
||||
async function batchOnchain() {
|
||||
for (const id of checkedKeys.value.map(String)) {
|
||||
await traceCodeApi.onchain(id);
|
||||
}
|
||||
message.success(t('pages.blockchain.triggered'));
|
||||
checkedKeys.value = [];
|
||||
await load();
|
||||
emit('changed');
|
||||
}
|
||||
|
||||
function rowActionOptions(row: any): DropdownOption[] {
|
||||
return [
|
||||
{ label: t('pages.traceCode.changeGroup'), key: 'changeGroup', children: rowGroupOptions.value },
|
||||
{ label: t('pages.traceCode.changeBatch'), key: 'batch:open' },
|
||||
{ label: t('pages.traceCode.registerOutbound'), key: 'outbound:open' },
|
||||
{ label: t('pages.blockchain.trigger'), key: 'onchain' },
|
||||
{ type: 'divider', key: 'divider-1' },
|
||||
{
|
||||
label: row.status === TraceCodeStatus.DISABLED ? t('pages.traceCode.enableOne') : t('pages.traceCode.disableOne'),
|
||||
@@ -574,14 +564,6 @@ async function onRowAction(row: any, key: string) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (key === 'onchain') {
|
||||
await traceCodeApi.onchain(String(row.id));
|
||||
message.success(t('pages.blockchain.triggered'));
|
||||
await load();
|
||||
emit('changed');
|
||||
return;
|
||||
}
|
||||
|
||||
if (key === 'status:disable' || key === 'status:enable') {
|
||||
await traceCodeApi.update(String(row.id), { disabled: key === 'status:disable' });
|
||||
message.success(t('common.msg.operationSuccess'));
|
||||
@@ -659,9 +641,13 @@ function openOutboundModal(row: any) {
|
||||
outboundModal.value = true;
|
||||
}
|
||||
|
||||
async function saveOutbound() {
|
||||
async function saveOutbound(triggerOnchain: boolean) {
|
||||
if (!outboundTarget.value) return;
|
||||
outboundSaving.value = true;
|
||||
if (triggerOnchain) {
|
||||
outboundTriggering.value = true;
|
||||
} else {
|
||||
outboundSaving.value = true;
|
||||
}
|
||||
try {
|
||||
await outboundApi.updateSingle(String(outboundTarget.value.id), {
|
||||
outTime: outboundForm.outTime ? dayjs(outboundForm.outTime).toISOString() : null,
|
||||
@@ -671,6 +657,9 @@ async function saveOutbound() {
|
||||
blockHeight: outboundForm.blockHeight ?? undefined,
|
||||
remark: outboundForm.remark || null,
|
||||
});
|
||||
if (triggerOnchain) {
|
||||
await traceCodeApi.onchain(String(outboundTarget.value.id));
|
||||
}
|
||||
message.success(t('common.msg.saved'));
|
||||
outboundModal.value = false;
|
||||
outboundTarget.value = null;
|
||||
@@ -678,6 +667,7 @@ async function saveOutbound() {
|
||||
emit('changed');
|
||||
} finally {
|
||||
outboundSaving.value = false;
|
||||
outboundTriggering.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -261,7 +261,6 @@
|
||||
"groupName": "Group Name",
|
||||
"batchGroup": "Set Group",
|
||||
"batchMove": "Move Batch",
|
||||
"batchOnchain": "Batch On-chain",
|
||||
"batchEnable": "Enable",
|
||||
"batchDisable": "Disable",
|
||||
"changeGroup": "Change Group",
|
||||
@@ -291,6 +290,8 @@
|
||||
"selectCodePlaceholder": "Search by short code / trace code / archive no.",
|
||||
"onchainSection": "On-chain info (optional; filling a hash records the result)",
|
||||
"txHashTip": "Paste the on-chain transaction/attestation hash",
|
||||
"saveRecord": "Save Record",
|
||||
"saveAndTriggerOnchain": "Save & Trigger On-chain",
|
||||
"selectFile": "Select File",
|
||||
"importing": "Importing…",
|
||||
"importResult": "Import Result",
|
||||
|
||||
@@ -261,7 +261,6 @@
|
||||
"groupName": "分组名称",
|
||||
"batchGroup": "批量分组",
|
||||
"batchMove": "批量修改批次",
|
||||
"batchOnchain": "批量上链",
|
||||
"batchEnable": "批量启用",
|
||||
"batchDisable": "批量停用",
|
||||
"changeGroup": "修改分组",
|
||||
@@ -291,6 +290,8 @@
|
||||
"selectCodePlaceholder": "输入短码 / 追溯码 / 档案号搜索",
|
||||
"onchainSection": "上链信息(选填,填写哈希即登记上链结果)",
|
||||
"txHashTip": "粘贴链上交易/存证哈希",
|
||||
"saveRecord": "保存登记",
|
||||
"saveAndTriggerOnchain": "保存并触发上链",
|
||||
"selectFile": "选择文件",
|
||||
"importing": "导入中…",
|
||||
"importResult": "导入结果",
|
||||
|
||||
Reference in New Issue
Block a user