123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188 |
- /**
- * Created by pushkeji on 2018/8/10.
- */
- angular.module('push')
- .controller('techDemandCheckDetailCtrl', ['$scope', '$stateParams', 'AccountService', '$q', 'UserService', '$ionicPopup', 'dataToolsService', '$ionicSlideBoxDelegate', '$timeout', function ($scope, $stateParams, AccountService, $q, UserService, $ionicPopup, dataToolsService, $ionicSlideBoxDelegate, $timeout) {
- $scope.defaultLan = UserService.defaultLan;
- $scope.checkData = {};
- $scope.node = UserService.node;
- if ($scope.node == '330122000') {
- $scope.agree = 1;
- } else {
- $scope.agree = true;
- }
- var getTechDemandDetail = function () {
- AccountService.getTechDemandDetail($stateParams.id).then(function (res) {
- if (res.code == 3350) {
- var data = res.data;
- $scope.applyname = data.sysUsersInfo.applyname;
- $scope.tel = data.sysUsersInfo.tel;
- $scope.certificate = data.sysUsersInfo.brokercertificate;
- $scope.orgtel = data.demandReward.orgtel;
- $scope.orguser = data.demandReward.orguser;
- $scope.demandname = data.demandReward.demandname;
- $scope.demandcontent = data.demandReward.demandcontent;
- $scope.capitalScale = data.sysUsersTaskInfo.capitalScale;
- $scope.cooperationmodel = data.sysUsersTaskInfo.cooperationmodel;
- $scope.createtime = data.demandReward.createtime;
- $scope.orgname = data.orgName;//用作存放企业名
- $scope.demandstatus = data.demandReward.demandstatus;
- $scope.refusereason = data.demandReward.refusereason;
- $scope.node = data.demandReward.node;
- $scope.abutList = data.companyAbutLkList;
- if(data.demandReward.creator != UserService.id){
- $scope.resubmitShow = false;
- }else{
- $scope.resubmitShow = true;
- }
- dataToolsService.getCooperationmodelByCode($scope.cooperationmodel).then(function (newRes) {
- if (newRes.code == 3350) {
- $scope.cooperationmodelInfo = newRes.data;
- }
- })
- }
- })
- }
- getTechDemandDetail();
- $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.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('demandRewardCheck');
- }
- })
- }
- //重置失败状态,失败原因没有实际作用(仅仅便于调一个接口)
- $scope.checkDemandRewardAgain = function () {
- AccountService.submitDemandReward($stateParams.id, 0, "1").then(function (res) {
- if (res.code == 3350) {
- $scope.go('demandRewardCheck');
- }
- })
- }
- }]);
|