SelfcheckdetailCtrl.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. angular.module('push')
  2. .controller('SelfcheckdetailCtrl', function ($scope,SelfcheckService,$stateParams,$ionicPopup,ConfigService,$ionicActionSheet,ionicDatePicker,UserService) {
  3. console.log($stateParams,JSON.parse($stateParams.obj))
  4. var routeParams=JSON.parse($stateParams.obj)
  5. SelfcheckService.getinspectdetail (routeParams).then(function (res){
  6. console.log(res)
  7. if(res.code==3350){
  8. $scope.detaildata=res.data
  9. }else {
  10. $ionicPopup.alert({
  11. title: '提示',
  12. template: res.message
  13. });
  14. }
  15. }).catch(function (res){
  16. console.log(res)
  17. $ionicPopup.alert({
  18. title: '提示',
  19. template: "服务器错误"
  20. });
  21. })
  22. $scope.exportReport = function () {
  23. var exparams={
  24. restype:routeParams.restype,
  25. id:routeParams.id
  26. }
  27. SelfcheckService.exportinspectOrFoster(exparams).then(function (res) {
  28. console.log(res)
  29. if (res.code == 3350) {
  30. var file = res.data;
  31. // window.open(ConfigService.imgurl + file.sourceName);
  32. var aEle = document.createElement("a");
  33. aEle.setAttribute("href", ConfigService.imgurl + file.sourceName);;
  34. aEle.click()
  35. // let a = document.createElement("a");
  36. // a.setAttribute("href", ConfigService.imgurl + file.sourceName);
  37. // a.click();
  38. return;
  39. } else {
  40. $ionicPopup.alert({
  41. title: '提示',
  42. template: '导出失败!'
  43. })
  44. return;
  45. }
  46. })
  47. }
  48. })