fix(contract-payment): fix comments of contract payment plan
This commit is contained in:
1 parent
60d4f06018
commit
1c0654c6f8
25 files changed
+956
-76
No files matched your search
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* 合同付款预警 API 类型与请求封装。
|
||||
* 依赖:统一 requestJson;后端 /api/contract-payment。
|
||||
* 逻辑:台账/合同详情查询、待发送摘要、每日扫描入队、周五汇总入队及批次附件下载。
|
||||
* 逻辑:台账/合同详情查询、汇总卡统计、待发送摘要、每日扫描入队、周五汇总入队及批次附件下载。
|
||||
*/
|
||||
import { requestBlob, requestJson } from '@/shared/api/client';
|
||||
|
||||
@@ -21,11 +21,27 @@ export interface ContractPaymentContract {
|
||||
status: string; parse_status: string; plan_status: string; parse_issues?: string[]; nodes: PaymentNode[]; alerts?: PaymentAlert[]; attachments?: ContractAttachment[];
|
||||
}
|
||||
export interface ContractListResponse { total: number; page: number; page_size: number; pages: number; items: ContractPaymentContract[]; }
|
||||
export type LedgerFocus = 'due' | 'overdue' | 'needs_completion' | 'due_this_month';
|
||||
export interface LedgerSummary {
|
||||
due: number;
|
||||
overdue: number;
|
||||
needs_completion: number;
|
||||
due_this_month: number;
|
||||
}
|
||||
export interface AlertBatch { id: number; batch_no: string; week_key: string; status: string; summary?: { total?: number; stages?: Record<string, number> }; excel_file_name?: string | null; excel_file_size?: number | null; sent_at?: string | null; }
|
||||
export interface AlertSummary { pending_count: number; next_send_at?: string | null; timezone?: string | null; }
|
||||
|
||||
export const listContractPaymentContracts = (params?: { keyword?: string; parse_status?: string; reviewOnly?: boolean; page?: number; pageSize?: number }) => {
|
||||
const query = new URLSearchParams(); if (params?.keyword) query.set('keyword', params.keyword); if (params?.parse_status) query.set('parse_status', params.parse_status); if (params?.reviewOnly) query.set('review_only', '1'); if (params?.page) query.set('page', String(params.page)); if (params?.pageSize) query.set('page_size', String(params.pageSize));
|
||||
/**
|
||||
* 分页查询合同付款台账或待确认合同。
|
||||
* 核心逻辑:keyword 同时匹配合同号、流程号、采购单号和供应商;reviewOnly 走待确认列表。
|
||||
* @param params.keyword - 模糊检索词,可为空。
|
||||
* @param params.parse_status - 解析状态精确筛选。
|
||||
* @param params.reviewOnly - 为 true 时只查 needs_review。
|
||||
* @param params.focus - 汇总卡口径:即将到期 / 逾期未付 / 待补充 / 本月应付。
|
||||
* @returns 分页后的合同列表。
|
||||
*/
|
||||
export const listContractPaymentContracts = (params?: { keyword?: string; parse_status?: string; reviewOnly?: boolean; focus?: LedgerFocus; page?: number; pageSize?: number }) => {
|
||||
const query = new URLSearchParams(); if (params?.keyword) query.set('keyword', params.keyword); if (params?.parse_status) query.set('parse_status', params.parse_status); if (params?.reviewOnly) query.set('review_only', '1'); if (params?.focus) query.set('focus', params.focus); if (params?.page) query.set('page', String(params.page)); if (params?.pageSize) query.set('page_size', String(params.pageSize));
|
||||
const suffix = query.toString() ? `?${query.toString()}` : ''; return requestJson<ContractListResponse>(`/api/contract-payment/contracts${suffix}`);
|
||||
};
|
||||
/** 获取单份合同的概览、原文附件、付款计划与预警审计详情。 */
|
||||
@@ -42,6 +58,12 @@ export const enqueueContractPaymentAlertScan = () => requestJson<{ job_id: strin
|
||||
export const enqueueContractPaymentWeeklyAlert = () => requestJson<{ job_id: string }>('/api/contract-payment/alerts/weekly-run', { method: 'POST' });
|
||||
/** 查询本周待发送笔数和下一次周五汇总发送时间。 */
|
||||
export const getContractPaymentAlertSummary = () => requestJson<AlertSummary>('/api/contract-payment/alerts/summary');
|
||||
/**
|
||||
* 查询合同台账四张汇总卡的合同份数。
|
||||
* 核心逻辑:始终统计全部已解析台账,不跟当前 keyword;与点卡片过滤共用 focus 口径。
|
||||
* @returns due / overdue / needs_completion / due_this_month。
|
||||
*/
|
||||
export const getContractPaymentLedgerSummary = () => requestJson<LedgerSummary>('/api/contract-payment/contracts/summary');
|
||||
export const listContractPaymentAlertBatches = () => requestJson<{ items: AlertBatch[] }>('/api/contract-payment/alert-batches');
|
||||
/** 下载已归档的合同付款预警周汇总 Excel 明细。 */
|
||||
export const downloadContractPaymentAlertBatchExcel = (batchId: number) => requestBlob(`/api/contract-payment/alert-batches/${batchId}/excel`);
|
||||
@@ -1,6 +1,6 @@
|
||||
<!--
|
||||
合同付款预警工作台:展示合同台账、付款阶段字段、本周待发送摘要,并提供预警任务入口。
|
||||
依赖:contract-payment.api、PaginationBar、统一消息提示;周汇总批次由独立页面展示。
|
||||
合同付款预警工作台:展示汇总卡、合同台账、付款阶段字段、本周待发送摘要;同步/扫描/发送仅管理员可见。
|
||||
依赖:contract-payment.api、PaginationBar、useAuthStore、统一消息提示;周汇总批次由独立页面展示。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
@@ -11,6 +11,7 @@ import { BusinessError } from '@/shared/api/client';
|
||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||
import PaginationBar from '@/shared/components/PaginationBar.vue';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { useAuthStore } from '@/features/auth/stores/auth.store';
|
||||
import { WORKSPACE_PATHS } from '@/features/workspace/constants/routes';
|
||||
import {
|
||||
enqueueContractPaymentAlertScan,
|
||||
@@ -18,21 +19,34 @@ import {
|
||||
enqueueContractPaymentSync,
|
||||
enqueueContractPaymentWeeklyAlert,
|
||||
getContractPaymentAlertSummary,
|
||||
getContractPaymentLedgerSummary,
|
||||
listContractPaymentContracts,
|
||||
type AlertSummary,
|
||||
type ContractPaymentContract,
|
||||
type LedgerFocus,
|
||||
type LedgerSummary,
|
||||
} from '../api/contract-payment.api';
|
||||
import { displayCurrency } from '../utils/currency';
|
||||
import { aggregateContractNodeStatus, type ContractNodeStatusCode } from '../utils/paymentStatus';
|
||||
|
||||
const { t } = useI18n();
|
||||
const router = useRouter();
|
||||
const auth = useAuthStore();
|
||||
const isAdmin = computed(() => auth.isAdmin);
|
||||
const msg = useMessage(); const keyword = ref(''); const loading = ref(false); const actionLoading = ref(false);
|
||||
const showForceSyncConfirm = ref(false);
|
||||
const showReparseExistingConfirm = ref(false);
|
||||
const contracts = ref<ContractPaymentContract[]>([]);
|
||||
const alertSummary = ref<AlertSummary | null>(null);
|
||||
const ledgerSummary = ref<LedgerSummary>({ due: 0, overdue: 0, needs_completion: 0, due_this_month: 0 });
|
||||
const ledgerFocus = ref<LedgerFocus | ''>('');
|
||||
const page = ref(1); const pageSize = ref(20); const total = ref(0); const pages = ref(1);
|
||||
const ledgerFocusCards = computed(() => ([
|
||||
{ key: 'due' as const, label: t('admin.contractPayment.ledgerFocus.due'), hint: t('admin.contractPayment.ledgerFocus.dueHint'), value: ledgerSummary.value.due, tone: 'due' },
|
||||
{ key: 'overdue' as const, label: t('admin.contractPayment.ledgerFocus.overdue'), hint: '', value: ledgerSummary.value.overdue, tone: 'overdue' },
|
||||
{ key: 'needs_completion' as const, label: t('admin.contractPayment.ledgerFocus.needsCompletion'), hint: '', value: ledgerSummary.value.needs_completion, tone: 'needs' },
|
||||
{ key: 'due_this_month' as const, label: t('admin.contractPayment.ledgerFocus.dueThisMonth'), hint: t('admin.contractPayment.ledgerFocus.dueThisMonthHint'), value: ledgerSummary.value.due_this_month, tone: 'month' },
|
||||
]));
|
||||
const stage = (item: ContractPaymentContract, name: string) => item.nodes.find((node) => node.node_type === name);
|
||||
/**
|
||||
* 以整数格式展示付款比例,不改变接口返回的精确比例值。
|
||||
@@ -123,19 +137,37 @@ async function refreshSummary(): Promise<void> {
|
||||
if (!alertSummary.value) alertSummary.value = { pending_count: 0, next_send_at: null, timezone: 'Asia/Shanghai' };
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 刷新四张汇总卡的合同份数。
|
||||
* 核心逻辑:始终统计全部已解析台账,失败时保留上次数字,不阻断列表。
|
||||
*/
|
||||
async function refreshLedgerSummary(): Promise<void> {
|
||||
try {
|
||||
ledgerSummary.value = await getContractPaymentLedgerSummary();
|
||||
} catch {
|
||||
/* 汇总失败不影响台账列表 */
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 加载当前页合同台账。
|
||||
* 核心逻辑:合同列表使用服务端分页;搜索和每页条数变化均从第一页开始,并并行刷新待发送摘要。
|
||||
* @param resetPage - 为 true 时重置为第一页,用于关键词查询。
|
||||
* @returns 完成后更新当前列表、分页元数据和待发送摘要。
|
||||
* 核心逻辑:合同列表使用服务端分页;关键词同时匹配合同号、流程号、采购单号和供应商;
|
||||
* 汇总卡 focus 与关键词叠加;搜索、点卡片和每页条数变化均从第一页开始,并并行刷新待发送摘要与汇总卡。
|
||||
* @param resetPage - 为 true 时重置为第一页,用于关键词查询或切换汇总卡。
|
||||
* @returns 完成后更新当前列表、分页元数据、待发送摘要和汇总卡。
|
||||
*/
|
||||
async function load(resetPage = false): Promise<void> {
|
||||
if (resetPage) page.value = 1;
|
||||
loading.value = true;
|
||||
try {
|
||||
const [result] = await Promise.all([
|
||||
listContractPaymentContracts({ keyword: keyword.value.trim(), page: page.value, pageSize: pageSize.value }),
|
||||
listContractPaymentContracts({
|
||||
keyword: keyword.value.trim(),
|
||||
focus: ledgerFocus.value || undefined,
|
||||
page: page.value,
|
||||
pageSize: pageSize.value,
|
||||
}),
|
||||
refreshSummary(),
|
||||
refreshLedgerSummary(),
|
||||
]);
|
||||
contracts.value = result.items || [];
|
||||
total.value = result.total || 0;
|
||||
@@ -147,13 +179,23 @@ async function load(resetPage = false): Promise<void> {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 点击汇总卡过滤台账;再次点击同一张卡则取消过滤。
|
||||
* 核心逻辑:focus 写入列表查询;汇总数字本身仍看全部台账。
|
||||
* @param key - 汇总卡口径。
|
||||
*/
|
||||
function toggleLedgerFocus(key: LedgerFocus): void {
|
||||
ledgerFocus.value = ledgerFocus.value === key ? '' : key;
|
||||
void load(true);
|
||||
}
|
||||
/**
|
||||
* 提交合同付款预警后台任务。
|
||||
* 核心逻辑:按操作类型调用相应的异步接口,任务入队成功后仅展示任务编号,不等待长耗时同步或发送完成。
|
||||
* 核心逻辑:仅管理员可提交;按操作类型调用相应的异步接口,任务入队成功后仅展示任务编号,不等待长耗时同步或发送完成。
|
||||
* @param action - sync 同步 OA、force-sync 强制覆盖、reparse-existing 刷新存量解析、scan 扫描预警、weekly 周汇总。
|
||||
* @returns 任务提交完成后显示成功或失败提示。
|
||||
*/
|
||||
async function submitAction(action: 'sync' | 'force-sync' | 'reparse-existing' | 'scan' | 'weekly'): Promise<void> {
|
||||
if (!isAdmin.value) return;
|
||||
actionLoading.value = true;
|
||||
try {
|
||||
if (action === 'sync' || action === 'force-sync') {
|
||||
@@ -181,6 +223,7 @@ async function submitAction(action: 'sync' | 'force-sync' | 'reparse-existing' |
|
||||
* @param action - 待提交的预警任务类型。
|
||||
*/
|
||||
function run(action: 'sync' | 'force-sync' | 'reparse-existing' | 'scan' | 'weekly'): void {
|
||||
if (!isAdmin.value) return;
|
||||
if (action === 'force-sync') {
|
||||
showForceSyncConfirm.value = true;
|
||||
return;
|
||||
@@ -212,8 +255,33 @@ onMounted(() => void load());
|
||||
</script>
|
||||
<template>
|
||||
<section class="section-gap animate-fade-in-up">
|
||||
<div class="flex flex-wrap items-start justify-between gap-4"><div><h2 class="text-2xl font-bold text-primary">{{ t('admin.contractPayment.title') }}</h2><p class="text-sm text-muted mt-1">{{ t('admin.contractPayment.subtitle') }}</p></div><div class="flex gap-2"><button class="btn-secondary-ds" :disabled="actionLoading" @click="run('sync')"><RefreshCw class="w-4 h-4" />{{ t('admin.contractPayment.sync') }}</button><button class="btn-secondary-ds" :disabled="actionLoading" @click="run('force-sync')"><RefreshCw class="w-4 h-4" />{{ t('admin.contractPayment.forceSync') }}</button><button class="btn-secondary-ds" :disabled="actionLoading" @click="run('reparse-existing')"><RefreshCw class="w-4 h-4" />{{ t('admin.contractPayment.reparseExisting') }}</button><button class="btn-secondary-ds" :disabled="actionLoading" @click="run('scan')"><CalendarClock class="w-4 h-4" />{{ t('admin.contractPayment.scanAlerts') }}</button><button class="btn-primary" :disabled="actionLoading" @click="run('weekly')"><Send class="w-4 h-4" />{{ t('admin.contractPayment.weeklySend') }}</button></div></div>
|
||||
<div class="surface-panel rounded-2xl p-4 mt-5"><div class="flex flex-wrap gap-3 items-center"><div class="relative w-full md:w-[360px]"><Search class="absolute left-3 top-2.5 w-4 h-4 text-muted" /><input v-model="keyword" class="input-field pl-9" :placeholder="t('admin.contractPayment.searchPlaceholder')" @keyup.enter="load(true)" /></div><button class="btn-secondary-ds" @click="load(true)">{{ t('admin.contractPayment.search') }}</button><span v-if="weeklyPendingText" class="text-xs text-muted">{{ weeklyPendingText }}</span></div></div>
|
||||
<div class="flex flex-wrap items-start justify-between gap-4"><div><h2 class="text-2xl font-bold text-primary">{{ t('admin.contractPayment.title') }}</h2><p class="text-sm text-muted mt-1">{{ t('admin.contractPayment.subtitle') }}</p></div><div v-if="isAdmin" class="flex flex-wrap gap-2"><button class="btn-secondary-ds" :disabled="actionLoading" @click="run('sync')"><RefreshCw class="w-4 h-4" />{{ t('admin.contractPayment.sync') }}</button><button class="btn-secondary-ds" :disabled="actionLoading" @click="run('force-sync')"><RefreshCw class="w-4 h-4" />{{ t('admin.contractPayment.forceSync') }}</button><button class="btn-secondary-ds" :disabled="actionLoading" @click="run('reparse-existing')"><RefreshCw class="w-4 h-4" />{{ t('admin.contractPayment.reparseExisting') }}</button><button class="btn-secondary-ds" :disabled="actionLoading" @click="run('scan')"><CalendarClock class="w-4 h-4" />{{ t('admin.contractPayment.scanAlerts') }}</button><button class="btn-primary" :disabled="actionLoading" @click="run('weekly')"><Send class="w-4 h-4" />{{ t('admin.contractPayment.weeklySend') }}</button></div></div>
|
||||
<div class="contract-stat-grid">
|
||||
<button
|
||||
v-for="card in ledgerFocusCards"
|
||||
:key="card.key"
|
||||
type="button"
|
||||
class="contract-stat-card"
|
||||
:class="[card.tone, { active: ledgerFocus === card.key }]"
|
||||
@click="toggleLedgerFocus(card.key)"
|
||||
>
|
||||
<span class="contract-stat-label">{{ card.label }}<small v-if="card.hint">({{ card.hint }})</small></span>
|
||||
<strong class="contract-stat-value">{{ card.value }}</strong>
|
||||
</button>
|
||||
</div>
|
||||
<div class="contract-filter-bar">
|
||||
<div class="contract-filter-search">
|
||||
<Search class="contract-filter-icon" />
|
||||
<input
|
||||
v-model="keyword"
|
||||
class="contract-filter-input"
|
||||
:placeholder="t('admin.contractPayment.searchPlaceholder')"
|
||||
@keyup.enter="load(true)"
|
||||
/>
|
||||
</div>
|
||||
<button type="button" class="contract-filter-submit" @click="load(true)">{{ t('admin.contractPayment.search') }}</button>
|
||||
<span v-if="weeklyPendingText" class="contract-filter-meta">{{ weeklyPendingText }}</span>
|
||||
</div>
|
||||
<div class="surface-panel contract-ledger-panel mt-4 overflow-x-auto">
|
||||
<table class="contract-ledger-table text-sm">
|
||||
<thead><tr>
|
||||
@@ -233,8 +301,9 @@ onMounted(() => void load());
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<PaginationBar v-model:page="page" v-model:page-size="pageSize" :total="total" :pages="pages" :visible="total > 0 || !!keyword.trim()" @update:page="() => load()" @update:page-size="() => load()" />
|
||||
<PaginationBar v-model:page="page" v-model:page-size="pageSize" :total="total" :pages="pages" :visible="total > 0 || !!keyword.trim() || !!ledgerFocus" @update:page="() => load()" @update:page-size="() => load()" />
|
||||
<DeleteConfirmDialog
|
||||
v-if="isAdmin"
|
||||
v-model="showForceSyncConfirm"
|
||||
:title="t('admin.contractPayment.forceSync')"
|
||||
:message="t('admin.contractPayment.forceSyncConfirm')"
|
||||
@@ -242,6 +311,7 @@ onMounted(() => void load());
|
||||
@confirm="confirmForceSync"
|
||||
/>
|
||||
<DeleteConfirmDialog
|
||||
v-if="isAdmin"
|
||||
v-model="showReparseExistingConfirm"
|
||||
:title="t('admin.contractPayment.reparseExisting')"
|
||||
:message="t('admin.contractPayment.reparseExistingConfirm')"
|
||||
@@ -251,6 +321,83 @@ onMounted(() => void load());
|
||||
</section>
|
||||
</template>
|
||||
<style scoped>
|
||||
.contract-stat-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
gap: 12px;
|
||||
margin-top: 16px;
|
||||
}
|
||||
.contract-stat-card {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
min-height: 88px;
|
||||
padding: 14px 16px 12px;
|
||||
border: 1px solid #d7e1ef;
|
||||
border-radius: 14px;
|
||||
background: #fff;
|
||||
box-shadow: 0 6px 20px rgba(33, 65, 111, .05);
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
}
|
||||
.contract-stat-card.active { border-color: #93c5fd; box-shadow: 0 0 0 2px rgba(59, 130, 246, .16); }
|
||||
.contract-stat-label { color: #8aa0bd; font-size: 12px; font-weight: 600; line-height: 1.35; }
|
||||
.contract-stat-label small { margin-left: 2px; font-size: 12px; font-weight: 600; }
|
||||
.contract-stat-value { margin-top: 8px; font-size: 28px; font-weight: 800; line-height: 1; }
|
||||
.contract-stat-card.due .contract-stat-value { color: #d97706; }
|
||||
.contract-stat-card.overdue .contract-stat-value { color: #dc2626; }
|
||||
.contract-stat-card.needs .contract-stat-value { color: #0f172a; }
|
||||
.contract-stat-card.month .contract-stat-value { color: #16a34a; }
|
||||
@media (max-width: 900px) { .contract-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
|
||||
.contract-filter-bar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-top: 16px;
|
||||
padding: 10px 14px;
|
||||
border: 1px solid #d7e1ef;
|
||||
border-radius: 12px;
|
||||
background: #fff;
|
||||
}
|
||||
.contract-filter-search { position: relative; width: min(100%, 320px); }
|
||||
.contract-filter-icon {
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
top: 50%;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
color: #8aa0bd;
|
||||
transform: translateY(-50%);
|
||||
pointer-events: none;
|
||||
}
|
||||
.contract-filter-input {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: 36px;
|
||||
padding: 0 12px 0 30px;
|
||||
border: 1px solid #d7e1ef;
|
||||
border-radius: 8px;
|
||||
background: #f7faff;
|
||||
color: #183c72;
|
||||
font-size: 14px;
|
||||
line-height: 36px;
|
||||
outline: none;
|
||||
}
|
||||
.contract-filter-input::placeholder { color: #8aa0bd; font-size: 14px; }
|
||||
.contract-filter-input:focus { border-color: #93c5fd; box-shadow: 0 0 0 2px rgba(59, 130, 246, .12); }
|
||||
.contract-filter-submit {
|
||||
height: 36px;
|
||||
padding: 0 14px;
|
||||
border: 1px solid #d7e1ef;
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
color: #426493;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.contract-filter-submit:hover { background: #f7faff; color: #183c72; }
|
||||
.contract-filter-meta { color: #8aa0bd; font-size: 13px; line-height: 1.4; }
|
||||
.contract-ledger-panel { border: 1px solid #d7e1ef; border-radius: 14px; background: #fff; box-shadow: 0 6px 20px rgba(33, 65, 111, .05); }
|
||||
.contract-ledger-table { width: 100%; min-width: 1260px; border-collapse: collapse; color: #183c72; }
|
||||
.contract-ledger-table th { height: 59px; padding: 11px 12px; background: #f7faff; border-bottom: 1px solid #d7e1ef; color: #426493; font-size: 13px; font-weight: 700; line-height: 1.35; text-align: left; vertical-align: top; white-space: nowrap; }
|
||||
|
||||
@@ -28,7 +28,7 @@ const pages = ref(1);
|
||||
|
||||
/**
|
||||
* 读取需要人工确认的合同列表。
|
||||
* 核心逻辑:明确传入 reviewOnly,避免前端仅按显示状态过滤而遗漏后端新产生的待确认合同。
|
||||
* 核心逻辑:明确传入 reviewOnly,避免前端仅按显示状态过滤而遗漏后端新产生的待确认合同;关键词同样匹配供应商。
|
||||
* @param resetPage - 为 true 时重置到第一页,供关键词查询使用。
|
||||
* @returns 请求完成后更新分页数据;失败时保留已有列表并提示原因。
|
||||
*/
|
||||
@@ -66,7 +66,18 @@ onMounted(() => void load());
|
||||
<template>
|
||||
<section class="section-gap animate-fade-in-up">
|
||||
<div><h2 class="text-2xl font-bold text-primary">{{ t('admin.contractPaymentReview.title') }}</h2><p class="mt-1 text-sm text-muted">{{ t('admin.contractPaymentReview.subtitle') }}</p></div>
|
||||
<div class="surface-panel mt-5 rounded-2xl p-4"><div class="flex flex-wrap items-center gap-3"><div class="relative w-full md:w-[360px]"><Search class="absolute left-3 top-2.5 h-4 w-4 text-muted" /><input v-model="keyword" class="input-field pl-9" :placeholder="t('admin.contractPaymentReview.searchPlaceholder')" @keyup.enter="load(true)" /></div><button class="btn-secondary-ds" @click="load(true)">{{ t('admin.contractPayment.search') }}</button></div></div>
|
||||
<div class="contract-filter-bar">
|
||||
<div class="contract-filter-search">
|
||||
<Search class="contract-filter-icon" />
|
||||
<input
|
||||
v-model="keyword"
|
||||
class="contract-filter-input"
|
||||
:placeholder="t('admin.contractPaymentReview.searchPlaceholder')"
|
||||
@keyup.enter="load(true)"
|
||||
/>
|
||||
</div>
|
||||
<button type="button" class="contract-filter-submit" @click="load(true)">{{ t('admin.contractPayment.search') }}</button>
|
||||
</div>
|
||||
<div class="surface-panel mt-4 overflow-x-auto rounded-2xl">
|
||||
<table class="review-table text-sm"><thead><tr><th>{{ t('admin.contractPaymentReview.contractWorkflow') }}</th><th>{{ t('admin.contractPayment.purchaseOrder') }}</th><th>{{ t('admin.contractPayment.supplier') }}</th><th>{{ t('admin.contractPayment.amount') }}</th><th>{{ t('admin.contractPaymentReview.reason') }}</th></tr></thead>
|
||||
<tbody><tr v-for="item in contracts" :key="item.id" class="cursor-pointer hover:bg-surface-soft" @click="openContractDetail(item.id)"><td><strong>{{ item.contract_no || t('admin.contractPayment.contractNoPending') }}</strong><span>{{ item.workflow_no || '—' }}</span></td><td>{{ item.purchase_order_no || '—' }}</td><td>{{ item.supplier_name || '—' }}</td><td>{{ item.total_amount || '—' }}</td><td><ul><li v-for="issue in item.parse_issues || [t('admin.contractPaymentReview.fallbackIssue')]" :key="issue">{{ issue }}</li></ul></td></tr><tr v-if="!loading && !contracts.length"><td colspan="5" class="py-9 text-center text-muted">{{ t('admin.contractPaymentReview.empty') }}</td></tr></tbody>
|
||||
@@ -77,5 +88,53 @@ onMounted(() => void load());
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.contract-filter-bar {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-top: 16px;
|
||||
padding: 10px 14px;
|
||||
border: 1px solid #d7e1ef;
|
||||
border-radius: 12px;
|
||||
background: #fff;
|
||||
}
|
||||
.contract-filter-search { position: relative; width: min(100%, 320px); }
|
||||
.contract-filter-icon {
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
top: 50%;
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
color: #8aa0bd;
|
||||
transform: translateY(-50%);
|
||||
pointer-events: none;
|
||||
}
|
||||
.contract-filter-input {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
height: 36px;
|
||||
padding: 0 12px 0 30px;
|
||||
border: 1px solid #d7e1ef;
|
||||
border-radius: 8px;
|
||||
background: #f7faff;
|
||||
color: #183c72;
|
||||
font-size: 14px;
|
||||
line-height: 36px;
|
||||
outline: none;
|
||||
}
|
||||
.contract-filter-input::placeholder { color: #8aa0bd; font-size: 14px; }
|
||||
.contract-filter-input:focus { border-color: #93c5fd; box-shadow: 0 0 0 2px rgba(59, 130, 246, .12); }
|
||||
.contract-filter-submit {
|
||||
height: 36px;
|
||||
padding: 0 14px;
|
||||
border: 1px solid #d7e1ef;
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
color: #426493;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
}
|
||||
.contract-filter-submit:hover { background: #f7faff; color: #183c72; }
|
||||
.review-table { width: 100%; min-width: 980px; border-collapse: collapse; color: #183c72; }.review-table th { padding: 13px 14px; border-bottom: 1px solid #d7e1ef; background: #f7faff; color: #426493; text-align: left; }.review-table td { padding: 13px 14px; border-bottom: 1px solid #d7e1ef; vertical-align: top; }.review-table tbody tr:last-child td { border-bottom: 0; }.review-table strong, .review-table span { display: block; }.review-table strong { color: #102d59; }.review-table span, .review-table li { color: #9a3412; }.review-table ul { margin: 0; padding-left: 18px; }.review-table li + li { margin-top: 3px; }
|
||||
</style>
|
||||
@@ -1,16 +1,17 @@
|
||||
<!--
|
||||
features/contract-payment/views/ContractPaymentWeeklyBatchesPage.vue
|
||||
用途:独立展示合同付款预警的周汇总批次及其企业微信发送审计摘要,并下载 Excel 明细。
|
||||
依赖:contract-payment.api、统一消息提示;由工作台“合同付款预警 > 周汇总批次”路由加载。
|
||||
逻辑:后端扫描产生的批次在此集中查看;Excel 经受控接口下载,手动发送仅提交异步任务。
|
||||
依赖:contract-payment.api、useAuthStore、统一消息提示;由工作台“合同付款预警 > 周汇总批次”路由加载。
|
||||
逻辑:后端扫描产生的批次在此集中查看;Excel 经受控接口下载;手动发送仅管理员可见并提交异步任务。
|
||||
-->
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { CalendarClock, Download, RefreshCw, Send } from 'lucide-vue-next';
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { CalendarClock, Download, Send } from 'lucide-vue-next';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { BusinessError } from '@/shared/api/client';
|
||||
import { formatLocalDateTime } from '@/shared/utils/dateTime';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
import { useAuthStore } from '@/features/auth/stores/auth.store';
|
||||
import {
|
||||
downloadContractPaymentAlertBatchExcel,
|
||||
enqueueContractPaymentWeeklyAlert,
|
||||
@@ -19,6 +20,8 @@ import {
|
||||
} from '../api/contract-payment.api';
|
||||
|
||||
const { t, te } = useI18n();
|
||||
const auth = useAuthStore();
|
||||
const isAdmin = computed(() => auth.isAdmin);
|
||||
const msg = useMessage();
|
||||
const batches = ref<AlertBatch[]>([]);
|
||||
const loading = ref(false);
|
||||
@@ -44,10 +47,11 @@ async function load(): Promise<void> {
|
||||
|
||||
/**
|
||||
* 手动提交本周汇总发送任务。
|
||||
* 核心逻辑:调用异步入队接口,避免浏览器等待企业微信发送和 Excel 文件生成完成。
|
||||
* 核心逻辑:仅管理员可调用异步入队接口,避免浏览器等待企业微信发送和 Excel 文件生成完成。
|
||||
* @returns 提交结果通过统一消息提示反馈,成功后刷新批次列表。
|
||||
*/
|
||||
async function runWeeklyAlert(): Promise<void> {
|
||||
if (!isAdmin.value) return;
|
||||
actionLoading.value = true;
|
||||
try {
|
||||
await enqueueContractPaymentWeeklyAlert();
|
||||
@@ -128,10 +132,7 @@ onMounted(() => void load());
|
||||
<h2 class="text-2xl font-bold text-primary">{{ t('admin.contractPayment.weeklyBatchesTitle') }}</h2>
|
||||
<p class="mt-1 text-sm text-muted">{{ t('admin.contractPayment.weeklyBatchesSubtitle') }}</p>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<button class="btn-secondary-ds" :disabled="loading" @click="() => load()">
|
||||
<RefreshCw class="h-4 w-4" />{{ t('admin.contractPayment.refresh') }}
|
||||
</button>
|
||||
<div v-if="isAdmin" class="flex gap-2">
|
||||
<button class="btn-primary" :disabled="actionLoading" @click="runWeeklyAlert">
|
||||
<Send class="h-4 w-4" />{{ t('admin.contractPayment.weeklySend') }}
|
||||
</button>
|
||||
|
||||
Reference in new issue
Block a user