feat: 完善艺术品审核变更流程
This commit is contained in:
@@ -32,7 +32,10 @@ export const templateApi = {
|
||||
|
||||
export const artworkApi = {
|
||||
list: (params: object) => get<PageResult<any>>('/artworks', params),
|
||||
auditList: (params: object) => get<PageResult<any>>('/artworks/audit-list', params),
|
||||
get: (id: number) => get(`/artworks/${id}`),
|
||||
revisions: (id: number, params: object) => get<PageResult<any>>(`/artworks/${id}/revisions`, params),
|
||||
revision: (id: number, revisionId: string) => get(`/artworks/${id}/revisions/${revisionId}`),
|
||||
create: (data: object) => post('/artworks', data),
|
||||
update: (id: number, data: object) => put(`/artworks/${id}`, data),
|
||||
remove: (id: number) => del(`/artworks/${id}`),
|
||||
@@ -86,8 +89,8 @@ export const outboundApi = {
|
||||
};
|
||||
|
||||
export const auditApi = {
|
||||
list: (params: object) => get<PageResult<any>>('/artworks', params),
|
||||
audit: (id: number, data: { approved: boolean; remark?: string }) => post(`/artworks/${id}/audit`, data),
|
||||
list: (params: object) => get<PageResult<any>>('/artworks/audit-list', params),
|
||||
audit: (id: number, data: { approved: boolean; remark?: string; revisionId?: string }) => post(`/artworks/${id}/audit`, data),
|
||||
};
|
||||
|
||||
export const jobApi = {
|
||||
|
||||
@@ -225,7 +225,8 @@
|
||||
"remarkPlaceholder": "Enter rejection reason or suggestions",
|
||||
"approveConfirm": "Approve \"{title}\"? It will become visible on the consumer page.",
|
||||
"rejectedTip": "This artwork was rejected. Please revise per the notes, save and resubmit for audit.",
|
||||
"pendingTip": "Pending audit; visible on consumer page only after approval. Saving edits re-enters pending."
|
||||
"pendingTip": "Pending audit; visible on consumer page only after approval. Saving edits re-enters pending.",
|
||||
"revisionPreviewTip": "You are previewing a pending revision. It will not replace the version shown to clients until approved."
|
||||
},
|
||||
"artwork": {
|
||||
"title": "Name",
|
||||
@@ -252,6 +253,18 @@
|
||||
"nodes": "Timeline",
|
||||
"certificates": "Certificates",
|
||||
"saveDraft": "Save Draft",
|
||||
"submitReview": "Submit for Audit",
|
||||
"submittedReview": "Submitted for audit. Changes take effect only after approval.",
|
||||
"changeInfo": "Change Notes",
|
||||
"changeTitle": "Change Title",
|
||||
"changeTitlePlaceholder": "e.g. Add certificate, adjust artwork images",
|
||||
"changeReason": "Change Reason",
|
||||
"changeReasonPlaceholder": "Describe why this change is needed for audit and traceability.",
|
||||
"changeRecords": "Change Records",
|
||||
"submitter": "Submitter",
|
||||
"submittedAt": "Submitted At",
|
||||
"reviewer": "Reviewer",
|
||||
"reviewedAt": "Reviewed At",
|
||||
"traceCode": "Trace Code",
|
||||
"status": "Status",
|
||||
"create": "New Artwork",
|
||||
|
||||
@@ -225,7 +225,8 @@
|
||||
"remarkPlaceholder": "请填写驳回原因或修改建议",
|
||||
"approveConfirm": "确认通过《{title}》的审核?通过后将对客户端可见。",
|
||||
"rejectedTip": "该作品审核未通过,请按意见修改后保存再次提交审核",
|
||||
"pendingTip": "该作品待审核,审核通过后方可在客户端展示;保存修改会重新进入待审核"
|
||||
"pendingTip": "该作品待审核,审核通过后方可在客户端展示;保存修改会重新进入待审核",
|
||||
"revisionPreviewTip": "当前正在预览待审核的修改内容,审核通过前不会覆盖客户端正在展示的正式内容。"
|
||||
},
|
||||
"artwork": {
|
||||
"title": "名称",
|
||||
@@ -252,6 +253,18 @@
|
||||
"nodes": "溯源时间轴",
|
||||
"certificates": "认证文件",
|
||||
"saveDraft": "保存草稿",
|
||||
"submitReview": "提交审核",
|
||||
"submittedReview": "已提交审核,审核通过后修改才会生效",
|
||||
"changeInfo": "修改说明",
|
||||
"changeTitle": "修改标题",
|
||||
"changeTitlePlaceholder": "例如:补充认证文件、调整作品图片",
|
||||
"changeReason": "修改理由",
|
||||
"changeReasonPlaceholder": "请说明本次修改的原因,便于审核与追溯",
|
||||
"changeRecords": "修改记录",
|
||||
"submitter": "提交人",
|
||||
"submittedAt": "提交时间",
|
||||
"reviewer": "审核人",
|
||||
"reviewedAt": "审核时间",
|
||||
"traceCode": "追溯码",
|
||||
"status": "状态",
|
||||
"create": "新建作品",
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
<div class="page-title">{{ isNew ? t('pages.artwork.create') : t('pages.artwork.detail') }}</div>
|
||||
<div class="spacer" />
|
||||
<div class="edit-actions">
|
||||
<n-button :loading="saving" :disabled="!auth.canWrite" @click="saveArtwork(true)">
|
||||
<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)">
|
||||
{{ t('common.action.save') }}
|
||||
{{ isNew ? t('common.action.save') : t('pages.artwork.submitReview') }}
|
||||
</n-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -22,26 +22,34 @@
|
||||
<n-grid-item>
|
||||
<n-card :title="t('pages.artwork.basicInfo')" :bordered="false">
|
||||
<template v-if="!isNew" #header-extra>
|
||||
<n-tag :type="auditTagType(artwork?.auditStatus)" size="small">
|
||||
{{ t('pages.audit.status') }}:{{ t(`common.auditStatus.${artwork?.auditStatus || 'PENDING'}`) }}
|
||||
<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?.auditStatus === 'REJECTED'"
|
||||
v-if="!isNew && (artwork?.effectiveAuditStatus || artwork?.auditStatus) === 'REJECTED'"
|
||||
type="error"
|
||||
:show-icon="true"
|
||||
style="margin-bottom: 12px"
|
||||
>
|
||||
{{ t('pages.audit.rejectedTip') }}{{ artwork?.auditRemark ? ':' + artwork.auditRemark : '' }}
|
||||
{{ t('pages.audit.rejectedTip') }}{{ artwork?.effectiveAuditRemark || artwork?.auditRemark ? ':' + (artwork?.effectiveAuditRemark || artwork?.auditRemark) : '' }}
|
||||
</n-alert>
|
||||
<n-alert
|
||||
v-else-if="!isNew && artwork?.auditStatus === 'PENDING'"
|
||||
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')">
|
||||
@@ -115,6 +123,23 @@
|
||||
|
||||
<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>
|
||||
@@ -188,6 +213,19 @@
|
||||
</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>
|
||||
|
||||
<!-- 节点弹窗 -->
|
||||
@@ -249,10 +287,10 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, reactive, ref } from 'vue';
|
||||
import { computed, h, onMounted, reactive, ref } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import type { FormInst, FormRules } from 'naive-ui';
|
||||
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';
|
||||
@@ -272,6 +310,7 @@ 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' },
|
||||
@@ -285,10 +324,30 @@ const nodeTypeOptions = Object.values(NodeType).map((v) => ({ label: t(`common.n
|
||||
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) {
|
||||
@@ -316,6 +375,12 @@ function toMedia(url: unknown) {
|
||||
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();
|
||||
@@ -324,6 +389,30 @@ async function loadTemplates() {
|
||||
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;
|
||||
@@ -333,8 +422,30 @@ async function loadArtwork() {
|
||||
...m,
|
||||
type: m.type || (isVideoMedia(m) ? 'video' : 'image'),
|
||||
}));
|
||||
nodes.value = (a.traceNodes || []).map(normalizeNode);
|
||||
certs.value = (a.certificates || []).map(normalizeCert);
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -354,6 +465,7 @@ function normalizeCert(c: any) {
|
||||
return {
|
||||
...c,
|
||||
originKey: c.originKey ?? c.originFileUrl,
|
||||
watermarkKey: c.watermarkKey ?? c.watermarkFileUrl,
|
||||
originUrl: c.originUrl,
|
||||
watermarkUrl: c.watermarkUrl,
|
||||
};
|
||||
@@ -381,6 +493,7 @@ function buildCertPayload() {
|
||||
issuer: cert.issuer,
|
||||
type: cert.type,
|
||||
originKey: cert.originKey,
|
||||
watermarkKey: cert.watermarkKey,
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -396,27 +509,29 @@ async function saveArtwork(asDraft: boolean) {
|
||||
templateId: form.templateId,
|
||||
title: form.title,
|
||||
artist: form.artist,
|
||||
status: asDraft ? ArtworkStatus.DRAFT : isNew.value ? ArtworkStatus.ACTIVE : form.status,
|
||||
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,
|
||||
traceNodes: buildNodePayload(),
|
||||
certificates: buildCertPayload(),
|
||||
});
|
||||
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('common.msg.saved'));
|
||||
message.success(t('pages.artwork.submittedReview'));
|
||||
Object.assign(changeForm, { title: '', reason: '' });
|
||||
await loadArtwork();
|
||||
await loadRevisions();
|
||||
}
|
||||
} finally {
|
||||
saving.value = false;
|
||||
@@ -469,40 +584,33 @@ async function saveNode() {
|
||||
type: m.type || (isVideoMedia(m) ? 'video' : 'image'),
|
||||
})),
|
||||
};
|
||||
if (isNew.value) {
|
||||
const draftNode = normalizeNode({
|
||||
...payload,
|
||||
id: editingNode.value,
|
||||
localId: editingNodeLocalId.value || nextLocalId('node'),
|
||||
media: nodeForm.media,
|
||||
});
|
||||
const index = nodes.value.findIndex((item) => 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 }));
|
||||
} else if (editingNode.value) await artworkApi.updateNode(editingNode.value, payload);
|
||||
else await artworkApi.createNode(artworkId.value, payload);
|
||||
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;
|
||||
if (!isNew.value) nodes.value = (await artworkApi.listNodes(artworkId.value)).map(normalizeNode);
|
||||
} finally {
|
||||
nodeSaving.value = false;
|
||||
}
|
||||
}
|
||||
function removeNode(n: any) {
|
||||
if (isNew.value) {
|
||||
nodes.value = nodes.value.filter((item) => item.localId !== n.localId);
|
||||
nodes.value = nodes.value.map((node, index) => ({ ...node, sortOrder: index }));
|
||||
return;
|
||||
}
|
||||
dialog.warning({
|
||||
title: t('common.action.delete'),
|
||||
content: t('common.msg.confirmDelete'),
|
||||
positiveText: t('common.action.confirm'),
|
||||
negativeText: t('common.action.cancel'),
|
||||
onPositiveClick: async () => {
|
||||
await artworkApi.removeNode(n.id);
|
||||
nodes.value = (await artworkApi.listNodes(artworkId.value)).map(normalizeNode);
|
||||
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 }));
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -528,45 +636,37 @@ async function saveCert() {
|
||||
type: certForm.type,
|
||||
originKey: certForm.files[0].key,
|
||||
};
|
||||
if (isNew.value) {
|
||||
certs.value.push(
|
||||
normalizeCert({
|
||||
...payload,
|
||||
localId: nextLocalId('cert'),
|
||||
originUrl: certForm.files[0].url,
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
await artworkApi.createCert(artworkId.value, payload);
|
||||
}
|
||||
certs.value.push(
|
||||
normalizeCert({
|
||||
...payload,
|
||||
localId: nextLocalId('cert'),
|
||||
originUrl: certForm.files[0].url,
|
||||
}),
|
||||
);
|
||||
message.success(t('common.msg.created'));
|
||||
certModal.value = false;
|
||||
if (!isNew.value) certs.value = (await artworkApi.listCerts(artworkId.value)).map(normalizeCert);
|
||||
} finally {
|
||||
certSaving.value = false;
|
||||
}
|
||||
}
|
||||
function removeCert(c: any) {
|
||||
if (isNew.value) {
|
||||
certs.value = certs.value.filter((item) => item.localId !== c.localId);
|
||||
return;
|
||||
}
|
||||
dialog.warning({
|
||||
title: t('common.action.delete'),
|
||||
content: t('common.msg.confirmDelete'),
|
||||
positiveText: t('common.action.confirm'),
|
||||
negativeText: t('common.action.cancel'),
|
||||
onPositiveClick: async () => {
|
||||
await artworkApi.removeCert(c.id);
|
||||
certs.value = (await artworkApi.listCerts(artworkId.value)).map(normalizeCert);
|
||||
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();
|
||||
else nodes.value = defaultTraceNodes();
|
||||
if (!isNew.value) {
|
||||
await loadArtwork();
|
||||
await loadRevisions();
|
||||
} else nodes.value = defaultTraceNodes();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -118,8 +118,12 @@ const columns: DataTableColumns<any> = [
|
||||
render: (r) =>
|
||||
h(
|
||||
NTag,
|
||||
{ size: 'small', type: r.auditStatus === 'APPROVED' ? 'success' : r.auditStatus === 'REJECTED' ? 'error' : 'warning' },
|
||||
{ default: () => t(`common.auditStatus.${r.auditStatus || 'PENDING'}`) },
|
||||
{
|
||||
size: 'small',
|
||||
type: (r.effectiveAuditStatus || r.auditStatus) === 'APPROVED' ? 'success' : (r.effectiveAuditStatus || r.auditStatus) === 'REJECTED' ? 'error' : 'warning',
|
||||
title: r.effectiveAuditRemark || r.latestRevision?.auditRemark || '',
|
||||
},
|
||||
{ default: () => t(`common.auditStatus.${r.effectiveAuditStatus || r.auditStatus || 'PENDING'}`) },
|
||||
),
|
||||
},
|
||||
{ title: () => t('common.label.createdAt'), key: 'createdAt', width: 150, align: 'center', ellipsis: { tooltip: true }, render: (r) => fmt(r.createdAt), ...sortProps('createdAt') },
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
class="table-fill"
|
||||
flex-height
|
||||
remote
|
||||
:scroll-x="1350"
|
||||
:scroll-x="1750"
|
||||
:row-key="(r) => r.id"
|
||||
@update:sorter="onSorterChange"
|
||||
/>
|
||||
@@ -125,6 +125,8 @@ const columns: DataTableColumns<any> = [
|
||||
),
|
||||
},
|
||||
{ title: () => t('pages.artwork.artist'), key: 'artist', minWidth: 140, ellipsis: { tooltip: true }, render: (r) => r.artist || '-' },
|
||||
{ title: () => t('pages.artwork.changeTitle'), key: 'revisionTitle', minWidth: 150, ellipsis: { tooltip: true }, render: (r) => r.revisionTitle || '-' },
|
||||
{ title: () => t('pages.artwork.changeReason'), key: 'revisionReason', minWidth: 220, ellipsis: { tooltip: true }, render: (r) => r.revisionReason || '-' },
|
||||
{
|
||||
title: () => renderTableFilterTitle(t('pages.audit.status'), query.auditStatus, auditStatusOptions, (value) => setAuditFilter(value)),
|
||||
key: 'auditStatus',
|
||||
@@ -132,7 +134,9 @@ const columns: DataTableColumns<any> = [
|
||||
align: 'center',
|
||||
render: (r) => h(NTag, { size: 'small', type: auditTagType(r.auditStatus) }, { default: () => t(`common.auditStatus.${r.auditStatus}`) }),
|
||||
},
|
||||
{ title: () => t('pages.audit.remark'), key: 'auditRemark', minWidth: 280, ellipsis: { tooltip: true }, render: (r) => r.auditRemark || '-' },
|
||||
{ title: () => t('pages.artwork.submitter'), key: 'submittedBy', width: 130, align: 'center', ellipsis: { tooltip: true }, render: (r) => r.submittedBy?.realName || r.submittedBy?.username || '-' },
|
||||
{ title: () => t('pages.artwork.submittedAt'), key: 'submittedAt', width: 160, align: 'center', render: (r) => fmt(r.submittedAt) },
|
||||
{ title: () => t('pages.audit.remark'), key: 'auditRemark', minWidth: 200, ellipsis: { tooltip: true }, render: (r) => r.auditRemark || '-' },
|
||||
{ title: () => t('common.label.updatedAt'), key: 'updatedAt', width: 160, align: 'center', render: (r) => fmt(r.updatedAt), ...sortProps('updatedAt') },
|
||||
{
|
||||
title: () => t('common.label.operation'),
|
||||
@@ -154,7 +158,7 @@ async function load() {
|
||||
try {
|
||||
const res: any = await auditApi.list({
|
||||
keyword: query.keyword || undefined,
|
||||
auditStatus: query.auditStatus || undefined,
|
||||
status: query.auditStatus || undefined,
|
||||
page: page.value,
|
||||
pageSize: pageSize.value,
|
||||
...sortParams(),
|
||||
@@ -176,7 +180,7 @@ function previewArtworkImages(images: any[]) {
|
||||
);
|
||||
}
|
||||
function goDetail(r: any) {
|
||||
router.push(`/artworks/${r.id}`);
|
||||
router.push(`/artworks/${r.id}${r.revisionId ? `?revisionId=${r.revisionId}` : ''}`);
|
||||
}
|
||||
function setAuditFilter(value: string | number | null) {
|
||||
query.auditStatus = value ? String(value) : null;
|
||||
@@ -189,7 +193,7 @@ function approve(r: any) {
|
||||
positiveText: t('common.action.confirm'),
|
||||
negativeText: t('common.action.cancel'),
|
||||
onPositiveClick: async () => {
|
||||
await auditApi.audit(r.id, { approved: true });
|
||||
await auditApi.audit(r.id, { approved: true, revisionId: r.revisionId });
|
||||
message.success(t('pages.audit.approved'));
|
||||
load();
|
||||
},
|
||||
@@ -204,7 +208,8 @@ async function doReject() {
|
||||
if (rejectId.value === null) return;
|
||||
acting.value = true;
|
||||
try {
|
||||
await auditApi.audit(rejectId.value, { approved: false, remark: rejectRemark.value });
|
||||
const row = rows.value.find((item) => item.id === rejectId.value);
|
||||
await auditApi.audit(rejectId.value, { approved: false, remark: rejectRemark.value, revisionId: row?.revisionId });
|
||||
message.success(t('pages.audit.rejected'));
|
||||
rejectModal.value = false;
|
||||
load();
|
||||
|
||||
Reference in New Issue
Block a user