std_wish.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. app.controller('StdWishCtrl', [ '$rootScope', '$scope', '$http', '$timeout', '$state', '$stateParams', function($rootScope, $scope, $http, $timeout, $state, $stateParams) {
  2. $scope.StdReg = angular.copy($rootScope.ArtStdReg);
  3. $scope.conf = [];
  4. $scope.currentStep = 'Init';
  5. $scope.params={};
  6. //保存志愿
  7. $scope.saveStdWish = function() {
  8. var stdwish=[];
  9. for(var i = 0;i<$scope.conf.length; i++) {
  10. if($scope.conf[i]!='' && $scope.conf[i] != undefined ) {
  11. stdwish.push($scope.conf[i]);
  12. }
  13. }
  14. $scope.conf=stdwish;
  15. if($scope.conf.length == 0) {
  16. $.alert('请选择志愿!');
  17. return ;
  18. }
  19. if(!$scope.params.adjust) {
  20. $.alert('请选择是否服从调剂!');
  21. return;
  22. }
  23. if($scope.params.adjust == '1' && $scope.aspectWish.length!=$scope.conf.length){
  24. $.alert('服从调剂,需要选择所有志愿!');
  25. return ;
  26. }
  27. for(var i = 0;i<$scope.conf.length; i++) {
  28. if($scope.conf[i]=='' || $scope.conf[i] == undefined ) {
  29. $.alert('请按顺序选择志愿!');
  30. return;
  31. }
  32. }
  33. $rootScope.ajaxRequest({
  34. url: '../std/wish/save.htm',
  35. data:{wish_ids:$scope.conf, adjust: $scope.params.adjust}
  36. }, function(response) {
  37. $scope.currentStep = 'success';
  38. });
  39. }
  40. $scope.listStdWish = function() {
  41. $scope.conf = [];
  42. //可编辑时间判断
  43. var endTime = new Date($rootScope.FrameParam['wishEditEndTime']);
  44. var nowTime = new Date();
  45. if(endTime.getTime() >= nowTime.getTime()) {
  46. $scope.params.editFlag = true;
  47. } else {
  48. $scope.params.editFlag = false;
  49. }
  50. $rootScope.ajaxRequest({
  51. url: '../std/wish/list.htm',
  52. data:{aspect_id:$stateParams.aspect_id== 'null' ? null : $stateParams.aspect_id}
  53. }, function(response) {
  54. //考生志愿
  55. $scope.wishArr = response.array;
  56. for(const wish of $scope.wishArr) {
  57. $scope.conf.push(wish.wish_id);
  58. $scope.params.adjust = wish.adjust;
  59. }
  60. });
  61. }
  62. $scope.listAspectWish = function() {
  63. $rootScope.ajaxRequest({
  64. url: '../cf/aspect/wish/list.htm',
  65. data:{aspect_id:$stateParams.aspect_id== 'null' ? null : $stateParams.aspect_id}
  66. }, function(response) {
  67. if(response.array.length==0)
  68. $.alert("不需要填报志愿");
  69. $scope.aspectWish = response.array;
  70. });
  71. }
  72. $scope.getWishNum = function(index) {
  73. var result = '';
  74. switch (index+'') {
  75. case '1':
  76. result = '一';
  77. break;
  78. case '2':
  79. result = '二';
  80. break;
  81. case '3':
  82. result = '三';
  83. break;
  84. case '4':
  85. result = '四';
  86. break;
  87. case '5':
  88. result = '五';
  89. break;
  90. case '6':
  91. result = '六';
  92. break;
  93. case '7':
  94. result = '七';
  95. break;
  96. case '8':
  97. result = '八';
  98. break;
  99. case '9':
  100. result = '九';
  101. break;
  102. case '10':
  103. result = '十';
  104. break;
  105. }
  106. return result;
  107. }
  108. $scope.listStdWish();
  109. $scope.listAspectWish();
  110. } ])