czh-20260430-修复任务管理相关bug
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
export const PRIORITY_OPTIONS = [
|
||||
{ label: '高', value: 'high' },
|
||||
{ label: '中', value: 'medium' },
|
||||
{ label: '低', value: 'low' },
|
||||
];
|
||||
|
||||
const PRIORITY_COLOR_MAP: Record<string, string> = {
|
||||
high: '#ffccc7',
|
||||
medium: '#ffe58f',
|
||||
low: '#91d5ff',
|
||||
};
|
||||
|
||||
export function getPriorityBg(value: string): string {
|
||||
return PRIORITY_COLOR_MAP[value] || '#f5f5f5';
|
||||
}
|
||||
|
||||
export function getPriorityLabel(value: string): string {
|
||||
const opt = PRIORITY_OPTIONS.find((o) => o.value === value);
|
||||
return opt?.label || value;
|
||||
}
|
||||
|
||||
export function isOverdue(task: { endTime?: string; completed?: boolean }): boolean {
|
||||
if (!task.endTime || task.completed) return false;
|
||||
const end = new Date(task.endTime);
|
||||
const now = new Date();
|
||||
now.setHours(0, 0, 0, 0);
|
||||
end.setHours(0, 0, 0, 0);
|
||||
return now > end;
|
||||
}
|
||||
Reference in New Issue
Block a user