Support query message by page (#688)

This commit is contained in:
Demogorgon314
2021-03-11 18:24:11 +08:00
committed by GitHub
parent be476bc146
commit c440b443a5
11 changed files with 831 additions and 39 deletions

View File

@@ -43,6 +43,8 @@ module.controller('messageController', ['$scope', 'ngDialog', '$http','Notificat
$scope.timepickerEnd = moment().add(1,'hour').format('YYYY-MM-DD HH:mm');
$scope.timepickerOptions ={format: 'YYYY-MM-DD HH:mm', showClear: true};
$scope.taskId = "";
$scope.paginationConf = {
currentPage: 1,
totalItems: 0,
@@ -51,10 +53,44 @@ module.controller('messageController', ['$scope', 'ngDialog', '$http','Notificat
perPageOptions: [10],
rememberPerPage: 'perPageItems',
onChange: function () {
$scope.changeShowMessageList(this.currentPage,this.totalItems);
$scope.queryMessagePageByTopic()
}
};
$scope.queryMessagePageByTopic = function () {
if ($scope.timepickerEnd < $scope.timepickerBegin) {
Notification.error({message: "endTime is later than beginTime!", delay: 2000});
return
}
if( $scope.selectedTopic === [] || (typeof $scope.selectedTopic) == "object"){
return
}
$http({
method: "POST",
url: "message/queryMessagePageByTopic.query",
data: {
topic: $scope.selectedTopic,
begin: $scope.timepickerBegin.valueOf(),
end: $scope.timepickerEnd.valueOf(),
pageNum: $scope.paginationConf.currentPage,
pageSize: $scope.paginationConf.itemsPerPage,
taskId: $scope.taskId
}
}).success(function (resp) {
if (resp.status === 0) {
console.log(resp);
$scope.messageShowList = resp.data.page.content;
if(resp.data.page.first){
$scope.paginationConf.currentPage = 1;
}
$scope.paginationConf.currentPage = resp.data.page.number + 1;
$scope.paginationConf.totalItems = resp.data.page.totalElements;
$scope.taskId = resp.data.taskId
}else {
Notification.error({message: resp.errMsg, delay: 2000});
}
});
}
$scope.queryMessageByTopic = function () {
console.log($scope.selectedTopic);
@@ -153,7 +189,6 @@ module.controller('messageController', ['$scope', 'ngDialog', '$http','Notificat
});
};
$scope.changeShowMessageList = function (currentPage,totalItem) {
var perPage = $scope.paginationConf.itemsPerPage;
var from = (currentPage - 1) * perPage;
@@ -161,6 +196,13 @@ module.controller('messageController', ['$scope', 'ngDialog', '$http','Notificat
$scope.messageShowList = $scope.queryMessageByTopicResult.slice(from, to);
$scope.paginationConf.totalItems = totalItem ;
};
$scope.onChangeQueryCondition = function (){
console.log("change")
$scope.taskId = "";
$scope.paginationConf.currentPage = 1;
$scope.paginationConf.totalItems = 0;
}
}]);
module.controller('messageDetailViewDialogController',['$scope', 'ngDialog', '$http','Notification', function ($scope, ngDialog, $http,Notification) {

View File

@@ -21,7 +21,7 @@
<md-tabs md-dynamic-height="" md-border-bottom="">
<md-tab label="Topic">
<md-content class="md-padding" style="min-height:600px">
<h5 class="md-display-5">Only Return 2000 Messages</h5>
<h5 class="md-display-5">Total {{paginationConf.totalItems}} Messages</h5>
<div class="row">
<form class="form-inline pull-left col-sm-12">
<div class="form-group">
@@ -32,6 +32,7 @@
<select name="mySelectTopic" chosen
ng-model="selectedTopic"
ng-options="item for item in allTopicList"
ng-change="onChangeQueryCondition()"
required>
<option value=""></option>
</select>
@@ -40,7 +41,7 @@
<div class="form-group ">
<label>{{'BEGIN' | translate}}:</label>
<div class="input-group">
<input class="form-control" datetimepicker ng-model="timepickerBegin"
<input class="form-control" datetimepicker ng-change="onChangeQueryCondition()" ng-model="timepickerBegin"
options="timepickerOptions"/>
<span class="input-group-addon"><span
class="glyphicon glyphicon-calendar"></span></span>
@@ -49,7 +50,7 @@
<div class="form-group">
<label>{{'END' | translate}}:</label>
<div class="input-group">
<input class="form-control" datetimepicker ng-model="timepickerEnd"
<input class="form-control" datetimepicker ng-change="onChangeQueryCondition()" ng-model="timepickerEnd"
options="timepickerOptions"/>
<span class="input-group-addon"><span
class="glyphicon glyphicon-calendar"></span></span>
@@ -58,7 +59,7 @@
<button id="searchAppsButton" type="button"
class="btn btn-raised btn-sm btn-primary"
data-toggle="modal"
ng-click="queryMessageByTopic()">
ng-click="queryMessagePageByTopic()">
<span class="glyphicon glyphicon-search"></span>{{ 'SEARCH' | translate}}
</button>
</form>