wujingTechnicalDetailCtrl.js 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /**
  2. * Created by pushkeji on 2018/8/16.
  3. */
  4. angular.module('push')
  5. .controller('wujingTechnicalDetailCtrl', ['$scope', '$stateParams', '$ionicActionSheet', '$ionicLoading', '$ionicScrollDelegate', 'UtilService', 'dataToolsService', '$sce', 'AccountService', 'UserService', '$ionicSlideBoxDelegate', '$timeout', '$state', '$http', 'ConfigService', 'CommonService', '$ionicPopup', 'ResourceLibraryService', 'taskModuleService', 'ScienceCircleService', '$ionicModal', '$q', function ($scope, $stateParams, $ionicActionSheet, $ionicLoading, $ionicScrollDelegate, UtilService, dataToolsService, $sce, AccountService, UserService, $ionicSlideBoxDelegate, $timeout, $state, $http, ConfigService, CommonService, $ionicPopup, ResourceLibraryService, taskModuleService, ScienceCircleService, $ionicModal, $q) {
  6. $scope.resource = $stateParams.resource;
  7. taskModuleService.thisUserIsAdmin().then(function (res) {
  8. if (res.code == 3350) {
  9. $scope.isAdmin = res.data;
  10. }
  11. })
  12. ResourceLibraryService.getResourceByID($scope.resource.unique).then(function (res1) {
  13. if(res1.code == 3350){
  14. taskModuleService.judgeUserInOrg(res1.data.oid).then(function (res2) {
  15. if (res2.code == 3350) {
  16. $scope.isuserInOrg = res2.data;
  17. }
  18. })
  19. }
  20. })
  21. var unionOtherOrgList = function () {
  22. ResourceLibraryService.unionOtherOrgList($scope.resource.title).then(function (res1) {
  23. if (res1.code == 3350) {
  24. $scope.viceorglist = res1.data;
  25. }
  26. })
  27. ResourceLibraryService.getResourceByID($scope.resource.unique).then(function (res2) {
  28. if (res2.code == 3350) {
  29. $scope.res = res2.data;
  30. if ($scope.res.orgscale != null) {
  31. ResourceLibraryService.getTypeentryByCode($scope.res.orgscale).then(function (res4) {
  32. if (res4.code == 3350) {
  33. $scope.orgscale = res4.data.itemkey;
  34. }
  35. })
  36. }
  37. $scope.category = "";
  38. if ($scope.res.category != null && $scope.res.category != undefined && $scope.res.category != '') {
  39. ResourceLibraryService.getCategoryByCode($scope.res.category).then(function (res5) {
  40. if (res5.code == 3350) {
  41. $scope.category = res5.data.name;
  42. }
  43. })
  44. }
  45. }
  46. })
  47. }
  48. unionOtherOrgList();
  49. $scope.completeOrgInfo = function (org) {
  50. ResourceLibraryService.getConnId(org.name).then(function (res) {
  51. if (res.code == 3350) {
  52. if (res.data.id == null || res.data.id == '') {
  53. $scope.go('visitModularForm', {
  54. companyid: org.id,
  55. pageid: 1,
  56. orgtype: 10104,
  57. pagecode: 1000003,
  58. isedit: 0,
  59. node: UserService.node,
  60. pageTitle: '新增企业信息',
  61. title: org.name
  62. });
  63. } else {
  64. $scope.go('visitModularForm', {
  65. companyid: org.id,
  66. pageid: 1,
  67. orgtype: 10104,
  68. isedit: 1,
  69. connid: res.data.id,
  70. pagecode: 1000003,
  71. node: UserService.node,
  72. pageTitle: '完善企业信息',
  73. title: org.name
  74. });
  75. }
  76. }
  77. })
  78. }
  79. $scope.goback1 = function (){
  80. $scope.go('wujingTechnical');
  81. }
  82. $scope.goOrgDetail = function (org) {
  83. taskModuleService.getResourceByDemandName(org.name,"320412000").then(function (res) {
  84. if (res.code == 3350) {
  85. var resource = res.data;
  86. if (resource.groupid == "0") {
  87. $scope.go('resourceDetails', {
  88. recourceid: resource.id,
  89. recourcetype: resource.restype,
  90. recourcecomefrom: resource.comefrom,
  91. title: resource.title
  92. });
  93. } else {
  94. $scope.go('resourceCommonDetailsPage', {
  95. recourceid: resource.id,
  96. recourcetype: resource.restype,
  97. recourcecomefrom: resource.comefrom,
  98. creator: resource.creator,
  99. title: resource.title,
  100. orgtype: 0,
  101. pagecode: 0
  102. });
  103. }
  104. }
  105. })
  106. }
  107. $scope.deleteorg = function (org) {
  108. ResourceLibraryService.getOrgByName($scope.resource.title,"320412000").then(function (res1) {
  109. if (res1.code == 3350) {
  110. ResourceLibraryService.deleteorg(res1.data.id, org.id).then(function (res2) {
  111. if (res2.code == 3350) {
  112. unionOtherOrgList();
  113. }
  114. })
  115. }
  116. })
  117. }
  118. }])
  119. ;