1
This commit is contained in:
@@ -89,8 +89,9 @@ class DeviceWorkStatusNotifier {
|
||||
description: this._formatCommandDescription(cmd),
|
||||
status: 'running',
|
||||
progress: cmd.progress || 0,
|
||||
currentStep: cmd.currentStep || cmd.current_step || '',
|
||||
startTime: cmd.startTime || cmd.start_time || new Date().toISOString()
|
||||
startTime: cmd.startTime || cmd.start_time || new Date().toISOString(),
|
||||
commandType: cmd.command_type || cmd.type || '',
|
||||
commandParams: cmd.command_params || cmd.params || {}
|
||||
};
|
||||
}
|
||||
// 如果有当前执行的任务,显示任务状态
|
||||
|
||||
@@ -1180,19 +1180,32 @@ class TaskQueue {
|
||||
task_id: currentTask.taskId,
|
||||
status: 'running'
|
||||
},
|
||||
order: [['id', 'DESC']]
|
||||
order: [['sequence', 'ASC'], ['id', 'ASC']] // 按执行顺序排序
|
||||
});
|
||||
|
||||
if (runningCommand) {
|
||||
const cmdData = runningCommand.toJSON();
|
||||
|
||||
// 解析命令参数
|
||||
let commandParams = {};
|
||||
if (cmdData.command_params) {
|
||||
try {
|
||||
commandParams = typeof cmdData.command_params === 'string'
|
||||
? JSON.parse(cmdData.command_params)
|
||||
: cmdData.command_params;
|
||||
} catch (e) {
|
||||
// 解析失败,忽略
|
||||
}
|
||||
}
|
||||
|
||||
currentCommand = {
|
||||
command_id: cmdData.id,
|
||||
command_name: cmdData.command_name || '执行指令',
|
||||
command_type: cmdData.command_type || '',
|
||||
command_params: cmdData.command_params || cmdData.params || {},
|
||||
command_params: commandParams,
|
||||
params: commandParams, // 兼容字段名
|
||||
progress: cmdData.progress || 0,
|
||||
currentStep: cmdData.current_step || '',
|
||||
startTime: cmdData.start_time || cmdData.created_time || new Date().toISOString()
|
||||
startTime: cmdData.start_time ? new Date(cmdData.start_time).toISOString() : new Date().toISOString()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user