simplify
This commit is contained in:
@@ -3,6 +3,7 @@ import { ElMessage } from 'element-plus';
|
||||
import { createDocument as createDocumentApi, getTemplate } from '@/services/api';
|
||||
import { useApiAction } from '@/composables/actions/useApiAction';
|
||||
import { DEFAULT_DOCUMENT_TYPE, normalizeDocumentType } from '@/utils/documentType';
|
||||
import { formatDate as _formatDate } from '@/utils/formatDate';
|
||||
|
||||
export function useTemplatePreviewPage({ t, route, router }) {
|
||||
const { runWithLoading } = useApiAction({ t });
|
||||
@@ -14,11 +15,7 @@ export function useTemplatePreviewPage({ t, route, router }) {
|
||||
|
||||
const templateId = computed(() => route.params.templateId || route.params.id);
|
||||
|
||||
const formatDate = (dateString) => {
|
||||
if (!dateString) return t('common.unknown');
|
||||
const date = new Date(dateString);
|
||||
return date.toLocaleDateString();
|
||||
};
|
||||
const formatDate = (value) => _formatDate(value, { fallback: t('common.unknown') });
|
||||
|
||||
const scopeLabel = computed(() => {
|
||||
const scope = template.value?.scope;
|
||||
|
||||
Reference in New Issue
Block a user