app_touchmedia
.controller("AdminSingboardsCtrl", ["$scope", "Common", "Config","Signboards", function ($scope, Common, Config,Signboards) {
	// 监控列表数据
    $scope.$watch(function () {
        return Signboards.getDatas();
    }, function (json) {
        $scope.currentPageStores = json.data;

        if (json.currentPage > 1) {
            return false;
        }
        // 以下变量不能重复赋值,否则会出现页码跳转会一直跳转至第1页
        $scope.totalItems = json.totalFound;
        $scope.foundRecordNum = json.totalFound;
        $scope.totalRecordNum = json.total;
        
        $scope.numPerPage = Config.pageSize;
        $scope.numPerPageOpt = Config.numPerPageOptions;
        $scope.currentPage = 1;

    });
    Signboards.getList(1, Config.pageSize);
    
    $scope.showDetail = function($event){
    		  	
    };

    
 // 更改每页显示记录数
    $scope.onNumPerPageChange = function () {
    	Signboards.getList(1, $scope.numPerPage);
    };

    // 页码点击事件
    $scope.select = function (currentPage) {
    	Signboards.getList(currentPage, $scope.numPerPage);
    };
    $scope.finish = function(id){
    	
    	Signboards.resource().get({id: id}, function (data) {
          if (data.error == 0) {
          	Common.dialog('modalSingboard.html', 'ModalSingboardCtrl', data.data);
          }
      });
    }
    
    //查询
    $scope.search = function () {
    	
    	
    	key = new Array();
    	key['project_name'] = $scope.project_name;
    	key['status'] = $scope.status;
    	key['appo_status'] = $scope.appo_status;
    	Singboards.getList(1, Config.pageSize,key);
    };
}])

