angular.module('push') .controller('selectFieldsToSetCtrl', function ($scope, $timeout, $stateParams, ResourceLibraryService, UserService, $ionicHistory,$state) { // 权限默认公开 $scope.ispublic = 2; //TODO $scope.defaultLan = UserService.defaultLan; // 记录id,由前一页面传递过来 console.log($stateParams.typecode); $scope.resid = $stateParams.resid; // 记录表对应的code $scope.typecode = $stateParams.typecode; // $scope.resid = 1; $scope.fieldGroups = []; //加载等待页 $scope.isloadingPageFloor = false; //加载失败页 $scope.isloadingPageFail = false; // 初始化设置界面 // 详情所有板块包括字段对应的code,由详情页传递 //TODO $scope.typecodemap = $stateParams.typecodemap; /*$scope.typecodemap= { "30001": [//表code 1// 表id ]/!*, "30002": [ 2,3 ]*!/ };*/ var getSetModuleAuthorityList = function () { $scope.isloadingPageFloor = true; console.log(angular.toJson($scope.typecodemap)); ResourceLibraryService.getSetModuleAuthorityList(angular.toJson($scope.typecodemap)).then(function (response) { console.log(response); $scope.fieldGroups = response.data; $scope.isloadingPageFloor = false; $scope.isloadingPageFail = false; $timeout(function () { //默认第一个展开 $scope.fieldGroups[0].isCecked = true; }) }, function () { $scope.isloadingPageFloor = false; $scope.isloadingPageFail = true; }); }; getSetModuleAuthorityList(); //重新加载 $scope.repeatLoad = function () { $scope.isloadingPageFail = false; getSetModuleAuthorityList(); }; //收缩切换 $scope.selectModelShow = function (index) { $scope.fieldGroups[index].isCecked = !$scope.fieldGroups[index].isCecked; }; //进入谁可以看界面 $scope.goSelectWhoSee = function (authorityid, authname, rescode, ispublic, resid) { $scope.go('selectWhoSee', { authorityid: authorityid, authname: authname, ispublic: ispublic, creator: UserService.id, updater: UserService.id, resid: resid, rescode: rescode }); }; // 点击保存进入新的页面t $scope.gotoInfoListPage = function () { if($stateParams.pagetitle == "新建创新创业联盟库"){ $ionicHistory.goBack(-3); }else{ $ionicHistory.goBack(-2); // $state.go('tab.activityIndex') } // if($stateParams.comfrom=='resourceLibrary'){ // $scope.go('resourceCommonDetailsPage',{ // recourcecomefrom:$stateParams.node, // recourceid:$stateParams.resid, // recourcetype:$stateParams.templettype, // title:$stateParams.title, // comfrom:$stateParams.comfrom // }) // }else if($stateParams.comfrom=='privateResource'){ // $ionicHistory.goBack(-2); // }else{ // $scope.go('technicalBrokerEnterCompanyInfo'); // } }; });