app.controller('sysLogCtrl', ['$scope', '$http', '$timeout', '$state', '$interval', 'uiGridConstants', 'i18nService', 'toaster', function ($scope, $http, $timeout, $state, $interval, uiGridConstants, i18nService, toaster) { i18nService.setCurrentLang("zh-cn"); moment.locale('zh-cn'); $scope.startTimeOpen = false; $scope.endTimeOpen = false; $scope.timeChange = function (newDate, oldDate) { $scope.startTimeOpen = false; $scope.endTimeOpen = false; }; //查询条件 $scope.query = { searchKey:"", startTime: moment().format("YYYY-MM-DD"), endTime: moment().format("YYYY-MM-DD"), }; // angular 事件绑定 $scope.ngEvent = { quickTime: function (event, passDay) { $scope.query.startTime = moment().add("day", -(passDay - 1)).format("YYYY-MM-DD"); $scope.query.endTime = moment().format("YYYY-MM-DD"); }, //查询 query: function () { if ($scope.query.startTime > $scope.query.endTime) { toaster.pop("info", "提示", "开始时间必须小于结束时间!"); return; } $scope.getPagedDataAsync(); }, }; $scope.getPagedDataAsync = function () { $scope.$broadcast("refreshTableData"); }; }]);