364 lines
11 KiB
Java
364 lines
11 KiB
Java
<template>
|
|
<div class="imports">
|
|
<a-drawer
|
|
class="imports-table-drawer"
|
|
:title="$t('ImportResults')"
|
|
placement="right"
|
|
:visible="visible"
|
|
:after-visible-change="afterVisibleChange"
|
|
@close="onClose"
|
|
width="1100"
|
|
>
|
|
<div class="imports-table-content">
|
|
<div class="imports-header">
|
|
<search :url="url" :flag="'condition'"></search>
|
|
</div>
|
|
</div>
|
|
<div class="imports-table-detail">
|
|
<tableData
|
|
:flag="'header'"
|
|
:url="url"
|
|
:type="type"
|
|
:showAction="false"
|
|
:OperationList="OperationList"
|
|
@onSelectChange="onSelectChange"
|
|
/>
|
|
</div>
|
|
<div class="imports-files">
|
|
<a-form-model
|
|
class="imports-content"
|
|
ref="ruleForm"
|
|
:model="form"
|
|
:rules="rules"
|
|
:label-col="labelCol"
|
|
:wrapper-col="wrapperCol"
|
|
>
|
|
<a-form-model-item ref="file" :label="$t('splitFile')" prop="file">
|
|
<split-upload ref="uploadFile" :accept="accept" :disabled="disabled" :module="'split'" @uploadSuccess="uploadSuccess"></split-upload>
|
|
<!-- <a-input v-model="form.file" >{{form.file}}</a-input>-->
|
|
<!-- <a-button type="primary" class="button-text"-->
|
|
<!-- @click="fileUpload()">-->
|
|
|
|
<!-- {{ (form.file === 'null' || form.file === '' ||-->
|
|
<!-- form.file == null) ? $t('upload1') : $t('viewUploadedFiles')-->
|
|
<!-- }}-->
|
|
<!-- </a-button>-->
|
|
</a-form-model-item>
|
|
</a-form-model>
|
|
<a-button class="file-down" type="primary" @click="downLoad">{{$t('templateDownload')}}</a-button>
|
|
</div>
|
|
<div class="imports-footer">
|
|
<div class="imports-footer-wrap">
|
|
|
|
<a-button class="imports-btn imports-chai" type="primary" @click="handleSubmit">{{$t('preservation')}}</a-button>
|
|
<a-button class="imports-btn" type="primary" @click="cancleImports">{{$t('cancel')}}</a-button>
|
|
</div>
|
|
</div>
|
|
<!-- <split-upload ref="uploadFile" :disabled="disabled" :title="upload1" :accept="accept" @uploadSuccess="uploadSuccess"></split-upload>-->
|
|
</a-drawer>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { getAction, postAction, deleteAction, downloadFile } from '@/api/manage'
|
|
import SplitUpload from '@/components/OcrUpload/index'
|
|
import search from '@/components/search/index'
|
|
import TableData from '@/components/SplitTable/DocTable'
|
|
import axios from 'axios'
|
|
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
|
import eventBUs from '../../../../common/event'
|
|
import Vue from 'vue'
|
|
export default {
|
|
name: 'import',
|
|
components:{
|
|
SplitUpload,
|
|
search,
|
|
TableData
|
|
},
|
|
data(){
|
|
return{
|
|
labelCol: { span:4 },
|
|
wrapperCol: { span: 18 },
|
|
visible:false,
|
|
contentVisible:true,
|
|
disabled:false,
|
|
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,
|
|
},
|
|
|
|
],
|
|
file:'',
|
|
form:{},
|
|
rules:{
|
|
file:[
|
|
{ required: true, message: this.$t('pleaseUploadFile'), trigger: 'change' },
|
|
],
|
|
},
|
|
spinning:false, //loading标识
|
|
type:'',
|
|
url:{
|
|
tableHeader: 'document/bussDocumentLibraryEO/getHeaderOrConditionForSplit', //表格头部字段
|
|
seachList: 'document/bussDocumentLibraryEO/getHeaderOrConditionForOcr', //搜索字段
|
|
tableList: 'document/bussDocumentLibraryEO/ocrPageInfo', //表格数据
|
|
},
|
|
OperationList:[],
|
|
upload1:this.$t('upload1'),
|
|
// accept:'application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/msword',
|
|
accept:'application/zip',
|
|
rows:[],
|
|
token:Vue.ls.get(ACCESS_TOKEN),
|
|
flag:false, //提交表单标识
|
|
}
|
|
},
|
|
props:{
|
|
importsVisible:Boolean
|
|
},
|
|
watch:{
|
|
'form.file'(val){
|
|
console.log('val111',val)
|
|
},
|
|
|
|
},
|
|
mounted() {
|
|
this.visible=this.importsVisible
|
|
// 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){
|
|
console.log('keys',keys,rows)
|
|
this.selectedRowKeys=keys
|
|
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()
|
|
},
|
|
cancleImports(){
|
|
this.$emit('visible',false)
|
|
},
|
|
fileUpload(){
|
|
this.$refs.uploadFile.visible=true
|
|
},
|
|
//上传文件
|
|
uploadSuccess(data) {
|
|
// console.log('updata',data)
|
|
let attIdList = []
|
|
if(data && data.length>0) {
|
|
data.map(item => {
|
|
attIdList.push(item.id || data.name)
|
|
})
|
|
}
|
|
// /** 赋值给当前对应的表单文件 */
|
|
this.form.file = attIdList.join(',')
|
|
// console.log('this.form.file',this.form.file)
|
|
},
|
|
//模板下载
|
|
downLoad(){
|
|
let name = this.$t('documentSplitTemplate')+'.xls'
|
|
downloadFile('split/sarFileSplitItems/exportTemplate',name, {})
|
|
},
|
|
//保存
|
|
handleSubmit(){
|
|
// console.log('seleced',this.selectedRowKeys,this.rows)
|
|
// console.log('this.form.file,',this.form.file)
|
|
if(this.rows.length===0){
|
|
this.$message.warning(this.$t('PleaseSelectData'))
|
|
}else if(this.rows&&this.rows.length>1){
|
|
this.$message.warning(this.$t('OnlyOneSelected'))
|
|
}else if(this.rows&&this.rows.length===1){
|
|
let params={
|
|
connectId:this.rows[0].connect_id,
|
|
splitFileId:this.form.file,
|
|
fileName:this.rows[0].file_name,
|
|
serialNumber:this.rows[0].serial_number,
|
|
title:this.rows[0].title,
|
|
|
|
}
|
|
if(this.rows[0].text_info=='发布稿(必读)'){
|
|
params.fileType='1'
|
|
}else if(this.rows[0].text_info=='增补件(必读)'){
|
|
params.fileType='2'
|
|
}else if(this.rows[0].text_info=='报批稿'){
|
|
params.fileType='3'
|
|
}else if(this.rows[0].text_info=='征求意见稿'){
|
|
params.fileType='4'
|
|
}else if(this.rows[0].text_info=='测试程序'){
|
|
params.fileType='5'
|
|
}else if(this.rows[0].text_info=='相关资料'){
|
|
params.fileType='6'
|
|
}
|
|
let formData = new FormData()
|
|
Object.keys(params).forEach((key) => {
|
|
console.log('key',key,params[key])
|
|
formData.append(key, params[key]);
|
|
});
|
|
// console.log('formData',params,formData.getAll)
|
|
if(!this.form.file) {
|
|
this.$refs.ruleForm.validate(valid => {
|
|
if (valid) {
|
|
this.flag = true
|
|
if (this.flag) {
|
|
|
|
axios({
|
|
url: '/jero-boot/split/sarFileSplitItems/importSplitResult',
|
|
method: 'post',
|
|
data: formData,
|
|
headers: {
|
|
'Content-Type': 'multipart/form-data',
|
|
// 'Content-Type': 'application/x-www-form-urlencoded',
|
|
'X-Access-Token': this.token
|
|
}
|
|
}).then(res => {
|
|
if (res.data.success) {
|
|
this.$message.success(this.$t('OperationSuccessful'))
|
|
eventBUs.$emit('searchReset')
|
|
}else{
|
|
this.$message.warning(res.data.message)
|
|
}
|
|
}).finally(() => [
|
|
this.flag = false
|
|
])
|
|
}
|
|
}
|
|
})
|
|
}else {
|
|
this.flag = true
|
|
this.$refs.ruleForm.clearValidate()
|
|
if (this.flag) {
|
|
axios({
|
|
url: '/jero-boot/split/sarFileSplitItems/importSplitResult',
|
|
method: 'post',
|
|
data: formData,
|
|
headers: {
|
|
'Content-Type': 'multipart/form-data',
|
|
// 'Content-Type': 'application/x-www-form-urlencoded',
|
|
'X-Access-Token': this.token
|
|
}
|
|
}).then(res => {
|
|
if (res.data.success) {
|
|
this.$message.success(this.$t('OperationSuccessful'))
|
|
eventBUs.$emit('searchReset')
|
|
}else{
|
|
this.$message.warning(res.data.message)
|
|
}
|
|
}).finally(() => [
|
|
this.flag = false
|
|
])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
.imports-table-content{
|
|
.imports-header{
|
|
margin-bottom: 20px;
|
|
}
|
|
}
|
|
|
|
.imports-table-detail{
|
|
.page{
|
|
margin: 20px 0;
|
|
text-align: right;
|
|
}
|
|
}
|
|
.imports-files{
|
|
position: relative;
|
|
margin:20px 0;
|
|
.file-down{
|
|
position: absolute;
|
|
left: 320px;
|
|
top: 5px;
|
|
}
|
|
}
|
|
.imports-footer{
|
|
.imports-footer-wrap{
|
|
margin:20px 0;
|
|
text-align: center;
|
|
.imports-chai{
|
|
margin-right: 20px;
|
|
}
|
|
}
|
|
}
|
|
</style>
|
|
<style lang="less">
|
|
.imports-table-content {
|
|
.imports-header {
|
|
.ant-col-sm-24{
|
|
display: flex;
|
|
}
|
|
}
|
|
}
|
|
|
|
</style> |