SubsidyauditafteDetailCtrl.js 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. angular.module('push')
  2. .controller('SubsidyauditafteDetailCtrl', function ($scope, $ionicPopup, UserService, $ionicSlideBoxDelegate, $ionicActionSheet, AccountService, $stateParams, ResourceLibraryService, CommentService, UtilService, $timeout, CommonService,ConfigService,taskModuleService) {
  3. console.log($stateParams.id)
  4. $scope.researchCostId = $stateParams.id
  5. $scope.demandreward = $stateParams.list;
  6. $scope.agree = 1;
  7. $scope.checkData = {};
  8. //获取产学研补助审核时的图片
  9. $scope.imageList1 = [];
  10. $scope.imageList2 = [];
  11. $scope.imageList3 = [];
  12. $scope.imageList4 = [];
  13. $scope.imageList5 = [];
  14. $scope.hasAuth = false;
  15. ResourceLibraryService.judgeManager(UserService.id, 10501).then(function (res) {
  16. // console.log(res);
  17. $scope.hasAuth = res.data;
  18. })
  19. $scope.agreeClick = function () {
  20. $scope.agree = 1;
  21. }
  22. $scope.rollClick = function () {
  23. $scope.agree = -2;
  24. }
  25. $scope.checkDemandReward = function () {
  26. if ($scope.agree == -2) {
  27. if ($scope.checkData.refusereason == "" || $scope.checkData.refusereason == null) {
  28. $ionicPopup.alert({
  29. title: '确定',
  30. template: '请填写拒绝理由'
  31. });
  32. return;
  33. }
  34. }
  35. AccountService.submitDemandReward($stateParams.list.id, $scope.agree, $scope.checkData.refusereason,$scope.data.rewardmoney).then(function (res) {
  36. if (res.code == 3350) {
  37. $scope.go('SubsidyauditafteCheck');
  38. }
  39. })
  40. }
  41. //通过technicalcontractid获取TechnicalContract数据
  42. ResourceLibraryService.getresearchcostdetail($scope.researchCostId,$scope.demandreward.restype).then(function (res) {
  43. console.log(res)
  44. if (res.code == 3350) {
  45. console.log(res);
  46. $scope.data = res.data;
  47. $scope.picturelist = JSON.parse(res.data.images);
  48. // console.log($scope.picturelist)
  49. angular.forEach(JSON.parse(res.data.images), function(val){
  50. if(val.remark == "A000000基础信息表"){
  51. $scope.imageList1.push(val)
  52. }
  53. if(val.remark == "A100000年度纳税申报表(A类)"){
  54. $scope.imageList2.push(val)
  55. }
  56. if(val.remark == "A107012研发费用加计扣除优惠明细表"){
  57. $scope.imageList3.push(val)
  58. }
  59. if(val.remark == "上传法定代表人授权委托书"){
  60. $scope.imageList4.push(val)
  61. }
  62. if(val.remark == "上传材料真实性承诺书"){
  63. $scope.imageList5.push(val)
  64. }
  65. })
  66. //判断是否享受过杭州市补助接口
  67. ResourceLibraryService.getenjoysubsidies(res.data.orgCode).then(function (res) {
  68. console.log(res)
  69. $scope.data['subsidies']=res.data
  70. })
  71. }
  72. })
  73. //重置失败状态,失败原因没有实际作用(仅仅便于调一个接口)
  74. $scope.checkDemandRewardAgain = function (demandreward) {
  75. var by2 = $stateParams.list.by2;
  76. AccountService.submitDemandReward($stateParams.list.id, 0, "1").then(function (res) {
  77. if (res.code == 3350) {
  78. $scope.go("toDeclare", {list: $scope.data, picturelist: $scope.picturelist, by2:by2});
  79. }
  80. })
  81. }
  82. $scope.hasAuth = false;
  83. ResourceLibraryService.judgeManager(UserService.id, 10501).then(function (res) {
  84. // console.log(res);
  85. $scope.hasAuth = res.data;
  86. })
  87. //打开操作表:设置/编辑
  88. $scope.openActionSheet = function (data) {
  89. console.log(data);
  90. // isedit:是否可以编辑资源,isset:是否可以设置权限
  91. var buttonlist = [];
  92. buttonlist.push({text: '导出附件zip'});
  93. // buttonlist.push({text: '导出'});
  94. console.log(buttonlist);
  95. if($scope.demandreward.demandstatus == 1){
  96. buttonlist.push({text: '共享'});
  97. }
  98. // else if($scope.demandreward.demandstatus == 8 || $scope.demandreward.demandstatus == 9){
  99. //
  100. // }else {
  101. // buttonlist.push({text: '编辑'});
  102. // }
  103. $ionicActionSheet.show({
  104. buttons: buttonlist,
  105. cancelText: '取消',
  106. buttonClicked: function (index) {
  107. if (buttonlist[index].text == '导出') {
  108. //产学研补助导出功能
  109. taskModuleService.exportCooperationReport(data).then(function (res) {
  110. if (res.code == 3350) {
  111. var file = res.data;
  112. window.open(ConfigService.imgurl + file.sourceName);
  113. return;
  114. } else {
  115. $ionicPopup.alert({
  116. title: '提示',
  117. template: '导出失败!'
  118. })
  119. return;
  120. }
  121. })
  122. return true;
  123. }
  124. if (buttonlist[index].text == '共享') {
  125. taskModuleService.shareCooperationReport($scope.demandreward.id).then(function (res) {
  126. if (res.code == 3350) {
  127. $ionicPopup.alert({
  128. title: '提示',
  129. template: '共享成功!'
  130. })
  131. $scope.go('cooperationSubsidyCheck');
  132. } else {
  133. $ionicPopup.alert({
  134. title: '提示',
  135. template: '共享失败!'
  136. })
  137. return;
  138. }
  139. })
  140. return true;
  141. }
  142. if (buttonlist[index].text == '共享') {
  143. $scope.go("toDeclare", {list: $scope.data, picturelist: $scope.picturelist, by2: 'subsidy'});
  144. }
  145. if (buttonlist[index].text == '导出附件zip') {
  146. var param=[]
  147. console.log($scope.picturelist)
  148. $scope.picturelist.forEach(function (row) {
  149. param.push(ConfigService.imgurl + row.sourceName)
  150. })
  151. $scope.showLoadingToast()
  152. console.log(param)
  153. taskModuleService.usertaskzipsubsidies(param).then(function (res) {
  154. console.log(res)
  155. $scope.hideLoadingToast()
  156. var aEle = document.createElement("a");// 创建a标签
  157. var blob = new Blob([res],{type: "application/zip"});
  158. // aEle.download = item.modelName;// 设置下载文件的文件名
  159. aEle.href = URL.createObjectURL(blob);
  160. aEle.click();// 设置点击事件
  161. })
  162. }
  163. }
  164. });
  165. };
  166. $scope.bigImage = false; //初始默认大图是隐藏的
  167. $scope.hideBigImage = function () {
  168. if ($scope.app) {
  169. $scope.setStatusBar(0);
  170. }
  171. $scope.bigImage = false;
  172. }
  173. $scope.shouBigImage = function (piclist, index) { //传递一个参数(图片的URl)
  174. window.open(ConfigService.imgurl + piclist[index].sourceName);
  175. return;
  176. };
  177. });