拆分结果导入修改
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
:columns="columns"
|
||||
@change="tableOnChange"
|
||||
>
|
||||
<span slot="showContent" slot-scope="text, record">
|
||||
<span slot="showContent" slot-scope="text, record" class="item-solt">
|
||||
<a-tooltip placement="top" class="item-content-tooltip" >
|
||||
<template slot="title" class="item-content-title">
|
||||
<span class="item-content-show" v-html="record.iterms_conditions"></span>
|
||||
@@ -184,7 +184,7 @@
|
||||
scopedSlots: { customRender: 'operation' }
|
||||
})
|
||||
}
|
||||
console.log('columns',this.columns)
|
||||
// console.log('columns',this.columns)
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
<template>
|
||||
<div class="ocr-upload">
|
||||
<!-- <a-modal v-model="visible" :maskClosable="false" :footer="[]" :title="title" class="ocr-upload-modal">-->
|
||||
<a-upload
|
||||
:accept='accept'
|
||||
:disabled="disabled"
|
||||
class="ant-upload-list"
|
||||
name="file"
|
||||
:list-type="listType"
|
||||
:file-list="myfileList"
|
||||
:multiple="false"
|
||||
:action = 'uploadAction'
|
||||
:headers="headers"
|
||||
:before-upload="beforeUpload"
|
||||
:remove='remove'
|
||||
:showUploadList="false"
|
||||
@change="handleChange">
|
||||
<!-- <p><a-icon style="font-size: 67px;color: #c0c4cc;" type="cloud-upload" /></p>-->
|
||||
<a-icon type="export" :rotate="-90" />
|
||||
拆分文件
|
||||
</a-upload>
|
||||
<!-- </a-modal>-->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Vue from 'vue'
|
||||
import { ACCESS_TOKEN } from "@/store/mutation-types"
|
||||
export default {
|
||||
name: 'importSplitUpload',
|
||||
props:['disableds','disabled','thisFileUploadUrl','readonly','thisFileType','accept','title','listType','module'],
|
||||
data(){
|
||||
return{
|
||||
visible:false,
|
||||
uploadAction:window._CONFIG['domianURL']+"/sys/common/upload",
|
||||
downLoadFileUrl:window._CONFIG['domianURL']+'/sys/common/static',
|
||||
myfileList:[],
|
||||
fileList:[],
|
||||
fileTypeSatus:false,
|
||||
headers:{},
|
||||
}
|
||||
},
|
||||
created(){
|
||||
const token = Vue.ls.get(ACCESS_TOKEN);
|
||||
this.headers = {"X-Access-Token":token};
|
||||
this.containerId = 'container-ty-'+new Date().getTime();
|
||||
},
|
||||
mounted(){
|
||||
// console.log(this.thisFileType,this.thisFileSize,this.thisFileUploadUrl);
|
||||
},
|
||||
methods:{
|
||||
beforeUpload(file,fileList) {
|
||||
// console.log('file',this.accept,file,fileList)
|
||||
this.fileTypeSatus=false
|
||||
// if(this.myfileList&&this.myfileList.length>=1){
|
||||
// this.$message.warning('只能上传一个文件')
|
||||
// return false
|
||||
// }else{
|
||||
// let thisFileType = this.thisFileType.replace(/\s+/g, "");
|
||||
if(file.type==this.accept){
|
||||
// console.log('111111')
|
||||
this.fileTypeSatus = true;
|
||||
this.$message.destroy()
|
||||
// 207M.doc文件大小超出100MB限制, 请压缩或降低文件质量!
|
||||
this.errorMessage = file.name + "文件大小超出100MB限制, 请压缩或降低文件质量!";
|
||||
}
|
||||
// }
|
||||
},
|
||||
remove(){
|
||||
this.fileTypeSatus = true;
|
||||
// console.log('rrr',this.myfileList)
|
||||
},
|
||||
handleChange(info) {
|
||||
// console.log('info',info)
|
||||
|
||||
let { file,fileList } = info;
|
||||
const status = info.file.status;
|
||||
info.fileList.forEach((val,index)=>{
|
||||
if(val.response && !val.response.result){
|
||||
this.$message.error(val.response.message);
|
||||
info.fileList.splice(index,1)
|
||||
}
|
||||
})
|
||||
if (this.fileTypeSatus) {
|
||||
if (file.size > 100000000) {
|
||||
this.$message.error(this.errorMessage)
|
||||
return
|
||||
}else {
|
||||
if (status === 'error') {
|
||||
this.$emit('uploadSuccess', this.fileList)
|
||||
this.$message.destroy()
|
||||
this.$message.error(`${info.file.name} 文件上传失败。`);
|
||||
} else if (status === 'removed') {
|
||||
this.myfileList = info.fileList;
|
||||
this.fileList = []
|
||||
this.myfileList.forEach((res) => {
|
||||
if (res.response) {
|
||||
this.fileList.push(res.response.result)
|
||||
} else {
|
||||
this.fileList.push(res)
|
||||
}
|
||||
})
|
||||
// console.log('remove',this.fileList)
|
||||
this.$emit('uploadSuccess', this.fileList)
|
||||
this.$message.destroy()
|
||||
this.$message.success(`${info.file.name} 删除成功。`);
|
||||
} else if (status === 'done') {
|
||||
this.fileList = []
|
||||
this.myfileList = info.fileList;
|
||||
// console.log('file3333',info.fileList)
|
||||
// if (info.fileList.length > 1) {
|
||||
// info.fileList.splice(1)
|
||||
// // this.myfileList = info.fileList;
|
||||
//
|
||||
// this.myfileList.forEach((res) => {
|
||||
// if (res.response) {
|
||||
// this.fileList.push(res.response.result)
|
||||
// } else {
|
||||
// this.fileList.push(res)
|
||||
// }
|
||||
// })
|
||||
// // console.log('file1111',this.fileList)
|
||||
// this.$emit('uploadSuccess', this.fileList)
|
||||
// this.$message.destroy()
|
||||
// this.$message.error('最多只能上传一个文件');
|
||||
// return
|
||||
// }
|
||||
// console.log('my222',this.myfileList)
|
||||
this.myfileList.forEach((res) => {
|
||||
if (res.response) {
|
||||
this.fileList.push(res.response.result)
|
||||
// console.log('flist',res.response)
|
||||
} else {
|
||||
this.fileList.push(res)
|
||||
}
|
||||
})
|
||||
let fileList1=[]
|
||||
fileList1[0]=this.fileList[this.fileList.length-1]
|
||||
if(this.myfileList.length > 0){
|
||||
this.$emit('uploadSuccess', fileList1)
|
||||
this.$message.destroy()
|
||||
this.$message.success(`${info.file.name} 文件上传成功。`);
|
||||
// console.log('fileList111',file,this.fileList,fileList1)
|
||||
}
|
||||
} else if (status === 'uploading') {
|
||||
this.myfileList = info.fileList;
|
||||
this.$emit('uploadSuccess')
|
||||
// this.$message.success(`${info.file.name} 文件上传成功。`);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
this.$message.warning('不支持上传该类型的文件!')
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
<style lang="less">
|
||||
.ocr-upload-modal{
|
||||
.ant-modal-wrap{
|
||||
z-index: 1002;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
Reference in New Issue
Block a user