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

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,87 +492,87 @@ export default {
}, },
// //
submitFiles(type) { submitFiles(type) {
if(type===1){
if(this.smwj.list.length>0){
const formData = new FormData();
let fileSize = 0;
this.smwj.list.forEach((item) => {
item.file = this.dataURLtoFile(item.base64Str, item.fileName);
fileSize += item.file.size;
formData.append('files', item.file);
});
console.log(22222, fileSize/1024/1024); if (type === 1) {
//
if(fileSize/1024/1024 < this.upload.fileSize){
const DaPicturesRecard = {}
DaPicturesRecard.muId = this.dangAnNode.key;
DaPicturesRecard.muPath = this.getAllLabels(this.dangAnNode);
DaPicturesRecard.ywType = this.dangAnNode.data.ywType;
DaPicturesRecard.wlsjId = this.smwj.wlsjNode.key;
DaPicturesRecard.wlsjPath = this.getAllLabels(this.smwj.wlsjNode);
formData.append('picRecard', new Blob([JSON.stringify(DaPicturesRecard)], {type: 'application/json',}));
this.smwj.loading = true;
collectSaves(formData).then(response => {
this.pictureRecard = response.data;
this.smwj.open = false;
this.smwj.loading = false;
}).catch(err => {
this.smwj.loading = false;
});
}else {
this.$alert(`上传文件大小不能超过 ${this.upload.fileSize} MB!`, `提示`, {
type: 'warning'
});
}
}else { if (this.smwj.list.length === 0) {
this.$alert(`请先开始扫描!`, `提示`, { 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.smwj.list.forEach((item) => {
this.fileList.forEach((file) => { item.file = this.dataURLtoFile(item.base64Str, item.fileName);
fileSize += file.size; fileSize += item.file.size;
formData.append('files', file); formData.append('files', item.file);
}); });
// //
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); DaPicturesRecard.ywType = this.dangAnNode.data.ywType;
DaPicturesRecard.ywType = this.dangAnNode.data.ywType; DaPicturesRecard.wlsjId = this.smwj.wlsjNode.key;
DaPicturesRecard.wlsjId = this.upload.wlsjNode.key; DaPicturesRecard.wlsjPath = this.getAllLabels(this.smwj.wlsjNode);
DaPicturesRecard.wlsjPath = this.getAllLabels(this.upload.wlsjNode); formData.append('picRecard', new Blob([JSON.stringify(DaPicturesRecard)], {type: 'application/json',}));
formData.append('picRecard', new Blob([JSON.stringify(DaPicturesRecard)], {type: 'application/json',})); this.smwj.loading = true;
this.upload.loading = true; collectSaves(formData).then(response => {
this.pictureRecard = response.data;
collectSaves(formData).then(response => { this.smwj.open = false;
this.pictureRecard = response.data; this.smwj.loading = false;
this.upload.open = false; }).catch(err => {
this.upload.loading = false; this.smwj.loading = false;
}).catch(err => { });
this.upload.loading = false; } else {
}); this.$alert(`上传文件大小不能超过 ${this.upload.fileSize} MB!`, `提示`, {
type: 'warning'
});
}
}else { } else {
this.$alert(`上传文件大小不能超过 ${this.upload.fileSize} MB!`, `提示`, {
type: 'warning'
});
}
}else { if (this.fileList.length === 0) {
this.$alert(`请先上传图片!`, `提示`, { this.$alert(`请先上传图片!`, `提示`, {
type: 'warning' type: 'warning'
}); });
return;
}
const formData = new FormData();
let fileSize = 0;
this.fileList.forEach((file) => {
fileSize += file.size;
formData.append('files', file);
});
//
if (fileSize / 1024 / 1024 < this.upload.fileSize) {
const DaPicturesRecard = {}
DaPicturesRecard.muId = this.dangAnNode.key;
DaPicturesRecard.muPath = this.getAllLabels(this.dangAnNode);
DaPicturesRecard.ywType = this.dangAnNode.data.ywType;
DaPicturesRecard.wlsjId = this.upload.wlsjNode.key;
DaPicturesRecard.wlsjPath = this.getAllLabels(this.upload.wlsjNode);
formData.append('picRecard', new Blob([JSON.stringify(DaPicturesRecard)], {type: 'application/json',}));
this.upload.loading = true;
collectSaves(formData).then(response => {
this.pictureRecard = response.data;
this.upload.open = false;
this.upload.loading = false;
}).catch(err => {
this.upload.loading = false;
});
} else {
this.$alert(`上传文件大小不能超过 ${this.upload.fileSize} MB!`, `提示`, {
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,33 +639,51 @@ export default {
this.checkLength = arr.length; this.checkLength = arr.length;
if(arr.length>0){ if(arr.length === 0){
this.$alert(`请先选择需要识别的档案!`, `提示`, {
const loading = this.$loading({ type: 'warning'
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
}); });
return;
}
collectRecongnize(arr).then(response => { if(this.checkLength > tatal_task_pic[0].value){
this.pictureRecard = []; this.$alert(`单任务图片最大数是【${tatal_task_pic[0].value}】!`, `提示`, {
this.checkAll = false; type: 'warning'
this.$modal.msgSuccess(response.msg);
loading.close();
}).catch((err)=>{
loading.close();
console.log(123,err);
if(err.taskId){
this.taskId = err.taskId;
this.tsVisible = true;
}
}); });
}else { return;
this.$alert(`请先选择需要识别的档案!`, `提示`, { }
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' type: 'warning'
}); });
return;
} }
const loading = this.$loading({
lock: true,
text: 'Loading',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.7)'
});
collectRecongnize(arr).then(response => {
this.pictureRecard = [];
this.checkAll = false;
this.$modal.msgSuccess(response.msg);
loading.close();
}).catch((err)=>{
loading.close();
if(err.taskId){
this.taskId = err.taskId;
this.tsVisible = true;
}
});
}, },
// //
onZbqljxcj(){ onZbqljxcj(){

Loading…
Cancel
Save