|
|
|
// 统一任务配置入口文件
|
|
|
|
|
|
|
|
import type { TaskConfig, FieldConfig } from './taskConfigTypes';
|
|
|
|
import { DOCUMENT_TASK_CONFIGS, getDocumentTaskConfig } from './documentTaskConfigs';
|
|
|
|
import { CONTRACT_TASK_CONFIGS, getContractTaskConfig } from './contractTaskConfigs';
|
|
|
|
import { TENDER_TASK_CONFIGS, getTenderTaskConfig } from './tenderTaskConfigs';
|
|
|
|
|
|
|
|
// 合并所有任务配置
|
|
|
|
const ALL_TASK_CONFIGS: Record<string, TaskConfig> = {
|
|
|
|
...DOCUMENT_TASK_CONFIGS,
|
|
|
|
...CONTRACT_TASK_CONFIGS,
|
|
|
|
...TENDER_TASK_CONFIGS
|
|
|
|
};
|
|
|
|
|
|
|
|
// 统一的获取任务配置函数
|
|
|
|
export function getTaskConfig(taskType: string): TaskConfig | null {
|
|
|
|
// 首先尝试从文档任务配置中获取
|
|
|
|
let config = getDocumentTaskConfig(taskType);
|
|
|
|
if (config) return config;
|
|
|
|
|
|
|
|
// 然后尝试从合同任务配置中获取
|
|
|
|
config = getContractTaskConfig(taskType);
|
|
|
|
if (config) return config;
|
|
|
|
|
|
|
|
// 最后尝试从招投标任务配置中获取
|
|
|
|
config = getTenderTaskConfig(taskType);
|
|
|
|
if (config) return config;
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 获取所有可用配置
|
|
|
|
export function getAvailableConfigs(): TaskConfig[] {
|
|
|
|
return Object.values(ALL_TASK_CONFIGS);
|
|
|
|
}
|
|
|
|
|
|
|
|
// 检查字段是否应该显示对比按钮
|
|
|
|
export function shouldShowComparison(fieldConfig: FieldConfig, item: any): boolean {
|
|
|
|
if (!fieldConfig.showComparison) return false;
|
|
|
|
|
|
|
|
// 获取对比字段名,默认为 modificationDisplay
|
|
|
|
const comparisonField = fieldConfig.comparisonConfig?.comparisonField || 'modificationDisplay';
|
|
|
|
|
|
|
|
// 检查对比字段是否有内容
|
|
|
|
return !!(item[comparisonField] && item[comparisonField].trim());
|
|
|
|
}
|
|
|
|
|
|
|
|
// 获取对比字段名
|
|
|
|
export function getComparisonField(fieldConfig: FieldConfig): string {
|
|
|
|
return fieldConfig.comparisonConfig?.comparisonField || 'modificationDisplay';
|
|
|
|
}
|
|
|
|
|
|
|
|
// 获取对比标题
|
|
|
|
export function getComparisonTitle(fieldConfig: FieldConfig): string {
|
|
|
|
return fieldConfig.comparisonConfig?.comparisonTitle || '修改情况展示';
|
|
|
|
}
|
|
|
|
|
|
|
|
// 检查是否应该显示对比按钮
|
|
|
|
export function shouldShowComparisonButton(fieldConfig: FieldConfig): boolean {
|
|
|
|
return fieldConfig.comparisonConfig?.showButton !== false; // 默认为true
|
|
|
|
}
|
|
|
|
|
|
|
|
// 获取字段的PDF源
|
|
|
|
export function getFieldPdfSource(fieldConfig: FieldConfig): string | null {
|
|
|
|
return fieldConfig.pdfSource || null;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 检查字段是否支持PDF定位
|
|
|
|
export function supportsPdfLocation(fieldConfig: FieldConfig): boolean {
|
|
|
|
return !!(fieldConfig.pdfSource && fieldConfig.pdfSource !== 'auto');
|
|
|
|
}
|
|
|
|
|
|
|
|
// 重新导出类型
|
|
|
|
export type { TaskConfig, FieldConfig, TabConfig, PdfSourceConfig } from './taskConfigTypes';
|