2025-11-05 16:20:12 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 任务状态全局配置
|
|
|
|
|
|
* 包含任务状态的配色方案、类型映射等
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
// 任务状态配色方案
|
|
|
|
|
|
export const TASK_STATUS_COLORS = {
|
|
|
|
|
|
// 待完成任务
|
|
|
|
|
|
pending: {
|
|
|
|
|
|
backgroundColor: '#2885ff',
|
|
|
|
|
|
color: '#fff',
|
|
|
|
|
|
borderColor: '#2885ff',
|
|
|
|
|
|
type: 'primary'
|
|
|
|
|
|
},
|
|
|
|
|
|
// 即将逾期任务
|
|
|
|
|
|
imminent: {
|
|
|
|
|
|
backgroundColor: '#ff9800',
|
|
|
|
|
|
color: '#fff',
|
|
|
|
|
|
borderColor: '#ff9800',
|
|
|
|
|
|
type: 'warning'
|
|
|
|
|
|
},
|
|
|
|
|
|
// 已完成任务
|
|
|
|
|
|
completed: {
|
|
|
|
|
|
backgroundColor: '#909399',
|
|
|
|
|
|
color: '#fff',
|
|
|
|
|
|
borderColor: '#909399',
|
|
|
|
|
|
type: 'info'
|
|
|
|
|
|
},
|
|
|
|
|
|
// 逾期任务
|
|
|
|
|
|
overdue: {
|
|
|
|
|
|
backgroundColor: '#f56c6c',
|
|
|
|
|
|
color: '#fff',
|
|
|
|
|
|
borderColor: '#f56c6c',
|
|
|
|
|
|
type: 'error'
|
|
|
|
|
|
},
|
|
|
|
|
|
// 紧急标签
|
|
|
|
|
|
urgent: {
|
|
|
|
|
|
backgroundColor: '#f56c6c',
|
|
|
|
|
|
color: '#fff',
|
|
|
|
|
|
borderColor: '#f56c6c',
|
|
|
|
|
|
type: 'error'
|
|
|
|
|
|
},
|
|
|
|
|
|
// 重要标签
|
|
|
|
|
|
important: {
|
|
|
|
|
|
backgroundColor: '#2885ff',
|
|
|
|
|
|
color: '#fff',
|
|
|
|
|
|
borderColor: '#2885ff',
|
|
|
|
|
|
type: 'primary'
|
|
|
|
|
|
},
|
|
|
|
|
|
// 普通标签
|
|
|
|
|
|
normal: {
|
|
|
|
|
|
backgroundColor: '#909399',
|
|
|
|
|
|
color: '#fff',
|
|
|
|
|
|
borderColor: '#909399',
|
|
|
|
|
|
type: 'info'
|
2025-11-24 09:27:41 +08:00
|
|
|
|
},
|
|
|
|
|
|
// 已取消任务
|
|
|
|
|
|
cancelled: {
|
|
|
|
|
|
backgroundColor: '#909399',
|
|
|
|
|
|
color: '#fff',
|
|
|
|
|
|
borderColor: '#909399',
|
|
|
|
|
|
type: 'info'
|
2025-11-05 16:20:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 状态文本映射
|
|
|
|
|
|
export const STATUS_TEXT_MAP = {
|
|
|
|
|
|
'imminent': '即将逾期',
|
|
|
|
|
|
'pending': '待完成',
|
|
|
|
|
|
'completed': '已完成',
|
|
|
|
|
|
'overdue': '逾期',
|
2025-11-24 09:27:41 +08:00
|
|
|
|
'cancelled': '已取消',
|
2025-11-05 16:20:12 +08:00
|
|
|
|
'urgent': '紧急',
|
|
|
|
|
|
'important': '重要',
|
|
|
|
|
|
'normal': '普通'
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 状态类型映射(用于uv-tags组件的type属性)
|
|
|
|
|
|
export const STATUS_TYPE_MAP = {
|
|
|
|
|
|
'imminent': 'warning',
|
|
|
|
|
|
'pending': 'primary',
|
|
|
|
|
|
'completed': 'info',
|
|
|
|
|
|
'overdue': 'error',
|
2025-11-24 09:27:41 +08:00
|
|
|
|
'cancelled': 'info',
|
2025-11-05 16:20:12 +08:00
|
|
|
|
'urgent': 'error',
|
|
|
|
|
|
'important': 'primary',
|
|
|
|
|
|
'normal': 'info'
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 标签文本到状态的映射(用于任务详细页面)
|
|
|
|
|
|
export const TAG_TEXT_TO_STATUS = {
|
|
|
|
|
|
'已逾期': 'overdue',
|
|
|
|
|
|
'紧急': 'urgent',
|
|
|
|
|
|
'重要': 'important',
|
|
|
|
|
|
'普通': 'normal',
|
|
|
|
|
|
'即将逾期': 'imminent',
|
|
|
|
|
|
'待完成': 'pending',
|
|
|
|
|
|
'已完成': 'completed'
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取任务状态的自定义样式
|
|
|
|
|
|
* @param {string} status - 任务状态
|
|
|
|
|
|
* @returns {object} 样式对象
|
|
|
|
|
|
*/
|
|
|
|
|
|
export const getTaskStatusStyle = (status) => {
|
|
|
|
|
|
return TASK_STATUS_COLORS[status] || TASK_STATUS_COLORS.normal;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取任务状态的类型(用于uv-tags组件)
|
|
|
|
|
|
* @param {string} status - 任务状态
|
|
|
|
|
|
* @returns {string} uv-tags组件的type值
|
|
|
|
|
|
*/
|
|
|
|
|
|
export const getTaskStatusType = (status) => {
|
|
|
|
|
|
return STATUS_TYPE_MAP[status] || 'primary';
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 获取状态文本
|
|
|
|
|
|
* @param {string} status - 任务状态
|
|
|
|
|
|
* @returns {string} 状态文本
|
|
|
|
|
|
*/
|
|
|
|
|
|
export const getStatusText = (status) => {
|
|
|
|
|
|
return STATUS_TEXT_MAP[status] || status;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 根据标签文本获取状态
|
|
|
|
|
|
* @param {string} tagText - 标签文本
|
|
|
|
|
|
* @returns {string} 任务状态
|
|
|
|
|
|
*/
|
|
|
|
|
|
export const getStatusFromTagText = (tagText) => {
|
|
|
|
|
|
return TAG_TEXT_TO_STATUS[tagText] || 'normal';
|
|
|
|
|
|
};
|
|
|
|
|
|
|