82 lines
5.3 KiB
Vue
82 lines
5.3 KiB
Vue
<!--
|
||
features/contract-payment/views/ContractPaymentReviewPage.vue
|
||
用途:集中展示关键解析事实缺失或冲突的合同,供管理员下载原文并人工确认。
|
||
依赖:contract-payment.api、PaginationBar、工作台路由与统一消息提示。
|
||
逻辑:后端以 review_only 过滤 needs_review 合同;页面不推导付款节点,也不触发预警任务。
|
||
-->
|
||
<script setup lang="ts">
|
||
import { onMounted, ref } from 'vue';
|
||
import { useRouter } from 'vue-router';
|
||
import { useI18n } from 'vue-i18n';
|
||
import { Search } from 'lucide-vue-next';
|
||
import { BusinessError } from '@/shared/api/client';
|
||
import PaginationBar from '@/shared/components/PaginationBar.vue';
|
||
import { useMessage } from '@/shared/composables/useMessage';
|
||
import { WORKSPACE_PATHS } from '@/features/workspace/constants/routes';
|
||
import { listContractPaymentContracts, type ContractPaymentContract } from '../api/contract-payment.api';
|
||
|
||
const router = useRouter();
|
||
const { t } = useI18n();
|
||
const msg = useMessage();
|
||
const keyword = ref('');
|
||
const loading = ref(false);
|
||
const contracts = ref<ContractPaymentContract[]>([]);
|
||
const page = ref(1);
|
||
const pageSize = ref(20);
|
||
const total = ref(0);
|
||
const pages = ref(1);
|
||
|
||
/**
|
||
* 读取需要人工确认的合同列表。
|
||
* 核心逻辑:明确传入 reviewOnly,避免前端仅按显示状态过滤而遗漏后端新产生的待确认合同。
|
||
* @param resetPage - 为 true 时重置到第一页,供关键词查询使用。
|
||
* @returns 请求完成后更新分页数据;失败时保留已有列表并提示原因。
|
||
*/
|
||
async function load(resetPage = false): Promise<void> {
|
||
if (resetPage) page.value = 1;
|
||
loading.value = true;
|
||
try {
|
||
const result = await listContractPaymentContracts({
|
||
keyword: keyword.value.trim(), reviewOnly: true, page: page.value, pageSize: pageSize.value,
|
||
});
|
||
contracts.value = result.items || [];
|
||
total.value = result.total || 0;
|
||
pages.value = result.pages || 1;
|
||
page.value = result.page || 1;
|
||
} catch (error) {
|
||
msg.error(error instanceof BusinessError ? error.message : t('admin.contractPaymentReview.loadFailed'));
|
||
} finally {
|
||
loading.value = false;
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 打开待确认合同详情,以便查看解析问题并下载原文人工核验。
|
||
* 核心逻辑:仍复用现有合同详情页,避免新页面复制附件权限与下载逻辑。
|
||
* @param contractId - 合同付款台账主键。
|
||
* @returns 路由跳转完成。
|
||
*/
|
||
async function openContractDetail(contractId: number): Promise<void> {
|
||
await router.push(WORKSPACE_PATHS.contractPaymentDetail(contractId));
|
||
}
|
||
|
||
onMounted(() => void load());
|
||
</script>
|
||
|
||
<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="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>
|
||
</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()" />
|
||
</section>
|
||
</template>
|
||
|
||
<style scoped>
|
||
.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>
|