angular.module('push') .controller('technicalBrokerExportCompanyInfoCtrl', function ($scope, TechnicalBrokerPublishTrainService, roleService,UserService,CommonService,ConfigService,$ionicHistory) { $scope.choose=true $scope.showif=false //获取导出人名字 TechnicalBrokerPublishTrainService.gettongTech().then(function (res){ if(res.code==3350){ $scope.selectedtypes=res.data[0] $scope.types=res.data }else { $ionicPopup.alert({ title: '提示', template: res.message }); } }) //获取导出字段 TechnicalBrokerPublishTrainService.getselbasicparam().then(function (res){ if(res.code==3350){ $scope.fieldList = { chooseall:false, list:res.data } }else { $ionicPopup.alert({ title: '提示', template: res.message }); } }) //选择框回调 $scope.handletypes=function (item) { $scope.selectedtypes=item entrylist() } //点击选择 $scope.clickResource = function (resource) { resource.show = !resource.show; } //全选 $scope.choiceAllResource=function () { if(!$scope.showif){ $scope.visitTaskRecordList.map(function (item) { if( $scope.choose){ item.show=true }else { item.show=false } }) $scope.choose=!$scope.choose }else { $scope.showif=false } } $scope.changeToggle=function(index,item){ if(index){ $scope.fieldList.chooseall=!$scope.fieldList.chooseall $scope.fieldList.list.map(function (item) { if( $scope.fieldList.chooseall){ item.show=true }else { item.show=false } }) }else { item.show=!item.show } } //选择导出字段 $scope.choiceExportField=function () { if(!$scope.showif){ $scope.exportparams={ exportStrs:[], interviewExports:[] } $scope.visitTaskRecordList.map(function (item) { if(item.show){ $scope.exportparams.interviewExports.push({ connid:item.connid, node:item.node, orgId:item.id, orgtype:item.orgtype, pagecode:item.pagecode, templettype:item.templettype, userid:item.userid, }) } }) if($scope.exportparams.interviewExports.length==0){ CommonService.showMessage('请选择导出企业', $scope); return } $scope.showif=true }else { $scope.fieldList.list.map(function (item) { if(item.show){ $scope.exportparams.exportStrs.push(item.param) } }) if($scope.exportparams.exportStrs.length==0){ CommonService.showMessage('请选择导出字段', $scope); return } TechnicalBrokerPublishTrainService.getexportinterviewinfo( $scope.exportparams).then(function (res) { if(res.code==3350){ // var aEle = document.createElement("a");// 创建a标签 // aEle.href = ConfigService.imgurl + res.data.sourceName // aEle.click();// 设置点击事件 // setTimeout(function () { // $ionicHistory.backView().go(); // },3000) let net= window.open(ConfigService.imgurl + res.data.sourceName); net.addEventListener("beforeunload", e => { console.log(res.data.sourceName, e); $ionicHistory.backView().go(); }); }else { $ionicPopup.alert({ title: '提示', template: res.message }); } }) } } function entrylist(){ TechnicalBrokerPublishTrainService.getMyInterviewListall($scope.selectedtypes.userid,1,UserService.node).then(function (res) { if(res.code==3350){ $scope.visitTaskRecordList=res.data }else { $ionicPopup.alert({ title: '提示', template: res.message }); } }) } })