This commit is contained in:
张成
2025-12-18 18:46:29 +08:00
parent 73a0999e20
commit f233f368ed
5 changed files with 77 additions and 30 deletions

View File

@@ -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('当前活动: 无');