Skip to content

Commit

Permalink
fix: ImageMS pagination bug
Browse files Browse the repository at this point in the history
1.Error position with code so cannot watch variable
2.Use api to do pagination
3.While click search button reset page to 1
  • Loading branch information
Chinlinlee committed Dec 15, 2020
1 parent 999eb1f commit 11354a3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
4 changes: 2 additions & 2 deletions public/html/ImageMS.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<br />
<div class="row">
<div class="col-sm-12">
<button class="btn btn-success" ng-click="QIDO();">Search</button>
<button class="btn btn-success" ng-click="isSearched=true;QIDO();">Search</button>
</div>
</div>
<hr style>
Expand All @@ -43,7 +43,7 @@ <h2 ng-show="dataList.length > 0">Study</h2>
<th class="text-center" style="width: 40%;">Operate</th>
</thead>
<tbody>
<tr ng-repeat="item in dataList|orderBy:orderStudyCol:orderStudyReverse|filter : studyTablePaginate" ng-click="">
<tr ng-repeat="item in dataList|orderBy:orderStudyCol:orderStudyReverse" ng-click="">
<td class="text-center" style="width: 10%;">{{item.patient[0].id}}</td>
<td class="text-center" style="width: 60%;">{{item.patient[0].name[0].text}}</td>
<td class="text-center" style="width: 10%;">{{item.started | date:'yyyyMMdd'}}</td>
Expand Down
26 changes: 17 additions & 9 deletions public/scripts/ImageMS/ImageMS.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ imageMSApp.controller('imageMSCtrl' , function ($scope , imageMSService , common
$scope.wadoUrlList = [];
$scope.isOpenSeries = false;
$scope.isOpenInstance = false;
$scope.isSearched = false;
$scope.curStudyPage = 1; //table
$scope.numStudyPerPage = 10; //table
$scope.totalItem = 0;
Expand Down Expand Up @@ -73,22 +74,26 @@ imageMSApp.controller('imageMSCtrl' , function ($scope , imageMSService , common
if (!check_Date(dates[0]))
{
alert('Invalid StudyDate');
return;
}
}
else if (dates.length ==2)
{
if (!check_Date(dates[0]) || !check_Date(dates[1]))
{
alert('Invalid StudyDate');
return;
}
}
}
$scope.curStudyPage = 1;
if ($scope.isSearched) {
$scope.curStudyPage = 1;
}
imageMSService.QIDO($scope).then(async function(res)
{
$scope.dataList = res.data[0];
$scope.totalItem = res.data[1];
console.log($scope.dataList);
//console.log($scope.dataList);
if ($scope.dataList == null ||$scope.dataList.length <=0 ) {
alert('no data');
return;
Expand Down Expand Up @@ -144,11 +149,12 @@ imageMSApp.controller('imageMSCtrl' , function ($scope , imageMSService , common
alert(resMessage[res.status]);
}
});
$scope.$watch("curStudyPage",function(newValue,oldValue){
// your code goes here...
$scope.QIDO();
});
}
$scope.$watch("curStudyPage",function(newValue,oldValue){
// your code goes here...
$scope.isSearched = false;
$scope.QIDO();
});
//#region dowload file function
$scope.downloadStudy = function (iItem) {
let url = `${envConfig.WADO.http}://${envConfig.WADO.hostName}:${envConfig.WADO.port}/${envConfig.WADO.api}/studies/${iItem.studyID}`;
Expand Down Expand Up @@ -272,13 +278,13 @@ imageMSApp.controller('imageMSCtrl' , function ($scope , imageMSService , common
$scope[element] = val ;
}
//????
$scope.studyTablePaginate = function(value) {
/* $scope.studyTablePaginate = function(value) {
let start , end , index ;
start = ($scope.curStudyPage -1 ) * $scope.numStudyPerPage;
end = start + $scope.numStudyPerPage;
index = $scope.dataList.indexOf(value);
return (start <= index && index < end);
}
}*/

$scope.isObject = function (iItem) {
return iItem !== undefined && iItem !== null && iItem.constructor == Object;
Expand All @@ -305,7 +311,9 @@ imageMSApp.service('imageMSService' , function ($http) {
ModalitiesInStudy : $scope.Modality,
PatientName : $scope.PatientName,
PatientID : $scope.PatientID,
StudyInstanceUID : $scope.StudyInstanceUID
StudyInstanceUID : $scope.StudyInstanceUID ,
limit : 10 ,
offset : ($scope.curStudyPage-1) * 10
}
});
return (request.then(handleSuccess , handleError));
Expand Down

0 comments on commit 11354a3

Please sign in to comment.