382 lines
10 KiB
Java
382 lines
10 KiB
Java
<template>
|
|
<div class="ocr">
|
|
<a-card :bordered="false">
|
|
<div class="table-page-search-wrapper">
|
|
<search :flag="'2'" :url="url"/>
|
|
</div>
|
|
<div class="table-operator">
|
|
<div class="operator-text" @click="handleUpload">
|
|
<a-icon type="plus" />
|
|
{{ $t('upload1') }}
|
|
</div>
|
|
<div class="operator-text" @click="handleFileExport">
|
|
<a-icon type="export" />
|
|
{{ $t('RetrieveFiles') }}
|
|
</div>
|
|
<div class="operator-text" @click="handleDel">
|
|
<a-icon type="delete" />
|
|
{{ $t('BatchDelete') }}
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 上传弹框-->
|
|
<a-modal
|
|
class="show-content"
|
|
:title="$t('UploadFile')"
|
|
:visible="fileVisible"
|
|
:confirm-loading="confirmLoading"
|
|
@ok="modalOk"
|
|
@cancel="handleCancel"
|
|
>
|
|
<addForm
|
|
ref="fileForm"
|
|
@addFormClick="addFormClick"
|
|
:flag="'2'"
|
|
:accept="accept"
|
|
v-if="fileVisible"
|
|
:url="url">
|
|
</addForm>
|
|
</a-modal>
|
|
|
|
<!-- 同步弹框-->
|
|
<a-modal
|
|
class="show-content"
|
|
:title="$t('SyncLibrary')"
|
|
v-if="toVisible"
|
|
:visible="toVisible"
|
|
:confirm-loading="confirmLoading"
|
|
@ok="handleOkTo"
|
|
@cancel="handleCancelTo"
|
|
>
|
|
<p style="text-align: center">{{$t('sureSynchronize')}}</p>
|
|
</a-modal>
|
|
<!-- 校核弹框-->
|
|
<a-modal
|
|
class="show-content"
|
|
:title="$t('check')"
|
|
v-if="checkVisible"
|
|
:visible="checkVisible"
|
|
:confirm-loading="confirmLoading"
|
|
@ok="handleOkCheck"
|
|
@cancel="handleCancelCheck"
|
|
>
|
|
<p style="text-align: center">{{$t('sureVerified')}}</p>
|
|
</a-modal>
|
|
<div class="table-detail">
|
|
<tableData
|
|
:flag="'2'"
|
|
:OperationList="OperationList"
|
|
@actionSynchron="actionSynchron"
|
|
:url="url"
|
|
showAction
|
|
@actionCheck="actionCheck"
|
|
@actionDown="actionDown"
|
|
@onSelectChange="onSelectChange"
|
|
@actionDelete="actionDelete"
|
|
@detailClick="detailClick"
|
|
/>
|
|
</div>
|
|
|
|
<doc-table v-if="drawVisible" :drawVisible="drawVisible" :drawTableSorce="drawTableSorce" @visible="docVisible" @exportVisible="exportVisible"></doc-table>
|
|
<ocr-upload ref="uploadFile1" :disabled="disabled" :accept="accept" @uploadSuccess="uploadSuccess"></ocr-upload>
|
|
</a-card>
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
import { axios } from '@/utils/request'
|
|
import { getAction, postAction, deleteAction, downloadFile } from '@/api/manage'
|
|
import search from '@/components/search/index'
|
|
import tableData from '@/components/ocrTable/index'
|
|
import addForm from '@/components/ocrAddForm/index'
|
|
import docTable from './modules/docTable'
|
|
import ocrUpload from '@/components/ocrUpload/index'
|
|
import { ACCESS_TOKEN } from "@/store/mutation-types"
|
|
import Vue from 'vue'
|
|
import eventBUs from '../../../common/event'
|
|
export default {
|
|
name: 'ocr',
|
|
components:{
|
|
search,
|
|
tableData,
|
|
addForm,
|
|
ocrUpload,
|
|
docTable
|
|
},
|
|
data(){
|
|
return{
|
|
OperationList: [
|
|
{
|
|
text: this.$t('SyncLibrary'),
|
|
ClickEvent: 'actionSynchron'
|
|
}, //同步至文档库
|
|
{
|
|
text: this.$t('check'),
|
|
ClickEvent: 'actionCheck'
|
|
}, //校核
|
|
{
|
|
text: this.$t('download'),
|
|
ClickEvent: 'actionDown'
|
|
}, //下载
|
|
{
|
|
text: this.$t('delete'),
|
|
ClickEvent: 'actionDelete'
|
|
} //删除
|
|
],
|
|
pageSize:10,
|
|
labelCol: { span:4 },
|
|
wrapperCol: { span: 18 },
|
|
disabled:false,
|
|
drawVisible:false,
|
|
toVisible:false, //同步弹框
|
|
checkVisible:false, //校核弹框
|
|
file:'',
|
|
form:{}, //表单数据
|
|
rules:{
|
|
attId:[
|
|
{ required: true, message: '请选择文件', trigger: 'change' },
|
|
],
|
|
standNumber:[
|
|
{ required: true, message: '请输入编号', trigger: 'blur' },
|
|
],
|
|
standName:[
|
|
{ required: true, message: '请输入名称', trigger: 'blur' },
|
|
],
|
|
fileType:[
|
|
{ required: true, message: '请选择文本状态', trigger: 'blur' },
|
|
]
|
|
},
|
|
url: {
|
|
tableHeader: 'ocr/ocrRecord/getHeader', //表格头部字段
|
|
seachList: 'ocr/ocrRecord/queryCondition', //搜索字段
|
|
tableList: 'ocr/ocrRecord/page', //表格数据
|
|
getAddForm: 'ocr/ocrRecord/getForm', // 表单的字段
|
|
addInfo: 'ocr/OcrRestful/addOcrRecord', //新增
|
|
},
|
|
queryParams:{}, //搜索条件
|
|
//列表数据
|
|
dataSource:[],
|
|
drawTableSorce:[],
|
|
total:0,
|
|
selectedRowKeys:[],
|
|
fileVisible:false,
|
|
confirmLoading: false,
|
|
selectedIds:'', //选择行id
|
|
record:{},
|
|
accept:'application/pdf',
|
|
today:'',
|
|
timer:''
|
|
}
|
|
},
|
|
props:{
|
|
|
|
},
|
|
mounted() {
|
|
// this.loadData()
|
|
},
|
|
created() {
|
|
const date = new Date(),
|
|
year = date.getFullYear(),
|
|
month = date.getMonth()+1,
|
|
myDate = date.getDate()
|
|
this.today = `${year}/${month < 10 ? '0'+month : month}/${myDate < 10 ? '0'+myDate : myDate}`
|
|
if(this.timer){
|
|
clearInterval(this.timer)
|
|
}else{
|
|
eventBUs.$emit('searchReset')
|
|
this.initSetTimeout(this.today)//调用每隔10秒刷新数据
|
|
}
|
|
},
|
|
|
|
methods:{
|
|
//上传
|
|
handleUpload(){
|
|
this.fileVisible=true
|
|
},
|
|
//调取已入库文件
|
|
handleFileExport(){
|
|
this.drawVisible=true
|
|
},
|
|
//批量删除
|
|
handleDel(){
|
|
let param={
|
|
ids:this.selectedIds
|
|
}
|
|
if(this.selectedIds){
|
|
this.$confirm({
|
|
title: this.$t('ConfirmBatchDeletion'),
|
|
content: '',
|
|
onOk:
|
|
async () => {
|
|
deleteAction(`ocr/ocrRecord/deleteBatch`, param).then(res => {
|
|
if (res.success) {
|
|
this.$message.success(this.$t('OperationSuccessful'))
|
|
eventBUs.$emit('searchReset')
|
|
}else{
|
|
this.$message.warning(this.$t('operationFailed'))
|
|
}
|
|
})
|
|
},
|
|
onCancel() {},
|
|
});
|
|
}else{
|
|
this.$message.warning(this.$t('selectLeastOne'));
|
|
}
|
|
},
|
|
//同步
|
|
actionSynchron(val){
|
|
this.record=val
|
|
if(this.record.resultContent=='转换成功'&&this.record.syncState!='已同步'){
|
|
this.toVisible=true
|
|
}else{
|
|
this.$message.warning('未转换成功或已同步至文档库')
|
|
}
|
|
},
|
|
//校核
|
|
actionCheck(val){
|
|
// if(val.resultContent=='转换成功'&&val.syncState!='已同步'){
|
|
// this.checkVisible=true
|
|
// }else{
|
|
// this.$message.warning('未转换成功或已同步至文档库,不能进行校核')
|
|
// }
|
|
this.checkVisible=true
|
|
},
|
|
//下载
|
|
actionDown(val){
|
|
// downloadFile('/sys/common/download', val.docRealName, { id: val.attId })
|
|
// downloadFile(val.docRealFile)
|
|
window.open(val.docRealFile)
|
|
},
|
|
//删除
|
|
actionDelete(record){
|
|
let params={
|
|
id:record.id
|
|
}
|
|
this.$confirm({
|
|
title: this.$t('ConfirmDelete'),
|
|
content: '',
|
|
onOk:
|
|
async () => {
|
|
deleteAction(`ocr/ocrRecord/delete`,params).then(res=> {
|
|
if(res.success){
|
|
this.$message.success(this.$t('OperationSuccessful'))
|
|
eventBUs.$emit('searchReset')
|
|
}else{
|
|
this.$message.warning(this.$t('operationFailed'))
|
|
}
|
|
})
|
|
},
|
|
onCancel() {},
|
|
});
|
|
|
|
},
|
|
onDelete(){
|
|
|
|
},
|
|
onSelectChange(selectedRowKeys,selectedRows){
|
|
this.selectedIds=selectedRowKeys.join(',')
|
|
|
|
},
|
|
//上传确定按钮
|
|
modalOk(){
|
|
this.$refs.fileForm.sumber()
|
|
},
|
|
handleCancel(){
|
|
this.fileVisible=false
|
|
},
|
|
//上传文件
|
|
uploadSuccess(data) {
|
|
let attIdList = []
|
|
if(data && data.length > 0){
|
|
data.forEach(item => {
|
|
attIdList.push(item.id || data.name)
|
|
})
|
|
this.form.attId = attIdList.join(',')
|
|
}
|
|
},
|
|
fileUpload(){
|
|
|
|
this.$refs.uploadFile1.visible=true
|
|
},
|
|
//同步至文档库确认
|
|
handleOkTo(){
|
|
let params={
|
|
...this.record
|
|
}
|
|
postAction(`ocr/ocrRecord/syncToDocument`,params).then(res=>{
|
|
if(res.success){
|
|
eventBUs.$emit('searchReset')
|
|
this.$message.success(this.$t('OperationSuccessful'))
|
|
this.toVisible=false
|
|
}else{
|
|
this.$message.warning(this.$t('operationFailed'))
|
|
}
|
|
})
|
|
},
|
|
//同步至文档库取消
|
|
handleCancelTo(){
|
|
this.toVisible=false
|
|
},
|
|
//校核确认
|
|
handleOkCheck(){
|
|
this.$router.push({
|
|
path:'/ocr/ocrSplit'
|
|
})
|
|
this.checkVisible=false
|
|
},
|
|
//校核取消
|
|
handleCancelCheck(){
|
|
this.checkVisible=false
|
|
},
|
|
docVisible(val){
|
|
this.drawVisible=val
|
|
},
|
|
//文件详情跳转
|
|
detailClick(val){
|
|
window.open('/pdf/web/viewer.html?file=' + encodeURIComponent('/jero-boot/sys/common/pdf/viewFile?id=' + val.id))
|
|
},
|
|
exportVisible(val){
|
|
// this.fileVisible=val
|
|
},
|
|
addFormClick() {
|
|
this.fileVisible = false
|
|
},
|
|
//10秒刷新页面
|
|
initSetTimeout(today) {//每隔10秒刷新数据,也就是每隔10秒向后台请求一次数据
|
|
this.timer=setInterval( () => {
|
|
eventBUs.$emit('searchReset')
|
|
}, 10000)
|
|
},
|
|
},
|
|
beforeDestroy(){
|
|
clearInterval(this.timer)
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
@import '~@assets/less/common.less';
|
|
.ocr{
|
|
.table-detail{
|
|
.action{
|
|
margin-right: 10px;
|
|
}
|
|
.action-delete{
|
|
color:red;
|
|
}
|
|
.page{
|
|
text-align:right ;
|
|
margin-top:20px;
|
|
}
|
|
}
|
|
}
|
|
</style>
|
|
<style lang="less">
|
|
.show-content{
|
|
.ant-modal-footer{
|
|
text-align: center;
|
|
}
|
|
}
|
|
|
|
</style> |