优化获取全部图片的逻辑,添加背面旋转180°的功能

This commit is contained in:
xjiangyan 2023-03-16 13:28:14 +08:00
parent ea657e4a82
commit 281c1e6f96
3 changed files with 106 additions and 24 deletions

View File

@ -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',

View File

@ -27,6 +27,7 @@ new Vue({
noiseDetachEnable: true,//去除噪点 scanner
noiseDetach: 15,//噪点阈值 10-50 scanner
prefix: '',
backRotate180: false,
upload: {//上传参数
uploadMode: 2,//是否边扫边上传 0http 1ftp 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,16 +270,16 @@ new Vue({
}
that.pid = result.data;
//获取上次的扫描结果
that.getAllImages();
that.getHistoryImages();
that.getDevices();
loading.close();
});
},
getAllImages: function () {
/* getAllImages: function () {
var that = this;
var loading = this.eleLoadding();
this.WebScan.getAllImages(function (result) {
console.log("getAllImages: " + JSON.stringify(result))
// console.log("getAllImages: " + JSON.stringify(result))
loading.close();
if (result.code == 200) {
@ -289,6 +290,49 @@ new Vue({
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) {
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");
}
})
},
deleteImage: function () {
var that = this;
@ -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");

View File

@ -253,9 +253,9 @@
<el-dialog
title="扫描设定"
:visible.sync="isSetup"
width="30%">
width="40%">
<div class="messageBox">
<el-form ref="form" :model="form" :rules="rules" label-width="80px"
<el-form ref="form" :model="form" :rules="rules" label-width="120px"
style="padding-left:10px">
<el-tabs v-model="activeName">
<el-tab-pane label="扫描参数" name="1">
@ -335,6 +335,9 @@
<el-option label="270度" :value="270"></el-option>
</el-select>
</el-form-item>
<el-form-item label="背面旋转180°">
<el-switch v-model="form.backRotate180"></el-switch>
</el-form-item>
<el-form-item label="图像分割">
<el-select v-model="form.splitImage" placeholder="图像分割">
<el-option label="不分割" :value=0></el-option>