technicalBrokerExportCompanyInfoCtrl.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. angular.module('push')
  2. .controller('technicalBrokerExportCompanyInfoCtrl', function ($scope, TechnicalBrokerPublishTrainService, roleService,UserService,CommonService,ConfigService,$ionicHistory) {
  3. $scope.choose=true
  4. $scope.showif=false
  5. //获取导出人名字
  6. TechnicalBrokerPublishTrainService.gettongTech().then(function (res){
  7. if(res.code==3350){
  8. $scope.selectedtypes=res.data[0]
  9. $scope.types=res.data
  10. }else {
  11. $ionicPopup.alert({
  12. title: '提示',
  13. template: res.message
  14. });
  15. }
  16. })
  17. //获取导出字段
  18. TechnicalBrokerPublishTrainService.getselbasicparam().then(function (res){
  19. if(res.code==3350){
  20. $scope.fieldList = {
  21. chooseall:false,
  22. list:res.data
  23. }
  24. }else {
  25. $ionicPopup.alert({
  26. title: '提示',
  27. template: res.message
  28. });
  29. }
  30. })
  31. //选择框回调
  32. $scope.handletypes=function (item) {
  33. $scope.selectedtypes=item
  34. entrylist()
  35. }
  36. //点击选择
  37. $scope.clickResource = function (resource) {
  38. resource.show = !resource.show;
  39. }
  40. //全选
  41. $scope.choiceAllResource=function () {
  42. if(!$scope.showif){
  43. $scope.visitTaskRecordList.map(function (item) {
  44. if( $scope.choose){
  45. item.show=true
  46. }else {
  47. item.show=false
  48. }
  49. })
  50. $scope.choose=!$scope.choose
  51. }else {
  52. $scope.showif=false
  53. }
  54. }
  55. $scope.changeToggle=function(index,item){
  56. if(index){
  57. $scope.fieldList.chooseall=!$scope.fieldList.chooseall
  58. $scope.fieldList.list.map(function (item) {
  59. if( $scope.fieldList.chooseall){
  60. item.show=true
  61. }else {
  62. item.show=false
  63. }
  64. })
  65. }else {
  66. item.show=!item.show
  67. }
  68. }
  69. //选择导出字段
  70. $scope.choiceExportField=function () {
  71. if(!$scope.showif){
  72. $scope.exportparams={
  73. exportStrs:[],
  74. interviewExports:[]
  75. }
  76. $scope.visitTaskRecordList.map(function (item) {
  77. if(item.show){
  78. $scope.exportparams.interviewExports.push({
  79. connid:item.connid,
  80. node:item.node,
  81. orgId:item.id,
  82. orgtype:item.orgtype,
  83. pagecode:item.pagecode,
  84. templettype:item.templettype,
  85. userid:item.userid,
  86. })
  87. }
  88. })
  89. if($scope.exportparams.interviewExports.length==0){
  90. CommonService.showMessage('请选择导出企业', $scope);
  91. return
  92. }
  93. $scope.showif=true
  94. }else {
  95. $scope.fieldList.list.map(function (item) {
  96. if(item.show){
  97. $scope.exportparams.exportStrs.push(item.param)
  98. }
  99. })
  100. if($scope.exportparams.exportStrs.length==0){
  101. CommonService.showMessage('请选择导出字段', $scope);
  102. return
  103. }
  104. TechnicalBrokerPublishTrainService.getexportinterviewinfo( $scope.exportparams).then(function (res) {
  105. if(res.code==3350){
  106. // var aEle = document.createElement("a");// 创建a标签
  107. // aEle.href = ConfigService.imgurl + res.data.sourceName
  108. // aEle.click();// 设置点击事件
  109. // setTimeout(function () {
  110. // $ionicHistory.backView().go();
  111. // },3000)
  112. let net= window.open(ConfigService.imgurl + res.data.sourceName);
  113. net.addEventListener("beforeunload", e => {
  114. console.log(res.data.sourceName, e);
  115. $ionicHistory.backView().go();
  116. });
  117. }else {
  118. $ionicPopup.alert({
  119. title: '提示',
  120. template: res.message
  121. });
  122. }
  123. })
  124. }
  125. }
  126. function entrylist(){
  127. TechnicalBrokerPublishTrainService.getMyInterviewListall($scope.selectedtypes.userid,1,UserService.node).then(function (res) {
  128. if(res.code==3350){
  129. $scope.visitTaskRecordList=res.data
  130. }else {
  131. $ionicPopup.alert({
  132. title: '提示',
  133. template: res.message
  134. });
  135. }
  136. })
  137. }
  138. })