From 37fcd5a9640b9eeefd02c9e0c5af58de56b28557 Mon Sep 17 00:00:00 2001 From: wanglei Date: Fri, 5 Jul 2024 16:16:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A1=A3=E6=A1=88=E9=87=87=E9=9B=86=E3=80=81?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E8=AE=B0=E5=BD=95=20=E9=87=8D=E6=96=B0?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E8=AF=86=E5=88=AB=E4=BB=BB=E5=8A=A1=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dangan-ui/src/api/dangan/collection.js | 13 +- dangan-ui/src/api/dangan/task.js | 9 ++ dangan-ui/src/utils/request.js | 2 +- .../src/views/dangan/collection/index.vue | 112 +++++++----------- dangan-ui/src/views/dangan/task/index.vue | 90 ++++++++++++-- 5 files changed, 149 insertions(+), 77 deletions(-) diff --git a/dangan-ui/src/api/dangan/collection.js b/dangan-ui/src/api/dangan/collection.js index 6d63ea8..bc4abae 100644 --- a/dangan-ui/src/api/dangan/collection.js +++ b/dangan-ui/src/api/dangan/collection.js @@ -19,17 +19,26 @@ export function collectRecongnize(data) { return request({ url: '/dangan/collect/recongnize', method: 'post', - timeout: 100000000, data: data }) } // 识别 组 -export function collectRecongnizeZu(data) { +/*export function collectRecongnizeZu(data) { return request({ url: '/dangan/collect/recongnizeZu', method: 'post', timeout: 1000000, data: data }) +}*/ + + +// 重新提交识别 +export function reRecongnize(data) { + return request({ + url: '/dangan/collect/reRecongnize', + method: 'post', + data: data + }) } diff --git a/dangan-ui/src/api/dangan/task.js b/dangan-ui/src/api/dangan/task.js index 0bf9ed5..ebeea39 100644 --- a/dangan-ui/src/api/dangan/task.js +++ b/dangan-ui/src/api/dangan/task.js @@ -42,3 +42,12 @@ export function delTask(id) { method: 'delete' }) } + +// 查询图片 +export function listByIds(query) { + return request({ + url: '/dangan/pictureRecard/listByIds', + method: 'get', + params: query + }) +} diff --git a/dangan-ui/src/utils/request.js b/dangan-ui/src/utils/request.js index 1428f2b..c26c84c 100644 --- a/dangan-ui/src/utils/request.js +++ b/dangan-ui/src/utils/request.js @@ -97,7 +97,7 @@ service.interceptors.response.use(res => { return Promise.reject('会话已过期,或者被挤下线,请重新登录。') } else if (code === 500) { Message({ message: msg, type: 'error' }) - return Promise.reject(new Error(msg)) + return Promise.reject(res.data) } else if (code === 601) { Message({ message: msg, type: 'warning' }) return Promise.reject('error') diff --git a/dangan-ui/src/views/dangan/collection/index.vue b/dangan-ui/src/views/dangan/collection/index.vue index de312b8..88c099c 100644 --- a/dangan-ui/src/views/dangan/collection/index.vue +++ b/dangan-ui/src/views/dangan/collection/index.vue @@ -49,10 +49,6 @@
-
- -
- 全选
@@ -206,13 +202,21 @@ -
-
- {{ percentage }} / - {{ checkLength }} + + +
+ OCR识别任务提交失败,请选择【暂不处理继续采集】或【重新提交任务】或【去任务记录】查看! +
+ -
拼命识别中...
-
+ +
@@ -222,16 +226,16 @@ import { listCatalog } from "@/api/dangan/catalog"; import Treeselect from "@riophae/vue-treeselect"; import "@riophae/vue-treeselect/dist/vue-treeselect.css"; import { getCabinetTree } from "@/api/dangan/cabinet"; -import { collectSaves, collectRecongnize } from "@/api/dangan/collection"; +import { collectSaves, collectRecongnize, reRecongnize } from "@/api/dangan/collection"; import '@/utils/WebScan'; -import axios from 'axios' export default { name: "Collection", components: {Treeselect}, data() { return { - isFails: false, + tsVisible: false, + taskId: null, // 颜色模式,0:黑白 1:灰色 2:彩色 pixel: 1, // 是否单面 @@ -272,9 +276,6 @@ export default { wlsjNode: undefined, list: [] }, - percentage: 0, - openProgress: false, - Interval : null }; }, watch: { @@ -602,43 +603,42 @@ export default { this.checkLength = arr.length; if(arr.length>0){ - this.percentage = 0; - this.openProgress = true; collectRecongnize(arr).then(response => { - if(response.fails&&response.fails.length>0){ - this.pictureRecard = response.fails - this.isFails = true; - this.$alert(`${response.msg},请重新识别失败档案!`, `提示`, { - type: 'warning' - }); - }else { - this.isFails = false; - this.pictureRecard = []; - this.$modal.msgSuccess(response.msg); - } + this.pictureRecard = []; this.checkAll = false; - clearInterval(this.Interval); - this.openProgress = false; - }).catch(()=>{ - clearInterval(this.Interval); - this.openProgress = false; - }); - - this.Interval = setInterval(()=> { - if(this.percentage===this.checkLength || this.percentage>this.checkLength){ - clearInterval(this.Interval); - this.Interval = null; - }else { - this.getProgress() + this.$modal.msgSuccess(response.msg); + }).catch((err)=>{ + console.log(123,err); + if(err.taskId){ + this.taskId = err.taskId; + this.tsVisible = true; } - }, 5000); - + }); }else { this.$alert(`请先选择需要识别的档案!`, `提示`, { type: 'warning' }); } }, + // 暂不处理继续采集 + onZbqljxcj(){ + this.pictureRecard = []; + this.checkAll = false; + this.tsVisible = false; + }, + // 重新提交任务 + qxtjTask(){ + reRecongnize({taskId: this.taskId}).then(response => { + this.pictureRecard = []; + this.checkAll = false; + this.tsVisible = false; + this.$modal.msgSuccess(response.msg); + }) + }, + // 去任务记录页面 + goTask(){ + this.$router.push("/task"); + }, // 删除 点击上传 deleteFile(index){ this.fileList.splice(index, 1); @@ -661,29 +661,7 @@ export default { // 创建File对象 const file = new File([blob], fileName, {type: mimeString}); return file; - }, - /** 查询识别进度 */ - 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 = response.data.file_counts; - - if(this.percentage===this.checkLength||this.percentage>this.checkLength){ - clearInterval(this.Interval); - this.Interval = null; - } - - }).catch((error)=> { - console.log(error) - }) - }, + } } }; diff --git a/dangan-ui/src/views/dangan/task/index.vue b/dangan-ui/src/views/dangan/task/index.vue index f003983..6bd0365 100644 --- a/dangan-ui/src/views/dangan/task/index.vue +++ b/dangan-ui/src/views/dangan/task/index.vue @@ -51,7 +51,6 @@ -