feat: 合同付款预警迁移到agent页面

This commit is contained in:
sophie committed 2026-09-16 09:36:18 +08:00
1 parent ef6bc42c20
commit 4ce2defef0
49 files changed
+1052 -423

No files matched your search

+2 -5
View File
@@ -1,7 +1,7 @@
/**
* app/router/guards.ts
* 全局路由守卫:认证、权限、旧 URL 兼容、document.title。
* 依赖:vue-router、config、auth.store、i18n、adminModulePath、isPublicPath、useMessage、contract-payment 权限常量。
* 依赖:vue-router、config、auth.store、i18n、adminModulePath、isPublicPath、useMessage。
* 逻辑:beforeEach 做登录/管理员/功能权限校验,未登录跳登录页时携带 redirect 深链参数(登录后原样回跳);
* afterEach 将 meta.title(i18n key 或字面量)解析为浏览器标题。
*/
@@ -9,7 +9,6 @@ import type { Router } from 'vue-router';
import { config } from '@/config';
import { adminModulePath } from '@/features/admin/constants/modules';
import { useAuthStore } from '@/features/auth/stores/auth.store';
import { CONTRACT_PAYMENT_ACCESS_PERMISSION } from '@/features/contract-payment/constants';
import { isPublicPath } from '@/shared/constants/routes';
import { useMessage } from '@/shared/composables/useMessage';
import { resolveSafeRedirect } from '@/shared/utils/redirect';
@@ -98,9 +97,7 @@ export function setupRouterGuards(router: Router): void {
.find((key): key is string => Boolean(key));
if (requiredFeature && !auth.hasFeaturePermission(requiredFeature)) {
// 无专项权限时提示后再回应用管理,避免静默跳转让用户以为菜单坏了。
const messageKey = requiredFeature === CONTRACT_PAYMENT_ACCESS_PERMISSION
? 'errors.codes.CONTRACT_PAYMENT_FORBIDDEN'
: 'errors.codes.AUTH_FORBIDDEN';
const messageKey = 'errors.codes.AUTH_FORBIDDEN';
useMessage().warning(String(i18n.global.t(messageKey)));
next('/workspace/applications');
return;
@@ -1,11 +1,13 @@
/**
* app/router/routes/workspace.routes.ts
* 工作台路由表:/workspace 布局壳 + 各业务子页面懒加载。
* 依赖:vue-router、contract-payment 权限常量;meta.title 存 i18n key(workspace.*),由 guards 解析为 document.title。
* 逻辑:WorkspaceLayout 嵌套应用首页、知识库、排程、反馈等子页;合同付款子路由用 requiresFeaturePermission 而非 requiresAdmin;立账凭证明细为 accounting-voucher-check/runs/:runId。
* 依赖:vue-router;meta.title 存 i18n key(workspace.*),由 guards 解析为 document.title。
* 逻辑:WorkspaceLayout 嵌套应用首页、知识库、排程、反馈等子页;合同付款旧地址重定向到 Chat Agent。
* 立账凭证明细为 accounting-voucher-check/runs/:runId。
*/
import type { RouteRecordRaw } from 'vue-router';
import { CONTRACT_PAYMENT_ACCESS_PERMISSION } from '@/features/contract-payment/constants';
const contractPaymentChatRedirect = () => import('@/features/contract-payment/views/ContractPaymentChatRedirect.vue');
export const workspaceRoutes: RouteRecordRaw[] = [
{
@@ -93,26 +95,26 @@ export const workspaceRoutes: RouteRecordRaw[] = [
{
path: 'contract-payment',
name: 'workspace-contract-payment',
component: () => import('@/features/contract-payment/views/ContractPaymentPage.vue'),
meta: { title: 'workspace.nav.contractPayment', requiresFeaturePermission: CONTRACT_PAYMENT_ACCESS_PERMISSION },
component: contractPaymentChatRedirect,
meta: { title: 'workspace.nav.contractPayment' },
},
{
path: 'contract-payment/review',
name: 'workspace-contract-payment-review',
component: () => import('@/features/contract-payment/views/ContractPaymentReviewPage.vue'),
meta: { title: 'workspace.nav.contractPaymentReview', requiresFeaturePermission: CONTRACT_PAYMENT_ACCESS_PERMISSION },
component: contractPaymentChatRedirect,
meta: { title: 'workspace.nav.contractPaymentReview' },
},
{
path: 'contract-payment/weekly-batches',
name: 'workspace-contract-payment-weekly-batches',
component: () => import('@/features/contract-payment/views/ContractPaymentWeeklyBatchesPage.vue'),
meta: { title: 'workspace.nav.contractPaymentWeeklyBatches', requiresFeaturePermission: CONTRACT_PAYMENT_ACCESS_PERMISSION },
component: contractPaymentChatRedirect,
meta: { title: 'workspace.nav.contractPaymentWeeklyBatches' },
},
{
path: 'contract-payment/contracts/:contractId',
name: 'workspace-contract-payment-detail',
component: () => import('@/features/contract-payment/views/ContractPaymentDetailPage.vue'),
meta: { title: 'workspace.nav.contractPayment', requiresFeaturePermission: CONTRACT_PAYMENT_ACCESS_PERMISSION },
component: contractPaymentChatRedirect,
meta: { title: 'workspace.nav.contractPayment' },
},
{
path: 'feedback',
@@ -217,19 +217,13 @@ onMounted(() => {
>
{{ t('admin.role.' + user.role) }}
</span>
<div v-if="user.feature_permissions?.training_hr_manage || user.feature_permissions?.['contract_payment.access']" class="mt-2 flex flex-wrap gap-1.5">
<div v-if="user.feature_permissions?.training_hr_manage" class="mt-2 flex flex-wrap gap-1.5">
<span
v-if="user.feature_permissions?.training_hr_manage"
class="inline-flex rounded-full border border-brand-100 bg-brand-50 px-2.5 py-0.5 text-xs font-medium text-brand-700"
>
{{ t('admin.user.fields.trainingHrManage') }}
</span>
<span
v-if="user.feature_permissions?.['contract_payment.access']"
class="inline-flex rounded-full border border-brand-100 bg-brand-50 px-2.5 py-0.5 text-xs font-medium text-brand-700"
>
{{ t('admin.user.fields.contractPaymentAccess') }}
</span>
</div>
</td>
<td class="px-6 py-4 text-right">
@@ -1,6 +1,6 @@
/**
* features/admin/modules/users/components/UserFormModal.vue
* 创建/编辑用户弹窗,含角色与功能权限勾选(培训 HR、合同付款预警访问)。
* 创建/编辑用户弹窗,含角色与培训 HR 功能权限勾选。
*/
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
@@ -105,17 +105,6 @@ const { t } = useI18n();
<span class="block text-xs leading-5 text-muted">{{ t('admin.user.fields.trainingHrManageHint') }}</span>
</span>
</label>
<label class="flex items-start gap-3 rounded-xl border border-default bg-white px-4 py-3">
<input
v-model="form.feature_permissions['contract_payment.access']"
type="checkbox"
class="mt-0.5 h-4 w-4 rounded border-default text-brand-600 focus:ring-brand-500"
/>
<span class="space-y-1">
<span class="block text-sm font-medium text-primary">{{ t('admin.user.fields.contractPaymentAccess') }}</span>
<span class="block text-xs leading-5 text-muted">{{ t('admin.user.fields.contractPaymentAccessHint') }}</span>
</span>
</label>
</div>
<div class="space-y-1.5">
<label class="block text-xs font-semibold text-muted uppercase tracking-wider">
@@ -205,7 +205,6 @@ export function useUsersAdmin() {
phone_number: user.phone_number || '',
feature_permissions: {
training_hr_manage: Boolean(user.feature_permissions?.training_hr_manage),
'contract_payment.access': Boolean(user.feature_permissions?.['contract_payment.access']),
},
agent_ids: user.agent_ids || [],
};
@@ -15,7 +15,6 @@ export interface UserFormState {
phone_number: string;
feature_permissions: {
training_hr_manage: boolean;
'contract_payment.access': boolean;
};
agent_ids: number[];
}
@@ -54,7 +53,6 @@ export const createEmptyUserForm = (): UserFormState => ({
phone_number: '',
feature_permissions: {
training_hr_manage: false,
'contract_payment.access': false,
},
agent_ids: [],
});
@@ -1,7 +1,7 @@
/**
* features/auth/stores/auth.store.ts
* 认证全局状态;Phase 0 仍委托 utils/auth 读写 storage。
* 依赖:shared/utils/auth、contract-payment 权限常量。
* 依赖:shared/utils/auth。
* 逻辑:登录态同步到 Pinia;hasFeaturePermission 供路由守卫与侧栏判断专项权限。
*/
import { defineStore } from 'pinia';
@@ -16,7 +16,6 @@ import {
type AuthUser,
type FeaturePermissions,
} from '@/shared/utils/auth';
import { CONTRACT_PAYMENT_ACCESS_PERMISSION } from '@/features/contract-payment/constants';
export type { AuthUser, FeaturePermissions };
@@ -36,18 +35,15 @@ export const useAuthStore = defineStore('auth', () => {
/**
* 判断当前登录用户是否具备指定功能权限。
* 核心逻辑:读取登录态 feature_permissions 的显式布尔值;键缺失时,合同付款访问与后端角色默认对齐(admin 为 true),避免权限键新增前写入的旧会话被误拦。
* 核心逻辑:读取登录态 feature_permissions 的显式布尔值;键缺失时回退 false。
* @param permissionKey - 后端 User.get_feature_permissions 下发的键
* @returns 显式为 true,或键缺失且命中角色默认时返回 true
* @returns 显式为 true 时返回 true
*/
const hasFeaturePermission = (permissionKey: string): boolean => {
const bag = user.value?.feature_permissions;
if (bag && Object.prototype.hasOwnProperty.call(bag, permissionKey)) {
return Boolean(bag[permissionKey]);
}
if (permissionKey === CONTRACT_PAYMENT_ACCESS_PERMISSION) {
return user.value?.role === 'admin';
}
return false;
};
@@ -1,6 +1,6 @@
/**
* features/chat/components/ChatMobileHeader.vue
* 移动端顶栏:Agent 名称、学习之窗与 Agent 切换弹层。
* 移动端顶栏:Agent 名称、学习之窗与 Agent 切换弹层。合同付款预警可隐藏历史入口。
*/
<script setup lang="ts">
import { onBeforeUnmount, onMounted, ref } from 'vue';
@@ -15,6 +15,7 @@ defineProps<{
activeAgentId: number;
hasAgentGuides: boolean;
userAgents: ChatMobileHeaderAgent[];
hideHistory?: boolean;
}>();
const emit = defineEmits<{
@@ -85,6 +86,7 @@ onBeforeUnmount(() => {
<LayoutGrid class="h-5 w-5" />
</button>
<button
v-if="!hideHistory"
type="button"
class="flex h-9 w-9 items-center justify-center rounded-full text-muted transition-colors hover-surface-soft"
:title="$t('chat.history')"
@@ -4,7 +4,7 @@
* 依赖:lucide-vue-next、LocaleToggleButton、ExternalSystemLinks、AgentCategoryList、chat.types。
* 逻辑:由聊天页面传入当前 Agent、历史记录与用户可用 Agent;通过事件把新会话、切换 Agent、反馈、进入管理控制台等操作回传给页面。
* 管理员通过底部右侧工具图标进入管理控制台;用户下拉菜单仅保留退出登录。
* 关联服务入口与主题/语言等底栏图标统一为同尺寸 inline icon 按钮,避免错位。
* 合同付款预警第一期不走对话,hideSessionUi 时隐藏新会话与历史列表。
*/
<script setup lang="ts">
import { computed, onBeforeUnmount, onMounted, ref } from 'vue';
@@ -48,6 +48,7 @@ const props = defineProps<{
userAgents: ChatSidebarAgent[];
currentUser: Record<string, unknown> | null;
appliedTheme: string;
hideSessionUi?: boolean;
}>();
const emit = defineEmits<{
@@ -198,13 +199,16 @@ const orderExtractionAttentionClass = (item: DisplayHistoryItem) => {
</button>
</div>
<div class="px-4 pb-4">
<div v-if="!hideSessionUi" class="px-4 pb-4">
<button type="button" class="chat-sidebar-btn" @click="onNewChat">
<Plus class="h-4 w-4" /> {{ $t('chat.createNewChat') }}
</button>
</div>
<p v-else class="px-4 pb-3 text-xs leading-5 text-muted">
{{ $t('admin.contractPayment.sessionHint') }}
</p>
<div class="flex items-center justify-between px-4 py-2">
<div v-if="!hideSessionUi" class="flex items-center justify-between px-4 py-2">
<span class="text-xs font-semibold text-muted">{{ $t('chat.history') }}</span>
<button
v-if="displayHistory.length > 0"
@@ -216,7 +220,7 @@ const orderExtractionAttentionClass = (item: DisplayHistoryItem) => {
</button>
</div>
<div class="scrollbar-thin flex-1 overflow-y-auto px-2">
<div v-if="!hideSessionUi" class="scrollbar-thin flex-1 overflow-y-auto px-2">
<div v-if="displayHistory.length === 0" class="py-8 text-center text-sm italic text-muted">
{{ $t('chat.noHistory') }}
</div>
@@ -4,11 +4,11 @@
* 用途:对话页主区域,组合侧栏、消息列表、输入栏、货代会话 Workflow 时间线与内置浏览器。
* 依赖:ChatSidebar、ChatMessageList、ChatInputBar、ShippingWorkflowTimeline、chat.context。
* 依赖:ChatSidebar、ChatMessageList、ChatInputBar、ShippingWorkflowTimeline、ContractPaymentChatPanel、chat.context。
* 逻辑:本文件只做页面结构编排;货代 Chat 仅上传/进度通知,履约写操作不在本页;
* 右侧「本次处理」由 conversationId 驱动 Workflow projection,extractionRunNo 仅作进度装饰;
* 订单复核工作台异步分包,避免普通对话首屏拉取 PDF.js。
* 订单复核工作台异步分包,避免普通对话首屏拉取 PDF.js;合同付款预警 Agent 用 Tab 台账替换消息列表与输入框。
*/
@@ -44,7 +44,7 @@ import { useChatPageContext } from '@/features/chat/composables/chat.context';
import { matchesTrainingAgent } from '@/features/chat/training/trainingWorkspace.utils';
import { agentHasIntentUiProfile, resolveAgentCode, AGENT_CODE_IN_TRANSIT_TRANSFER } from '@/shared/utils/agent-registry.utils';
import { agentHasIntentUiProfile, resolveAgentCode, AGENT_CODE_IN_TRANSIT_TRANSFER, isContractPaymentAgent } from '@/shared/utils/agent-registry.utils';
import {
SHIPPING_WORKFLOW_KEY,
@@ -70,6 +70,10 @@ const ShippingOrderReviewView = defineAsyncComponent(
() => import('@/features/chat/views/ShippingOrderReviewView.vue'),
);
const ContractPaymentChatPanel = defineAsyncComponent(
() => import('@/features/contract-payment/components/ContractPaymentChatPanel.vue'),
);
type MaintenanceRecordPanelCommand = {
mode: 'list' | 'create';
@@ -114,6 +118,9 @@ const isMaintenanceAgentPage = computed(() => agentHasIntentUiProfile(page.curre
/** 在途仓自动调拨 Agent:无消息时展示专属首页入口区(决策:补 Chat 首页入口 A 方案)。 */
const isInTransitTransferAgent = computed(() => resolveAgentCode(page.currentAgent) === AGENT_CODE_IN_TRANSIT_TRANSFER);
/** 合同付款预警 Agent:主区嵌台账 Tab,隐藏对话输入与历史。 */
const isContractPaymentAgentPage = computed(() => isContractPaymentAgent(page.currentAgent));
/** 在途仓自动调拨业务流激活(来源选择/待处理等子视图)时隐藏聊天输入框,模拟业务页。 */
const transferFlowActive = ref(false);
watch(isInTransitTransferAgent, (isTransfer) => { if (!isTransfer) transferFlowActive.value = false; });
@@ -391,6 +398,8 @@ watch(() => page.currentAgentId, () => {
:applied-theme="page.appliedTheme"
:hide-session-ui="isContractPaymentAgentPage"
@new-chat="page.handleSidebarNewChat"
@open-guide="page.openGuideModal"
@@ -431,6 +440,8 @@ watch(() => page.currentAgentId, () => {
:user-agents="page.userAgents"
:hide-history="isContractPaymentAgentPage"
@open-guide="page.openGuideModal"
@go-history="page.goToWorkspace('history')"
@@ -473,6 +484,8 @@ watch(() => page.currentAgentId, () => {
<ShippingOrderReviewView v-if="isOrderReviewMode" />
<ContractPaymentChatPanel v-else-if="isContractPaymentAgentPage" />
<div v-else class="flex min-h-0 min-w-0 flex-1" :class="showShippingWorkflowTimeline ? 'shipping-workbench-layout' : ''">
<div class="flex min-h-0 min-w-0 flex-1 flex-col" :class="showShippingWorkflowTimeline ? 'shipping-chat-column' : ''">
@@ -21,11 +21,11 @@ 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 type LedgerFocus = 'due' | 'overdue' | 'active' | 'due_this_month';
export interface LedgerSummary {
due: number;
overdue: number;
needs_completion: number;
active: 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; }
@@ -37,7 +37,7 @@ export interface AlertSummary { pending_count: number; next_send_at?: string | n
* @param params.keyword - 模糊检索词,可为空。
* @param params.parse_status - 解析状态精确筛选。
* @param params.reviewOnly - 为 true 时只查 needs_review。
* @param params.focus - 汇总卡口径:即将到期 / 逾期未付 / 待补充 / 本月应付。
* @param params.focus - 汇总卡口径:即将到期 / 逾期未付 / 进行中 / 本月应付。
* @returns 分页后的合同列表。
*/
export const listContractPaymentContracts = (params?: { keyword?: string; parse_status?: string; reviewOnly?: boolean; focus?: LedgerFocus; page?: number; pageSize?: number }) => {
@@ -61,7 +61,7 @@ export const getContractPaymentAlertSummary = () => requestJson<AlertSummary>('/
/**
* 查询合同台账四张汇总卡的合同份数。
* 核心逻辑:始终统计全部已解析台账,不跟当前 keyword;与点卡片过滤共用 focus 口径。
* @returns due / overdue / needs_completion / due_this_month。
* @returns due / overdue / active / due_this_month。
*/
export const getContractPaymentLedgerSummary = () => requestJson<LedgerSummary>('/api/contract-payment/contracts/summary');
export const listContractPaymentAlertBatches = () => requestJson<{ items: AlertBatch[] }>('/api/contract-payment/alert-batches');
@@ -0,0 +1,202 @@
<!--
features/contract-payment/components/ContractPaymentChatPanel.vue
用途:合同付款预警 Chat 主区:管理员按钮、三 Tab、当前 Tab 内详情下钻。
依赖:contract-payment 三页与详情、useContractPaymentAdminActions、vue-router query。
逻辑:由 ChatViewContent 在 agent_code=contract_payment 时替换消息列表与输入框;
view / contractId 写入 /chat/:agentId 查询参数,旧工作台地址重定向后仍可深链打开。
-->
<script setup lang="ts">
import { computed, onMounted, ref, watch } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { CalendarClock, RefreshCw, Send } from 'lucide-vue-next';
import { useI18n } from 'vue-i18n';
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
import { listContractPaymentContracts } from '../api/contract-payment.api';
import { useContractPaymentAdminActions } from '../composables/useContractPaymentAdminActions';
import type { ContractPaymentView } from '../constants';
import {
buildContractPaymentChatQuery,
parseContractPaymentChatQuery,
} from '../utils/contractPaymentChat.utils';
import ContractPaymentPage from '../views/ContractPaymentPage.vue';
import ContractPaymentReviewPage from '../views/ContractPaymentReviewPage.vue';
import ContractPaymentWeeklyBatchesPage from '../views/ContractPaymentWeeklyBatchesPage.vue';
import ContractPaymentDetailPage from '../views/ContractPaymentDetailPage.vue';
const { t } = useI18n();
const route = useRoute();
const router = useRouter();
const parsedQuery = computed(() => parseContractPaymentChatQuery(route.query.view, route.query.contractId));
const activeView = computed<ContractPaymentView>(() => parsedQuery.value.view);
const detailId = computed(() => parsedQuery.value.contractId);
const reviewCount = ref(0);
const {
isAdmin,
actionLoading,
showForceSyncConfirm,
showReparseExistingConfirm,
run,
confirmForceSync,
confirmReparseExisting,
} = useContractPaymentAdminActions();
const tabs = computed(() => ([
{ key: 'ledger' as const, label: t('admin.contractPayment.ledger') },
{ key: 'review' as const, label: t('admin.contractPaymentReview.title'), count: reviewCount.value },
{ key: 'batches' as const, label: t('admin.contractPayment.weeklyBatchesTitle') },
]));
/**
* 把当前 Tab / 详情写入 Chat 路由,保持刷新与旧地址重定向可用。
* 核心逻辑:replace 避免 Tab 切换堆积历史;切 Tab 时清掉 contractId。
*/
async function syncQuery(view: ContractPaymentView, contractId: number | null): Promise<void> {
const nextQuery = buildContractPaymentChatQuery(view, contractId);
const currentView = String(route.query.view || '');
const currentContractId = String(route.query.contractId || '');
if (currentView === nextQuery.view && currentContractId === (nextQuery.contractId || '')) return;
const query = { ...route.query, ...nextQuery };
if (!contractId) delete query.contractId;
await router.replace({ params: { ...route.params }, query });
}
/**
* 切换主 Tab;详情下钻随 Tab 关闭,避免第四个隐形页。
*/
function selectView(view: ContractPaymentView): void {
void syncQuery(view, null);
}
/**
* 在当前 Tab 内打开合同详情。
*/
function openDetail(contractId: number): void {
void syncQuery(activeView.value, contractId);
}
/**
* 从详情返回当前 Tab 列表。
*/
function closeDetail(): void {
void syncQuery(activeView.value, null);
}
/**
* 读取待确认合同数量,供 Tab 角标展示。
* 核心逻辑:只取 total,不拉列表正文,失败时角标归零不打断主区。
*/
async function loadReviewCount(): Promise<void> {
try {
const result = await listContractPaymentContracts({
reviewOnly: true,
page: 1,
pageSize: 1,
});
reviewCount.value = result.total || 0;
} catch {
reviewCount.value = 0;
}
}
onMounted(() => {
void loadReviewCount();
});
watch(
() => route.query.view,
(rawView) => {
if (rawView) return;
void syncQuery(activeView.value, detailId.value);
},
{ immediate: true },
);
</script>
<template>
<section class="flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-[var(--surface-muted,#f4f7fb)]">
<div class="flex flex-wrap items-start justify-between gap-3 px-5 pt-5">
<div class="min-w-0">
<h1 class="text-xl font-bold text-primary">{{ t('admin.contractPayment.title') }}</h1>
<p class="mt-1 text-sm text-muted">{{ t('admin.contractPayment.subtitle') }}</p>
</div>
<div v-if="isAdmin" class="flex flex-wrap gap-2">
<button class="btn-secondary-ds" type="button" :disabled="actionLoading" @click="run('sync')">
<RefreshCw class="h-4 w-4" />{{ t('admin.contractPayment.sync') }}
</button>
<button class="btn-secondary-ds" type="button" :disabled="actionLoading" @click="run('force-sync')">
<RefreshCw class="h-4 w-4" />{{ t('admin.contractPayment.forceSync') }}
</button>
<button class="btn-secondary-ds" type="button" :disabled="actionLoading" @click="run('reparse-existing')">
<RefreshCw class="h-4 w-4" />{{ t('admin.contractPayment.reparseExisting') }}
</button>
<button class="btn-secondary-ds" type="button" :disabled="actionLoading" @click="run('scan')">
<CalendarClock class="h-4 w-4" />{{ t('admin.contractPayment.scanAlerts') }}
</button>
<button class="btn-primary" type="button" :disabled="actionLoading" @click="run('weekly')">
<Send class="h-4 w-4" />{{ t('admin.contractPayment.weeklySend') }}
</button>
</div>
</div>
<div class="mt-4 flex gap-0 border-b border-default px-5">
<button
v-for="tab in tabs"
:key="tab.key"
type="button"
class="mb-[-1px] border-b-2 px-4 py-2.5 text-sm font-bold"
:class="activeView === tab.key
? 'border-brand-500 text-brand-600'
: 'border-transparent text-muted hover:text-secondary'"
@click="selectView(tab.key)"
>
{{ tab.label }}
<span
v-if="tab.key === 'review' && tab.count"
class="ml-1 inline-grid h-[18px] min-w-[18px] place-items-center rounded-full bg-amber-50 px-1.5 text-[11px] text-amber-700"
>{{ tab.count }}</span>
</button>
</div>
<div class="min-h-0 flex-1 overflow-auto px-5 py-4">
<ContractPaymentDetailPage
v-if="detailId"
:contract-id="detailId"
embedded
@close="closeDetail"
/>
<ContractPaymentPage
v-else-if="activeView === 'ledger'"
embedded
@open-detail="openDetail"
/>
<ContractPaymentReviewPage
v-else-if="activeView === 'review'"
embedded
@open-detail="openDetail"
/>
<ContractPaymentWeeklyBatchesPage
v-else
embedded
/>
</div>
<DeleteConfirmDialog
v-if="isAdmin"
v-model="showForceSyncConfirm"
:title="t('admin.contractPayment.forceSync')"
:message="t('admin.contractPayment.forceSyncConfirm')"
confirm-tone="primary"
@confirm="confirmForceSync"
/>
<DeleteConfirmDialog
v-if="isAdmin"
v-model="showReparseExistingConfirm"
:title="t('admin.contractPayment.reparseExisting')"
:message="t('admin.contractPayment.reparseExistingConfirm')"
confirm-tone="primary"
@confirm="confirmReparseExisting"
/>
</section>
</template>
@@ -0,0 +1,88 @@
/**
* features/contract-payment/composables/useContractPaymentAdminActions.ts
* 用途:合同付款预警管理员异步任务(同步 / 重解析 / 扫描 / 发送)共用入口。
* 依赖:contract-payment.api、useAuthStore、useMessage、i18n。
* 逻辑:Chat 顶栏与旧台账页共用;非管理员直接忽略,强制覆盖和存量重解析先走确认框。
*/
import { computed, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { BusinessError } from '@/shared/api/client';
import { useMessage } from '@/shared/composables/useMessage';
import { useAuthStore } from '@/features/auth/stores/auth.store';
import {
enqueueContractPaymentAlertScan,
enqueueContractPaymentReparse,
enqueueContractPaymentSync,
enqueueContractPaymentWeeklyAlert,
} from '../api/contract-payment.api';
export type ContractPaymentAdminAction = 'sync' | 'force-sync' | 'reparse-existing' | 'scan' | 'weekly';
/**
* 提供合同付款预警管理员操作状态与提交函数。
* 核心逻辑:仅 role=admin 可提交;入队成功只提示任务已提交,不阻塞等待 Worker。
* @param onAfterScanOrWeekly - 扫描或发送后刷新本周待发送摘要的回调
*/
export function useContractPaymentAdminActions(onAfterScanOrWeekly?: () => Promise<void> | void) {
const { t } = useI18n();
const auth = useAuthStore();
const msg = useMessage();
const isAdmin = computed(() => auth.isAdmin);
const actionLoading = ref(false);
const showForceSyncConfirm = ref(false);
const showReparseExistingConfirm = ref(false);
/**
* 提交合同付款预警后台任务。
* 核心逻辑:按操作类型调用相应异步接口;扫描和发送成功后刷新摘要。
*/
async function submitAction(action: ContractPaymentAdminAction): Promise<void> {
if (!isAdmin.value) return;
actionLoading.value = true;
try {
if (action === 'sync' || action === 'force-sync') {
await enqueueContractPaymentSync(action === 'force-sync');
} else if (action === 'reparse-existing') {
await enqueueContractPaymentReparse();
} else if (action === 'scan') {
await enqueueContractPaymentAlertScan();
} else {
await enqueueContractPaymentWeeklyAlert();
}
msg.success(t('admin.contractPayment.jobSubmitted'));
if ((action === 'scan' || action === 'weekly') && onAfterScanOrWeekly) {
await onAfterScanOrWeekly();
}
} catch (error) {
msg.error(error instanceof BusinessError ? error.message : t('admin.contractPayment.actionFailed'));
} finally {
actionLoading.value = false;
}
}
/**
* 触发任务入口;强制覆盖和存量重解析先弹出确认框。
*/
function run(action: ContractPaymentAdminAction): void {
if (!isAdmin.value) return;
if (action === 'force-sync') {
showForceSyncConfirm.value = true;
return;
}
if (action === 'reparse-existing') {
showReparseExistingConfirm.value = true;
return;
}
void submitAction(action);
}
return {
isAdmin,
actionLoading,
showForceSyncConfirm,
showReparseExistingConfirm,
run,
confirmForceSync: () => void submitAction('force-sync'),
confirmReparseExisting: () => void submitAction('reparse-existing'),
};
}
@@ -1,7 +1,9 @@
/**
* features/contract-payment/constants.ts
* 用途:合同付款预警前端权限键与路由 meta 共用常量。
* 用途:合同付款预警 Chat 视图与查询参数常量。
* 依赖:无。
* 逻辑:路由守卫、侧栏与用户管理勾选读取同一键,须与后端 User._role_default_feature_permissions 一致。
* 逻辑:Chat Tab、工作台旧地址重定向与详情下钻共用同一套 view 名。
*/
export const CONTRACT_PAYMENT_ACCESS_PERMISSION = 'contract_payment.access' as const;
export const CONTRACT_PAYMENT_VIEWS = ['ledger', 'review', 'batches'] as const;
export type ContractPaymentView = (typeof CONTRACT_PAYMENT_VIEWS)[number];
@@ -0,0 +1,42 @@
/**
* features/contract-payment/utils/contractPaymentChat.utils.test.ts
* 用途:锁定合同付款预警 Chat 深链 query 的解析与回写规则。
*/
import { describe, expect, it } from 'vitest';
import {
buildContractPaymentChatQuery,
parseContractPaymentChatQuery,
} from './contractPaymentChat.utils';
describe('parseContractPaymentChatQuery', () => {
it('accepts ledger / review / batches and a positive contractId', () => {
expect(parseContractPaymentChatQuery('review', '12')).toEqual({
view: 'review',
contractId: 12,
});
});
it('falls back to ledger for unknown view and ignores invalid contractId', () => {
expect(parseContractPaymentChatQuery('unknown', 'abc')).toEqual({
view: 'ledger',
contractId: null,
});
expect(parseContractPaymentChatQuery(undefined, '0')).toEqual({
view: 'ledger',
contractId: null,
});
});
});
describe('buildContractPaymentChatQuery', () => {
it('always writes view and omits contractId on list pages', () => {
expect(buildContractPaymentChatQuery('batches', null)).toEqual({ view: 'batches' });
});
it('keeps the current tab when drilling into a contract', () => {
expect(buildContractPaymentChatQuery('review', 9)).toEqual({
view: 'review',
contractId: '9',
});
});
});
@@ -0,0 +1,46 @@
/**
* features/contract-payment/utils/contractPaymentChat.utils.ts
* 用途:解析合同付款预警 Chat 的 view / contractId 查询参数。
* 依赖:contract-payment/constants。
* 逻辑:旧工作台重定向与 Chat Tab 共用;非法 view 回退台账。
*/
import { CONTRACT_PAYMENT_VIEWS, type ContractPaymentView } from '../constants';
export interface ContractPaymentChatQuery {
view: ContractPaymentView;
contractId: number | null;
}
/**
* 把路由 query 归一成 Chat 台账视图。
* 核心逻辑:只接受 ledger / review / batches;contractId 必须是正整数才进入详情下钻。
* @param rawView - 路由 query.view
* @param rawContractId - 路由 query.contractId
* @returns 可安全写入 Tab 与详情状态的查询对象
*/
export function parseContractPaymentChatQuery(
rawView: unknown,
rawContractId: unknown,
): ContractPaymentChatQuery {
const view = CONTRACT_PAYMENT_VIEWS.includes(String(rawView) as ContractPaymentView)
? String(rawView) as ContractPaymentView
: 'ledger';
const parsed = Number(rawContractId);
const contractId = Number.isInteger(parsed) && parsed > 0 ? parsed : null;
return { view, contractId };
}
/**
* 把台账视图写回 Chat 路由 query,便于刷新与旧工作台重定向共用同一深链。
* 核心逻辑:始终带 view;仅在下钻详情时带 contractId,避免空 query 污染地址栏。
* @param view - 当前 Tab
* @param contractId - 详情合同 ID;列表态传 null
*/
export function buildContractPaymentChatQuery(
view: ContractPaymentView,
contractId: number | null,
): Record<string, string> {
const query: Record<string, string> = { view };
if (contractId) query.contractId = String(contractId);
return query;
}
@@ -0,0 +1,77 @@
<!--
features/contract-payment/views/ContractPaymentChatRedirect.vue
用途:把旧工作台合同付款预警 URL 转到对应 Chat Agent 深链。
依赖:listUserAgents、isContractPaymentAgent、contractPaymentChat.utils。
逻辑:按路径还原 view / contractId,再在当前用户 Agent 列表中定位 contract_payment;
未授权时提示并回应用管理。本页不渲染业务 UI。
-->
<script setup lang="ts">
import { onMounted } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { listUserAgents } from '@/features/auth/api/user.api';
import { useMessage } from '@/shared/composables/useMessage';
import { isContractPaymentAgent } from '@/shared/utils/agent-registry.utils';
import { WORKSPACE_PATHS } from '@/features/workspace/constants/routes';
import type { ContractPaymentView } from '../constants';
import { buildContractPaymentChatQuery } from '../utils/contractPaymentChat.utils';
const route = useRoute();
const router = useRouter();
const { t } = useI18n();
const msg = useMessage();
/**
* 从旧工作台路径还原 Chat Tab 与详情合同。
* 核心逻辑:review / weekly-batches / contracts/:id 分别对应三个 Tab 与台账下钻。
*/
function resolveLegacyTarget(): { view: ContractPaymentView; contractId: number | null } {
const path = String(route.path || '');
if (path.includes('/contract-payment/review')) {
return { view: 'review', contractId: null };
}
if (path.includes('/contract-payment/weekly-batches')) {
return { view: 'batches', contractId: null };
}
const detailMatch = path.match(/\/contract-payment\/contracts\/(\d+)/);
if (detailMatch) {
return { view: 'ledger', contractId: Number(detailMatch[1]) };
}
return { view: 'ledger', contractId: null };
}
/**
* 查找当前用户可用的合同付款预警 Agent 并跳转 Chat。
* 核心逻辑:admin 与已授权用户都能在 /api/agents 看到该 Agent;找不到则视为无权限。
*/
async function redirectToChat(): Promise<void> {
const { view, contractId } = resolveLegacyTarget();
try {
const agents = await listUserAgents();
const agent = Array.isArray(agents) ? agents.find((item) => isContractPaymentAgent(item)) : null;
const agentId = Number(agent?.id);
if (!Number.isInteger(agentId) || agentId <= 0) {
msg.warning(t('errors.codes.CONTRACT_PAYMENT_FORBIDDEN'));
await router.replace(WORKSPACE_PATHS.applications);
return;
}
await router.replace({
path: `/chat/${agentId}`,
query: buildContractPaymentChatQuery(view, contractId),
});
} catch {
msg.warning(t('errors.codes.CONTRACT_PAYMENT_FORBIDDEN'));
await router.replace(WORKSPACE_PATHS.applications);
}
}
onMounted(() => {
void redirectToChat();
});
</script>
<template>
<div class="flex min-h-[40vh] items-center justify-center text-sm text-muted">
{{ t('chat.loadingAgent') }}
</div>
</template>
@@ -1,12 +1,11 @@
<!--
features/contract-payment/views/ContractPaymentDetailPage.vue
用途:展示单份采购合同的概览、原文附件、付款计划及企业微信预警审计。
依赖:contract-payment.api、vue-router、统一消息提示;由合同付款台账的行点击进入。
依赖:contract-payment.api、统一消息提示;由 Chat 台账/待确认行点击在当前 Tab 内下钻。
逻辑:以合同 ID 调用已有详情接口,所有付款任务按付款节点和预警轮次聚合呈现。
-->
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue';
import { useRoute, useRouter } from 'vue-router';
import { computed, onMounted, ref, watch } from 'vue';
import { ArrowLeft, CircleHelp, Download, FileText, RefreshCw } from 'lucide-vue-next';
import { useI18n } from 'vue-i18n';
import { BusinessError } from '@/shared/api/client';
@@ -20,20 +19,26 @@ import {
type ContractPaymentContract,
type PaymentNode,
} from '../api/contract-payment.api';
import { WORKSPACE_PATHS } from '@/features/workspace/constants/routes';
import { displayCurrency } from '../utils/currency';
import { isNodeNearDue, isNodeOverdue, nodeDueReference } from '../utils/paymentStatus';
const props = withDefaults(defineProps<{
contractId: number;
embedded?: boolean;
}>(), { embedded: false });
const emit = defineEmits<{
close: [];
}>();
const { t, te } = useI18n();
const route = useRoute();
const router = useRouter();
const msg = useMessage();
const contract = ref<ContractPaymentContract | null>(null);
const loading = ref(false);
const downloadingId = ref<number | null>(null);
const reparsing = ref(false);
const activeTab = ref<'plan' | 'attachments' | 'alerts'>('plan');
const contractId = computed(() => Number(route.params.contractId));
const contractId = computed(() => Number(props.contractId));
const orderedNodes = computed(() => {
const order = ['prepayment', 'shipment', 'acceptance', 'warranty'];
return [...(contract.value?.nodes || [])].sort((left, right) => order.indexOf(left.node_type) - order.indexOf(right.node_type));
@@ -189,13 +194,13 @@ function alertsForNode(node: PaymentNode) {
}
/**
* 加载当前路由合同的完整详情。
* 核心逻辑:ID 非法时返回台账;接口失败保留空态并展示统一业务错误。
* 加载当前合同的完整详情。
* 核心逻辑:ID 非法时通知父级关闭下钻;接口失败保留空态并展示统一业务错误。
* @returns 完成后更新详情数据及加载状态。
*/
async function load(): Promise<void> {
if (!Number.isInteger(contractId.value) || contractId.value <= 0) {
await router.replace(WORKSPACE_PATHS.contractPayment);
emit('close');
return;
}
loading.value = true;
@@ -254,14 +259,17 @@ async function reparseContract(): Promise<void> {
}
/**
* 返回合同付款预警台账。
* 核心逻辑:使用路由常量而非浏览器历史,避免从周汇总或外部链接进入详情时返回错误页面。
* @returns 路由跳转完成。
* 返回当前 Tab 的合同列表。
* 核心逻辑:由 Chat 父级清掉 contractId,避免从待确认下钻后误回到台账。
*/
async function backToLedger(): Promise<void> {
await router.push(WORKSPACE_PATHS.contractPayment);
function backToLedger(): void {
emit('close');
}
watch(contractId, () => {
void load();
});
onMounted(() => void load());
</script>
@@ -1,23 +1,17 @@
<!--
合同付款预警工作台:展示汇总卡、合同台账、付款阶段字段、本周待发送摘要;同步/扫描/发送仅管理员可见。
依赖:contract-payment.api、PaginationBar、useAuthStore、统一消息提示;周汇总批次由独立页面展示。
features/contract-payment/views/ContractPaymentPage.vue
用途:合同付款预警台账列表、汇总卡与本周待发送摘要。
依赖:contract-payment.api、PaginationBar、统一消息提示。
逻辑:Chat Tab 以 embedded 嵌入时隐藏页头;点行通过 open-detail 交给父级下钻详情。
-->
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { CalendarClock, RefreshCw, Search, Send } from 'lucide-vue-next';
import { Search } from 'lucide-vue-next';
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,
enqueueContractPaymentReparse,
enqueueContractPaymentSync,
enqueueContractPaymentWeeklyAlert,
getContractPaymentAlertSummary,
getContractPaymentLedgerSummary,
listContractPaymentContracts,
@@ -29,22 +23,25 @@ import {
import { displayCurrency } from '../utils/currency';
import { aggregateContractNodeStatus, type ContractNodeStatusCode } from '../utils/paymentStatus';
const props = withDefaults(defineProps<{
embedded?: boolean;
}>(), { embedded: false });
const emit = defineEmits<{
'open-detail': [contractId: number];
}>();
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 msg = useMessage(); const keyword = ref(''); const loading = 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 ledgerSummary = ref<LedgerSummary>({ due: 0, overdue: 0, active: 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: 'active' as const, label: t('admin.contractPayment.ledgerFocus.active'), hint: '', value: ledgerSummary.value.active, tone: 'in-progress' },
{ 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);
@@ -189,80 +186,27 @@ function toggleLedgerFocus(key: LedgerFocus): void {
void load(true);
}
/**
* 提交合同付款预警后台任务。
* 核心逻辑:仅管理员可提交;按操作类型调用相应的异步接口,任务入队成功后仅展示任务编号,不等待长耗时同步或发送完成。
* @param action - sync 同步 OA、force-sync 强制覆盖、reparse-existing 刷新存量解析、scan 扫描预警、weekly 周汇总。
* @returns 任务提交完成后显示成功或失败提示。
* 打开合同详情。
* 核心逻辑:Chat 父级用 open-detail 在当前 Tab 内下钻;不再跳工作台路由。
*/
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') {
await enqueueContractPaymentSync(action === 'force-sync');
} else if (action === 'reparse-existing') {
await enqueueContractPaymentReparse();
} else if (action === 'scan') {
await enqueueContractPaymentAlertScan();
} else {
await enqueueContractPaymentWeeklyAlert();
}
msg.success(t('admin.contractPayment.jobSubmitted'));
if (action === 'scan' || action === 'weekly') {
await refreshSummary();
}
} catch (error) {
msg.error(error instanceof BusinessError ? error.message : t('admin.contractPayment.actionFailed'));
} finally {
actionLoading.value = false;
}
}
/**
* 触发任务入口;强制覆盖同步先弹出统一确认框,其余直接提交。
* 核心逻辑:用公共确认组件替代原生 confirm,避免浏览器差异;确认后仍走统一的提交逻辑。
* @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;
}
if (action === 'reparse-existing') {
showReparseExistingConfirm.value = true;
return;
}
void submitAction(action);
}
/** 强制覆盖同步确认后的提交回调。 */
function confirmForceSync(): void {
void submitAction('force-sync');
}
/** 存量合同批量重解析确认后的提交回调。 */
function confirmReparseExisting(): void {
void submitAction('reparse-existing');
}
/**
* 进入所选合同的付款计划和预警审计详情。
* 核心逻辑:仅使用台账已返回的内部主键构造路由,合同编号为空时仍可安全查看详情。
* @param contractId - 合同台账主键。
* @returns 详情路由跳转完成。
*/
async function openContractDetail(contractId: number): Promise<void> {
await router.push(WORKSPACE_PATHS.contractPaymentDetail(contractId));
function openContractDetail(contractId: number): void {
emit('open-detail', contractId);
}
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 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 v-if="!props.embedded" class="mb-4">
<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="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 }]"
:class="[card.tone, { 'is-selected': ledgerFocus === card.key }]"
@click="toggleLedgerFocus(card.key)"
>
<span class="contract-stat-label">{{ card.label }}<small v-if="card.hint">({{ card.hint }})</small></span>
@@ -302,22 +246,6 @@ onMounted(() => void load());
</table>
</div>
<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')"
confirm-tone="primary"
@confirm="confirmForceSync"
/>
<DeleteConfirmDialog
v-if="isAdmin"
v-model="showReparseExistingConfirm"
:title="t('admin.contractPayment.reparseExisting')"
:message="t('admin.contractPayment.reparseExistingConfirm')"
confirm-tone="primary"
@confirm="confirmReparseExisting"
/>
</section>
</template>
<style scoped>
@@ -340,13 +268,13 @@ onMounted(() => void load());
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-card.is-selected { 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.in-progress .contract-stat-value { color: #2563eb; }
.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 {
@@ -1,21 +1,25 @@
<!--
features/contract-payment/views/ContractPaymentReviewPage.vue
用途:集中展示关键解析事实缺失或冲突的合同,供管理员下载原文并人工确认。
依赖:contract-payment.api、PaginationBar、工作台路由与统一消息提示。
逻辑:后端以 review_only 过滤 needs_review 合同;页面不推导付款节点,也不触发预警任务。
依赖:contract-payment.api、PaginationBar、统一消息提示。
逻辑:后端以 review_only 过滤 needs_review 合同;Chat 父级通过 open-detail 下钻详情。
-->
<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 props = withDefaults(defineProps<{
embedded?: boolean;
}>(), { embedded: false });
const emit = defineEmits<{
'open-detail': [contractId: number];
}>();
const { t } = useI18n();
const msg = useMessage();
const keyword = ref('');
@@ -56,8 +60,8 @@ async function load(resetPage = false): Promise<void> {
* @param contractId - 合同付款台账主键。
* @returns 路由跳转完成。
*/
async function openContractDetail(contractId: number): Promise<void> {
await router.push(WORKSPACE_PATHS.contractPaymentDetail(contractId));
function openContractDetail(contractId: number): void {
emit('open-detail', contractId);
}
onMounted(() => void load());
@@ -65,7 +69,10 @@ 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 v-if="!props.embedded">
<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="contract-filter-bar">
<div class="contract-filter-search">
<Search class="contract-filter-icon" />
@@ -1,31 +1,30 @@
<!--
features/contract-payment/views/ContractPaymentWeeklyBatchesPage.vue
用途:独立展示合同付款预警的周汇总批次及其企业微信发送审计摘要,并下载 Excel 明细。
依赖:contract-payment.api、useAuthStore、统一消息提示;由工作台“合同付款预警 > 周汇总批次”路由加载。
逻辑:后端扫描产生的批次在此集中查看;Excel 经受控接口下载;手动发送仅管理员可见并提交异步任务。
依赖:contract-payment.api、统一消息提示。
逻辑:后端扫描产生的批次在此集中查看;Excel 经受控接口下载;Chat 顶栏共用发送入口,本页 embedded 时隐藏页头与发送按钮。
-->
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue';
import { CalendarClock, Download, Send } from 'lucide-vue-next';
import { onMounted, ref } from 'vue';
import { CalendarClock, Download } 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,
listContractPaymentAlertBatches,
type AlertBatch,
} from '../api/contract-payment.api';
const props = withDefaults(defineProps<{
embedded?: boolean;
}>(), { embedded: false });
const { t, te } = useI18n();
const auth = useAuthStore();
const isAdmin = computed(() => auth.isAdmin);
const msg = useMessage();
const batches = ref<AlertBatch[]>([]);
const loading = ref(false);
const actionLoading = ref(false);
const downloadingId = ref<number | null>(null);
/**
@@ -45,25 +44,6 @@ async function load(): Promise<void> {
}
}
/**
* 手动提交本周汇总发送任务。
* 核心逻辑:仅管理员可调用异步入队接口,避免浏览器等待企业微信发送和 Excel 文件生成完成。
* @returns 提交结果通过统一消息提示反馈,成功后刷新批次列表。
*/
async function runWeeklyAlert(): Promise<void> {
if (!isAdmin.value) return;
actionLoading.value = true;
try {
await enqueueContractPaymentWeeklyAlert();
msg.success(t('admin.contractPayment.weeklyBatchSubmitted'));
await load();
} catch (error) {
msg.error(error instanceof BusinessError ? error.message : t('admin.contractPayment.actionFailed'));
} finally {
actionLoading.value = false;
}
}
/**
* 判断批次是否已归档 Excel,供下载按钮启用。
* 核心逻辑:文件名或大小任一存在即视为可下载;真正有无字节由下载接口校验。
@@ -127,16 +107,9 @@ onMounted(() => void load());
<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.weeklyBatchesTitle') }}</h2>
<p class="mt-1 text-sm text-muted">{{ t('admin.contractPayment.weeklyBatchesSubtitle') }}</p>
</div>
<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>
</div>
<div v-if="!props.embedded">
<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="surface-panel mt-5 overflow-x-auto rounded-2xl">
@@ -1,23 +1,21 @@
<script setup lang="ts">
/**
* features/workspace/components/WorkspaceSidebar.vue
* 工作台左侧导航:子路由链接、货代/合同付款二级菜单、关联服务入口、返回聊天与退出登录。
* 依赖:WORKSPACE_PATHS、workspace.context、ExternalSystemLinks、auth.store、contract-payment 权限常量。
* 逻辑:底部关联服务复用 ws-nav-btn,与返回聊天/退出登录对齐;合同付款菜单仅在具备 contract_payment.access 时展示。
* 工作台左侧导航:子路由链接、货代二级菜单、关联服务入口、返回聊天与退出登录。
* 依赖:WORKSPACE_PATHS、workspace.context、ExternalSystemLinks。
* 逻辑:底部关联服务复用 ws-nav-btn,与返回聊天/退出登录对齐。合同付款已迁入 Chat Agent,不再在此展示。
* 矮屏时中间导航独立滚动,底部返回聊天/退出登录始终留在视口内。
*/
import { computed, inject, onBeforeUnmount, onMounted, ref, watch } from 'vue';
import { useRoute } from 'vue-router';
import {
LayoutGrid, Bot, FileText, User, LogOut, Edit, Megaphone, Clock, Package, PanelLeftClose, PanelLeftOpen, ClipboardCheck, CalendarClock,
LayoutGrid, Bot, FileText, User, LogOut, Edit, Megaphone, Clock, Package, PanelLeftClose, PanelLeftOpen, ClipboardCheck,
ChevronDown, ChevronRight, ContactRound, Inbox, FileDown,
} from 'lucide-vue-next';
import { WORKSPACE_PATHS } from '../constants/routes';
import { WORKSPACE_KEY } from '../composables/workspace.context';
import { useShippingTodoBadge } from '../composables/useShippingTodoBadge';
import { ExternalSystemLinks } from '@/features/sso';
import { useAuthStore } from '@/features/auth/stores/auth.store';
import { CONTRACT_PAYMENT_ACCESS_PERMISSION } from '@/features/contract-payment/constants';
const props = defineProps<{
collapsed?: boolean;
@@ -27,15 +25,7 @@ const ws = inject(WORKSPACE_KEY)! as any;
const route = useRoute();
const shippingRouteNames = ['workspace-shipping-customers', 'workspace-shipping-tasks', 'workspace-shipping-my-tasks'] as const;
const shippingExpanded = ref(false);
const contractPaymentRouteNames = ['workspace-contract-payment', 'workspace-contract-payment-review', 'workspace-contract-payment-weekly-batches'] as const;
const contractPaymentExpanded = ref(false);
const isAdmin = computed(() => String(ws.currentUser?.role || '').trim().toLowerCase() === 'admin');
const auth = useAuthStore();
/**
* 当前用户是否可看见并进入合同付款预警工作台。
* 核心逻辑:读取登录态 feature_permissions.contract_payment.access;admin 默认 true,普通用户需显式授予。
*/
const canAccessContractPayment = computed(() => auth.hasFeaturePermission(CONTRACT_PAYMENT_ACCESS_PERMISSION));
const { pendingBadge, startShippingTodoBadgePolling, stopShippingTodoBadgePolling } = useShippingTodoBadge();
const primaryLinkItems = [
@@ -61,16 +51,13 @@ function isActive(match: readonly string[]) {
return match.includes(String(route.name || ''));
}
/** 当前路由进入货代或合同付款子页面时自动展开对应一级菜单,保证激活项可见。 */
/** 当前路由进入货代子页面时自动展开对应一级菜单,保证激活项可见。 */
watch(
() => route.name,
(routeName) => {
if (shippingRouteNames.includes(String(routeName || '') as typeof shippingRouteNames[number])) {
shippingExpanded.value = true;
}
if (contractPaymentRouteNames.includes(String(routeName || '') as typeof contractPaymentRouteNames[number])) {
contractPaymentExpanded.value = true;
}
},
{ immediate: true },
);
@@ -84,15 +71,6 @@ const toggleShippingMenu = (): void => {
shippingExpanded.value = !shippingExpanded.value;
};
/** 展开或收起合同付款预警目录;侧栏折叠时图标直接进入合同台账。 */
const toggleContractPaymentMenu = (): void => {
if (props.collapsed) {
void ws.router.push(WORKSPACE_PATHS.contractPayment);
return;
}
contractPaymentExpanded.value = !contractPaymentExpanded.value;
};
onMounted(() => {
startShippingTodoBadgePolling();
});
@@ -199,48 +177,6 @@ onBeforeUnmount(() => {
</RouterLink>
</div>
</div>
<div v-if="canAccessContractPayment">
<button
type="button"
class="ws-nav-btn w-full"
:class="[
{ 'ws-nav-btn--active': isActive(contractPaymentRouteNames) },
collapsed ? 'justify-center px-0' : '',
]"
:title="$t('workspace.nav.contractPayment')"
@click="toggleContractPaymentMenu"
>
<CalendarClock class="h-[18px] w-[18px]" />
<span v-if="!collapsed" class="flex-1">{{ $t('workspace.nav.contractPayment') }}</span>
<component v-if="!collapsed" :is="contractPaymentExpanded ? ChevronDown : ChevronRight" class="h-4 w-4" />
</button>
<div v-if="!collapsed && contractPaymentExpanded" class="mt-1 space-y-1 pl-5">
<RouterLink
:to="WORKSPACE_PATHS.contractPayment"
class="ws-nav-btn py-2.5 text-[13px]"
:class="{ 'ws-nav-btn--active': isActive(['workspace-contract-payment']) }"
>
<CalendarClock class="h-4 w-4" />
<span>{{ $t('workspace.nav.contractPaymentLedger') }}</span>
</RouterLink>
<RouterLink
:to="WORKSPACE_PATHS.contractPaymentReview"
class="ws-nav-btn py-2.5 text-[13px]"
:class="{ 'ws-nav-btn--active': isActive(['workspace-contract-payment-review']) }"
>
<ClipboardCheck class="h-4 w-4" />
<span>{{ $t('workspace.nav.contractPaymentReview') }}</span>
</RouterLink>
<RouterLink
:to="WORKSPACE_PATHS.contractPaymentWeeklyBatches"
class="ws-nav-btn py-2.5 text-[13px]"
:class="{ 'ws-nav-btn--active': isActive(['workspace-contract-payment-weekly-batches']) }"
>
<Inbox class="h-4 w-4" />
<span>{{ $t('workspace.nav.contractPaymentWeeklyBatches') }}</span>
</RouterLink>
</div>
</div>
<RouterLink
v-for="item in secondaryLinkItems"
:key="item.path"
@@ -2,6 +2,7 @@
* features/workspace/constants/routes.ts
* 工作台子路由 path 常量,以及旧 ?view= 查询参数到新 path 的映射。
* 立账凭证批次明细:accountingVoucherCheckDetail(scheduleRunId)。
* 合同付款路径仍保留,供旧书签落到 Chat 重定向页。
*/
export const WORKSPACE_PATHS = {
root: '/workspace',
@@ -24,7 +24,6 @@ export type WorkspaceSidebarItem =
| 'schedule_runs'
| 'receipt_reports'
| 'shipping_notice'
| 'contract_payment'
| 'history';
export interface WorkspaceAgent {
+1 -1
View File
@@ -4794,7 +4794,7 @@
}
},
"contractPayment": {
"title": "Contract Payment Alerts", "subtitle": "Sync OA contract, acceptance, and vendor prepayment requests; notify procurement roles through three escalation rounds.", "sync": "Sync OA data", "forceSync": "Force overwrite OA fields", "forceSyncConfirm": "This will overwrite existing OA data with non-empty fields returned this time and record an audit trail. Continue?", "reparseExisting": "Reparse existing contracts", "reparseExistingConfirm": "This will refresh all existing contract parsing results from archived attachments using the current rules. OA fields will not be synced or overwritten. Continue?", "scanAlerts": "Scan to generate alerts", "jobSubmitted": "Job submitted", "actionFailed": "Action failed", "loadFailed": "Failed to load contracts", "searchPlaceholder": "Search contract number, purchase order, or supplier", "allStatus": "All", "search": "Search", "ledger": "Contract ledger", "items": "items", "empty": "No contract data", "purchaseOrder": "Purchase order", "supplier": "Supplier", "amount": "Contract amount", "deliveryDate": "Delivery due date", "timeline": "Payment plan timeline", "notAvailable": "—", "stats": {"contracts": "Contracts", "pendingParse": "Pending contracts", "readyPlans": "Plans ready", "alerts": "Alert nodes"}, "ledgerFocus": {"due": "Due soon", "dueHint": "within 7 days", "overdue": "Overdue unpaid", "needsCompletion": "Needs completion", "dueThisMonth": "Due this month", "dueThisMonthHint": "this calendar month"}, "status": {"completed": "Completed", "needs_review": "Needs review", "pending": "Pending parse"}, "stateLabel": {"parsed": "Parsed", "needs_review": "Needs review", "pending": "Pending parse", "active": "Active"}, "nodeType": {"prepayment": "Prepayment", "shipment": "Shipment payment", "acceptance": "Acceptance payment", "warranty": "Warranty payment"}, "ruleConfirmed": "Confirmed", "prepaymentRule": "Alerts at 7/14/21 days after contract archival; request status comes from OA vendor prepayment requests.", "shipmentRule": "Alerts 7 days before delivery, on the due date, and 14 days after; request status comes from OA vendor prepayment requests.", "acceptanceRule": "Alerts at 30/40/60 days after acceptance archival; warranty alerts are 7 days before, on, and 14 days after maturity.", "pendingAlerts": "Pending alerts", "processing": "Payment initiated", "dataPending": "Data pending", "paid": "Paid", "amountRatioDate": "Amount / ratio · date", "applicant": "Applicant", "statusLabel": "Status", "contractPrefix": "Contract", "datePending": "Date pending", "statusNormal": "Normal", "statusNeedsCompletion": "Needs completion", "statusOverdue": "Overdue", "statusUpcoming": "Due soon", "statusActive": "In progress", "statusCompleted": "Completed", "totalPrefix": "Total", "contractSupplier": "Contract / supplier", "nextAlert": "Next alert", "triggerBasis": "Trigger basis", "alertDate": "Alert date", "alertFirstRound": "Round 1", "payDate": "Payment date", "processStatus": "Status", "owner": "Procurement owner", "oaData": "OA data", "contractRule": "Contract rule", "ownerDefault": "Procurement owner", "workflowNo": "Workflow number", "contractNoPending": "Contract number pending attachment parsing", "synced": "Synced", "detailSubtitle": "OA data, payment nodes, and WeCom alert records", "backToOverview": "Back to overview", "contractInfo": "OA contract details", "alertHistory": "Alert history", "alertRound": "Alert round {round}", "alertAudit": "Alert delivery record", "alertAuditEmpty": "No alert records", "alertNode": "Payment stage", "alertScheduledAt": "Scheduled date", "alertSentAt": "Sent at", "alertStatus": {"pending": "Pending", "sent": "Sent", "failed": "Failed"}, "roundValue": "Round {round}", "weeklyBatchesTitle": "Weekly Summary Batches", "weeklyBatchesSubtitle": "Review recipient-level payment-alert summaries, Excel attachments, and delivery records.", "weeklySend": "Send alerts", "weeklyBatchSubmitted": "Send alert job submitted", "weeklyBatchesLoadFailed": "Failed to load weekly summary batches", "batchNo": "Batch no.", "weekKey": "Week", "batchStatusLabel": "Delivery status", "batchTotal": "Summary count", "batchExcel": "Excel attachment", "batchSentAt": "Sent at", "weeklyBatchesEmpty": "No weekly summary batches", "weeklyPendingSummary": "{count} pending this week · next send {datetime}", "weeklyPendingCountOnly": "{count} pending this week", "downloadExcel": "Download Excel", "excelDownloadFailed": "Failed to download the alert attachment", "batchStatus": {"pending": "Pending", "sent": "Sent", "failed": "Failed", "processing": "Processing", "resolved": "Alerts stopped"}, "backToLedger": "Back", "detailLoadFailed": "Failed to load contract details", "detailLoading": "Loading contract details…", "detailOverview": "Contract Overview", "detailAttachments": "Original Attachments", "detailPaymentPlan": "Payment Plan", "detailAlertHistory": "Alert History", "archiveDate": "Contract archive date", "archiveDateHint": "This date is when the contract apLine truncated
"title": "Contract Payment Alerts", "subtitle": "Sync OA contract, acceptance, and vendor prepayment requests; notify procurement roles through three escalation rounds.", "sessionHint": "Chat and history are hidden in this phase. Use the tabs above to open the ledger.", "sync": "Sync OA data", "forceSync": "Force overwrite OA fields", "forceSyncConfirm": "This will overwrite existing OA data with non-empty fields returned this time and record an audit trail. Continue?", "reparseExisting": "Reparse existing contracts", "reparseExistingConfirm": "This will refresh all existing contract parsing results from archived attachments using the current rules. OA fields will not be synced or overwritten. Continue?", "scanAlerts": "Scan to generate alerts", "jobSubmitted": "Job submitted", "actionFailed": "Action failed", "loadFailed": "Failed to load contracts", "searchPlaceholder": "Search contract number, purchase order, or supplier", "allStatus": "All", "search": "Search", "ledger": "Contract ledger", "items": "items", "empty": "No contract data", "purchaseOrder": "Purchase order", "supplier": "Supplier", "amount": "Contract amount", "deliveryDate": "Delivery due date", "timeline": "Payment plan timeline", "notAvailable": "—", "stats": {"contracts": "Contracts", "pendingParse": "Pending contracts", "readyPlans": "Plans ready", "alerts": "Alert nodes"}, "ledgerFocus": {"due": "Due soon", "dueHint": "within 7 days", "overdue": "Overdue unpaid", "active": "In progress", "dueThisMonth": "Due this month", "dueThisMonthHint": "this calendar month"}, "status": {"completed": "Completed", "needs_review": "Needs review", "pending": "Pending parse"}, "stateLabel": {"parsed": "Parsed", "needs_review": "Needs review", "pending": "Pending parse", "active": "Active"}, "nodeType": {"prepayment": "Prepayment", "shipment": "Shipment payment", "acceptance": "Acceptance payment", "warranty": "Warranty payment"}, "ruleConfirmed": "Confirmed", "prepaymentRule": "Alerts at 7/14/21 days after contract archival; request status comes from OA vendor prepayment requests.", "shipmentRule": "Alerts 7 days before delivery, on the due date, and 14 days after; request status comes from OA vendor prepayment requests.", "acceptanceRule": "Alerts at 30/40/60 days after acceptance archival; warranty alerts are 7 days before, on, and 14 days after maturity.", "pendingAlerts": "Pending alerts", "processing": "Payment initiated", "dataPending": "Data pending", "paid": "Paid", "amountRatioDate": "Amount / ratio · date", "applicant": "Applicant", "statusLabel": "Status", "contractPrefix": "Contract", "datePending": "Date pending", "statusNormal": "Normal", "statusNeedsCompletion": "Needs completion", "statusOverdue": "Overdue", "statusUpcoming": "Due soon", "statusActive": "In progress", "statusCompleted": "Completed", "totalPrefix": "Total", "contractSupplier": "Contract / supplier", "nextAlert": "Next alert", "triggerBasis": "Trigger basis", "alertDate": "Alert date", "alertFirstRound": "Round 1", "payDate": "Payment date", "processStatus": "Status", "owner": "Procurement owner", "oaData": "OA data", "contractRule": "Contract rule", "ownerDefault": "Procurement owner", "workflowNo": "Workflow number", "contractNoPending": "Contract number pending attachment parsing", "synced": "Synced", "detailSubtitle": "OA data, payment nodes, and WeCom alert records", "backToOverview": "Back to overview", "contractInfo": "OA contract details", "alertHistory": "Alert history", "alertRound": "Alert round {round}", "alertAudit": "Alert delivery record", "alertAuditEmpty": "No alert records", "alertNode": "Payment stage", "alertScheduledAt": "Scheduled date", "alertSentAt": "Sent at", "alertStatus": {"pending": "Pending", "sent": "Sent", "failed": "Failed"}, "roundValue": "Round {round}", "weeklyBatchesTitle": "Weekly Summary Batches", "weeklyBatchesSubtitle": "Review recipient-level payment-alert summaries, Excel attachments, and delivery records.", "weeklySend": "Send alerts", "weeklyBatchSubmitted": "Send alert job submitted", "weeklyBatchesLoadFailed": "Failed to load weekly summary batches", "batchNo": "Batch no.", "weekKey": "Week", "batchStatusLabel": "Delivery status", "batchTotal": "Summary count", "batchExcel": "Excel attachment", "batchSentAt": "Sent at", "weeklyBatchesEmpty": "No weekly summary batches", "weeklyPendingSummary": "{count} pending this week · next send {datetime}", "weeklyPendingCountOnly": "{count} pending this week", "downloadExcel": "Download Excel", "excelDownloadFailed": "Failed to download the alert attachment", "batchStatus": {"pending": "Pending", "sent": "Sent", "failed": "Failed", "processing": "Processing", "resolved": "Alerts stopped"}, "backToLedger": "Back", "detailLoadFailed": "Failed to load contract details", "detailLoading": "Loading contract details…", "detailOverview": "Contract Overview", "detailAttachments": "Original Attachments", "detailPaymentPlan": "Payment Plan", "detailAlertHistory": "Alert History", "archivLine truncated
},
"contractPaymentReview": {"title": "Contracts for Confirmation", "subtitle": "Contracts that do not match the equipment procurement synonym title groups, fail payment-ratio validation, or conflict with OA fields are excluded from payment alerts. Download the original contract to verify it.", "searchPlaceholder": "Contract number, purchase order, or supplier", "loadFailed": "Failed to load contracts for confirmation", "contractWorkflow": "Contract / workflow number", "reason": "Reason for confirmation", "fallbackIssue": "Parsing result requires manual confirmation", "empty": "No contracts need confirmation"},
"contractPaymentReparse": {"action": "Reparse contract original", "success": "Reparsed with attachment “{attachment}”", "failed": "Failed to reparse contract"},
+1 -1
View File
@@ -4663,7 +4663,7 @@
}
},
"contractPayment": {
"title": "แจ้งเตือนการชำระเงินตามสัญญา", "subtitle": "ซิงก์สัญญา OA การรับมอบ และคำขอเบิกเงินล่วงหน้าของผู้ขาย พร้อมแจ้งเตือน 3 ระดับ", "sync": "ซิงก์ข้อมูล OA", "forceSync": "เขียนทับฟิลด์ OA แบบบังคับ", "forceSyncConfirm": "ระบบจะเขียนทับข้อมูล OA เดิมด้วยฟิลด์ที่ไม่ว่างจาก OA ครั้งนี้และบันทึกการตรวจสอบ ต้องการดำเนินการต่อหรือไม่?", "reparseExisting": "แยกวิเคราะห์สัญญาเดิมทั้งหมดใหม่", "reparseExistingConfirm": "ระบบจะรีเฟรชผลการแยกข้อมูลของสัญญาเดิมทั้งหมดจากไฟล์แนบที่จัดเก็บตามกฎปัจจุบัน โดยจะไม่ซิงก์หรือเขียนทับฟิลด์ OA ต้องการดำเนินการต่อหรือไม่?", "scanAlerts": "สแกนเพื่อสร้างแจ้งเตือน", "jobSubmitted": "ส่งงานแล้ว", "actionFailed": "ดำเนินการไม่สำเร็จ", "loadFailed": "โหลดสัญญาไม่สำเร็จ", "searchPlaceholder": "ค้นหาเลขที่สัญญา ใบสั่งซื้อ หรือผู้ขาย", "allStatus": "ทั้งหมด", "search": "ค้นหา", "ledger": "ทะเบียนสัญญา", "items": "รายการ", "empty": "ไม่มีข้อมูลสัญญา", "purchaseOrder": "ใบสั่งซื้อ", "supplier": "ผู้ขาย", "amount": "มูลค่าสัญญา", "deliveryDate": "กำหนดส่งมอบ", "timeline": "ไทม์ไลน์แผนการชำระเงิน", "notAvailable": "—", "stats": {"contracts": "สัญญา", "pendingParse": "สัญญาที่รอดำเนินการ", "readyPlans": "แผนพร้อมใช้", "alerts": "จุดแจ้งเตือน"}, "ledgerFocus": {"due": "ใกล้ครบกำหนด", "dueHint": "ใน 7 วัน", "overdue": "ค้างชำระเกินกำหนด", "needsCompletion": "รอข้อมูลเพิ่ม", "dueThisMonth": "ถึงกำหนดเดือนนี้", "dueThisMonthHint": "เดือนปฏิทินนี้"}, "status": {"completed": "เสร็จสิ้น", "needs_review": "ต้องตรวจสอบ", "pending": "รอแยกข้อมูล"}, "stateLabel": {"parsed": "แยกข้อมูลแล้ว", "needs_review": "ต้องตรวจสอบ", "pending": "รอแยกข้อมูล", "active": "ใช้งานอยู่"}, "nodeType": {"prepayment": "เงินล่วงหน้า", "shipment": "เงินก่อนส่ง", "acceptance": "เงินรับมอบ", "warranty": "เงินประกัน"}, "ruleConfirmed": "ยืนยันแล้ว", "prepaymentRule": "แจ้งเตือนวันที่ 7/14/21 หลังจัดเก็บสัญญา; สถานะคำขออ้างอิง OA.", "shipmentRule": "แจ้งเตือนก่อนกำหนดส่ง 7 วัน วันครบกำหนด และหลังครบกำหนด 14 วัน; สถานะคำขออ้างอิง OA.", "acceptanceRule": "แจ้งเตือนวันที่ 30/40/60 หลังจัดเก็บใบรับมอบ; เงินประกันแจ้งก่อนครบกำหนด 7 วัน วันครบกำหนด และหลังครบกำหนด 14 วัน.", "pendingAlerts": "แจ้งเตือนที่รอดำเนินการ", "processing": "เริ่มชำระแล้ว", "dataPending": "รอข้อมูล", "paid": "ชำระแล้ว", "amountRatioDate": "จำนวนเงิน / สัดส่วน · วันที่", "applicant": "ผู้ขอ", "statusLabel": "สถานะ", "contractPrefix": "สัญญา", "datePending": "รอระบุวันที่", "statusNormal": "ปกติ", "statusNeedsCompletion": "ต้องเติมข้อมูล", "statusOverdue": "เกินกำหนดชำระ", "statusUpcoming": "ใกล้ถึงกำหนด", "statusActive": "กำลังดำเนินการ", "statusLine truncated
"title": "แจ้งเตือนการชำระเงินตามสัญญา", "subtitle": "ซิงก์สัญญา OA การรับมอบ และคำขอเบิกเงินล่วงหน้าของผู้ขาย พร้อมแจ้งเตือน 3 ระดับ", "sessionHint": "ระยะนี้ยังไม่ใช้แชทและประวัติการสนทนา เปิดบัญชีจากแท็บด้านบน", "sync": "ซิงก์ข้อมูล OA", "forceSync": "เขียนทับฟิลด์ OA แบบบังคับ", "forceSyncConfirm": "ระบบจะเขียนทับข้อมูล OA เดิมด้วยฟิลด์ที่ไม่ว่างจาก OA ครั้งนี้และบันทึกการตรวจสอบ ต้องการดำเนินการต่อหรือไม่?", "reparseExisting": "แยกวิเคราะห์สัญญาเดิมทั้งหมดใหม่", "reparseExistingConfirm": "ระบบจะรีเฟรชผลการแยกข้อมูลของสัญญาเดิมทั้งหมดจากไฟล์แนบที่จัดเก็บตามกฎปัจจุบัน โดยจะไม่ซิงก์หรือเขียนทับฟิลด์ OA ต้องการดำเนินการต่อหรือไม่?", "scanAlerts": "สแกนเพื่อสร้างแจ้งเตือน", "jobSubmitted": "ส่งงานแล้ว", "actionFailed": "ดำเนินการไม่สำเร็จ", "loadFailed": "โหลดสัญญาไม่สำเร็จ", "searchPlaceholder": "ค้นหาเลขที่สัญญา ใบสั่งซื้อ หรือผู้ขาย", "allStatus": "ทั้งหมด", "search": "ค้นหา", "ledger": "ทะเบียนสัญญา", "items": "รายการ", "empty": "ไม่มีข้อมูลสัญญา", "purchaseOrder": "ใบสั่งซื้อ", "supplier": "ผู้ขาย", "amount": "มูลค่าสัญญา", "deliveryDate": "กำหนดส่งมอบ", "timeline": "ไทม์ไลน์แผนการชำระเงิน", "notAvailable": "—", "stats": {"contracts": "สัญญา", "pendingParse": "สัญญาที่รอดำเนินการ", "readyPlans": "แผนพร้อมใช้", "alerts": "จุดแจ้งเตือน"}, "ledgerFocus": {"due": "ใกล้ครบกำหนด", "dueHint": "ใน 7 วัน", "overdue": "ค้างชำระเกินกำหนด", "active": "กำลังดำเนินการ", "dueThisMonth": "ถึงกำหนดเดือนนี้", "dueThisMonthHint": "เดือนปฏิทินนี้"}, "status": {"completed": "เสร็จสิ้น", "needs_review": "ต้องตรวจสอบ", "pending": "รอแยกข้อมูล"}, "stateLabel": {"parsed": "แยกข้อมูลแล้ว", "needs_review": "ต้องตรวจสอบ", "pending": "รอแยกข้อมูล", "active": "ใช้งานอยู่"}, "nodeType": {"prepayment": "เงินล่วงหน้า", "shipment": "เงินก่อนส่ง", "acceptance": "เงินรับมอบ", "warranty": "เงินประกัน"}, "ruleConfirmed": "ยืนยันแล้ว", "prepaymentRule": "แจ้งเตือนวันที่ 7/14/21 หลังจัดเก็บสัญญา; สถานะคำขออ้างอิง OA.", "shipmentRule": "แจ้งเตือนก่อนกำหนดส่ง 7 วัน วันครบกำหนด และหลังครบกำหนด 14 วัน; สถานะคำขออ้างอิง OA.", "acceptanceRule": "แจ้งเตือนวันที่ 30/40/60 หลังจัดเก็บใบรับมอบ; เงินประกันแจ้งก่อนครบกำหนด 7 วัน วันครบกำหนด และหลังครบกำหนด 14 วัน.", "pendingAlerts": "แจ้งเตือนที่รอดำเนินการ", "processing": "เริ่มชำระแล้ว", "dataPending": "รอข้อมูล", "paid": "ชำระแล้ว", "amountRatioDate": "จำนวนเงิน / สัดส่วน · วันที่", "applicant": "ผู้ขอ", "statusLabel": "สถานะ", "contractPrefix": "สัญญา", "datePending": "รอระบุวันที่", "statusNormal": "ปกติ", "statusNeedsCompletion": "ต้องเติมข้อมูLine truncated
},
"contractPaymentReview": {"title": "สัญญาที่รอยืนยัน", "subtitle": "สัญญาที่ไม่ตรงกับกลุ่มหัวข้อคำพ้องของสัญญาจัดซื้ออุปกรณ์ ตรวจสอบสัดส่วนการชำระเงินไม่ผ่าน หรือขัดแย้งกับฟิลด์ OA จะไม่เข้าสู่การแจ้งเตือนการชำระเงิน โปรดดาวน์โหลดต้นฉบับเพื่อตรวจสอบ", "searchPlaceholder": "เลขที่สัญญา ใบสั่งซื้อ หรือผู้ขาย", "loadFailed": "โหลดสัญญาที่รอยืนยันไม่สำเร็จ", "contractWorkflow": "เลขที่สัญญา / เวิร์กโฟลว์", "reason": "เหตุผลที่ต้องยืนยัน", "fallbackIssue": "ผลการแยกข้อมูลต้องยืนยันโดยผู้ใช้", "empty": "ไม่มีสัญญาที่รอยืนยัน"},
"contractPaymentReparse": {"action": "แยกข้อมูลจากต้นฉบับอีกครั้ง", "success": "แยกข้อมูลใหม่ด้วยไฟล์แนบ “{attachment}” แล้ว", "failed": "แยกข้อมูลสัญญาใหม่ไม่สำเร็จ"},
+2 -1
View File
@@ -4781,6 +4781,7 @@
"contractPayment": {
"title": "合同付款预警",
"subtitle": "同步 OA 合同、验收和厂商预付款请款作业,按三轮规则通知采购岗位",
"sessionHint": "本期不使用对话和历史会话,请从上方 Tab 查看台账。",
"sync": "同步 OA 数据",
"forceSync": "强制覆盖 OA 字段",
"forceSyncConfirm": "将用本次 OA 返回的非空字段覆盖已有 OA 数据,并记录变更审计。是否继续?",
@@ -4803,7 +4804,7 @@
"timeline": "付款计划时间线",
"notAvailable": "—",
"stats": {"contracts": "合同总数", "pendingParse": "待处理合同", "readyPlans": "计划已生成", "alerts": "待预警节点"},
"ledgerFocus": {"due": "即将到期", "dueHint": "7日内", "overdue": "逾期未付", "needsCompletion": "待补充", "dueThisMonth": "本月应付", "dueThisMonthHint": "本自然月"},
"ledgerFocus": {"due": "即将到期", "dueHint": "7日内", "overdue": "逾期未付", "active": "进行中", "dueThisMonth": "本月应付", "dueThisMonthHint": "本自然月"},
"status": {"completed": "已完成", "needs_review": "待复核", "pending": "待解析"}, "stateLabel": {"parsed": "已解析", "needs_review": "待复核", "pending": "待解析", "active": "已生效"},
"nodeType": {"prepayment": "预付款", "shipment": "出货款", "acceptance": "验收款", "warranty": "质保款"},
"ruleConfirmed": "已确定",
+1 -1
View File
@@ -4668,7 +4668,7 @@
}
},
"contractPayment": {
"title": "合約付款預警", "subtitle": "同步 OA 合約、驗收和廠商預付款請款作業,按三輪規則通知採購職位", "sync": "同步 OA 資料", "forceSync": "強制覆蓋 OA 欄位", "forceSyncConfirm": "將以本次 OA 回傳的非空欄位覆蓋既有 OA 資料,並記錄變更稽核。是否繼續?", "reparseExisting": "批量重新解析既有合約", "reparseExistingConfirm": "將使用已歸檔的合約附件依目前規則更新所有既有合約的解析結果,不會同步或覆蓋 OA 欄位。是否繼續?", "scanAlerts": "掃描產生預警", "jobSubmitted": "工作已提交", "actionFailed": "操作失敗", "loadFailed": "載入合約失敗", "searchPlaceholder": "搜尋合約編號、採購單號或供應商", "allStatus": "全部", "search": "查詢", "ledger": "合約台帳", "items": "筆", "empty": "暫無合約資料", "purchaseOrder": "採購單號", "supplier": "供應商", "amount": "合約金額", "deliveryDate": "交貨期限", "timeline": "付款計畫時間線", "notAvailable": "—", "stats": {"contracts": "合約總數", "pendingParse": "待處理合約", "readyPlans": "計畫已產生", "alerts": "待預警節點"}, "ledgerFocus": {"due": "即將到期", "dueHint": "7日內", "overdue": "逾期未付", "needsCompletion": "待補充", "dueThisMonth": "本月應付", "dueThisMonthHint": "本自然月"}, "status": {"completed": "已完成", "needs_review": "待覆核", "pending": "待解析"}, "stateLabel": {"parsed": "已解析", "needs_review": "待複核", "pending": "待解析", "active": "已生效"}, "nodeType": {"prepayment": "預付款", "shipment": "出貨款", "acceptance": "驗收款", "warranty": "質保款"}, "ruleConfirmed": "已確定", "prepaymentRule": "合約歸檔後第 7/14/21 天預警;請款以 OA 廠商預付款請款作業為準。", "shipmentRule": "交貨期限前 7 天、到期日、到期後 14 天預警;請款以 OA 廠商預付款請款作業為準。", "acceptanceRule": "驗收歸檔後第 30/40/60 天預警;質保款在質保到期前 7 天、到期日、到期後 14 天預警。", "pendingAlerts": "待處理預警", "processing": "已發起付款", "dataPending": "資料待確認", "paid": "已付款", "amountRatioDate": "金額 / 比例 · 日期", "applicant": "申請人", "statusLabel": "狀態", "contractPrefix": "合約", "datePending": "待補充日期", "statusNormal": "正常", "statusNeedsCompletion": "待補充", "statusOverdue": "已逾期", "statusUpcoming": "即將到期", "statusActive": "進行中", "statusCompleted": "已完成", "totalPrefix": "共", "contractSupplier": "合約號 / 供應商", "nextAlert": "下一預警", "triggerBasis": "觸發依據", "alertDate": "預警日期", "alertFirstRound": "首輪", "payDate": "付款日期", "processStatus": "處理狀態", "owner": "採購負責人", "oaData": "OA 資料", "contractRule": "合約規則", "ownerDefault": "採購負責人", "workflowNo": "流程編號", "contractNoPending": "合約號待從附件解析", "synced": "已同步", "detailSubtitle": "OA 資料、付款節點與企業微信提醒記錄", "backToOverview": "返回總覽", "contractInfo": "OA 合約資訊", "alertHistory": "預警記錄", "alertRound": "第 {round} 次預警", "alertAudit": "預警發送記錄", "alertAuditEmpty": "暫無預警記錄", "alertNode": "付款節點", "alertScheduledAt": "計畫日期", "alertSentAt": "發送時間", "alertStatus": {"pending": "待發送", "sent": "已發送", "failed": "發送失敗"}, "roundValue": "第 {round} 次", "weeklyBatchesTitle": "週彙總批次", "weeklyBatchesSubtitle": "查看依收件人產生的付款預警週彙總、Excel 附件與發送記錄。", "weeklySend": "傳送預警", "weeklyBatchSubmitted": "發送預警任務已提交", "weeklyBatchesLoadFailed": "載入週彙總批次失敗", "batchNo": "批次號", "weekKey": "週次", "batchStatusLabel": "發送狀態", "batchTotal": "彙總筆數", "batchExcel": "Excel 附件", "batchSentAt": "發送時間", "weeklyBatchesEmpty": "暫無週彙總批次", "weeklyPendingSummary": "本週待發送 {count} 筆 · 下次發送 {datetime}", "weeklyPendingCountOnly": "本週待發送 {count} 筆", "downloadExcel": "下載 Excel", "excelDownloadFailed": "下載預警附件失敗", "batchStatus": {"pending": "待發送", "sent": "已發送", "failed": "發送失敗", "processing": "處理中", "resolved": "已停止提醒"}, "backToLedger": "返回", "detailLoadFailed": "載入合約詳情失敗", "detailLoading": "正在載入合約詳情…", "detailOverview": "合約概覽", "detailAttachments": "原文附件", "detailPaymentPlan": "付款計畫", "detailAlertHistory": "預警記錄", "archiveDate": "合約歸檔日期", "archiveDateHint": "該日期為合約申請單的歸檔日期", "parseStatus": "解析狀態", "parseIssueTitle": "解析提示", "planStatus": "計畫狀態", "attachmentsEmpty": "暫無已歸檔的合約原文附件", "downloadAttachment": "下載Line truncated
"title": "合約付款預警", "subtitle": "同步 OA 合約、驗收和廠商預付款請款作業,按三輪規則通知採購職位", "sessionHint": "本期不使用對話和歷史會話,請從上方 Tab 查看台帳。", "sync": "同步 OA 資料", "forceSync": "強制覆蓋 OA 欄位", "forceSyncConfirm": "將以本次 OA 回傳的非空欄位覆蓋既有 OA 資料,並記錄變更稽核。是否繼續?", "reparseExisting": "批量重新解析既有合約", "reparseExistingConfirm": "將使用已歸檔的合約附件依目前規則更新所有既有合約的解析結果,不會同步或覆蓋 OA 欄位。是否繼續?", "scanAlerts": "掃描產生預警", "jobSubmitted": "工作已提交", "actionFailed": "操作失敗", "loadFailed": "載入合約失敗", "searchPlaceholder": "搜尋合約編號、採購單號或供應商", "allStatus": "全部", "search": "查詢", "ledger": "合約台帳", "items": "筆", "empty": "暫無合約資料", "purchaseOrder": "採購單號", "supplier": "供應商", "amount": "合約金額", "deliveryDate": "交貨期限", "timeline": "付款計畫時間線", "notAvailable": "—", "stats": {"contracts": "合約總數", "pendingParse": "待處理合約", "readyPlans": "計畫已產生", "alerts": "待預警節點"}, "ledgerFocus": {"due": "即將到期", "dueHint": "7日內", "overdue": "逾期未付", "active": "進行中", "dueThisMonth": "本月應付", "dueThisMonthHint": "本自然月"}, "status": {"completed": "已完成", "needs_review": "待覆核", "pending": "待解析"}, "stateLabel": {"parsed": "已解析", "needs_review": "待複核", "pending": "待解析", "active": "已生效"}, "nodeType": {"prepayment": "預付款", "shipment": "出貨款", "acceptance": "驗收款", "warranty": "質保款"}, "ruleConfirmed": "已確定", "prepaymentRule": "合約歸檔後第 7/14/21 天預警;請款以 OA 廠商預付款請款作業為準。", "shipmentRule": "交貨期限前 7 天、到期日、到期後 14 天預警;請款以 OA 廠商預付款請款作業為準。", "acceptanceRule": "驗收歸檔後第 30/40/60 天預警;質保款在質保到期前 7 天、到期日、到期後 14 天預警。", "pendingAlerts": "待處理預警", "processing": "已發起付款", "dataPending": "資料待確認", "paid": "已付款", "amountRatioDate": "金額 / 比例 · 日期", "applicant": "申請人", "statusLabel": "狀態", "contractPrefix": "合約", "datePending": "待補充日期", "statusNormal": "正常", "statusNeedsCompletion": "待補充", "statusOverdue": "已逾期", "statusUpcoming": "即將到期", "statusActive": "進行中", "statusCompleted": "已完成", "totalPrefix": "共", "contractSupplier": "合約號 / 供應商", "nextAlert": "下一預警", "triggerBasis": "觸發依據", "alertDate": "預警日期", "alertFirstRound": "首輪", "payDate": "付款日期", "processStatus": "處理狀態", "owner": "採購負責人", "oaData": "OA 資料", "contractRule": "合約規則", "ownerDefault": "採購負責人", "workflowNo": "流程編號", "contractNoPending": "合約號待從附件解析", "synced": "已同步", "detailSubtitle": "OA 資料、付款節點與企業微信提醒記錄", "backToOverview": "返回總覽", "contractInfo": "OA 合約資訊", "alertHistory": "預警記錄", "alertRound": "第 {round} 次預警", "alertAudit": "預警發送記錄", "alertAuditEmpty": "暫無預警記錄", "alertNode": "付款節點", "alertScheduledAt": "計畫日期", "alertSentAt": "發送時間", "alertStatus": {"pending": "待發送", "sent": "已發送", "failed": "發送失敗"}, "roundValue": "第 {round} 次", "weeklyBatchesTitle": "週彙總批次", "weeklyBatchesSubtitle": "查看依收件人產生的付款預警週彙總、Excel 附件與發送記錄。", "weeklySend": "傳送預警", "weeklyBatchSubmitted": "發送預警任務已提交", "weeklyBatchesLoadFailed": "載入週彙總批次失敗", "batchNo": "批次號", "weekKey": "週次", "batchStatusLabel": "發送狀態", "batchTotal": "彙總筆數", "batchExcel": "Excel 附件", "batchSentAt": "發送時間", "weeklyBatchesEmpty": "暫無週彙總批次", "weeklyPendingSummary": "本週待發送 {count} 筆 · 下次發送 {datetime}", "weeklyPendingCountOnly": "本週待發送 {count} 筆", "downloadExcel": "下載 Excel", "excelDownloadFailed": "下載預警附件失敗", "batchStatus": {"pending": "待發送", "sent": "已發送", "failed": "發送失敗", "processing": "處理中", "resolved": "已停止提醒"}, "backToLedger": "返回", "detailLoadFailed": "載入合約詳情失敗", "detailLoading": "正在載入合約詳情…", "detailOverview": "合約概覽", "detailAttachments": "原文附件", "detailPaymentPlan": "付款計畫", "detailAlertHistory": "預警記錄", "archiveDate": "合約歸檔日期", "archiveDateHint": "該日期為合約申請單的歸檔日期", "parseStatus": "解析狀態", "parseIssueTitle": "解析提示", "planStatus": "計畫狀態", "attachmLine truncated
},
"contractPaymentReview": {"title": "待確認合約", "subtitle": "未符合設備採購合約同義標題組、付款比例驗證失敗或關鍵欄位衝突的合約,不會進入付款預警,請下載原文核對。", "searchPlaceholder": "合約編號、採購單號或供應商", "loadFailed": "待確認合約載入失敗", "contractWorkflow": "合約號 / 流程編號", "reason": "待確認原因", "fallbackIssue": "解析結果待人工確認", "empty": "暫無待確認合約"},
"contractPaymentReparse": {"action": "重新解析合約原文", "success": "已使用附件“{attachment}”重新解析", "failed": "重新解析合約失敗"},
@@ -10,6 +10,7 @@ export const AGENT_CODE_GENERIC = 'generic';
export const AGENT_CODE_SHIPPING_NOTICE = 'shipping_notice';
export const AGENT_CODE_FILE_CHECK = 'file_check';
export const AGENT_CODE_PROCUREMENT_CONTRACT_REVIEW = 'procurement_contract_review';
export const AGENT_CODE_CONTRACT_PAYMENT = 'contract_payment';
export const AGENT_CODE_IN_TRANSIT_TRANSFER = 'in_transit_transfer';
export interface AgentRegistryCapabilities {
@@ -237,6 +238,11 @@ export function isProcurementContractAgent(agent: AgentLike): boolean {
return resolveAgentCode(agent) === AGENT_CODE_PROCUREMENT_CONTRACT_REVIEW;
}
/** 是否为合同付款预警 Agent(agent_code=contract_payment)。 */
export function isContractPaymentAgent(agent: AgentLike): boolean {
return resolveAgentCode(agent) === AGENT_CODE_CONTRACT_PAYMENT;
}
/** 是否启用本地请假表单(后端 leave_feature_enabled)。 */
export function canUseLeaveFeature(agent: AgentLike): boolean {
return Boolean(agent?.leave_feature_enabled);
-1
View File
@@ -6,7 +6,6 @@
*/
export type FeaturePermissions = {
training_hr_manage?: boolean;
'contract_payment.access'?: boolean;
[key: string]: boolean | undefined;
};