123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- angular.module('push')
- .controller('cooperateDetailCtrl', function ($scope, $ionicPopup, UserService, $ionicSlideBoxDelegate, $ionicActionSheet, AccountService, $stateParams, ResourceLibraryService, CommentService, UtilService, $timeout, CommonService,ConfigService,taskModuleService) {
- $scope.technicalcontractid = $stateParams.list.technicalcontractid;
- $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;
- })
- AccountService.getTechnicalContractList($scope.technicalcontractid).then(function (res) {
- if (res.code == 3350) {
- $scope.picturelist = res.data;
- console.log($scope.picturelist)
- angular.forEach($scope.picturelist, function(val){
- if(val.remark == "经技术合同登记的产学研合作合同(技术开发、技术转让、技术咨询、技术服务)"){
- $scope.imageList1.push(val)
- }
- if(val.remark == "发票"){
- $scope.imageList2.push(val)
- }
- if(val.remark == "支付凭证(银行转账凭证)"){
- $scope.imageList3.push(val)
- }
- if(val.remark == "结果凭证(结题报告、进度报告等)"){
- $scope.imageList4.push(val)
- }
- if(val.remark == "法定代表人授权委托书"){
- $scope.imageList5.push(val)
- }
- })
- }
- })
- $scope.agreeClick = function () {
- $scope.agree = 1;
- }
- $scope.rollClick = function () {
- $scope.agree = -1;
- }
- $scope.checkDemandReward = function () {
- if ($scope.agree == -1) {
- if ($scope.checkData.refusereason == "" || $scope.checkData.refusereason == null) {
- $ionicPopup.alert({
- title: '确定',
- template: '请填写拒绝理由'
- });
- return;
- }else {
- submit()
- }
- }else {
- $ionicPopup.confirm({
- title: '确定',
- template: ' <div class="list">\n' +
- ' <label class="item item-input">\n' +
- ' <span class="input-label">拟补助金额:</span>\n' +
- ' <span>{{data.by3}}</span>\n' +
- ' </label>\n' +
- ' <label class="item item-input">\n' +
- ' <span class="input-label">核定补助金额:</span>\n' +
- ' <input type="text" ng-model="data.rewardmoney">\n' +
- ' </label>\n' +
- ' </div>',
- scope: $scope,
- buttons: [{
- text: '取消',
- type: 'button-default',
- }, {
- text: '确定',
- type: 'button-positive',
- onTap: function(e) {
- if (!$scope.data.rewardmoney) {
- CommonService.showMessage("请填写核定补助金额", $scope);
- e.preventDefault();
- } else {
- console.log($scope.data)
- submit()
- }
- }
- }]
- });
- }
- }
- function submit(){
- console.log($scope.checkData.refusereason)
- AccountService.submitDemandReward($stateParams.list.id, $scope.agree, $scope.data.rewardmoney,$scope.checkData.refusereason).then(function (res) {
- if (res.code == 3350) {
- $scope.go('cooperationSubsidyCheck');
- }
- })
- }
- //通过technicalcontractid获取TechnicalContract数据
- ResourceLibraryService.getTechContractByContractid($scope.technicalcontractid).then(function (res) {
- console.log(res)
- if (res.code == 3350) {
- $scope.data = 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) {
- // isedit:是否可以编辑资源,isset:是否可以设置权限
- var buttonlist = [];
- buttonlist.push({text: '导出附件zip'});
- // buttonlist.push({text: '导出'});
- if($scope.demandreward.demandstatus == 1){
- buttonlist.push({text: '共享'});
- }
- if($scope.demandreward.demandstatus == 0){
- buttonlist.push({text: '修改'});
- }
- // else if($scope.demandreward.demandstatus == 8 || $scope.demandreward.demandstatus == 9){
- //
- // }else {
- // }
- $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();// 设置点击事件
- })
- }
- if (buttonlist[index].text == '修改') {
- console.log($stateParams.list)
- $scope.go("toDeclare", {list: JSON.stringify($stateParams.list)});
- }
- }
- });
- };
- $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;
- };
- });
|