123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- angular.module('push')
- .controller('CloudAuthoritySetCtrl', function ($scope, UtilService, CloudFolderService, $timeout, AuthorityModelService) {
- $scope.cloudfolder = {name: "", authoritylist: ""};
- //权限列表初始化
- var getAuthorityList = function () {
- $scope.showLoadingToast();
- CloudFolderService.getCloudAutListForFolder("").then(function (response) {
- if(angular.isDefined(response.cloautlist)){
- $scope.AuthorityList = response.cloautlist;
- }else {
- $scope.AuthorityList = [];
- }
- $scope.hideLoadingToast();
- }, function () {
- $scope.hideLoadingToast();
- $scope.AuthorityList = [];
- UtilService.showMess("网络不给力,请稍后重试");
- })
- };
- getAuthorityList();
- $scope.chooseNewUndid = function (Authority, index) {
- $scope.AuthorityList[index].checked = !$scope.AuthorityList[index].checked;
- };
- $scope.saveCloudFolder = function () {
- if(!UtilService.isDefined($scope.cloudfolder.name)){
- UtilService.showMess("文件夹名称不能为空");
- return;
- }
- $scope.cloudfolder.authoritylist = "";
- angular.forEach($scope.AuthorityList, function (data, index) {
- if (data.checked) {
- var tempstr = data.id + ":" + data.comefrom;
- if ($scope.cloudfolder.authoritylist.length == 0) {
- $scope.cloudfolder.authoritylist = tempstr;
- } else {
- $scope.cloudfolder.authoritylist = $scope.cloudfolder.authoritylist + "," + tempstr;
- }
- }
- });
- if(!UtilService.isDefined($scope.cloudfolder.authoritylist)){
- UtilService.showMess("权限不能为空");
- return;
- }
- $scope.showLoadingToast();
- // console.log($scope.cloudfolder);
- CloudFolderService.createCloudFolder($scope.cloudfolder).then(function (response) {
- UtilService.showMess("新建成功");
- $timeout(function () {
- $scope.goback();
- }, 1500);
- $scope.hideLoadingToast();
- }, function () {
- $scope.hideLoadingToast();
- UtilService.showMess("网络不给力,请稍后重试");
- })
- };
- //创建权限
- $scope.creatAuthority = function () {
- AuthorityModelService.resetData();
- $scope.go('creatAuthority');
- };
- });
|