Zt il y a 1 an
Parent
commit
f8288ca944

+ 2 - 2
reado-app/manifest.json

@@ -124,8 +124,8 @@
         },
         "template" : "index.html",
         "router" : {
-            "base" : "./",
-            "mode" : "hash"
+            "base" : "",
+            "mode" : "history"
         },
         "title" : "Easy Industrial Report"
     }

+ 19 - 2
reado-app/pages/reportForm/report-detail/index.vue

@@ -22,7 +22,11 @@
 		onLoad(options) {
 			this.id = options.id
 			this.title = options.title
-			this.src = `/static/webview/report-wv.html?id=${this.id}`
+			const randomId=this.GetQueryString('randomId')
+			const printArea=this.GetQueryString('printArea')
+			const printAreaValue=this.GetQueryString('printAreaValue')
+			
+			this.src = `/static/webview/report-wv.html?id=${this.id}&randomId=${randomId}&printArea=${printArea}&printAreaValue=${printAreaValue}`
 			// this.getReportTable()
 		},
 		onReady() {
@@ -40,12 +44,25 @@
 				});
 			},
 			//报表详情
-			getReportTable(){
+			getReportTable() {
 				uni.$http.get('/reportTable/getReportTableById', {
 					id: this.id
 				}).then(res => {
 					console.log(res, 'res');
+					if (res.data.code === 200) {
+						// this.title=res.data.data.reportTableName
+					}
 				})
+			},
+			GetQueryString(name) {
+				var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
+				var r = window.location.search.substr(1).match(reg); //获取url中"?"符后的字符串并正则匹配
+				var context = "";
+				if (r != null)
+					context = decodeURIComponent(r[2]);
+				reg = null;
+				r = null;
+				return context == null || context == "" || context == "undefined" ? "" : context;
 			}
 		}
 	}

+ 28 - 13
reado-app/static/webview/plugins/excelopput.js

@@ -16,22 +16,37 @@ function exportSheetExcel(luckysheet, images, name = "file") { // 参数为lucky
 	const buffer = workbook.xlsx.writeBuffer()
 	// 5.保存为文件
 	buffer.then(function(buf) {
-		// saveFile(buf, name);
-		var formData = new FormData();
-		formData.append("file", buf);
-		$.ajax({
-			url: 'http://192.168.0.11:8084/api/uploadExcel',
-			type:'POST',
-			data: formData,
-			contentType: false,
-			processData: false,
-			success: (res) => {
-				console.log(res);
-			}
-		})
+		saveFile(buf, name);
+		uploadExcel(buf,'http://192.168.0.11:8084/api/uploadExcel')
+		
+	})
+}
+
+function uploadExcel(buffer, url) {
+	const formData = new FormData();
+	const randomId = GetQueryString('randomid')
+	formData.append('file', new Blob([buffer], {
+		type: 'application/octet-stream'
+	}));
+	formData.append("randomId", randomId);
+	$.ajax({
+		url: url,
+		type: 'POST',
+		data: formData,
+		processData: false, // 告诉jQuery不要处理发送的数据
+		contentType: false, // 告诉jQuery不要设置Content-Type请求头
+		success: function(response) {
+			// 上传成功
+			console.log('上传成功');
+		},
+		error: function(xhr, status, error) {
+			// 上传失败
+			console.error('上传失败');
+		}
 	})
 }
 
+
 function arrayBufferToBase64(array) {
 	array = new Uint8Array(array);
 	var length = array.byteLength;