Files
laws_weilai/jero-web/src/views/documentManage/ocr/modules/docTable.vue
T
2022-03-09 10:26:48 +08:00

259 lines
6.9 KiB
Java

<template>
<div class="doc-table">
<a-drawer
class="doc-table-drawer"
:title="title"
placement="right"
:visible="visible"
:after-visible-change="afterVisibleChange"
@close="onClose"
width="1100"
>
<div class="doc-table-content">
<div class="doc-header">
<search :url="url" :flag="'condition'"></search>
</div>
</div>
<div class="doc-table-detail">
<tableData
:flag="'header'"
:url="url"
:showAction="false"
:OperationList="OperationList"
@onSelectChange="onSelectChange"
/>
</div>
<div class="doc-table-footer">
<a-button type="primary" class="btn-export" @click="tableExport">{{$t('import')}}</a-button>
<a-button type="primary" @click="onClose">{{$t('cancel')}}</a-button>
</div>
</a-drawer>
</div>
</template>
<script>
import { getAction, postAction, deleteAction } from '@/api/manage'
import search from '@/components/search/index'
import tableData from '@/components/ocrTable/docTable'
import eventBUs from '../../../../common/event'
export default {
name: 'docTable',
components:{
search,
tableData,
},
props:{
drawVisible:Boolean,
drawTableSorce:Array,
},
data(){
return{
title:this.$t('RetrieveFiles'),
visible:false,
queryParams:{
pageNo:1,
pageSize:10,
serialNumber:'',
title:''
},
total:0,
OperationList:[],
ipagination: {
defaultPageSize: 10,
defaultCurrent: 1,
currentPage:1,
pageSizeOptions: ['10', '20', '30', '40', '100'],
showQuickJumper: true,
showSizeChanger: true,
showTotal: (total, range) => `显示 ${range[0]} ~ ${range[1]} 条记录,共 ${total} 条记录`
},
total:0,
selectedRowKeys:[],
tableSource:[],
//表头
columns: [
{
title: '序号',
key: 'num',
align:"center",
scopedSlots: { customRender: 'num' },
width:80,
ellipsis: true,
},
{
title:'标准编号',
key: 'serial_number',
align:"center",
dataIndex: 'serial_number',
ellipsis: true,
},
{
title:'标题',
key: 'title',
align:"center",
dataIndex: 'title',
ellipsis: true,
},
{
title:'状态',
key: 'state',
align:"center",
dataIndex: 'state',
ellipsis: true,
},
{
title:'文件名称',
key: 'file_name',
align:"center",
dataIndex: 'file_name',
ellipsis: true,
},
{
title:'文件信息',
key: 'text_info',
align:"center",
dataIndex: 'text_info',
ellipsis: true,
},
],
url:{
tableHeader: 'document/bussDocumentLibraryEO/getHeaderOrConditionForOcr', //表格头部字段
seachList: 'document/bussDocumentLibraryEO/getHeaderOrConditionForOcr', //搜索字段
tableList: 'document/bussDocumentLibraryEO/ocrPageInfo', //表格数据
// getAddForm: 'ocr/ocrRecord/getForm', // 表单的字段
// addInfo: 'ocr/OcrRestful/addOcrRecord', //新增
},
rowId:''
}
},
mounted() {
this.visible=this.drawVisible
// this.loadData()
// this.tableSource= [...this.drawTableSorce]
},
methods: {
loadData(){
let params={
...this.queryParams
}
postAction(`document/bussDocumentLibraryEO/ocrPageInfo`,params).then(res=>{
if(res.success){
this.total=res.result.total
this.tableSource=[...res.result.records]
}
})
},
afterVisibleChange(val) {
// console.log('visible', val);
},
onClose() {
this.visible = false;
this.$emit('visible',false)
},
//搜索
searchQuery(){
},
//清空
searchReset(){
},
onSelectChange(rowKeys,rows){
if(rowKeys.length>1){
this.$message.warning(this.$t('OnlyOneSelected'))
}else{
this.rowId=rowKeys[0]
this.rows=rows[0]
}
},
//点击页数
onChangePage(page,pageSize){
this.queryParams.pageNo = page
this.loadData()
},
//一页显示条数
SizeChange(page,pageSize){
this.queryParams.pageSize = pageSize
this.loadData()
},
//导入按钮
tableExport(){
if(this.rows.length>1){
this.$message.warning(this.$t('OnlyOneSelected'))
}else {
if(this.rows.file_name){
let name = this.rows.file_name.split('.')
let nameSuffix=name[name.length-1]
if(nameSuffix.toLowerCase()=='pdf'){
let params = {
attId: this.rows.id,
standName: this.rows.title,
standNumber: this.rows.serial_number,
connectId:this.rows.connect_id
}
if(this.rows.text_info=='发布稿(必读)'){
params.fileType='1'
}else if(this.rows.text_info=='增补件(必读)'){
params.fileType='2'
}else if(this.rows.text_info=='报批稿'){
params.fileType='3'
}else if(this.rows.text_info=='征求意见稿'){
params.fileType='4'
}else if(this.rows.text_info=='测试程序'){
params.fileType='5'
}else if(this.rows.text_info=='相关资料'){
params.fileType='6'
}
postAction(`ocr/OcrRestful/addOcrRecord`, params).then(res => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
eventBUs.$emit('searchReset')
} else {
this.$message.warning(this.$t('operationFailed'))
}
})
// this.$emit('exportVisible',true)
}else{
this.$message.warning(this.$t('OnlyPDF'))
}
}
}
}
},
}
</script>
<style lang="less" scoped>
.doc-table-drawer{
.ant-drawer-content-wrapper{
}
}
.doc-table-detail{
margin-top: 20px;
.page{
text-align: right;
margin-top: 20px;
}
}
.doc-table-footer{
margin-top: 20px;
text-align: center;
.btn-export{
margin-right: 20px;
}
}
</style>
<style lang="less">
.doc-header{
.table-page-search-submitButtons{
float: none!important;
}
}
</style>