angular.module('push') .controller('SubsidyauditafteDetailCtrl', function ($scope, $ionicPopup, UserService, $ionicSlideBoxDelegate, $ionicActionSheet, AccountService, $stateParams, ResourceLibraryService, CommentService, UtilService, $timeout, CommonService,ConfigService,taskModuleService) { console.log($stateParams.id) $scope.researchCostId = $stateParams.id $scope.demandreward = $stateParams.list; $scope.agree = 1; $scope.checkData = {}; //获取产学研补助审核时的图片 $scope.imageList1 = []; $scope.imageList2 = []; $scope.imageList3 = []; $scope.imageList4 = []; $scope.imageList5 = []; $scope.hasAuth = false; ResourceLibraryService.judgeManager(UserService.id, 10501).then(function (res) { // console.log(res); $scope.hasAuth = res.data; }) $scope.agreeClick = function () { $scope.agree = 1; } $scope.rollClick = function () { $scope.agree = -2; } $scope.checkDemandReward = function () { if ($scope.agree == -2) { if ($scope.checkData.refusereason == "" || $scope.checkData.refusereason == null) { $ionicPopup.alert({ title: '确定', template: '请填写拒绝理由' }); return; } } AccountService.submitDemandReward($stateParams.list.id, $scope.agree, $scope.checkData.refusereason,$scope.data.rewardmoney).then(function (res) { if (res.code == 3350) { $scope.go('SubsidyauditafteCheck'); } }) } //通过technicalcontractid获取TechnicalContract数据 ResourceLibraryService.getresearchcostdetail($scope.researchCostId,$scope.demandreward.restype).then(function (res) { console.log(res) if (res.code == 3350) { console.log(res); $scope.data = res.data; $scope.picturelist = JSON.parse(res.data.images); // console.log($scope.picturelist) angular.forEach(JSON.parse(res.data.images), function(val){ if(val.remark == "A000000基础信息表"){ $scope.imageList1.push(val) } if(val.remark == "A100000年度纳税申报表(A类)"){ $scope.imageList2.push(val) } if(val.remark == "A107012研发费用加计扣除优惠明细表"){ $scope.imageList3.push(val) } if(val.remark == "上传法定代表人授权委托书"){ $scope.imageList4.push(val) } if(val.remark == "上传材料真实性承诺书"){ $scope.imageList5.push(val) } }) //判断是否享受过杭州市补助接口 ResourceLibraryService.getenjoysubsidies(res.data.orgCode).then(function (res) { console.log(res) $scope.data['subsidies']=res.data }) } }) //重置失败状态,失败原因没有实际作用(仅仅便于调一个接口) $scope.checkDemandRewardAgain = function (demandreward) { var by2 = $stateParams.list.by2; AccountService.submitDemandReward($stateParams.list.id, 0, "1").then(function (res) { if (res.code == 3350) { $scope.go("toDeclare", {list: $scope.data, picturelist: $scope.picturelist, by2:by2}); } }) } $scope.hasAuth = false; ResourceLibraryService.judgeManager(UserService.id, 10501).then(function (res) { // console.log(res); $scope.hasAuth = res.data; }) //打开操作表:设置/编辑 $scope.openActionSheet = function (data) { console.log(data); // isedit:是否可以编辑资源,isset:是否可以设置权限 var buttonlist = []; buttonlist.push({text: '导出附件zip'}); // buttonlist.push({text: '导出'}); console.log(buttonlist); if($scope.demandreward.demandstatus == 1){ buttonlist.push({text: '共享'}); } // else if($scope.demandreward.demandstatus == 8 || $scope.demandreward.demandstatus == 9){ // // }else { // buttonlist.push({text: '编辑'}); // } $ionicActionSheet.show({ buttons: buttonlist, cancelText: '取消', buttonClicked: function (index) { if (buttonlist[index].text == '导出') { //产学研补助导出功能 taskModuleService.exportCooperationReport(data).then(function (res) { if (res.code == 3350) { var file = res.data; window.open(ConfigService.imgurl + file.sourceName); return; } else { $ionicPopup.alert({ title: '提示', template: '导出失败!' }) return; } }) return true; } if (buttonlist[index].text == '共享') { taskModuleService.shareCooperationReport($scope.demandreward.id).then(function (res) { if (res.code == 3350) { $ionicPopup.alert({ title: '提示', template: '共享成功!' }) $scope.go('cooperationSubsidyCheck'); } else { $ionicPopup.alert({ title: '提示', template: '共享失败!' }) return; } }) return true; } if (buttonlist[index].text == '共享') { $scope.go("toDeclare", {list: $scope.data, picturelist: $scope.picturelist, by2: 'subsidy'}); } if (buttonlist[index].text == '导出附件zip') { var param=[] console.log($scope.picturelist) $scope.picturelist.forEach(function (row) { param.push(ConfigService.imgurl + row.sourceName) }) $scope.showLoadingToast() console.log(param) taskModuleService.usertaskzipsubsidies(param).then(function (res) { console.log(res) $scope.hideLoadingToast() var aEle = document.createElement("a");// 创建a标签 var blob = new Blob([res],{type: "application/zip"}); // aEle.download = item.modelName;// 设置下载文件的文件名 aEle.href = URL.createObjectURL(blob); aEle.click();// 设置点击事件 }) } } }); }; $scope.bigImage = false; //初始默认大图是隐藏的 $scope.hideBigImage = function () { if ($scope.app) { $scope.setStatusBar(0); } $scope.bigImage = false; } $scope.shouBigImage = function (piclist, index) { //传递一个参数(图片的URl) window.open(ConfigService.imgurl + piclist[index].sourceName); return; }; });