unionDetailCtrl.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /**
  2. * Created by pushkeji on 2018/10/11.
  3. */
  4. angular.module('push')
  5. .controller('unionDetailCtrl', ['$scope', '$stateParams', '$ionicActionSheet', '$ionicLoading', '$ionicScrollDelegate', 'UtilService', 'dataToolsService', '$sce', 'UserService', '$ionicSlideBoxDelegate', '$timeout', '$state', '$http', 'ConfigService', '$ionicPopup', 'ResourceLibraryService', 'taskModuleService', 'ScienceCircleService', '$ionicModal', '$q', function ($scope, $stateParams, $ionicActionSheet, $ionicLoading, $ionicScrollDelegate, UtilService, dataToolsService, $sce, UserService, $ionicSlideBoxDelegate, $timeout, $state, $http, ConfigService, $ionicPopup, ResourceLibraryService, taskModuleService, ScienceCircleService, $ionicModal, $q) {
  6. var unionInfo = {};
  7. var getUnionList = function () {
  8. taskModuleService.unionList().then(function (res) {
  9. if (res.code == 3350) {
  10. if (res.data.length == 0) {
  11. $scope.name = "武进区科技创新创业联盟";
  12. } else {
  13. var data = res.data[0];
  14. $scope.name = data.name;
  15. $scope.content = data.content;
  16. $scope.viceorgList = [];
  17. $scope.tel = data.tel;
  18. if (data.org != null && data.org != undefined && data.org != "") {
  19. dataToolsService.getOrganizationModelByOrgid(data.org).then(function (orgres) {
  20. if (orgres.code == 3350) {
  21. $scope.org = orgres.data.name;
  22. }
  23. })
  24. }
  25. if (data.viceorg != null && data.viceorg != undefined && data.viceorg != "") {
  26. var viceorgArr = data.viceorg.split(',');
  27. angular.forEach(viceorgArr, function (val, index) {
  28. if (val != "") {
  29. dataToolsService.getOrganizationModelByOrgid(val).then(function (orgres1) {
  30. if (orgres1.code == 3350) {
  31. $scope.viceorgList.push(orgres1.data.name);
  32. }
  33. })
  34. }
  35. })
  36. }
  37. }
  38. }
  39. })
  40. }
  41. getUnionList();
  42. //当前登陆用户是否是管理员
  43. var thisUserIsAdmin = function () {
  44. taskModuleService.thisUserIsAdmin().then(function (res) {
  45. if (res.code == 3350) {
  46. $scope.isAdmin = res.data;
  47. }
  48. })
  49. }
  50. thisUserIsAdmin();
  51. $scope.editUnion = function () {
  52. unionInfo.name = $scope.name;
  53. unionInfo.content = $scope.content;
  54. unionInfo.tel = $scope.tel;
  55. unionInfo.org = $scope.org;
  56. unionInfo.viceorgList = $scope.viceorgList;
  57. $scope.go("unionIntroduction", {union: unionInfo});
  58. }
  59. }
  60. ])
  61. ;