Files
Artveris/apps/admin/src/views/ArtworkEdit.vue
T

718 lines
27 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="page">
<div class="page-toolbar">
<n-button quaternary @click="router.back()">
<template #icon><n-icon :component="ArrowBackOutline" /></template>
{{ t('common.action.back') }}
</n-button>
<div class="page-title">{{ isNew ? t('pages.artwork.create') : t('pages.artwork.detail') }}</div>
<div class="spacer" />
<div class="edit-actions">
<n-button v-if="isNew" :loading="saving" :disabled="!auth.canWrite" @click="saveArtwork(true)">
{{ t('pages.artwork.saveDraft') }}
</n-button>
<n-button type="primary" :loading="saving" :disabled="!auth.canWrite" @click="saveArtwork(false)">
{{ isNew ? t('common.action.save') : t('pages.artwork.submitReview') }}
</n-button>
</div>
</div>
<n-grid :cols="1" :y-gap="16">
<!-- 基础信息 -->
<n-grid-item>
<n-card :title="t('pages.artwork.basicInfo')" :bordered="false">
<template v-if="!isNew" #header-extra>
<n-tag :type="auditTagType(artwork?.effectiveAuditStatus || artwork?.auditStatus)" size="small">
{{ t('pages.audit.status') }}:{{ t(`common.auditStatus.${artwork?.effectiveAuditStatus || artwork?.auditStatus || 'PENDING'}`) }}
</n-tag>
</template>
<n-alert
v-if="!isNew && (artwork?.effectiveAuditStatus || artwork?.auditStatus) === 'REJECTED'"
type="error"
:show-icon="true"
style="margin-bottom: 12px"
>
{{ t('pages.audit.rejectedTip') }}{{ artwork?.effectiveAuditRemark || artwork?.auditRemark ? ':' + (artwork?.effectiveAuditRemark || artwork?.auditRemark) : '' }}
</n-alert>
<n-alert
v-else-if="!isNew && (artwork?.effectiveAuditStatus || artwork?.auditStatus) === 'PENDING'"
type="info"
:show-icon="true"
style="margin-bottom: 12px"
>
{{ t('pages.audit.pendingTip') }}
</n-alert>
<n-alert
v-if="previewRevision"
type="warning"
:show-icon="true"
style="margin-bottom: 12px"
>
{{ t('pages.audit.revisionPreviewTip') }}
</n-alert>
<n-form ref="formRef" :model="form" :rules="rules" label-placement="top">
<n-grid :cols="2" :x-gap="16" item-responsive responsive="screen">
<n-form-item-gi span="2 m:1" path="templateId" :label="t('pages.artwork.template')">
<n-select
v-model:value="form.templateId"
:options="templateOptions"
:disabled="!isNew"
@update:value="onTemplateChange"
/>
</n-form-item-gi>
<n-form-item-gi span="2 m:1" path="title" :label="t('pages.artwork.title')">
<n-input v-model:value="form.title" />
</n-form-item-gi>
<n-form-item-gi span="2 m:1" :label="t('pages.artwork.artist')">
<n-input v-model:value="form.artist" />
</n-form-item-gi>
<n-form-item-gi v-if="!isNew" span="2 m:1" :label="t('common.label.status')">
<n-select v-model:value="form.status" :options="statusOptions" />
</n-form-item-gi>
</n-grid>
<n-divider style="margin: 4px 0 16px">{{ t('pages.artwork.dynamicFields') }}</n-divider>
<n-grid :cols="2" :x-gap="16" item-responsive responsive="screen">
<n-form-item-gi
v-for="f in currentFields"
:key="f.fieldKey"
span="2 m:1"
:label="f.required ? `${f.label} *` : f.label"
>
<n-date-picker
v-if="f.type === 'DATE'"
v-model:formatted-value="form.dynamicFields[f.fieldKey]"
value-format="yyyy-MM-dd"
type="date"
clearable
style="width: 100%"
/>
<n-input
v-else-if="f.type === 'TEXTAREA'"
v-model:value="form.dynamicFields[f.fieldKey]"
type="textarea"
:rows="2"
/>
<n-input-number
v-else-if="f.type === 'NUMBER'"
v-model:value="form.dynamicFields[f.fieldKey]"
style="width: 100%"
/>
<n-input
v-else-if="f.type === 'LINK'"
v-model:value="form.dynamicFields[f.fieldKey]"
placeholder="https://"
/>
<media-upload
v-else-if="f.type === 'IMAGE'"
:model-value="toMedia(form.dynamicFields[f.fieldKey])"
type="image"
:max="1"
@update:model-value="(v) => (form.dynamicFields[f.fieldKey] = v[0]?.url || '')"
/>
<media-upload
v-else-if="f.type === 'FILE'"
:model-value="toMedia(form.dynamicFields[f.fieldKey])"
type="file"
:max="1"
@update:model-value="(v) => (form.dynamicFields[f.fieldKey] = v[0]?.url || '')"
/>
<n-input v-else v-model:value="form.dynamicFields[f.fieldKey]" />
</n-form-item-gi>
</n-grid>
<n-divider style="margin: 4px 0 16px">{{ t('pages.artwork.images') }}</n-divider>
<media-sorter v-model="form.images" :max="12" />
<template v-if="!isNew && auth.canWrite">
<n-divider style="margin: 16px 0">{{ t('pages.artwork.changeInfo') }}</n-divider>
<n-grid :cols="2" :x-gap="16" item-responsive responsive="screen">
<n-form-item-gi span="2 m:1" :label="t('pages.artwork.changeTitle')">
<n-input v-model:value="changeForm.title" :placeholder="t('pages.artwork.changeTitlePlaceholder')" />
</n-form-item-gi>
<n-form-item-gi span="2 m:1" :label="t('pages.artwork.changeReason')">
<n-input
v-model:value="changeForm.reason"
type="textarea"
:rows="2"
:placeholder="t('pages.artwork.changeReasonPlaceholder')"
/>
</n-form-item-gi>
</n-grid>
</template>
</n-form>
</n-card>
</n-grid-item>
<!-- 溯源时间轴 -->
<n-grid-item>
<n-card :title="t('pages.artwork.nodes')" :bordered="false">
<template #header-extra>
<n-button v-if="auth.canWrite" size="small" type="primary" @click="openNode()">
<template #icon><n-icon :component="AddOutline" /></template>
{{ t('pages.artwork.addNode') }}
</n-button>
</template>
<n-empty v-if="!nodes.length" :description="t('common.msg.noData')" />
<n-timeline v-else>
<n-timeline-item v-for="n in nodes" :key="n.id ?? n.localId" type="info" :title="n.title">
<template #header>
<div class="node-head">
<span>{{ t(`common.nodeType.${n.nodeType}`) }} · {{ n.title }}</span>
<span v-if="auth.canWrite" class="node-ops">
<n-button text size="tiny" @click="openNode(n)">{{ t('common.action.edit') }}</n-button>
<n-button text size="tiny" type="error" @click="removeNode(n)">{{ t('common.action.delete') }}</n-button>
</span>
</div>
</template>
<div class="node-meta">{{ [fmtDate(n.occurredAt), n.location].filter(Boolean).join(' · ') }}</div>
<div>{{ n.description }}</div>
<div class="node-media">
<template v-for="m in n.media" :key="m.url || m.key">
<video
v-if="isVideoMedia(m)"
:src="m.url"
controls
preload="metadata"
style="max-height: 90px; border-radius: 6px; background: #000"
/>
<n-image v-else :src="m.url" width="64" height="64" object-fit="cover" style="border-radius:6px" />
</template>
</div>
</n-timeline-item>
</n-timeline>
</n-card>
</n-grid-item>
<!-- 认证文件 -->
<n-grid-item>
<n-card :title="t('pages.artwork.certificates')" :bordered="false">
<template #header-extra>
<n-button v-if="auth.canWrite" size="small" type="primary" @click="openCert()">
<template #icon><n-icon :component="AddOutline" /></template>
{{ t('pages.artwork.addCert') }}
</n-button>
</template>
<n-empty v-if="!certs.length" :description="t('common.msg.noData')" />
<n-grid v-else :cols="4" :x-gap="12" :y-gap="12" item-responsive responsive="screen">
<n-grid-item v-for="c in certs" :key="c.id ?? c.localId" span="2 m:1">
<n-card size="small" :title="c.name">
<template #cover>
<n-image v-if="c.watermarkUrl || c.originUrl" :src="c.watermarkUrl || c.originUrl" object-fit="cover" style="height:140px;width:100%" />
<div v-else class="cert-pending">{{ t('pages.artwork.watermarkPending') }}</div>
</template>
<div class="cert-meta">{{ c.issuer || '-' }}</div>
<template #footer>
<n-button v-if="auth.canWrite" text size="tiny" type="error" @click="removeCert(c)">
{{ t('common.action.delete') }}
</n-button>
</template>
</n-card>
</n-grid-item>
</n-grid>
</n-card>
</n-grid-item>
<n-grid-item v-if="!isNew">
<n-card :title="t('pages.artwork.changeRecords')" :bordered="false">
<n-data-table
:columns="revisionColumns"
:data="revisions"
:loading="revisionLoading"
:pagination="false"
:scroll-x="980"
size="small"
/>
</n-card>
</n-grid-item>
</n-grid>
<!-- 节点弹窗 -->
<n-modal v-model:show="nodeModal" preset="card" :title="t('pages.artwork.addNode')" style="width:560px;max-width:94vw">
<n-form :model="nodeForm" label-placement="top">
<n-grid :cols="2" :x-gap="12">
<n-form-item-gi :label="t('common.label.type')">
<n-select v-model:value="nodeForm.nodeType" :options="nodeTypeOptions" />
</n-form-item-gi>
<n-form-item-gi :label="t('pages.artwork.nodeTitle')">
<n-input v-model:value="nodeForm.title" />
</n-form-item-gi>
<n-form-item-gi :label="t('pages.artwork.nodeTime')">
<n-date-picker v-model:formatted-value="nodeForm.occurredAt" value-format="yyyy-MM-dd" type="date" style="width:100%" />
</n-form-item-gi>
<n-form-item-gi :label="t('pages.artwork.nodeLocation')">
<n-input v-model:value="nodeForm.location" />
</n-form-item-gi>
</n-grid>
<n-form-item :label="t('pages.artwork.nodeDesc')">
<n-input v-model:value="nodeForm.description" type="textarea" :rows="2" />
</n-form-item>
<n-form-item :label="t('pages.artwork.nodeMedia')">
<media-sorter v-model="nodeForm.media" :captionable="true" :max="12" />
</n-form-item>
</n-form>
<template #footer>
<div style="text-align:right">
<n-button class="mr8" @click="nodeModal = false">{{ t('common.action.cancel') }}</n-button>
<n-button type="primary" :loading="nodeSaving" @click="saveNode">{{ t('common.action.save') }}</n-button>
</div>
</template>
</n-modal>
<!-- 证书弹窗 -->
<n-modal v-model:show="certModal" preset="card" :title="t('pages.artwork.addCert')" style="width:480px;max-width:94vw">
<n-form :model="certForm" label-placement="top">
<n-form-item :label="t('pages.artwork.certName')">
<n-input v-model:value="certForm.name" />
</n-form-item>
<n-form-item :label="t('pages.artwork.certIssuer')">
<n-input v-model:value="certForm.issuer" />
</n-form-item>
<n-form-item :label="t('pages.artwork.certType')">
<n-select v-model:value="certForm.type" :options="certTypeOptions" />
</n-form-item>
<n-form-item :label="t('pages.artwork.originFile')">
<media-upload v-model="certForm.files" type="image" :max="1" />
</n-form-item>
</n-form>
<template #footer>
<div style="text-align:right">
<n-button class="mr8" @click="certModal = false">{{ t('common.action.cancel') }}</n-button>
<n-button type="primary" :loading="certSaving" @click="saveCert">{{ t('common.action.save') }}</n-button>
</div>
</template>
</n-modal>
</div>
</template>
<script setup lang="ts">
import { computed, h, onMounted, reactive, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { NTag, type DataTableColumns, type FormInst, type FormRules } from 'naive-ui';
import { ArrowBackOutline, AddOutline } from '@vicons/ionicons5';
import { ArtworkStatus, CertType, NodeType } from '@artveris/shared';
import { artworkApi, templateApi } from '@/api';
import { useAuthStore } from '@/stores/auth';
import MediaUpload from '@/components/MediaUpload.vue';
import MediaSorter from '@/components/MediaSorter.vue';
import { message, dialog } from '@/utils/feedback';
import { fmtDate } from '@/utils/format';
const { t } = useI18n();
const route = useRoute();
const router = useRouter();
const auth = useAuthStore();
const isNew = computed(() => route.params.id === 'new');
const artworkId = computed(() => Number(route.params.id));
const formRef = ref<FormInst | null>(null);
const form = reactive<any>({ templateId: null, title: '', artist: '', status: ArtworkStatus.DRAFT, dynamicFields: {}, images: [] });
const changeForm = reactive({ title: '', reason: '' });
const rules: FormRules = {
templateId: { required: true, type: 'number', message: () => t('pages.artwork.template'), trigger: 'change' },
title: { required: true, message: () => t('pages.artwork.title'), trigger: 'blur' },
};
const saving = ref(false);
const templates = ref<any[]>([]);
const templateOptions = computed(() => templates.value.map((x) => ({ label: x.name, value: x.id })));
const statusOptions = Object.values(ArtworkStatus).map((v) => ({ label: t(`common.status.${v}`), value: v }));
const nodeTypeOptions = Object.values(NodeType).map((v) => ({ label: t(`common.nodeType.${v}`), value: v }));
const certTypeOptions = Object.values(CertType).map((v) => ({ label: v, value: v }));
const currentFields = computed(() => templates.value.find((x) => x.id === form.templateId)?.fields ?? []);
const revisionColumns: DataTableColumns<any> = [
{ title: () => t('pages.artwork.changeTitle'), key: 'title', minWidth: 150, ellipsis: { tooltip: true } },
{ title: () => t('pages.artwork.changeReason'), key: 'reason', minWidth: 220, ellipsis: { tooltip: true }, render: (r) => r.reason || '-' },
{
title: () => t('pages.audit.status'),
key: 'status',
width: 110,
align: 'center',
render: (r) =>
h(NTag, { size: 'small', type: auditTagType(r.status) }, { default: () => t(`common.auditStatus.${r.status}`) }),
},
{ title: () => t('pages.artwork.submitter'), key: 'submitter', width: 130, align: 'center', ellipsis: { tooltip: true }, render: (r) => userName(r.submitter) },
{ title: () => t('pages.artwork.submittedAt'), key: 'submittedAt', width: 160, align: 'center', render: (r) => fmtDateTime(r.submittedAt) },
{ title: () => t('pages.artwork.reviewer'), key: 'reviewer', width: 130, align: 'center', ellipsis: { tooltip: true }, render: (r) => userName(r.reviewer) },
{ title: () => t('pages.artwork.reviewedAt'), key: 'reviewedAt', width: 160, align: 'center', render: (r) => fmtDateTime(r.reviewedAt) },
{ title: () => t('pages.audit.remark'), key: 'auditRemark', minWidth: 180, ellipsis: { tooltip: true }, render: (r) => r.auditRemark || '-' },
];
const artwork = ref<any>(null);
const nodes = ref<any[]>([]);
const certs = ref<any[]>([]);
const revisions = ref<any[]>([]);
const revisionLoading = ref(false);
const previewRevision = ref<any>(null);
let localIdSeed = 0;
function nextLocalId(prefix: string) {
localIdSeed += 1;
return `${prefix}-${Date.now()}-${localIdSeed}`;
}
function defaultTraceNodes() {
return [
{ localId: nextLocalId('node'), nodeType: NodeType.CREATE, title: '创作 / 选胚', sortOrder: 0, media: [] },
{ localId: nextLocalId('node'), nodeType: NodeType.PRODUCE, title: '制作过程', sortOrder: 1, media: [] },
{ localId: nextLocalId('node'), nodeType: NodeType.STORAGE, title: '仓储 / 托管', sortOrder: 2, media: [] },
{ localId: nextLocalId('node'), nodeType: NodeType.OUTBOUND, title: '出库 / 流转', sortOrder: 3, media: [] },
];
}
function onTemplateChange() {
form.dynamicFields = {};
}
// 动态字段 IMAGE/FILE 适配:dynamicFields 存 url 字符串,MediaUpload 需要 MediaItem[]
function toMedia(url: unknown) {
return url ? [{ key: String(url), url: String(url), name: String(url) }] : [];
}
function auditTagType(s?: string) {
return s === 'APPROVED' ? 'success' : s === 'REJECTED' ? 'error' : 'warning';
}
function userName(user?: any) {
return user?.realName || user?.username || '-';
}
function fmtDateTime(value?: string | Date | null) {
return value ? fmtDate(value) : '-';
}
async function loadTemplates() {
templates.value = await templateApi.options();
}
async function loadArtwork() {
const a: any = await artworkApi.get(artworkId.value);
artwork.value = a;
applyArtworkToForm(a);
nodes.value = (a.traceNodes || []).map(normalizeNode);
certs.value = (a.certificates || []).map(normalizeCert);
const revisionId = String(route.query.revisionId || '');
if (revisionId) {
previewRevision.value = await artworkApi.revision(artworkId.value, revisionId);
applySnapshotToForm(previewRevision.value.afterSnapshot);
} else {
previewRevision.value = null;
}
}
async function loadRevisions() {
if (isNew.value) return;
revisionLoading.value = true;
try {
const res: any = await artworkApi.revisions(artworkId.value, { page: 1, pageSize: 20 });
revisions.value = res.list || [];
} finally {
revisionLoading.value = false;
}
}
function applyArtworkToForm(a: any) {
form.templateId = a.templateId;
form.title = a.title;
form.artist = a.artist;
form.status = a.status;
form.dynamicFields = a.dynamicFields || {};
form.images = (a.images || []).map((m: any) => ({
...m,
type: m.type || (isVideoMedia(m) ? 'video' : 'image'),
}));
}
function applySnapshotToForm(snapshot: any) {
if (!snapshot?.artwork) return;
applyArtworkToForm({
templateId: snapshot.artwork.templateId,
title: snapshot.artwork.title,
artist: snapshot.artwork.artist,
status: snapshot.artwork.status,
dynamicFields: snapshot.artwork.dynamicFields,
images: snapshot.artwork.images,
});
nodes.value = (snapshot.traceNodes || []).map((node: any) =>
normalizeNode({ ...node, mediaFiles: node.mediaFiles || [] }),
);
certs.value = (snapshot.certificates || []).map((cert: any) =>
normalizeCert({
...cert,
originFileUrl: cert.originKey,
watermarkFileUrl: cert.watermarkKey,
originUrl: cert.originUrl,
watermarkUrl: cert.watermarkUrl,
}),
);
}
function normalizeNode(n: any) {
const media = n.media ?? n.mediaFiles ?? [];
return {
...n,
media: media.map((m: any) => ({
key: m.key || m.url,
url: m.url,
name: m.name,
type: m.type || (isVideoMedia(m) ? 'video' : 'image'),
})),
};
}
function normalizeCert(c: any) {
return {
...c,
originKey: c.originKey ?? c.originFileUrl,
watermarkKey: c.watermarkKey ?? c.watermarkFileUrl,
originUrl: c.originUrl,
watermarkUrl: c.watermarkUrl,
};
}
function buildNodePayload() {
return nodes.value.map((node, index) => ({
nodeType: node.nodeType,
title: node.title,
occurredAt: node.occurredAt || undefined,
location: node.location,
description: node.description,
sortOrder: index,
mediaFiles: (node.media || []).map((m: any) => ({
key: m.key,
name: m.name,
type: m.type || (isVideoMedia(m) ? 'video' : 'image'),
})),
}));
}
function buildCertPayload() {
return certs.value.map((cert) => ({
name: cert.name,
issuer: cert.issuer,
type: cert.type,
originKey: cert.originKey,
watermarkKey: cert.watermarkKey,
}));
}
async function saveArtwork(asDraft: boolean) {
try {
await formRef.value?.validate();
} catch {
return;
}
saving.value = true;
try {
const payload = {
templateId: form.templateId,
title: form.title,
artist: form.artist,
status: asDraft ? ArtworkStatus.DRAFT : isNew.value || form.status === ArtworkStatus.DRAFT ? ArtworkStatus.ACTIVE : form.status,
dynamicFields: form.dynamicFields,
images: form.images.map((m: any) => ({
key: m.key,
name: m.name,
type: m.type || (isVideoMedia(m) ? 'video' : 'image'),
})),
revisionTitle: changeForm.title || undefined,
revisionReason: changeForm.reason || undefined,
traceNodes: buildNodePayload(),
certificates: buildCertPayload(),
};
if (isNew.value) {
const created: any = await artworkApi.create(payload);
message.success(t('common.msg.created'));
await router.replace(`/artworks/${created.id}`);
await loadArtwork();
} else {
await artworkApi.update(artworkId.value, payload);
message.success(t('pages.artwork.submittedReview'));
Object.assign(changeForm, { title: '', reason: '' });
await loadArtwork();
await loadRevisions();
}
} finally {
saving.value = false;
}
}
/* 节点 */
const nodeModal = ref(false);
const nodeSaving = ref(false);
const editingNode = ref<number | null>(null);
const editingNodeLocalId = ref<string | null>(null);
const nodeForm = reactive<any>({ nodeType: NodeType.CREATE, title: '', occurredAt: null, location: '', description: '', media: [] });
function isVideoMedia(m: any) {
return m.type === 'video' || /\.(mp4|webm|mov|m4v)$/i.test(m.url || m.key || '');
}
function openNode(n?: any) {
editingNode.value = n?.id ?? null;
editingNodeLocalId.value = n?.localId ?? null;
Object.assign(nodeForm, {
nodeType: n?.nodeType ?? NodeType.CREATE,
title: n?.title ?? '',
occurredAt: n?.occurredAt ? fmtDate(n.occurredAt) : null,
location: n?.location ?? '',
description: n?.description ?? '',
media: (n?.media ?? []).map((m: any) => ({
key: m.key || m.url,
url: m.url,
name: m.name,
type: m.type || (isVideoMedia(m) ? 'video' : 'image'),
})),
});
nodeModal.value = true;
}
async function saveNode() {
if (!nodeForm.title) {
message.error(t('pages.artwork.nodeTitle'));
return;
}
nodeSaving.value = true;
try {
const payload = {
nodeType: nodeForm.nodeType,
title: nodeForm.title,
occurredAt: nodeForm.occurredAt || undefined,
location: nodeForm.location,
description: nodeForm.description,
mediaFiles: nodeForm.media.map((m: any) => ({
key: m.key,
name: m.name,
type: m.type || (isVideoMedia(m) ? 'video' : 'image'),
})),
};
const draftNode = normalizeNode({
...payload,
id: editingNode.value,
localId: editingNodeLocalId.value || nextLocalId('node'),
media: nodeForm.media,
});
const index = nodes.value.findIndex((item) =>
editingNode.value ? item.id === editingNode.value : item.localId === draftNode.localId,
);
if (index >= 0) nodes.value.splice(index, 1, draftNode);
else nodes.value.push(draftNode);
nodes.value = nodes.value.map((node, index) => ({ ...node, sortOrder: index }));
message.success(t('common.msg.saved'));
nodeModal.value = false;
} finally {
nodeSaving.value = false;
}
}
function removeNode(n: any) {
dialog.warning({
title: t('common.action.delete'),
content: t('common.msg.confirmDelete'),
positiveText: t('common.action.confirm'),
negativeText: t('common.action.cancel'),
onPositiveClick: () => {
nodes.value = nodes.value.filter((item) => (n.id ? item.id !== n.id : item.localId !== n.localId));
nodes.value = nodes.value.map((node, index) => ({ ...node, sortOrder: index }));
},
});
}
/* 证书 */
const certModal = ref(false);
const certSaving = ref(false);
const certForm = reactive<any>({ name: '', issuer: '', type: CertType.CERT, files: [] });
function openCert() {
Object.assign(certForm, { name: '', issuer: '', type: CertType.CERT, files: [] });
certModal.value = true;
}
async function saveCert() {
if (!certForm.name || !certForm.files.length) {
message.error(t('pages.artwork.certName'));
return;
}
certSaving.value = true;
try {
const payload = {
name: certForm.name,
issuer: certForm.issuer,
type: certForm.type,
originKey: certForm.files[0].key,
};
certs.value.push(
normalizeCert({
...payload,
localId: nextLocalId('cert'),
originUrl: certForm.files[0].url,
}),
);
message.success(t('common.msg.created'));
certModal.value = false;
} finally {
certSaving.value = false;
}
}
function removeCert(c: any) {
dialog.warning({
title: t('common.action.delete'),
content: t('common.msg.confirmDelete'),
positiveText: t('common.action.confirm'),
negativeText: t('common.action.cancel'),
onPositiveClick: () => {
certs.value = certs.value.filter((item) => (c.id ? item.id !== c.id : item.localId !== c.localId));
},
});
}
onMounted(async () => {
await loadTemplates();
if (!isNew.value) {
await loadArtwork();
await loadRevisions();
} else nodes.value = defaultTraceNodes();
});
</script>
<style scoped>
.page-title {
font-size: 16px;
font-weight: 600;
}
.mr8 {
margin-right: 8px;
}
.node-head {
display: flex;
justify-content: space-between;
gap: 8px;
}
.node-ops {
display: inline-flex;
gap: 8px;
}
.node-meta {
color: #8a8a8a;
font-size: 12px;
margin: 2px 0;
}
.node-media {
display: flex;
gap: 8px;
margin-top: 6px;
flex-wrap: wrap;
}
.cert-meta {
font-size: 12px;
color: #6b7280;
}
.cert-pending {
height: 140px;
display: flex;
align-items: center;
justify-content: center;
color: #9ca3af;
background: #f4f7fc;
}
.edit-actions {
display: inline-flex;
gap: 8px;
}
</style>