导入拆分结果
This commit is contained in:
@@ -569,5 +569,6 @@ module.exports = {
|
|||||||
searchContent:'Search content',
|
searchContent:'Search content',
|
||||||
viewFile:'view file',
|
viewFile:'view file',
|
||||||
fileFormatIncorrect:'the file format is incorrect',
|
fileFormatIncorrect:'the file format is incorrect',
|
||||||
|
pleaseUploadFile:'please upload the file',
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -573,6 +573,7 @@ module.exports = {
|
|||||||
searchContent:'搜索内容',
|
searchContent:'搜索内容',
|
||||||
viewFile:'查看文件',
|
viewFile:'查看文件',
|
||||||
fileFormatIncorrect:'文件格式不正确',
|
fileFormatIncorrect:'文件格式不正确',
|
||||||
|
pleaseUploadFile:'请上传文件',
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -169,7 +169,7 @@
|
|||||||
<span class="title-text-text">{{item.db_field_txt}}</span>
|
<span class="title-text-text">{{item.db_field_txt}}</span>
|
||||||
</div>
|
</div>
|
||||||
<a-form-model-item class="itemModel" :prop="item.db_field_name">
|
<a-form-model-item class="itemModel" :prop="item.db_field_name">
|
||||||
<uploadFile ref="uploadFile" :accept="accept" :disabled="disabled" @uploadSuccess="uploadSuccess"></uploadFile>
|
<uploadFile ref="uploadFile" :accept="accept" :disabled="disabled" :module="'ocr'" @uploadSuccess="uploadSuccess"></uploadFile>
|
||||||
<!-- <a-button type="primary" class="button-text"-->
|
<!-- <a-button type="primary" class="button-text"-->
|
||||||
<!-- @click="clickButtonToUpload(item.db_field_name)">-->
|
<!-- @click="clickButtonToUpload(item.db_field_name)">-->
|
||||||
<!-- {{ (formInline[item.db_field_name] === 'null' || formInline[item.db_field_name] === '' ||-->
|
<!-- {{ (formInline[item.db_field_name] === 'null' || formInline[item.db_field_name] === '' ||-->
|
||||||
|
|||||||
@@ -15,7 +15,8 @@
|
|||||||
:remove='remove'
|
:remove='remove'
|
||||||
@change="handleChange">
|
@change="handleChange">
|
||||||
<!-- <p><a-icon style="font-size: 67px;color: #c0c4cc;" type="cloud-upload" /></p>-->
|
<!-- <p><a-icon style="font-size: 67px;color: #c0c4cc;" type="cloud-upload" /></p>-->
|
||||||
<a-button type="primary" ghost class="ant-upload-text" style="font-size: 14px;line-height: 30px">{{$t('clickUpload')}}</a-button>
|
<a-button type="primary" v-if="module=='ocr'" ghost class="ant-upload-text" style="font-size: 14px;line-height: 30px">{{$t('clickUpload')}}</a-button>
|
||||||
|
<a-button type="primary" v-if="module=='split'" class="ant-upload-text" style="font-size: 14px;line-height: 30px">{{$t('clickUpload')}}</a-button>
|
||||||
</a-upload>
|
</a-upload>
|
||||||
<!-- </a-modal>-->
|
<!-- </a-modal>-->
|
||||||
</div>
|
</div>
|
||||||
@@ -26,7 +27,7 @@
|
|||||||
import { ACCESS_TOKEN } from "@/store/mutation-types"
|
import { ACCESS_TOKEN } from "@/store/mutation-types"
|
||||||
export default {
|
export default {
|
||||||
name: 'ocrUpload',
|
name: 'ocrUpload',
|
||||||
props:['disableds','disabled','thisFileUploadUrl','readonly','thisFileType','accept','title','listType'],
|
props:['disableds','disabled','thisFileUploadUrl','readonly','thisFileType','accept','title','listType','module'],
|
||||||
data(){
|
data(){
|
||||||
return{
|
return{
|
||||||
visible:false,
|
visible:false,
|
||||||
@@ -48,6 +49,7 @@
|
|||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
beforeUpload(file,fileList) {
|
beforeUpload(file,fileList) {
|
||||||
|
console.log('file',this.accept)
|
||||||
if(this.myfileList&&this.myfileList.length>=1){
|
if(this.myfileList&&this.myfileList.length>=1){
|
||||||
this.$message.warning('只能上传一个文件')
|
this.$message.warning('只能上传一个文件')
|
||||||
return false
|
return false
|
||||||
@@ -67,7 +69,7 @@
|
|||||||
},
|
},
|
||||||
handleChange(info) {
|
handleChange(info) {
|
||||||
// console.log('info',info)
|
// console.log('info',info)
|
||||||
let { file } = info;
|
let { file,fileList } = info;
|
||||||
const status = info.file.status;
|
const status = info.file.status;
|
||||||
info.fileList.forEach((val,index)=>{
|
info.fileList.forEach((val,index)=>{
|
||||||
if(val.response && !val.response.result){
|
if(val.response && !val.response.result){
|
||||||
|
|||||||
@@ -71,21 +71,14 @@
|
|||||||
beforeUpload(file) {
|
beforeUpload(file) {
|
||||||
let fileFlag=false
|
let fileFlag=false
|
||||||
console.log('accept',this.accept,file)
|
console.log('accept',this.accept,file)
|
||||||
// if(this.accept.indexOf(',')!=-1){
|
|
||||||
// let fileTypes=this.accept.split(',')
|
let fileTypes=this.accept.split('/')
|
||||||
// fileTypes.forEach(item=>{
|
let fileNowTypes=file.type.split('/')
|
||||||
// if(item==file.type){
|
fileFlag=fileTypes[0]==fileTypes[0]?true:false
|
||||||
// fileFlag=true
|
|
||||||
// }
|
|
||||||
// })
|
|
||||||
// }else{
|
|
||||||
// let fileTypes=this.accept.split('/')
|
|
||||||
// let fileNowTypes=file.type.split('/')
|
|
||||||
// fileFlag=fileTypes[0]==fileTypes[0]?true:false
|
|
||||||
// }
|
|
||||||
|
|
||||||
// console.log('filetype',fileFlag)
|
// console.log('filetype',fileFlag)
|
||||||
if(fileFlag){
|
if(!fileFlag){
|
||||||
this.$message.warning(this.$t('fileFormatIncorrect'))
|
this.$message.warning(this.$t('fileFormatIncorrect'))
|
||||||
this.fileTypeSatus = false
|
this.fileTypeSatus = false
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
@@ -34,33 +34,33 @@
|
|||||||
:wrapper-col="wrapperCol"
|
:wrapper-col="wrapperCol"
|
||||||
>
|
>
|
||||||
<a-form-model-item ref="file" :label="$t('splitFile')" prop="file">
|
<a-form-model-item ref="file" :label="$t('splitFile')" prop="file">
|
||||||
{{form.file}}
|
<split-upload ref="uploadFile" :accept="accept" :disabled="disabled" :module="'split'" @uploadSuccess="uploadSuccess"></split-upload>
|
||||||
<a-button type="primary" class="button-text"
|
<!-- <a-button type="primary" class="button-text"-->
|
||||||
@click="fileUpload()">
|
<!-- @click="fileUpload()">-->
|
||||||
|
|
||||||
{{ (form.file === 'null' || form.file === '' ||
|
<!-- {{ (form.file === 'null' || form.file === '' ||-->
|
||||||
form.file == null) ? $t('upload1') : $t('viewUploadedFiles')
|
<!-- form.file == null) ? $t('upload1') : $t('viewUploadedFiles')-->
|
||||||
}}
|
<!-- }}-->
|
||||||
</a-button>
|
<!-- </a-button>-->
|
||||||
</a-form-model-item>
|
</a-form-model-item>
|
||||||
</a-form-model>
|
</a-form-model>
|
||||||
<a-button class="file-down" type="primary" @click="downLoad">{{$t('templateDownload')}}</a-button>
|
<a-button class="file-down" type="primary" @click="downLoad">{{$t('templateDownload')}}</a-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="imports-footer">
|
<div class="imports-footer">
|
||||||
<div class="imports-footer-wrap">
|
<div class="imports-footer-wrap">
|
||||||
<!-- <uploadFile ref="uploadFile" :accept="accept" :disabled="disabled" @uploadSuccess="uploadSuccess"></uploadFile>-->
|
|
||||||
<a-button class="imports-btn imports-chai" type="primary" @click="handleSubmit">{{$t('preservation')}}</a-button>
|
<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>
|
<a-button class="imports-btn" type="primary" @click="cancleImports">{{$t('cancel')}}</a-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<split-upload ref="uploadFile" :disabled="disabled" :title="upload1" :accept="accept" @uploadSuccess="uploadSuccess"></split-upload>
|
<!-- <split-upload ref="uploadFile" :disabled="disabled" :title="upload1" :accept="accept" @uploadSuccess="uploadSuccess"></split-upload>-->
|
||||||
</a-drawer>
|
</a-drawer>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getAction, postAction, deleteAction, downloadFile } from '@/api/manage'
|
import { getAction, postAction, deleteAction, downloadFile } from '@/api/manage'
|
||||||
import SplitUpload from '@/components/SplitUpload/index'
|
import SplitUpload from '@/components/OcrUpload/index'
|
||||||
import search from '@/components/search/index'
|
import search from '@/components/search/index'
|
||||||
import TableData from '@/components/SplitTable/DocTable'
|
import TableData from '@/components/SplitTable/DocTable'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
@@ -123,7 +123,7 @@
|
|||||||
form:{},
|
form:{},
|
||||||
rules:{
|
rules:{
|
||||||
file:[
|
file:[
|
||||||
{ required: true, message: this.$t('noFile'), trigger: 'change' },
|
{ required: true, message: this.$t('pleaseUploadFile'), trigger: 'blur' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
spinning:false, //loading标识
|
spinning:false, //loading标识
|
||||||
@@ -139,6 +139,7 @@
|
|||||||
accept:'application/zip',
|
accept:'application/zip',
|
||||||
rows:[],
|
rows:[],
|
||||||
token:Vue.ls.get(ACCESS_TOKEN),
|
token:Vue.ls.get(ACCESS_TOKEN),
|
||||||
|
flag:false, //提交表单标识
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props:{
|
props:{
|
||||||
@@ -209,9 +210,11 @@
|
|||||||
uploadSuccess(data) {
|
uploadSuccess(data) {
|
||||||
// console.log('updata',data)
|
// console.log('updata',data)
|
||||||
let attIdList = []
|
let attIdList = []
|
||||||
data.map(item => {
|
if(data && data.length>0) {
|
||||||
attIdList.push(item.id || data.name)
|
data.map(item => {
|
||||||
})
|
attIdList.push(item.id || data.name)
|
||||||
|
})
|
||||||
|
}
|
||||||
// /** 赋值给当前对应的表单文件 */
|
// /** 赋值给当前对应的表单文件 */
|
||||||
this.form.file = attIdList.join(',')
|
this.form.file = attIdList.join(',')
|
||||||
// console.log('this.form.file',this.form.file)
|
// console.log('this.form.file',this.form.file)
|
||||||
@@ -223,47 +226,69 @@
|
|||||||
},
|
},
|
||||||
//保存
|
//保存
|
||||||
handleSubmit(){
|
handleSubmit(){
|
||||||
console.log('seleced',this.selectedRowKeys,this.rows)
|
// console.log('seleced',this.selectedRowKeys,this.rows)
|
||||||
if(!this.rows){
|
if(this.rows.length===0){
|
||||||
this.$message.warning(this.$t('PleaseSelectData'))
|
this.$message.warning(this.$t('PleaseSelectData'))
|
||||||
}else if(this.rows&&this.rows.length>1){
|
}else if(this.rows&&this.rows.length>1){
|
||||||
this.$message.warning(this.$t('OnlyOneSelected'))
|
this.$message.warning(this.$t('OnlyOneSelected'))
|
||||||
}else if(this.rows&&this.rows.length===1){
|
}else if(this.rows&&this.rows.length===1){
|
||||||
let params={
|
this.$refs.ruleForm.validate(valid=>{
|
||||||
connectId:this.rows[0].connect_id,
|
if(valid){
|
||||||
fileId:this.form.file,
|
this.flag=true
|
||||||
fileName:this.rows[0].file_name,
|
if(this.flag){
|
||||||
fileType:this.rows[0].text_info,
|
let params={
|
||||||
serialNumber:this.rows[0].serial_number,
|
connectId:this.rows[0].connect_id,
|
||||||
title:this.rows[0].title
|
splitFileId:this.form.file,
|
||||||
}
|
fileName:this.rows[0].file_name,
|
||||||
let formData = new FormData()
|
serialNumber:this.rows[0].serial_number,
|
||||||
Object.keys(params).forEach((key) => {
|
title:this.rows[0].title,
|
||||||
console.log('key',key,params[key])
|
|
||||||
formData.append(key, params[key]);
|
|
||||||
});
|
|
||||||
console.log('formData',params,formData.getAll)
|
|
||||||
axios({
|
|
||||||
url: '/jero-boot/split/sarFileSplitItems/importSplitResult',
|
|
||||||
method: 'post',
|
|
||||||
data:formData,
|
|
||||||
// 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': 'multipart/form-data',
|
|
||||||
// 'Content-Type': 'application/x-www-form-urlencoded',
|
|
||||||
'X-Access-Token':this.token
|
|
||||||
}
|
|
||||||
}).then(res => {
|
|
||||||
if (res.data.success) {
|
|
||||||
|
|
||||||
|
}
|
||||||
|
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)
|
||||||
|
axios({
|
||||||
|
url: '/jero-boot/split/sarFileSplitItems/importSplitResult',
|
||||||
|
method: 'post',
|
||||||
|
data:formData,
|
||||||
|
// 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': 'multipart/form-data',
|
||||||
|
// 'Content-Type': 'application/x-www-form-urlencoded',
|
||||||
|
'X-Access-Token':this.token
|
||||||
|
}
|
||||||
|
}).then(res => {
|
||||||
|
if (res.data.success) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}).finally(()=>[
|
||||||
|
this.flag=false
|
||||||
|
])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user