Commit d96c5d2c authored by neo's avatar neo

[DEV] fixed async report control js

parent 619d8073
......@@ -55,7 +55,7 @@
return $http.get('/Report/getRunningJob/' + projectId+'/'+period, apiConfig.createVat());
},
getJobStatus: function (projectId, period, jobId) {
return $http.get('/Report/getJobStatus/' + projectId+'/'+period+'/'+jobId, apiConfig.createVat());
return $http.get('/Report/getJobStatus/' + projectId+'/'+period+'/'+jobId, apiConfig.createVat({ignoreLoadingBar: true}));
},
getReportData: function (reportId) {
return $http.get('/Report/reportData/' + reportId, apiConfig.createVat());
......
......@@ -279,11 +279,23 @@
function doStartCaculate2(isMergeManualDataSource) {
vatReportService.generateAll(vatSessionService.project.id, isMergeManualDataSource, vatSessionService.month, vatSessionService.logUser.id ? vatSessionService.logUser.id : "").success(function (data) {
if(data && data.result) {
updateTasksStatus(data.result.data);
if(data && data.result)
updateTasksStatus(data.data);
if(data.data.status=='Begin'){
$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);
}
});
},1000);
}
}).error(function () {
taskError(_this);
$log.debug("generate all report may be some error");
// taskError(_this);
});
}
var startCaculate = function () {
......@@ -529,10 +541,12 @@
var updateTasksStatus = function(job){
if((job).currentStep == 'UpdateConfig'){
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;
var currentIndex = 0;
items.forEach(function(item,index){
......@@ -546,17 +560,18 @@
if(index < currentIndex){
item.status ='completed';
}else if(index == currentIndex){
if((job).status == 'Error'){
if(job.status == 'Error'){
item.status = 'error';
}else if(result.data.status == 'End'){
}else if(job.status == 'End'){
item.status = 'completed';
if($scope.timer){
$interval.cancel($scope.timer);
}
}else if(result.data.status == 'Begin'){
}else if(job.status == 'Begin'){
item.status = 'processing';
}
}
item.text = $translate.instant(item.status);
});
}
......@@ -568,7 +583,7 @@
updateTasksStatus(result.data);
if(result.data.status=='Begin'){
$scope.timer= $interval(function(){
vatReportService.getJobStatus(vatSessionService.project.id,vatSessionService.month,jobId,id).then(function(result){
vatReportService.getJobStatus(vatSessionService.project.id,vatSessionService.month,result.data.id).then(function(result){
if(result.data && result.status == 200){
updateTasksStatus(result.data);
}
......@@ -583,7 +598,6 @@
});
}
var
var sendMessage = function (task) {
var msgDto = {};
......
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