Selaa lähdekoodia

全部数据导出内网修改成url导出

chenyubai 2 vuotta sitten
vanhempi
commit
d2ce814e01

+ 54 - 37
api/http-request.js

@ -315,45 +315,62 @@
	
	// 导出xls
	function downLoadFileForAjax(url, fileName, data){
		return new Promise(function(resolve, reject){
			const xhr = new XMLHttpRequest();
			if(data){
				var p = []
				for(var k in data){
					p.push(k + "=" + data[k])
				}
				url += (url.indexOf("?")!=-1? "&" : "?") + p.join("&")
		// 判断内网走url
		if(publish_version&&isInner) {
			var p = []
			for(var k in data){
				p.push(k + "=" + data[k])
			}
			xhr.open('GET', server + url, true);
	      	xhr.responseType = "blob";  
	      	xhr.onload = function() {
				if(xhr.readyState == 4 && xhr.status==200){
			        const blob = xhr.response;
			        const blobUrl = URL.createObjectURL(blob);
			        const a = document.createElement('a');
			        a.style.display = 'none';
			        a.download = fileName
			        a.href = blobUrl;
			        a.target = '_blank';
			        a.click();
					resolve()
				} else {
					reject(xhr)
			var ps = p.join("&")
			let str = server + url+'?'+ps
			window.location.href = str
		}else{
			// 外网做ajax
			return new Promise(function(resolve, reject){
				if(URL) {
					const xhr = new XMLHttpRequest();
					if(data){
						var p = []
						for(var k in data){
							p.push(k + "=" + data[k])
						}
						url += (url.indexOf("?")!=-1? "&" : "?") + p.join("&")
					}
					xhr.open('GET', server + url, true);
			      	xhr.responseType = "blob";  
			      	xhr.onload = function() {
						if(xhr.readyState == 4 && xhr.status==200){
					        const blob = xhr.response;
					        const blobUrl = URL.createObjectURL(blob);
					        const a = document.createElement('a');
					        a.style.display = 'none';
					        a.download = fileName
					        a.href = blobUrl;
					        a.target = '_blank';
					        a.click();
							resolve()
						} else {
							reject(xhr)
						}
			      	}   
					xhr.onerror = function(err){
						console.error(err)
						reject(xhr)
					}           
			      
			      	xhr.setRequestHeader("Content-Type","application/json;charset=UTF-8");
					var agent = userAgent || {
						imei: localStorage.getItem('WLYY_IMEI'),
						platform: 4
					}
			      	xhr.setRequestHeader("userAgent", JSON.stringify(agent));  
			      	xhr.send();
				}else{
					reject('浏览器版本低,请更新浏览器后再操作!')
				}
	      	}   
			xhr.onerror = function(err){
				console.error(err)
				reject(xhr)
			}           
	      
	      	xhr.setRequestHeader("Content-Type","application/json;charset=UTF-8");
			var agent = userAgent || {
				imei: localStorage.getItem('WLYY_IMEI'),
				platform: 4
			}
	      	xhr.setRequestHeader("userAgent", JSON.stringify(agent));  
	      	xhr.send();
		})
				
			})
		}
	}
	
    httpRequest = {

+ 1 - 1
app/login/login.js

@ -12,7 +12,7 @@ new Vue({
		imgCode: "",
		imgCaptcha: ""
    },
	mounted() {
	mounted: function() {
		this.getImgCode()
	},
    methods: {

+ 2 - 1
app/statistics/js/annual-appraisal-report.js

@ -161,7 +161,6 @@ new Vue({
		exportHandle:function(){
			var vm =this
			var vm = this
			
			var areaCode = vm.areaCode=="350200"?"":vm.areaCode
			vm.fullscreenLoading = true
			if(vm.datatotal.length!=0){
@ -178,6 +177,8 @@ new Vue({
					// FileSaver()
				})
				.catch(function(err){
					toastr.info(err)
					vm.fullscreenLoading = false
					console.error(err)
				})
				// let str = httpRequest.server + 'statisticsExport/exportAnnualAssessment?signYear='+vm.chooseYear+

+ 12 - 0
app/statistics/js/comprehensive-query.js

@ -716,6 +716,8 @@ new Vue({
						// FileSaver()
					})
					.catch(function(err){
						toastr.info(err)
						vm.fullscreenLoading = false
						console.error(err)
					})
					
@ -748,6 +750,8 @@ new Vue({
						// FileSaver()
					})
					.catch(function(err){
						toastr.info(err)
						vm.fullscreenLoading = false
						console.error(err)
					})
					
@ -780,6 +784,8 @@ new Vue({
						// FileSaver()
					})
					.catch(function(err){
						toastr.info(err)
						vm.fullscreenLoading = false
						console.error(err)
					})
					// var str = httpRequest.server + 'statisticsExport/exportSickList?year='+chooseYear+'&startDate='+startDate+'&endDate='+endDate+
@ -811,6 +817,8 @@ new Vue({
						// FileSaver()
					})
					.catch(function(err){
						toastr.info(err)
						vm.fullscreenLoading = false
						console.error(err)
					})
					// var str = httpRequest.server + 'statisticsExport/getBirthdayPatientListExport?signYear='+chooseYear+'&startDate='+startDate+'&endDate='+endDate+
@ -844,6 +852,8 @@ new Vue({
						// FileSaver()
					})
					.catch(function(err){
						toastr.info(err)
						vm.fullscreenLoading = false
						console.error(err)
					})
					// var str = httpRequest.server + 'statisticsExport/exportDoorServiceList?signYear='+chooseYear+'&startDate='+startDate+'&endDate='+endDate+
@ -878,6 +888,8 @@ new Vue({
						// FileSaver()
					})
					.catch(function(err){
						toastr.info(err)
						vm.fullscreenLoading = false
						console.error(err)
					})
					// var str = httpRequest.server + 'statisticsExport/exportPrescriptionList?signYear='+chooseYear+'&startDate='+startDate+'&endDate='+endDate+

+ 2 - 0
app/statistics/js/consult-not-reply.js

@ -162,6 +162,8 @@ new Vue({
					// FileSaver()
				})
				.catch(function(err){
					toastr.info(err)
					vm.fullscreenLoading = false
					console.error(err)
				})