feat: 支持控制出库时间轴显示
This commit is contained in:
@@ -327,6 +327,7 @@
|
||||
"basicInfo": "Basic Info",
|
||||
"dynamicFields": "Fields",
|
||||
"nodes": "Timeline",
|
||||
"showOutboundTimeline": "Show outbound record on client",
|
||||
"certificates": "Certificates",
|
||||
"saveDraft": "Save Draft",
|
||||
"saveChanges": "Save Changes",
|
||||
|
||||
@@ -327,6 +327,7 @@
|
||||
"basicInfo": "基础信息",
|
||||
"dynamicFields": "动态字段",
|
||||
"nodes": "溯源时间轴",
|
||||
"showOutboundTimeline": "客户端显示本件出库记录",
|
||||
"certificates": "认证文件",
|
||||
"saveDraft": "保存草稿",
|
||||
"saveChanges": "保存修改",
|
||||
|
||||
@@ -153,10 +153,15 @@
|
||||
<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>
|
||||
<n-space align="center">
|
||||
<n-checkbox v-model:checked="form.showOutboundTimeline" :disabled="!auth.canWrite">
|
||||
{{ t('pages.artwork.showOutboundTimeline') }}
|
||||
</n-checkbox>
|
||||
<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>
|
||||
</n-space>
|
||||
</template>
|
||||
<n-empty v-if="!nodes.length" :description="t('common.msg.noData')" />
|
||||
<n-timeline v-else>
|
||||
@@ -352,7 +357,15 @@ 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 form = reactive<any>({
|
||||
templateId: null,
|
||||
title: '',
|
||||
artist: '',
|
||||
status: ArtworkStatus.DRAFT,
|
||||
dynamicFields: {},
|
||||
images: [],
|
||||
showOutboundTimeline: false,
|
||||
});
|
||||
const submitReviewForm = reactive({ title: '', reason: '' });
|
||||
const submitReviewModal = ref(false);
|
||||
const rules: FormRules = {
|
||||
@@ -478,6 +491,7 @@ function applyArtworkToForm(a: any) {
|
||||
form.title = a.title;
|
||||
form.artist = a.artist;
|
||||
form.status = a.status;
|
||||
form.showOutboundTimeline = a.showOutboundTimeline === true;
|
||||
form.dynamicFields = a.dynamicFields || {};
|
||||
form.images = (a.images || []).map((m: any) => ({
|
||||
...m,
|
||||
@@ -492,6 +506,7 @@ function applySnapshotToForm(snapshot: any) {
|
||||
title: snapshot.artwork.title,
|
||||
artist: snapshot.artwork.artist,
|
||||
status: snapshot.artwork.status,
|
||||
showOutboundTimeline: snapshot.artwork.showOutboundTimeline ?? false,
|
||||
dynamicFields: snapshot.artwork.dynamicFields,
|
||||
images: snapshot.artwork.images,
|
||||
});
|
||||
@@ -577,6 +592,7 @@ async function saveArtwork(asDraft: boolean) {
|
||||
templateId: form.templateId,
|
||||
title: form.title,
|
||||
artist: form.artist,
|
||||
showOutboundTimeline: form.showOutboundTimeline === true,
|
||||
status: asDraft ? ArtworkStatus.DRAFT : isNew.value || form.status === ArtworkStatus.DRAFT ? ArtworkStatus.ACTIVE : form.status,
|
||||
dynamicFields: form.dynamicFields,
|
||||
images: form.images.map((m: any) => ({
|
||||
@@ -614,6 +630,7 @@ function buildComparableSnapshot() {
|
||||
title: form.title || '',
|
||||
artist: form.artist || '',
|
||||
status: form.status,
|
||||
showOutboundTimeline: form.showOutboundTimeline === true,
|
||||
dynamicFields: normalizeJson(form.dynamicFields || {}),
|
||||
images: normalizeMedia(form.images),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user