123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310 |
- angular.module('push')
- .controller('techDemandCheckCtrl', function ($scope, AccountService, $stateParams, UserService, $ionicPopup, dataToolsService, $ionicSlideBoxDelegate) {
- $scope.defaultLan = UserService.defaultLan;
- $scope.id = $stateParams.id;
- $scope.node = UserService.node;
- $scope.comefrom = $stateParams.comefrom;
- $scope.list = $stateParams.list;
- $scope.isBroker = false;
- $scope.permission1 = false;//公开
- $scope.permission2 = false;//技术经纪人可见
- $scope.permission3 = false;//高校院所专家可见
- $scope.permission4 = false;//私密
- $scope.cooperationmodelInfo = "";
- if ($scope.node == '330122000') {
- $scope.agree = 1;
- } else {
- $scope.agree = true;
- }
- $scope.checkData = {};
- $scope.checkShow = $stateParams.checkShow;
- $scope.resubmitData = {};
- //通过当前技术需求id获取当前的技术需求
- var getDemandInfo = function () {
- AccountService.getDemandInfo($stateParams.id).then(function (res) {
- if (res.code == 3350) {
- var data = res.data;
- $scope.projectname = data.projectname;
- $scope.capitalScale = data.capitalScale;
- $scope.contactor = data.contactor;
- $scope.tel = data.tel;
- $scope.photolist = data.photoList;
- $scope.taskintroduction = data.taskintroduction;
- $scope.cooperationmodelCHN = data.cooperationmodelCHN;
- $scope.tonglucheckstatus = data.tonglucheckstatus;
- $scope.refusereason = data.refusereason;
- $scope.node = data.node;
- $scope.permissionvalue = data.permissionvalue;
- var splitArr = [];
- if($scope.permissionvalue == 1 || $scope.permissionvalue == 2 || $scope.permissionvalue == 3 ||
- $scope.permissionvalue == 4 || $scope.permissionvalue == 5){
- splitArr.push($scope.permissionvalue);
- }else if($scope.permissionvalue != null){
- splitArr = $scope.permissionvalue.split(',');
- }else{
- splitArr.push(1);
- }
- for (var i = 0; i < splitArr.length; i++) {
- if (splitArr[i] == 1) {
- $scope.permission1 = true;
- }
- if (splitArr[i] == 2) {
- $scope.permission2 = true;
- }
- if (splitArr[i] == 3) {
- $scope.permission3 = true;
- }
- if (splitArr[i] == 4) {
- $scope.permission4 = true;
- }
- }
- var cooperationmodel = data.cooperationmodel;
- if (cooperationmodel != null && cooperationmodel != "") {
- dataToolsService.getCooperationmodelByCode(cooperationmodel).then(function (newRes) {
- if (newRes.code == 3350) {
- $scope.cooperationmodelInfo = newRes.data;
- }
- })
- }
- //判断创建者是不是技术经纪人
- dataToolsService.judgeUserBroker(data.creator).then(function (isBrokerRes) {
- if (isBrokerRes.code == 3350) {
- $scope.isBroker = isBrokerRes.data;
- if (isBrokerRes.data) {
- //当前用户是技术经纪人
- AccountService.getUserCheckInfo(data.creator).then(function (response) {
- if (response.code == 3350) {
- var user = response.data;
- $scope.contactor = user.applyname;
- $scope.tel = user.tel;
- }
- });
- }
- AccountService.getCompanyById(data.companyid).then(function (nameRes) {
- if (res.code == 3350) {
- $scope.companyName = nameRes.data;
- AccountService.getUserNameById(data.creator).then(function (userRes) {
- if (res.code == 3350) {
- $scope.userName = userRes.data;
- }
- });
- }
- });
- }
- });
- }
- });
- }
- getDemandInfo();
- //点击图片放大
- $scope.bigImage = false; //初始默认大图是隐藏的
- $scope.hideBigImage = function () {
- $scope.bigImage = false;
- };
- $scope.shouBigImage = function (index) { //传递一个参数(图片的URl)
- if ($scope.app) {
- $scope.setStatusBar(1);
- }
- $scope.bigImage = true; //显示大图
- $(function () {
- $('div.pinch-zoom').each(function () {
- new RTP.PinchZoom($(this), {});
- });
- });
- $ionicSlideBoxDelegate.update();//重绘,让图片显示出来
- //图片总数量
- setTimeout(function () {
- // console.log(parseInt($ionicSlideBoxDelegate.slidesCount()));
- // console.log(parseInt($ionicSlideBoxDelegate.currentIndex()));
- $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.agreeClick = function () {
- if ($scope.node == '330122000') {
- $scope.agree = 1;
- } else {
- $scope.agree = true;
- }
- }
- $scope.rollClick = function () {
- $scope.agree = -2;
- }
- $scope.rejectClick = function () {
- if ($scope.node == '330122000') {
- $scope.agree = -1;
- } else {
- $scope.agree = false;
- }
- }
- //需求审核
- $scope.checkDemand = function (id) {
- if ($scope.node != '330122000') {
- if ($scope.agree) {
- var value = 1;
- } else {
- var value = -1
- }
- }
- if ($scope.node == '330122000') {
- if ($scope.agree == 1) {
- var value = 1;
- }
- if ($scope.agree == -1) {
- var value = -1
- }
- if ($scope.agree == -2) {
- var 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.checkTechDemand(value, id, $scope.checkData.refusereason).then(function (res) {
- if (res.code == 3350) {
- $scope.go('techDemandDetail');
- }
- })
- }
- $scope.checkDemandAgain = function (list, demandId) {
- list.infoSectionList = [];
- list.infoSectionList[0] = {};
- list.infoSectionList[0].unitlist = [];
- if ($scope.projectname) {
- var value = {};
- value.tcname = "projectname";
- value.content = $scope.projectname;
- list.infoSectionList[0].unitlist.push(value);
- }
- if ($scope.capitalScale) {
- var value = {};
- value.tcname = "capitalScale";
- value.content = $scope.capitalScale;
- list.infoSectionList[0].unitlist.push(value);
- }
- if ($scope.contactor) {
- var value = {};
- value.tcname = "contactor";
- value.content = $scope.contactor;
- list.infoSectionList[0].unitlist.push(value);
- }
- if ($scope.tel) {
- var value = {};
- value.tcname = "tel";
- value.content = $scope.tel;
- list.infoSectionList[0].unitlist.push(value);
- list.tel = $scope.tel;
- }
- if ($scope.cooperationmodelInfo) {
- var value = {};
- value.tcname = "cooperationmodel";
- value.content = $scope.cooperationmodelInfo;
- list.infoSectionList[0].unitlist.push(value);
- }
- if ($scope.taskintroduction) {
- var value = {};
- value.tcname = "taskintroduction";
- value.content = $scope.taskintroduction;
- list.infoSectionList[0].unitlist.push(value);
- }
- if ($scope.companyName) {
- var value = {};
- value.tcname = "oid";
- value.content = $scope.companyName;
- list.infoSectionList[0].unitlist.push(value);
- }
- if ($scope.photolist) {
- var value = {};
- value = $scope.photolist;
- list.infoSectionList[0].unitlist.push(value);
- }
- list.baseInfoModel = {};
- list.baseInfoModel.oid = list.companyid;
- list.baseInfoModel.permission1 = $scope.permission1;
- list.baseInfoModel.permission2 = $scope.permission2;
- list.baseInfoModel.permission3 = $scope.permission3;
- list.baseInfoModel.permission4 = $scope.permission4;
- list.title = $scope.projectname;
- list.content = $scope.taskintroduction;
- list.photolist = $scope.photolist;
- //判断当前用户是不是技术经纪人
- dataToolsService.judgeUserBroker(UserService.id).then(function (res) {
- $scope.userIsBroker = false;
- if (res.code == 3350) {
- $scope.userIsBroker = res.data;
- }else{
- $scope.userIsBroker = false;
- }
- $scope.go('taskRelease', {data: list, userIsBroker: $scope.userIsBroker, demandId:demandId});
- })
- /*$scope.go('techDemandCheckAgain', {resubmitData: $scope.resubmitData});*/
- }
- })
- ;
|