Commit 8db79f5a authored by neo's avatar neo

[DEV] fixed items status by jobstatus and step status

parent 329a29b8
......@@ -283,7 +283,7 @@
$scope.readonly = true;
if(data && data.result)
updateTasksStatus(data.data);
if(data.data.status=='Begin'){
if(data.data.jobStatus=='Begin'||data.data.jobStatus=='Running'){
$scope.timer= $interval(function(){
vatReportService.getJobStatus(vatSessionService.project.id,vatSessionService.month,data.data.id).then(function(result){
if(result.data && result.status == 200){
......@@ -299,6 +299,12 @@
}
});
}
function isAllEnd(stepCode,status){
var statusList = JSON.parse(status);
var stepCodes = stepCode.split(",");
}
var startCaculate = function () {
......@@ -551,35 +557,33 @@
}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){
if((job).currentStep == item.code){
currentIndex = index;
if(job.jobStatus == 'End'){
if($scope.timer){
$interval.cancel($scope.timer);
vatCommonService.setProjectStatus(vatSessionService.project.id, vatSessionService.month, constant.ProjectStatusEnum.Generated
, constant.DictionaryDictKey.WFDataProcess, enums.FinishStatusEnum.Finished);
}
});
items.forEach(function(item,index){
if(index < currentIndex){
item.status ='completed';
}else if(index == currentIndex){
if(job.status == 'Error'){
item.status = 'error';
}else if(job.status == 'End'){
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.status == 'Begin'){
item.status = 'processing';
}
}
item.text = $translate.instant(item.status);
});
}else if(job.jobStatus=='Running'){
var tasks = JSON.parse(job)
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);
}
})
});
}else if(job.jobStatus == 'Error'){
if($scope.timer)$interval.cancel($scope.timer);
}
}
}
......@@ -587,7 +591,7 @@
vatReportService.getRunningJob(vatSessionService.project.id,vatSessionService.month).then(function (result) {
if(result.data && result.status == 200){
updateTasksStatus(result.data);
if(result.data.status=='Begin'){
if(result.data.jobStatus=='Begin'||result.data.jobStatus=='Running'){
$scope.timer= $interval(function(){
vatReportService.getJobStatus(vatSessionService.project.id,vatSessionService.month,result.data.id)
.success(function(result){
......
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