From 281c1e6f9622addf4d1b48b08c688cedb0c856ec Mon Sep 17 00:00:00 2001 From: xjiangyan Date: Thu, 16 Mar 2023 13:28:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=8E=B7=E5=8F=96=E5=85=A8?= =?UTF-8?q?=E9=83=A8=E5=9B=BE=E7=89=87=E7=9A=84=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=83=8C=E9=9D=A2=E6=97=8B=E8=BD=AC180=C2=B0?= =?UTF-8?q?=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/static/js/WebScan.js | 35 +++++++++++++++ config/static/js/scanWeb.js | 88 +++++++++++++++++++++++++++---------- config/static/webScan.html | 7 ++- 3 files changed, 106 insertions(+), 24 deletions(-) diff --git a/config/static/js/WebScan.js b/config/static/js/WebScan.js index 449fd17..d8123e9 100644 --- a/config/static/js/WebScan.js +++ b/config/static/js/WebScan.js @@ -330,6 +330,41 @@ } }) }, + getHistoryImagesCount: function (callback) { + jQuery.ajax({ + type: 'get', + url: this.url + "/image/getHistoryImagesCount", + data: { + "pid": this.clientId + }, + success: function (data) { + callback(data); + }, + error: function () { + var result = new Result(500, "网络错误", null); + callback(result); + } + }) + }, + getRangeImage: function (startIndex, count, callback) { + jQuery.ajax({ + type: 'get', + url: this.url + "/image/getRangeImage", + cache: false, + data: { + "pid": this.clientId, + "startIndex": startIndex, + "count": count + }, + success: function (data) { + callback(data); + }, + error: function () { + var result = new Result(500, "网络错误", null); + callback(result); + } + }) + }, deleteImage: function (imageName, callback) { jQuery.ajax({ type: 'post', diff --git a/config/static/js/scanWeb.js b/config/static/js/scanWeb.js index 7336adf..2a170eb 100644 --- a/config/static/js/scanWeb.js +++ b/config/static/js/scanWeb.js @@ -27,6 +27,7 @@ new Vue({ noiseDetachEnable: true,//去除噪点 scanner noiseDetach: 15,//噪点阈值 10-50 scanner prefix: '', + backRotate180: false, upload: {//上传参数 uploadMode: 2,//是否边扫边上传 0:http 1:ftp 2:不上传 httpUrl: '',//上传地址 @@ -219,7 +220,7 @@ new Vue({ "image": image, "index": index } - console.log("selectImage: " + JSON.stringify(this.selectImageObj)) + // console.log("selectImage: " + JSON.stringify(this.selectImageObj)) this.loadImage(image); this.selectManyImages = new Array(); this.selectManyImages.push(index); @@ -269,21 +270,64 @@ new Vue({ } that.pid = result.data; //获取上次的扫描结果 - that.getAllImages(); + that.getHistoryImages(); that.getDevices(); loading.close(); }); }, - getAllImages: function () { - var that = this; - var loading = this.eleLoadding(); - this.WebScan.getAllImages(function (result) { - console.log("getAllImages: " + JSON.stringify(result)) + /* getAllImages: function () { + var that = this; + var loading = this.eleLoadding(); + this.WebScan.getAllImages(function (result) { + // console.log("getAllImages: " + JSON.stringify(result)) + loading.close(); + if (result.code == 200) { + if (result.data != null && result.data.length > 0) { + that.urls = result.data; + } + } else { + that.eleMessage(result.msg, "warning"); + } + }) + },*/ + getHistoryImages: function () { + var that = this; + let loading = this.eleLoadding(); + + this.WebScan.getHistoryImagesCount(function (result) { + console.log("getHistoryImagesCount: " + JSON.stringify(result)) loading.close(); if (result.code == 200) { - if (result.data != null && result.data.length > 0) { - that.urls = result.data; + if (result.data != null) { + let count = result.data; + that.urls = Array.from({length: count}, () => ''); + + let onceCount = 40; + let number = Math.floor(count / onceCount); + if (count % onceCount != 0) { + number = number + 1; + } + console.log("getRangeImage number: " + number) + + for (let i = 0; i < number; i++) { + + that.WebScan.getRangeImage(i * onceCount, onceCount, function (result) { + // console.log("getRangeImage: " + JSON.stringify(result)) + + let startIndex = parseInt(result.data.startIndex); + + let list = result.data.images; + let length = list.length; + + console.log("getRangeImage length: " + length) + + for (let j = startIndex; j < startIndex + length; j++) { + that.urls[j] = list[j - startIndex].imageName + } + + }) + } } } else { that.eleMessage(result.msg, "warning"); @@ -868,7 +912,7 @@ new Vue({ this.canvas.selection = true; this.canvas.on("mouse:down", function (e) { that.startP = that.canvas.getPointer(e); - console.log(that.startP); + // console.log(that.startP); }) that.canvas.on("mouse:up", function (e) { var endPointer = that.canvas.getPointer(e); @@ -1033,7 +1077,7 @@ new Vue({ var that = this; var loading = this.eleLoadding(); - console.log('save image dataUrl:' + dataUrl) + // console.log('save image dataUrl:' + dataUrl) this.WebScan.saveImage(this.imageName, dataUrl, function (result) { loading.close(); if (result.code == 200) { @@ -1055,7 +1099,7 @@ new Vue({ var loading = this.eleLoadding(); var that = this; this.WebScan.majorOFD(true, function (result) { - console.log("majorOFD: " + JSON.stringify(result)) + // console.log("majorOFD: " + JSON.stringify(result)) loading.close(); if (result.code == 200) { @@ -1092,7 +1136,7 @@ new Vue({ var loading = this.eleLoadding(); var that = this; this.WebScan.majorOFDFile(true, function (result) { - console.log("majorOFD: " + JSON.stringify(result)) + // console.log("majorOFD: " + JSON.stringify(result)) loading.close(); if (result.status == 200) { @@ -1123,7 +1167,7 @@ new Vue({ var loading = this.eleLoadding(); var that = this; this.WebScan.majorPDF(function (result) { - console.log("majorPDF: " + JSON.stringify(result)) + // console.log("majorPDF: " + JSON.stringify(result)) loading.close(); if (result.code == 200) { @@ -1160,7 +1204,7 @@ new Vue({ var loading = this.eleLoadding(); var that = this; this.WebScan.majorPDFFile(function (result) { - console.log("majorPDF: " + JSON.stringify(result.response)) + // console.log("majorPDF: " + JSON.stringify(result.response)) loading.close(); if (result.status == 200) { @@ -1193,7 +1237,7 @@ new Vue({ var loading = this.eleLoadding(); var that = this; this.WebScan.majorTiff(function (result) { - console.log("majorTiff: " + JSON.stringify(result)) + // console.log("majorTiff: " + JSON.stringify(result)) loading.close(); if (result.code == 200) { @@ -1230,7 +1274,7 @@ new Vue({ var loading = this.eleLoadding(); var that = this; this.WebScan.majorTiffFile(function (result) { - console.log("majorTiff: " + result) + // console.log("majorTiff: " + result) loading.close(); if (result.status == 200) { @@ -1264,7 +1308,7 @@ new Vue({ var loading = this.eleLoadding(); var that = this; this.WebScan.majorZip(function (result) { - console.log("majorZip: " + JSON.stringify(result)) + // console.log("majorZip: " + JSON.stringify(result)) loading.close(); if (result.code == 200) { @@ -1301,7 +1345,7 @@ new Vue({ var loading = this.eleLoadding(); var that = this; this.WebScan.majorZipFile(function (result) { - console.log("majorZip: " + JSON.stringify(result)) + // console.log("majorZip: " + JSON.stringify(result)) loading.close(); if (result.status == 200) { @@ -1482,7 +1526,7 @@ new Vue({ that.WebScan.split(that.selectImageObj.image.imageName, isHorizontal, that.assistLine.x1, that.assistLine.y1, that.assistLine.x2, that.assistLine.y2, function (result) { loading.close(); - console.log('拆分结果:' + JSON.stringify(result)) + // console.log('拆分结果:' + JSON.stringify(result)) if (result.code == 200) { that.eleMessage("切分成功", "success"); that.selectImageObj.image.src = result.data.oneSrc; @@ -1492,7 +1536,7 @@ new Vue({ "src": result.data.oneSrc } that.loadImage(currentImage) - that.getAllImages() + that.getHistoryImages() } else { that.eleMessage(result.msg, "warning"); } @@ -1534,7 +1578,7 @@ new Vue({ "src": data.src, "imageName": data.imageName } - that.getAllImages() + that.getHistoryImages() that.loadImage(image) } else { that.eleMessage(result.msg, "warning"); diff --git a/config/static/webScan.html b/config/static/webScan.html index 0eab495..422295d 100644 --- a/config/static/webScan.html +++ b/config/static/webScan.html @@ -253,9 +253,9 @@ + width="40%">
- @@ -335,6 +335,9 @@ + + +