advice.js 3.72 KB
/**
 * Created by 王冠伦 on 2018/2/26.
 */
(function () {
    "user strict";

    var railwayController = function($scope,$modal,$http,$interval,$filter,dialogService,railwayService){
        $scope.$emit('navShow', 5);
        $scope.vm = {
            pageSize : 10,
            totalCount : 0,
            pageNumber : 1
        }
        /*$scope.names = [
            {name : "上报时间", value : 0},
            {name : "用户", value : 1},
            {name : "车站名", value : 2},
            {name : "事件类型", value : 3}
        ]

        $scope.change = function(){
            var condition = $scope.condition;
            $scope.date = true;
            if (condition.value != 0){
                $scope.date = !$scope.date;
            }
            $scope.content1 = "";
            $scope.content = "";
        }*/

        $scope.searchByCondition = function(){
            if ($scope.vm.createTime != null){
                var createTime = $scope.vm.createTime;
                $scope.vm.createTime = $filter('date')(createTime, 'yyyy-MM-dd');
            }
            $scope.getList();
        }

        $scope.getList = function(){
            railwayService.findEventByCondition($scope.vm).success(function(data){
                if (data.errors == null || data.errors.length > 0) {
                    dialogService.tip(data.errors);
                }else{
                    $scope.eventList = data.result;
                    for(var i =0 ;i< $scope.eventList.length;i++){
                        if ($scope.eventList[i].isHandled != null) {
                            if($scope.eventList[i].isHandled == "1"){
                                $scope.eventList[i].isHandled = "已处理";
                            }else if($scope.eventList[i].isHandled == "0"){
                                $scope.eventList[i].isHandled = "处理中";
                            }
                        }/*
                        if ($scope.eventList[i].type != null) {
                            if($scope.eventList[i].type == "STATION"){
                                $scope.eventList[i].type = "车站事件";
                            }else if($scope.eventList[i].type == "CARRIAGE"){
                                $scope.eventList[i].type = "车厢事件";
                            }else if($scope.eventList[i].type == "GOOD"){
                                $scope.eventList[i].type = "好人好事";
                            }
                        }*/
                    }
                    $scope.vm.totalCount = data.totalCount;
                    $scope.settingShow = 2;
                }
            })
        }
        $scope.getList();

        $scope.openSubmitTimeFrom = function ($event) {
            $event.preventDefault();
            $event.stopPropagation();
            $scope.submitTimeFrom = true;
        };

        //弹出式日历触发函数
        $scope.openFDate = function($event) {
            $event.preventDefault();
            $event.stopPropagation();
            $scope.fromDate = true;
        };
        $scope.openTDate = function($event) {
            $event.preventDefault();
            $event.stopPropagation();
            $scope.toDate = true;
        };
        $scope.startDate = function ($event) {
            $event.preventDefault();
            $event.stopPropagation();
            $scope.startTime = true;
        };
        $scope.endDate = function ($event) {
            $event.preventDefault();
            $event.stopPropagation();
            $scope.endTime = true;
        };
    }

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