feat(invoice-check): 立账凭证检核增加收件人配置并迁移到chat页面
This commit is contained in:
1 parent
18e957545c
commit
7b80b4c395
72 files changed
+2705
-263
No files matched your search
@@ -3,7 +3,8 @@
|
||||
* features/workspace/views/AccountingVoucherCheckDetailView.vue
|
||||
* 用途:立账凭证检核批次明细独立页,支持按 invoice 或按文件类型汇总。
|
||||
* 依赖:voucherCheck.api、PaginationBar、vue-router、vue-i18n、useMessage、voucherCheck.display。
|
||||
* 逻辑:路由 /workspace/accounting-voucher-check/runs/:runId;标题下用下划线 Tab 切换汇总维度;状态筛选仅在按 invoice 时出现。
|
||||
* 逻辑:独立路由或 Chat 嵌入;标题下用下划线 Tab 切换汇总维度;状态筛选仅在按 invoice 时出现。
|
||||
* Chat 嵌入时 runId / runNo 由父级传入,返回列表通过 close 事件。
|
||||
*/
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
@@ -24,6 +25,20 @@ import {
|
||||
voucherCheckStatusLabel,
|
||||
} from '../utils/voucherCheck.display';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
embedded?: boolean;
|
||||
runId?: number;
|
||||
runNo?: string | null;
|
||||
}>(), {
|
||||
embedded: false,
|
||||
runId: 0,
|
||||
runNo: null,
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
close: [];
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
const msg = useMessage();
|
||||
const route = useRoute();
|
||||
@@ -40,12 +55,17 @@ const runNo = ref('');
|
||||
const viewMode = ref<'invoice' | 'fileType'>('invoice');
|
||||
|
||||
const scheduleRunId = computed(() => {
|
||||
if (props.embedded) {
|
||||
const id = Number(props.runId);
|
||||
return Number.isInteger(id) && id > 0 ? id : 0;
|
||||
}
|
||||
const raw = route.params.runId;
|
||||
const id = Number(Array.isArray(raw) ? raw[0] : raw);
|
||||
return Number.isFinite(id) && id > 0 ? id : 0;
|
||||
});
|
||||
|
||||
const titleRunId = computed(() => {
|
||||
if (props.embedded && props.runNo) return props.runNo;
|
||||
const q = route.query.runNo;
|
||||
if (typeof q === 'string' && q.trim()) return q.trim();
|
||||
return runNo.value || String(scheduleRunId.value || '');
|
||||
@@ -111,6 +131,10 @@ function setViewMode(mode: 'invoice' | 'fileType') {
|
||||
* 返回立账凭证检核任务列表。
|
||||
*/
|
||||
function backToList() {
|
||||
if (props.embedded) {
|
||||
emit('close');
|
||||
return;
|
||||
}
|
||||
void router.push(WORKSPACE_PATHS.accountingVoucherCheck);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* features/workspace/views/AccountingVoucherCheckView.vue
|
||||
* 用途:立账凭证检核任务列表——按资料所属期间(年 + 月)查看批次统计,并展示最近一次检核进度。
|
||||
* 用途:立账凭证检核任务列表——按资料所属期间(年 + 月)查看批次统计,并展示最近一次检核。
|
||||
* 依赖:voucherCheck.api、vue-i18n、useMessage、DeleteConfirmDialog、PaginationBar、formatLocalDateTime、voucherCheck.display、auth。
|
||||
* 逻辑:路由 /workspace/accounting-voucher-check;进页默认上一个自然月;「最近一次检核」不跟筛选;强制重检仅 admin,进度在本卡轮询。
|
||||
* Chat 嵌入时由 VoucherCheckChatPanel 传入 embedded / activeTab。
|
||||
* 逻辑:独立路由或 Chat 嵌入;进页默认上一个自然月;「最近一次检核」不跟筛选;强制重检仅 admin,进度在本卡轮询。
|
||||
* 终态用矮指标格;排队/执行中才展开进度条与当前步骤。Chat 嵌入时隐藏页头与内层 Tab。
|
||||
*/
|
||||
import { computed, onMounted, onUnmounted, ref, watch } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
@@ -32,6 +34,18 @@ import {
|
||||
voucherCheckStepLabel,
|
||||
} from '../utils/voucherCheck.display';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
embedded?: boolean;
|
||||
activeTab?: 'tasks' | 'notifications';
|
||||
}>(), {
|
||||
embedded: false,
|
||||
activeTab: 'tasks',
|
||||
});
|
||||
|
||||
const emit = defineEmits<{
|
||||
'open-detail': [payload: { runId: number; runNo?: string | null }];
|
||||
}>();
|
||||
|
||||
const { t } = useI18n();
|
||||
const msg = useMessage();
|
||||
const route = useRoute();
|
||||
@@ -47,7 +61,7 @@ const pageSize = ref(50);
|
||||
const periodYear = ref('');
|
||||
const periodMonth = ref('');
|
||||
const status = ref('');
|
||||
const listTab = ref<'tasks' | 'notifications'>('tasks');
|
||||
const listTab = ref<'tasks' | 'notifications'>(props.activeTab);
|
||||
const notifyLoading = ref(false);
|
||||
const notifyItems = ref<VoucherCheckNotificationItem[]>([]);
|
||||
const notifyTotal = ref(0);
|
||||
@@ -74,6 +88,31 @@ const latestCanOpenDetail = computed(() => {
|
||||
return row.status === 'missing' || row.status === 'completed';
|
||||
});
|
||||
|
||||
/**
|
||||
* 最近一次检核的四个指标格,终态矮格与执行中共用。
|
||||
* 核心逻辑:缺件时后两项(缺件文件 / 缺件 invoice)标红。
|
||||
*/
|
||||
const latestMetrics = computed(() => {
|
||||
const row = latestRun.value;
|
||||
if (!row) return [];
|
||||
const warn = latestHasMissing.value;
|
||||
return [
|
||||
{ key: 'subject', value: row.subject_count, labelKey: 'workspace.voucherCheck.subjectCount', warn: false },
|
||||
{ key: 'archived', value: row.archived_file_count, labelKey: 'workspace.voucherCheck.archivedFiles', warn: false },
|
||||
{ key: 'missingFiles', value: row.missing_file_count, labelKey: 'workspace.voucherCheck.missingFiles', warn },
|
||||
{ key: 'missingInvoices', value: row.missing_invoice_count, labelKey: 'workspace.voucherCheck.missingInvoices', warn },
|
||||
];
|
||||
});
|
||||
|
||||
/**
|
||||
* 终态是否展示失败原因:仅技术失败或带 error_message 时占一行,完整/缺件不再重复完成提示。
|
||||
*/
|
||||
const latestShowFailureHint = computed(() => {
|
||||
const row = latestRun.value;
|
||||
if (!row || latestInProgress.value) return false;
|
||||
return row.status === 'technical_failed' || Boolean(row.error_message);
|
||||
});
|
||||
|
||||
const MONTH_VALUES = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'] as const;
|
||||
|
||||
/**
|
||||
@@ -218,6 +257,20 @@ function formatRecipientNames(names?: string[]): string {
|
||||
return names.join('、');
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开批次明细:Chat 嵌入时回传父级,独立页则跳转工作台详情路由。
|
||||
*/
|
||||
function navigateToDetail(runId: number, runNo?: string | null) {
|
||||
if (props.embedded) {
|
||||
emit('open-detail', { runId, runNo: runNo || null });
|
||||
return;
|
||||
}
|
||||
void router.push({
|
||||
path: WORKSPACE_PATHS.accountingVoucherCheckDetail(runId),
|
||||
query: runNo ? { runNo } : undefined,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 从发送记录跳转对应批次明细。
|
||||
* @param row - 企微发送记录
|
||||
@@ -227,10 +280,7 @@ function openNotifyDetail(row: VoucherCheckNotificationItem) {
|
||||
msg.error(t('workspace.voucherCheck.loadFailed'));
|
||||
return;
|
||||
}
|
||||
void router.push({
|
||||
path: WORKSPACE_PATHS.accountingVoucherCheckDetail(row.schedule_run_id),
|
||||
query: row.run_no ? { runNo: row.run_no } : undefined,
|
||||
});
|
||||
navigateToDetail(row.schedule_run_id, row.run_no);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -274,10 +324,7 @@ function openRunDetail(row: VoucherCheckRunItem) {
|
||||
msg.error(t('workspace.voucherCheck.loadFailed'));
|
||||
return;
|
||||
}
|
||||
void router.push({
|
||||
path: WORKSPACE_PATHS.accountingVoucherCheckDetail(row.schedule_run_id),
|
||||
query: row.run_no ? { runNo: row.run_no } : undefined,
|
||||
});
|
||||
navigateToDetail(row.schedule_run_id, row.run_no);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -406,10 +453,7 @@ function openLatestDetail() {
|
||||
msg.error(t('workspace.voucherCheck.loadFailed'));
|
||||
return;
|
||||
}
|
||||
void router.push({
|
||||
path: WORKSPACE_PATHS.accountingVoucherCheckDetail(row.schedule_run_id),
|
||||
query: row.run_no ? { runNo: row.run_no } : undefined,
|
||||
});
|
||||
navigateToDetail(row.schedule_run_id, row.run_no);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -419,13 +463,27 @@ watch([listTab, latestInProgress], () => {
|
||||
syncLatestPoll();
|
||||
});
|
||||
|
||||
watch(
|
||||
() => props.activeTab,
|
||||
(tab) => {
|
||||
if (!props.embedded) return;
|
||||
if (listTab.value === tab) return;
|
||||
setListTab(tab);
|
||||
},
|
||||
);
|
||||
|
||||
onMounted(async () => {
|
||||
if (redirectLegacyRunQuery()) return;
|
||||
if (!props.embedded && redirectLegacyRunQuery()) return;
|
||||
const previous = previousYearMonth();
|
||||
periodYear.value = previous.year;
|
||||
periodMonth.value = previous.month;
|
||||
const qStatus = route.query.status;
|
||||
if (typeof qStatus === 'string' && qStatus) status.value = qStatus;
|
||||
if (props.embedded) listTab.value = props.activeTab;
|
||||
if (listTab.value === 'notifications') {
|
||||
await loadNotifications();
|
||||
return;
|
||||
}
|
||||
await Promise.all([loadRuns(), loadLatestRun()]);
|
||||
});
|
||||
|
||||
@@ -435,13 +493,13 @@ onUnmounted(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="space-y-5 animate-fade-in-up">
|
||||
<header class="space-y-1">
|
||||
<div class="space-y-4 animate-fade-in-up">
|
||||
<header v-if="!embedded" class="space-y-1">
|
||||
<h1 class="text-2xl font-bold text-primary">{{ $t('workspace.voucherCheck.title') }}</h1>
|
||||
<p class="text-sm text-muted">{{ $t('workspace.voucherCheck.subtitle') }}</p>
|
||||
</header>
|
||||
|
||||
<div class="flex gap-1 border-b border-default" role="tablist">
|
||||
<div v-if="!embedded" class="flex gap-1 border-b border-default" role="tablist">
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
@@ -469,19 +527,30 @@ onUnmounted(() => {
|
||||
class="overflow-hidden rounded-2xl border border-default bg-surface"
|
||||
aria-live="polite"
|
||||
>
|
||||
<div class="flex flex-wrap items-start justify-between gap-3 bg-blue-50 px-4 py-3.5">
|
||||
<div
|
||||
class="flex flex-wrap items-start justify-between gap-3 px-4 py-2.5"
|
||||
:class="latestInProgress ? 'bg-blue-50' : ''"
|
||||
>
|
||||
<div>
|
||||
<h2 class="text-[15px] font-semibold text-primary">{{ $t('workspace.voucherCheck.latestTitle') }}</h2>
|
||||
<p v-if="latestRun" class="mt-1 text-xs text-muted">
|
||||
<h2 class="text-sm font-semibold text-primary">{{ $t('workspace.voucherCheck.latestTitle') }}</h2>
|
||||
<p v-if="latestRun" class="mt-0.5 text-xs text-muted">
|
||||
<span class="mr-3">{{ $t('workspace.voucherCheck.latestBatch', { runNo: latestRun.run_no }) }}</span>
|
||||
<span class="mr-3">{{ $t('workspace.voucherCheck.latestPeriod', { period: latestRun.period_month || '-' }) }}</span>
|
||||
<span>{{ voucherCheckModeLabel(t, latestRun.mode) }}</span>
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex shrink-0 items-center gap-2">
|
||||
<button
|
||||
v-if="latestCanOpenDetail"
|
||||
type="button"
|
||||
class="text-sm font-semibold text-brand-700 hover:underline"
|
||||
@click="openLatestDetail"
|
||||
>
|
||||
{{ $t('workspace.voucherCheck.viewLatestDetail') }}
|
||||
</button>
|
||||
<span
|
||||
v-if="latestRun"
|
||||
class="inline-flex rounded-full px-2.5 py-1 text-xs font-semibold"
|
||||
class="inline-flex rounded-full px-2.5 py-0.5 text-xs font-semibold"
|
||||
:class="latestBadgeClass(latestRun.status)"
|
||||
>
|
||||
{{ voucherCheckStatusLabel(t, latestRun.status) }}
|
||||
@@ -499,67 +568,50 @@ onUnmounted(() => {
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-4 py-3.5">
|
||||
<div v-if="latestLoading && !latestRun" class="flex items-center justify-center gap-2 py-8 text-sm text-muted">
|
||||
<Loader2 class="h-4 w-4 animate-spin" />
|
||||
{{ $t('workspace.voucherCheck.loading') }}
|
||||
</div>
|
||||
<p v-else-if="!latestRun" class="py-8 text-center text-sm text-muted">
|
||||
{{ $t('workspace.voucherCheck.latestEmpty') }}
|
||||
</p>
|
||||
<template v-else>
|
||||
<div class="h-2.5 overflow-hidden rounded-full bg-slate-200">
|
||||
<div v-if="latestLoading && !latestRun" class="flex items-center justify-center gap-2 px-4 py-6 text-sm text-muted">
|
||||
<Loader2 class="h-4 w-4 animate-spin" />
|
||||
{{ $t('workspace.voucherCheck.loading') }}
|
||||
</div>
|
||||
<p v-else-if="!latestRun" class="px-4 py-6 text-center text-sm text-muted">
|
||||
{{ $t('workspace.voucherCheck.latestEmpty') }}
|
||||
</p>
|
||||
<div v-else class="px-4 pb-3">
|
||||
<template v-if="latestInProgress">
|
||||
<div class="h-2 overflow-hidden rounded-full bg-slate-200">
|
||||
<div
|
||||
class="h-full rounded-full transition-[width] duration-300"
|
||||
:class="latestRun.status === 'technical_failed' ? 'bg-rose-600' : 'bg-teal-700'"
|
||||
class="h-full rounded-full bg-teal-700 transition-[width] duration-300"
|
||||
:style="{ width: `${latestRun.progress_percent || 0}%` }"
|
||||
/>
|
||||
</div>
|
||||
<div class="mt-2 mb-3.5 flex flex-wrap justify-between gap-3 text-xs text-muted">
|
||||
<div class="mt-1.5 mb-2.5 flex flex-wrap justify-between gap-3 text-xs text-muted">
|
||||
<span>{{ $t('workspace.voucherCheck.progress', { percent: latestRun.progress_percent || 0 }) }}</span>
|
||||
<span>
|
||||
{{ $t('workspace.voucherCheck.startedAt') }}:{{ formatLocalDateTime(latestRun.started_at) }}
|
||||
{{ $t('workspace.voucherCheck.finishedAt') }}:{{ latestInProgress ? $t('workspace.voucherCheck.inProgress') : formatLocalDateTime(latestRun.finished_at) }}
|
||||
{{ $t('workspace.voucherCheck.finishedAt') }}:{{ $t('workspace.voucherCheck.inProgress') }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="grid grid-cols-2 gap-2 md:grid-cols-4">
|
||||
<div class="rounded-[10px] border border-default bg-slate-50 px-2.5 py-3">
|
||||
<b class="block text-[22px] font-semibold leading-tight text-primary">{{ latestRun.subject_count }}</b>
|
||||
<span class="text-xs text-muted">{{ $t('workspace.voucherCheck.subjectCount') }}</span>
|
||||
</div>
|
||||
<div class="rounded-[10px] border border-default bg-slate-50 px-2.5 py-3">
|
||||
<b class="block text-[22px] font-semibold leading-tight text-primary">{{ latestRun.archived_file_count }}</b>
|
||||
<span class="text-xs text-muted">{{ $t('workspace.voucherCheck.archivedFiles') }}</span>
|
||||
</div>
|
||||
<div class="rounded-[10px] border border-default bg-slate-50 px-2.5 py-3">
|
||||
<b
|
||||
class="block text-[22px] font-semibold leading-tight"
|
||||
:class="latestHasMissing ? 'text-rose-700' : 'text-primary'"
|
||||
>{{ latestRun.missing_file_count }}</b>
|
||||
<span class="text-xs text-muted">{{ $t('workspace.voucherCheck.missingFiles') }}</span>
|
||||
</div>
|
||||
<div class="rounded-[10px] border border-default bg-slate-50 px-2.5 py-3">
|
||||
<b
|
||||
class="block text-[22px] font-semibold leading-tight"
|
||||
:class="latestHasMissing ? 'text-rose-700' : 'text-primary'"
|
||||
>{{ latestRun.missing_invoice_count }}</b>
|
||||
<span class="text-xs text-muted">{{ $t('workspace.voucherCheck.missingInvoices') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="mt-3 text-[13px] text-slate-700">
|
||||
<p class="mb-2.5 text-[13px] text-slate-700">
|
||||
{{ latestStepText(latestRun) }}
|
||||
<small v-if="latestHintText(latestRun)" class="mt-0.5 block text-muted">{{ latestHintText(latestRun) }}</small>
|
||||
</p>
|
||||
<div v-if="latestCanOpenDetail" class="mt-3 flex justify-end">
|
||||
<button
|
||||
type="button"
|
||||
class="text-sm font-semibold text-brand-700 hover:underline"
|
||||
@click="openLatestDetail"
|
||||
>
|
||||
{{ $t('workspace.voucherCheck.viewLatestDetail') }}
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
<div class="grid grid-cols-2 gap-2 md:grid-cols-4">
|
||||
<div
|
||||
v-for="metric in latestMetrics"
|
||||
:key="metric.key"
|
||||
class="rounded-[10px] border border-default bg-slate-50 px-2.5 py-2"
|
||||
>
|
||||
<b
|
||||
class="block text-lg font-semibold leading-tight tabular-nums"
|
||||
:class="metric.warn ? 'text-rose-700' : 'text-primary'"
|
||||
>{{ metric.value }}</b>
|
||||
<span class="text-[11px] text-muted">{{ $t(metric.labelKey) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<p v-if="latestShowFailureHint" class="mt-2 text-[13px] text-slate-700">
|
||||
{{ latestStepText(latestRun) }}
|
||||
<small v-if="latestHintText(latestRun)" class="mt-0.5 block text-muted">{{ latestHintText(latestRun) }}</small>
|
||||
</p>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
|
||||
Reference in new issue
Block a user