refactor(workbench): 重构待办面板功能提升用户体验
- 替换原有时间桶过滤为分类标签页和截止时间筛选器 - 添加优先级排序功能,支持任务类别内按优先级排序 - 重构待办数据结构,新增创建时间和优先级字段 - 移除高优先级标记,统一使用优先级枚举值 - 添加个人事项创建对话框和相关操作功能 - 更新模拟数据以匹配新的数据结构和功能需求 - 优化列表排序逻辑,按创建时间升序排列,无截止时间排最后 - 为各类别待办项添加逾期状态标识和计数统计 - 实现分页加载,每页显示5条待办记录 - 更新样式类名以匹配新的逾期判断逻辑 refactor(project): 优化项目执行模块提升性能和可维护性 - 移除执行项点击切换功能相关的事件和方法 - 删除不再使用的select-execution事件发射器 - 移除执行标签的悬停效果和鼠标指针样式 - 重构任务表格视图,将日期格式化函数名称标准化 - 在跨执行模式下也显示进度列,统一界面布局 - 更新最近更新列宽度并调整日期格式显示 - 将默认页面大小从10增加到20以提高加载效率 feat(list): 统一日期格式化功能简化代码维护 - 将日期时间格式化函数重命名为更准确的date格式化 - 在产品列表和项目列表中统一使用新的日期格式化函数 - 移除秒数显示,仅保留年月日格式提高可读性 refactor(todo): 重构待办事项数据模型和过滤逻辑 - 重新定义待办事项分类类型,移除mention添加personal - 新增主标签、截止时间筛选器和优先级类型定义 - 添加创建时间字段用于排序和显示 - 实现基于分类、截止时间和优先级的过滤函数 - 创建优先级权重映射用于排序算法 - 更新待办项构建函数以支持新的排序逻辑 - 修改逾期判断逻辑以适应新的数据结构 - 移除原有的高优先级字段,统一使用优先级枚举 - 添加优先级排序功能支持升序降序切换 - 重构排序算法,优先按创建时间,其次按截止时间排序 refactor(task): 清理任务模块中已废弃的功能 - 移除通过ID选择执行项的相关函数和事件处理器 - 删除任务卡片和表格中的执行项点击切换功能 - 更新任务工作区组件以移除废弃的事件监听 - 调整任务表格视图中进度条的样式和状态显示 refactor(components): 项目列表中添加进度条可视化组件 - 引入Element Plus进度条组件用于项目进度展示 - 在项目列表中添加进度列并实现进度条渲染 - 配置进度条样式包括内嵌文字、成功状态和边框圆角 - 调整进度列宽度以适应进度条显示需求 refactor(widgets): 整理工作台模块配置和清理冗余组件 - 从工作台模块注册中移除已废弃的myTicket组件 - 更新模块注释说明,明确myTicket已废弃的原因 - 删除不再使用的workbench-my-ticket.vue组件文件 - 更新模块总数注释从16个调整为15个
This commit is contained in:
@@ -2,9 +2,13 @@ import dayjs from 'dayjs';
|
||||
|
||||
export type WorkbenchTrend = 'up' | 'down' | 'flat';
|
||||
|
||||
export type WorkbenchTodoCategory = 'review' | 'task' | 'ticket' | 'mention';
|
||||
export type WorkbenchTodoCategory = 'task' | 'ticket' | 'personal' | 'review';
|
||||
|
||||
export type WorkbenchTodoTimeBucket = 'all' | 'today' | 'week' | 'overdue';
|
||||
export type WorkbenchTodoMainTab = 'all' | WorkbenchTodoCategory;
|
||||
|
||||
export type WorkbenchTodoDeadlineFilter = 'overdue' | 'today' | 'week' | null;
|
||||
|
||||
export type WorkbenchTodoPriority = 'high' | 'mid' | 'low';
|
||||
|
||||
export type WorkbenchProjectStatus = 'active' | 'preview' | 'paused';
|
||||
|
||||
@@ -72,14 +76,16 @@ export interface WorkbenchTodoItemSource {
|
||||
id: string;
|
||||
category: WorkbenchTodoCategory;
|
||||
title: string;
|
||||
/** 创建时间,ISO 字符串。列表默认按这个升序 */
|
||||
createdTime: string;
|
||||
/** 截止时间,ISO 字符串 */
|
||||
deadline: string | null;
|
||||
/** 来源(提交人/项目名/工单号) */
|
||||
source: string;
|
||||
/** 优先级,用于前端排序与高亮 */
|
||||
priority?: WorkbenchTodoPriority;
|
||||
/** 是否逾期 */
|
||||
overdue?: boolean;
|
||||
/** 是否高优先级 */
|
||||
highPriority?: boolean;
|
||||
/** 跳转路由 key(可选,未配则不跳转) */
|
||||
routeKey?: string;
|
||||
}
|
||||
@@ -140,10 +146,16 @@ const todoCategoryMeta: Record<
|
||||
WorkbenchTodoCategory,
|
||||
{ label: string; tone: WorkbenchTodoItem['categoryTone']; icon: string }
|
||||
> = {
|
||||
review: { label: '需求评审', tone: 'sky', icon: 'mdi:file-search-outline' },
|
||||
task: { label: '任务', tone: 'emerald', icon: 'mdi:checkbox-marked-circle-outline' },
|
||||
ticket: { label: '工单', tone: 'amber', icon: 'mdi:ticket-confirmation-outline' },
|
||||
mention: { label: '@ 提及', tone: 'violet', icon: 'mdi:at' }
|
||||
personal: { label: '个人事项', tone: 'violet', icon: 'mdi:notebook-edit-outline' },
|
||||
review: { label: '待评审', tone: 'sky', icon: 'mdi:file-search-outline' }
|
||||
};
|
||||
|
||||
const todoPriorityWeight: Record<WorkbenchTodoPriority, number> = {
|
||||
high: 0,
|
||||
mid: 1,
|
||||
low: 2
|
||||
};
|
||||
|
||||
const activityToneMap: Record<WorkbenchActivityItemSource['targetKind'], WorkbenchActivityItem['tone']> = {
|
||||
@@ -282,9 +294,12 @@ export function buildWorkbenchKpiCards(source: WorkbenchKpiSource): WorkbenchKpi
|
||||
export function buildWorkbenchTodoItems(source: readonly WorkbenchTodoItemSource[]): WorkbenchTodoItem[] {
|
||||
return [...source]
|
||||
.sort((left, right) => {
|
||||
const leftValue = left.deadline ? dayjs(left.deadline).valueOf() : Number.POSITIVE_INFINITY;
|
||||
const rightValue = right.deadline ? dayjs(right.deadline).valueOf() : Number.POSITIVE_INFINITY;
|
||||
return leftValue - rightValue;
|
||||
const leftCreated = dayjs(left.createdTime).valueOf();
|
||||
const rightCreated = dayjs(right.createdTime).valueOf();
|
||||
if (leftCreated !== rightCreated) return leftCreated - rightCreated;
|
||||
const leftDeadline = left.deadline ? dayjs(left.deadline).valueOf() : Number.POSITIVE_INFINITY;
|
||||
const rightDeadline = right.deadline ? dayjs(right.deadline).valueOf() : Number.POSITIVE_INFINITY;
|
||||
return leftDeadline - rightDeadline;
|
||||
})
|
||||
.map(item => {
|
||||
const meta = todoCategoryMeta[item.category];
|
||||
@@ -298,12 +313,42 @@ export function buildWorkbenchTodoItems(source: readonly WorkbenchTodoItemSource
|
||||
});
|
||||
}
|
||||
|
||||
export function filterWorkbenchTodoItems(items: readonly WorkbenchTodoItem[], bucket: WorkbenchTodoTimeBucket) {
|
||||
if (bucket === 'all') return [...items];
|
||||
if (bucket === 'overdue') return items.filter(item => item.remainingDays !== null && item.remainingDays < 0);
|
||||
if (bucket === 'today') return items.filter(item => item.remainingDays === 0);
|
||||
// bucket === 'week'
|
||||
return items.filter(item => item.remainingDays !== null && item.remainingDays >= 0 && item.remainingDays <= 7);
|
||||
export function filterWorkbenchTodoItemsByCategory(items: readonly WorkbenchTodoItem[], tab: WorkbenchTodoMainTab) {
|
||||
if (tab === 'all') return [...items];
|
||||
return items.filter(item => item.category === tab);
|
||||
}
|
||||
|
||||
export function filterWorkbenchTodoItemsByDeadline(
|
||||
items: readonly WorkbenchTodoItem[],
|
||||
filter: WorkbenchTodoDeadlineFilter
|
||||
) {
|
||||
if (!filter) return [...items];
|
||||
if (filter === 'overdue') return items.filter(item => isOverdue(item));
|
||||
if (filter === 'today') return items.filter(item => item.remainingDays === 0);
|
||||
// filter === 'week':含今日,含逾期一起暴露给用户处理
|
||||
return items.filter(item => item.remainingDays !== null && item.remainingDays <= 7);
|
||||
}
|
||||
|
||||
export function isWorkbenchTodoOverdue(item: WorkbenchTodoItem) {
|
||||
return isOverdue(item);
|
||||
}
|
||||
|
||||
function isOverdue(item: WorkbenchTodoItem) {
|
||||
if (item.overdue) return true;
|
||||
return item.remainingDays !== null && item.remainingDays < 0;
|
||||
}
|
||||
|
||||
export function sortWorkbenchTodoItemsByPriority(
|
||||
items: readonly WorkbenchTodoItem[],
|
||||
direction: 'asc' | 'desc' = 'desc'
|
||||
) {
|
||||
const factor = direction === 'desc' ? 1 : -1;
|
||||
return [...items].sort((left, right) => {
|
||||
const leftWeight = todoPriorityWeight[left.priority ?? 'low'];
|
||||
const rightWeight = todoPriorityWeight[right.priority ?? 'low'];
|
||||
if (leftWeight !== rightWeight) return (leftWeight - rightWeight) * factor;
|
||||
return dayjs(left.createdTime).valueOf() - dayjs(right.createdTime).valueOf();
|
||||
});
|
||||
}
|
||||
|
||||
export function buildWorkbenchActivityItems(source: readonly WorkbenchActivityItemSource[]): WorkbenchActivityItem[] {
|
||||
|
||||
Reference in New Issue
Block a user