feat: 拆分上链与出库管理界面
This commit is contained in:
@@ -1,6 +1,21 @@
|
||||
import { get, post, put, del, download } from './request';
|
||||
import type { PageResult } from '@artveris/shared';
|
||||
|
||||
export interface TraceCodeFilters {
|
||||
keyword?: string;
|
||||
artworkId?: number;
|
||||
batchId?: number;
|
||||
groupId?: number;
|
||||
status?: string;
|
||||
activated?: boolean;
|
||||
outboundStatus?: string;
|
||||
proofStatus?: string;
|
||||
}
|
||||
|
||||
export type BatchSelection =
|
||||
| { mode: 'IDS'; ids: string[] }
|
||||
| { mode: 'FILTER'; filters: TraceCodeFilters; excludeIds: string[] };
|
||||
|
||||
export interface LoginResult {
|
||||
token: string;
|
||||
user: { id: number; username: string; realName?: string; role: string };
|
||||
@@ -61,13 +76,8 @@ export const artworkApi = {
|
||||
remove: (id: number) => del(`/artworks/${id}`),
|
||||
// nodes
|
||||
listNodes: (artworkId: number) => get<any[]>(`/artworks/${artworkId}/nodes`),
|
||||
createNode: (artworkId: number, data: object) => post(`/artworks/${artworkId}/nodes`, data),
|
||||
updateNode: (id: number, data: object) => put(`/nodes/${id}`, data),
|
||||
removeNode: (id: number) => del(`/nodes/${id}`),
|
||||
// certificates
|
||||
listCerts: (artworkId: number) => get<any[]>(`/artworks/${artworkId}/certificates`),
|
||||
createCert: (artworkId: number, data: object) => post(`/artworks/${artworkId}/certificates`, data),
|
||||
removeCert: (id: number) => del(`/certificates/${id}`),
|
||||
// audit
|
||||
audit: (id: number, data: { approved: boolean; remark?: string }) => post(`/artworks/${id}/audit`, data),
|
||||
};
|
||||
@@ -83,7 +93,6 @@ export const traceCodeApi = {
|
||||
batchDelete: (ids: string[]) => post('/trace-codes/batch/delete', { ids }),
|
||||
qrUrl: (id: string) => `/api/trace-codes/${id}/qrcode`,
|
||||
qrBlob: (id: string) => download(`/trace-codes/${id}/qrcode`),
|
||||
onchain: (id: string) => post(`/trace-codes/${id}/onchain`, {}),
|
||||
confirmProof: (id: number) => post(`/blockchain-proofs/${id}/confirm`, {}),
|
||||
previewToken: () => get<{ token: string; clientBase: string; periodMs: number }>('/trace-codes/preview-token'),
|
||||
// 分组
|
||||
@@ -99,10 +108,38 @@ export const traceCodeApi = {
|
||||
put('/trace-codes/batch/move', { ids, ...data }),
|
||||
batchStatus: (ids: string[], disabled: boolean) =>
|
||||
put('/trace-codes/batch/status', { ids, disabled }),
|
||||
match: (codes: string[], operation: 'ONCHAIN' | 'OUTBOUND') =>
|
||||
post<{
|
||||
matched: any[];
|
||||
missing: string[];
|
||||
duplicates: string[];
|
||||
}>('/trace-codes/match', { codes, operation }),
|
||||
};
|
||||
|
||||
export const onchainApi = {
|
||||
createJob: (selection: BatchSelection) => post('/blockchain/onchain-jobs', { selection }),
|
||||
resync: (chunkId: string) => post(`/blockchain/onchain-chunks/${chunkId}/resync`, {}),
|
||||
markFailed: (chunkId: string, reason: string) =>
|
||||
post(`/blockchain/onchain-chunks/${chunkId}/mark-failed`, { reason }),
|
||||
recordTransaction: (proofId: number, txHash: string) =>
|
||||
post(`/blockchain-proofs/${proofId}/transaction`, { txHash }),
|
||||
};
|
||||
|
||||
export const outboundApi = {
|
||||
updateSingle: (id: string, data: object) => put(`/outbound/trace-codes/${id}`, data),
|
||||
getRecord: (id: string, silent = false) =>
|
||||
get(`/outbound/${id}`, undefined, { silentError: silent }),
|
||||
updateRecord: (id: string, data: { outTime: string; remark?: string | null }) =>
|
||||
put(`/outbound/${id}`, data),
|
||||
createJob: (selection: BatchSelection, outTime: string, remark?: string) =>
|
||||
post('/outbound/jobs', { selection, outTime, remark: remark || undefined }),
|
||||
images: (id: string, params: { page: number; pageSize: number }) =>
|
||||
get<{ items: any[]; total: number; page: number; pageSize: number }>(`/outbound/${id}/images`, params),
|
||||
uploadImage: (id: string, data: FormData) =>
|
||||
post(`/outbound/${id}/images`, data, { timeout: 0 }),
|
||||
removeImage: (id: string, imageId: string) =>
|
||||
del(`/outbound/${id}/images/${imageId}`),
|
||||
moveImage: (id: string, imageId: string, direction: 'UP' | 'DOWN') =>
|
||||
put(`/outbound/${id}/images/${imageId}/move`, { direction }),
|
||||
templateUrl: '/api/outbound/import/template',
|
||||
preview: (data: FormData) => post('/outbound/import/preview', data, { timeout: 0 }),
|
||||
requestSession: (requestId: string, silent = false) =>
|
||||
@@ -124,6 +161,12 @@ export const auditApi = {
|
||||
export const jobApi = {
|
||||
get: (id: string, silent = false) => get(`/jobs/${id}`, undefined, { silentError: silent }),
|
||||
list: (params: object) => get<PageResult<any>>('/jobs', params),
|
||||
items: (id: string, params: { page: number; pageSize: number; status?: string }, silent = false) =>
|
||||
get<{ items?: any[]; list?: any[]; total: number; page: number; pageSize: number }>(
|
||||
`/jobs/${id}/items`,
|
||||
params,
|
||||
{ silentError: silent },
|
||||
),
|
||||
};
|
||||
|
||||
export const queryLogApi = {
|
||||
|
||||
@@ -0,0 +1,264 @@
|
||||
<template>
|
||||
<n-modal v-model:show="visible" preset="card" :title="title" class="batch-job-modal">
|
||||
<n-space v-if="job" align="center" wrap class="job-summary">
|
||||
<n-statistic :label="t('pages.operations.total')" :value="jobTotal" />
|
||||
<n-statistic :label="t('pages.operations.success')" :value="successCount" />
|
||||
<n-statistic :label="t('pages.operations.failed')" :value="failCount" />
|
||||
<n-statistic :label="t('pages.operations.skipped')" :value="skippedCount" />
|
||||
<n-tag :type="statusType(job.status)">{{ statusText(job.status) }}</n-tag>
|
||||
</n-space>
|
||||
|
||||
<n-progress
|
||||
v-if="job && !terminal"
|
||||
type="line"
|
||||
:percentage="progress"
|
||||
:indicator-placement="'inside'"
|
||||
processing
|
||||
class="job-progress"
|
||||
/>
|
||||
|
||||
<div class="result-toolbar">
|
||||
<n-select
|
||||
v-model:value="itemStatus"
|
||||
:options="itemStatusOptions"
|
||||
clearable
|
||||
:placeholder="t('pages.operations.allResults')"
|
||||
class="status-select"
|
||||
@update:value="reloadItems"
|
||||
/>
|
||||
<div class="spacer" />
|
||||
<n-button quaternary circle :loading="loading" :title="t('common.action.refresh')" @click="refresh">
|
||||
<template #icon><n-icon :component="RefreshOutline" /></template>
|
||||
</n-button>
|
||||
</div>
|
||||
|
||||
<n-data-table
|
||||
:columns="columns"
|
||||
:data="items"
|
||||
:loading="loading"
|
||||
:pagination="false"
|
||||
:row-key="(row) => row.id || `${row.shortCode}-${row.status}`"
|
||||
:scroll-x="760"
|
||||
size="small"
|
||||
max-height="360"
|
||||
virtual-scroll
|
||||
/>
|
||||
<div class="modal-pagination">
|
||||
<n-pagination
|
||||
v-model:page="page"
|
||||
:page-size="pageSize"
|
||||
:item-count="itemTotal"
|
||||
:disabled="loading"
|
||||
@update:page="loadItems"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<template #footer>
|
||||
<div class="footer-actions">
|
||||
<n-button @click="visible = false">{{ t('common.action.close') }}</n-button>
|
||||
</div>
|
||||
</template>
|
||||
</n-modal>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, h, onUnmounted, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { NIcon, NTag, NText, type DataTableColumns } from 'naive-ui';
|
||||
import { RefreshOutline } from '@vicons/ionicons5';
|
||||
import { jobApi } from '@/api';
|
||||
import { fmt, statusType } from '@/utils/format';
|
||||
import { localizeOperationReason } from '@/utils/operationReason';
|
||||
|
||||
const props = defineProps<{
|
||||
show: boolean;
|
||||
jobId: string;
|
||||
title: string;
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
(event: 'update:show', value: boolean): void;
|
||||
(event: 'completed'): void;
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
const visible = computed({
|
||||
get: () => props.show,
|
||||
set: (value) => emit('update:show', value),
|
||||
});
|
||||
const job = ref<any>(null);
|
||||
const items = ref<any[]>([]);
|
||||
const loading = ref(false);
|
||||
const page = ref(1);
|
||||
const pageSize = 20;
|
||||
const itemTotal = ref(0);
|
||||
const itemStatus = ref<string | null>(null);
|
||||
let timer: ReturnType<typeof setTimeout> | undefined;
|
||||
let completedEmitted = false;
|
||||
|
||||
const terminalStatuses = new Set(['SUCCESS', 'PARTIAL', 'FAILED', 'CANCELLED']);
|
||||
const terminal = computed(() => terminalStatuses.has(String(job.value?.status || '')));
|
||||
const jobTotal = computed(() => Number(job.value?.total || itemTotal.value || 0));
|
||||
const successCount = computed(() => Number(job.value?.successCount || 0));
|
||||
const failCount = computed(() => Number(job.value?.failCount || 0));
|
||||
const skippedCount = computed(() => {
|
||||
if (job.value?.skippedCount !== undefined) return Number(job.value.skippedCount || 0);
|
||||
return terminal.value ? Math.max(0, jobTotal.value - successCount.value - failCount.value) : 0;
|
||||
});
|
||||
const progress = computed(() => {
|
||||
const total = jobTotal.value;
|
||||
if (!total) return terminal.value ? 100 : 0;
|
||||
const done = successCount.value + failCount.value + skippedCount.value;
|
||||
return Math.min(100, Math.round((done / total) * 100));
|
||||
});
|
||||
|
||||
const itemStatusOptions = computed(() =>
|
||||
['PENDING', 'PROCESSING', 'SUCCESS', 'FAILED', 'SKIPPED', 'UNKNOWN'].map((value) => ({
|
||||
value,
|
||||
label: t(`pages.operations.itemStatus.${value}`),
|
||||
})),
|
||||
);
|
||||
|
||||
const columns = computed<DataTableColumns<any>>(() => [
|
||||
{
|
||||
title: t('pages.traceCode.shortCode'),
|
||||
key: 'shortCode',
|
||||
width: 150,
|
||||
align: 'center',
|
||||
render: (row) => row.shortCode || row.payload?.shortCode || '-',
|
||||
},
|
||||
{
|
||||
title: t('common.label.status'),
|
||||
key: 'status',
|
||||
width: 120,
|
||||
align: 'center',
|
||||
render: (row) =>
|
||||
h(NTag, { size: 'small', type: statusType(row.status) }, {
|
||||
default: () => t(`pages.operations.itemStatus.${row.status}`),
|
||||
}),
|
||||
},
|
||||
{
|
||||
title: t('pages.operations.processedAt'),
|
||||
key: 'updatedAt',
|
||||
width: 170,
|
||||
align: 'center',
|
||||
render: (row) => fmt(row.processedAt || row.updatedAt),
|
||||
},
|
||||
{
|
||||
title: t('pages.operations.resultReason'),
|
||||
key: 'reason',
|
||||
minWidth: 300,
|
||||
ellipsis: { tooltip: true },
|
||||
render: (row) => {
|
||||
const reason = localizeOperationReason(row.reason || row.result?.reason || row.error);
|
||||
return reason || h(NText, { depth: 3 }, { default: () => '-' });
|
||||
},
|
||||
},
|
||||
]);
|
||||
|
||||
function statusText(status?: string) {
|
||||
if (!status) return '-';
|
||||
const key = `pages.operations.jobStatus.${status}`;
|
||||
const translated = t(key);
|
||||
return translated === key ? status : translated;
|
||||
}
|
||||
|
||||
function stopPolling() {
|
||||
if (timer) clearTimeout(timer);
|
||||
timer = undefined;
|
||||
}
|
||||
|
||||
function schedulePoll() {
|
||||
stopPolling();
|
||||
if (!visible.value || terminal.value) return;
|
||||
timer = setTimeout(() => void refresh(), 1200);
|
||||
}
|
||||
|
||||
async function loadItems() {
|
||||
if (!props.jobId) return;
|
||||
try {
|
||||
const result: any = await jobApi.items(
|
||||
props.jobId,
|
||||
{ page: page.value, pageSize, status: itemStatus.value || undefined },
|
||||
true,
|
||||
);
|
||||
items.value = result.items || result.list || [];
|
||||
itemTotal.value = Number(result.total || 0);
|
||||
} catch {
|
||||
// 任务刚创建时逐项结果可能尚未初始化,下一轮轮询会自动补齐。
|
||||
}
|
||||
}
|
||||
|
||||
function reloadItems() {
|
||||
page.value = 1;
|
||||
void loadItems();
|
||||
}
|
||||
|
||||
async function refresh() {
|
||||
if (!props.jobId || loading.value) return;
|
||||
loading.value = true;
|
||||
try {
|
||||
const nextJob = await jobApi.get(props.jobId, true);
|
||||
job.value = nextJob;
|
||||
await loadItems();
|
||||
if (terminal.value && !completedEmitted) {
|
||||
completedEmitted = true;
|
||||
emit('completed');
|
||||
}
|
||||
} catch {
|
||||
// 临时网络异常不终止任务跟踪。
|
||||
} finally {
|
||||
loading.value = false;
|
||||
schedulePoll();
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => [props.show, props.jobId] as const,
|
||||
([show, id]) => {
|
||||
stopPolling();
|
||||
if (!show || !id) return;
|
||||
completedEmitted = false;
|
||||
job.value = null;
|
||||
items.value = [];
|
||||
itemTotal.value = 0;
|
||||
page.value = 1;
|
||||
itemStatus.value = null;
|
||||
void refresh();
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
|
||||
onUnmounted(stopPolling);
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.batch-job-modal {
|
||||
width: min(900px, calc(100vw - 32px));
|
||||
}
|
||||
.job-summary {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.job-progress {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.result-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.status-select {
|
||||
width: 180px;
|
||||
}
|
||||
.spacer {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
.modal-pagination,
|
||||
.footer-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
.modal-pagination {
|
||||
padding-top: 12px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,279 @@
|
||||
<template>
|
||||
<n-modal v-model:show="visible" preset="card" :title="t('pages.blockchain.title')" class="proof-modal">
|
||||
<n-descriptions :column="1" label-placement="left" bordered size="small">
|
||||
<n-descriptions-item :label="t('pages.traceCode.shortCode')">
|
||||
{{ traceCode?.shortCode || '-' }}
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item :label="t('pages.artwork.title')">
|
||||
{{ traceCode?.artwork?.title || '-' }}
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item :label="t('pages.blockchain.status')">
|
||||
<n-tag v-if="proof" size="small" :type="statusType(proof.status)">{{ proofStatusText }}</n-tag>
|
||||
<n-text v-else depth="3">{{ t('pages.traceCode.noOnchain') }}</n-text>
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item v-if="proof?.txHash" :label="t('pages.blockchain.txHash')">
|
||||
<copyable-value :value="proof.txHash" />
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item v-if="proof?.chainName" :label="t('pages.blockchain.chainName')">
|
||||
{{ proof.chainName }}
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item v-if="proof?.blockHeight" :label="t('pages.blockchain.blockHeight')">
|
||||
<copyable-value :value="proof.blockHeight" />
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item v-if="proof?.contractAddress" :label="t('pages.blockchain.contract')">
|
||||
<copyable-value :value="proof.contractAddress" />
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item v-if="proof?.onchainAt" :label="t('pages.blockchain.onchainAt')">
|
||||
{{ fmt(proof.onchainAt) }}
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item v-if="proof?.explorerUrl" :label="t('pages.blockchain.explorer')">
|
||||
<a :href="proof.explorerUrl" target="_blank" rel="noopener" class="proof-link">
|
||||
{{ t('pages.blockchain.openExplorer') }}
|
||||
<n-icon :component="OpenOutline" />
|
||||
</a>
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item v-if="failureReason" :label="t('pages.operations.resultReason')">
|
||||
<n-text type="error">{{ failureReason }}</n-text>
|
||||
</n-descriptions-item>
|
||||
</n-descriptions>
|
||||
|
||||
<n-alert v-if="isUnknown" type="warning" :bordered="false" class="unknown-alert">
|
||||
{{ t('pages.blockchain.unknownTip') }}
|
||||
</n-alert>
|
||||
<n-alert v-else-if="unavailableReason" type="warning" :bordered="false" class="unknown-alert">
|
||||
{{ unavailableReason }}
|
||||
</n-alert>
|
||||
|
||||
<template #footer>
|
||||
<div class="footer-actions">
|
||||
<template v-if="auth.canWrite">
|
||||
<n-button v-if="canRun" type="primary" :loading="working" @click="runOnchain">
|
||||
{{ proof?.status === 'FAILED' ? t('pages.blockchain.retry') : t('pages.blockchain.trigger') }}
|
||||
</n-button>
|
||||
<n-button v-if="canConfirm" :loading="working" @click="confirmProof">
|
||||
{{ t('pages.traceCode.reconfirmOnchain') }}
|
||||
</n-button>
|
||||
<template v-if="isUnknown">
|
||||
<n-button v-if="proof?.onchainChunkId" :loading="working" @click="resync">
|
||||
{{ t('pages.blockchain.resync') }}
|
||||
</n-button>
|
||||
<n-popover v-if="proof?.onchainChunkId" trigger="click" placement="top-end">
|
||||
<template #trigger>
|
||||
<n-button>{{ t('pages.blockchain.recordTransaction') }}</n-button>
|
||||
</template>
|
||||
<div class="proof-action-form">
|
||||
<n-input v-model:value="transactionHash" :maxlength="191" :placeholder="t('pages.blockchain.txHash')" />
|
||||
<n-button type="primary" :disabled="transactionHash.trim().length < 8" :loading="working" @click="recordTransaction">
|
||||
{{ t('common.action.confirm') }}
|
||||
</n-button>
|
||||
</div>
|
||||
</n-popover>
|
||||
<n-popover v-if="auth.isSuperAdmin && proof?.id && proof?.onchainChunkId" trigger="click" placement="top-end">
|
||||
<template #trigger>
|
||||
<n-button type="error">{{ t('pages.blockchain.markFailed') }}</n-button>
|
||||
</template>
|
||||
<div class="proof-action-form">
|
||||
<n-input v-model:value="failedReason" :maxlength="2000" :placeholder="t('pages.operations.resultReason')" />
|
||||
<n-button type="error" :disabled="failedReason.trim().length < 5" :loading="working" @click="markFailed">
|
||||
{{ t('common.action.confirm') }}
|
||||
</n-button>
|
||||
</div>
|
||||
</n-popover>
|
||||
</template>
|
||||
</template>
|
||||
<n-button @click="visible = false">{{ t('common.action.close') }}</n-button>
|
||||
</div>
|
||||
</template>
|
||||
</n-modal>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, defineComponent, h, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { NButton, NIcon } from 'naive-ui';
|
||||
import { CopyOutline, OpenOutline } from '@vicons/ionicons5';
|
||||
import { onchainApi, traceCodeApi } from '@/api';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { fmt, statusType } from '@/utils/format';
|
||||
import { dialog, message } from '@/utils/feedback';
|
||||
import { localizeOperationReason } from '@/utils/operationReason';
|
||||
|
||||
const props = defineProps<{
|
||||
show: boolean;
|
||||
traceCode: any | null;
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
(event: 'update:show', value: boolean): void;
|
||||
(event: 'run', traceCode: any): void;
|
||||
(event: 'changed'): void;
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
const auth = useAuthStore();
|
||||
const visible = computed({
|
||||
get: () => props.show,
|
||||
set: (value) => emit('update:show', value),
|
||||
});
|
||||
const proof = computed(() => props.traceCode?.latestAnyProof || props.traceCode?.proof || null);
|
||||
const working = ref(false);
|
||||
const transactionHash = ref('');
|
||||
const failedReason = ref('');
|
||||
|
||||
const proofStatusText = computed(() => {
|
||||
const status = proof.value?.status;
|
||||
if (!status) return '-';
|
||||
const key = `common.status.${status}`;
|
||||
const translated = t(key);
|
||||
return translated === key ? status : translated;
|
||||
});
|
||||
const isUnknown = computed(() => proof.value?.status === 'UNKNOWN');
|
||||
const canRun = computed(() => {
|
||||
const eligible = props.traceCode?.onchainEligible ?? props.traceCode?.eligible;
|
||||
return eligible !== false && (!proof.value || proof.value.status === 'FAILED');
|
||||
});
|
||||
const canConfirm = computed(() =>
|
||||
Boolean(proof.value?.id && proof.value?.txHash && proof.value.status === 'CONFIRMING'),
|
||||
);
|
||||
const failureReason = computed(() => {
|
||||
const raw = proof.value?.rawResponse;
|
||||
return localizeOperationReason(
|
||||
proof.value?.failureReason || proof.value?.reason || proof.value?.error || raw?.error || raw?.message || raw?.enqueueError,
|
||||
);
|
||||
});
|
||||
const unavailableReason = computed(() =>
|
||||
!proof.value && !canRun.value
|
||||
? localizeOperationReason(props.traceCode?.onchainReason || props.traceCode?.reason) || t('pages.operations.onchainUnavailable')
|
||||
: '',
|
||||
);
|
||||
|
||||
const CopyableValue = defineComponent({
|
||||
props: { value: { type: [String, Number], required: true } },
|
||||
setup(componentProps) {
|
||||
return () => h('span', { class: 'copyable-value' }, [
|
||||
h('span', { class: 'copyable-text' }, String(componentProps.value)),
|
||||
h(
|
||||
NButton,
|
||||
{
|
||||
quaternary: true,
|
||||
circle: true,
|
||||
size: 'tiny',
|
||||
title: t('common.action.copy'),
|
||||
onClick: () => copyValue(componentProps.value),
|
||||
},
|
||||
{ icon: () => h(NIcon, null, { default: () => h(CopyOutline) }) },
|
||||
),
|
||||
]);
|
||||
},
|
||||
});
|
||||
|
||||
async function copyValue(value: unknown) {
|
||||
try {
|
||||
await navigator.clipboard.writeText(String(value));
|
||||
message.success(t('common.msg.copied'));
|
||||
} catch {
|
||||
message.error(t('common.msg.copyFailed'));
|
||||
}
|
||||
}
|
||||
|
||||
function runOnchain() {
|
||||
if (!props.traceCode) return;
|
||||
emit('run', props.traceCode);
|
||||
}
|
||||
|
||||
async function execute(action: () => Promise<unknown>) {
|
||||
if (working.value) return;
|
||||
working.value = true;
|
||||
try {
|
||||
await action();
|
||||
message.success(t('common.msg.operationSuccess'));
|
||||
visible.value = false;
|
||||
emit('changed');
|
||||
} finally {
|
||||
working.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function confirmProof() {
|
||||
if (!proof.value?.id) return;
|
||||
void execute(() => traceCodeApi.confirmProof(Number(proof.value.id)));
|
||||
}
|
||||
|
||||
function resync() {
|
||||
if (!proof.value?.onchainChunkId) return;
|
||||
void execute(() => onchainApi.resync(String(proof.value.onchainChunkId)));
|
||||
}
|
||||
|
||||
function recordTransaction() {
|
||||
if (!proof.value?.id || transactionHash.value.trim().length < 8) return;
|
||||
void execute(() => onchainApi.recordTransaction(Number(proof.value.id), transactionHash.value.trim()));
|
||||
}
|
||||
|
||||
function markFailed() {
|
||||
if (!proof.value?.onchainChunkId || failedReason.value.trim().length < 5) return;
|
||||
const chunkId = String(proof.value.onchainChunkId);
|
||||
const reason = failedReason.value.trim();
|
||||
dialog.warning({
|
||||
title: t('pages.blockchain.markFailed'),
|
||||
content: t('pages.blockchain.markFailedConfirm'),
|
||||
positiveText: t('common.action.confirm'),
|
||||
negativeText: t('common.action.cancel'),
|
||||
onPositiveClick: () => execute(() => onchainApi.markFailed(chunkId, reason)),
|
||||
});
|
||||
}
|
||||
|
||||
watch(
|
||||
() => [props.show, proof.value?.id] as const,
|
||||
([show]) => {
|
||||
if (!show) return;
|
||||
transactionHash.value = proof.value?.txHash || '';
|
||||
failedReason.value = '';
|
||||
},
|
||||
);
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.proof-modal {
|
||||
width: min(680px, calc(100vw - 32px));
|
||||
}
|
||||
.proof-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
color: var(--brand);
|
||||
text-decoration: none;
|
||||
}
|
||||
.unknown-alert {
|
||||
margin-top: 12px;
|
||||
}
|
||||
.footer-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
}
|
||||
.proof-action-form {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
width: min(460px, calc(100vw - 72px));
|
||||
}
|
||||
.proof-action-form :deep(.n-input) {
|
||||
min-width: 0;
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
:deep(.copyable-value) {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
max-width: 100%;
|
||||
}
|
||||
:deep(.copyable-text) {
|
||||
overflow-wrap: anywhere;
|
||||
font-family: Consolas, monospace;
|
||||
}
|
||||
@media (max-width: 520px) {
|
||||
.proof-action-form {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,285 @@
|
||||
<template>
|
||||
<div class="outbound-images">
|
||||
<div class="images-toolbar">
|
||||
<n-text depth="3">{{ t('pages.outbound.imageCount', { n: total }) }}</n-text>
|
||||
<div class="spacer" />
|
||||
<n-upload
|
||||
:show-file-list="false"
|
||||
accept=".jpg,.jpeg,.png,.webp,image/jpeg,image/png,image/webp"
|
||||
:custom-request="upload"
|
||||
:disabled="disabled || uploading"
|
||||
>
|
||||
<n-button size="small" :loading="uploading" :disabled="disabled">
|
||||
<template #icon><n-icon :component="CloudUploadOutline" /></template>
|
||||
{{ t('pages.outbound.addImage') }}
|
||||
</n-button>
|
||||
</n-upload>
|
||||
</div>
|
||||
|
||||
<n-spin :show="loading">
|
||||
<n-empty v-if="!items.length" :description="t('common.msg.noData')" class="empty-images" />
|
||||
<div v-else class="image-grid">
|
||||
<div v-for="(item, index) in items" :key="imageId(item)" class="image-tile">
|
||||
<button class="image-preview" type="button" @click="preview(index)">
|
||||
<img :src="imageUrl(item)" :alt="item.name || t('pages.outbound.outImage')" loading="lazy" />
|
||||
</button>
|
||||
<div class="image-meta">
|
||||
<span class="image-name" :title="item.name || item.key">{{ item.name || item.key || '-' }}</span>
|
||||
<div class="image-actions">
|
||||
<n-button
|
||||
quaternary
|
||||
circle
|
||||
size="tiny"
|
||||
:disabled="disabled || globalIndex(index) === 0"
|
||||
:title="t('pages.outbound.moveImageUp')"
|
||||
@click="move(item, index, 'UP')"
|
||||
>
|
||||
<template #icon><n-icon :component="ArrowUpOutline" /></template>
|
||||
</n-button>
|
||||
<n-button
|
||||
quaternary
|
||||
circle
|
||||
size="tiny"
|
||||
:disabled="disabled || globalIndex(index) === total - 1"
|
||||
:title="t('pages.outbound.moveImageDown')"
|
||||
@click="move(item, index, 'DOWN')"
|
||||
>
|
||||
<template #icon><n-icon :component="ArrowDownOutline" /></template>
|
||||
</n-button>
|
||||
<n-button
|
||||
quaternary
|
||||
circle
|
||||
size="tiny"
|
||||
type="error"
|
||||
:disabled="disabled"
|
||||
:title="t('common.action.delete')"
|
||||
@click="remove(item)"
|
||||
>
|
||||
<template #icon><n-icon :component="TrashOutline" /></template>
|
||||
</n-button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</n-spin>
|
||||
|
||||
<div v-if="total > pageSize" class="images-pagination">
|
||||
<n-pagination
|
||||
v-model:page="page"
|
||||
:page-size="pageSize"
|
||||
:item-count="total"
|
||||
:disabled="loading"
|
||||
@update:page="load"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import type { UploadCustomRequestOptions } from 'naive-ui';
|
||||
import { NIcon } from 'naive-ui';
|
||||
import { ArrowDownOutline, ArrowUpOutline, CloudUploadOutline, TrashOutline } from '@vicons/ionicons5';
|
||||
import { outboundApi } from '@/api';
|
||||
import { dialog, message } from '@/utils/feedback';
|
||||
import { resolveMediaUrl } from '@/utils/mediaUrl';
|
||||
import { openMediaViewer } from '@/composables/openMediaViewer';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
traceCodeId: string;
|
||||
disabled?: boolean;
|
||||
}>(), {
|
||||
disabled: false,
|
||||
});
|
||||
const emit = defineEmits<{ (event: 'changed'): void }>();
|
||||
|
||||
const { t } = useI18n();
|
||||
const items = ref<any[]>([]);
|
||||
const total = ref(0);
|
||||
const page = ref(1);
|
||||
const pageSize = 12;
|
||||
const loading = ref(false);
|
||||
const uploading = ref(false);
|
||||
|
||||
function imageId(item: any) {
|
||||
return String(item.id || item.imageId || item.key || '');
|
||||
}
|
||||
|
||||
function imageUrl(item: any) {
|
||||
return resolveMediaUrl(item.url || item.key);
|
||||
}
|
||||
|
||||
async function load() {
|
||||
if (!props.traceCodeId) return;
|
||||
loading.value = true;
|
||||
try {
|
||||
const result: any = await outboundApi.images(props.traceCodeId, { page: page.value, pageSize });
|
||||
items.value = result.items || result.list || [];
|
||||
total.value = Number(result.total || 0);
|
||||
if (!items.value.length && page.value > 1) {
|
||||
page.value -= 1;
|
||||
await load();
|
||||
}
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function validateFile(file: File) {
|
||||
const extensionOk = /\.(jpe?g|png|webp)$/i.test(file.name);
|
||||
const mimeOk = !file.type || ['image/jpeg', 'image/png', 'image/webp'].includes(file.type);
|
||||
if (!extensionOk || !mimeOk) {
|
||||
message.error(t('pages.outbound.imageFormatTip'));
|
||||
return false;
|
||||
}
|
||||
if (file.size > 100 * 1024 * 1024) {
|
||||
message.error(t('pages.outbound.imageSizeTip'));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
async function upload({ file, onFinish, onError }: UploadCustomRequestOptions) {
|
||||
const raw = file.file;
|
||||
if (!raw || !validateFile(raw)) {
|
||||
onError();
|
||||
return;
|
||||
}
|
||||
uploading.value = true;
|
||||
try {
|
||||
const data = new FormData();
|
||||
data.append('file', raw);
|
||||
await outboundApi.uploadImage(props.traceCodeId, data);
|
||||
page.value = 1;
|
||||
await load();
|
||||
emit('changed');
|
||||
message.success(t('common.msg.operationSuccess'));
|
||||
onFinish();
|
||||
} catch {
|
||||
onError();
|
||||
} finally {
|
||||
uploading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
function remove(item: any) {
|
||||
const id = imageId(item);
|
||||
if (!id) return;
|
||||
dialog.warning({
|
||||
title: t('common.action.delete'),
|
||||
content: t('pages.outbound.deleteImageConfirm'),
|
||||
positiveText: t('common.action.confirm'),
|
||||
negativeText: t('common.action.cancel'),
|
||||
onPositiveClick: async () => {
|
||||
await outboundApi.removeImage(props.traceCodeId, id);
|
||||
await load();
|
||||
emit('changed');
|
||||
message.success(t('common.msg.deleted'));
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async function move(item: any, index: number, direction: 'UP' | 'DOWN') {
|
||||
const id = imageId(item);
|
||||
if (!id) return;
|
||||
await outboundApi.moveImage(props.traceCodeId, id, direction);
|
||||
if (direction === 'UP' && index === 0 && page.value > 1) page.value -= 1;
|
||||
if (direction === 'DOWN' && index === items.value.length - 1 && globalIndex(index) < total.value - 1) page.value += 1;
|
||||
await load();
|
||||
emit('changed');
|
||||
}
|
||||
|
||||
function globalIndex(index: number) {
|
||||
return (page.value - 1) * pageSize + index;
|
||||
}
|
||||
|
||||
function preview(index: number) {
|
||||
void openMediaViewer(
|
||||
items.value.map((item) => ({
|
||||
url: imageUrl(item),
|
||||
name: item.name || item.key,
|
||||
type: item.type || item.mime || 'image',
|
||||
})),
|
||||
index,
|
||||
);
|
||||
}
|
||||
|
||||
watch(() => props.traceCodeId, () => {
|
||||
page.value = 1;
|
||||
void load();
|
||||
});
|
||||
|
||||
onMounted(load);
|
||||
|
||||
defineExpose({ reload: load });
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.outbound-images {
|
||||
min-width: 0;
|
||||
}
|
||||
.images-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.spacer {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
.empty-images {
|
||||
padding: 28px 0;
|
||||
}
|
||||
.image-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
|
||||
gap: 12px;
|
||||
}
|
||||
.image-tile {
|
||||
min-width: 0;
|
||||
border: 1px solid var(--n-border-color);
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
background: var(--n-color);
|
||||
}
|
||||
.image-preview {
|
||||
display: block;
|
||||
width: 100%;
|
||||
aspect-ratio: 4 / 3;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: #f4f7f8;
|
||||
cursor: zoom-in;
|
||||
}
|
||||
.image-preview img {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
}
|
||||
.image-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
min-height: 38px;
|
||||
padding: 4px 6px 4px 8px;
|
||||
}
|
||||
.image-name {
|
||||
min-width: 0;
|
||||
flex: 1 1 auto;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-size: 12px;
|
||||
}
|
||||
.image-actions {
|
||||
display: inline-flex;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
.images-pagination {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
padding-top: 12px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,183 @@
|
||||
<template>
|
||||
<n-modal v-model:show="visible" preset="card" :title="modalTitle" class="outbound-record-modal">
|
||||
<n-spin :show="loading">
|
||||
<n-descriptions :column="2" label-placement="top" size="small" bordered class="trace-summary">
|
||||
<n-descriptions-item :label="t('pages.traceCode.shortCode')">
|
||||
{{ traceCode?.shortCode || '-' }}
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item :label="t('pages.artwork.title')">
|
||||
{{ traceCode?.artwork?.title || '-' }}
|
||||
</n-descriptions-item>
|
||||
</n-descriptions>
|
||||
|
||||
<n-form :model="form" label-placement="top">
|
||||
<n-grid :cols="2" :x-gap="16" item-responsive responsive="screen">
|
||||
<n-form-item-gi span="2 m:1" :label="t('pages.outbound.outTime')" required>
|
||||
<n-date-picker
|
||||
v-model:formatted-value="form.outTime"
|
||||
value-format="yyyy-MM-dd HH:mm"
|
||||
type="datetime"
|
||||
clearable
|
||||
:disabled="!auth.canWrite"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</n-form-item-gi>
|
||||
<n-form-item-gi span="2 m:1" :label="t('common.label.remark')">
|
||||
<n-input
|
||||
v-model:value="form.remark"
|
||||
type="textarea"
|
||||
:autosize="{ minRows: 1, maxRows: 3 }"
|
||||
:maxlength="191"
|
||||
show-count
|
||||
:disabled="!auth.canWrite"
|
||||
/>
|
||||
</n-form-item-gi>
|
||||
</n-grid>
|
||||
</n-form>
|
||||
|
||||
<div class="record-actions" v-if="auth.canWrite">
|
||||
<n-button type="primary" :loading="saving" @click="saveRecord">
|
||||
{{ t('pages.outbound.saveRecord') }}
|
||||
</n-button>
|
||||
</div>
|
||||
|
||||
<n-divider>{{ t('pages.outbound.outImage') }}</n-divider>
|
||||
<outbound-image-manager
|
||||
v-if="traceCodeId"
|
||||
ref="imageManager"
|
||||
:trace-code-id="traceCodeId"
|
||||
:disabled="!auth.canWrite || !hasRecord"
|
||||
@changed="emit('changed')"
|
||||
/>
|
||||
</n-spin>
|
||||
|
||||
<template #footer>
|
||||
<div class="footer-actions">
|
||||
<n-button @click="visible = false">{{ t('common.action.close') }}</n-button>
|
||||
</div>
|
||||
</template>
|
||||
</n-modal>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, reactive, ref, watch } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import dayjs from 'dayjs';
|
||||
import { outboundApi } from '@/api';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { message } from '@/utils/feedback';
|
||||
import OutboundImageManager from '@/components/OutboundImageManager.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
show: boolean;
|
||||
traceCode: any | null;
|
||||
}>();
|
||||
const emit = defineEmits<{
|
||||
(event: 'update:show', value: boolean): void;
|
||||
(event: 'changed'): void;
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
const auth = useAuthStore();
|
||||
const visible = computed({
|
||||
get: () => props.show,
|
||||
set: (value) => emit('update:show', value),
|
||||
});
|
||||
const traceCodeId = computed(() => String(props.traceCode?.id || ''));
|
||||
const modalTitle = computed(() =>
|
||||
isOutboundRow(props.traceCode) ? t('pages.outbound.editRecord') : t('pages.outbound.registerRecord'),
|
||||
);
|
||||
const loading = ref(false);
|
||||
const saving = ref(false);
|
||||
const record = ref<any>(null);
|
||||
const imageManager = ref<InstanceType<typeof OutboundImageManager> | null>(null);
|
||||
const form = reactive<{ outTime: string | null; remark: string }>({
|
||||
outTime: null,
|
||||
remark: '',
|
||||
});
|
||||
let loadVersion = 0;
|
||||
|
||||
const hasRecord = computed(() => Boolean(record.value?.outTime || props.traceCode?.outTime || props.traceCode?.outbound));
|
||||
|
||||
function isOutboundRow(row: any) {
|
||||
return Boolean(row?.outbound || row?.outTime || row?.outImages?.length);
|
||||
}
|
||||
|
||||
function formatDate(value?: string | Date | null) {
|
||||
return value ? dayjs(value).format('YYYY-MM-DD HH:mm') : null;
|
||||
}
|
||||
|
||||
async function load() {
|
||||
if (!traceCodeId.value) return;
|
||||
const version = ++loadVersion;
|
||||
loading.value = true;
|
||||
try {
|
||||
let next: any = null;
|
||||
try {
|
||||
next = await outboundApi.getRecord(traceCodeId.value, true);
|
||||
} catch {
|
||||
next = null;
|
||||
}
|
||||
if (version !== loadVersion) return;
|
||||
record.value = next;
|
||||
form.outTime = formatDate(next?.outTime || props.traceCode?.outTime)
|
||||
|| (auth.canWrite ? dayjs().format('YYYY-MM-DD HH:mm') : null);
|
||||
form.remark = next?.remark || props.traceCode?.remark || '';
|
||||
await imageManager.value?.reload();
|
||||
} finally {
|
||||
if (version === loadVersion) loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function saveRecord() {
|
||||
if (!traceCodeId.value || !form.outTime) {
|
||||
message.warning(t('pages.outbound.outTimeRequired'));
|
||||
return;
|
||||
}
|
||||
saving.value = true;
|
||||
try {
|
||||
const outTime = dayjs(form.outTime).toISOString();
|
||||
const updated: any = await outboundApi.updateRecord(traceCodeId.value, {
|
||||
outTime,
|
||||
remark: form.remark.trim() || null,
|
||||
});
|
||||
record.value = {
|
||||
...(record.value || {}),
|
||||
...(updated && typeof updated === 'object' ? updated : {}),
|
||||
outTime,
|
||||
remark: form.remark.trim() || null,
|
||||
};
|
||||
message.success(t('common.msg.saved'));
|
||||
emit('changed');
|
||||
await imageManager.value?.reload();
|
||||
} finally {
|
||||
saving.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
watch(
|
||||
() => [props.show, traceCodeId.value] as const,
|
||||
([show]) => {
|
||||
if (show) void load();
|
||||
else {
|
||||
loadVersion += 1;
|
||||
loading.value = false;
|
||||
}
|
||||
},
|
||||
{ immediate: true },
|
||||
);
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.outbound-record-modal {
|
||||
width: min(780px, calc(100vw - 32px));
|
||||
}
|
||||
.trace-summary {
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
.record-actions,
|
||||
.footer-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
</style>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -144,93 +144,23 @@
|
||||
</template>
|
||||
</n-modal>
|
||||
|
||||
<n-modal v-model:show="outboundModal" preset="card" :title="outboundModalTitle" style="width: 620px">
|
||||
<n-form :model="outboundForm" label-placement="top">
|
||||
<n-grid :cols="2" :x-gap="16">
|
||||
<n-form-item-gi :label="t('pages.outbound.outTime')" :required="!outboundReadonly">
|
||||
<n-date-picker v-if="!outboundReadonly" v-model:formatted-value="outboundForm.outTime" value-format="yyyy-MM-dd HH:mm" type="datetime" clearable style="width: 100%" />
|
||||
<n-text v-else>{{ outboundForm.outTime || '-' }}</n-text>
|
||||
</n-form-item-gi>
|
||||
<n-form-item-gi :label="t('common.label.remark')">
|
||||
<n-input v-if="!outboundReadonly" v-model:value="outboundForm.remark" />
|
||||
<n-text v-else>{{ outboundForm.remark || '-' }}</n-text>
|
||||
</n-form-item-gi>
|
||||
</n-grid>
|
||||
<n-form-item :label="t('pages.outbound.outImage')">
|
||||
<media-upload v-if="!outboundReadonly || outImages.length" v-model="outImages" type="image" :max="8" :disabled="outboundReadonly" />
|
||||
<n-text v-else>-</n-text>
|
||||
</n-form-item>
|
||||
|
||||
<template v-if="targetOnchain && targetProof">
|
||||
<n-divider style="margin: 4px 0 12px">{{ t('pages.blockchain.title') }}</n-divider>
|
||||
<n-descriptions
|
||||
:column="1"
|
||||
label-placement="left"
|
||||
size="small"
|
||||
bordered
|
||||
:label-style="{ whiteSpace: 'nowrap', verticalAlign: 'middle' }"
|
||||
:content-style="{ verticalAlign: 'middle' }"
|
||||
>
|
||||
<n-descriptions-item :label="t('pages.blockchain.status')">
|
||||
<n-tag size="small" :type="proofStatusType(targetProof)">{{ proofStatusText(targetProof) }}</n-tag>
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item v-if="targetProof.dataHash" :label="t('pages.blockchain.dataHash')">
|
||||
<span class="onchain-val"><span class="onchain-mono">{{ targetProof.dataHash }}</span>
|
||||
<n-button quaternary circle size="tiny" :title="t('common.action.copy')" @click="copyValue(targetProof.dataHash)"><template #icon><n-icon :component="CopyOutline" /></template></n-button>
|
||||
</span>
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item v-if="targetProof.txHash" :label="t('pages.blockchain.txHash')">
|
||||
<span class="onchain-val"><span class="onchain-mono">{{ targetProof.txHash }}</span>
|
||||
<n-button quaternary circle size="tiny" :title="t('common.action.copy')" @click="copyValue(targetProof.txHash)"><template #icon><n-icon :component="CopyOutline" /></template></n-button>
|
||||
</span>
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item v-if="targetProof.tokenId !== null && targetProof.tokenId !== undefined" :label="t('pages.blockchain.tokenId')">
|
||||
<span class="onchain-val"><span class="onchain-mono">{{ targetProof.tokenId }}</span>
|
||||
<n-button quaternary circle size="tiny" :title="t('common.action.copy')" @click="copyValue(targetProof.tokenId)"><template #icon><n-icon :component="CopyOutline" /></template></n-button>
|
||||
</span>
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item v-if="targetProof.contractAddress" :label="t('pages.blockchain.contract')">
|
||||
<span class="onchain-val"><span class="onchain-mono">{{ targetProof.contractAddress }}</span>
|
||||
<n-button quaternary circle size="tiny" :title="t('common.action.copy')" @click="copyValue(targetProof.contractAddress)"><template #icon><n-icon :component="CopyOutline" /></template></n-button>
|
||||
</span>
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item v-if="targetProof.blockHeight" :label="t('pages.blockchain.blockHeight')">
|
||||
<span class="onchain-val"><span>{{ targetProof.blockHeight }}</span>
|
||||
<n-button quaternary circle size="tiny" :title="t('common.action.copy')" @click="copyValue(targetProof.blockHeight)"><template #icon><n-icon :component="CopyOutline" /></template></n-button>
|
||||
</span>
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item v-if="targetProof.onchainAt" :label="t('pages.blockchain.onchainAt')">
|
||||
<span class="onchain-val"><span>{{ fmt(targetProof.onchainAt) }}</span>
|
||||
<n-button quaternary circle size="tiny" :title="t('common.action.copy')" @click="copyValue(fmt(targetProof.onchainAt))"><template #icon><n-icon :component="CopyOutline" /></template></n-button>
|
||||
</span>
|
||||
</n-descriptions-item>
|
||||
<n-descriptions-item v-if="targetProof.explorerUrl" :label="t('pages.blockchain.explorer')">
|
||||
<span class="onchain-val"><a :href="targetProof.explorerUrl" target="_blank" rel="noopener" class="onchain-mono" style="color: var(--brand)">{{ targetProof.explorerUrl }}</a>
|
||||
<n-button quaternary circle size="tiny" :title="t('common.action.copy')" @click="copyValue(targetProof.explorerUrl)"><template #icon><n-icon :component="CopyOutline" /></template></n-button>
|
||||
</span>
|
||||
</n-descriptions-item>
|
||||
</n-descriptions>
|
||||
</template>
|
||||
|
||||
<n-alert v-if="!targetOnchain" type="info" :bordered="false" class="onchain-tip">
|
||||
{{ t('pages.outbound.onchainAutoTip') }}
|
||||
</n-alert>
|
||||
</n-form>
|
||||
<template #footer>
|
||||
<div style="text-align: right">
|
||||
<n-button class="mr8" @click="outboundModal = false">
|
||||
{{ targetOnchain ? t('common.action.close') : t('common.action.cancel') }}
|
||||
</n-button>
|
||||
<!-- 只读角色(无写权限)从状态列点开时仅可查看,隐藏保存/触发按钮 -->
|
||||
<template v-if="!targetOnchain && auth.canWrite">
|
||||
<n-button v-if="!targetOutbound" class="mr8" :loading="outboundSaving" @click="saveOutbound(false)">{{ t('pages.outbound.saveRecord') }}</n-button>
|
||||
<n-button type="primary" :loading="outboundTriggering" @click="saveOutbound(true)">
|
||||
{{ targetOutbound ? t('pages.blockchain.trigger') : t('pages.outbound.saveAndTriggerOnchain') }}
|
||||
</n-button>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
</n-modal>
|
||||
<outbound-record-modal
|
||||
v-model:show="outboundRecordVisible"
|
||||
:trace-code="operationTarget"
|
||||
@changed="reloadAfterOperation"
|
||||
/>
|
||||
<onchain-proof-modal
|
||||
v-model:show="proofVisible"
|
||||
:trace-code="operationTarget"
|
||||
@run="runOnchainRow"
|
||||
@changed="reloadAfterOperation"
|
||||
/>
|
||||
<batch-job-modal
|
||||
v-model:show="jobVisible"
|
||||
:job-id="jobId"
|
||||
:title="t('pages.operations.onchainProgress')"
|
||||
@completed="reloadAfterOperation"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -239,17 +169,19 @@ import { computed, h, onMounted, onUnmounted, reactive, ref, watch } from 'vue';
|
||||
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';
|
||||
import dayjs from 'dayjs';
|
||||
import { SearchOutline, AddOutline, DownloadOutline, QrCodeOutline, FolderOutline, OpenOutline, EllipsisHorizontalOutline, FilterOutline } from '@vicons/ionicons5';
|
||||
import { TraceCodeStatus } from '@artveris/shared';
|
||||
import { traceCodeApi, jobApi, artworkApi, outboundApi } from '@/api';
|
||||
import { traceCodeApi, jobApi, artworkApi, onchainApi } from '@/api';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { message, dialog } from '@/utils/feedback';
|
||||
import { fmt, statusType } from '@/utils/format';
|
||||
import { downloadFile } from '@/utils/download';
|
||||
import { useTablePage } from '@/composables/useTablePage';
|
||||
import { useRemoteSort } from '@/utils/tableSort';
|
||||
import MediaUpload from '@/components/MediaUpload.vue';
|
||||
import { localizeOperationReason } from '@/utils/operationReason';
|
||||
import BatchJobModal from '@/components/BatchJobModal.vue';
|
||||
import OnchainProofModal from '@/components/OnchainProofModal.vue';
|
||||
import OutboundRecordModal from '@/components/OutboundRecordModal.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
artworkId?: number;
|
||||
@@ -334,35 +266,35 @@ const editingGroup = ref<number | null>(null);
|
||||
const batchModal = ref(false);
|
||||
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>({
|
||||
outTime: null,
|
||||
remark: '',
|
||||
});
|
||||
const outboundRecordVisible = ref(false);
|
||||
const proofVisible = ref(false);
|
||||
const operationTarget = ref<any | null>(null);
|
||||
const jobVisible = ref(false);
|
||||
const jobId = ref('');
|
||||
|
||||
function rowIsOutbound(row: any) {
|
||||
if (!row) return false;
|
||||
return Boolean(row.outTime || getOutImages(row).length);
|
||||
return Boolean(row.outbound || row.outTime || getOutImages(row).length);
|
||||
}
|
||||
function rowIsOnchain(row: any) {
|
||||
// 已提交上链即视为已上链:ONCHAIN(已确认)/CONFIRMING(确认中)/PENDING(待处理) 均不允许重复上链,仅 FAILED 可重试
|
||||
const s = row?.latestAnyProof?.status;
|
||||
return s === 'ONCHAIN' || s === 'CONFIRMING' || s === 'PENDING';
|
||||
const s = proofOf(row)?.status || row?.proofStatus;
|
||||
return s === 'ONCHAIN' || s === 'CONFIRMING' || s === 'SUBMITTING' || s === 'PENDING';
|
||||
}
|
||||
function outboundMenuLabel(row: any) {
|
||||
if (rowIsOnchain(row)) return t('pages.traceCode.onchainInfo');
|
||||
if (rowIsOutbound(row)) return t('pages.traceCode.triggerOnchainOnly');
|
||||
return t('pages.traceCode.registerOutbound');
|
||||
function proofOf(row: any) {
|
||||
return row?.latestAnyProof ?? row?.proof ?? null;
|
||||
}
|
||||
function canRunOnchain(row: any) {
|
||||
if (typeof row?.onchainEligible === 'boolean') return row.onchainEligible;
|
||||
const status = proofOf(row)?.status || row?.proofStatus || 'NONE';
|
||||
return status === 'NONE' || status === 'FAILED';
|
||||
}
|
||||
function outboundActionLabel(row: any) {
|
||||
return rowIsOutbound(row) ? t('pages.outbound.editRecord') : t('pages.outbound.registerRecord');
|
||||
}
|
||||
function onchainActionLabel(row: any) {
|
||||
if (rowIsOnchain(row) || proofOf(row)) return t('pages.traceCode.onchainInfo');
|
||||
return canRunOnchain(row) ? t('pages.blockchain.trigger') : t('pages.operations.onchainUnavailable');
|
||||
}
|
||||
const targetOutbound = computed(() => rowIsOutbound(outboundTarget.value));
|
||||
const targetOnchain = computed(() => rowIsOnchain(outboundTarget.value));
|
||||
const outboundReadonly = computed(() => targetOutbound.value || targetOnchain.value);
|
||||
const targetProof = computed<any>(() => outboundTarget.value?.latestProof ?? outboundTarget.value?.latestAnyProof ?? null);
|
||||
const outboundModalTitle = computed(() => outboundMenuLabel(outboundTarget.value));
|
||||
|
||||
const columns = computed<DataTableColumns<any>>(() => {
|
||||
const cols: DataTableColumns<any> = [
|
||||
@@ -426,7 +358,7 @@ const columns = computed<DataTableColumns<any>>(() => {
|
||||
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) =>
|
||||
@@ -438,7 +370,7 @@ const columns = computed<DataTableColumns<any>>(() => {
|
||||
render: (r) =>
|
||||
h(
|
||||
'span',
|
||||
{ class: 'cell-click', title: outboundMenuLabel(r), onClick: () => openOutboundModal(r) },
|
||||
{ class: 'cell-click', title: outboundActionLabel(r), onClick: () => openOutboundRecord(r) },
|
||||
[
|
||||
r.outTime || getOutImages(r).length
|
||||
? h(NTag, { size: 'small', type: 'success' }, { default: () => t('pages.traceCode.outRegistered') })
|
||||
@@ -446,7 +378,7 @@ const columns = computed<DataTableColumns<any>>(() => {
|
||||
],
|
||||
),
|
||||
},
|
||||
// 上链状态:同上,点击进详情弹窗
|
||||
// 上链状态仅打开存证详情。
|
||||
{
|
||||
title: () => t('pages.traceCode.onchainStatus'),
|
||||
key: 'onchainStatus',
|
||||
@@ -455,10 +387,14 @@ const columns = computed<DataTableColumns<any>>(() => {
|
||||
render: (r) =>
|
||||
h(
|
||||
'span',
|
||||
{ class: 'cell-click', title: outboundMenuLabel(r), onClick: () => openOutboundModal(r) },
|
||||
{
|
||||
class: 'cell-click',
|
||||
title: localizeOperationReason(r.onchainReason) || onchainActionLabel(r),
|
||||
onClick: () => openProof(r),
|
||||
},
|
||||
[
|
||||
r.latestAnyProof
|
||||
? h(NTag, { size: 'small', type: proofStatusType(r.latestAnyProof) }, { default: () => proofStatusText(r.latestAnyProof) })
|
||||
proofOf(r)
|
||||
? h(NTag, { size: 'small', type: proofStatusType(proofOf(r)) }, { default: () => proofStatusText(proofOf(r)) })
|
||||
: h(NText, { depth: 3 }, { default: () => t('pages.traceCode.noOnchain') }),
|
||||
],
|
||||
),
|
||||
@@ -833,9 +769,17 @@ function rowActionOptions(row: any): DropdownOption[] {
|
||||
const options: DropdownOption[] = [
|
||||
{ label: t('pages.traceCode.changeGroup'), key: 'changeGroup', children: rowGroupOptions.value },
|
||||
{ label: t('pages.traceCode.changeBatch'), key: 'batch:open' },
|
||||
{ label: outboundMenuLabel(row), key: 'outbound:open' },
|
||||
{ label: outboundActionLabel(row), key: 'outbound:open' },
|
||||
canRunOnchain(row)
|
||||
? {
|
||||
label: proofOf(row)?.status === 'FAILED' ? t('pages.blockchain.retry') : t('pages.blockchain.trigger'),
|
||||
key: 'onchain:run',
|
||||
}
|
||||
: proofOf(row)
|
||||
? { label: t('pages.traceCode.onchainInfo'), key: 'onchain:info' }
|
||||
: { label: t('pages.operations.onchainUnavailable'), key: 'onchain:unavailable', disabled: true },
|
||||
];
|
||||
if (canManualConfirm(row.latestAnyProof)) {
|
||||
if (canManualConfirm(proofOf(row))) {
|
||||
options.push({ label: t('pages.traceCode.reconfirmOnchain'), key: 'onchain:confirm' });
|
||||
}
|
||||
options.push(
|
||||
@@ -865,12 +809,22 @@ async function onRowAction(row: any, key: string) {
|
||||
}
|
||||
|
||||
if (key === 'outbound:open') {
|
||||
openOutboundModal(row);
|
||||
openOutboundRecord(row);
|
||||
return;
|
||||
}
|
||||
|
||||
if (key === 'onchain:run') {
|
||||
await runOnchainRow(row);
|
||||
return;
|
||||
}
|
||||
|
||||
if (key === 'onchain:info') {
|
||||
openProof(row);
|
||||
return;
|
||||
}
|
||||
|
||||
if (key === 'onchain:confirm') {
|
||||
await confirmProof(row.latestAnyProof);
|
||||
await confirmProof(proofOf(row));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -958,10 +912,6 @@ async function applyBatchMove() {
|
||||
emit('changed');
|
||||
}
|
||||
|
||||
function formatDateTime(value?: string | Date | null) {
|
||||
return value ? dayjs(value).format('YYYY-MM-DD HH:mm') : null;
|
||||
}
|
||||
|
||||
function fileName(key: string) {
|
||||
return key.split('/').pop() || key;
|
||||
}
|
||||
@@ -973,58 +923,43 @@ function getOutImages(row: any) {
|
||||
);
|
||||
}
|
||||
|
||||
async function copyValue(value: unknown) {
|
||||
const text = value === null || value === undefined ? '' : String(value);
|
||||
if (!text) return;
|
||||
try {
|
||||
await navigator.clipboard.writeText(text);
|
||||
message.success(t('common.msg.copied'));
|
||||
} catch {
|
||||
message.error(t('common.msg.copyFailed'));
|
||||
}
|
||||
function openOutboundRecord(row: any) {
|
||||
operationTarget.value = row;
|
||||
outboundRecordVisible.value = true;
|
||||
}
|
||||
|
||||
function openOutboundModal(row: any) {
|
||||
outboundTarget.value = row;
|
||||
// 出库时间必填:未出库时默认此刻;已出库时回显既有时间(只读)
|
||||
outboundForm.outTime = row.outTime ? formatDateTime(row.outTime) : dayjs().format('YYYY-MM-DD HH:mm');
|
||||
outboundForm.remark = row.remark || '';
|
||||
outImages.value = getOutImages(row);
|
||||
outboundModal.value = true;
|
||||
function openProof(row: any) {
|
||||
operationTarget.value = row;
|
||||
proofVisible.value = true;
|
||||
}
|
||||
|
||||
async function saveOutbound(triggerOnchain: boolean) {
|
||||
if (!outboundTarget.value) return;
|
||||
if (!outboundReadonly.value && !outboundForm.outTime) {
|
||||
message.warning(t('pages.outbound.outTimeRequired'));
|
||||
return;
|
||||
}
|
||||
if (triggerOnchain) {
|
||||
outboundTriggering.value = true;
|
||||
function runOnchainRow(row: any) {
|
||||
operationTarget.value = row;
|
||||
dialog.warning({
|
||||
title: t('pages.blockchain.trigger'),
|
||||
content: t('pages.operations.singleOnchainConfirm', { code: row.shortCode }),
|
||||
positiveText: t('common.action.confirm'),
|
||||
negativeText: t('common.action.cancel'),
|
||||
onPositiveClick: () => submitOnchainRow(row),
|
||||
});
|
||||
}
|
||||
|
||||
async function submitOnchainRow(row: any) {
|
||||
const result: any = await onchainApi.createJob({ mode: 'IDS', ids: [String(row.id)] });
|
||||
proofVisible.value = false;
|
||||
const id = String(result?.jobId || result?.id || result?.job?.id || '');
|
||||
if (id) {
|
||||
jobId.value = id;
|
||||
jobVisible.value = true;
|
||||
} else {
|
||||
outboundSaving.value = true;
|
||||
}
|
||||
try {
|
||||
if (!outboundReadonly.value) {
|
||||
await outboundApi.updateSingle(String(outboundTarget.value.id), {
|
||||
outTime: outboundForm.outTime ? dayjs(outboundForm.outTime).toISOString() : null,
|
||||
outImageKey: outImages.value[0]?.key ?? null,
|
||||
outImageKeys: outImages.value.map((item) => item.key).filter(Boolean),
|
||||
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;
|
||||
await load();
|
||||
emit('changed');
|
||||
} finally {
|
||||
outboundSaving.value = false;
|
||||
outboundTriggering.value = false;
|
||||
message.success(t('pages.operations.jobSubmitted'));
|
||||
}
|
||||
await load();
|
||||
}
|
||||
|
||||
async function reloadAfterOperation() {
|
||||
await load();
|
||||
emit('changed');
|
||||
}
|
||||
|
||||
function resetGroupForm() {
|
||||
@@ -1175,9 +1110,6 @@ onUnmounted(() => {
|
||||
.mr8 {
|
||||
margin-right: 8px;
|
||||
}
|
||||
.onchain-tip {
|
||||
margin-top: 4px;
|
||||
}
|
||||
/* 表格单元格由 n-data-table 子组件渲染,不带本组件 scope 属性,必须用 :deep() 才能命中 */
|
||||
:deep(.cell-link) {
|
||||
color: var(--brand);
|
||||
@@ -1196,23 +1128,6 @@ onUnmounted(() => {
|
||||
:deep(.cell-click:hover) {
|
||||
opacity: 0.75;
|
||||
}
|
||||
.onchain-mono {
|
||||
font-family: 'JetBrains Mono', Consolas, monospace;
|
||||
font-size: 12px;
|
||||
word-break: break-all;
|
||||
}
|
||||
.onchain-val {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
.onchain-val > :first-child {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
.onchain-val .n-button {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
@media (max-width: 720px) {
|
||||
.toolbar-control,
|
||||
.toolbar-control.wide,
|
||||
|
||||
@@ -73,6 +73,7 @@ import {
|
||||
LogOutOutline,
|
||||
KeyOutline,
|
||||
ShieldCheckmarkOutline,
|
||||
LinkOutline,
|
||||
} from '@vicons/ionicons5';
|
||||
import { useAuthStore } from '@/stores/auth';
|
||||
import { settingsApi } from '@/api';
|
||||
@@ -101,6 +102,7 @@ const menuOptions = computed<MenuOption[]>(() => {
|
||||
{ label: t('menu.templates'), key: 'templates', icon: renderIcon(DocumentTextOutline) },
|
||||
{ label: t('menu.artworks'), key: 'artworks', icon: renderIcon(ImagesOutline) },
|
||||
{ label: t('menu.traceCodes'), key: 'traceCodes', icon: renderIcon(QrCodeOutline) },
|
||||
{ label: t('menu.onchain'), key: 'onchain', icon: renderIcon(LinkOutline) },
|
||||
{ label: t('menu.outbound'), key: 'outbound', icon: renderIcon(CubeOutline) },
|
||||
{ label: t('menu.audit'), key: 'audit', icon: renderIcon(ShieldCheckmarkOutline), auditOnly: true },
|
||||
{ label: t('menu.queryLogs'), key: 'queryLogs', icon: renderIcon(ListOutline) },
|
||||
|
||||
@@ -55,11 +55,15 @@
|
||||
"UNBOUND": "Unbound",
|
||||
"INACTIVE": "Inactive",
|
||||
"PENDING": "Pending",
|
||||
"SUBMITTING": "Submitting",
|
||||
"CONFIRMING": "Confirming",
|
||||
"PROCESSING": "Processing",
|
||||
"SUCCESS": "Success",
|
||||
"PARTIAL": "Partial",
|
||||
"FAILED": "Failed",
|
||||
"UNKNOWN": "Unknown",
|
||||
"SKIPPED": "Skipped",
|
||||
"CANCELLED": "Cancelled",
|
||||
"ONCHAIN": "On-chain",
|
||||
"GENERATING": "Generating",
|
||||
"DONE": "Done"
|
||||
@@ -165,7 +169,8 @@
|
||||
"templates": "Templates",
|
||||
"artworks": "Artwork Files",
|
||||
"traceCodes": "Trace Code Management",
|
||||
"outbound": "Outbound & Chain",
|
||||
"onchain": "On-chain Management",
|
||||
"outbound": "Outbound Management",
|
||||
"audit": "Content Audit",
|
||||
"queryLogs": "Query Logs",
|
||||
"operationLogs": "Operation Logs",
|
||||
@@ -324,6 +329,7 @@
|
||||
"nodes": "Timeline",
|
||||
"certificates": "Certificates",
|
||||
"saveDraft": "Save Draft",
|
||||
"saveChanges": "Save Changes",
|
||||
"submitReview": "Submit for Audit",
|
||||
"submittedReview": "Submitted for audit. Changes take effect only after approval.",
|
||||
"noChangeTip": "No artwork content changes to submit.",
|
||||
@@ -425,8 +431,6 @@
|
||||
"reconfirmOnchain": "Reconfirm",
|
||||
"confirmSubmitted": "Reconfirm task submitted",
|
||||
"tableFilter": "Filter",
|
||||
"registerOutbound": "Outbound & On-chain",
|
||||
"triggerOnchainOnly": "On-chain",
|
||||
"onchainInfo": "On-chain Info",
|
||||
"enableOne": "Enable",
|
||||
"disableOne": "Disable",
|
||||
@@ -434,15 +438,22 @@
|
||||
"assignGroup": "Assign group"
|
||||
},
|
||||
"outbound": {
|
||||
"recordsTab": "Outbound Records",
|
||||
"zipTab": "ZIP Batch Import",
|
||||
"batchImportTitle": "Outbound Batch Import",
|
||||
"import": "Batch Import",
|
||||
"outTime": "Outbound Time",
|
||||
"outImage": "Outbound Photo",
|
||||
"onchainSection": "On-chain Info",
|
||||
"txHashTip": "Written automatically from the blockchain API response",
|
||||
"moreOnchainInfo": "More On-chain Info",
|
||||
"saveRecord": "Save Record",
|
||||
"saveAndTriggerOnchain": "Save & Trigger On-chain",
|
||||
"registerRecord": "Register Outbound",
|
||||
"editRecord": "Edit Outbound Record",
|
||||
"addImage": "Add Outbound Photo",
|
||||
"imageCount": "{n} photo(s)",
|
||||
"moveImageUp": "Move earlier",
|
||||
"moveImageDown": "Move later",
|
||||
"imageFormatTip": "Only JPG, JPEG, PNG, and WebP images are supported",
|
||||
"imageSizeTip": "Each image must not exceed 100MB",
|
||||
"deleteImageConfirm": "Delete this outbound photo?",
|
||||
"selectFile": "Select File",
|
||||
"importing": "Importing…",
|
||||
"importResult": "Import Result",
|
||||
@@ -495,7 +506,6 @@
|
||||
"previewExpired": "The import preview expired or its status changed",
|
||||
"duplicateTraceCode": "This trace code is duplicated in the import (first used on row {row})",
|
||||
"batchNoMismatch": "Batch number does not match; the actual value is {value}",
|
||||
"tooManyImages": "Each row can contain at most {count} outbound images",
|
||||
"duplicateZipImage": "The ZIP contains a duplicate image path: {path}",
|
||||
"imageTooLarge": "Image exceeds the 100MB limit: {path}",
|
||||
"tooManyRows": "The import exceeds the {count}-row limit",
|
||||
@@ -505,9 +515,9 @@
|
||||
"missingHeaders": "The xlsx file is missing required headers: {value}",
|
||||
"unsafeImagePath": "Image path is unsafe: {path}",
|
||||
"imageOutsideDirectory": "Image must be inside the images directory: {path}",
|
||||
"imageCodeDirectory": "Image must be stored under images/<12-digit trace code>/: {path}",
|
||||
"orphanImageDirectory": "The image directory's trace code is not present in the xlsx file: {code}",
|
||||
"unsupportedImage": "Unsupported image format: {path}",
|
||||
"duplicateImage": "The same image is referenced more than once in this row: {path}",
|
||||
"imageMissing": "Image not found: {path}",
|
||||
"imageFormat": "Image content does not match its file extension: {path}",
|
||||
"imagePixels": "Image dimensions exceed the allowed limit: {path}",
|
||||
"animatedImage": "Multi-frame images are not supported: {path}",
|
||||
@@ -519,8 +529,8 @@
|
||||
"zipInvalidSize": "The ZIP contains an invalid file size",
|
||||
"xlsxInvalidSize": "The xlsx file contains an invalid file size",
|
||||
"zipEntryLimit": "The ZIP contains more than {count} entries",
|
||||
"tempDiskSpace": "Insufficient temporary disk space for outbound import; at least {mb}MB is required",
|
||||
"xlsxEntryLimit": "The xlsx file contains more than {count} entries",
|
||||
"imageReferenceLimit": "The import contains more than {count} image references",
|
||||
"incompleteRows": "Import row states are incomplete: {success} succeeded, {fail} failed, {remaining} pending, {total} total",
|
||||
"previewSessionMissing": "The import preview session no longer exists",
|
||||
"previewJobMismatch": "The preview task does not match this import session",
|
||||
@@ -542,21 +552,105 @@
|
||||
"FAILED": "Failed",
|
||||
"EXPIRED": "Expired"
|
||||
},
|
||||
"onchainAutoTip": "On-chain hash, attestation link, and on-chain time are written automatically from the configured blockchain API response.",
|
||||
"outTimeRequired": "Outbound time is required"
|
||||
},
|
||||
"operations": {
|
||||
"filterArtwork": "Filter artwork",
|
||||
"traceStatus": "Trace Code Status",
|
||||
"activationFilter": "Activation",
|
||||
"activated": "Activated",
|
||||
"notActivated": "Not Activated",
|
||||
"matchCodes": "Match Trace Codes",
|
||||
"matchPlaceholder": "Enter one 12-digit trace code per line",
|
||||
"startMatch": "Match",
|
||||
"matchedCount": "{n} matched",
|
||||
"missingCount": "{n} missing",
|
||||
"duplicateCount": "{n} duplicate",
|
||||
"invalidCodeCount": "{n} invalid",
|
||||
"matchLimit": "Up to {n} trace codes can be matched at once",
|
||||
"addSelected": "Add Selected ({n})",
|
||||
"available": "Available",
|
||||
"unavailable": "Unavailable",
|
||||
"onchainUnavailable": "On-chain Unavailable",
|
||||
"selectAllFiltered": "Select All Filtered",
|
||||
"selectEligibleFilterTip": "Select all is available only for eligible status filters",
|
||||
"replaceFilterSelectionTitle": "Replace Filter Selection",
|
||||
"replaceFilterSelectionConfirm": "Matching trace codes will clear the current select-all-filtered selection. Continue?",
|
||||
"clearSelection": "Clear Selection",
|
||||
"filterSelectionSummary": "Selected all {n} eligible filtered records; {excluded} excluded",
|
||||
"idSelectionSummary": "{n} selected across pages",
|
||||
"batchOnchain": "On-chain ({n})",
|
||||
"batchOutbound": "Batch Outbound",
|
||||
"batchOutboundWithCount": "Outbound ({n})",
|
||||
"batchOnchainTitle": "Batch On-chain",
|
||||
"batchOnchainConfirm": "Submit {n} trace codes for on-chain processing?",
|
||||
"singleOnchainConfirm": "Submit trace code {code} for on-chain processing?",
|
||||
"confirmBatch": "Confirm ({n})",
|
||||
"jobSubmitted": "Task submitted",
|
||||
"recentJob": "The latest batch task is available",
|
||||
"viewProgress": "View Progress",
|
||||
"onchainProgress": "Batch On-chain Progress",
|
||||
"outboundProgress": "Batch Outbound Progress",
|
||||
"total": "Total",
|
||||
"success": "Success",
|
||||
"failed": "Failed",
|
||||
"skipped": "Skipped",
|
||||
"allResults": "All Results",
|
||||
"processedAt": "Processed At",
|
||||
"resultReason": "Result",
|
||||
"proofStatus": {
|
||||
"ELIGIBLE": "Eligible",
|
||||
"NONE": "Not On-chain",
|
||||
"PENDING": "Queued",
|
||||
"SUBMITTING": "Submitting",
|
||||
"CONFIRMING": "Confirming",
|
||||
"ONCHAIN": "On-chain",
|
||||
"FAILED": "Failed",
|
||||
"UNKNOWN": "Unknown"
|
||||
},
|
||||
"itemStatus": {
|
||||
"PENDING": "Pending",
|
||||
"PROCESSING": "Processing",
|
||||
"SUCCESS": "Success",
|
||||
"FAILED": "Failed",
|
||||
"SKIPPED": "Skipped",
|
||||
"UNKNOWN": "Unknown"
|
||||
},
|
||||
"jobStatus": {
|
||||
"PENDING": "Pending",
|
||||
"PROCESSING": "Processing",
|
||||
"SUCCESS": "Completed",
|
||||
"PARTIAL": "Partially Completed",
|
||||
"FAILED": "Failed",
|
||||
"CANCELLED": "Cancelled"
|
||||
},
|
||||
"reason": {
|
||||
"alreadyOutbound": "This trace code is already outbound",
|
||||
"traceCodeUnavailable": "Disabled or abnormal trace codes cannot be submitted on-chain",
|
||||
"artworkUnavailable": "The artwork is inactive or has not been approved",
|
||||
"missingPrimaryImage": "The artwork does not have a valid primary image",
|
||||
"alreadyOnchain": "This trace code is already on-chain",
|
||||
"onchainProcessing": "This trace code is being processed on-chain"
|
||||
}
|
||||
},
|
||||
"blockchain": {
|
||||
"title": "Blockchain Attestation",
|
||||
"status": "On-chain Status",
|
||||
"dataHash": "Data Hash",
|
||||
"txHash": "Tx Hash",
|
||||
"chainName": "Chain",
|
||||
"blockHeight": "Block Height",
|
||||
"tokenId": "Token ID",
|
||||
"contract": "Contract Address",
|
||||
"onchainAt": "On-chain Time",
|
||||
"explorer": "Explorer",
|
||||
"openExplorer": "Open Explorer",
|
||||
"trigger": "Trigger On-chain",
|
||||
"triggered": "On-chain task submitted"
|
||||
"triggered": "On-chain task submitted",
|
||||
"retry": "Retry On-chain",
|
||||
"unknownTip": "The transaction result cannot be confirmed yet. Resync it or correct the status manually.",
|
||||
"resync": "Resync",
|
||||
"recordTransaction": "Record Transaction Hash",
|
||||
"markFailed": "Mark Failed",
|
||||
"markFailedConfirm": "Mark this unknown attestation as failed? Use this only after manual verification."
|
||||
},
|
||||
"queryLog": {
|
||||
"result": "Result",
|
||||
@@ -723,7 +817,12 @@
|
||||
"outboundTemplate": "Download outbound import template",
|
||||
"traceExport": "Export trace codes and QR images",
|
||||
"traceBatchDelete": "Batch delete trace codes",
|
||||
"traceMatch": "Match trace codes",
|
||||
"traceOnchain": "Trace code on-chain attestation",
|
||||
"batchOnchain": "Submit batch on-chain task",
|
||||
"batchOutbound": "Submit batch outbound task",
|
||||
"outboundRecord": "Create or update outbound record",
|
||||
"outboundImages": "Manage outbound photos",
|
||||
"backupCreate": "Create backup",
|
||||
"backupDelete": "Delete backup",
|
||||
"backupDownload": "Download backup package",
|
||||
@@ -735,6 +834,9 @@
|
||||
"storageConfirm": "Switch storage config",
|
||||
"blockchainRetry": "Retry blockchain proof",
|
||||
"blockchainConfirm": "Query blockchain confirmation",
|
||||
"blockchainResync": "Resync blockchain proof",
|
||||
"blockchainRecordTransaction": "Record transaction hash manually",
|
||||
"blockchainMarkFailed": "Mark on-chain task as failed",
|
||||
"changePassword": "Change password",
|
||||
"login": "Sign in to admin",
|
||||
"upload": "Upload file"
|
||||
|
||||
@@ -55,11 +55,15 @@
|
||||
"UNBOUND": "未绑定",
|
||||
"INACTIVE": "未激活",
|
||||
"PENDING": "等待中",
|
||||
"SUBMITTING": "提交中",
|
||||
"CONFIRMING": "确认中",
|
||||
"PROCESSING": "处理中",
|
||||
"SUCCESS": "成功",
|
||||
"PARTIAL": "部分成功",
|
||||
"FAILED": "失败",
|
||||
"UNKNOWN": "状态未知",
|
||||
"SKIPPED": "已跳过",
|
||||
"CANCELLED": "已取消",
|
||||
"ONCHAIN": "已上链",
|
||||
"GENERATING": "生成中",
|
||||
"DONE": "已完成"
|
||||
@@ -165,7 +169,8 @@
|
||||
"templates": "溯源模板",
|
||||
"artworks": "艺术品档案",
|
||||
"traceCodes": "追溯码管理",
|
||||
"outbound": "出库与上链",
|
||||
"onchain": "上链管理",
|
||||
"outbound": "出库管理",
|
||||
"audit": "内容审核",
|
||||
"queryLogs": "查询日志",
|
||||
"operationLogs": "操作日志",
|
||||
@@ -324,6 +329,7 @@
|
||||
"nodes": "溯源时间轴",
|
||||
"certificates": "认证文件",
|
||||
"saveDraft": "保存草稿",
|
||||
"saveChanges": "保存修改",
|
||||
"submitReview": "提交审核",
|
||||
"submittedReview": "已提交审核,审核通过后修改才会生效",
|
||||
"noChangeTip": "作品内容未发生变化,无需提交审核",
|
||||
@@ -425,8 +431,6 @@
|
||||
"reconfirmOnchain": "重新确认",
|
||||
"confirmSubmitted": "已提交重新确认任务",
|
||||
"tableFilter": "筛选",
|
||||
"registerOutbound": "出库上链",
|
||||
"triggerOnchainOnly": "上链",
|
||||
"onchainInfo": "上链信息",
|
||||
"enableOne": "启用",
|
||||
"disableOne": "禁用",
|
||||
@@ -434,15 +438,22 @@
|
||||
"assignGroup": "设为分组"
|
||||
},
|
||||
"outbound": {
|
||||
"recordsTab": "出库登记",
|
||||
"zipTab": "ZIP 批量导入",
|
||||
"batchImportTitle": "出库批量导入",
|
||||
"import": "批量导入",
|
||||
"outTime": "出库时间",
|
||||
"outImage": "出库实况图",
|
||||
"onchainSection": "上链信息",
|
||||
"txHashTip": "由区块链接口返回后自动写入",
|
||||
"moreOnchainInfo": "更多上链信息",
|
||||
"saveRecord": "保存登记",
|
||||
"saveAndTriggerOnchain": "保存并触发上链",
|
||||
"registerRecord": "登记出库",
|
||||
"editRecord": "编辑出库记录",
|
||||
"addImage": "补录实况图",
|
||||
"imageCount": "共 {n} 张",
|
||||
"moveImageUp": "前移",
|
||||
"moveImageDown": "后移",
|
||||
"imageFormatTip": "仅支持 JPG、JPEG、PNG、WebP 图片",
|
||||
"imageSizeTip": "单张图片不能超过 100MB",
|
||||
"deleteImageConfirm": "确认删除该出库实况图?",
|
||||
"selectFile": "选择文件",
|
||||
"importing": "导入中…",
|
||||
"importResult": "导入结果",
|
||||
@@ -495,7 +506,6 @@
|
||||
"previewExpired": "导入预览会话已过期或状态已变化",
|
||||
"duplicateTraceCode": "追溯码在本次导入中重复(首次出现于第 {row} 行)",
|
||||
"batchNoMismatch": "批次编号不匹配,实际为 {value}",
|
||||
"tooManyImages": "每行最多填写 {count} 张出库图",
|
||||
"duplicateZipImage": "ZIP 中存在重复图片路径:{path}",
|
||||
"imageTooLarge": "图片超过 100MB:{path}",
|
||||
"tooManyRows": "导入数据超过 {count} 行限制",
|
||||
@@ -505,9 +515,9 @@
|
||||
"missingHeaders": "xlsx 缺少必填表头:{value}",
|
||||
"unsafeImagePath": "图片路径不安全:{path}",
|
||||
"imageOutsideDirectory": "图片必须位于 images 目录:{path}",
|
||||
"imageCodeDirectory": "图片必须位于 images/<12位追溯码>/ 目录:{path}",
|
||||
"orphanImageDirectory": "图片目录对应的追溯码未出现在 xlsx 中:{code}",
|
||||
"unsupportedImage": "不支持的图片格式:{path}",
|
||||
"duplicateImage": "同一行重复引用图片:{path}",
|
||||
"imageMissing": "图片不存在:{path}",
|
||||
"imageFormat": "图片实际格式与扩展名不一致:{path}",
|
||||
"imagePixels": "图片像素尺寸超过限制:{path}",
|
||||
"animatedImage": "不支持多帧图片:{path}",
|
||||
@@ -519,8 +529,8 @@
|
||||
"zipInvalidSize": "ZIP 包含无效文件大小",
|
||||
"xlsxInvalidSize": "xlsx 包含无效文件大小",
|
||||
"zipEntryLimit": "ZIP 文件数量超过限制(最多 {count} 个)",
|
||||
"tempDiskSpace": "出库导入临时磁盘空间不足,至少需要 {mb}MB 可用空间",
|
||||
"xlsxEntryLimit": "xlsx 文件数量超过限制(最多 {count} 个)",
|
||||
"imageReferenceLimit": "出库图片引用总数超过限制(最多 {count} 张)",
|
||||
"incompleteRows": "导入行状态不完整:成功 {success},失败 {fail},待处理 {remaining},总数 {total}",
|
||||
"previewSessionMissing": "导入预览会话不存在",
|
||||
"previewJobMismatch": "导入预览任务与会话不匹配",
|
||||
@@ -542,21 +552,105 @@
|
||||
"FAILED": "失败",
|
||||
"EXPIRED": "已过期"
|
||||
},
|
||||
"onchainAutoTip": "链上哈希、存证链接、上链时间由当前配置的区块链接口返回后自动写入。",
|
||||
"outTimeRequired": "出库时间不能为空"
|
||||
},
|
||||
"operations": {
|
||||
"filterArtwork": "筛选艺术品",
|
||||
"traceStatus": "追溯码状态",
|
||||
"activationFilter": "激活状态",
|
||||
"activated": "已激活",
|
||||
"notActivated": "未激活",
|
||||
"matchCodes": "按追溯码匹配",
|
||||
"matchPlaceholder": "每行输入一个 12 位追溯码",
|
||||
"startMatch": "开始匹配",
|
||||
"matchedCount": "匹配 {n} 个",
|
||||
"missingCount": "不存在 {n} 个",
|
||||
"duplicateCount": "重复 {n} 个",
|
||||
"invalidCodeCount": "格式错误 {n} 个",
|
||||
"matchLimit": "一次最多匹配 {n} 个追溯码",
|
||||
"addSelected": "加入所选({n})",
|
||||
"available": "可操作",
|
||||
"unavailable": "不可操作",
|
||||
"onchainUnavailable": "不可上链",
|
||||
"selectAllFiltered": "选择全部筛选结果",
|
||||
"selectEligibleFilterTip": "仅在筛选为可操作状态时支持全部选择",
|
||||
"replaceFilterSelectionTitle": "替换当前筛选选择",
|
||||
"replaceFilterSelectionConfirm": "按追溯码匹配将清空当前“全部筛选结果”选择,是否继续?",
|
||||
"clearSelection": "清空选择",
|
||||
"filterSelectionSummary": "已选择全部可操作筛选结果,共 {n} 项,已排除 {excluded} 项",
|
||||
"idSelectionSummary": "已跨页选择 {n} 项",
|
||||
"batchOnchain": "批量上链({n})",
|
||||
"batchOutbound": "批量出库",
|
||||
"batchOutboundWithCount": "批量出库({n})",
|
||||
"batchOnchainTitle": "批量上链",
|
||||
"batchOnchainConfirm": "确认提交 {n} 个追溯码进行上链?",
|
||||
"singleOnchainConfirm": "确认提交追溯码 {code} 进行上链?",
|
||||
"confirmBatch": "确认处理({n})",
|
||||
"jobSubmitted": "任务已提交",
|
||||
"recentJob": "最近提交的批量任务仍可查看",
|
||||
"viewProgress": "查看任务进度",
|
||||
"onchainProgress": "批量上链进度",
|
||||
"outboundProgress": "批量出库进度",
|
||||
"total": "总数",
|
||||
"success": "成功",
|
||||
"failed": "失败",
|
||||
"skipped": "跳过",
|
||||
"allResults": "全部结果",
|
||||
"processedAt": "处理时间",
|
||||
"resultReason": "结果说明",
|
||||
"proofStatus": {
|
||||
"ELIGIBLE": "可上链",
|
||||
"NONE": "未上链",
|
||||
"PENDING": "排队中",
|
||||
"SUBMITTING": "提交中",
|
||||
"CONFIRMING": "确认中",
|
||||
"ONCHAIN": "已上链",
|
||||
"FAILED": "上链失败",
|
||||
"UNKNOWN": "状态未知"
|
||||
},
|
||||
"itemStatus": {
|
||||
"PENDING": "待处理",
|
||||
"PROCESSING": "处理中",
|
||||
"SUCCESS": "成功",
|
||||
"FAILED": "失败",
|
||||
"SKIPPED": "已跳过",
|
||||
"UNKNOWN": "结果未知"
|
||||
},
|
||||
"jobStatus": {
|
||||
"PENDING": "等待中",
|
||||
"PROCESSING": "处理中",
|
||||
"SUCCESS": "已完成",
|
||||
"PARTIAL": "部分完成",
|
||||
"FAILED": "失败",
|
||||
"CANCELLED": "已取消"
|
||||
},
|
||||
"reason": {
|
||||
"alreadyOutbound": "该追溯码已登记出库",
|
||||
"traceCodeUnavailable": "停用或异常追溯码不可上链",
|
||||
"artworkUnavailable": "作品未生效或未审核通过",
|
||||
"missingPrimaryImage": "作品缺少有效主图",
|
||||
"alreadyOnchain": "该追溯码已上链",
|
||||
"onchainProcessing": "该追溯码正在上链处理中"
|
||||
}
|
||||
},
|
||||
"blockchain": {
|
||||
"title": "区块链存证",
|
||||
"status": "上链状态",
|
||||
"dataHash": "数据哈希",
|
||||
"txHash": "交易哈希",
|
||||
"chainName": "链名称",
|
||||
"blockHeight": "区块高度",
|
||||
"tokenId": "数字商品ID",
|
||||
"contract": "合约地址",
|
||||
"onchainAt": "上链时间",
|
||||
"explorer": "存证查询",
|
||||
"openExplorer": "打开存证查询",
|
||||
"trigger": "触发上链",
|
||||
"triggered": "已提交上链任务"
|
||||
"triggered": "已提交上链任务",
|
||||
"retry": "重新上链",
|
||||
"unknownTip": "链上交易结果暂时无法确认,可重新同步或由管理员修正状态。",
|
||||
"resync": "重新同步",
|
||||
"recordTransaction": "登记交易哈希",
|
||||
"markFailed": "标记失败",
|
||||
"markFailedConfirm": "确认将该未知状态存证标记为失败?此操作仅用于人工核验后的异常恢复。"
|
||||
},
|
||||
"queryLog": {
|
||||
"result": "查询结果",
|
||||
@@ -723,7 +817,12 @@
|
||||
"outboundTemplate": "下载出库导入模板",
|
||||
"traceExport": "导出追溯码与二维码",
|
||||
"traceBatchDelete": "批量删除追溯码",
|
||||
"traceMatch": "按追溯码批量匹配",
|
||||
"traceOnchain": "追溯码上链存证",
|
||||
"batchOnchain": "提交批量上链任务",
|
||||
"batchOutbound": "提交批量出库任务",
|
||||
"outboundRecord": "登记或修改出库记录",
|
||||
"outboundImages": "维护出库实况图",
|
||||
"backupCreate": "创建备份",
|
||||
"backupDelete": "删除备份",
|
||||
"backupDownload": "下载备份包",
|
||||
@@ -735,6 +834,9 @@
|
||||
"storageConfirm": "切换存储配置",
|
||||
"blockchainRetry": "重试区块链存证",
|
||||
"blockchainConfirm": "查询区块链确认结果",
|
||||
"blockchainResync": "重新同步区块链存证",
|
||||
"blockchainRecordTransaction": "人工登记交易哈希",
|
||||
"blockchainMarkFailed": "人工标记上链失败",
|
||||
"changePassword": "修改密码",
|
||||
"login": "登录后台",
|
||||
"upload": "上传文件"
|
||||
|
||||
@@ -27,7 +27,8 @@ export const routes: RouteRecordRaw[] = [
|
||||
{ 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: 'onchain', name: 'onchain', component: () => import('@/views/Onchain.vue') },
|
||||
{ path: 'outbound', name: 'outbound', component: () => import('@/views/OutboundManagement.vue') },
|
||||
{ path: 'audit', name: 'audit', component: () => import('@/views/Audit.vue'), meta: { roles: ['SUPER_ADMIN', 'AUDITOR'] } },
|
||||
{ path: 'query-logs', name: 'queryLogs', component: () => import('@/views/QueryLogs.vue') },
|
||||
{ path: 'operation-logs', name: 'operationLogs', component: () => import('@/views/OperationLogs.vue'), meta: { roles: ['SUPER_ADMIN'] } },
|
||||
|
||||
@@ -22,10 +22,14 @@ const STATUS_TYPE: Record<string, 'default' | 'success' | 'warning' | 'error' |
|
||||
UNBOUND: 'default',
|
||||
INACTIVE: 'info',
|
||||
PENDING: 'info',
|
||||
SUBMITTING: 'info',
|
||||
CONFIRMING: 'info',
|
||||
PROCESSING: 'info',
|
||||
GENERATING: 'info',
|
||||
PARTIAL: 'warning',
|
||||
UNKNOWN: 'warning',
|
||||
CANCELLED: 'warning',
|
||||
SKIPPED: 'default',
|
||||
DISABLED: 'warning',
|
||||
ABNORMAL: 'error',
|
||||
FAILED: 'error',
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { i18n } from '@/locales';
|
||||
|
||||
const REASON_KEYS: Record<string, string> = {
|
||||
'该追溯码已登记出库': 'alreadyOutbound',
|
||||
'停用或异常追溯码不可上链': 'traceCodeUnavailable',
|
||||
'作品未生效或未审核通过': 'artworkUnavailable',
|
||||
'作品缺少有效主图': 'missingPrimaryImage',
|
||||
'该追溯码已上链': 'alreadyOnchain',
|
||||
'该追溯码正在上链处理中': 'onchainProcessing',
|
||||
};
|
||||
|
||||
export function localizeOperationReason(value: unknown): string {
|
||||
const text = typeof value === 'string' ? value : '';
|
||||
const key = REASON_KEYS[text];
|
||||
return key ? i18n.global.t(`pages.operations.reason.${key}`) : text;
|
||||
}
|
||||
@@ -16,9 +16,9 @@
|
||||
:loading="saving"
|
||||
:disabled="!auth.canWrite || (!isNew && !hasArtworkChanges)"
|
||||
:title="!isNew && !hasArtworkChanges ? t('pages.artwork.noChangeTip') : ''"
|
||||
@click="isNew ? saveArtwork(false) : openSubmitReview()"
|
||||
@click="isNew || auth.isSuperAdmin ? saveArtwork(false) : openSubmitReview()"
|
||||
>
|
||||
{{ isNew ? t('common.action.save') : t('pages.artwork.submitReview') }}
|
||||
{{ isNew ? t('common.action.save') : auth.isSuperAdmin ? t('pages.artwork.saveChanges') : t('pages.artwork.submitReview') }}
|
||||
</n-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -303,7 +303,7 @@
|
||||
</template>
|
||||
</n-modal>
|
||||
|
||||
<n-modal v-model:show="submitReviewModal" preset="card" :title="t('pages.artwork.submitReview')" style="width:520px;max-width:94vw">
|
||||
<n-modal v-if="!auth.isSuperAdmin" v-model:show="submitReviewModal" preset="card" :title="t('pages.artwork.submitReview')" style="width:520px;max-width:94vw">
|
||||
<n-form label-placement="top">
|
||||
<n-form-item :label="t('pages.artwork.changeTitle')">
|
||||
<n-input v-model:value="submitReviewForm.title" :placeholder="t('pages.artwork.changeTitlePlaceholder')" />
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<template>
|
||||
<div class="page table-page onchain-page">
|
||||
<trace-code-operation-table mode="ONCHAIN" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import TraceCodeOperationTable from '@/components/TraceCodeOperationTable.vue';
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.onchain-page {
|
||||
min-width: 0;
|
||||
}
|
||||
</style>
|
||||
@@ -198,7 +198,7 @@ function effectiveAction(row: any) {
|
||||
if (path.includes('/backups') && method === 'DELETE') return 'delete';
|
||||
if (isBackupRoot && method === 'POST') return 'backup';
|
||||
if (path.includes('/trace-codes/batch/delete')) return 'delete';
|
||||
if (path.includes('/outbound/import/preview') || /\/outbound\/import\/?$/.test(cleanPath)) return 'upload';
|
||||
if (path.includes('/outbound/import/preview')) return 'upload';
|
||||
if (path.includes('/outbound/import-sessions') && path.includes('/commit')) return 'update';
|
||||
if (path.includes('/outbound/import-sessions') && path.includes('/result')) return 'download';
|
||||
if (path.includes('/storage/test') || path.includes('/storage/migrate') || path.includes('/storage/confirm')) return 'update';
|
||||
@@ -215,6 +215,14 @@ function pathLabel(path?: string, action?: string, method?: string) {
|
||||
const isBackupRoot = /\/backups\/?$/.test(cleanPath);
|
||||
if (path.includes('/auth/change-password')) return t('pages.operationLog.paths.changePassword');
|
||||
if (path.includes('/auth/login')) return t('pages.operationLog.paths.login');
|
||||
if (path.includes('/trace-codes/match')) return t('pages.operationLog.paths.traceMatch');
|
||||
if (path.includes('/blockchain/onchain-jobs')) return t('pages.operationLog.paths.batchOnchain');
|
||||
if (path.includes('/outbound/jobs')) return t('pages.operationLog.paths.batchOutbound');
|
||||
if (/\/outbound\/\d+\/images/.test(cleanPath)) return t('pages.operationLog.paths.outboundImages');
|
||||
if (/\/outbound\/\d+\/?$/.test(cleanPath)) return t('pages.operationLog.paths.outboundRecord');
|
||||
if (path.includes('/blockchain/onchain-chunks/') && path.includes('/resync')) return t('pages.operationLog.paths.blockchainResync');
|
||||
if (path.includes('/blockchain-proofs/') && path.includes('/transaction')) return t('pages.operationLog.paths.blockchainRecordTransaction');
|
||||
if (path.includes('/blockchain/onchain-chunks/') && path.includes('/mark-failed')) return t('pages.operationLog.paths.blockchainMarkFailed');
|
||||
if (path.includes('/outbound/import/preview')) return t('pages.operationLog.paths.outboundPreview');
|
||||
if (path.includes('/outbound/import-sessions') && path.includes('/commit')) return t('pages.operationLog.paths.outboundCommit');
|
||||
if (path.includes('/outbound/import-sessions') && path.includes('/result')) return t('pages.operationLog.paths.outboundResult');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="page table-page outbound-page">
|
||||
<div :class="['page', 'table-page', 'outbound-page', { embedded }]">
|
||||
<div class="page-toolbar outbound-toolbar">
|
||||
<div class="section-title">{{ t('pages.outbound.batchImportTitle') }}</div>
|
||||
<div class="spacer" />
|
||||
@@ -94,6 +94,8 @@ import { openMediaViewer } from '@/composables/openMediaViewer';
|
||||
import { useRemoteSort } from '@/utils/tableSort';
|
||||
import { resolveMediaUrl } from '@/utils/mediaUrl';
|
||||
|
||||
withDefaults(defineProps<{ embedded?: boolean }>(), { embedded: false });
|
||||
|
||||
const { t, locale } = useI18n();
|
||||
const auth = useAuthStore();
|
||||
|
||||
@@ -1039,22 +1041,21 @@ function localizeBackendError(value?: unknown) {
|
||||
const patterns: Array<[RegExp, string, string]> = [
|
||||
[/^追溯码在本次导入中重复(首次出现于第 (\d+) 行)$/, 'duplicateTraceCode', 'row'],
|
||||
[/^批次编号不匹配,实际为 (.+)$/, 'batchNoMismatch', 'value'],
|
||||
[/^每行最多填写 (\d+) 张出库图$/, 'tooManyImages', 'count'],
|
||||
[/^ZIP 中存在重复图片路径:(.+)$/, 'duplicateZipImage', 'path'],
|
||||
[/^图片超过 100MB:(.+)$/, 'imageTooLarge', 'path'],
|
||||
[/^导入数据超过 (\d+) 行限制$/, 'tooManyRows', 'count'],
|
||||
[/^ZIP 文件数量超过限制(最多 (\d+) 个)$/, 'zipEntryLimit', 'count'],
|
||||
[/^出库导入临时磁盘空间不足:至少需要 (\d+)MB 可用空间$/, 'tempDiskSpace', 'mb'],
|
||||
[/^xlsx 文件数量超过限制(最多 (\d+) 个)$/, 'xlsxEntryLimit', 'count'],
|
||||
[/^出库图片引用总数超过限制(最多 (\d+) 张)$/, 'imageReferenceLimit', 'count'],
|
||||
[/^xlsx 列数超过 (\d+) 列限制$/, 'tooManyColumns', 'count'],
|
||||
[/^xlsx 表头重复:(.+)$/, 'duplicateHeader', 'value'],
|
||||
[/^xlsx 包含未知表头:(.+)$/, 'unknownHeaders', 'value'],
|
||||
[/^xlsx 缺少必填表头:(.+)$/, 'missingHeaders', 'value'],
|
||||
[/^图片路径不安全:(.+)$/, 'unsafeImagePath', 'path'],
|
||||
[/^图片必须位于 images 目录:(.+)$/, 'imageOutsideDirectory', 'path'],
|
||||
[/^图片必须位于 images\/<12位追溯码>\/ 目录:(.+)$/, 'imageCodeDirectory', 'path'],
|
||||
[/^图片目录对应的追溯码未出现在 xlsx 中:(.+)$/, 'orphanImageDirectory', 'code'],
|
||||
[/^不支持的图片格式:(.+)$/, 'unsupportedImage', 'path'],
|
||||
[/^同一行重复引用图片:(.+)$/, 'duplicateImage', 'path'],
|
||||
[/^图片不存在:(.+)$/, 'imageMissing', 'path'],
|
||||
[/^图片实际格式与扩展名不一致:(.+)$/, 'imageFormat', 'path'],
|
||||
[/^图片像素尺寸超过限制:(.+)$/, 'imagePixels', 'path'],
|
||||
[/^不支持多帧图片:(.+)$/, 'animatedImage', 'path'],
|
||||
@@ -1076,6 +1077,18 @@ function localizeBackendError(value?: unknown) {
|
||||
.outbound-page {
|
||||
min-width: 0;
|
||||
}
|
||||
.outbound-page.embedded {
|
||||
height: 100%;
|
||||
min-height: 0;
|
||||
max-height: none;
|
||||
padding: 0;
|
||||
}
|
||||
.outbound-page.embedded .page-toolbar {
|
||||
position: static;
|
||||
margin: 0 0 12px;
|
||||
padding: 0 0 12px;
|
||||
box-shadow: none;
|
||||
}
|
||||
.outbound-toolbar {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
<template>
|
||||
<div class="page table-page outbound-management-page">
|
||||
<n-tabs v-model:value="activeTab" type="line" animated class="operation-tabs">
|
||||
<n-tab-pane name="records" :tab="t('pages.outbound.recordsTab')" display-directive="show">
|
||||
<trace-code-operation-table mode="OUTBOUND" />
|
||||
</n-tab-pane>
|
||||
<n-tab-pane name="zip" :tab="t('pages.outbound.zipTab')" display-directive="show">
|
||||
<outbound embedded />
|
||||
</n-tab-pane>
|
||||
</n-tabs>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import TraceCodeOperationTable from '@/components/TraceCodeOperationTable.vue';
|
||||
import Outbound from '@/views/Outbound.vue';
|
||||
|
||||
const { t } = useI18n();
|
||||
const activeTab = ref<'records' | 'zip'>('records');
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.outbound-management-page {
|
||||
min-width: 0;
|
||||
}
|
||||
.operation-tabs {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
.operation-tabs :deep(.n-tabs-nav) {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
.operation-tabs :deep(.n-tabs-pane-wrapper),
|
||||
.operation-tabs :deep(.n-tab-pane) {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
}
|
||||
.operation-tabs :deep(.n-tab-pane) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding-top: 12px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user