feat(contract): 采购合同对比agent
Signed-off-by: sophie <sophie> Signed-off-by: sophie <sophie>
This commit is contained in:
1 parent
ffccf19ba2
commit
0503ff76a6
90 files changed
+16729
-1344
No files matched your search
@@ -0,0 +1,406 @@
|
||||
/**
|
||||
* features/admin/api/procurement-contract.api.ts
|
||||
* 用途:采购合同审查 Admin / 会话 API 封装(含鉴权下载)。
|
||||
* 依赖:shared/api/client requestJson、auth headers。
|
||||
* 逻辑:Templates / Reviews 页面与 Chat 控件调用;下载走 fetch+blob。
|
||||
*/
|
||||
import { requestJson } from '@/shared/api/client';
|
||||
import { getAuthHeaders } from '@/shared/utils/auth';
|
||||
|
||||
export type ContractMetadataField = 'title' | 'version' | 'contract_no' | 'buyer' | 'seller';
|
||||
|
||||
export interface ContractComparisonRegionConfig {
|
||||
metadata_fields: ContractMetadataField[];
|
||||
body_start_anchors: string[];
|
||||
body_end_anchors: string[];
|
||||
signature_terms: string[];
|
||||
attachment_start_anchors: string[];
|
||||
attachment_policy: 'page_count_only';
|
||||
}
|
||||
|
||||
export interface ContractComparisonRegionPreview {
|
||||
status: 'recognized' | 'incomplete' | string;
|
||||
body_start_anchor?: string | null;
|
||||
body_end_anchor?: string | null;
|
||||
signature_terms_found?: string[];
|
||||
attachment_anchor?: string | null;
|
||||
warning?: string | null;
|
||||
}
|
||||
|
||||
export interface ContractTemplateRow {
|
||||
id: number;
|
||||
name: string;
|
||||
version: string;
|
||||
file_name: string;
|
||||
file_asset_id?: number | null;
|
||||
contract_type?: string;
|
||||
applicable_scope?: string | null;
|
||||
change_note?: string | null;
|
||||
comparison_region_config?: ContractComparisonRegionConfig | null;
|
||||
status: 'enabled' | 'disabled' | string;
|
||||
is_default: boolean;
|
||||
remark?: string | null;
|
||||
updated_by_name?: string | null;
|
||||
created_at?: string | null;
|
||||
updated_at?: string | null;
|
||||
}
|
||||
|
||||
export interface ContractClauseItem {
|
||||
clause_no?: string;
|
||||
title?: string;
|
||||
change_type?: string;
|
||||
/** 后端语义分类:仅 obligation 会参与法律与履约风险统计。 */
|
||||
change_class?: 'format' | 'metadata' | 'commercial' | 'obligation' | string;
|
||||
risk_level?: string;
|
||||
clause_category?: string;
|
||||
detail?: string;
|
||||
risk_hint?: string;
|
||||
suggestion?: string;
|
||||
negotiation_text?: string;
|
||||
old_text?: string;
|
||||
new_text?: string;
|
||||
/** 后端标记:old/new 是否为可读抽取片段;false 时前端展示编码不兼容提示 */
|
||||
comparison_readable?: boolean;
|
||||
llm_enabled?: boolean;
|
||||
llm_confidence?: number | null;
|
||||
llm_reason?: string;
|
||||
llm_suggestion?: string;
|
||||
llm_negotiation_text?: string;
|
||||
llm_model_risk_level?: string;
|
||||
llm_decision?: 'confirm' | 'reject' | 'uncertain' | string;
|
||||
llm_evidence?: string;
|
||||
evidence?: string;
|
||||
source?: string;
|
||||
validation_status?: 'confirmed' | 'needs_review' | string;
|
||||
/** 同一业务主题下聚合的底层 OCR 不确定片段数。 */
|
||||
affected_fragments?: number;
|
||||
business_impact?: string;
|
||||
anchor_status?: 'anchored' | 'unanchored' | string;
|
||||
evidence_anchor?: {
|
||||
page_no?: number;
|
||||
rects?: number[][];
|
||||
matched_text?: string;
|
||||
source_text?: string;
|
||||
confidence?: number;
|
||||
method?: 'exact' | 'fuzzy' | 'ocr_page' | string;
|
||||
} | null;
|
||||
}
|
||||
|
||||
export interface ContractRiskRuleRow {
|
||||
id: number;
|
||||
code: string;
|
||||
/** 内置规则携带组合业务判断;自定义规则仅执行关键词命中判断。 */
|
||||
rule_kind?: 'builtin' | 'custom' | string;
|
||||
contract_type: string;
|
||||
clause_category: string;
|
||||
title: string;
|
||||
keywords: string[];
|
||||
trigger_type: 'keyword_missing' | 'keyword_present' | string;
|
||||
risk_level: 'high' | 'medium' | 'low' | string;
|
||||
risk_hint: string;
|
||||
suggestion: string;
|
||||
negotiation_text?: string | null;
|
||||
status: 'enabled' | 'disabled' | string;
|
||||
sort_order: number;
|
||||
created_at?: string | null;
|
||||
updated_at?: string | null;
|
||||
}
|
||||
|
||||
export interface ContractReviewRow {
|
||||
id: number;
|
||||
review_no: string;
|
||||
review_mode: 'compare' | 'solo' | string;
|
||||
status: string;
|
||||
contract_file_name: string;
|
||||
supplier_name?: string | null;
|
||||
/** 从合同正文抽取的业务合同编号(非审查编号) */
|
||||
contract_no?: string | null;
|
||||
contract_type?: string;
|
||||
template_id?: number | null;
|
||||
template_source: string;
|
||||
template_name?: string | null;
|
||||
total_change_count?: number;
|
||||
high_risk_count: number;
|
||||
medium_risk_count: number;
|
||||
low_risk_count: number;
|
||||
user_id: number;
|
||||
user_name?: string | null;
|
||||
error_message?: string | null;
|
||||
started_at?: string | null;
|
||||
finished_at?: string | null;
|
||||
created_at?: string | null;
|
||||
progress?: number;
|
||||
processing_stage?: string | null;
|
||||
processing_message?: string | null;
|
||||
summary_json?: Record<string, unknown> | null;
|
||||
clauses_json?: ContractClauseItem[] | null;
|
||||
report_text?: string | null;
|
||||
template_asset_id?: number | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 鉴权下载:fetch blob → 触发浏览器保存。
|
||||
* @param url - 需携带 JWT 的下载 URL
|
||||
* @param fallbackName - Content-Disposition 缺失时的文件名
|
||||
*/
|
||||
async function downloadAuthenticatedFile(url: string, fallbackName: string): Promise<void> {
|
||||
const res = await fetch(url, { headers: getAuthHeaders() });
|
||||
if (!res.ok) {
|
||||
const body = await res.json().catch(() => ({}));
|
||||
const err = body as { error?: { message?: string }; message?: string };
|
||||
throw new Error(err?.error?.message || err?.message || res.statusText);
|
||||
}
|
||||
const disposition = res.headers.get('content-disposition');
|
||||
const blob = await res.blob();
|
||||
const objectUrl = URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = objectUrl;
|
||||
const rawName = disposition?.match(/filename\*?=(?:UTF-8'')?["']?([^;"'\n]+)/)?.[1] || fallbackName;
|
||||
try {
|
||||
a.download = decodeURIComponent(rawName);
|
||||
} catch {
|
||||
a.download = rawName;
|
||||
}
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
URL.revokeObjectURL(objectUrl);
|
||||
}
|
||||
|
||||
/** Admin:下载模板文件 */
|
||||
export function downloadAdminContractTemplate(templateId: number): Promise<void> {
|
||||
return downloadAuthenticatedFile(
|
||||
`/api/admin/procurement-contract/templates/${templateId}/file`,
|
||||
`template-${templateId}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Admin:下载审查报告。
|
||||
* @param reviewId - 审查主键
|
||||
* @param reviewNo - 审查编号(文件名用)
|
||||
* @param format - 默认 docx;传 txt 可下载纯文本
|
||||
*/
|
||||
export function downloadAdminContractReviewReport(
|
||||
reviewId: number,
|
||||
reviewNo?: string,
|
||||
format: 'txt' | 'docx' = 'docx',
|
||||
): Promise<void> {
|
||||
const q = format === 'docx' ? '?format=docx' : '';
|
||||
return downloadAuthenticatedFile(
|
||||
`/api/admin/procurement-contract/reviews/${reviewId}/report${q}`,
|
||||
`${reviewNo || reviewId}_report.${format === 'docx' ? 'docx' : 'txt'}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** Admin:下载待审合同 */
|
||||
export function downloadAdminContractReviewContract(reviewId: number, fileName?: string): Promise<void> {
|
||||
return downloadAuthenticatedFile(
|
||||
`/api/admin/procurement-contract/reviews/${reviewId}/contract`,
|
||||
fileName || `contract-${reviewId}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** Admin:下载带风险高亮批注的合同 PDF 副本 */
|
||||
export function downloadAdminAnnotatedContract(reviewId: number, reviewNo?: string): Promise<void> {
|
||||
return downloadAuthenticatedFile(
|
||||
`/api/admin/procurement-contract/reviews/${reviewId}/annotated-contract`,
|
||||
`${reviewNo || reviewId}_annotated.pdf`,
|
||||
);
|
||||
}
|
||||
|
||||
/** Admin:下载本次审查所用模板文件 */
|
||||
export function downloadAdminContractReviewTemplateFile(reviewId: number): Promise<void> {
|
||||
return downloadAuthenticatedFile(
|
||||
`/api/admin/procurement-contract/reviews/${reviewId}/template-file`,
|
||||
`template-for-review-${reviewId}`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Chat:下载本人审查报告。
|
||||
* @param reviewNo - 审查编号
|
||||
* @param format - 默认 docx;传 txt 可下载纯文本
|
||||
*/
|
||||
export function downloadChatContractReviewReport(
|
||||
reviewNo: string,
|
||||
format: 'txt' | 'docx' = 'docx',
|
||||
): Promise<void> {
|
||||
const q = format === 'docx' ? '?format=docx' : '';
|
||||
return downloadAuthenticatedFile(
|
||||
`/api/procurement-contract/reviews/${encodeURIComponent(reviewNo)}/report${q}`,
|
||||
`${reviewNo}_report.${format === 'docx' ? 'docx' : 'txt'}`,
|
||||
);
|
||||
}
|
||||
|
||||
/** Chat:下载本人带风险高亮批注的合同 PDF */
|
||||
export function downloadChatAnnotatedContract(reviewNo: string): Promise<void> {
|
||||
return downloadAuthenticatedFile(
|
||||
`/api/procurement-contract/reviews/${encodeURIComponent(reviewNo)}/annotated-contract`,
|
||||
`${reviewNo}_annotated.pdf`,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理端模板列表。
|
||||
*/
|
||||
export async function listAdminContractTemplates(status?: string): Promise<ContractTemplateRow[]> {
|
||||
const q = status ? `?status=${encodeURIComponent(status)}` : '';
|
||||
return requestJson<ContractTemplateRow[]>(`/api/admin/procurement-contract/templates${q}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传并创建模板(multipart)。
|
||||
*/
|
||||
export async function createAdminContractTemplate(form: FormData): Promise<ContractTemplateRow> {
|
||||
const res = await fetch('/api/admin/procurement-contract/templates', {
|
||||
method: 'POST',
|
||||
headers: getAuthHeaders(),
|
||||
body: form,
|
||||
});
|
||||
const body = await res.json();
|
||||
if (!res.ok || body?.success === false) {
|
||||
throw new Error(body?.error?.message || body?.message || 'upload failed');
|
||||
}
|
||||
return (body?.data ?? body) as ContractTemplateRow;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新模板。
|
||||
*/
|
||||
export async function updateAdminContractTemplate(
|
||||
id: number,
|
||||
data: Partial<Pick<ContractTemplateRow, 'name' | 'version' | 'status' | 'is_default' | 'remark' | 'contract_type' | 'applicable_scope' | 'change_note' | 'comparison_region_config'>>,
|
||||
): Promise<ContractTemplateRow> {
|
||||
return requestJson<ContractTemplateRow>(`/api/admin/procurement-contract/templates/${id}`, {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
}
|
||||
|
||||
/** Admin: preview unsaved region anchors against the stored template file. */
|
||||
export async function previewAdminContractTemplateRegions(
|
||||
id: number,
|
||||
comparisonRegionConfig: ContractComparisonRegionConfig,
|
||||
): Promise<ContractComparisonRegionPreview> {
|
||||
return requestJson<ContractComparisonRegionPreview>(
|
||||
`/api/admin/procurement-contract/templates/${id}/comparison-region-preview`,
|
||||
{
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ comparison_region_config: comparisonRegionConfig }),
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除模板。
|
||||
*/
|
||||
export async function deleteAdminContractTemplate(id: number): Promise<void> {
|
||||
await requestJson(`/api/admin/procurement-contract/templates/${id}`, { method: 'DELETE' });
|
||||
}
|
||||
|
||||
/**
|
||||
* 审查历史列表。
|
||||
*/
|
||||
export async function listAdminContractReviews(params?: {
|
||||
review_mode?: string;
|
||||
template_source?: string;
|
||||
status?: string;
|
||||
keyword?: string;
|
||||
contract_type?: string;
|
||||
supplier_name?: string;
|
||||
risk_level?: string;
|
||||
date_from?: string;
|
||||
date_to?: string;
|
||||
}): Promise<{ total: number; items: ContractReviewRow[] }> {
|
||||
const sp = new URLSearchParams();
|
||||
if (params?.review_mode) sp.set('review_mode', params.review_mode);
|
||||
if (params?.template_source) sp.set('template_source', params.template_source);
|
||||
if (params?.status) sp.set('status', params.status);
|
||||
if (params?.keyword) sp.set('keyword', params.keyword);
|
||||
if (params?.contract_type) sp.set('contract_type', params.contract_type);
|
||||
if (params?.supplier_name) sp.set('supplier_name', params.supplier_name);
|
||||
if (params?.risk_level) sp.set('risk_level', params.risk_level);
|
||||
if (params?.date_from) sp.set('date_from', params.date_from);
|
||||
if (params?.date_to) sp.set('date_to', params.date_to);
|
||||
const q = sp.toString() ? `?${sp.toString()}` : '';
|
||||
return requestJson(`/api/admin/procurement-contract/reviews${q}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 审查详情。
|
||||
*/
|
||||
export async function getAdminContractReview(id: number): Promise<ContractReviewRow> {
|
||||
return requestJson(`/api/admin/procurement-contract/reviews/${id}`);
|
||||
}
|
||||
|
||||
/** Admin:风险规则列表 */
|
||||
export async function listAdminContractRiskRules(params?: {
|
||||
contract_type?: string;
|
||||
status?: string;
|
||||
clause_category?: string;
|
||||
}): Promise<ContractRiskRuleRow[]> {
|
||||
const sp = new URLSearchParams();
|
||||
if (params?.contract_type) sp.set('contract_type', params.contract_type);
|
||||
if (params?.status) sp.set('status', params.status);
|
||||
if (params?.clause_category) sp.set('clause_category', params.clause_category);
|
||||
const q = sp.toString() ? `?${sp.toString()}` : '';
|
||||
return requestJson(`/api/admin/procurement-contract/rules${q}`);
|
||||
}
|
||||
|
||||
/** Admin:创建风险规则 */
|
||||
export async function createAdminContractRiskRule(
|
||||
data: Omit<Partial<ContractRiskRuleRow>, 'id'>,
|
||||
): Promise<ContractRiskRuleRow> {
|
||||
return requestJson('/api/admin/procurement-contract/rules', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
}
|
||||
|
||||
/** Admin:更新风险规则 */
|
||||
export async function updateAdminContractRiskRule(
|
||||
id: number,
|
||||
data: Partial<ContractRiskRuleRow>,
|
||||
): Promise<ContractRiskRuleRow> {
|
||||
return requestJson(`/api/admin/procurement-contract/rules/${id}`, {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
}
|
||||
|
||||
/** Admin:删除风险规则 */
|
||||
export async function deleteAdminContractRiskRule(id: number): Promise<void> {
|
||||
await requestJson(`/api/admin/procurement-contract/rules/${id}`, { method: 'DELETE' });
|
||||
}
|
||||
|
||||
/** 会话:启用模板列表 */
|
||||
export async function listChatContractTemplates(): Promise<ContractTemplateRow[]> {
|
||||
return requestJson('/api/procurement-contract/templates');
|
||||
}
|
||||
|
||||
/** 会话:发起审查 */
|
||||
export async function startChatContractReview(payload: {
|
||||
review_mode: 'compare' | 'solo';
|
||||
contract_asset_no: string;
|
||||
/** 模板比对时必填:用户上传的我方原合同资产编号。 */
|
||||
original_contract_asset_no?: string | null;
|
||||
contract_type?: string | null;
|
||||
supplier_name?: string | null;
|
||||
agent_id?: number | null;
|
||||
}): Promise<ContractReviewRow> {
|
||||
return requestJson('/api/procurement-contract/reviews', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(payload),
|
||||
});
|
||||
}
|
||||
|
||||
/** 会话:轮询本人合同审查详情 */
|
||||
export async function getChatContractReview(reviewNo: string): Promise<ContractReviewRow> {
|
||||
return requestJson(`/api/procurement-contract/reviews/${encodeURIComponent(reviewNo)}`);
|
||||
}
|
||||
@@ -10,7 +10,8 @@ import { useI18n } from 'vue-i18n';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import {
|
||||
LayoutDashboard, UserPlus, UserCog, Building, Bot, FileText,
|
||||
Settings2, Megaphone, MessageCircleQuestion, Link2, Users, ShieldCheck, BarChart2, AppWindow
|
||||
Settings2, Megaphone, MessageCircleQuestion, Link2, Users, ShieldCheck, BarChart2, AppWindow,
|
||||
ScrollText,
|
||||
} from 'lucide-vue-next';
|
||||
import type { Component } from 'vue';
|
||||
import { config } from '@/config';
|
||||
@@ -36,6 +37,7 @@ const iconMap: Record<AdminModuleId, Component> = {
|
||||
wecom: Link2,
|
||||
permissions: Users,
|
||||
platform_apps: AppWindow,
|
||||
procurement_contract: ScrollText,
|
||||
requests: ShieldCheck,
|
||||
reports: BarChart2,
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@ export interface AdminModuleMeta {
|
||||
|
||||
/** 已独立拆分的模块(全部 admin 模块均已拆分) */
|
||||
export const STANDALONE_ADMIN_MODULES = new Set<AdminModuleId>([
|
||||
'dashboard', 'agents', 'users', 'departments', 'approvals', 'announcements', 'questions', 'requests', 'permissions', 'schedules', 'knowledge_base', 'wecom', 'platform_apps', 'reports',
|
||||
'dashboard', 'agents', 'users', 'departments', 'approvals', 'announcements', 'questions', 'requests', 'permissions', 'schedules', 'knowledge_base', 'wecom', 'platform_apps', 'procurement_contract', 'reports',
|
||||
]);
|
||||
|
||||
export const ADMIN_MODULE_METAS: AdminModuleMeta[] = [
|
||||
@@ -31,6 +31,7 @@ export const ADMIN_MODULE_METAS: AdminModuleMeta[] = [
|
||||
{ id: 'wecom', routeName: 'AdminWecom', path: 'wecom', labelKey: 'admin.nav.wecom', configKey: 'wecom' },
|
||||
{ id: 'permissions', routeName: 'AdminPermissions', path: 'permissions', labelKey: 'admin.nav.permissions', configKey: 'permissions' },
|
||||
{ id: 'platform_apps', routeName: 'AdminPlatformApps', path: 'platform-apps', labelKey: 'admin.nav.platformApps', configKey: 'platform_apps' },
|
||||
{ id: 'procurement_contract', routeName: 'AdminProcurementContract', path: 'procurement-contract', labelKey: 'admin.nav.procurementContract', configKey: 'procurement_contract' },
|
||||
{ id: 'requests', routeName: 'AdminRequests', path: 'requests', labelKey: 'admin.nav.requests', configKey: 'requests' },
|
||||
];
|
||||
|
||||
|
||||
+1073
File diff suppressed because it is too large.
Load diff
+590
@@ -0,0 +1,590 @@
|
||||
/**
|
||||
* features/admin/modules/procurement-contract/components/ContractRiskRulesPanel.vue
|
||||
* 用途:采购合同风险红线规则列表与新增/编辑(含迁移种子默认规则)。
|
||||
* 依赖:procurement-contract.api、DeleteConfirmDialog、useMessage、vue-i18n。
|
||||
* 逻辑:由 ProcurementContractPage「风险规则」Tab 挂载;CRUD 走 Admin rules API。
|
||||
*/
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
import { CircleHelp, Plus, ShieldAlert, ShieldCheck, SlidersHorizontal } from 'lucide-vue-next';
|
||||
import {
|
||||
createAdminContractRiskRule,
|
||||
deleteAdminContractRiskRule,
|
||||
listAdminContractRiskRules,
|
||||
updateAdminContractRiskRule,
|
||||
type ContractRiskRuleRow,
|
||||
} from '@/features/admin/api/procurement-contract.api';
|
||||
import DeleteConfirmDialog from '@/shared/components/DeleteConfirmDialog.vue';
|
||||
import { useMessage } from '@/shared/composables/useMessage';
|
||||
|
||||
const { t } = useI18n();
|
||||
const msg = useMessage();
|
||||
|
||||
const loading = ref(false);
|
||||
const saving = ref(false);
|
||||
const rules = ref<ContractRiskRuleRow[]>([]);
|
||||
const filterStatus = ref('');
|
||||
|
||||
const showForm = ref(false);
|
||||
const editing = ref<ContractRiskRuleRow | null>(null);
|
||||
const formTitle = ref('');
|
||||
const formCategory = ref('');
|
||||
const formKeywords = ref('');
|
||||
const formTriggerType = ref<'keyword_missing' | 'keyword_present'>('keyword_missing');
|
||||
const formRiskLevel = ref<'high' | 'medium' | 'low'>('medium');
|
||||
const formRiskHint = ref('');
|
||||
const formSuggestion = ref('');
|
||||
const formNegotiation = ref('');
|
||||
const formStatus = ref<'enabled' | 'disabled'>('enabled');
|
||||
const formSortOrder = ref(100);
|
||||
|
||||
const clauseCategories = [
|
||||
'payment',
|
||||
'delivery',
|
||||
'acceptance',
|
||||
'warranty',
|
||||
'liability',
|
||||
'jurisdiction',
|
||||
'dispute',
|
||||
'ip',
|
||||
'other',
|
||||
] as const;
|
||||
|
||||
const showDeleteConfirm = ref(false);
|
||||
const pendingDelete = ref<ContractRiskRuleRow | null>(null);
|
||||
const deleting = ref(false);
|
||||
|
||||
const isEditMode = computed(() => Boolean(editing.value));
|
||||
const formTitleText = computed(() =>
|
||||
isEditMode.value
|
||||
? t('admin.procurementContract.ruleEditTitle')
|
||||
: t('admin.procurementContract.ruleCreateTitle'),
|
||||
);
|
||||
|
||||
const isBuiltinRule = computed(() => editing.value?.rule_kind === 'builtin');
|
||||
|
||||
const keywordLogicHint = computed(() =>
|
||||
formTriggerType.value === 'keyword_present'
|
||||
? t('admin.procurementContract.keywordPresentLogicHint')
|
||||
: t('admin.procurementContract.keywordMissingLogicHint'),
|
||||
);
|
||||
const ruleStats = computed(() => ({
|
||||
total: rules.value.length,
|
||||
enabled: rules.value.filter((rule) => rule.status === 'enabled').length,
|
||||
highRisk: rules.value.filter((rule) => rule.risk_level === 'high').length,
|
||||
}));
|
||||
|
||||
/**
|
||||
* 生成风险规则统计卡片,帮助管理员先扫状态再进入列表维护。
|
||||
*/
|
||||
const ruleSummaryCards = computed(() => [
|
||||
{
|
||||
key: 'total',
|
||||
label: t('admin.procurementContract.ruleStatTotal'),
|
||||
value: ruleStats.value.total,
|
||||
icon: SlidersHorizontal,
|
||||
className: 'border-slate-200 bg-white text-slate-600',
|
||||
},
|
||||
{
|
||||
key: 'enabled',
|
||||
label: t('admin.procurementContract.ruleStatEnabled'),
|
||||
value: ruleStats.value.enabled,
|
||||
icon: ShieldCheck,
|
||||
className: 'border-emerald-100 bg-emerald-50/80 text-emerald-700',
|
||||
},
|
||||
{
|
||||
key: 'highRisk',
|
||||
label: t('admin.procurementContract.ruleStatHighRisk'),
|
||||
value: ruleStats.value.highRisk,
|
||||
icon: ShieldAlert,
|
||||
className: 'border-rose-100 bg-rose-50/80 text-rose-700',
|
||||
},
|
||||
]);
|
||||
|
||||
/**
|
||||
* 加载风险规则列表。
|
||||
* @param options.silent - 为 true 时不切换 loading,避免启停时整表闪烁
|
||||
*/
|
||||
async function loadRules(options?: { silent?: boolean }): Promise<void> {
|
||||
const silent = Boolean(options?.silent);
|
||||
if (!silent) loading.value = true;
|
||||
try {
|
||||
rules.value = await listAdminContractRiskRules({
|
||||
status: filterStatus.value || undefined,
|
||||
});
|
||||
} catch (e: unknown) {
|
||||
console.error(e);
|
||||
msg.error(e instanceof Error ? e.message : t('admin.procurementContract.loadFailed'));
|
||||
} finally {
|
||||
if (!silent) loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 响应筛选条件变更并刷新规则列表。
|
||||
*/
|
||||
async function onFilterStatusChange(): Promise<void> {
|
||||
await loadRules();
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
void loadRules();
|
||||
});
|
||||
|
||||
/**
|
||||
* 重置规则表单为新建默认值。
|
||||
*/
|
||||
function resetForm(): void {
|
||||
editing.value = null;
|
||||
formTitle.value = '';
|
||||
formCategory.value = 'payment';
|
||||
formKeywords.value = '';
|
||||
formTriggerType.value = 'keyword_missing';
|
||||
formRiskLevel.value = 'medium';
|
||||
formRiskHint.value = '';
|
||||
formSuggestion.value = '';
|
||||
formNegotiation.value = '';
|
||||
formStatus.value = 'enabled';
|
||||
formSortOrder.value = 100;
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开新建规则弹窗。
|
||||
*/
|
||||
function openCreate(): void {
|
||||
resetForm();
|
||||
showForm.value = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开编辑规则弹窗(种子规则也可改,code 只读)。
|
||||
*/
|
||||
function openEdit(row: ContractRiskRuleRow): void {
|
||||
editing.value = row;
|
||||
formTitle.value = row.title;
|
||||
formCategory.value = row.clause_category;
|
||||
formKeywords.value = (row.keywords || []).join(',');
|
||||
formTriggerType.value = row.trigger_type === 'keyword_present' ? 'keyword_present' : 'keyword_missing';
|
||||
formRiskLevel.value =
|
||||
row.risk_level === 'high' || row.risk_level === 'low' ? row.risk_level : 'medium';
|
||||
formRiskHint.value = row.risk_hint || '';
|
||||
formSuggestion.value = row.suggestion || '';
|
||||
formNegotiation.value = row.negotiation_text || '';
|
||||
formStatus.value = row.status === 'disabled' ? 'disabled' : 'enabled';
|
||||
formSortOrder.value = Number(row.sort_order) || 100;
|
||||
showForm.value = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭规则表单。
|
||||
*/
|
||||
function closeForm(): void {
|
||||
showForm.value = false;
|
||||
editing.value = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交新建或更新规则。
|
||||
*/
|
||||
async function submitForm(): Promise<void> {
|
||||
if (!formTitle.value.trim() || !formCategory.value.trim()) {
|
||||
msg.error(t('admin.procurementContract.ruleRequiredFields'));
|
||||
return;
|
||||
}
|
||||
if (!formKeywords.value.trim()) {
|
||||
msg.error(t('admin.procurementContract.ruleKeywordsRequired'));
|
||||
return;
|
||||
}
|
||||
if (!formRiskHint.value.trim() || !formSuggestion.value.trim()) {
|
||||
msg.error(t('admin.procurementContract.ruleRequiredFields'));
|
||||
return;
|
||||
}
|
||||
|
||||
saving.value = true;
|
||||
try {
|
||||
// 与后端 _normalize_keywords 一致:逗号/中文逗号分隔
|
||||
const keywords = formKeywords.value
|
||||
.replace(/,/g, ',')
|
||||
.split(',')
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean);
|
||||
const payload = {
|
||||
title: formTitle.value.trim(),
|
||||
clause_category: formCategory.value.trim(),
|
||||
// 当前采购合同审核只支持通用采购类型,保留固定值以兼容后端规则加载。
|
||||
contract_type: 'general_procurement',
|
||||
keywords,
|
||||
trigger_type: formTriggerType.value,
|
||||
risk_level: formRiskLevel.value,
|
||||
risk_hint: formRiskHint.value.trim(),
|
||||
suggestion: formSuggestion.value.trim(),
|
||||
negotiation_text: formNegotiation.value.trim() || null,
|
||||
status: formStatus.value,
|
||||
sort_order: Number(formSortOrder.value) || 100,
|
||||
};
|
||||
if (isEditMode.value && editing.value) {
|
||||
await updateAdminContractRiskRule(editing.value.id, payload);
|
||||
msg.success(t('admin.procurementContract.ruleEditOk'));
|
||||
} else {
|
||||
await createAdminContractRiskRule(payload);
|
||||
msg.success(t('admin.procurementContract.ruleCreateOk'));
|
||||
}
|
||||
closeForm();
|
||||
await loadRules({ silent: true });
|
||||
} catch (e: unknown) {
|
||||
msg.error(e instanceof Error ? e.message : t('admin.procurementContract.actionFailed'));
|
||||
} finally {
|
||||
saving.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 切换规则启停(种子与自定义规则均可)。
|
||||
* 核心逻辑:先乐观更新本地行,成功后再静默对齐服务端;失败则回滚。
|
||||
*/
|
||||
async function toggleStatus(row: ContractRiskRuleRow): Promise<void> {
|
||||
const prev = row.status;
|
||||
const next = prev === 'enabled' ? 'disabled' : 'enabled';
|
||||
row.status = next;
|
||||
try {
|
||||
const updated = await updateAdminContractRiskRule(row.id, { status: next });
|
||||
Object.assign(row, updated);
|
||||
// 当前筛选为「启用/停用」时,状态变更后该项应离开列表
|
||||
if (filterStatus.value && filterStatus.value !== next) {
|
||||
rules.value = rules.value.filter((r) => r.id !== row.id);
|
||||
}
|
||||
} catch (e: unknown) {
|
||||
row.status = prev;
|
||||
msg.error(e instanceof Error ? e.message : t('admin.procurementContract.actionFailed'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 打开删除确认。
|
||||
*/
|
||||
function openDelete(row: ContractRiskRuleRow): void {
|
||||
pendingDelete.value = row;
|
||||
showDeleteConfirm.value = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭删除确认。
|
||||
*/
|
||||
function closeDelete(): void {
|
||||
showDeleteConfirm.value = false;
|
||||
pendingDelete.value = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认删除规则。
|
||||
*/
|
||||
async function confirmDelete(): Promise<void> {
|
||||
const row = pendingDelete.value;
|
||||
if (!row) return;
|
||||
deleting.value = true;
|
||||
try {
|
||||
await deleteAdminContractRiskRule(row.id);
|
||||
closeDelete();
|
||||
rules.value = rules.value.filter((r) => r.id !== row.id);
|
||||
} catch (e: unknown) {
|
||||
msg.error(e instanceof Error ? e.message : t('admin.procurementContract.actionFailed'));
|
||||
} finally {
|
||||
deleting.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 风险等级文案。
|
||||
*/
|
||||
function riskLabel(level: string): string {
|
||||
if (level === 'high') return t('admin.procurementContract.riskHigh');
|
||||
if (level === 'medium') return t('admin.procurementContract.riskMedium');
|
||||
if (level === 'low') return t('admin.procurementContract.riskLow');
|
||||
return level;
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发类型文案。
|
||||
*/
|
||||
function triggerLabel(type: string): string {
|
||||
if (type === 'keyword_present') return t('admin.procurementContract.triggerPresent');
|
||||
return t('admin.procurementContract.triggerMissing');
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态文案。
|
||||
*/
|
||||
function statusLabel(status: string): string {
|
||||
if (status === 'enabled') return t('admin.procurementContract.enable');
|
||||
if (status === 'disabled') return t('admin.procurementContract.disable');
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* 规则关键词展示文本。
|
||||
* @param row - 风险规则行;关键词为空时返回短横线占位,避免表格空洞。
|
||||
*/
|
||||
function keywordText(row: ContractRiskRuleRow): string {
|
||||
const keywords = row.keywords || [];
|
||||
return keywords.length ? keywords.join(',') : '-';
|
||||
}
|
||||
|
||||
/**
|
||||
* 将内部条款分类编码转换为与规则弹窗一致的可读名称。
|
||||
* 核心逻辑:规则仍保存稳定编码,列表仅负责展示本地化文案。
|
||||
* @param category - 后端返回的条款分类编码。
|
||||
* @returns 用户可读的分类名称;历史未知编码保持原样,避免丢失信息。
|
||||
*/
|
||||
function categoryLabel(category: string): string {
|
||||
const key = `admin.procurementContract.category_${category}`;
|
||||
const translated = t(key);
|
||||
return translated === key ? category : translated;
|
||||
}
|
||||
|
||||
defineExpose({ loadRules, openCreate });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="space-y-5">
|
||||
<div class="grid gap-3 md:grid-cols-3">
|
||||
<div
|
||||
v-for="card in ruleSummaryCards"
|
||||
:key="card.key"
|
||||
class="rounded-xl border px-4 py-3 shadow-sm"
|
||||
:class="card.className"
|
||||
>
|
||||
<div class="flex items-center justify-between gap-3">
|
||||
<div>
|
||||
<div class="text-xs font-medium text-muted">{{ card.label }}</div>
|
||||
<div class="mt-1 text-2xl font-semibold text-primary">{{ card.value }}</div>
|
||||
</div>
|
||||
<span class="inline-flex h-9 w-9 items-center justify-center rounded-lg bg-white/80 shadow-sm">
|
||||
<component :is="card.icon" class="h-4 w-4" />
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-3 rounded-xl border border-subtle bg-white px-4 py-3 shadow-sm sm:flex-row sm:items-center sm:justify-between">
|
||||
<div class="flex items-center gap-3">
|
||||
<label class="flex shrink-0 items-center gap-2 text-sm font-medium text-secondary">
|
||||
<span>{{ t('admin.procurementContract.colStatus') }}</span>
|
||||
<select
|
||||
v-model="filterStatus"
|
||||
class="input-field h-10 w-48 min-w-48 py-0 text-sm"
|
||||
@change="onFilterStatusChange"
|
||||
>
|
||||
<option value="">{{ t('admin.procurementContract.all') }}</option>
|
||||
<option value="enabled">{{ t('admin.procurementContract.enable') }}</option>
|
||||
<option value="disabled">{{ t('admin.procurementContract.disable') }}</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<button type="button" class="btn-primary inline-flex h-10 items-center gap-2 px-4 shadow-sm" @click="openCreate">
|
||||
<Plus class="h-4 w-4" />
|
||||
{{ t('admin.procurementContract.addRule') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="overflow-hidden rounded-xl border border-subtle bg-white shadow-sm">
|
||||
<div class="overflow-auto">
|
||||
<table class="w-full min-w-[1030px] whitespace-nowrap text-sm">
|
||||
<thead class="bg-slate-50/80 text-xs font-semibold text-muted">
|
||||
<tr>
|
||||
<th class="px-5 py-3 text-left">{{ t('admin.procurementContract.colRuleTitle') }}</th>
|
||||
<th class="px-5 py-3 text-left">{{ t('admin.procurementContract.colCategory') }}</th>
|
||||
<th class="px-5 py-3 text-left">{{ t('admin.procurementContract.colKeywords') }}</th>
|
||||
<th class="px-5 py-3 text-left">{{ t('admin.procurementContract.colTrigger') }}</th>
|
||||
<th class="px-5 py-3 text-left">{{ t('admin.procurementContract.colRisk') }}</th>
|
||||
<th class="px-5 py-3 text-left">{{ t('admin.procurementContract.colStatus') }}</th>
|
||||
<th class="px-5 py-3 text-left">{{ t('admin.procurementContract.colSort') }}</th>
|
||||
<th class="px-5 py-3 text-left">{{ t('admin.procurementContract.colActions') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-if="loading">
|
||||
<td colspan="8" class="px-4 py-8 text-center text-muted">
|
||||
{{ t('admin.procurementContract.loading') }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-else-if="!rules.length">
|
||||
<td colspan="8" class="px-4 py-8 text-center text-muted">
|
||||
{{ t('admin.procurementContract.emptyRules') }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-for="row in rules" :key="row.id" class="border-t border-subtle transition-colors hover:bg-slate-50/70">
|
||||
<td class="px-5 py-4 align-top">
|
||||
<div class="font-semibold text-primary">{{ row.title }}</div>
|
||||
</td>
|
||||
<td class="px-5 py-4 align-top">
|
||||
<span class="inline-flex rounded-md border border-slate-200 bg-slate-50 px-2 py-1 text-xs font-medium text-slate-700">
|
||||
{{ categoryLabel(row.clause_category) }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="max-w-[260px] px-5 py-4 align-top text-xs text-muted" :title="keywordText(row)">
|
||||
<div class="line-clamp-2 whitespace-normal leading-5">{{ keywordText(row) }}</div>
|
||||
</td>
|
||||
<td class="px-5 py-4 align-top text-secondary">{{ triggerLabel(row.trigger_type) }}</td>
|
||||
<td class="px-5 py-4 align-top">
|
||||
<span
|
||||
class="inline-flex rounded-full px-2.5 py-1 text-xs font-semibold"
|
||||
:class="{
|
||||
'bg-rose-50 text-rose-700': row.risk_level === 'high',
|
||||
'bg-amber-50 text-amber-800': row.risk_level === 'medium',
|
||||
'bg-sky-50 text-sky-700': row.risk_level === 'low',
|
||||
}"
|
||||
>
|
||||
{{ riskLabel(row.risk_level) }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-5 py-4 align-top">
|
||||
<span
|
||||
class="inline-flex rounded-full px-2.5 py-1 text-xs font-semibold"
|
||||
:class="row.status === 'enabled' ? 'bg-emerald-50 text-emerald-700' : 'bg-slate-100 text-slate-600'"
|
||||
>
|
||||
{{ statusLabel(row.status) }}
|
||||
</span>
|
||||
</td>
|
||||
<td class="px-5 py-4 align-top font-mono text-xs text-muted">{{ row.sort_order }}</td>
|
||||
<td class="px-5 py-4 align-top">
|
||||
<div class="flex items-center gap-2">
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex h-8 items-center rounded-lg border border-[#d8e0ec] bg-white px-3 text-xs font-semibold text-[#2f80d1] transition-colors hover:border-[#2f80d1] hover:bg-[#eaf4ff]"
|
||||
@click="openEdit(row)"
|
||||
>
|
||||
{{ t('admin.edit') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex h-8 items-center rounded-lg border border-[#d8e0ec] bg-white px-3 text-xs font-semibold text-[#172033] transition-colors hover:border-[#667792] hover:bg-slate-50"
|
||||
@click="toggleStatus(row)"
|
||||
>
|
||||
{{ row.status === 'enabled' ? t('admin.procurementContract.disable') : t('admin.procurementContract.enable') }}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex h-8 items-center rounded-lg border border-rose-200 bg-white px-3 text-xs font-semibold text-rose-600 transition-colors hover:border-rose-300 hover:bg-rose-50"
|
||||
@click="openDelete(row)"
|
||||
>
|
||||
{{ t('admin.delete') }}
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="showForm"
|
||||
class="admin-modal-overlay animate-fade-in"
|
||||
@click.self="closeForm"
|
||||
>
|
||||
<div class="admin-modal-panel max-w-2xl max-h-[92vh] my-auto scale-100" role="dialog" aria-modal="true">
|
||||
<div class="admin-modal-header flex items-center justify-between gap-3">
|
||||
<h3 class="section-title">{{ formTitleText }}</h3>
|
||||
<button type="button" class="btn-ghost h-9 px-3 text-sm" @click="closeForm">
|
||||
{{ t('admin.close') }}
|
||||
</button>
|
||||
</div>
|
||||
<div class="admin-modal-body min-h-0 !space-y-0 grid grid-cols-1 gap-4 sm:grid-cols-2 items-start">
|
||||
<label class="flex flex-col gap-1.5 text-sm">
|
||||
<span class="font-medium text-secondary">{{ t('admin.procurementContract.colRuleTitle') }}</span>
|
||||
<input v-model="formTitle" type="text" class="input-field w-full" />
|
||||
</label>
|
||||
<label class="flex flex-col gap-1.5 text-sm">
|
||||
<span class="font-medium text-secondary">{{ t('admin.procurementContract.colCategory') }}</span>
|
||||
<select v-model="formCategory" class="input-field w-full" :disabled="isBuiltinRule">
|
||||
<option v-for="category in clauseCategories" :key="category" :value="category">
|
||||
{{ t(`admin.procurementContract.category_${category}`) }}
|
||||
</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="flex flex-col gap-1.5 text-sm sm:col-span-2">
|
||||
<span class="font-medium text-secondary">{{ t('admin.procurementContract.colKeywords') }}</span>
|
||||
<input
|
||||
v-model="formKeywords"
|
||||
type="text"
|
||||
class="input-field w-full"
|
||||
:disabled="isBuiltinRule"
|
||||
:placeholder="t('admin.procurementContract.ruleKeywordsPlaceholder')"
|
||||
/>
|
||||
<span class="text-xs leading-5 text-muted">{{ keywordLogicHint }}</span>
|
||||
</label>
|
||||
<label class="flex flex-col gap-1.5 text-sm">
|
||||
<span class="font-medium text-secondary">{{ t('admin.procurementContract.colTrigger') }}</span>
|
||||
<select v-model="formTriggerType" class="input-field w-full" :disabled="isBuiltinRule">
|
||||
<option value="keyword_missing">{{ t('admin.procurementContract.triggerMissing') }}</option>
|
||||
<option value="keyword_present">{{ t('admin.procurementContract.triggerPresent') }}</option>
|
||||
</select>
|
||||
<span v-if="isBuiltinRule" class="text-xs leading-5 text-amber-700">{{ t('admin.procurementContract.builtinRuleLogicHint') }}</span>
|
||||
</label>
|
||||
<label class="flex flex-col gap-1.5 text-sm">
|
||||
<span class="font-medium text-secondary">{{ t('admin.procurementContract.colRisk') }}</span>
|
||||
<select v-model="formRiskLevel" class="input-field w-full">
|
||||
<option value="high">{{ t('admin.procurementContract.riskHigh') }}</option>
|
||||
<option value="medium">{{ t('admin.procurementContract.riskMedium') }}</option>
|
||||
<option value="low">{{ t('admin.procurementContract.riskLow') }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="flex flex-col gap-1.5 text-sm">
|
||||
<span class="font-medium text-secondary">{{ t('admin.procurementContract.colStatus') }}</span>
|
||||
<select v-model="formStatus" class="input-field w-full">
|
||||
<option value="enabled">{{ t('admin.procurementContract.enable') }}</option>
|
||||
<option value="disabled">{{ t('admin.procurementContract.disable') }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<div class="flex flex-col gap-1.5 text-sm">
|
||||
<div class="flex items-center gap-1.5">
|
||||
<label for="risk-rule-sort-order" class="font-medium text-secondary">{{ t('admin.procurementContract.colSort') }}</label>
|
||||
<span class="group relative inline-flex">
|
||||
<button
|
||||
type="button"
|
||||
class="inline-flex text-muted transition-colors hover:text-brand-600 focus:outline-none focus-visible:text-brand-600"
|
||||
:aria-label="t('admin.procurementContract.ruleSortHint')"
|
||||
>
|
||||
<CircleHelp class="h-4 w-4" />
|
||||
</button>
|
||||
<span class="pointer-events-none absolute bottom-full left-1/2 z-10 mb-2 hidden w-60 -translate-x-1/2 rounded-lg border border-subtle bg-white px-3 py-2 text-xs font-normal leading-5 text-secondary shadow-lg group-hover:block group-focus-within:block">
|
||||
{{ t('admin.procurementContract.ruleSortHint') }}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<input id="risk-rule-sort-order" v-model.number="formSortOrder" type="number" class="input-field w-full" min="0" />
|
||||
</div>
|
||||
<label class="flex flex-col gap-1.5 text-sm sm:col-span-2">
|
||||
<span class="font-medium text-secondary">{{ t('admin.procurementContract.colRiskHint') }}</span>
|
||||
<textarea v-model="formRiskHint" rows="2" class="input-field w-full resize-y" />
|
||||
</label>
|
||||
<label class="flex flex-col gap-1.5 text-sm sm:col-span-2">
|
||||
<span class="font-medium text-secondary">{{ t('admin.procurementContract.colSuggestion') }}</span>
|
||||
<textarea v-model="formSuggestion" rows="2" class="input-field w-full resize-y" />
|
||||
</label>
|
||||
<label class="flex flex-col gap-1.5 text-sm sm:col-span-2">
|
||||
<span class="font-medium text-secondary">{{ t('admin.procurementContract.colNegotiation') }}</span>
|
||||
<textarea v-model="formNegotiation" rows="2" class="input-field w-full resize-y" />
|
||||
</label>
|
||||
</div>
|
||||
<div class="admin-modal-footer flex justify-end gap-2">
|
||||
<button type="button" class="btn-ghost h-10 px-4" @click="closeForm">
|
||||
{{ t('admin.cancel') }}
|
||||
</button>
|
||||
<button type="button" class="btn-primary h-10 px-4 disabled:opacity-70" :disabled="saving" @click="submitForm">
|
||||
{{ saving ? t('admin.procurementContract.saving') : t('admin.procurementContract.saveChanges') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<DeleteConfirmDialog
|
||||
v-model="showDeleteConfirm"
|
||||
:message="t('admin.procurementContract.confirmDeleteRule', { title: pendingDelete?.title || '' })"
|
||||
:confirm-loading="deleting"
|
||||
@confirm="confirmDelete"
|
||||
@cancel="closeDelete"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
@@ -17,6 +17,7 @@ export type AdminModuleId =
|
||||
| 'permissions'
|
||||
| 'requests'
|
||||
| 'platform_apps'
|
||||
| 'procurement_contract'
|
||||
| 'reports';
|
||||
|
||||
export type AdminReportTableId =
|
||||
|
||||
Reference in new issue
Block a user