BusinessdataCtrl.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. angular.module('push')
  2. .controller('BusinessdataCtrl', function ($scope,SelfcheckService,$stateParams,UserService,$ionicPopup,AccountService,
  3. $timeout,$ionicModal,$ionicActionSheet,ionicDatePicker,$ionicScrollDelegate) {
  4. $scope.isShowSearchButton = true;
  5. $scope.keyfilter=''
  6. $scope.CaseDatalist =function (orgname){
  7. $scope.showLoadingToastUtilEnd();
  8. console.log(orgname)
  9. let params= {
  10. keyWord: this.keyfilter,
  11. org: [{code: "", name: ""}],
  12. pageNo: 0,
  13. pageSize: 0,
  14. userId: UserService.id
  15. }
  16. AccountService.getmarketgetByName(params).then(function (res){
  17. $scope.hideLoadingToast();
  18. console.log(res)
  19. if(res.code==3350){
  20. $scope.list=res.data
  21. if(!res.data){
  22. $ionicPopup.alert({
  23. title: '提示',
  24. template: '没有当前数据!'
  25. });
  26. }
  27. }else {
  28. $ionicPopup.alert({
  29. title: '提示',
  30. template: res.message
  31. });
  32. }
  33. }).catch(function (res){
  34. $scope.hideLoadingToast();
  35. $ionicPopup.alert({
  36. title: '提示',
  37. template: "服务器错误"
  38. });
  39. })
  40. }
  41. $scope.showSearchButtonLeft = function () {
  42. $scope.isShowSearchButton = false;
  43. $timeout(function () {
  44. $(".showSearchInput").focus();
  45. }, 300)
  46. };
  47. $scope.clearSearch = function () {
  48. $scope.isShowSearchButton = true;
  49. $scope.keyfilter= '';
  50. $scope.list=[]
  51. // $scope.CaseDatalist('0');
  52. }
  53. //更新所有数据
  54. $scope.oninputs=function (){
  55. let params= {
  56. keyWord: "",
  57. org: [{code: "", name: ""}],
  58. pageNo: 0,
  59. pageSize: 0,
  60. userId: UserService.id
  61. }
  62. $scope.showLoadingToastUtilEnd();
  63. AccountService.getmarketcompareAll(params).then((res)=>{
  64. $scope.hideLoadingToast();
  65. console.log(res)
  66. if(res.code==3350){
  67. $ionicPopup.alert({
  68. title: '提示',
  69. template: '导入成功'
  70. });
  71. }else {
  72. $ionicPopup.alert({
  73. title: '提示',
  74. template: res.message
  75. });
  76. }
  77. }).catch(function (res){
  78. $scope.hideLoadingToast();
  79. $ionicPopup.alert({
  80. title: '提示',
  81. template: "服务器错误"
  82. });
  83. })
  84. }
  85. $scope.clickResource=function (item){
  86. item.isselected=!item.isselected
  87. }
  88. //导入选择数据
  89. $scope.onimport=function (){
  90. let params= {
  91. keyWord: "",
  92. org: [],
  93. list:[],
  94. pageNo: 0,
  95. pageSize: 0,
  96. userId: UserService.id
  97. }
  98. $scope.list.forEach((row)=>{
  99. if(row.isselected){
  100. params.list.push(row)
  101. }
  102. })
  103. $scope.showLoadingToastUtilEnd();
  104. AccountService.getmarketcompareBatch(params).then((res)=>{
  105. $scope.hideLoadingToast();
  106. console.log(res)
  107. if(res.code==3350){
  108. $ionicPopup.alert({
  109. title: '提示',
  110. template: '导入成功'
  111. });
  112. }else {
  113. $ionicPopup.alert({
  114. title: '提示',
  115. template: res.message
  116. });
  117. }
  118. }).catch(function (res){
  119. $scope.hideLoadingToast();
  120. $ionicPopup.alert({
  121. title: '提示',
  122. template: "服务器错误"
  123. });
  124. })
  125. }
  126. })