technicalCheckDetailCtrl.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. /**
  2. * Created by pushkeji on 2018/8/10.
  3. */
  4. angular.module('push')
  5. .controller('technicalCheckDetailCtrl', ['$scope', '$stateParams', 'AccountService', '$q', 'UserService', '$ionicPopup', '$ionicSlideBoxDelegate', '$timeout', 'dataToolsService', 'ConfigService',function ($scope, $stateParams, AccountService, $q, UserService, $ionicPopup, $ionicSlideBoxDelegate, $timeout,dataToolsService,ConfigService) {
  6. $scope.defaultLan = UserService.defaultLan;
  7. $scope.imageList1 = [];
  8. $scope.imageList2 = [];
  9. $scope.imageList3 = [];
  10. $scope.comefrom = $stateParams.comefrom;
  11. $scope.checkData = {};
  12. $scope.node = UserService.node;
  13. if ($scope.node == '330122000') {
  14. $scope.agree = 1;
  15. } else {
  16. $scope.agree = true;
  17. }
  18. $scope.org = {};
  19. var getTechDemandDetail = function () {
  20. AccountService.getTechDemandDetail($stateParams.id).then(function (res) {
  21. if (res.code == 3350) {
  22. var data = res.data;
  23. $scope.applyname = data.sysUsersInfo.applyname;
  24. $scope.certificate = data.sysUsersInfo.brokercertificate;
  25. $scope.tel = data.sysUsersInfo.tel;
  26. $scope.orgname = data.orgName;
  27. $scope.org.orguser = data.demandReward.orguser;
  28. $scope.org.orgtel = data.demandReward.orgtel;
  29. $scope.projectname = data.sysUsersTaskInfo.projectname;
  30. $scope.capitalScale = data.sysUsersTaskInfo.capitalScale;
  31. $scope.cooperationmodel = data.sysUsersTaskInfo.cooperationmodel;
  32. $scope.taskintroduction = data.sysUsersTaskInfo.taskintroduction;
  33. $scope.demandstatus = data.demandReward.demandstatus;
  34. $scope.refusereason = data.demandReward.refusereason;
  35. $scope.node = data.demandReward.node;
  36. $scope.abutList = data.companyAbutLkList;
  37. $scope.technical = data.technicalContractList[0];
  38. dataToolsService.getCooperationmodelByCode($scope.cooperationmodel).then(function (newRes) {
  39. if (newRes.code == 3350) {
  40. $scope.cooperationmodelInfo = newRes.data;
  41. }
  42. })
  43. angular.forEach(data.systemPictureList, function(val, index){
  44. if(val.title == "上传合作双方认可证明"){
  45. $scope.imageList1.push(val)
  46. }
  47. if(val.title == "上传发票"){
  48. $scope.imageList2.push(val)
  49. }
  50. if(val.title == "上传转账凭证"){
  51. $scope.imageList3.push(val)
  52. }
  53. })
  54. console.log($scope.imageList1);
  55. console.log($scope.imageList2);
  56. console.log($scope.imageList3);
  57. }
  58. })
  59. }
  60. getTechDemandDetail();
  61. $scope.seeTechnicalInfo = function (technical) {
  62. $scope.go('signDemandContractDetail', {contract: technical});
  63. }
  64. $scope.agreeClick = function () {
  65. if ($scope.node != '330122000') {
  66. $scope.agree = true;
  67. } else {
  68. $scope.agree = 1;
  69. }
  70. }
  71. $scope.rollClick = function () {
  72. $scope.agree = -2;
  73. }
  74. $scope.rejectClick = function () {
  75. if ($scope.node != '330122000') {
  76. $scope.agree = false;
  77. } else {
  78. $scope.agree = -1;
  79. }
  80. }
  81. $scope.checkDemandReward = function () {
  82. var value = 0;
  83. if ($scope.node != '330122000') {
  84. if ($scope.agree) {
  85. value = 1;
  86. } else {
  87. value = -1;
  88. }
  89. } else {
  90. if ($scope.agree == 1) {
  91. value = 1;
  92. }
  93. if ($scope.agree == -1) {
  94. value = -1;
  95. }
  96. if ($scope.agree == -2) {
  97. value = -2;
  98. }
  99. }
  100. if (value == -1 || value == -2) {
  101. if ($scope.checkData.refusereason == "" || $scope.checkData.refusereason == null) {
  102. if (value == -1) {
  103. $ionicPopup.alert({
  104. title: '确定',
  105. template: '请填写拒绝理由'
  106. });
  107. }
  108. if (value == -2) {
  109. $ionicPopup.alert({
  110. title: '确定',
  111. template: '请填写退回理由'
  112. });
  113. }
  114. return;
  115. }
  116. }
  117. AccountService.submitDemandReward($stateParams.id, value, $scope.checkData.refusereason).then(function (res) {
  118. if (res.code == 3350) {
  119. $scope.go('technicalRewardCheck');
  120. }
  121. })
  122. }
  123. //重置失败状态,失败原因没有实际作用(仅仅便于调一个接口)
  124. $scope.checkDemandRewardAgain = function () {
  125. AccountService.submitDemandReward($stateParams.id, 0, "1").then(function (res) {
  126. if (res.code == 3350) {
  127. $scope.go('technicalRewardCheck');
  128. }
  129. })
  130. }
  131. $scope.goOnContractInfo = function (contract) {
  132. $scope.go('signDemandContractDetail', {contract: contract});
  133. }
  134. $scope.bigImage = false; //初始默认大图是隐藏的
  135. $scope.hideBigImage = function () {
  136. if ($scope.app) {
  137. $scope.setStatusBar(0);
  138. }
  139. $scope.bigImage = false;
  140. }
  141. $scope.shouBigImage = function (outindex, innerindex) {
  142. if ($scope.app) {
  143. $scope.setStatusBar(1);
  144. }
  145. $scope.bigImageList = $scope.abutList[outindex].photoList;
  146. $scope.bigImage = true; //显示大图
  147. $(function () {
  148. $('div.pinch-zoom').each(function () {
  149. new RTP.PinchZoom($(this), {});
  150. });
  151. });
  152. $ionicSlideBoxDelegate.update();//重绘,让图片显示出来
  153. //图片总数量
  154. setTimeout(function () {
  155. $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(innerindex, 0);
  156. //获取图片
  157. var imgObj = document.getElementsByClassName('bigimage');
  158. var n;
  159. for (n = 0; n < imgObj.length; n++) {
  160. // 获取图片的原始高度和宽度
  161. var oldWid = imgObj[n].naturalWidth;
  162. var oldHei = imgObj[n].naturalHeight;
  163. var screen = document.body.offsetWidth;
  164. var screenH = window.innerHeight;
  165. // console.log(oldWid/oldHei);
  166. // console.log(screen );
  167. var rate = oldWid / oldHei;
  168. if (oldWid >= screen && oldHei >= screenH) {
  169. var tw = screen;
  170. var th = tw / rate;
  171. if (th < screenH) {
  172. imgObj[n].style.width = tw + 'px';
  173. imgObj[n].style.height = th + 'px';
  174. imgObj[n].style.marginTop = (screenH - th) / 2 + 'px';
  175. } else {
  176. imgObj[n].style.width = screenH * rate + 'px';
  177. imgObj[n].style.height = screenH + 'px';
  178. imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
  179. }
  180. } else if (oldWid >= screen && oldHei <= screenH) {
  181. imgObj[n].style.width = screen + 'px';
  182. imgObj[n].style.height = screen / rate + 'px';
  183. imgObj[n].style.marginTop = (screenH - screen / rate) / 2 + 'px';
  184. } else if (oldWid <= screen && oldHei >= screenH) {
  185. // var hh=screenH;
  186. // var ww=screenH*rate;
  187. imgObj[n].style.width = screenH * rate + 'px';
  188. imgObj[n].style.height = screenH + 'px';
  189. imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
  190. } else {
  191. imgObj[n].style.width = oldWid + 'px';
  192. imgObj[n].style.height = oldHei + 'px';
  193. imgObj[n].style.marginLeft = (screen - oldWid) / 2 + 'px';
  194. imgObj[n].style.marginTop = (screenH - oldHei) / 2 + 'px';
  195. }
  196. }
  197. }, 500);
  198. }
  199. $scope.shouBigImage1 = function (index,url) {
  200. if(url.indexOf('.pdf')!=-1){
  201. window.open(ConfigService.imgurl + url)
  202. return
  203. }
  204. if ($scope.app) {
  205. $scope.setStatusBar(1);
  206. }
  207. $scope.bigImageList = $scope.imageList1;
  208. $scope.bigImage = true; //显示大图
  209. $(function () {
  210. $('div.pinch-zoom').each(function () {
  211. new RTP.PinchZoom($(this), {});
  212. });
  213. });
  214. $ionicSlideBoxDelegate.update();//重绘,让图片显示出来
  215. //图片总数量
  216. setTimeout(function () {
  217. $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(index, 0);
  218. //获取图片
  219. var imgObj = document.getElementsByClassName('bigimage');
  220. var n;
  221. for (n = 0; n < imgObj.length; n++) {
  222. // 获取图片的原始高度和宽度
  223. var oldWid = imgObj[n].naturalWidth;
  224. var oldHei = imgObj[n].naturalHeight;
  225. var screen = document.body.offsetWidth;
  226. var screenH = window.innerHeight;
  227. // console.log(oldWid/oldHei);
  228. // console.log(screen );
  229. var rate = oldWid / oldHei;
  230. if (oldWid >= screen && oldHei >= screenH) {
  231. var tw = screen;
  232. var th = tw / rate;
  233. if (th < screenH) {
  234. imgObj[n].style.width = tw + 'px';
  235. imgObj[n].style.height = th + 'px';
  236. imgObj[n].style.marginTop = (screenH - th) / 2 + 'px';
  237. } else {
  238. imgObj[n].style.width = screenH * rate + 'px';
  239. imgObj[n].style.height = screenH + 'px';
  240. imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
  241. }
  242. } else if (oldWid >= screen && oldHei <= screenH) {
  243. imgObj[n].style.width = screen + 'px';
  244. imgObj[n].style.height = screen / rate + 'px';
  245. imgObj[n].style.marginTop = (screenH - screen / rate) / 2 + 'px';
  246. } else if (oldWid <= screen && oldHei >= screenH) {
  247. // var hh=screenH;
  248. // var ww=screenH*rate;
  249. imgObj[n].style.width = screenH * rate + 'px';
  250. imgObj[n].style.height = screenH + 'px';
  251. imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
  252. } else {
  253. imgObj[n].style.width = oldWid + 'px';
  254. imgObj[n].style.height = oldHei + 'px';
  255. imgObj[n].style.marginLeft = (screen - oldWid) / 2 + 'px';
  256. imgObj[n].style.marginTop = (screenH - oldHei) / 2 + 'px';
  257. }
  258. }
  259. }, 500);
  260. }
  261. $scope.shouBigImage2 = function (index,url) {
  262. if(url.indexOf('.pdf')!=-1){
  263. console.log( url)
  264. window.open(ConfigService.imgurl + url)
  265. return
  266. }
  267. if ($scope.app) {
  268. $scope.setStatusBar(1);
  269. }
  270. $scope.bigImageList = $scope.imageList2;
  271. $scope.bigImage = true; //显示大图
  272. $(function () {
  273. $('div.pinch-zoom').each(function () {
  274. new RTP.PinchZoom($(this), {});
  275. });
  276. });
  277. $ionicSlideBoxDelegate.update();//重绘,让图片显示出来
  278. //图片总数量
  279. setTimeout(function () {
  280. $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(index, 0);
  281. //获取图片
  282. var imgObj = document.getElementsByClassName('bigimage');
  283. var n;
  284. for (n = 0; n < imgObj.length; n++) {
  285. // 获取图片的原始高度和宽度
  286. var oldWid = imgObj[n].naturalWidth;
  287. var oldHei = imgObj[n].naturalHeight;
  288. var screen = document.body.offsetWidth;
  289. var screenH = window.innerHeight;
  290. // console.log(oldWid/oldHei);
  291. // console.log(screen );
  292. var rate = oldWid / oldHei;
  293. if (oldWid >= screen && oldHei >= screenH) {
  294. var tw = screen;
  295. var th = tw / rate;
  296. if (th < screenH) {
  297. imgObj[n].style.width = tw + 'px';
  298. imgObj[n].style.height = th + 'px';
  299. imgObj[n].style.marginTop = (screenH - th) / 2 + 'px';
  300. } else {
  301. imgObj[n].style.width = screenH * rate + 'px';
  302. imgObj[n].style.height = screenH + 'px';
  303. imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
  304. }
  305. } else if (oldWid >= screen && oldHei <= screenH) {
  306. imgObj[n].style.width = screen + 'px';
  307. imgObj[n].style.height = screen / rate + 'px';
  308. imgObj[n].style.marginTop = (screenH - screen / rate) / 2 + 'px';
  309. } else if (oldWid <= screen && oldHei >= screenH) {
  310. // var hh=screenH;
  311. // var ww=screenH*rate;
  312. imgObj[n].style.width = screenH * rate + 'px';
  313. imgObj[n].style.height = screenH + 'px';
  314. imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
  315. } else {
  316. imgObj[n].style.width = oldWid + 'px';
  317. imgObj[n].style.height = oldHei + 'px';
  318. imgObj[n].style.marginLeft = (screen - oldWid) / 2 + 'px';
  319. imgObj[n].style.marginTop = (screenH - oldHei) / 2 + 'px';
  320. }
  321. }
  322. }, 500);
  323. }
  324. $scope.shouBigImage3 = function (index,url) {
  325. if(url.indexOf('.pdf')!=-1){
  326. window.open(ConfigService.imgurl + url)
  327. return
  328. }
  329. if ($scope.app) {
  330. $scope.setStatusBar(1);
  331. }
  332. $scope.bigImageList = $scope.imageList3;
  333. $scope.bigImage = true; //显示大图
  334. $(function () {
  335. $('div.pinch-zoom').each(function () {
  336. new RTP.PinchZoom($(this), {});
  337. });
  338. });
  339. $ionicSlideBoxDelegate.update();//重绘,让图片显示出来
  340. //图片总数量
  341. setTimeout(function () {
  342. $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(index, 0);
  343. //获取图片
  344. var imgObj = document.getElementsByClassName('bigimage');
  345. var n;
  346. for (n = 0; n < imgObj.length; n++) {
  347. // 获取图片的原始高度和宽度
  348. var oldWid = imgObj[n].naturalWidth;
  349. var oldHei = imgObj[n].naturalHeight;
  350. var screen = document.body.offsetWidth;
  351. var screenH = window.innerHeight;
  352. // console.log(oldWid/oldHei);
  353. // console.log(screen );
  354. var rate = oldWid / oldHei;
  355. if (oldWid >= screen && oldHei >= screenH) {
  356. var tw = screen;
  357. var th = tw / rate;
  358. if (th < screenH) {
  359. imgObj[n].style.width = tw + 'px';
  360. imgObj[n].style.height = th + 'px';
  361. imgObj[n].style.marginTop = (screenH - th) / 2 + 'px';
  362. } else {
  363. imgObj[n].style.width = screenH * rate + 'px';
  364. imgObj[n].style.height = screenH + 'px';
  365. imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
  366. }
  367. } else if (oldWid >= screen && oldHei <= screenH) {
  368. imgObj[n].style.width = screen + 'px';
  369. imgObj[n].style.height = screen / rate + 'px';
  370. imgObj[n].style.marginTop = (screenH - screen / rate) / 2 + 'px';
  371. } else if (oldWid <= screen && oldHei >= screenH) {
  372. // var hh=screenH;
  373. // var ww=screenH*rate;
  374. imgObj[n].style.width = screenH * rate + 'px';
  375. imgObj[n].style.height = screenH + 'px';
  376. imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px';
  377. } else {
  378. imgObj[n].style.width = oldWid + 'px';
  379. imgObj[n].style.height = oldHei + 'px';
  380. imgObj[n].style.marginLeft = (screen - oldWid) / 2 + 'px';
  381. imgObj[n].style.marginTop = (screenH - oldHei) / 2 + 'px';
  382. }
  383. }
  384. }, 500);
  385. }
  386. }]);