Merge branch 'dev' into runny827
feat(training): 新增精益培训视频与周任务管理 # Conflicts: # backend/app/models/__init__.py
This commit is contained in:
1 parent
85d27e9ffa
commit
91b7233872
812 files changed
+73763
-18908
No files matched your search
@@ -1,82 +1,101 @@
|
||||
/**
|
||||
* features/workspace/api/voucherCheck.api.ts
|
||||
* 用途:工作台立账凭证检核记录查询 API 客户端。
|
||||
* 用途:工作台立账凭证检核任务列表、批次明细、企微发送记录与强制重检 API 客户端。
|
||||
* 依赖:@/shared/api/client、getAuthHeaders。
|
||||
* 逻辑:AccountingVoucherCheckView 调用;对应 /api/workspace/accounting-voucher-check/*。
|
||||
* 逻辑:AccountingVoucherCheckView / DetailView 调用;对应 /api/workspace/accounting-voucher-check/* 与排程 Excel 下载。
|
||||
*/
|
||||
import { requestJson } from '@/shared/api/client';
|
||||
import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
|
||||
export interface VoucherCheckStateItem {
|
||||
export interface VoucherCheckRunItem {
|
||||
id: number;
|
||||
scope_code: string;
|
||||
schedule_run_id?: number | null;
|
||||
run_no: string;
|
||||
profile_code: string;
|
||||
period_month: string | null;
|
||||
invoice_no: string;
|
||||
invoice_date?: string | null;
|
||||
mode: string;
|
||||
status: string;
|
||||
folder_path?: string | null;
|
||||
folder_exists?: boolean;
|
||||
matched_files?: Record<string, string>;
|
||||
missing_materials?: Array<{ code?: string; name?: string }>;
|
||||
last_checked_at?: string | null;
|
||||
last_missing_notified_on?: string | null;
|
||||
subject_count: number;
|
||||
missing_file_count: number;
|
||||
missing_invoice_count: number;
|
||||
technical_error_count: number;
|
||||
staged_file_count: number;
|
||||
finished_at?: string | null;
|
||||
error_message?: string | null;
|
||||
}
|
||||
|
||||
export interface VoucherCheckStatesResponse {
|
||||
scope_code: string;
|
||||
period: string;
|
||||
export interface VoucherCheckRunsResponse {
|
||||
page: number;
|
||||
page_size: number;
|
||||
total: number;
|
||||
items: VoucherCheckStateItem[];
|
||||
items: VoucherCheckRunItem[];
|
||||
}
|
||||
|
||||
export interface VoucherCheckRunInvoiceItem {
|
||||
id: number;
|
||||
invoice_no: string;
|
||||
result: string;
|
||||
status_label?: string | null;
|
||||
missing_materials?: Array<{ code?: string; name?: string }>;
|
||||
missing_count?: number | null;
|
||||
cells?: Record<string, string>;
|
||||
checked_at?: string | null;
|
||||
}
|
||||
|
||||
export interface VoucherCheckFileTypeSummary {
|
||||
rule_code: string;
|
||||
rule_name: string;
|
||||
missing_file_count: number;
|
||||
missing_invoice_count: number;
|
||||
missing_ratio: number;
|
||||
}
|
||||
|
||||
export interface VoucherCheckRunItemsResponse {
|
||||
run_id: number;
|
||||
engine_run_id?: number;
|
||||
run_no: string;
|
||||
page: number;
|
||||
page_size: number;
|
||||
total: number;
|
||||
items: Array<{
|
||||
id: number;
|
||||
invoice_no: string;
|
||||
invoice_date?: string | null;
|
||||
result: string;
|
||||
folder_path?: string | null;
|
||||
folder_exists?: boolean;
|
||||
matched_files?: Record<string, string>;
|
||||
missing_materials?: Array<{ code?: string; name?: string }>;
|
||||
error_code?: string | null;
|
||||
error_message?: string | null;
|
||||
checked_at?: string | null;
|
||||
}>;
|
||||
items: VoucherCheckRunInvoiceItem[];
|
||||
subject_count?: number;
|
||||
by_file_type?: VoucherCheckFileTypeSummary[];
|
||||
}
|
||||
|
||||
export interface VoucherCheckForceRunResponse {
|
||||
schedule_task_id: number;
|
||||
schedule_run_id: number;
|
||||
run_no: string;
|
||||
job_id: number;
|
||||
mode: string;
|
||||
status: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 按月份/状态/发票号筛选最新检核状态。
|
||||
* 分页查询检核任务列表。
|
||||
*/
|
||||
export function listVoucherCheckStates(params: {
|
||||
export function listVoucherCheckRuns(params: {
|
||||
period?: string;
|
||||
profile_code?: string;
|
||||
status?: string;
|
||||
invoice_no?: string;
|
||||
page?: number;
|
||||
page_size?: number;
|
||||
}) {
|
||||
const q = new URLSearchParams();
|
||||
if (params.period) q.set('period', params.period);
|
||||
if (params.profile_code) q.set('profile_code', params.profile_code);
|
||||
if (params.status) q.set('status', params.status);
|
||||
if (params.invoice_no) q.set('invoice_no', params.invoice_no);
|
||||
if (params.page) q.set('page', String(params.page));
|
||||
if (params.page_size) q.set('page_size', String(params.page_size));
|
||||
const qs = q.toString();
|
||||
return requestJson<VoucherCheckStatesResponse>(
|
||||
`/api/workspace/accounting-voucher-check/states${qs ? `?${qs}` : ''}`,
|
||||
return requestJson<VoucherCheckRunsResponse>(
|
||||
`/api/workspace/accounting-voucher-check/runs${qs ? `?${qs}` : ''}`,
|
||||
{ headers: getAuthHeaders() },
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询指定批次明细。
|
||||
* 分页查询指定排程批次的 invoice 明细,可按 result 过滤状态;同时返回 by_file_type。
|
||||
*/
|
||||
export function listVoucherCheckRunItems(runId: number, params?: { result?: string; page?: number; page_size?: number }) {
|
||||
const q = new URLSearchParams();
|
||||
@@ -89,3 +108,92 @@ export function listVoucherCheckRunItems(runId: number, params?: { result?: stri
|
||||
{ headers: getAuthHeaders() },
|
||||
);
|
||||
}
|
||||
|
||||
export interface VoucherCheckNotificationItem {
|
||||
id: number;
|
||||
run_id: number;
|
||||
schedule_run_id?: number | null;
|
||||
run_no?: string | null;
|
||||
period_month?: string | null;
|
||||
subject_count: number;
|
||||
missing_file_count: number;
|
||||
missing_invoice_count: number;
|
||||
send_status: string;
|
||||
skip_reason?: string | null;
|
||||
excel_filename?: string | null;
|
||||
has_excel?: boolean;
|
||||
recipient_names?: string[];
|
||||
sent_at?: string | null;
|
||||
created_at?: string | null;
|
||||
}
|
||||
|
||||
export interface VoucherCheckNotificationsResponse {
|
||||
page: number;
|
||||
page_size: number;
|
||||
total: number;
|
||||
items: VoucherCheckNotificationItem[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询企微缺件汇总发送记录。
|
||||
*/
|
||||
export function listVoucherCheckNotifications(params?: {
|
||||
period?: string;
|
||||
send_status?: string;
|
||||
page?: number;
|
||||
page_size?: number;
|
||||
}) {
|
||||
const q = new URLSearchParams();
|
||||
if (params?.period) q.set('period', params.period);
|
||||
if (params?.send_status) q.set('send_status', params.send_status);
|
||||
if (params?.page) q.set('page', String(params.page));
|
||||
if (params?.page_size) q.set('page_size', String(params.page_size));
|
||||
const qs = q.toString();
|
||||
return requestJson<VoucherCheckNotificationsResponse>(
|
||||
`/api/workspace/accounting-voucher-check/notifications${qs ? `?${qs}` : ''}`,
|
||||
{ headers: getAuthHeaders() },
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载该排程批次的检核结果 Excel。
|
||||
* @param scheduleRunId - ScheduleRun.id
|
||||
* @param filename - 回退文件名(无 Content-Disposition 时使用)
|
||||
*/
|
||||
export async function downloadVoucherCheckExcel(scheduleRunId: number, filename?: string | null) {
|
||||
const res = await fetch(`/api/workspace/schedule-runs/${scheduleRunId}/excel`, { headers: getAuthHeaders() });
|
||||
if (!res.ok) {
|
||||
throw new Error('excel');
|
||||
}
|
||||
const blob = await res.blob();
|
||||
const url = URL.createObjectURL(blob);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
const disposition = res.headers.get('content-disposition') || '';
|
||||
const encoded = disposition.match(/filename\*=UTF-8''([^;]+)/i)?.[1];
|
||||
const plain = disposition.match(/filename="?([^";]+)"?/i)?.[1];
|
||||
const raw = encoded || plain || filename || 'voucher_check.xlsx';
|
||||
try {
|
||||
link.download = decodeURIComponent(raw);
|
||||
} catch {
|
||||
link.download = raw;
|
||||
}
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 强制重检上一个自然月(不走增量跳过)。
|
||||
*/
|
||||
export function triggerVoucherCheckForceAll() {
|
||||
return requestJson<VoucherCheckForceRunResponse>(
|
||||
'/api/workspace/accounting-voucher-check/runs',
|
||||
{
|
||||
method: 'POST',
|
||||
headers: { ...getAuthHeaders(), 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ mode: 'force_all' }),
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
* 工作台左侧导航:子路由链接、货代/合同付款二级菜单、关联服务入口、返回聊天与退出登录。
|
||||
* 依赖:WORKSPACE_PATHS、workspace.context、ExternalSystemLinks、auth.store、contract-payment 权限常量。
|
||||
* 逻辑:底部关联服务复用 ws-nav-btn,与返回聊天/退出登录对齐;合同付款菜单仅在具备 contract_payment.access 时展示。
|
||||
* 矮屏时中间导航独立滚动,底部返回聊天/退出登录始终留在视口内。
|
||||
*/
|
||||
import { computed, inject, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
@@ -45,7 +46,7 @@ const primaryLinkItems = [
|
||||
] as const;
|
||||
|
||||
const secondaryLinkItems = [
|
||||
{ path: WORKSPACE_PATHS.accountingVoucherCheck, labelKey: 'workspace.nav.accountingVoucherCheck', icon: ClipboardCheck, match: ['workspace-accounting-voucher-check'] },
|
||||
{ path: WORKSPACE_PATHS.accountingVoucherCheck, labelKey: 'workspace.nav.accountingVoucherCheck', icon: ClipboardCheck, match: ['workspace-accounting-voucher-check', 'workspace-accounting-voucher-check-detail'] },
|
||||
{ path: WORKSPACE_PATHS.feedback, labelKey: 'workspace.nav.feedback', icon: Edit, match: ['workspace-feedback'] },
|
||||
{ path: WORKSPACE_PATHS.updates, labelKey: 'workspace.nav.updates', icon: Megaphone, match: ['workspace-updates'] },
|
||||
] as const;
|
||||
@@ -102,9 +103,9 @@ onBeforeUnmount(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<aside class="lg:sticky lg:top-0 lg:h-screen">
|
||||
<aside class="lg:h-full lg:min-h-0">
|
||||
<div
|
||||
class="flex h-full flex-col border-r border-default bg-surface shadow-sm transition-all duration-200"
|
||||
class="flex h-full min-h-0 flex-col border-r border-default bg-surface shadow-sm transition-all duration-200"
|
||||
:class="collapsed ? 'px-3 py-4' : 'px-4 py-4'"
|
||||
>
|
||||
<template v-if="collapsed">
|
||||
@@ -118,7 +119,7 @@ onBeforeUnmount(() => {
|
||||
</button>
|
||||
</template>
|
||||
|
||||
<div class="border-b border-subtle pb-4">
|
||||
<div class="shrink-0 border-b border-subtle pb-4">
|
||||
<div class="flex items-center gap-3" :class="collapsed ? 'justify-center' : ''">
|
||||
<div class="flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-gradient-to-br from-brand-500 via-brand-600 to-sky-600 text-sm font-bold text-white shadow-sm shadow-brand-500/25">
|
||||
AI
|
||||
@@ -141,7 +142,7 @@ onBeforeUnmount(() => {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex-1 py-4">
|
||||
<div class="min-h-0 flex-1 overflow-y-auto py-4">
|
||||
<nav class="space-y-2">
|
||||
<RouterLink
|
||||
v-for="item in primaryLinkItems"
|
||||
@@ -270,7 +271,7 @@ onBeforeUnmount(() => {
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
<div class="border-t border-subtle pt-4">
|
||||
<div class="shrink-0 border-t border-subtle pt-4">
|
||||
<div class="space-y-2">
|
||||
<ExternalSystemLinks
|
||||
:compact="Boolean(collapsed)"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/**
|
||||
* features/workspace/constants/routes.ts
|
||||
* 工作台子路由 path 常量,以及旧 ?view= 查询参数到新 path 的映射。
|
||||
* 立账凭证批次明细:accountingVoucherCheckDetail(scheduleRunId)。
|
||||
*/
|
||||
export const WORKSPACE_PATHS = {
|
||||
root: '/workspace',
|
||||
@@ -15,6 +16,7 @@ export const WORKSPACE_PATHS = {
|
||||
shippingNoticeTasks: '/workspace/shipping-notice/tasks',
|
||||
shippingNoticeMyTasks: '/workspace/shipping-notice/my-tasks',
|
||||
accountingVoucherCheck: '/workspace/accounting-voucher-check',
|
||||
accountingVoucherCheckDetail: (runId: number | string) => `/workspace/accounting-voucher-check/runs/${runId}`,
|
||||
contractPayment: '/workspace/contract-payment',
|
||||
contractPaymentReview: '/workspace/contract-payment/review',
|
||||
contractPaymentWeeklyBatches: '/workspace/contract-payment/weekly-batches',
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* features/workspace/pages/AccountingVoucherCheckDetailPage.vue
|
||||
* 用途:立账凭证检核批次明细工作台页面壳。
|
||||
* 依赖:AccountingVoucherCheckDetailView。
|
||||
* 逻辑:路由懒加载入口。
|
||||
*/
|
||||
import AccountingVoucherCheckDetailView from '../views/AccountingVoucherCheckDetailView.vue';
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AccountingVoucherCheckDetailView />
|
||||
</template>
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
SHIPPING_NOTICE_AGENT_CODE,
|
||||
} from '@/features/chat/api/shipping.api';
|
||||
import type { ShippingOrderExtractionRun } from '@/features/chat/types/shipping.api.types';
|
||||
import { formatOrderExtractionElapsed } from '@/features/chat/shipping/orderExtractionProgressDisplay';
|
||||
import { formatOrderExtractionElapsed, resolveOrderExtractionRunStageKey } from '@/features/chat/shipping/orderExtractionProgressDisplay';
|
||||
|
||||
const { t, te } = useI18n();
|
||||
const router = useRouter();
|
||||
@@ -69,14 +69,15 @@ async function load() {
|
||||
|
||||
/**
|
||||
* 用户可见阶段文案;无投影时回退状态文案。
|
||||
* v2:key 构造改走共享 resolveOrderExtractionRunStageKey(输出不变,仅事实解析同源)。
|
||||
*/
|
||||
function stageLabel(run: ShippingOrderExtractionRun): string {
|
||||
const stage = String(run.current_activity?.user_visible_stage || '').trim();
|
||||
if (stage) {
|
||||
const key = `chat.shippingOrderExtractionUserStage.${stage}`;
|
||||
const key = resolveOrderExtractionRunStageKey(stage, run.status);
|
||||
if (te(key)) return t(key);
|
||||
}
|
||||
const statusKey = `chat.shippingOrderExtractionCardTitle.${run.status}`;
|
||||
const statusKey = resolveOrderExtractionRunStageKey(null, run.status);
|
||||
return te(statusKey) ? t(statusKey) : run.status;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ function evidenceText(row: NonNullable<ShippingStpFacts['line_resolutions']>[num
|
||||
<tbody>
|
||||
<tr
|
||||
v-for="(row, index) in lineRows"
|
||||
:key="`${row.line_key || row.line_index}-${index}`"
|
||||
:key="`${row.line_no || row.line_index}-${index}`"
|
||||
class="border-b border-default/50 align-top"
|
||||
>
|
||||
<td class="py-1.5 pr-2 font-mono">{{ (row.line_index ?? index) + 1 }}</td>
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ function detail(): ShippingTaskDetail {
|
||||
},
|
||||
secondary: [],
|
||||
},
|
||||
checkpoint_kind: 'inventory',
|
||||
user_mode: 'must_human',
|
||||
process_gate: {
|
||||
execution_no: 'SPE-1',
|
||||
current_blocking_gate: {
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/**
|
||||
* features/workspace/utils/voucherCheck.display.ts
|
||||
* 用途:立账凭证检核列表与明细页共用的状态文案、缺件列表、缺件数、缺失占比与企微发送状态展示。
|
||||
* 依赖:vue-i18n 的 t()。
|
||||
* 逻辑:AccountingVoucherCheckView / AccountingVoucherCheckDetailView 调用。
|
||||
*/
|
||||
|
||||
/**
|
||||
* 将检核状态码映射为工作台 i18n 文案。
|
||||
* 核心逻辑:兼容引擎状态与旧 run_items 结论值;未知码原样返回。
|
||||
* @param t - i18n 翻译函数
|
||||
* @param value - 批次或 invoice 行状态
|
||||
*/
|
||||
export function voucherCheckStatusLabel(t: (key: string) => string, value: string): string {
|
||||
if (value === 'complete' || value === 'completed') return t('workspace.voucherCheck.statusComplete');
|
||||
if (value === 'missing') return t('workspace.voucherCheck.statusMissing');
|
||||
if (value === 'skipped') return t('workspace.voucherCheck.statusSkipped');
|
||||
if (value === 'technical_error' || value === 'technical_failed') return t('workspace.voucherCheck.statusTechError');
|
||||
if (value === 'failed') return t('workspace.voucherCheck.statusTechError');
|
||||
if (value === 'pending') return t('workspace.voucherCheck.statusPending');
|
||||
return value || '-';
|
||||
}
|
||||
|
||||
/**
|
||||
* 将企微汇总发送状态码映射为工作台文案。
|
||||
* @param t - i18n 翻译函数
|
||||
* @param value - send_status
|
||||
*/
|
||||
export function voucherCheckNotifyStatusLabel(t: (key: string) => string, value: string): string {
|
||||
if (value === 'sent') return t('workspace.voucherCheck.notifyStatusSent');
|
||||
if (value === 'failed') return t('workspace.voucherCheck.notifyStatusFailed');
|
||||
if (value === 'skipped_no_missing') return t('workspace.voucherCheck.notifyStatusNoMissing');
|
||||
if (value === 'skipped_no_recipients') return t('workspace.voucherCheck.notifyStatusNoRecipients');
|
||||
if (value === 'skipped_disabled') return t('workspace.voucherCheck.notifyStatusDisabled');
|
||||
return value || '-';
|
||||
}
|
||||
|
||||
/**
|
||||
* 将缺件材料列表拼成展示文本。
|
||||
* @param list - 缺件 code/name
|
||||
*/
|
||||
export function formatVoucherCheckMissing(list?: Array<{ code?: string; name?: string }>): string {
|
||||
if (!list?.length) return '-';
|
||||
return list.map((x) => x.name || x.code || '').filter(Boolean).join('、');
|
||||
}
|
||||
|
||||
/**
|
||||
* 取 invoice 行的缺件数;优先用后端 missing_count,否则数 missing_materials。
|
||||
* @param row - 批次明细行
|
||||
*/
|
||||
export function voucherCheckMissingCount(row: {
|
||||
missing_count?: number | null;
|
||||
missing_materials?: Array<{ code?: string; name?: string }>;
|
||||
}): number {
|
||||
if (typeof row.missing_count === 'number' && Number.isFinite(row.missing_count)) {
|
||||
return row.missing_count;
|
||||
}
|
||||
return row.missing_materials?.length ?? 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将缺失占比格式化为百分数。
|
||||
* @param ratio - 0–1 之间的比例
|
||||
*/
|
||||
export function formatVoucherCheckMissingRatio(ratio?: number | null): string {
|
||||
const value = typeof ratio === 'number' && Number.isFinite(ratio) ? ratio : 0;
|
||||
return `${(value * 100).toFixed(1)}%`;
|
||||
}
|
||||
@@ -0,0 +1,281 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* features/workspace/views/AccountingVoucherCheckDetailView.vue
|
||||
* 用途:立账凭证检核批次明细独立页,支持按 invoice 或按文件类型汇总。
|
||||
* 依赖:voucherCheck.api、PaginationBar、vue-router、vue-i18n、useMessage、voucherCheck.display。
|
||||
* 逻辑:路由 /workspace/accounting-voucher-check/runs/:runId;标题下用下划线 Tab 切换汇总维度;状态筛选仅在按 invoice 时出现。
|
||||
*/
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { ArrowLeft, Loader2, Search } from 'lucide-vue-next';
|
||||
import PaginationBar from '@/shared/components/PaginationBar.vue';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { WORKSPACE_PATHS } from '../constants/routes';
|
||||
import {
|
||||
listVoucherCheckRunItems,
|
||||
type VoucherCheckFileTypeSummary,
|
||||
type VoucherCheckRunInvoiceItem,
|
||||
} from '../api/voucherCheck.api';
|
||||
import {
|
||||
formatVoucherCheckMissing,
|
||||
formatVoucherCheckMissingRatio,
|
||||
voucherCheckMissingCount,
|
||||
voucherCheckStatusLabel,
|
||||
} from '../utils/voucherCheck.display';
|
||||
|
||||
const { t } = useI18n();
|
||||
const msg = useMessage();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const loading = ref(false);
|
||||
const items = ref<VoucherCheckRunInvoiceItem[]>([]);
|
||||
const fileTypeRows = ref<VoucherCheckFileTypeSummary[]>([]);
|
||||
const total = ref(0);
|
||||
const page = ref(1);
|
||||
const pageSize = ref(50);
|
||||
const statusFilter = ref('');
|
||||
const runNo = ref('');
|
||||
const viewMode = ref<'invoice' | 'fileType'>('invoice');
|
||||
|
||||
const scheduleRunId = computed(() => {
|
||||
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(() => {
|
||||
const q = route.query.runNo;
|
||||
if (typeof q === 'string' && q.trim()) return q.trim();
|
||||
return runNo.value || String(scheduleRunId.value || '');
|
||||
});
|
||||
|
||||
const statusOptions = computed(() => [
|
||||
{ value: '', label: t('workspace.voucherCheck.statusAll') },
|
||||
{ value: 'missing', label: t('workspace.voucherCheck.statusMissing') },
|
||||
{ value: 'complete', label: t('workspace.voucherCheck.statusComplete') },
|
||||
{ value: 'technical_error', label: t('workspace.voucherCheck.statusTechError') },
|
||||
]);
|
||||
|
||||
const pages = computed(() => Math.max(1, Math.ceil((total.value || 0) / Math.max(1, pageSize.value))));
|
||||
|
||||
/**
|
||||
* 加载当前排程批次明细;invoice 行分页,文件类型汇总为整批快照。
|
||||
*/
|
||||
async function loadItems() {
|
||||
if (!scheduleRunId.value) {
|
||||
items.value = [];
|
||||
fileTypeRows.value = [];
|
||||
total.value = 0;
|
||||
return;
|
||||
}
|
||||
loading.value = true;
|
||||
try {
|
||||
const data = await listVoucherCheckRunItems(scheduleRunId.value, {
|
||||
result: statusFilter.value || undefined,
|
||||
page: page.value,
|
||||
page_size: pageSize.value,
|
||||
});
|
||||
items.value = data.items || [];
|
||||
fileTypeRows.value = data.by_file_type || [];
|
||||
total.value = data.total || 0;
|
||||
runNo.value = data.run_no || '';
|
||||
} catch (e: any) {
|
||||
items.value = [];
|
||||
fileTypeRows.value = [];
|
||||
total.value = 0;
|
||||
msg.error(e?.message || t('workspace.voucherCheck.loadFailed'));
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态筛选变更时回到第一页再查询。
|
||||
*/
|
||||
function applyStatusFilter() {
|
||||
page.value = 1;
|
||||
void loadItems();
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换 invoice / 文件类型汇总视图。
|
||||
* @param mode - 明细聚合维度
|
||||
*/
|
||||
function setViewMode(mode: 'invoice' | 'fileType') {
|
||||
viewMode.value = mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回立账凭证检核任务列表。
|
||||
*/
|
||||
function backToList() {
|
||||
void router.push(WORKSPACE_PATHS.accountingVoucherCheck);
|
||||
}
|
||||
|
||||
/**
|
||||
* invoice 行状态徽标样式。
|
||||
* @param result - 引擎结论码
|
||||
*/
|
||||
function statusBadgeClass(result: string): string {
|
||||
if (result === 'missing') return 'bg-rose-50 text-rose-700';
|
||||
if (result === 'complete' || result === 'completed') return 'bg-emerald-50 text-emerald-700';
|
||||
if (result === 'technical_error' || result === 'technical_failed' || result === 'failed') {
|
||||
return 'bg-surface-soft text-secondary';
|
||||
}
|
||||
return 'bg-surface-soft text-secondary';
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
void loadItems();
|
||||
});
|
||||
|
||||
watch(scheduleRunId, () => {
|
||||
page.value = 1;
|
||||
statusFilter.value = '';
|
||||
viewMode.value = 'invoice';
|
||||
void loadItems();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="space-y-5 animate-fade-in-up">
|
||||
<header class="flex flex-wrap items-start justify-between gap-3">
|
||||
<div class="space-y-1">
|
||||
<h1 class="text-2xl font-bold text-primary">
|
||||
{{ $t('workspace.voucherCheck.runItemsTitle', { runId: titleRunId }) }}
|
||||
</h1>
|
||||
<p class="text-sm text-muted">{{ $t('workspace.voucherCheck.detailSubtitle') }}</p>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1.5 rounded-xl border border-default px-3 py-1.5 text-sm font-medium text-secondary transition-colors hover:bg-surface-soft"
|
||||
@click="backToList"
|
||||
>
|
||||
<ArrowLeft class="h-3.5 w-3.5" />
|
||||
{{ $t('workspace.voucherCheck.backToList') }}
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<div class="flex gap-1 border-b border-default" role="tablist">
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
class="px-4 py-2.5 text-sm font-medium border-b-2 -mb-px transition-colors"
|
||||
:class="viewMode === 'invoice' ? 'border-brand-600 text-brand-600' : 'border-transparent text-muted hover:text-secondary'"
|
||||
:aria-selected="viewMode === 'invoice'"
|
||||
@click="setViewMode('invoice')"
|
||||
>
|
||||
{{ $t('workspace.voucherCheck.viewByInvoice') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
class="px-4 py-2.5 text-sm font-medium border-b-2 -mb-px transition-colors"
|
||||
:class="viewMode === 'fileType' ? 'border-brand-600 text-brand-600' : 'border-transparent text-muted hover:text-secondary'"
|
||||
:aria-selected="viewMode === 'fileType'"
|
||||
@click="setViewMode('fileType')"
|
||||
>
|
||||
{{ $t('workspace.voucherCheck.viewByFileType') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<section
|
||||
v-if="viewMode === 'invoice'"
|
||||
class="flex flex-wrap items-end gap-3 rounded-2xl border border-default/80 bg-surface/70 px-4 py-3 shadow-sm"
|
||||
>
|
||||
<label class="flex flex-col gap-1 text-xs font-medium text-muted">
|
||||
{{ $t('workspace.voucherCheck.status') }}
|
||||
<select v-model="statusFilter" class="rounded-xl border border-default bg-surface px-3 py-1.5 text-sm text-primary">
|
||||
<option v-for="opt in statusOptions" :key="opt.value || 'all'" :value="opt.value">{{ opt.label }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1 rounded-xl bg-brand-600 px-3 py-1.5 text-sm font-medium text-white transition-colors hover:bg-brand-700"
|
||||
@click="applyStatusFilter"
|
||||
>
|
||||
<Search class="h-3.5 w-3.5" />
|
||||
{{ $t('workspace.voucherCheck.search') }}
|
||||
</button>
|
||||
</section>
|
||||
|
||||
<section class="overflow-hidden rounded-2xl border border-default bg-surface">
|
||||
<div v-if="loading" class="flex items-center justify-center gap-2 py-16 text-sm text-muted">
|
||||
<Loader2 class="h-4 w-4 animate-spin" />
|
||||
{{ $t('workspace.voucherCheck.loading') }}
|
||||
</div>
|
||||
|
||||
<template v-else-if="viewMode === 'fileType'">
|
||||
<div v-if="!fileTypeRows.length" class="py-16 text-center text-sm text-muted">
|
||||
{{ $t('workspace.voucherCheck.fileTypeEmpty') }}
|
||||
</div>
|
||||
<div v-else class="overflow-auto scrollbar-thin">
|
||||
<table class="w-full min-w-[640px] text-left text-sm">
|
||||
<thead class="sticky top-0 z-10">
|
||||
<tr class="border-b border-subtle bg-surface-soft text-xs font-semibold text-secondary">
|
||||
<th class="bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.fileType') }}</th>
|
||||
<th class="bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.missingFiles') }}</th>
|
||||
<th class="bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.involvedInvoiceCount') }}</th>
|
||||
<th class="bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.missingRatio') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="row in fileTypeRows" :key="row.rule_code" class="border-b border-subtle hover:bg-surface-soft/50">
|
||||
<td class="px-4 py-3 font-medium text-primary">{{ row.rule_name || row.rule_code }}</td>
|
||||
<td class="px-4 py-3 text-muted">{{ row.missing_file_count }}</td>
|
||||
<td class="px-4 py-3 text-muted">{{ row.missing_invoice_count }}</td>
|
||||
<td class="px-4 py-3 text-muted">{{ formatVoucherCheckMissingRatio(row.missing_ratio) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template v-else>
|
||||
<div v-if="!items.length" class="py-16 text-center text-sm text-muted">
|
||||
{{ $t('workspace.voucherCheck.detailEmpty') }}
|
||||
</div>
|
||||
<div v-else class="max-h-[calc(100vh-18rem)] overflow-auto scrollbar-thin">
|
||||
<table class="w-full min-w-[720px] text-left text-sm">
|
||||
<thead class="sticky top-0 z-10">
|
||||
<tr class="border-b border-subtle bg-surface-soft text-xs font-semibold text-secondary">
|
||||
<th class="bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.invoiceNo') }}</th>
|
||||
<th class="bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.status') }}</th>
|
||||
<th class="bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.missingCount') }}</th>
|
||||
<th class="bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.missing') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="(row, idx) in items" :key="`${row.invoice_no}-${idx}`" class="border-b border-subtle hover:bg-surface-soft/50">
|
||||
<td class="px-4 py-3 font-medium text-primary">{{ row.invoice_no }}</td>
|
||||
<td class="px-4 py-3">
|
||||
<span
|
||||
class="inline-flex rounded-full px-2.5 py-1 text-xs font-semibold"
|
||||
:class="statusBadgeClass(row.result)"
|
||||
>
|
||||
{{ voucherCheckStatusLabel(t, row.result) }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-muted">{{ voucherCheckMissingCount(row) }}</td>
|
||||
<td class="px-4 py-3 text-muted">{{ formatVoucherCheckMissing(row.missing_materials) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</template>
|
||||
</section>
|
||||
|
||||
<PaginationBar
|
||||
v-if="viewMode === 'invoice'"
|
||||
v-model:page="page"
|
||||
v-model:page-size="pageSize"
|
||||
:total="total"
|
||||
:pages="pages"
|
||||
:visible="total > 0 || !!statusFilter"
|
||||
@update:page="() => loadItems()"
|
||||
@update:page-size="() => loadItems()"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,67 +1,209 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* features/workspace/views/AccountingVoucherCheckView.vue
|
||||
* 用途:立账凭证检核记录页——按月筛选最新状态与缺资料票。
|
||||
* 依赖:voucherCheck.api、vue-i18n、useMessage。
|
||||
* 逻辑:路由 /workspace/accounting-voucher-check;企微 textcard 也可跳转至此。
|
||||
* 用途:立账凭证检核任务列表——按资料所属期间查看批次统计。
|
||||
* 依赖:voucherCheck.api、vue-i18n、useMessage、DeleteConfirmDialog、PaginationBar、formatLocalDateTime、voucherCheck.display。
|
||||
* 逻辑:路由 /workspace/accounting-voucher-check;Tab 切换检核任务与企微发送记录;查看详情进入独立明细页;企微 ?run_id= 重定向到明细路由。
|
||||
*/
|
||||
import { computed, onMounted, ref, watch } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { computed, onMounted, onUnmounted, ref } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { Loader2, RefreshCw, Search } from 'lucide-vue-next';
|
||||
import { Download, Loader2, RefreshCw, RotateCcw, Search } from 'lucide-vue-next';
|
||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||
import PaginationBar from '@/shared/components/PaginationBar.vue';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { formatLocalDateTime } from '@/shared/utils/dateTime';
|
||||
import { WORKSPACE_PATHS } from '../constants/routes';
|
||||
import {
|
||||
listVoucherCheckRunItems,
|
||||
listVoucherCheckStates,
|
||||
type VoucherCheckStateItem,
|
||||
downloadVoucherCheckExcel,
|
||||
listVoucherCheckNotifications,
|
||||
listVoucherCheckRuns,
|
||||
triggerVoucherCheckForceAll,
|
||||
type VoucherCheckNotificationItem,
|
||||
type VoucherCheckRunItem,
|
||||
} from '../api/voucherCheck.api';
|
||||
import { voucherCheckNotifyStatusLabel, voucherCheckStatusLabel } from '../utils/voucherCheck.display';
|
||||
|
||||
const { t } = useI18n();
|
||||
const msg = useMessage();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const loading = ref(false);
|
||||
const items = ref<VoucherCheckStateItem[]>([]);
|
||||
const forcing = ref(false);
|
||||
const showForceConfirm = ref(false);
|
||||
const items = ref<VoucherCheckRunItem[]>([]);
|
||||
const total = ref(0);
|
||||
const page = ref(1);
|
||||
const pageSize = 50;
|
||||
const pageSize = ref(50);
|
||||
const period = ref('');
|
||||
const status = ref('');
|
||||
const invoiceNo = ref('');
|
||||
const runIdFilter = ref<number | null>(null);
|
||||
const runItems = ref<Awaited<ReturnType<typeof listVoucherCheckRunItems>>['items']>([]);
|
||||
const listTab = ref<'tasks' | 'notifications'>('tasks');
|
||||
const notifyLoading = ref(false);
|
||||
const notifyItems = ref<VoucherCheckNotificationItem[]>([]);
|
||||
const notifyTotal = ref(0);
|
||||
const notifyPage = ref(1);
|
||||
const notifyPageSize = ref(50);
|
||||
const notifyStatus = ref('');
|
||||
let forcePollTimer: ReturnType<typeof setInterval> | null = null;
|
||||
|
||||
/**
|
||||
* 默认检核月份(当前自然月 YYYY-MM)。
|
||||
* 默认资料所属期间为上一个自然月 YYYY-MM。
|
||||
*/
|
||||
function currentPeriod(): string {
|
||||
function previousPeriod(): string {
|
||||
const d = new Date();
|
||||
d.setDate(1);
|
||||
d.setMonth(d.getMonth() - 1);
|
||||
const m = String(d.getMonth() + 1).padStart(2, '0');
|
||||
return `${d.getFullYear()}-${m}`;
|
||||
}
|
||||
|
||||
const statusOptions = computed(() => [
|
||||
{ value: '', label: t('workspace.voucherCheck.statusAll') },
|
||||
{ value: 'complete', label: t('workspace.voucherCheck.statusComplete') },
|
||||
{ value: 'missing', label: t('workspace.voucherCheck.statusMissing') },
|
||||
{ value: 'completed', label: t('workspace.voucherCheck.statusComplete') },
|
||||
{ value: 'technical_failed', label: t('workspace.voucherCheck.statusTechError') },
|
||||
]);
|
||||
|
||||
const notifyStatusOptions = computed(() => [
|
||||
{ value: '', label: t('workspace.voucherCheck.notifyStatusAll') },
|
||||
{ value: 'sent', label: t('workspace.voucherCheck.notifyStatusSent') },
|
||||
{ value: 'failed', label: t('workspace.voucherCheck.notifyStatusFailed') },
|
||||
{ value: 'skipped_no_missing', label: t('workspace.voucherCheck.notifyStatusNoMissing') },
|
||||
{ value: 'skipped_no_recipients', label: t('workspace.voucherCheck.notifyStatusNoRecipients') },
|
||||
{ value: 'skipped_disabled', label: t('workspace.voucherCheck.notifyStatusDisabled') },
|
||||
]);
|
||||
|
||||
const pages = computed(() =>
|
||||
Math.max(1, Math.ceil((total.value || 0) / Math.max(1, pageSize.value))),
|
||||
);
|
||||
|
||||
const notifyPages = computed(() =>
|
||||
Math.max(1, Math.ceil((notifyTotal.value || 0) / Math.max(1, notifyPageSize.value))),
|
||||
);
|
||||
|
||||
/**
|
||||
* 加载最新状态列表。
|
||||
* 加载企微缺件汇总发送记录。
|
||||
*/
|
||||
async function loadStates() {
|
||||
async function loadNotifications() {
|
||||
notifyLoading.value = true;
|
||||
try {
|
||||
const data = await listVoucherCheckNotifications({
|
||||
period: period.value || undefined,
|
||||
send_status: notifyStatus.value || undefined,
|
||||
page: notifyPage.value,
|
||||
page_size: notifyPageSize.value,
|
||||
});
|
||||
notifyItems.value = data.items || [];
|
||||
notifyTotal.value = data.total || 0;
|
||||
} catch (e: any) {
|
||||
msg.error(e?.message || t('workspace.voucherCheck.notifyLoadFailed'));
|
||||
} finally {
|
||||
notifyLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换检核任务 / 企微发送记录。
|
||||
* @param tab - 列表页 Tab
|
||||
*/
|
||||
function setListTab(tab: 'tasks' | 'notifications') {
|
||||
if (listTab.value === tab) return;
|
||||
listTab.value = tab;
|
||||
if (tab === 'notifications') {
|
||||
notifyPage.value = 1;
|
||||
void loadNotifications();
|
||||
return;
|
||||
}
|
||||
page.value = 1;
|
||||
void loadRuns();
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前 Tab 按筛选条件查询。
|
||||
*/
|
||||
function searchCurrentTab() {
|
||||
if (listTab.value === 'tasks') {
|
||||
page.value = 1;
|
||||
void loadRuns();
|
||||
return;
|
||||
}
|
||||
notifyPage.value = 1;
|
||||
void loadNotifications();
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前 Tab 刷新列表,不重置页码。
|
||||
*/
|
||||
function refreshCurrentTab() {
|
||||
if (listTab.value === 'tasks') {
|
||||
void loadRuns();
|
||||
return;
|
||||
}
|
||||
void loadNotifications();
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载该发送记录对应批次的 Excel。
|
||||
* @param row - 企微发送记录
|
||||
*/
|
||||
async function downloadNotifyExcel(row: VoucherCheckNotificationItem) {
|
||||
if (!row.schedule_run_id || !row.has_excel) return;
|
||||
try {
|
||||
await downloadVoucherCheckExcel(row.schedule_run_id, row.excel_filename);
|
||||
} catch {
|
||||
msg.error(t('workspace.voucherCheck.downloadExcelFailed'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 企微发送状态徽标样式。
|
||||
* @param value - send_status
|
||||
*/
|
||||
function notifyBadgeClass(value: string): string {
|
||||
if (value === 'sent') return 'bg-emerald-50 text-emerald-700';
|
||||
if (value === 'failed') return 'bg-rose-50 text-rose-700';
|
||||
return 'bg-surface-soft text-secondary';
|
||||
}
|
||||
|
||||
/**
|
||||
* 将接收人姓名拼成展示文本。
|
||||
* @param names - 系统用户姓名
|
||||
*/
|
||||
function formatRecipientNames(names?: string[]): string {
|
||||
if (!names?.length) return '-';
|
||||
return names.join('、');
|
||||
}
|
||||
|
||||
/**
|
||||
* 从发送记录跳转对应批次明细。
|
||||
* @param row - 企微发送记录
|
||||
*/
|
||||
function openNotifyDetail(row: VoucherCheckNotificationItem) {
|
||||
if (!row.schedule_run_id) {
|
||||
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,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载检核任务列表。
|
||||
*/
|
||||
async function loadRuns() {
|
||||
loading.value = true;
|
||||
try {
|
||||
const data = await listVoucherCheckStates({
|
||||
const data = await listVoucherCheckRuns({
|
||||
period: period.value || undefined,
|
||||
status: status.value || undefined,
|
||||
invoice_no: invoiceNo.value || undefined,
|
||||
page: page.value,
|
||||
page_size: pageSize,
|
||||
page_size: pageSize.value,
|
||||
});
|
||||
items.value = data.items || [];
|
||||
total.value = data.total || 0;
|
||||
if (data.period && !period.value) period.value = data.period;
|
||||
} catch (e: any) {
|
||||
msg.error(e?.message || t('workspace.voucherCheck.loadFailed'));
|
||||
} finally {
|
||||
@@ -70,186 +212,315 @@ async function loadStates() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 若 URL 带 run_id,额外加载该批次明细。
|
||||
* 企微卡片若仍带 ?run_id=,转到独立明细页,避免在列表上方展开。
|
||||
*/
|
||||
async function loadRunItemsIfNeeded() {
|
||||
function redirectLegacyRunQuery() {
|
||||
const raw = route.query.run_id;
|
||||
const id = Number(Array.isArray(raw) ? raw[0] : raw);
|
||||
if (!Number.isFinite(id) || id <= 0) {
|
||||
runIdFilter.value = null;
|
||||
runItems.value = [];
|
||||
if (!Number.isFinite(id) || id <= 0) return false;
|
||||
void router.replace(WORKSPACE_PATHS.accountingVoucherCheckDetail(id));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开批次 invoice 明细独立页。
|
||||
* @param row - 列表中的检核批次
|
||||
*/
|
||||
function openRunDetail(row: VoucherCheckRunItem) {
|
||||
if (!row.schedule_run_id) {
|
||||
msg.error(t('workspace.voucherCheck.loadFailed'));
|
||||
return;
|
||||
}
|
||||
runIdFilter.value = id;
|
||||
try {
|
||||
const data = await listVoucherCheckRunItems(id, { page: 1, page_size: 100 });
|
||||
runItems.value = data.items || [];
|
||||
} catch (e: any) {
|
||||
msg.error(e?.message || t('workspace.voucherCheck.loadFailed'));
|
||||
void router.push({
|
||||
path: WORKSPACE_PATHS.accountingVoucherCheckDetail(row.schedule_run_id),
|
||||
query: row.run_no ? { runNo: row.run_no } : undefined,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止强制重检后的列表轮询。
|
||||
*/
|
||||
function stopForcePoll() {
|
||||
if (forcePollTimer) {
|
||||
clearInterval(forcePollTimer);
|
||||
forcePollTimer = null;
|
||||
}
|
||||
}
|
||||
|
||||
function statusLabel(value: string) {
|
||||
if (value === 'complete') return t('workspace.voucherCheck.statusComplete');
|
||||
if (value === 'missing') return t('workspace.voucherCheck.statusMissing');
|
||||
if (value === 'skipped') return t('workspace.voucherCheck.statusSkipped');
|
||||
if (value === 'technical_error') return t('workspace.voucherCheck.statusTechError');
|
||||
return value || '-';
|
||||
/**
|
||||
* 打开强制重检确认框;用公共 DeleteConfirmDialog 替代原生 window.confirm。
|
||||
*/
|
||||
function openForceRecheck() {
|
||||
if (forcing.value) return;
|
||||
showForceConfirm.value = true;
|
||||
}
|
||||
|
||||
function formatMissing(list?: Array<{ code?: string; name?: string }>) {
|
||||
if (!list?.length) return '-';
|
||||
return list.map((x) => x.name || x.code || '').filter(Boolean).join('、');
|
||||
/**
|
||||
* 确认后入队强制重检上一个月:不跳过已归档记录,期间取执行日的上一个自然月。
|
||||
*/
|
||||
async function forceRecheck() {
|
||||
if (forcing.value) return;
|
||||
forcing.value = true;
|
||||
try {
|
||||
const data = await triggerVoucherCheckForceAll();
|
||||
msg.success(t('workspace.voucherCheck.forceQueued', { runNo: data.run_no }));
|
||||
await loadRuns();
|
||||
stopForcePoll();
|
||||
const started = Date.now();
|
||||
forcePollTimer = setInterval(() => {
|
||||
void loadRuns();
|
||||
if (Date.now() - started > 120_000) stopForcePoll();
|
||||
}, 5000);
|
||||
} catch (e: any) {
|
||||
msg.error(e?.message || t('workspace.voucherCheck.forceFailed'));
|
||||
} finally {
|
||||
forcing.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
period.value = currentPeriod();
|
||||
if (redirectLegacyRunQuery()) return;
|
||||
period.value = previousPeriod();
|
||||
const qStatus = route.query.status;
|
||||
if (typeof qStatus === 'string' && qStatus) status.value = qStatus;
|
||||
await Promise.all([loadStates(), loadRunItemsIfNeeded()]);
|
||||
await loadRuns();
|
||||
});
|
||||
|
||||
watch(
|
||||
() => route.query.run_id,
|
||||
() => {
|
||||
void loadRunItemsIfNeeded();
|
||||
},
|
||||
);
|
||||
onUnmounted(() => {
|
||||
stopForcePoll();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="mx-auto flex h-full w-full max-w-6xl flex-col gap-4 p-4 md:p-6">
|
||||
<div class="space-y-5 animate-fade-in-up">
|
||||
<header class="space-y-1">
|
||||
<h1 class="text-xl font-semibold text-slate-800">{{ $t('workspace.voucherCheck.title') }}</h1>
|
||||
<p class="text-sm text-slate-500">{{ $t('workspace.voucherCheck.subtitle') }}</p>
|
||||
<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>
|
||||
|
||||
<section class="flex flex-wrap items-end gap-3 rounded-xl border border-slate-200 bg-white p-3">
|
||||
<label class="flex flex-col gap-1 text-xs text-slate-500">
|
||||
<div class="flex gap-1 border-b border-default" role="tablist">
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
class="px-4 py-2.5 text-sm font-medium border-b-2 -mb-px transition-colors"
|
||||
:class="listTab === 'tasks' ? 'border-brand-600 text-brand-600' : 'border-transparent text-muted hover:text-secondary'"
|
||||
:aria-selected="listTab === 'tasks'"
|
||||
@click="setListTab('tasks')"
|
||||
>
|
||||
{{ $t('workspace.voucherCheck.tabTasks') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
role="tab"
|
||||
class="px-4 py-2.5 text-sm font-medium border-b-2 -mb-px transition-colors"
|
||||
:class="listTab === 'notifications' ? 'border-brand-600 text-brand-600' : 'border-transparent text-muted hover:text-secondary'"
|
||||
:aria-selected="listTab === 'notifications'"
|
||||
@click="setListTab('notifications')"
|
||||
>
|
||||
{{ $t('workspace.voucherCheck.tabNotifications') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<section class="flex flex-wrap items-end gap-3 rounded-2xl border border-default/80 bg-surface/70 px-4 py-3 shadow-sm">
|
||||
<label class="flex flex-col gap-1 text-xs font-medium text-muted">
|
||||
{{ $t('workspace.voucherCheck.period') }}
|
||||
<input v-model="period" type="month" class="rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800" />
|
||||
<input v-model="period" type="month" class="rounded-xl border border-default bg-surface px-3 py-1.5 text-sm text-primary" />
|
||||
</label>
|
||||
<label class="flex flex-col gap-1 text-xs text-slate-500">
|
||||
<label v-if="listTab === 'tasks'" class="flex flex-col gap-1 text-xs font-medium text-muted">
|
||||
{{ $t('workspace.voucherCheck.status') }}
|
||||
<select v-model="status" class="rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800">
|
||||
<select v-model="status" class="rounded-xl border border-default bg-surface px-3 py-1.5 text-sm text-primary">
|
||||
<option v-for="opt in statusOptions" :key="opt.value || 'all'" :value="opt.value">{{ opt.label }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="flex min-w-[12rem] flex-1 flex-col gap-1 text-xs text-slate-500">
|
||||
{{ $t('workspace.voucherCheck.invoiceNo') }}
|
||||
<input
|
||||
v-model="invoiceNo"
|
||||
type="text"
|
||||
class="rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-800"
|
||||
:placeholder="$t('workspace.voucherCheck.invoicePlaceholder')"
|
||||
@keyup.enter="page = 1; loadStates()"
|
||||
/>
|
||||
<label v-else class="flex flex-col gap-1 text-xs font-medium text-muted">
|
||||
{{ $t('workspace.voucherCheck.notifyStatus') }}
|
||||
<select v-model="notifyStatus" class="rounded-xl border border-default bg-surface px-3 py-1.5 text-sm text-primary">
|
||||
<option v-for="opt in notifyStatusOptions" :key="opt.value || 'all'" :value="opt.value">{{ opt.label }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1 rounded-lg bg-sky-600 px-3 py-2 text-sm font-medium text-white hover:bg-sky-700"
|
||||
@click="page = 1; loadStates()"
|
||||
class="inline-flex items-center gap-1 rounded-xl bg-brand-600 px-3 py-1.5 text-sm font-medium text-white transition-colors hover:bg-brand-700"
|
||||
@click="searchCurrentTab"
|
||||
>
|
||||
<Search class="h-4 w-4" />
|
||||
<Search class="h-3.5 w-3.5" />
|
||||
{{ $t('workspace.voucherCheck.search') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1 rounded-lg border border-slate-200 px-3 py-2 text-sm text-slate-700 hover:bg-slate-50"
|
||||
@click="loadStates()"
|
||||
class="inline-flex items-center gap-1 rounded-xl border border-default px-3 py-1.5 text-sm font-medium text-secondary transition-colors hover:bg-surface-soft"
|
||||
@click="refreshCurrentTab"
|
||||
>
|
||||
<RefreshCw class="h-4 w-4" />
|
||||
<RefreshCw class="h-3.5 w-3.5" />
|
||||
{{ $t('workspace.voucherCheck.refresh') }}
|
||||
</button>
|
||||
<button
|
||||
v-if="listTab === 'tasks'"
|
||||
type="button"
|
||||
class="ml-auto inline-flex items-center gap-1 rounded-xl border border-amber-300 bg-amber-50 px-3 py-1.5 text-sm font-medium text-amber-900 transition-colors hover:bg-amber-100 disabled:opacity-50"
|
||||
:disabled="forcing"
|
||||
@click="openForceRecheck()"
|
||||
>
|
||||
<Loader2 v-if="forcing" class="h-3.5 w-3.5 animate-spin" />
|
||||
<RotateCcw v-else class="h-3.5 w-3.5" />
|
||||
{{ $t('workspace.voucherCheck.forceRecheck') }}
|
||||
</button>
|
||||
</section>
|
||||
|
||||
<section v-if="runIdFilter" class="rounded-xl border border-amber-200 bg-amber-50/60 p-3">
|
||||
<h2 class="mb-2 text-sm font-semibold text-amber-900">
|
||||
{{ $t('workspace.voucherCheck.runItemsTitle', { runId: runIdFilter }) }}
|
||||
</h2>
|
||||
<div class="overflow-x-auto">
|
||||
<table class="min-w-full text-left text-sm">
|
||||
<thead class="text-xs text-slate-500">
|
||||
<tr>
|
||||
<th class="px-2 py-1">{{ $t('workspace.voucherCheck.invoiceNo') }}</th>
|
||||
<th class="px-2 py-1">{{ $t('workspace.voucherCheck.result') }}</th>
|
||||
<th class="px-2 py-1">{{ $t('workspace.voucherCheck.missing') }}</th>
|
||||
<section v-if="listTab === 'tasks'" class="overflow-hidden rounded-2xl border border-default bg-surface">
|
||||
<div v-if="loading" class="flex items-center justify-center gap-2 py-16 text-sm text-muted">
|
||||
<Loader2 class="h-4 w-4 animate-spin" />
|
||||
{{ $t('workspace.voucherCheck.loading') }}
|
||||
</div>
|
||||
<div v-else-if="!items.length" class="rounded-2xl border border-dashed border-transparent py-16 text-center text-sm text-muted">
|
||||
{{ $t('workspace.voucherCheck.empty') }}
|
||||
</div>
|
||||
<div v-else class="max-h-[calc(100vh-17rem)] overflow-auto scrollbar-thin">
|
||||
<table class="w-full min-w-[960px] text-left text-sm">
|
||||
<thead class="sticky top-0 z-10">
|
||||
<tr class="border-b border-subtle bg-surface-soft text-xs font-semibold text-secondary">
|
||||
<th class="whitespace-nowrap bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.runNo') }}</th>
|
||||
<th class="whitespace-nowrap bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.period') }}</th>
|
||||
<th class="whitespace-nowrap bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.subjectCount') }}</th>
|
||||
<th class="whitespace-nowrap bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.missingInvoices') }}</th>
|
||||
<th class="whitespace-nowrap bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.missingFiles') }}</th>
|
||||
<th class="whitespace-nowrap bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.status') }}</th>
|
||||
<th class="whitespace-nowrap bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.checkedAt') }}</th>
|
||||
<th class="whitespace-nowrap bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.failureReason') }}</th>
|
||||
<th class="whitespace-nowrap bg-surface-soft px-4 py-3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="row in runItems" :key="row.id" class="border-t border-amber-100">
|
||||
<td class="px-2 py-1.5 font-medium text-slate-800">{{ row.invoice_no }}</td>
|
||||
<td class="px-2 py-1.5">{{ statusLabel(row.result) }}</td>
|
||||
<td class="px-2 py-1.5 text-slate-600">{{ formatMissing(row.missing_materials) }}</td>
|
||||
<tr v-for="row in items" :key="row.id" class="border-b border-subtle transition-colors hover:bg-surface-soft/50">
|
||||
<td class="whitespace-nowrap px-4 py-3 font-medium text-primary">{{ row.run_no }}</td>
|
||||
<td class="whitespace-nowrap px-4 py-3 text-muted">{{ row.period_month || '-' }}</td>
|
||||
<td class="whitespace-nowrap px-4 py-3 text-muted">{{ row.subject_count }}</td>
|
||||
<td class="whitespace-nowrap px-4 py-3 text-muted">{{ row.missing_invoice_count }}</td>
|
||||
<td class="whitespace-nowrap px-4 py-3 text-muted">{{ row.missing_file_count }}</td>
|
||||
<td class="whitespace-nowrap px-4 py-3">
|
||||
<span
|
||||
class="inline-flex rounded-full px-2.5 py-1 text-xs font-semibold"
|
||||
:class="row.status === 'missing' ? 'bg-rose-50 text-rose-700' : row.status === 'completed' ? 'bg-emerald-50 text-emerald-700' : 'bg-surface-soft text-secondary'"
|
||||
>
|
||||
{{ voucherCheckStatusLabel(t, row.status) }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-4 py-3 text-muted">{{ formatLocalDateTime(row.finished_at) }}</td>
|
||||
<td class="max-w-64 truncate px-4 py-3 text-rose-700" :title="row.error_message || ''">{{ row.error_message || '-' }}</td>
|
||||
<td class="whitespace-nowrap px-4 py-3">
|
||||
<button
|
||||
type="button"
|
||||
class="text-sm font-medium text-brand-700 hover:underline"
|
||||
@click="openRunDetail(row)"
|
||||
>
|
||||
{{ $t('workspace.voucherCheck.viewDetail') }}
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="min-h-0 flex-1 overflow-hidden rounded-xl border border-slate-200 bg-white">
|
||||
<div v-if="loading" class="flex items-center justify-center gap-2 py-16 text-sm text-slate-500">
|
||||
<section v-else class="overflow-hidden rounded-2xl border border-default bg-surface">
|
||||
<div v-if="notifyLoading" class="flex items-center justify-center gap-2 py-16 text-sm text-muted">
|
||||
<Loader2 class="h-4 w-4 animate-spin" />
|
||||
{{ $t('workspace.voucherCheck.loading') }}
|
||||
</div>
|
||||
<div v-else-if="!items.length" class="py-16 text-center text-sm text-slate-500">
|
||||
{{ $t('workspace.voucherCheck.empty') }}
|
||||
<div v-else-if="!notifyItems.length" class="rounded-2xl border border-dashed border-transparent py-16 text-center text-sm text-muted">
|
||||
{{ $t('workspace.voucherCheck.notifyEmpty') }}
|
||||
</div>
|
||||
<div v-else class="max-h-full overflow-auto">
|
||||
<table class="min-w-full text-left text-sm">
|
||||
<thead class="sticky top-0 bg-slate-50 text-xs text-slate-500">
|
||||
<tr>
|
||||
<th class="px-3 py-2">{{ $t('workspace.voucherCheck.invoiceNo') }}</th>
|
||||
<th class="px-3 py-2">{{ $t('workspace.voucherCheck.invoiceDate') }}</th>
|
||||
<th class="px-3 py-2">{{ $t('workspace.voucherCheck.status') }}</th>
|
||||
<th class="px-3 py-2">{{ $t('workspace.voucherCheck.folder') }}</th>
|
||||
<th class="px-3 py-2">{{ $t('workspace.voucherCheck.missing') }}</th>
|
||||
<th class="px-3 py-2">{{ $t('workspace.voucherCheck.checkedAt') }}</th>
|
||||
<div v-else class="max-h-[calc(100vh-17rem)] overflow-auto scrollbar-thin">
|
||||
<table class="w-full min-w-[1180px] text-left text-sm">
|
||||
<thead class="sticky top-0 z-10">
|
||||
<tr class="border-b border-subtle bg-surface-soft text-xs font-semibold text-secondary">
|
||||
<th class="whitespace-nowrap bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.runNo') }}</th>
|
||||
<th class="whitespace-nowrap bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.period') }}</th>
|
||||
<th class="whitespace-nowrap bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.subjectCount') }}</th>
|
||||
<th class="whitespace-nowrap bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.missingInvoices') }}</th>
|
||||
<th class="whitespace-nowrap bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.missingFiles') }}</th>
|
||||
<th class="whitespace-nowrap bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.notifyStatus') }}</th>
|
||||
<th class="whitespace-nowrap bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.notifySkipReason') }}</th>
|
||||
<th class="whitespace-nowrap bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.notifyRecipients') }}</th>
|
||||
<th class="whitespace-nowrap bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.notifySentAt') }}</th>
|
||||
<th class="whitespace-nowrap bg-surface-soft px-4 py-3">{{ $t('workspace.voucherCheck.notifyExcel') }}</th>
|
||||
<th class="whitespace-nowrap bg-surface-soft px-4 py-3"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="row in items" :key="row.id" class="border-t border-slate-100 hover:bg-slate-50/80">
|
||||
<td class="px-3 py-2 font-medium text-slate-800">{{ row.invoice_no }}</td>
|
||||
<td class="px-3 py-2 text-slate-600">{{ row.invoice_date || '-' }}</td>
|
||||
<td class="px-3 py-2">
|
||||
<tr v-for="row in notifyItems" :key="row.id" class="border-b border-subtle transition-colors hover:bg-surface-soft/50">
|
||||
<td class="whitespace-nowrap px-4 py-3 font-medium text-primary">{{ row.run_no || '-' }}</td>
|
||||
<td class="whitespace-nowrap px-4 py-3 text-muted">{{ row.period_month || '-' }}</td>
|
||||
<td class="whitespace-nowrap px-4 py-3 text-muted">{{ row.subject_count }}</td>
|
||||
<td class="whitespace-nowrap px-4 py-3 text-muted">{{ row.missing_invoice_count }}</td>
|
||||
<td class="whitespace-nowrap px-4 py-3 text-muted">{{ row.missing_file_count }}</td>
|
||||
<td class="whitespace-nowrap px-4 py-3">
|
||||
<span
|
||||
class="inline-flex rounded-full px-2 py-0.5 text-xs font-medium"
|
||||
:class="row.status === 'complete' ? 'bg-emerald-50 text-emerald-700' : 'bg-rose-50 text-rose-700'"
|
||||
class="inline-flex rounded-full px-2.5 py-1 text-xs font-semibold"
|
||||
:class="notifyBadgeClass(row.send_status)"
|
||||
>
|
||||
{{ statusLabel(row.status) }}
|
||||
{{ voucherCheckNotifyStatusLabel(t, row.send_status) }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="max-w-[16rem] truncate px-3 py-2 text-slate-600" :title="row.folder_path || ''">
|
||||
{{ row.folder_path || '-' }}
|
||||
<td class="max-w-56 truncate px-4 py-3 text-muted" :title="row.skip_reason || ''">{{ row.skip_reason || '-' }}</td>
|
||||
<td class="max-w-48 truncate px-4 py-3 text-muted" :title="formatRecipientNames(row.recipient_names)">{{ formatRecipientNames(row.recipient_names) }}</td>
|
||||
<td class="whitespace-nowrap px-4 py-3 text-muted">{{ formatLocalDateTime(row.sent_at || row.created_at) }}</td>
|
||||
<td class="whitespace-nowrap px-4 py-3">
|
||||
<button
|
||||
v-if="row.has_excel && row.schedule_run_id"
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1 text-sm font-medium text-brand-700 hover:underline"
|
||||
@click="downloadNotifyExcel(row)"
|
||||
>
|
||||
<Download class="h-3.5 w-3.5" />
|
||||
{{ $t('workspace.voucherCheck.downloadExcel') }}
|
||||
</button>
|
||||
<span v-else class="text-muted">-</span>
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-4 py-3">
|
||||
<button
|
||||
type="button"
|
||||
class="text-sm font-medium text-brand-700 hover:underline disabled:text-muted disabled:no-underline"
|
||||
:disabled="!row.schedule_run_id"
|
||||
@click="openNotifyDetail(row)"
|
||||
>
|
||||
{{ $t('workspace.voucherCheck.viewDetail') }}
|
||||
</button>
|
||||
</td>
|
||||
<td class="px-3 py-2 text-slate-600">{{ formatMissing(row.missing_materials) }}</td>
|
||||
<td class="px-3 py-2 text-slate-600">{{ row.last_checked_at || '-' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="flex items-center justify-between border-t border-slate-100 px-3 py-2 text-xs text-slate-500">
|
||||
<span>{{ $t('workspace.voucherCheck.totalCount', { total }) }}</span>
|
||||
<div class="flex items-center gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded border border-slate-200 px-2 py-1 disabled:opacity-40"
|
||||
:disabled="page <= 1 || loading"
|
||||
@click="page -= 1; loadStates()"
|
||||
>
|
||||
{{ $t('workspace.voucherCheck.prevPage') }}
|
||||
</button>
|
||||
<span>{{ page }}</span>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded border border-slate-200 px-2 py-1 disabled:opacity-40"
|
||||
:disabled="page * pageSize >= total || loading"
|
||||
@click="page += 1; loadStates()"
|
||||
>
|
||||
{{ $t('workspace.voucherCheck.nextPage') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<PaginationBar
|
||||
v-if="listTab === 'tasks'"
|
||||
v-model:page="page"
|
||||
v-model:page-size="pageSize"
|
||||
:total="total"
|
||||
:pages="pages"
|
||||
:visible="total > 0 || !!status"
|
||||
@update:page="() => loadRuns()"
|
||||
@update:page-size="() => loadRuns()"
|
||||
/>
|
||||
<PaginationBar
|
||||
v-else
|
||||
v-model:page="notifyPage"
|
||||
v-model:page-size="notifyPageSize"
|
||||
:total="notifyTotal"
|
||||
:pages="notifyPages"
|
||||
:visible="notifyTotal > 0 || !!notifyStatus"
|
||||
@update:page="() => loadNotifications()"
|
||||
@update:page-size="() => loadNotifications()"
|
||||
/>
|
||||
|
||||
<DeleteConfirmDialog
|
||||
v-model="showForceConfirm"
|
||||
:title="t('workspace.voucherCheck.forceRecheck')"
|
||||
:message="t('workspace.voucherCheck.forceConfirm')"
|
||||
:confirm-loading="forcing"
|
||||
confirm-tone="primary"
|
||||
@confirm="forceRecheck"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -2,6 +2,8 @@
|
||||
/**
|
||||
* features/workspace/views/WorkspaceLayout.vue
|
||||
* 工作台布局壳:初始化 composable、侧边栏、子路由出口与全局弹窗。
|
||||
* 依赖:useWorkspace、WorkspaceSidebar、WorkspaceModals、lucide 图标。
|
||||
* 逻辑:桌面端(lg)锁视口高度,侧栏与主区各自滚动,避免矮屏把底部按钮裁掉。
|
||||
*/
|
||||
import { provide } from 'vue';
|
||||
import { LayoutGrid, Bot, User } from 'lucide-vue-next';
|
||||
@@ -22,12 +24,15 @@ const mobileTabs = [
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="page-shell min-h-screen font-sans animate-fade-in">
|
||||
<div
|
||||
class="page-shell font-sans animate-fade-in"
|
||||
:class="ws.isMobile ? 'min-h-screen' : 'min-h-screen lg:h-screen lg:overflow-hidden'"
|
||||
>
|
||||
<div v-if="ws.isLoading" class="animate-pulse p-8 space-y-8">
|
||||
<div class="h-48 bg-surface-strong rounded-2xl"></div>
|
||||
</div>
|
||||
|
||||
<div v-else>
|
||||
<div v-else class="lg:h-full lg:min-h-0">
|
||||
<header v-if="ws.isMobile" class="sticky top-0 z-30 flex items-center justify-between border-b border-default bg-surface px-4 py-2.5">
|
||||
<div class="flex items-center gap-2">
|
||||
<button
|
||||
@@ -43,12 +48,15 @@ const mobileTabs = [
|
||||
</header>
|
||||
|
||||
<div
|
||||
class="grid min-h-screen gap-0 transition-[grid-template-columns] duration-200"
|
||||
class="grid min-h-screen gap-0 transition-[grid-template-columns] duration-200 lg:h-full lg:min-h-0"
|
||||
:class="ws.isMobile ? '' : (ws.isSidebarCollapsed ? 'lg:grid-cols-[72px_minmax(0,1fr)]' : 'lg:grid-cols-[280px_minmax(0,1fr)]')"
|
||||
>
|
||||
<WorkspaceSidebar v-if="!ws.isMobile" :collapsed="ws.isSidebarCollapsed" />
|
||||
|
||||
<section class="ws-main" :class="ws.isMobile ? 'pb-20' : ''">
|
||||
<section
|
||||
class="ws-main min-h-0"
|
||||
:class="ws.isMobile ? 'pb-20' : 'lg:overflow-y-auto lg:pb-8'"
|
||||
>
|
||||
<RouterView />
|
||||
</section>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user