feat(i18n): 将前端用户可见中文硬编码改为四语言
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
dce915ea30
commit
ac7b53a523
105 files changed
+2928
-647
No files matched your search
@@ -15,8 +15,7 @@ import type { ScheduleTask } from '@/shared/types/schedule.types';
|
||||
import type { AgentTypeCatalogEntry, IntentRouteOption } from '../composables/useAgentsAdminRegistry';
|
||||
import type { AdminContentProfileOption } from '@/features/admin/api/admin.api';
|
||||
import {
|
||||
DEFAULT_TRAINING_EMPLOYEE_CHAT_QUESTIONS,
|
||||
DEFAULT_TRAINING_HR_CHAT_QUESTIONS,
|
||||
getDefaultTrainingChatQuestions,
|
||||
} from '@/features/chat/training/trainingChatQuestions';
|
||||
import {
|
||||
applyCatalogDefaultsToForm,
|
||||
@@ -188,10 +187,10 @@ const handleTrainingWorkspaceToggle = () => {
|
||||
if (props.form.training_workspace_enabled) {
|
||||
props.form.content_profile = 'training';
|
||||
if (!props.form.training_employee_chat_questions_text.trim()) {
|
||||
props.form.training_employee_chat_questions_text = DEFAULT_TRAINING_EMPLOYEE_CHAT_QUESTIONS.join('\n');
|
||||
props.form.training_employee_chat_questions_text = getDefaultTrainingChatQuestions('employee').join('\n');
|
||||
}
|
||||
if (!props.form.training_hr_chat_questions_text.trim()) {
|
||||
props.form.training_hr_chat_questions_text = DEFAULT_TRAINING_HR_CHAT_QUESTIONS.join('\n');
|
||||
props.form.training_hr_chat_questions_text = getDefaultTrainingChatQuestions('hr').join('\n');
|
||||
}
|
||||
} else if (props.form.content_profile === 'training') {
|
||||
props.form.content_profile = '';
|
||||
@@ -305,10 +304,10 @@ const handleTrainingQuestionTypeChange = (form: AgentFormState, index: number) =
|
||||
|
||||
<template v-if="showDifyFields">
|
||||
<div class="space-y-2">
|
||||
<label class="text-xs font-bold text-muted uppercase tracking-wider">Dify应用类型</label>
|
||||
<label class="text-xs font-bold text-muted uppercase tracking-wider">{{ t('admin.agent.fields.difyAppType') }}</label>
|
||||
<select v-model="form.dify_app_type" class="w-full input-field text-sm">
|
||||
<option value="chatflow">Chatflow</option>
|
||||
<option value="workflow">Workflow</option>
|
||||
<option value="chatflow">{{ t('admin.agent.fields.difyAppTypes.chatflow') }}</option>
|
||||
<option value="workflow">{{ t('admin.agent.fields.difyAppTypes.workflow') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="space-y-2">
|
||||
@@ -565,30 +564,30 @@ const handleTrainingQuestionTypeChange = (form: AgentFormState, index: number) =
|
||||
|
||||
<div class="col-span-1 md:col-span-2 space-y-3">
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<label class="text-xs font-bold text-muted uppercase tracking-wider">常见问题</label>
|
||||
<label class="text-xs font-bold text-muted uppercase tracking-wider">{{ t('admin.agent.suggestedQuestions.title') }}</label>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex items-center gap-1 rounded-lg border border-default px-3 py-1.5 text-xs font-medium text-secondary transition-colors hover:bg-surface-soft"
|
||||
@click="emit('addSuggestedQuestion')"
|
||||
>
|
||||
<Plus class="h-4 w-4" />
|
||||
添加问题
|
||||
{{ t('admin.agent.suggestedQuestions.add') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-3 text-sm">
|
||||
<label class="inline-flex items-center gap-2 text-secondary">
|
||||
<input v-model="form.suggested_questions_style" type="radio" value="plain" class="accent-brand-600" />
|
||||
<span>无样式</span>
|
||||
<span>{{ t('admin.agent.suggestedQuestions.stylePlain') }}</span>
|
||||
</label>
|
||||
<label class="inline-flex items-center gap-2 text-secondary">
|
||||
<input v-model="form.suggested_questions_style" type="radio" value="styled" class="accent-brand-600" />
|
||||
<span>有样式</span>
|
||||
<span>{{ t('admin.agent.suggestedQuestions.styleStyled') }}</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div v-if="form.suggested_questions.length === 0" class="rounded-xl border border-dashed border-default px-4 py-5 text-sm text-muted">
|
||||
暂未配置常见问题,点击“添加问题”后会同步到对应 Agent 的 Chat 欢迎页。
|
||||
{{ t('admin.agent.suggestedQuestions.empty') }}
|
||||
</div>
|
||||
|
||||
<div v-else class="space-y-3">
|
||||
@@ -602,14 +601,16 @@ const handleTrainingQuestionTypeChange = (form: AgentFormState, index: number) =
|
||||
v-model="item.question"
|
||||
type="text"
|
||||
class="w-full input-field text-sm"
|
||||
placeholder="请输入常见问题,例如:查询我有多少假期?"
|
||||
:placeholder="t('admin.agent.suggestedQuestions.questionPlaceholder')"
|
||||
/>
|
||||
<input
|
||||
v-model="item.group"
|
||||
type="text"
|
||||
class="w-full input-field text-sm"
|
||||
:disabled="form.suggested_questions_style !== 'styled'"
|
||||
:placeholder="form.suggested_questions_style === 'styled' ? '可选:分组标题,例如:考勤与休假' : '无样式下无需分组'"
|
||||
:placeholder="form.suggested_questions_style === 'styled'
|
||||
? t('admin.agent.suggestedQuestions.groupPlaceholderStyled')
|
||||
: t('admin.agent.suggestedQuestions.groupPlaceholderPlain')"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -500,13 +500,13 @@ export function useAgentsAdmin() {
|
||||
payload.dify_api_key = form.value.dify_api_key;
|
||||
}
|
||||
await updateAdminAgent(form.value.id, payload);
|
||||
msg.success('应用更新成功');
|
||||
msg.success(t('admin.agent.updateSuccess'));
|
||||
} else {
|
||||
await createAdminAgent({
|
||||
...registryPayload,
|
||||
dify_api_key: form.value.dify_api_key,
|
||||
});
|
||||
msg.success('应用创建成功');
|
||||
msg.success(t('admin.agent.createSuccess'));
|
||||
}
|
||||
|
||||
await loadAgents();
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
/**
|
||||
* features/admin/modules/platform-apps/PlatformAppsPage.vue
|
||||
* 用途:平台应用说明(新手指南)管理——按 Agent 维护指南资料上传、启停与排序。
|
||||
* 依赖:admin.api 指南 CRUD/上传、vue-i18n、lucide 图标。
|
||||
* 逻辑:Admin 路由挂载;选择应用后拉取指南列表,弹窗内上传并保存元数据。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
@@ -29,6 +35,9 @@ const form = ref({
|
||||
const isUploading = ref(false);
|
||||
const uploadError = ref('');
|
||||
|
||||
/**
|
||||
* 拉取 Agent 列表并默认选中第一项,再加载其指南。
|
||||
*/
|
||||
const fetchAgents = async () => {
|
||||
try {
|
||||
agents.value = await listAdminAgents();
|
||||
@@ -41,6 +50,9 @@ const fetchAgents = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 按当前选中 Agent 拉取指南列表。
|
||||
*/
|
||||
const fetchGuides = async () => {
|
||||
if (!selectedAgentId.value) return;
|
||||
isLoading.value = true;
|
||||
@@ -62,6 +74,9 @@ onMounted(() => {
|
||||
fetchAgents();
|
||||
});
|
||||
|
||||
/**
|
||||
* 打开新建指南弹窗并重置表单。
|
||||
*/
|
||||
const openCreateModal = () => {
|
||||
isEditing.value = false;
|
||||
editingId.value = null;
|
||||
@@ -79,6 +94,10 @@ const openCreateModal = () => {
|
||||
isModalOpen.value = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 打开编辑指南弹窗并回填行数据。
|
||||
* @param guide - 列表行指南对象
|
||||
*/
|
||||
const openEditModal = (guide: any) => {
|
||||
isEditing.value = true;
|
||||
editingId.value = guide.id;
|
||||
@@ -96,6 +115,10 @@ const openEditModal = (guide: any) => {
|
||||
isModalOpen.value = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* 上传指南文件并回填 path/type/size;必要时校正 guide_usage 与文件类型一致性。
|
||||
* @param event - input file change 事件
|
||||
*/
|
||||
const handleFileUpload = async (event: Event) => {
|
||||
const file = (event.target as HTMLInputElement).files?.[0];
|
||||
if (!file) return;
|
||||
@@ -118,12 +141,15 @@ const handleFileUpload = async (event: Event) => {
|
||||
form.value.file_name = res.file_name;
|
||||
}
|
||||
} catch (err: any) {
|
||||
uploadError.value = err.message || '上传失败';
|
||||
uploadError.value = err.message || t('admin.platformApps.uploadFailed');
|
||||
} finally {
|
||||
isUploading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 提交新建或更新指南元数据。
|
||||
*/
|
||||
const submitForm = async () => {
|
||||
if (!selectedAgentId.value || !form.value.file_path || !form.value.file_name) return;
|
||||
|
||||
@@ -143,8 +169,12 @@ const submitForm = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 确认后删除指南。
|
||||
* @param id - 指南主键
|
||||
*/
|
||||
const deleteGuide = async (id: number) => {
|
||||
if (!confirm('确定要删除该指南吗?删除后不可恢复。')) return;
|
||||
if (!confirm(t('admin.platformApps.confirmDelete'))) return;
|
||||
try {
|
||||
await deleteAdminAgentGuide(id);
|
||||
await fetchGuides();
|
||||
@@ -153,6 +183,10 @@ const deleteGuide = async (id: number) => {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 切换指南启停状态。
|
||||
* @param guide - 列表行指南对象
|
||||
*/
|
||||
const toggleStatus = async (guide: any) => {
|
||||
try {
|
||||
await updateAdminAgentGuide(guide.id, { status: guide.status === 1 ? 0 : 1 });
|
||||
@@ -162,6 +196,11 @@ const toggleStatus = async (guide: any) => {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 将字节数格式化为可读文件大小。
|
||||
* @param bytes - 文件字节数
|
||||
* @returns 如 `1.2 MB`
|
||||
*/
|
||||
const formatSize = (bytes: number) => {
|
||||
if (!bytes) return '0 B';
|
||||
const k = 1024;
|
||||
@@ -170,6 +209,10 @@ const formatSize = (bytes: number) => {
|
||||
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
|
||||
};
|
||||
|
||||
/**
|
||||
* 按文件类型返回列表图标组件。
|
||||
* @param type - 文件类型(video/pdf/其它)
|
||||
*/
|
||||
const getIcon = (type: string) => {
|
||||
if (type === 'video') return Play;
|
||||
if (type === 'pdf') return FileText;
|
||||
@@ -185,7 +228,7 @@ const getIcon = (type: string) => {
|
||||
{{ t('admin.nav.platformApps') }}
|
||||
</h2>
|
||||
<p class="text-sm text-muted mt-1">
|
||||
管理应用的新手指南资料(支持视频、PDF等)
|
||||
{{ t('admin.platformApps.subtitle') }}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -193,7 +236,7 @@ const getIcon = (type: string) => {
|
||||
<div class="surface-panel rounded-2xl p-6 shadow-sm border border-subtle flex-1 flex flex-col gap-6">
|
||||
<div class="flex items-center justify-between">
|
||||
<div class="flex items-center gap-4">
|
||||
<label class="font-medium text-sm text-default">选择应用:</label>
|
||||
<label class="font-medium text-sm text-default">{{ t('admin.platformApps.selectAgent') }}</label>
|
||||
<select v-model="selectedAgentId" class="input-field w-64" @change="fetchGuides">
|
||||
<option v-for="agent in agents" :key="agent.id" :value="agent.id">
|
||||
{{ agent.name }}
|
||||
@@ -202,7 +245,7 @@ const getIcon = (type: string) => {
|
||||
</div>
|
||||
<button v-if="selectedAgentId" type="button" class="btn-primary" @click="openCreateModal">
|
||||
<Plus class="w-5 h-5 mr-1" />
|
||||
<span>添加指南</span>
|
||||
<span>{{ t('admin.platformApps.addGuide') }}</span>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -211,25 +254,25 @@ const getIcon = (type: string) => {
|
||||
</div>
|
||||
|
||||
<div v-else-if="!selectedAgentId" class="flex flex-col items-center justify-center py-20 text-muted">
|
||||
请先选择一个应用
|
||||
{{ t('admin.platformApps.selectAgentFirst') }}
|
||||
</div>
|
||||
|
||||
<div v-else-if="guides.length === 0" class="flex flex-col items-center justify-center py-20 text-muted">
|
||||
该应用暂无新手指南资料
|
||||
{{ t('admin.platformApps.emptyGuides') }}
|
||||
</div>
|
||||
|
||||
<div v-else class="overflow-x-auto rounded-xl border border-subtle">
|
||||
<table class="w-full text-left text-sm whitespace-nowrap">
|
||||
<thead class="bg-muted text-muted uppercase text-xs font-semibold tracking-wider border-b border-subtle">
|
||||
<tr>
|
||||
<th class="px-6 py-4">类型</th>
|
||||
<th class="px-6 py-4">资料名称</th>
|
||||
<th class="px-6 py-4">{{ t('admin.platformApps.colType') }}</th>
|
||||
<th class="px-6 py-4">{{ t('admin.platformApps.colFileName') }}</th>
|
||||
<th class="px-6 py-4">{{ t('admin.platformApps.guideUsage') }}</th>
|
||||
<th class="px-6 py-4">Agent应用</th>
|
||||
<th class="px-6 py-4">文件大小</th>
|
||||
<th class="px-6 py-4">排序</th>
|
||||
<th class="px-6 py-4">状态</th>
|
||||
<th class="px-6 py-4 text-right">操作</th>
|
||||
<th class="px-6 py-4">{{ t('admin.platformApps.colAgent') }}</th>
|
||||
<th class="px-6 py-4">{{ t('admin.platformApps.colFileSize') }}</th>
|
||||
<th class="px-6 py-4">{{ t('admin.platformApps.colSort') }}</th>
|
||||
<th class="px-6 py-4">{{ t('admin.platformApps.colStatus') }}</th>
|
||||
<th class="px-6 py-4 text-right">{{ t('admin.platformApps.colActions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-subtle">
|
||||
@@ -259,14 +302,14 @@ const getIcon = (type: string) => {
|
||||
:class="guide.status === 1 ? 'bg-green-100 text-green-700 hover:bg-green-200' : 'bg-gray-100 text-gray-700 hover:bg-gray-200'"
|
||||
@click="toggleStatus(guide)"
|
||||
>
|
||||
{{ guide.status === 1 ? '已启用' : '已禁用' }}
|
||||
{{ guide.status === 1 ? t('admin.platformApps.statusEnabled') : t('admin.platformApps.statusDisabled') }}
|
||||
</button>
|
||||
</td>
|
||||
<td class="px-6 py-4 text-right space-x-2">
|
||||
<button type="button" class="btn-icon-ds" @click="openEditModal(guide)" title="编辑">
|
||||
<button type="button" class="btn-icon-ds" @click="openEditModal(guide)" :title="t('common.edit')">
|
||||
<Edit2 class="w-4 h-4" />
|
||||
</button>
|
||||
<button type="button" class="btn-icon-ds text-red-500 hover:bg-red-50" @click="deleteGuide(guide.id)" title="删除">
|
||||
<button type="button" class="btn-icon-ds text-red-500 hover:bg-red-50" @click="deleteGuide(guide.id)" :title="t('common.delete')">
|
||||
<Trash2 class="w-4 h-4" />
|
||||
</button>
|
||||
</td>
|
||||
@@ -280,13 +323,13 @@ const getIcon = (type: string) => {
|
||||
<div v-if="isModalOpen" class="fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm">
|
||||
<div class="bg-white dark:bg-gray-800 rounded-2xl shadow-xl w-full max-w-lg overflow-hidden flex flex-col max-h-[90vh]">
|
||||
<div class="px-6 py-4 border-b border-subtle flex justify-between items-center">
|
||||
<h3 class="text-lg font-bold text-default">{{ isEditing ? '编辑指南' : '添加指南' }}</h3>
|
||||
<h3 class="text-lg font-bold text-default">{{ isEditing ? t('admin.platformApps.editGuide') : t('admin.platformApps.addGuide') }}</h3>
|
||||
<button @click="isModalOpen = false" class="text-muted hover:text-default text-xl leading-none">×</button>
|
||||
</div>
|
||||
|
||||
<div class="p-6 overflow-y-auto space-y-4">
|
||||
<div v-if="!isEditing" class="space-y-2">
|
||||
<label class="text-sm font-medium text-default">上传文件</label>
|
||||
<label class="text-sm font-medium text-default">{{ t('admin.platformApps.uploadFile') }}</label>
|
||||
<input
|
||||
type="file"
|
||||
accept="video/mp4,video/webm,application/pdf,image/png,image/jpeg"
|
||||
@@ -294,20 +337,20 @@ const getIcon = (type: string) => {
|
||||
@change="handleFileUpload"
|
||||
/>
|
||||
<div v-if="isUploading" class="text-sm text-blue-600 mt-2 flex items-center gap-2">
|
||||
<div class="animate-spin rounded-full h-4 w-4 border-b-2 border-blue-600"></div> 上传中...
|
||||
<div class="animate-spin rounded-full h-4 w-4 border-b-2 border-blue-600"></div> {{ t('admin.platformApps.uploading') }}
|
||||
</div>
|
||||
<div v-if="uploadError" class="text-sm text-red-500 mt-2">{{ uploadError }}</div>
|
||||
<div v-if="form.file_path && !isUploading" class="text-sm text-green-600 mt-2">已上传文件就绪</div>
|
||||
<div v-if="form.file_path && !isUploading" class="text-sm text-green-600 mt-2">{{ t('admin.platformApps.uploadReady') }}</div>
|
||||
</div>
|
||||
|
||||
<div class="space-y-2">
|
||||
<label class="text-sm font-medium text-default">资料名称</label>
|
||||
<input v-model="form.file_name" type="text" class="input-field w-full" placeholder="如:人事助手使用手册" />
|
||||
<label class="text-sm font-medium text-default">{{ t('admin.platformApps.fileName') }}</label>
|
||||
<input v-model="form.file_name" type="text" class="input-field w-full" :placeholder="t('admin.platformApps.fileNamePlaceholder')" />
|
||||
</div>
|
||||
|
||||
<div class="space-y-2">
|
||||
<label class="text-sm font-medium text-default">备注说明</label>
|
||||
<textarea v-model="form.remark" class="input-field w-full h-20" placeholder="简要说明..."></textarea>
|
||||
<label class="text-sm font-medium text-default">{{ t('admin.platformApps.remark') }}</label>
|
||||
<textarea v-model="form.remark" class="input-field w-full h-20" :placeholder="t('admin.platformApps.remarkPlaceholder')"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
@@ -321,29 +364,29 @@ const getIcon = (type: string) => {
|
||||
<p class="text-xs text-muted">{{ t('admin.platformApps.guideUsageHint') }}</p>
|
||||
</div>
|
||||
<div class="space-y-2">
|
||||
<label class="text-sm font-medium text-default">排序权重</label>
|
||||
<label class="text-sm font-medium text-default">{{ t('admin.platformApps.sortOrder') }}</label>
|
||||
<input v-model.number="form.sort_order" type="number" class="input-field w-full" />
|
||||
<p class="text-xs text-muted">数值越小越靠前</p>
|
||||
<p class="text-xs text-muted">{{ t('admin.platformApps.sortOrderHint') }}</p>
|
||||
</div>
|
||||
<div class="space-y-2">
|
||||
<label class="text-sm font-medium text-default">状态</label>
|
||||
<label class="text-sm font-medium text-default">{{ t('admin.platformApps.status') }}</label>
|
||||
<select v-model="form.status" class="input-field w-full">
|
||||
<option :value="1">启用</option>
|
||||
<option :value="0">禁用</option>
|
||||
<option :value="1">{{ t('admin.platformApps.enable') }}</option>
|
||||
<option :value="0">{{ t('admin.platformApps.disable') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="px-6 py-4 border-t border-subtle bg-muted flex justify-end gap-3">
|
||||
<button type="button" class="btn-secondary" @click="isModalOpen = false">取消</button>
|
||||
<button type="button" class="btn-secondary" @click="isModalOpen = false">{{ t('admin.cancel') }}</button>
|
||||
<button
|
||||
type="button"
|
||||
class="btn-primary"
|
||||
@click="submitForm"
|
||||
:disabled="isUploading || !form.file_path || !form.file_name"
|
||||
>
|
||||
保存
|
||||
{{ t('admin.platformApps.save') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+4
-11
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* features/admin/modules/procurement-contract/ProcurementContractPage.vue
|
||||
* 用途:采购合同审查管理——模板库 / 风险规则 / 审查历史(Tab),含鉴权下载。
|
||||
* 依赖:procurement-contract.api、ContractRiskRulesPanel、DeleteConfirmDialog、useMessage、vue-i18n。
|
||||
* 依赖:procurement-contract.api、contract-ocr-match-tokens、ContractRiskRulesPanel、DeleteConfirmDialog、useMessage、vue-i18n。
|
||||
* 逻辑:Admin 路由挂载;会话 Agent 读模板列表走 /api/procurement-contract。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
@@ -27,6 +27,7 @@ import {
|
||||
type ContractReviewRow,
|
||||
type ContractTemplateRow,
|
||||
} from '@/features/admin/api/procurement-contract.api';
|
||||
import { V4_REGION_CONFIG } from './contract-ocr-match-tokens';
|
||||
import ContractRiskRulesPanel from './components/ContractRiskRulesPanel.vue';
|
||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
@@ -44,7 +45,7 @@ const reviewTotal = ref(0);
|
||||
const showUpload = ref(false);
|
||||
const uploading = ref(false);
|
||||
const editingTemplate = ref<ContractTemplateRow | null>(null);
|
||||
const uploadName = ref('标准采购合同');
|
||||
const uploadName = ref(t('admin.procurementContract.defaultTemplateName'));
|
||||
const uploadVersion = ref('V1.0');
|
||||
const uploadStatus = ref<'enabled' | 'disabled'>('enabled');
|
||||
const uploadDefault = ref(false);
|
||||
@@ -89,14 +90,6 @@ const regionSignatureTerms = ref('');
|
||||
const regionAttachmentStart = ref('');
|
||||
let reviewFilterTimer: ReturnType<typeof setTimeout> | undefined;
|
||||
|
||||
const V4_REGION_CONFIG: ContractComparisonRegionConfig = {
|
||||
metadata_fields: ['contract_no', 'buyer', 'seller', 'version'],
|
||||
body_start_anchors: ['兹因甲方向乙方购买设备'],
|
||||
body_end_anchors: ['本合同一式两份', '以下无正文', '本页以下无正文'],
|
||||
signature_terms: ['甲方', '乙方', '盖章', '签署日期', '合同专用章'],
|
||||
attachment_start_anchors: ['附件', '性能需求表', '技术协议', '设备配置清单'],
|
||||
attachment_policy: 'page_count_only',
|
||||
};
|
||||
const metadataFieldOptions: ContractMetadataField[] = ['contract_no', 'buyer', 'seller', 'version'];
|
||||
|
||||
/**
|
||||
@@ -172,7 +165,7 @@ async function switchTab(next: 'templates' | 'rules' | 'reviews'): Promise<void>
|
||||
*/
|
||||
function resetUploadForm(): void {
|
||||
editingTemplate.value = null;
|
||||
uploadName.value = '标准采购合同';
|
||||
uploadName.value = t('admin.procurementContract.defaultTemplateName');
|
||||
uploadVersion.value = 'V1.0';
|
||||
uploadStatus.value = 'enabled';
|
||||
uploadDefault.value = false;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* features/admin/modules/procurement-contract/contract-ocr-match-tokens.ts
|
||||
* 用途:采购合同比对区域的 V4 默认 OCR/正文匹配锚点与签章关键词(检测用 token,非 UI 文案)。
|
||||
* 依赖:procurement-contract.api 的 ContractComparisonRegionConfig 类型。
|
||||
* 逻辑:ProcurementContractPage「恢复 V4 默认配置」与新建区域配置时引用;勿当作 i18n 展示文案。
|
||||
*
|
||||
* NOTE: Strings below are OCR match tokens for Chinese contract PDFs. Keep them in Chinese
|
||||
* regardless of UI locale so region recognition against Chinese source documents still works.
|
||||
*/
|
||||
import type { ContractComparisonRegionConfig } from '@/features/admin/api/procurement-contract.api';
|
||||
|
||||
/** V4 默认比对区域配置(锚点/关键词为中文 OCR 匹配 token)。 */
|
||||
export const V4_REGION_CONFIG: ContractComparisonRegionConfig = {
|
||||
metadata_fields: ['contract_no', 'buyer', 'seller', 'version'],
|
||||
body_start_anchors: ['兹因甲方向乙方购买设备'],
|
||||
body_end_anchors: ['本合同一式两份', '以下无正文', '本页以下无正文'],
|
||||
signature_terms: ['甲方', '乙方', '盖章', '签署日期', '合同专用章'],
|
||||
attachment_start_anchors: ['附件', '性能需求表', '技术协议', '设备配置清单'],
|
||||
attachment_policy: 'page_count_only',
|
||||
};
|
||||
Reference in new issue
Block a user