上传历史记录 识别添加

master
wanglei 1 year ago
parent 3e5a880774
commit 3a068e2fee

@ -118,9 +118,9 @@
v-hasPermi="['dangan:pictureRecard:export']" v-hasPermi="['dangan:pictureRecard:export']"
>导出图片</el-button> >导出图片</el-button>
</el-col> </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-button icon="el-icon-full-screen" size="mini" type="primary" @click="OCRRecognition">OCR</el-button>
</el-col>--> </el-col>
</el-row> </el-row>
<el-table v-loading="loading" :data="pictureRecardList" @selection-change="handleSelectionChange" border> <el-table v-loading="loading" :data="pictureRecardList" @selection-change="handleSelectionChange" border>
@ -132,8 +132,8 @@
</template> </template>
</el-table-column>--> </el-table-column>-->
<el-table-column label="档案目录路径" align="center" prop="muPath" min-width="120" show-overflow-tooltip/> <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="档案室密集柜ID" align="center" prop="wlsjId" min-width="120"/>
<el-table-column label="档案室密集柜路径" align="center" prop="wlsjPath" min-width="100" show-overflow-tooltip/> <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> <el-table-column label="是否已经识别" align="center" prop="recognize" min-width="120" show-overflow-tooltip>
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.recognize" :value="scope.row.recognize"/> <dict-tag :options="dict.type.recognize" :value="scope.row.recognize"/>
@ -175,27 +175,36 @@
</div> </div>
<div class="myProgress" v-show="openProgress"> <!--采集识别失败提示-->
<div style="font-size: 50px"> <el-dialog
<span style="color: #409EFF">{{ percentage }}</span> / title="提示"
<span style="color: #67C23A">{{ selectionList.length }} </span> :visible.sync="tsVisible"
width="500px">
<div style="padding: 0 30px; line-height: 30px">
OCR识别任务提交失败请选择暂不处理继续采集重新提交任务去任务记录查看!
</div> </div>
<div style="margin-top:20px;">拼命识别中...</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> </div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listPictureRecard, delPictureRecard } from "@/api/dangan/pictureRecard"; import { listPictureRecard, delPictureRecard } from "@/api/dangan/pictureRecard";
import { collectRecongnize } from "@/api/dangan/collection"; import { collectRecongnize, reRecongnize } from "@/api/dangan/collection";
import axios from 'axios' import { listTask } from "@/api/dangan/task";
export default { export default {
name: "PictureRecard", name: "PictureRecard",
dicts: ['recognize', 'yw_type', 'error_correct'], dicts: ['recognize', 'yw_type', 'error_correct', 'total_task', 'tatal_task_pic'],
data() { data() {
return { return {
tsVisible: false,
taskId: null,
// //
loading: true, loading: true,
// //
@ -282,7 +291,11 @@ export default {
}).catch(() => {}); }).catch(() => {});
}, },
// OCR // 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 arr = [];
let singeOrDouble = 0 let singeOrDouble = 0
if(this.queryParams.ywType==='option1'){ if(this.queryParams.ywType==='option1'){
@ -292,34 +305,66 @@ export default {
item.singeOrDouble = singeOrDouble item.singeOrDouble = singeOrDouble
arr.push(item); arr.push(item);
}) })
if(arr.length>0){
this.percentage = 0; if (arr.length === 0) {
this.openProgress = true; this.$alert(`请先选择需要识别的档案!`, `提示`, {
collectRecongnize(arr).then(response => { type: 'warning'
this.selectionList = [];
clearInterval(this.Interval);
this.openProgress = false;
this.$modal.msgSuccess("操作成功");
this.getList();
}).catch(()=>{
clearInterval(this.Interval);
this.openProgress = false;
}); });
return;
}
this.Interval = setInterval(()=> { if(arr.length > tatal_task_pic[0].value){
if(this.percentage===this.selectionList.length||this.percentage>this.selectionList.length){ this.$alert(`单任务图片最大数是【${tatal_task_pic[0].value}】!`, `提示`, {
clearInterval(this.Interval); type: 'warning'
this.Interval = null; });
}else { return;
this.getProgress()
} }
}, 5000);
}else { let total1 = await listTask({status: '1'}).then(response => {
this.$alert(`请先选择需要识别的档案!`, `提示`, { 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.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() { handleExport() {
@ -332,30 +377,7 @@ export default {
this.download('dangan/pictureRecard/exportImage', { this.download('dangan/pictureRecard/exportImage', {
...this.queryParams ...this.queryParams
}, `上传历史记录图片_${new Date().getTime()}.zip`) }, `上传历史记录图片_${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> </script>
@ -365,22 +387,6 @@ export default {
display: flex; 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 { .c-tabs__item {
cursor: pointer; cursor: pointer;
text-align: right; text-align: right;

Loading…
Cancel
Save