SendMessagesController.js
2.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
"use strict";
var sendMessagesController = angular.module('sendMessagesController',[]);
sendMessagesController.controller('sendMessagesController', [
'$rootScope',
'$scope',
'SendMessagesService',
function($rootScope, $scope, SendMessagesService) {
$scope.operationType=$rootScope.$stateParams.operationType;
$scope.currentPage = 1;
$scope.numPages = 1;
$scope.pageSize = 20;
$scope.totalRecord = 0;
$scope.pages = [];
$scope.operations=[];
$scope.condition={
operationUser:'',
operationObject:'',
operationContent:'',
operationType:$scope.operationType,
startDate:'',
endDate:'',
pageNow:1,
pageSize:20
};
SendMessagesService.operationPager($scope.condition);
$scope.$on('operation.list',function(){
$scope.operations=SendMessagesService.operations.datas;
$scope.numPages=SendMessagesService.operations.totalPage;
$scope.totalRecord=SendMessagesService.operations.totalRecord;
$("#messageShow").show();
$("#basicform").hide();
});
//选当前页
$scope.onSelectPage = function(page) {
$scope.condition.pageNow=page;
$scope.currentPage=page;
SendMessagesService.operationPager($scope.condition);
};
$scope.searchOperation=function(){
$scope.condition.pageNow=1;
$scope.condition.startDate = $('#datepickfrom').val();
$scope.condition.endDate = $('#datepickto').val();
SendMessagesService.operationPager($scope.condition);
};
$scope.sms={
phone:'',
content:''
};
$scope.smsFunc = function () {
$("#messageShow").hide();
$("#basicform").show();
};
$scope.onSubmitSms = function () {
if(confirm("确认发送短信给[" + $scope.sms.phone + "]?")) {
SendMessagesService.sendSms($scope.sms,function(res){
if(res){
SendMessagesService.operationPager($scope.condition);
$scope.$on('operation.list',function(){
$scope.operations=SendMessagesService.operations.datas;
$scope.numPages=SendMessagesService.operations.totalPage;
$scope.totalRecord=SendMessagesService.operations.totalRecord;
$("#messageShow").show();
$("#basicform").hide();
});
}
});
}
};
}]
);