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('当前活动: 无');
|
||||
|
||||
Reference in New Issue
Block a user