Commit 22f66510 authored by neo's avatar neo

[Bugfix] cannot stop timer when updateconfig is error

parent bc10900c
......@@ -549,48 +549,55 @@
vatOperationLogService.addOperationLog(logDto);
};
var updateTasksStatus = function(job){
if(job.currentStep == 'UpdateConfig'){
$scope.tasks[0].items[0].status = 'processing';
$scope.tasks[0].items[0].text= $translate.instant('processing');
}else{
$scope.tasks[0].items[0].status = 'completed';
$scope.tasks[0].items[0].text= $translate.instant('completed');
var items = $scope.tasks[1].items;
if(job.jobStatus == 'End'){
items.forEach(function(item,index){
item.status = 'completed';
});
if($scope.timer){
$interval.cancel($scope.timer);
vatCommonService.setProjectStatus(vatSessionService.project.id, vatSessionService.month, constant.ProjectStatusEnum.Generated
, constant.DictionaryDictKey.WFDataProcess, enums.FinishStatusEnum.Finished);
}
}else if(job.jobStatus=='Running'|| job.jobStatus=='Error'){
var tasks = JSON.parse(job.status)
items.forEach(function(item,index){
tasks.forEach(function(task){
if(task.code==item.code){
if(task.status == 'Error'){
item.status = 'error';
}else if(task.status == 'End'){
item.status = 'completed';
}else if(task.status == 'Begin'){
item.status = 'processing';
}
item.text = $translate.instant(item.status);
}
})
});
var items = $scope.tasks[1].items;
if(job.jobStatus == 'End'){
items.forEach(function(item,index){
item.status = 'completed';
item.task = $translate.instant('completed');
});
$scope.tasks[0].items[0].status = 'completed';
$scope.tasks[0].items[0].text= $translate.instant('completed');
if($scope.timer){
$interval.cancel($scope.timer);
vatCommonService.setProjectStatus(vatSessionService.project.id, vatSessionService.month, constant.ProjectStatusEnum.Generated
, constant.DictionaryDictKey.WFDataProcess, enums.FinishStatusEnum.Finished);
}
}else if(job.jobStatus=='Running'|| job.jobStatus=='Error'){
var tasks = JSON.parse(job.status)
if(job.jobStatus == 'Error'){
if($scope.timer)$interval.cancel($scope.timer);
var updateConfig = tasks[0];
if(updateConfig.status == 'Error'){
$scope.tasks[0].items[0].status = 'error';
}else if(updateConfig.status == 'End'){
$scope.tasks[0].items[0].status = 'completed';
}else if(updateConfig.status == 'Begin'){
$scope.tasks[0].items[0].status = 'processing';
}
$scope.tasks[0].items[0].text= $translate.instant($scope.tasks[0].items[0].status);
items.forEach(function(item,index){
tasks.forEach(function(task){
if(task.code==item.code){
if(task.status == 'Error'){
item.status = 'error';
}else if(task.status == 'End'){
item.status = 'completed';
}else if(task.status == 'Begin'){
item.status = 'processing';
}
item.text = $translate.instant(item.status);
}
}
}
})
});
if(job.jobStatus == 'Error'){
if($scope.timer)$interval.cancel($scope.timer);
}
}
}
var getInitTaskStatus = function(){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment