UNPKG

jordium-gantt-vue3

Version:

A Vue 3 Gantt chart component for project management, task scheduling, resource planning, calendar, resource usage and timeline visualization.

84 lines (83 loc) 2.19 kB
import { Task } from '../models/classes/Task'; /** * 冲突区域数据结构 */ export interface ConflictZone { /** 冲突开始时间 */ startDate: Date; /** 冲突结束时间 */ endDate: Date; /** 总投入比例(百分比) */ totalPercent: number; /** 冲突等级 */ level: 'light' | 'medium' | 'severe'; /** 涉及的任务列表 */ tasks: Array<{ id: number | string; name: string; capacity: number; }>; /** Canvas渲染坐标(由GanttConflicts组件计算填充) */ left?: number; width?: number; top?: number; height?: number; } /** * 时间交集结果 */ export interface TimeIntersection { start: Date; end: Date; } /** * 检测资源时间冲突 * * @param tasks 任务列表 * @param resourceId 资源ID * @returns 冲突区域列表 * * @example * const conflicts = detectConflicts(tasks, 'resource-1') */ export declare function detectConflicts(tasks: Task[], resourceId: string | number, timeScale?: string): ConflictZone[]; /** * 计算两个任务的时间交集 * * @param task1 任务1 * @param task2 任务2 * @returns 时间交集,如果没有交集返回null * * @example * const intersection = getTimeIntersection(task1, task2) * if (intersection) { * console.log('冲突时间段:', intersection.start, '~', intersection.end) * } */ export declare function getTimeIntersection(task1: Task | { startDate?: string; endDate?: string; }, task2: Task | { startDate?: string; endDate?: string; }, timeScale?: string): TimeIntersection | null; /** * 判断冲突等级 * * @param totalPercent 总投入比例(百分比) * @returns 冲突等级 * * @example * getConflictLevel(110) // 'light' * getConflictLevel(130) // 'medium' * getConflictLevel(160) // 'severe' */ export declare function getConflictLevel(totalPercent: number): 'light' | 'medium' | 'severe'; /** * 计算两个日期之间的天数差 */ export declare function getDaysDiff(start: Date, end: Date): number; /** * 检查日期是否在指定范围内 */ export declare function isDateInRange(date: Date, start: Date, end: Date): boolean;