Files
laws_weilai/jero-web/src/views/documentManage/splitting/index.vue
T

372 lines
10 KiB
Java

<template>
<div class="splitting">
<a-card :bordered="false">
<div class="splitting-search-wrapper">
<searchalonesplit :flag="'3'" :url="url" :searchalonesplit='serialnumber'/>
</div>
<div class="table-operator">
<div class="operator-text" @click="handleModule" v-has="'split:sarFileSplitInfo:splitFile'">
<a-icon type="plus"/>
{{ $t('SplitText') }}
</div>
<div class="operator-text" @click="handleExport" v-has="'split:sarFileSplitInfo:splitResult'">
<a-icon type="export"/>
{{ $t('ImportResults') }}
</div>
<div class="operator-text" @click="handleDel" v-has="'split:sarFileSplitInfo:deleteBatch'">
<a-icon type="delete"/>
{{ $t('BatchDelete') }}
</div>
</div>
<div class="splitting-table">
<table-data
:url="url"
:flag="'3'"
:OperationList="OperationList"
showAction
@onSelectChange="onSelectChange"
@backDocument="backDocument"
@deleteDetail="deleteDetail"
@detailClick="detailClick"
></table-data>
</div>
<split-text v-if="splitVisible" :splitVisible="splitVisible" @visible="sVisible"></split-text>
<import-result v-if="importsVisible" :importsVisible="importsVisible" @visible="iVisible"></import-result>
</a-card>
</div>
</template>
<script>
import searchalonesplit from '@/components/searchalonesplit/index'
import TableData from '@/components/SplitTable/index'
import SplitText from './modules/SplitText'
import ImportResult from './modules/ImportResult'
import { getAction, postAction, deleteAction } from '@/api/manage'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import eventBUs from '../../../common/event'
import axios from 'axios'
import Vue from 'vue'
export default {
name: 'splitting',
components: {
searchalonesplit,
TableData,
SplitText,
ImportResult
},
data() {
return {
splitVisible: false,
importsVisible: false,
selectedRowKeys: [],
loading: false,
total: 0,
ids: [],
tableData: [],
columns: [
{
title: this.$t('standard'),
align: 'center',
dataIndex: 'serialNumber'
},
{
title: this.$t('title'),
align: 'center',
dataIndex: 'title'
},
{
title: this.$t('TextStatus'),
align: 'center',
dataIndex: 'fileType_dictText'
},
{
title: this.$t('fileName'),
align: 'center',
dataIndex: 'fileName'
},
{
title: this.$t('splitTime'),
align: 'center',
dataIndex: 'createTime'
},
{
title: this.$t('splitResult'),
align: 'center',
dataIndex: 'splitResult_dictText'
},
{
title: this.$t('operation'),
dataIndex: 'action',
scopedSlots: { customRender: 'action' },
align: 'center',
width: 170
}
],
OperationList: [
{
text: this.$t('backDocument'),
ClickEvent: 'backDocument'
}, //回传至文档库
{
text: this.$t('view'),
ClickEvent: 'detailClick'
}, //查看
{
text: this.$t('delete'),
ClickEvent: 'deleteDetail'
} //删除
],
url: {
tableHeader: 'split/sarFileSplitInfo/getHeader', //表格头部字段
seachList: 'split/sarFileSplitInfo/queryCondition', //搜索字段
tableList: 'split/sarFileSplitInfo/page' //表格数据
// getAddForm: 'ocr/ocrRecord/getForm', // 表单的字段
// addInfo: 'ocr/OcrRestful/addOcrRecord', //新增
},
queryParams: {
pageNo: 1,
pageSize: 10
},
token: Vue.ls.get(ACCESS_TOKEN),
serialnumber: ''
}
},
props: {},
created() {
},
mounted() {
if (this.$route.query.serial_number) {
this.serialnumber = this.$route.query.serial_number
}
},
methods: {
//获取列表数据
loadData() {
this.loading = true
let params = {
...this.queryParams
}
getAction(`split/sarFileSplitInfo/page`, params).then(res => {
if (res.success) {
if (res.result.current > 1 && res.result.records.length == 0) {
this.queryParams.pageNo = res.result.current - 1
this.loadData()
return
}
this.tableData = [...res.result.records]
this.loading = false
this.total = res.result.total
} else {
this.loading = false
}
})
},
//拆分已入库文本
handleModule() {
this.splitVisible = true
},
//导入拆分结果
handleExport() {
this.importsVisible = true
},
//批量删除
handleDel() {
let params = {
ids: this.selectedRowKeys.join(',')
}
if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
this.$confirm({
title: this.$t('ConfirmDelete'),
content: '',
onOk:
async () => {
// let formData = new FormData();
// formData.append('params', params)
// console.log('formdata',formData)
axios({
url: '/jero-boot/split/sarFileSplitInfo/deleteBatch',
method: 'post',
data: params,
transformRequest: [function(data) {
// Do whatever you want to transform the data
let ret = ''
for (let it in data) {
ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
}
return ret
}],
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-Access-Token': this.token
}
}).then(res => {
if (res.data.success) {
this.$message.success(this.$t('OperationSuccessful'))
// if(this.selectedRowKeys&&this.selectedRowKeys.length==this.tableData.length){
// this.queryParams.pageNo=this.queryParams.pageNo-1
// }
this.selectedRowKeys = []
eventBUs.$emit('searchGetData')
// this.loadData()
} else {
this.$message.warning(this.$t('operationFailed'))
}
})
}
})
} else {
this.$message.warning(this.$t('selectLeastOne'))
}
},
//删除
deleteDetail(val) {
this.$confirm({
content: this.$t('confirmDeletion'),
onOk:
async () => {
getAction(`split/sarFileSplitInfo/delete`, { id: val.id }).then((res) => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
// if (this.tableData && this.tableData.length == 1 && this.queryParams.pageNo != 1) {
// this.queryParams.pageNo = this.queryParams.pageNo - 1
// }
eventBUs.$emit('searchGetData')
// this.loadData()
} else {
this.$message.warning(this.$t('operationFailed'))
}
})
}
})
},
sVisible(val,num) {
this.splitVisible = false
if (num == 1){
eventBUs.$emit('searchGetData')
}
},
iVisible(val,num) {
this.importsVisible = val
if (num == 1){
eventBUs.$emit('searchGetData')
}
},
//查询
searchQuery() {
},
//清空
searchReset() {
},
onSelectChange(selKeys) {
this.selectedRowKeys = selKeys
},
handleTableChange() {
},
//点击页数
onChangePage(page, pageSize) {
this.queryParams.pageNo = page
this.$emit('queryParams', this.queryParams)
},
//一页显示条数
SizeChange(page, pageSize) {
this.queryParams.pageSize = pageSize
this.queryParams.pageNo = 1
this.$emit('queryParams', this.queryParams)
},
//回传至文档库
backDocument(val) {
this.$confirm({
content: this.$t('backDocument'),
onOk:
async () => {
let params = {
id: val.id,
fileName: val.fileName,
connectId: val.connectId
}
axios({
url: '/jero-boot/split/sarFileSplitInfo/bindToDocumentLibrary',
method: 'get',
params: params,
headers: {
// 'Content-Type': 'multipart/form-data',
'X-Access-Token': this.token
}
}).then(res => {
// console.log('res,res',res)
if (res.data.success) {
this.$message.success(this.$t('OperationSuccessful'))
eventBUs.$emit('searchGetData')
} else {
this.$message.warning(res.data.message)
}
})
}
})
},
//查看
detailClick(val) {
this.$router.push({
path: '/docManage/splitting/splitDetail',
query: {
infoId: val.id,
infoNumber: val.serialNumber,
createBy: val.createBy
}
})
}
}
}
</script>
<style lang="less" scoped>
@import '~@assets/less/common.less';
</style>
<style lang="less" scoped>
.splitting {
.splitting-search-wrapper {
margin-bottom: 20px;
}
.splitting-table {
.action-margin {
margin-right: 10px;
}
}
}
.splitting-table {
.page {
margin-top: 20px;
text-align: right;
}
}
</style>
<style lang="less">
.splitting-search-wrapper {
.table-page-search-submitButtons {
/*float: none!important;*/
.ant-col-sm-24 {
display: flex;
}
}
.ant-col-sm-8 {
min-width: 300px;
}
}
</style>