123456789101112131415161718192021222324252627282930313233343536373839 |
- angular.module('push')
- .controller('authoritySetMangerCtrl', function ($scope, AuthorityModel, UtilService) {
- if($scope.app){
- $scope.setStatusBar(0);
- }
- $scope.memberlist = AuthorityModel.getMemberList();
- var adminnum = 0;
- var adminlist = [];
- var countAdminNum = function () {
- adminnum = 0;
- adminlist = [];
- angular.forEach($scope.memberlist, function (value, index) {
- if (value.iscreator == 2) {
- adminnum++;
- adminlist.push(value);
- }
- });
- AuthorityModel.setAdminList(adminlist);
- };
- countAdminNum();
- $scope.chooseAdmin = function (member, index) {
- // console.log(adminnum);
- if ($scope.memberlist[index].iscreator == 1) {
- return;
- }
- if ($scope.memberlist[index].iscreator == 2) {
- $scope.memberlist[index].iscreator = 0;
- } else {
- if (adminnum == 5) {
- UtilService.showMess("请设置5个以内管理员!");
- return;
- }
- $scope.memberlist[index].iscreator = 2;
- }
- countAdminNum();
- };
- });
|