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

99 lines
3.0 KiB
Vue

<template>
<div class="page table-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">{{ t('pages.artwork.traceCodeManage') }}</div>
</div>
<n-card :bordered="false" class="summary-card">
<template #header>
<div class="summary-title">
<span>{{ artwork?.title || '-' }}</span>
<n-tag v-if="artwork?.auditStatus" size="small" :type="auditTagType(artwork.auditStatus)">
{{ t(`common.auditStatus.${artwork.auditStatus}`) }}
</n-tag>
</div>
</template>
<n-descriptions :column="5" label-placement="top" bordered size="small">
<n-descriptions-item :label="t('pages.artwork.archiveNo')">{{ artwork?.archiveNo || '-' }}</n-descriptions-item>
<n-descriptions-item :label="t('pages.artwork.batchCount')">{{ artwork?.codeStats?.batchTotal ?? artwork?.batches?.length ?? 0 }}</n-descriptions-item>
<n-descriptions-item :label="t('pages.artwork.codeCount')">{{ artwork?.codeStats?.total ?? 0 }}</n-descriptions-item>
<n-descriptions-item :label="t('pages.artwork.activeCount')">{{ artwork?.codeStats?.active ?? 0 }}</n-descriptions-item>
<n-descriptions-item :label="t('pages.artwork.queryTotal')">{{ artwork?.codeStats?.queryTotal ?? 0 }}</n-descriptions-item>
</n-descriptions>
</n-card>
<n-card :bordered="false" class="table-card">
<div class="trace-table-wrap">
<trace-code-panel :artwork-id="artworkId" @changed="loadArtwork" />
</div>
</n-card>
</div>
</template>
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { NIcon } from 'naive-ui';
import { ArrowBackOutline } from '@vicons/ionicons5';
import { artworkApi } from '@/api';
import TraceCodePanel from '@/components/TraceCodePanel.vue';
const route = useRoute();
const router = useRouter();
const { t } = useI18n();
const artworkId = computed(() => Number(route.params.id));
const artwork = ref<any>(null);
function auditTagType(s?: string) {
return s === 'APPROVED' ? 'success' : s === 'REJECTED' ? 'error' : 'warning';
}
async function loadArtwork() {
artwork.value = await artworkApi.get(artworkId.value);
}
onMounted(loadArtwork);
</script>
<style scoped>
.page-title {
font-size: 16px;
font-weight: 600;
}
.summary-card {
margin-bottom: 16px;
flex: 0 0 auto;
}
.table-card {
flex: 1 1 auto;
min-height: 0;
display: flex;
flex-direction: column;
}
.table-card :deep(.n-card-content) {
flex: 1 1 auto;
min-height: 0;
display: flex;
flex-direction: column;
}
.summary-title {
display: flex;
align-items: center;
gap: 10px;
min-width: 0;
}
.trace-table-wrap {
flex: 1 1 auto;
height: 100%;
min-height: 0;
display: flex;
flex-direction: column;
}
</style>