techDemandCheckDetailCtrl.js 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. /**
  2. * Created by pushkeji on 2018/8/10.
  3. */
  4. angular.module('push')
  5. .controller('techDemandCheckDetailCtrl', ['$scope', '$stateParams', 'AccountService', '$q', 'UserService', '$ionicPopup', 'dataToolsService', '$ionicSlideBoxDelegate', '$timeout', function ($scope, $stateParams, AccountService, $q, UserService, $ionicPopup, dataToolsService, $ionicSlideBoxDelegate, $timeout) {
  6. $scope.defaultLan = UserService.defaultLan;
  7. $scope.checkData = {};
  8. $scope.node = UserService.node;
  9. if ($scope.node == '330122000') {
  10. $scope.agree = 1;
  11. } else {
  12. $scope.agree = true;
  13. }
  14. var getTechDemandDetail = function () {
  15. AccountService.getTechDemandDetail($stateParams.id).then(function (res) {
  16. if (res.code == 3350) {
  17. var data = res.data;
  18. $scope.applyname = data.sysUsersInfo.applyname;
  19. $scope.tel = data.sysUsersInfo.tel;
  20. $scope.certificate = data.sysUsersInfo.brokercertificate;
  21. $scope.orgtel = data.demandReward.orgtel;
  22. $scope.orguser = data.demandReward.orguser;
  23. $scope.demandname = data.demandReward.demandname;
  24. $scope.demandcontent = data.demandReward.demandcontent;
  25. $scope.capitalScale = data.sysUsersTaskInfo.capitalScale;
  26. $scope.cooperationmodel = data.sysUsersTaskInfo.cooperationmodel;
  27. $scope.createtime = data.demandReward.createtime;
  28. $scope.orgname = data.orgName;//用作存放企业名
  29. $scope.demandstatus = data.demandReward.demandstatus;
  30. $scope.refusereason = data.demandReward.refusereason;
  31. $scope.node = data.demandReward.node;
  32. $scope.abutList = data.companyAbutLkList;
  33. if(data.demandReward.creator != UserService.id){
  34. $scope.resubmitShow = false;
  35. }else{
  36. $scope.resubmitShow = true;
  37. }
  38. dataToolsService.getCooperationmodelByCode($scope.cooperationmodel).then(function (newRes) {
  39. if (newRes.code == 3350) {
  40. $scope.cooperationmodelInfo = newRes.data;
  41. }
  42. })
  43. }
  44. })
  45. }
  46. getTechDemandDetail();
  47. $scope.bigImage = false; //初始默认大图是隐藏的
  48. $scope.hideBigImage = function () {
  49. if ($scope.app) {
  50. $scope.setStatusBar(0);
  51. }
  52. $scope.bigImage = false;
  53. }
  54. $scope.shouBigImage = function (outindex, innerindex) {
  55. if ($scope.app) {
  56. $scope.setStatusBar(1);
  57. }
  58. $scope.bigImageList = $scope.abutList[outindex].photoList;
  59. $scope.bigImage = true; //显示大图
  60. $(function () {
  61. $('div.pinch-zoom').each(function () {
  62. new RTP.PinchZoom($(this), {});
  63. });
  64. });
  65. $ionicSlideBoxDelegate.update();//重绘,让图片显示出来
  66. //图片总数量
  67. setTimeout(function () {
  68. $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(innerindex, 0);
  69. //获取图片
  70. var imgObj = document.getElementsByClassName('bigimage');
  71. var n;
  72. for (n = 0; n < imgObj.length; n++) {
  73. // 获取图片的原始高度和宽度
  74. var oldWid = imgObj[n].naturalWidth;
  75. var oldHei = imgObj[n].naturalHeight;
  76. var screen = document.body.offsetWidth;
  77. var screenH = window.innerHeight;
  78. // console.log(oldWid/oldHei);
  79. // console.log(screen );
  80. var rate = oldWid / oldHei;
  81. if (oldWid >= screen && oldHei >= screenH) {
  82. var tw = screen;
  83. var th = tw / rate;
  84. if (th < screenH) {
  85. imgObj[n].style.width = tw + 'px';
  86. imgObj[n].style.height = th + 'px';
  87. imgObj[n].style.marginTop = (screenH - th) / 2 + 'px';
  88. } else {
  89. imgObj[n].style.width = screenH * rate + 'px';
  90. imgObj[n].style.height = screenH + 'px';
  91. imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
  92. }
  93. } else if (oldWid >= screen && oldHei <= screenH) {
  94. imgObj[n].style.width = screen + 'px';
  95. imgObj[n].style.height = screen / rate + 'px';
  96. imgObj[n].style.marginTop = (screenH - screen / rate) / 2 + 'px';
  97. } else if (oldWid <= screen && oldHei >= screenH) {
  98. // var hh=screenH;
  99. // var ww=screenH*rate;
  100. imgObj[n].style.width = screenH * rate + 'px';
  101. imgObj[n].style.height = screenH + 'px';
  102. imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
  103. } else {
  104. imgObj[n].style.width = oldWid + 'px';
  105. imgObj[n].style.height = oldHei + 'px';
  106. imgObj[n].style.marginLeft = (screen - oldWid) / 2 + 'px';
  107. imgObj[n].style.marginTop = (screenH - oldHei) / 2 + 'px';
  108. }
  109. }
  110. }, 500);
  111. }
  112. $scope.agreeClick = function () {
  113. if ($scope.node != '330122000') {
  114. $scope.agree = true;
  115. } else {
  116. $scope.agree = 1;
  117. }
  118. }
  119. $scope.rollClick = function () {
  120. $scope.agree = -2;
  121. }
  122. $scope.rejectClick = function () {
  123. if ($scope.node != '330122000') {
  124. $scope.agree = false;
  125. } else {
  126. $scope.agree = -1;
  127. }
  128. }
  129. $scope.checkDemandReward = function () {
  130. var value = 0;
  131. if ($scope.node != '330122000') {
  132. if ($scope.agree) {
  133. value = 1;
  134. } else {
  135. value = -1;
  136. }
  137. } else {
  138. if ($scope.agree == 1) {
  139. value = 1;
  140. }
  141. if ($scope.agree == -1) {
  142. value = -1;
  143. }
  144. if ($scope.agree == -2) {
  145. value = -2;
  146. }
  147. }
  148. if (value == -1 || value == -2) {
  149. if ($scope.checkData.refusereason == "" || $scope.checkData.refusereason == null) {
  150. if (value == -1) {
  151. $ionicPopup.alert({
  152. title: '确定',
  153. template: '请填写拒绝理由'
  154. });
  155. }
  156. if (value == -2) {
  157. $ionicPopup.alert({
  158. title: '确定',
  159. template: '请填写退回理由'
  160. });
  161. }
  162. return;
  163. }
  164. }
  165. AccountService.submitDemandReward($stateParams.id, value, $scope.checkData.refusereason).then(function (res) {
  166. if (res.code == 3350) {
  167. $scope.go('demandRewardCheck');
  168. }
  169. })
  170. }
  171. //重置失败状态,失败原因没有实际作用(仅仅便于调一个接口)
  172. $scope.checkDemandRewardAgain = function () {
  173. AccountService.submitDemandReward($stateParams.id, 0, "1").then(function (res) {
  174. if (res.code == 3350) {
  175. $scope.go('demandRewardCheck');
  176. }
  177. })
  178. }
  179. }]);