1
This commit is contained in:
@@ -240,21 +240,31 @@ class DeviceWorkStatusNotifier {
|
||||
if (workStatus.currentActivity) {
|
||||
const activity = workStatus.currentActivity;
|
||||
const typeText = activity.type === 'command' ? '指令' : '任务';
|
||||
const statusText = activity.status === 'running' ? '执行中' :
|
||||
activity.status === 'completed' ? '已完成' :
|
||||
const statusText = activity.status === 'running' ? '执行中' :
|
||||
activity.status === 'completed' ? '已完成' :
|
||||
activity.status === 'failed' ? '失败' : '未知';
|
||||
|
||||
// 构建详细描述:包含指令/任务名称和描述
|
||||
let activityDesc = activity.description || activity.name;
|
||||
|
||||
// 对于指令,显示指令类型和名称的详细信息
|
||||
if (activity.type === 'command') {
|
||||
const cmdType = activity.commandType || '';
|
||||
if (cmdType && cmdType !== activity.name) {
|
||||
activityDesc = `${activityDesc} [${cmdType}]`;
|
||||
|
||||
// 使用 description 或 name,避免重复显示
|
||||
// 如果 description 存在且不等于 name,优先使用 description
|
||||
// 否则,使用 name 并可能添加 commandType
|
||||
let activityDesc = '';
|
||||
|
||||
if (activity.description && activity.description !== activity.name) {
|
||||
// 有独立的 description,直接使用,不再添加 commandType
|
||||
activityDesc = activity.description;
|
||||
} else {
|
||||
// 使用 name
|
||||
activityDesc = activity.name;
|
||||
|
||||
// 对于指令,如果 commandType 存在且与 name 不同,添加详细信息
|
||||
if (activity.type === 'command') {
|
||||
const cmdType = activity.commandType || '';
|
||||
if (cmdType && cmdType !== activity.name && !activity.name.includes(cmdType)) {
|
||||
activityDesc = `${activityDesc} [${cmdType}]`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
parts.push(`${typeText}: ${activityDesc} (${statusText}${activity.progress > 0 ? `, 进度: ${activity.progress}%` : ''})`);
|
||||
} else {
|
||||
parts.push('当前活动: 无');
|
||||
|
||||
@@ -26,8 +26,8 @@ function checkTimeRange(timeRange) {
|
||||
const startTime = startHour * 60 + startMinute;
|
||||
const endTime = endHour * 60 + endMinute;
|
||||
|
||||
// 检查是否仅工作日
|
||||
if (timeRange.workdays_only === 1) {
|
||||
// 检查是否仅工作日(使用宽松比较,兼容字符串和数字)
|
||||
if (timeRange.workdays_only == 1) { // 使用 == 而不是 ===
|
||||
const dayOfWeek = now.getDay(); // 0=周日, 1=周一, ..., 6=周六
|
||||
if (dayOfWeek === 0 || dayOfWeek === 6) {
|
||||
return { allowed: false, reason: '当前是周末,不在允许的时间范围内' };
|
||||
|
||||
@@ -523,8 +523,8 @@ class TaskHandlers {
|
||||
const startTime = startHour * 60 + startMinute;
|
||||
const endTime = endHour * 60 + endMinute;
|
||||
|
||||
// 检查是否仅工作日
|
||||
if (timeRange.workdays_only === 1) {
|
||||
// 检查是否仅工作日(使用宽松比较,兼容字符串和数字)
|
||||
if (timeRange.workdays_only == 1) { // 使用 == 而不是 ===
|
||||
const dayOfWeek = now.getDay(); // 0=周日, 1=周一, ..., 6=周六
|
||||
if (dayOfWeek === 0 || dayOfWeek === 6) {
|
||||
return { allowed: false, reason: '当前是周末,不在允许的时间范围内' };
|
||||
|
||||
Reference in New Issue
Block a user