realTimeData.js 1.81 KB
/**
 * Created by cjl on 2018/4/24.
 */
(function () {
    "user strict";

    var railwayController = function($scope,$modal,$http,$interval,dialogService,railwayService){
        $scope.$emit('settingShow', 1);
        $scope.vm = {
            totalCount : 0,
            pageNumber : 1,
            pageSize : 10,
            userId : '',
            type:"LAID_ON"
        }
        $scope.getList = function(){
            railwayService.findEscortAttendanceReal($scope.vm).success(function(data){
                if (data.errors == null || data.errors.length > 0) {
                    dialogService.tip(data.errors);
                }else{
                    $scope.userAttendanceList = data.result;
                    for(var i =0 ;i< $scope.userAttendanceList.length;i++){
                        if ($scope.userAttendanceList[i].lastUpdateTime != null) {
                            var time = new Date(Number($scope.userAttendanceList[i].lastUpdateTime));
                            $scope.userAttendanceList[i].lastUpdateTime = time.format("yyyy-MM-dd hh:mm:ss ");
                        }
                    }
                    // debugger
                    $scope.vm.totalCount = data.totalCount;
                }
            })
        }
        $scope.getList();
        // var timer=$interval(function(){
        //     $scope.getList();
        // },10000);   //间隔2秒定时执行

        // timer.then(function(){ console.log('查询成功')},
        //     function(){ console.log('查询不成功')});
        $scope.doSearch = function(){
            $scope.vm.pageNumber = 1;
            $scope.getList();
        }
    };

    angular.module("xn.page", ["xn.directive.form"])
        .controller("RailwayController",["$scope","$modal","$http","$interval","dialogService","RailwayService",railwayController])
})();