档案采集

master
wanglei 2 years ago
parent 88d62876f2
commit ceb872b0f9

@ -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'
})
}

@ -42,12 +42,6 @@
<el-empty :image-size="240" v-if="pictureRecard.length===0"></el-empty>
<div v-if="pictureRecard.length>0">
<div style="margin-bottom: 20px;">
<el-checkbox v-model="isYiZu">[OCR2]</el-checkbox>
<el-checkbox v-model="isSuangMian"></el-checkbox>
</div>
<el-checkbox v-model="checkAll" @change="handleCheckAllChange"></el-checkbox>
<div style="margin: 15px 0;"></div>
<el-checkbox v-for="item in pictureRecard" :label="item.picName" :key="item.id" v-model="item.checked" @change="handleCheckChange(item)">
@ -148,32 +142,23 @@
<div v-if="smwj.shelfId && smwj.list.length===0" style="width: 650px;margin-left: 20px;">
<div>
<el-row class="sm_row" :gutter="20">
<el-col class="sm_col" :span="12">
<label>颜色模式</label>
<el-col class="sm_col" :span="8">
<label style="width: 100px;">颜色模式</label>
<el-select v-model="pixel" placeholder="请选择颜色模式">
<el-option label="黑白" :value="0"></el-option>
<el-option label="灰色" :value="1"></el-option>
<el-option label="彩色" :value="2"></el-option>
</el-select>
</el-col>
<el-col class="sm_col" :span="12">
<label>单双面</label>
<el-select v-model="single" placeholder="请选择单双面">
<el-option label="单面" :value="false"></el-option>
<el-option label="双面" :value="true"></el-option>
</el-select>
</el-col>
</el-row>
<el-row class="sm_row" :gutter="20">
<el-col class="sm_col" :span="12">
<label>去白页</label>
<el-col class="sm_col" :span="8">
<label style="width: 100px;">去白页</label>
<el-select v-model="white" placeholder="请选择去白页">
<el-option label="是" :value="true"></el-option>
<el-option label="否" :value="false"></el-option>
</el-select>
</el-col>
<el-col class="sm_col" :span="12">
<label>分辨率</label>
<el-col class="sm_col" :span="8">
<label style="width: 100px;">分辨率</label>
<el-select v-model="resolution" placeholder="请选择分辨率">
<el-option label="100" :value="100"></el-option>
<el-option label="150" :value="150"></el-option>
@ -214,6 +199,7 @@
<el-progress type="circle" :percentage="percentage"></el-progress>
<div style="margin-top:20px;">拼命识别中...</div>
</div>
</div>
</template>
@ -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,39 +571,9 @@ export default {
},
// OCR
OCRRecognition(){
if(this.isYiZu){
let checked = [];
let unchecked = [];
let singeOrDouble = 0
if(this.isSuangMian){
singeOrDouble = 1
}
this.pictureRecard.forEach(item => {
item.singeOrDouble = singeOrDouble
if(item.checked){
checked.push(item)
}else {
unchecked.push(item)
}
})
if(checked.length>0){ //collectRecongnizeZu
collectRecongnizeZu({
checked,
unchecked
}).then(response => {
this.pictureRecard = [];
this.$modal.msgSuccess("操作成功");
});
}else {
this.$alert(`请先选择需要识别的档案!`, `提示`, {
type: 'warning'
});
}
}else {
let arr = [];
let singeOrDouble = 0
if(this.isSuangMian){
if(this.single){
singeOrDouble = 1
}
this.pictureRecard.forEach(item => {
@ -647,16 +583,33 @@ export default {
}
})
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 {
this.getProgress()
}
}, 5000);
}else {
this.$alert(`请先选择需要识别的档案!`, `提示`, {
type: 'warning'
});
}
}
},
//
deleteFile(index){
@ -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);
})
},
}
};
</script>
<style lang="scss" scoped>
::v-deep .el-checkbox__inner{
width: 20px;
height: 20px;
}
::v-deep .el-checkbox__inner::after {
height: 10px;
left: 7px;
top: 2px;
}
.smwjList{
width: 120px;
height: 100px;
@ -716,31 +673,28 @@ export default {
border-radius: 10px;
overflow: hidden;
}
.myProgress{
position: absolute;
top:0;
left:0;
z-index: 10;
width: 100%;
height: 100%;
background: rgba(255,255,255,0.8);
background: rgba(255,255,255,0.9);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
font-size: 20px;
}
.sm_col{
display: flex;
justify-content: space-between;
align-items: center
}
.sm_row{
margin-bottom: 10px;
}
::v-deep .el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content {
background-color: #fff18e;
}

Loading…
Cancel
Save