上传历史记录 识别添加

master
wanglei 1 year ago
parent 3e5a880774
commit 3a068e2fee

@ -118,9 +118,9 @@
v-hasPermi="['dangan:pictureRecard:export']"
>导出图片</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-col :span="1.5">
<el-button icon="el-icon-full-screen" size="mini" type="primary" @click="OCRRecognition">OCR</el-button>
</el-col>-->
</el-col>
</el-row>
<el-table v-loading="loading" :data="pictureRecardList" @selection-change="handleSelectionChange" border>
@ -132,8 +132,8 @@
</template>
</el-table-column>-->
<el-table-column label="档案目录路径" align="center" prop="muPath" min-width="120" show-overflow-tooltip/>
<el-table-column label="档案室密集柜ID" align="center" prop="wlsjId" min-width="90"/>
<el-table-column label="档案室密集柜路径" align="center" prop="wlsjPath" min-width="100" show-overflow-tooltip/>
<el-table-column label="档案室密集柜ID" align="center" prop="wlsjId" min-width="120"/>
<el-table-column label="档案室密集柜路径" align="center" prop="wlsjPath" min-width="140" show-overflow-tooltip/>
<el-table-column label="是否已经识别" align="center" prop="recognize" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<dict-tag :options="dict.type.recognize" :value="scope.row.recognize"/>
@ -175,27 +175,36 @@
</div>
<div class="myProgress" v-show="openProgress">
<div style="font-size: 50px">
<span style="color: #409EFF">{{ percentage }}</span> /
<span style="color: #67C23A">{{ selectionList.length }} </span>
<!--采集识别失败提示-->
<el-dialog
title="提示"
:visible.sync="tsVisible"
width="500px">
<div style="padding: 0 30px; line-height: 30px">
OCR识别任务提交失败请选择暂不处理继续采集重新提交任务去任务记录查看!
</div>
<div style="margin-top:20px;">拼命识别中...</div>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" plain @click="onZbqljxcj"></el-button>
<el-button type="primary" plain @click="qxtjTask"></el-button>
<el-button type="primary" plain @click="goTask"></el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listPictureRecard, delPictureRecard } from "@/api/dangan/pictureRecard";
import { collectRecongnize } from "@/api/dangan/collection";
import axios from 'axios'
import { collectRecongnize, reRecongnize } from "@/api/dangan/collection";
import { listTask } from "@/api/dangan/task";
export default {
name: "PictureRecard",
dicts: ['recognize', 'yw_type', 'error_correct'],
dicts: ['recognize', 'yw_type', 'error_correct', 'total_task', 'tatal_task_pic'],
data() {
return {
tsVisible: false,
taskId: null,
//
loading: true,
//
@ -282,7 +291,11 @@ export default {
}).catch(() => {});
},
// OCR
OCRRecognition(){
async OCRRecognition(){
let tatal_task_pic = this.dict.type.tatal_task_pic;
let total_task = this.dict.type.total_task;
let arr = [];
let singeOrDouble = 0
if(this.queryParams.ywType==='option1'){
@ -292,34 +305,66 @@ export default {
item.singeOrDouble = singeOrDouble
arr.push(item);
})
if(arr.length>0){
this.percentage = 0;
this.openProgress = true;
collectRecongnize(arr).then(response => {
this.selectionList = [];
clearInterval(this.Interval);
this.openProgress = false;
this.$modal.msgSuccess("操作成功");
this.getList();
}).catch(()=>{
clearInterval(this.Interval);
this.openProgress = false;
if (arr.length === 0) {
this.$alert(`请先选择需要识别的档案!`, `提示`, {
type: 'warning'
});
return;
}
if(arr.length > tatal_task_pic[0].value){
this.$alert(`单任务图片最大数是【${tatal_task_pic[0].value}】!`, `提示`, {
type: 'warning'
});
return;
}
this.Interval = setInterval(()=> {
if(this.percentage===this.selectionList.length||this.percentage>this.selectionList.length){
clearInterval(this.Interval);
this.Interval = null;
}else {
this.getProgress()
}
}, 5000);
let total1 = await listTask({status: '1'}).then(response => {
return response.total;
});
}else {
this.$alert(`请先选择需要识别的档案`, `提示`, {
if(total1 > total_task[0].value || total1 == total_task[0].value){
this.$alert(`同时接收任务最大数【${total_task[0].value}】,请稍后再试!`, `提示`, {
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.selectionList = [];
this.$modal.msgSuccess("操作成功");
loading.close();
this.getList();
}).catch((err)=>{
loading.close();
this.taskId = err.taskId;
this.tsVisible = true;
});
},
//
onZbqljxcj(){
this.selectionList = [];
this.tsVisible = false;
},
//
qxtjTask(){
reRecongnize({taskId: this.taskId}).then(response => {
this.selectionList = [];
this.tsVisible = false;
this.$modal.msgSuccess(response.msg);
})
},
//
goTask(){
this.$router.push("/task");
},
/** 导出按钮操作 */
handleExport() {
@ -332,30 +377,7 @@ export default {
this.download('dangan/pictureRecard/exportImage', {
...this.queryParams
}, `上传历史记录图片_${new Date().getTime()}.zip`)
},
/** 查询识别进度 */
getProgress() {
// ID
//axios.post('http://20.206.150.166:22443/get_file_count',`username=${this.$store.state.user.name}`, {
axios.post('http://123.57.142.195:443/get_file_count',`username=${this.$store.state.user.name}`, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}).then((response)=>{
// this.percentage = Math.round((response.data.file_counts/this.selectionList.length)*100);
this.percentage = response.data.file_counts
if(this.percentage===this.selectionList.length||this.percentage>this.selectionList.length){
clearInterval(this.Interval);
this.Interval = null;
}
}).catch(function (error) {
//
console.log(error);
})
},
}
}
};
</script>
@ -365,22 +387,6 @@ export default {
display: flex;
}
.myProgress{
position: fixed;
top:0;
left:0;
z-index: 10000;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.7);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 20px;
color: white;
}
.c-tabs__item {
cursor: pointer;
text-align: right;

Loading…
Cancel
Save