Commit a186fdaf authored by neo's avatar neo

[Bugfix] fixed bugs for status

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