Commit a186fdaf authored by neo's avatar neo

[Bugfix] fixed bugs for status

parent 0c93b8e9
...@@ -284,10 +284,14 @@ ...@@ -284,10 +284,14 @@
if(data && data.result) if(data && data.result)
updateTasksStatus(data.data); updateTasksStatus(data.data);
if(data.data.jobStatus=='Begin'||data.data.jobStatus=='Running'){ if(data.data.jobStatus=='Begin'||data.data.jobStatus=='Running'){
if(!$scope.timer)
$scope.timer= $interval(function(){ $scope.timer= $interval(function(){
vatReportService.getJobStatus(vatSessionService.project.id,vatSessionService.month,data.data.id).then(function(result){ vatReportService.getJobStatus(vatSessionService.project.id,vatSessionService.month,data.data.id).then(function(result){
if(result.data && result.status == 200){ if(result.data && result.status == 200){
updateTasksStatus(result.data); updateTasksStatus(result.data);
}else{
if($scope.timer)
$interval.cancel($scope.timer);
} }
}); });
...@@ -296,6 +300,8 @@ ...@@ -296,6 +300,8 @@
}).error(function (data,status,config,statusText) { }).error(function (data,status,config,statusText) {
if(status==412){ if(status==412){
SweetAlert.error('报表提审中或审核已通过!'); SweetAlert.error('报表提审中或审核已通过!');
}else if(status == 409){
SweetAlert.error('报表已在处理中!');
} }
}); });
...@@ -554,7 +560,7 @@ ...@@ -554,7 +560,7 @@
if(job.jobStatus == 'End'){ if(job.jobStatus == 'End'){
items.forEach(function(item,index){ items.forEach(function(item,index){
item.status = 'completed'; item.status = 'completed';
item.task = $translate.instant('completed'); item.text = $translate.instant('completed');
}); });
$scope.tasks[0].items[0].status = 'completed'; $scope.tasks[0].items[0].status = 'completed';
...@@ -605,14 +611,16 @@ ...@@ -605,14 +611,16 @@
if(result.data && result.status == 200){ if(result.data && result.status == 200){
updateTasksStatus(result.data); updateTasksStatus(result.data);
if(result.data.jobStatus=='Begin'||result.data.jobStatus=='Running'){ if(result.data.jobStatus=='Begin'||result.data.jobStatus=='Running'){
if(!$scope.timer)
$scope.timer= $interval(function(){ $scope.timer= $interval(function(){
vatReportService.getJobStatus(vatSessionService.project.id,vatSessionService.month,result.data.id) vatReportService.getJobStatus(vatSessionService.project.id,vatSessionService.month,result.data.id)
.success(function(result){ .then(function(result){
if(result.data && result.status == 200){ if(result.data && result.status == 200){
updateTasksStatus(result.data); updateTasksStatus(result.data);
} }else{
}).error(function(result){ if($scope.timer)
$interval.cancel($scope.timer); $interval.cancel($scope.timer);
}
}); });
},1000); },1000);
...@@ -653,6 +661,9 @@ ...@@ -653,6 +661,9 @@
initTasks(); initTasks();
$scope.startCaculate = startCaculate; $scope.startCaculate = startCaculate;
$scope.startCaculate2 = startCaculate2; $scope.startCaculate2 = startCaculate2;
$scope.$on('$destroy',function(){
if($scope.timer)$interval.cancel($scope.timer);
});
})(); })();
} }
......
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