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

332 lines
9.1 KiB
Java

<template>
<div class="split">
<a-drawer
class="split-table-drawer"
:title="$t('SplitText')"
placement="right"
:visible="visible"
:after-visible-change="afterVisibleChange"
@close="onClose"
width="1100"
>
<div class="split-table-content">
<div class="split-header">
<search :url="url" :flag="'condition'"></search>
</div>
</div>
<div class="table-operator operator-select">
<div class="operator-text">
<!-- <a-icon type="download" />-->
<!-- 模板下载-->
<div class="operator-select-type">
<span class="operator-file-type"><i class="operator-i">*</i>{{$t('fileType')}}</span>
<a-select v-model="fileGroup" :placeholder="$t('selectFileType')" class="file-type-select">
<a-select-option value="GSO" key="GSO" title="GSO">
GSO
</a-select-option>
<a-select-option value="KMVSS_Table" key="KMVSS_Table" :title="$t('KMVSS_Table')">
{{$t('KMVSS_Table')}}
</a-select-option>
<a-select-option value="KMVSS_Article" key="KMVSS_Article" :title="$t('KMVSS_Article')">
{{$t('KMVSS_Article')}}
</a-select-option>
<a-select-option value="US" key="US" :title="$t('America')">
{{$t('America')}}
</a-select-option>
<a-select-option value="EU" key="EU" :title="$t('Europe')">
{{$t('Europe')}}
</a-select-option>
<a-select-option value="Japan_one" key="Japan_one" :title="$t('Japan_one')">
{{$t('Japan_one')}}
</a-select-option>
<a-select-option value="Japan_two" key="Japan_two" :title="$t('Japan_two')">
{{$t('Japan_two')}}
</a-select-option>
<a-select-option value="CN" key="CN" :title="$t('China')">
{{$t('China')}}
</a-select-option>
</a-select>
</div>
</div>
</div>
<div class="split-table-detail">
<tableData
:flag="'header'"
:url="url"
:type="type"
:showAction="false"
:OperationList="OperationList"
@onSelectChange="onSelectChange"
/>
</div>
<div class="split-footer">
<div class="split-footer-wrap">
<a-button class="split-btn split-chai" type="primary" @click="submitSplit" v-has="'split:sarFileSplitInfo:add'">{{$t('split')}}</a-button>
<a-button class="split-btn" type="primary" @click="cancelSplit">{{$t('cancel')}}</a-button>
</div>
</div>
</a-drawer>
</div>
</template>
<script>
import { getAction, postAction } from '../../../../api/manage'
import search from '@/components/search/index'
import TableData from '@/components/SplitTable/DocTable'
import eventBUs from '../../../../common/event'
import Vue from 'vue'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import axios from 'axios'
export default {
name: 'split',
components:{
search,
TableData,
},
data(){
return{
visible:false,
fileGroup:'',
tableSource:[], //列表数据
selectedRowKeys:[],
queryParams:{
pageNo:1,
pageSize:10
}, //搜索条件
total:0,
columns: [
{
title:this.$t('standard'),
key: 'standNumber',
align:"center",
dataIndex: 'standNumber',
ellipsis: true,
},
{
title:this.$t('title'),
key: 'standName',
align:"center",
dataIndex: 'standName',
ellipsis: true,
},
{
title:this.$t('fileName'),
key: 'fileName',
align:"center",
dataIndex: 'fileName',
ellipsis: true,
},
{
title:this.$t('TextStatus'),
key: 'fileType_dictText',
align:"center",
dataIndex: 'fileType_dictText',
ellipsis: true,
},
],
spinning:false, //loading标识
url:{
tableHeader: 'document/bussDocumentLibraryEO/getHeaderOrConditionForSplitResult', //表格头部字段
seachList: 'document/bussDocumentLibraryEO/getHeaderOrConditionForSplitResult', //搜索字段
tableList: 'split/sarFileSplitInfo/splitFilePageInfo', //表格数据
},
type:'doc',
OperationList:[],
token:Vue.ls.get(ACCESS_TOKEN),
cut:'',
submitFlag:false
}
},
props:{
splitVisible:{
type:Boolean,
default:false
},
},
mounted() {
this.visible=this.splitVisible
// console.log('visibleSplit',this.visible)
},
methods:{
//获取列表数据
loadData(){
this.spinning=true
let params={
}
getAction(``,params).then(res=>{
}).finally(()=>{
this.spinning=false
})
},
afterVisibleChange(val) {
console.log('visible', val);
},
onClose() {
this.visible = false;
this.$emit('visible',false)
},
onSelectChange(keys,rows){
this.selectedRowKeys=keys
if(keys.length>1){
this.$message.warning(this.$t('OnlyOneSelected'))
}else{
this.rowId=keys[0]
}
this.rows=[...rows]
},
//搜索
searchQuery(){
},
//清空
searchReset(){
},
//点击页数
onChangePage(page,pageSize){
this.queryParams.pageNo = page
this.loadData()
},
//一页显示条数
SizeChange(page,pageSize){
this.queryParams.pageSize = pageSize
this.queryParams.pageNo = 1
this.loadData()
},
cancelSplit(){
this.$emit('visible',false)
},
//拆分
submitSplit(){
if(this.fileGroup.length == 0||this.fileGroup==undefined){
this.$message.warning(this.$t('selectFileType'))
}else if(this.rows&&this.rows.length>1){
this.$message.warning(this.$t('OnlyOneSelected'))
}else if(this.rows==undefined||this.rows.length===0){
this.$message.warning(this.$t('selectLeastOne'))
}else if(this.rows&&this.rows.length==1) {
let file = this.rows[0]
if (file.file_name) {
let name = file.file_name.split('.')
let nameSuffix = name[name.length - 1]
if (nameSuffix.toLowerCase() === 'doc'||nameSuffix.toLowerCase() === 'docx') {
let params = {
attId: file.id,
title: file.title,
fileName:file.file_name,
serialNumber: file.serial_number,
connectId: file.connect_id,
fileGroup: this.fileGroup,
fileType:file.text_info
}
if(!this.submitFlag){
this.submitFlag=true
postAction(`split/sarFileSplitInfo/add`, params).then(res => {
if (res.success) {
this.$message.success(this.$t('OperationSuccessful'))
eventBUs.$emit('searchReset')
this.visible = false;
this.$emit('visible', false)
} else {
this.$message.warning(res.message)
}
}).finally(()=>{
this.submitFlag =false
})
this.$emit('exportVisible',true)
}
} else {
this.$message.warning(this.$t('OnlyWord'))
}
}
}
}
}
}
</script>
<style lang="less" scoped>
.split-table-content{
.split-header{
margin-bottom: 20px;
.split-item{
display: flex;
}
}
}
.split-table-detail{
.page{
margin: 20px 0;
text-align: right;
}
}
.split-footer{
.split-footer-wrap{
margin:20px 0;
text-align: center;
.split-chai{
margin-right: 20px;
}
}
}
.operator-select{
margin-bottom: 20px;
/*margin-left: 60px;*/
.operator-file-type{
/*width: 100px;*/
min-width: 110px;
text-align: right;
line-height: 32px;
display: inline-block;
margin-right: 16px;
.operator-i{
display: inline-block;
width: 10px;
height: 38px;
line-height: 38px;
text-align: center;
color:#f5222d;
}
}
.operator-select-type{
display: flex;
justify-content: start;
.file-type-select{
min-width: 120px;
}
}
}
</style>
<style lang="less">
.split-table-content {
.split-header {
.ant-col-sm-24{
display: flex;
}
}
}
.operator-select-type{
.ant-select-selection{
height: 38px;
.ant-select-selection__rendered{
height: 38px;
line-height: 38px;
}
}
}
</style>