/** * Created by pushkeji on 2018/8/10. */ angular.module('push') .controller('technicalCheckDetailCtrl', ['$scope', '$stateParams', 'AccountService', '$q', 'UserService', '$ionicPopup', '$ionicSlideBoxDelegate', '$timeout', 'dataToolsService', 'ConfigService',function ($scope, $stateParams, AccountService, $q, UserService, $ionicPopup, $ionicSlideBoxDelegate, $timeout,dataToolsService,ConfigService) { $scope.defaultLan = UserService.defaultLan; $scope.imageList1 = []; $scope.imageList2 = []; $scope.imageList3 = []; $scope.comefrom = $stateParams.comefrom; $scope.checkData = {}; $scope.node = UserService.node; if ($scope.node == '330122000') { $scope.agree = 1; } else { $scope.agree = true; } $scope.org = {}; var getTechDemandDetail = function () { AccountService.getTechDemandDetail($stateParams.id).then(function (res) { if (res.code == 3350) { var data = res.data; $scope.applyname = data.sysUsersInfo.applyname; $scope.certificate = data.sysUsersInfo.brokercertificate; $scope.tel = data.sysUsersInfo.tel; $scope.orgname = data.orgName; $scope.org.orguser = data.demandReward.orguser; $scope.org.orgtel = data.demandReward.orgtel; $scope.projectname = data.sysUsersTaskInfo.projectname; $scope.capitalScale = data.sysUsersTaskInfo.capitalScale; $scope.cooperationmodel = data.sysUsersTaskInfo.cooperationmodel; $scope.taskintroduction = data.sysUsersTaskInfo.taskintroduction; $scope.demandstatus = data.demandReward.demandstatus; $scope.refusereason = data.demandReward.refusereason; $scope.node = data.demandReward.node; $scope.abutList = data.companyAbutLkList; $scope.technical = data.technicalContractList[0]; dataToolsService.getCooperationmodelByCode($scope.cooperationmodel).then(function (newRes) { if (newRes.code == 3350) { $scope.cooperationmodelInfo = newRes.data; } }) angular.forEach(data.systemPictureList, function(val, index){ if(val.title == "上传合作双方认可证明"){ $scope.imageList1.push(val) } if(val.title == "上传发票"){ $scope.imageList2.push(val) } if(val.title == "上传转账凭证"){ $scope.imageList3.push(val) } }) console.log($scope.imageList1); console.log($scope.imageList2); console.log($scope.imageList3); } }) } getTechDemandDetail(); $scope.seeTechnicalInfo = function (technical) { $scope.go('signDemandContractDetail', {contract: technical}); } $scope.agreeClick = function () { if ($scope.node != '330122000') { $scope.agree = true; } else { $scope.agree = 1; } } $scope.rollClick = function () { $scope.agree = -2; } $scope.rejectClick = function () { if ($scope.node != '330122000') { $scope.agree = false; } else { $scope.agree = -1; } } $scope.checkDemandReward = function () { var value = 0; if ($scope.node != '330122000') { if ($scope.agree) { value = 1; } else { value = -1; } } else { if ($scope.agree == 1) { value = 1; } if ($scope.agree == -1) { value = -1; } if ($scope.agree == -2) { value = -2; } } if (value == -1 || value == -2) { if ($scope.checkData.refusereason == "" || $scope.checkData.refusereason == null) { if (value == -1) { $ionicPopup.alert({ title: '确定', template: '请填写拒绝理由' }); } if (value == -2) { $ionicPopup.alert({ title: '确定', template: '请填写退回理由' }); } return; } } AccountService.submitDemandReward($stateParams.id, value, $scope.checkData.refusereason).then(function (res) { if (res.code == 3350) { $scope.go('technicalRewardCheck'); } }) } //重置失败状态,失败原因没有实际作用(仅仅便于调一个接口) $scope.checkDemandRewardAgain = function () { AccountService.submitDemandReward($stateParams.id, 0, "1").then(function (res) { if (res.code == 3350) { $scope.go('technicalRewardCheck'); } }) } $scope.goOnContractInfo = function (contract) { $scope.go('signDemandContractDetail', {contract: contract}); } $scope.bigImage = false; //初始默认大图是隐藏的 $scope.hideBigImage = function () { if ($scope.app) { $scope.setStatusBar(0); } $scope.bigImage = false; } $scope.shouBigImage = function (outindex, innerindex) { if ($scope.app) { $scope.setStatusBar(1); } $scope.bigImageList = $scope.abutList[outindex].photoList; $scope.bigImage = true; //显示大图 $(function () { $('div.pinch-zoom').each(function () { new RTP.PinchZoom($(this), {}); }); }); $ionicSlideBoxDelegate.update();//重绘,让图片显示出来 //图片总数量 setTimeout(function () { $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(innerindex, 0); //获取图片 var imgObj = document.getElementsByClassName('bigimage'); var n; for (n = 0; n < imgObj.length; n++) { // 获取图片的原始高度和宽度 var oldWid = imgObj[n].naturalWidth; var oldHei = imgObj[n].naturalHeight; var screen = document.body.offsetWidth; var screenH = window.innerHeight; // console.log(oldWid/oldHei); // console.log(screen ); var rate = oldWid / oldHei; if (oldWid >= screen && oldHei >= screenH) { var tw = screen; var th = tw / rate; if (th < screenH) { imgObj[n].style.width = tw + 'px'; imgObj[n].style.height = th + 'px'; imgObj[n].style.marginTop = (screenH - th) / 2 + 'px'; } else { imgObj[n].style.width = screenH * rate + 'px'; imgObj[n].style.height = screenH + 'px'; imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px'; } } else if (oldWid >= screen && oldHei <= screenH) { imgObj[n].style.width = screen + 'px'; imgObj[n].style.height = screen / rate + 'px'; imgObj[n].style.marginTop = (screenH - screen / rate) / 2 + 'px'; } else if (oldWid <= screen && oldHei >= screenH) { // var hh=screenH; // var ww=screenH*rate; imgObj[n].style.width = screenH * rate + 'px'; imgObj[n].style.height = screenH + 'px'; imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px'; } else { imgObj[n].style.width = oldWid + 'px'; imgObj[n].style.height = oldHei + 'px'; imgObj[n].style.marginLeft = (screen - oldWid) / 2 + 'px'; imgObj[n].style.marginTop = (screenH - oldHei) / 2 + 'px'; } } }, 500); } $scope.shouBigImage1 = function (index,url) { if(url.indexOf('.pdf')!=-1){ window.open(ConfigService.imgurl + url) return } if ($scope.app) { $scope.setStatusBar(1); } $scope.bigImageList = $scope.imageList1; $scope.bigImage = true; //显示大图 $(function () { $('div.pinch-zoom').each(function () { new RTP.PinchZoom($(this), {}); }); }); $ionicSlideBoxDelegate.update();//重绘,让图片显示出来 //图片总数量 setTimeout(function () { $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(index, 0); //获取图片 var imgObj = document.getElementsByClassName('bigimage'); var n; for (n = 0; n < imgObj.length; n++) { // 获取图片的原始高度和宽度 var oldWid = imgObj[n].naturalWidth; var oldHei = imgObj[n].naturalHeight; var screen = document.body.offsetWidth; var screenH = window.innerHeight; // console.log(oldWid/oldHei); // console.log(screen ); var rate = oldWid / oldHei; if (oldWid >= screen && oldHei >= screenH) { var tw = screen; var th = tw / rate; if (th < screenH) { imgObj[n].style.width = tw + 'px'; imgObj[n].style.height = th + 'px'; imgObj[n].style.marginTop = (screenH - th) / 2 + 'px'; } else { imgObj[n].style.width = screenH * rate + 'px'; imgObj[n].style.height = screenH + 'px'; imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px'; } } else if (oldWid >= screen && oldHei <= screenH) { imgObj[n].style.width = screen + 'px'; imgObj[n].style.height = screen / rate + 'px'; imgObj[n].style.marginTop = (screenH - screen / rate) / 2 + 'px'; } else if (oldWid <= screen && oldHei >= screenH) { // var hh=screenH; // var ww=screenH*rate; imgObj[n].style.width = screenH * rate + 'px'; imgObj[n].style.height = screenH + 'px'; imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px'; } else { imgObj[n].style.width = oldWid + 'px'; imgObj[n].style.height = oldHei + 'px'; imgObj[n].style.marginLeft = (screen - oldWid) / 2 + 'px'; imgObj[n].style.marginTop = (screenH - oldHei) / 2 + 'px'; } } }, 500); } $scope.shouBigImage2 = function (index,url) { if(url.indexOf('.pdf')!=-1){ console.log( url) window.open(ConfigService.imgurl + url) return } if ($scope.app) { $scope.setStatusBar(1); } $scope.bigImageList = $scope.imageList2; $scope.bigImage = true; //显示大图 $(function () { $('div.pinch-zoom').each(function () { new RTP.PinchZoom($(this), {}); }); }); $ionicSlideBoxDelegate.update();//重绘,让图片显示出来 //图片总数量 setTimeout(function () { $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(index, 0); //获取图片 var imgObj = document.getElementsByClassName('bigimage'); var n; for (n = 0; n < imgObj.length; n++) { // 获取图片的原始高度和宽度 var oldWid = imgObj[n].naturalWidth; var oldHei = imgObj[n].naturalHeight; var screen = document.body.offsetWidth; var screenH = window.innerHeight; // console.log(oldWid/oldHei); // console.log(screen ); var rate = oldWid / oldHei; if (oldWid >= screen && oldHei >= screenH) { var tw = screen; var th = tw / rate; if (th < screenH) { imgObj[n].style.width = tw + 'px'; imgObj[n].style.height = th + 'px'; imgObj[n].style.marginTop = (screenH - th) / 2 + 'px'; } else { imgObj[n].style.width = screenH * rate + 'px'; imgObj[n].style.height = screenH + 'px'; imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px'; } } else if (oldWid >= screen && oldHei <= screenH) { imgObj[n].style.width = screen + 'px'; imgObj[n].style.height = screen / rate + 'px'; imgObj[n].style.marginTop = (screenH - screen / rate) / 2 + 'px'; } else if (oldWid <= screen && oldHei >= screenH) { // var hh=screenH; // var ww=screenH*rate; imgObj[n].style.width = screenH * rate + 'px'; imgObj[n].style.height = screenH + 'px'; imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px'; } else { imgObj[n].style.width = oldWid + 'px'; imgObj[n].style.height = oldHei + 'px'; imgObj[n].style.marginLeft = (screen - oldWid) / 2 + 'px'; imgObj[n].style.marginTop = (screenH - oldHei) / 2 + 'px'; } } }, 500); } $scope.shouBigImage3 = function (index,url) { if(url.indexOf('.pdf')!=-1){ window.open(ConfigService.imgurl + url) return } if ($scope.app) { $scope.setStatusBar(1); } $scope.bigImageList = $scope.imageList3; $scope.bigImage = true; //显示大图 $(function () { $('div.pinch-zoom').each(function () { new RTP.PinchZoom($(this), {}); }); }); $ionicSlideBoxDelegate.update();//重绘,让图片显示出来 //图片总数量 setTimeout(function () { $ionicSlideBoxDelegate.$getByHandle('slide_detail').slide(index, 0); //获取图片 var imgObj = document.getElementsByClassName('bigimage'); var n; for (n = 0; n < imgObj.length; n++) { // 获取图片的原始高度和宽度 var oldWid = imgObj[n].naturalWidth; var oldHei = imgObj[n].naturalHeight; var screen = document.body.offsetWidth; var screenH = window.innerHeight; // console.log(oldWid/oldHei); // console.log(screen ); var rate = oldWid / oldHei; if (oldWid >= screen && oldHei >= screenH) { var tw = screen; var th = tw / rate; if (th < screenH) { imgObj[n].style.width = tw + 'px'; imgObj[n].style.height = th + 'px'; imgObj[n].style.marginTop = (screenH - th) / 2 + 'px'; } else { imgObj[n].style.width = screenH * rate + 'px'; imgObj[n].style.height = screenH + 'px'; imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px'; } } else if (oldWid >= screen && oldHei <= screenH) { imgObj[n].style.width = screen + 'px'; imgObj[n].style.height = screen / rate + 'px'; imgObj[n].style.marginTop = (screenH - screen / rate) / 2 + 'px'; } else if (oldWid <= screen && oldHei >= screenH) { // var hh=screenH; // var ww=screenH*rate; imgObj[n].style.width = screenH * rate + 'px'; imgObj[n].style.height = screenH + 'px'; imgObj[n].style.marginLeft = (screen - screenH * rate) / 2 + 'px'; } else { imgObj[n].style.width = oldWid + 'px'; imgObj[n].style.height = oldHei + 'px'; imgObj[n].style.marginLeft = (screen - oldWid) / 2 + 'px'; imgObj[n].style.marginTop = (screenH - oldHei) / 2 + 'px'; } } }, 500); } }]);