angular.module('push') .controller('SelfcheckdetailCtrl', function ($scope,SelfcheckService,$stateParams,$ionicPopup,ConfigService,$ionicActionSheet,ionicDatePicker,UserService) { console.log($stateParams,JSON.parse($stateParams.obj)) var routeParams=JSON.parse($stateParams.obj) SelfcheckService.getinspectdetail (routeParams).then(function (res){ console.log(res) if(res.code==3350){ $scope.detaildata=res.data }else { $ionicPopup.alert({ title: '提示', template: res.message }); } }).catch(function (res){ console.log(res) $ionicPopup.alert({ title: '提示', template: "服务器错误" }); }) $scope.exportReport = function () { var exparams={ restype:routeParams.restype, id:routeParams.id } SelfcheckService.exportinspectOrFoster(exparams).then(function (res) { console.log(res) if (res.code == 3350) { var file = res.data; // window.open(ConfigService.imgurl + file.sourceName); var aEle = document.createElement("a"); aEle.setAttribute("href", ConfigService.imgurl + file.sourceName);; aEle.click() // let a = document.createElement("a"); // a.setAttribute("href", ConfigService.imgurl + file.sourceName); // a.click(); return; } else { $ionicPopup.alert({ title: '提示', template: '导出失败!' }) return; } }) } })