diff --git a/dangan-ui/src/api/dangan/collection.js b/dangan-ui/src/api/dangan/collection.js
index 7b4cbff..a36d883 100644
--- a/dangan-ui/src/api/dangan/collection.js
+++ b/dangan-ui/src/api/dangan/collection.js
@@ -13,30 +13,22 @@ export function collectSaves(data) {
})
}
-// 新增档案目录
+// 识别
export function collectRecongnize(data) {
return request({
url: '/dangan/collect/recongnize',
method: 'post',
+ timeout: 100000000,
data: data
})
}
-
-// 新增档案目录 组
+// 识别 组
export function collectRecongnizeZu(data) {
return request({
url: '/dangan/collect/recongnizeZu',
method: 'post',
+ timeout: 1000000,
data: data
})
}
-
-
-// 获取进度条
-export function collectProgress() {
- return request({
- url: '/dangan/collect/progress',
- method: 'get'
- })
-}
diff --git a/dangan-ui/src/views/dangan/collection/index.vue b/dangan-ui/src/views/dangan/collection/index.vue
index 3353d12..4d9dce2 100644
--- a/dangan-ui/src/views/dangan/collection/index.vue
+++ b/dangan-ui/src/views/dangan/collection/index.vue
@@ -42,12 +42,6 @@
-
-
- 一组[OCR最多选择2张识别]
- 双面
-
-
全选
@@ -148,32 +142,23 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
@@ -214,6 +199,7 @@
拼命识别中...
+
@@ -222,8 +208,9 @@ import { catalogTreeselect } from "@/api/system/user";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
import { listBookshelf } from "@/api/dangan/bookshelf";
-import { collectSaves, collectRecongnize, collectProgress, collectRecongnizeZu } from "@/api/dangan/collection";
+import { collectSaves, collectRecongnize } from "@/api/dangan/collection";
import '@/utils/WebScan';
+import axios from 'axios'
export default {
name: "Collection",
@@ -263,10 +250,6 @@ export default {
pictureRecard: [],
// 是否全选
checkAll: false,
- // 是否一组
- isYiZu: false,
- // 是否双面
- isSuangMian: false,
// 扫描文件上传
smwj: {
loading: false,
@@ -288,19 +271,8 @@ export default {
}
},
created() {
+ console.log(this.$store.state.user.name);
this.getDeptTree();
-
- this.getProgress()
-
- /*this.Interval = setInterval(()=> {
- if(this.percentage===100){
- clearInterval(this.Interval);
- this.Interval = null;
- }else {
- this.getProgress()
- }
- }, 2000);*/
-
},
methods: {
// 初始化
@@ -346,9 +318,7 @@ export default {
},
// 扫描设定
WebScanSetParams(){
-
let _this = this;
-
let form = {
device: 'M3230',
autofeeder: 1,
@@ -396,7 +366,6 @@ export default {
"type":1
}]
};
-
_this.WebScan.setParams(form,function(result){
if(result.code!=200){
this.$alert(`${result.msg}`, `提示`, {
@@ -423,14 +392,17 @@ export default {
getDeptTree() {
catalogTreeselect().then(response => {
this.dangAnOptions = response.data;
-
if(this.$route.query.id){
this.$nextTick(() => {
this.$refs.tree.setCurrentKey(this.$route.query.id);
this.dangAnNode = this.$refs.tree.getNode(this.$route.query.id);
+ if(this.dangAnNode.data.ywType==='option1'){
+ this.single = true;
+ }else {
+ this.single = false;
+ }
});
}
-
});
},
// 筛选节点
@@ -442,6 +414,11 @@ export default {
handleNodeClick(data, Node) {
this.dangAnID = data.id;
this.dangAnNode = Node;
+ if(this.dangAnNode.data.ywType==='option1'){
+ this.single = true;
+ }else {
+ this.single = false;
+ }
},
/** 点击上传操作 */
handleUpload() {
@@ -502,17 +479,13 @@ export default {
this.smwj.list.forEach((item) => {
formData.append('files', this.dataURLtoFile(item.base64Str, item.fileName));
});
-
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;
@@ -532,17 +505,13 @@ export default {
this.fileList.forEach((file) => {
formData.append('files', file);
});
-
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;
@@ -571,19 +540,16 @@ export default {
// 获取所有label
getAllLabels(obj) {
let values = '';
-
function getValues(obj) {
if(values.length>0){
values = obj.label+'/'+values
}else {
values = obj.label
}
-
if(obj.level>1){
getValues(obj.parent);
}
}
-
getValues(obj);
return values;
},
@@ -605,57 +571,44 @@ export default {
},
// OCR识别
OCRRecognition(){
-
- if(this.isYiZu){
- let checked = [];
- let unchecked = [];
- let singeOrDouble = 0
- if(this.isSuangMian){
- singeOrDouble = 1
+ let arr = [];
+ let singeOrDouble = 0
+ if(this.single){
+ singeOrDouble = 1
+ }
+ this.pictureRecard.forEach(item => {
+ item.singeOrDouble = singeOrDouble
+ if(item.checked){
+ arr.push(item)
}
- this.pictureRecard.forEach(item => {
- item.singeOrDouble = singeOrDouble
- if(item.checked){
- checked.push(item)
+ })
+ if(arr.length>0){
+ this.openProgress = true;
+ collectRecongnize(arr).then(response => {
+ this.pictureRecard = [];
+ clearInterval(this.Interval);
+ this.openProgress = false;
+ this.$modal.msgSuccess("操作成功");
+ }).catch(()=>{
+ clearInterval(this.Interval);
+ this.openProgress = false;
+ });
+
+ this.getProgress()
+
+ this.Interval = setInterval(()=> {
+ if(this.percentage===100||this.percentage>100){
+ clearInterval(this.Interval);
+ this.Interval = null;
}else {
- unchecked.push(item)
+ this.getProgress()
}
- })
- if(checked.length>0){ //collectRecongnizeZu
- collectRecongnizeZu({
- checked,
- unchecked
- }).then(response => {
- this.pictureRecard = [];
- this.$modal.msgSuccess("操作成功");
- });
- }else {
- this.$alert(`请先选择需要识别的档案!`, `提示`, {
- type: 'warning'
- });
- }
+ }, 5000);
+
}else {
- let arr = [];
- let singeOrDouble = 0
- if(this.isSuangMian){
- singeOrDouble = 1
- }
- this.pictureRecard.forEach(item => {
- item.singeOrDouble = singeOrDouble
- if(item.checked){
- arr.push(item)
- }
- })
- if(arr.length>0){
- collectRecongnize(arr).then(response => {
- this.pictureRecard = [];
- this.$modal.msgSuccess("操作成功");
- });
- }else {
- this.$alert(`请先选择需要识别的档案!`, `提示`, {
- type: 'warning'
- });
- }
+ this.$alert(`请先选择需要识别的档案!`, `提示`, {
+ type: 'warning'
+ });
}
},
// 删除 点击上传
@@ -681,29 +634,33 @@ export default {
const file = new File([blob], fileName, {type: mimeString});
return file;
},
- /** 查询目录列表 */
+ /** 查询识别进度 */
getProgress() {
- collectProgress().then(response => {
- this.percentage = response*100;
- });
+ // 向给定ID的用户发起请求
+ axios.get('http://123.57.142.195:443/get_file_count',{ params: {
+ username: this.$store.state.user.name
+ }})
+ .then(function (response) {
+ this.percentage = (response.data.file_counts/this.pictureRecard.length)*100
+ }).catch(function (error) {
+ // 处理错误情况
+ console.log(error);
+ })
},
}
};