同时接收任务最大数、单任务图片最大数限制添加

master
wanglei 1 year ago
parent 8088cbea15
commit 992769362d

@ -227,11 +227,13 @@ import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { getCabinetTree } from "@/api/dangan/cabinet"; import { getCabinetTree } from "@/api/dangan/cabinet";
import { collectSaves, collectRecongnize, reRecongnize } from "@/api/dangan/collection"; import { collectSaves, collectRecongnize, reRecongnize } from "@/api/dangan/collection";
import { listTask } from "@/api/dangan/task";
import '@/utils/WebScan'; import '@/utils/WebScan';
export default { export default {
name: "Collection", name: "Collection",
components: {Treeselect}, components: {Treeselect},
dicts: ['total_task', 'tatal_task_pic'],
data() { data() {
return { return {
tsVisible: false, tsVisible: false,
@ -490,9 +492,16 @@ export default {
}, },
// //
submitFiles(type) { submitFiles(type) {
if(type===1){
if(this.smwj.list.length>0){ if (type === 1) {
if (this.smwj.list.length === 0) {
this.$alert(`请先开始扫描!`, `提示`, {
type: 'warning'
});
return;
}
const formData = new FormData(); const formData = new FormData();
let fileSize = 0; let fileSize = 0;
this.smwj.list.forEach((item) => { this.smwj.list.forEach((item) => {
@ -501,10 +510,8 @@ export default {
formData.append('files', item.file); formData.append('files', item.file);
}); });
console.log(22222, fileSize/1024/1024);
// //
if(fileSize/1024/1024 < this.upload.fileSize){ if (fileSize / 1024 / 1024 < this.upload.fileSize) {
const DaPicturesRecard = {} const DaPicturesRecard = {}
DaPicturesRecard.muId = this.dangAnNode.key; DaPicturesRecard.muId = this.dangAnNode.key;
DaPicturesRecard.muPath = this.getAllLabels(this.dangAnNode); DaPicturesRecard.muPath = this.getAllLabels(this.dangAnNode);
@ -520,20 +527,21 @@ export default {
}).catch(err => { }).catch(err => {
this.smwj.loading = false; this.smwj.loading = false;
}); });
}else { } else {
this.$alert(`上传文件大小不能超过 ${this.upload.fileSize} MB!`, `提示`, { this.$alert(`上传文件大小不能超过 ${this.upload.fileSize} MB!`, `提示`, {
type: 'warning' type: 'warning'
}); });
} }
}else { } else {
this.$alert(`请先开始扫描!`, `提示`, {
if (this.fileList.length === 0) {
this.$alert(`请先上传图片!`, `提示`, {
type: 'warning' type: 'warning'
}); });
return;
} }
}else {
if(this.fileList.length>0){
const formData = new FormData(); const formData = new FormData();
let fileSize = 0; let fileSize = 0;
this.fileList.forEach((file) => { this.fileList.forEach((file) => {
@ -542,7 +550,7 @@ export default {
}); });
// //
if(fileSize/1024/1024 < this.upload.fileSize){ if (fileSize / 1024 / 1024 < this.upload.fileSize) {
const DaPicturesRecard = {} const DaPicturesRecard = {}
DaPicturesRecard.muId = this.dangAnNode.key; DaPicturesRecard.muId = this.dangAnNode.key;
@ -561,17 +569,11 @@ export default {
this.upload.loading = false; this.upload.loading = false;
}); });
}else { } else {
this.$alert(`上传文件大小不能超过 ${this.upload.fileSize} MB!`, `提示`, { this.$alert(`上传文件大小不能超过 ${this.upload.fileSize} MB!`, `提示`, {
type: 'warning' type: 'warning'
}); });
} }
}else {
this.$alert(`请先上传图片!`, `提示`, {
type: 'warning'
});
}
} }
}, },
// //
@ -617,7 +619,11 @@ export default {
this.checkAll = checkAll this.checkAll = checkAll
}, },
// OCR // OCR
OCRRecognition(){ async OCRRecognition(){
let tatal_task_pic = this.dict.type.tatal_task_pic;
let total_task = this.dict.type.total_task;
this.checkLength = 0; this.checkLength = 0;
let arr = []; let arr = [];
let singeOrDouble = 0 let singeOrDouble = 0
@ -633,7 +639,30 @@ export default {
this.checkLength = arr.length; this.checkLength = arr.length;
if(arr.length>0){ if(arr.length === 0){
this.$alert(`请先选择需要识别的档案!`, `提示`, {
type: 'warning'
});
return;
}
if(this.checkLength > tatal_task_pic[0].value){
this.$alert(`单任务图片最大数是【${tatal_task_pic[0].value}】!`, `提示`, {
type: 'warning'
});
return;
}
let total1 = await listTask({status: '1'}).then(response => {
return response.total;
});
if(total1 > total_task[0].value || total1 == total_task[0].value){
this.$alert(`同时接收任务最大数【${total_task[0].value}】,请稍后再试!`, `提示`, {
type: 'warning'
});
return;
}
const loading = this.$loading({ const loading = this.$loading({
lock: true, lock: true,
@ -649,17 +678,12 @@ export default {
loading.close(); loading.close();
}).catch((err)=>{ }).catch((err)=>{
loading.close(); loading.close();
console.log(123,err);
if(err.taskId){ if(err.taskId){
this.taskId = err.taskId; this.taskId = err.taskId;
this.tsVisible = true; this.tsVisible = true;
} }
}); });
}else {
this.$alert(`请先选择需要识别的档案!`, `提示`, {
type: 'warning'
});
}
}, },
// //
onZbqljxcj(){ onZbqljxcj(){

Loading…
Cancel
Save