导入拆分结果
This commit is contained in:
@@ -34,33 +34,33 @@
|
||||
:wrapper-col="wrapperCol"
|
||||
>
|
||||
<a-form-model-item ref="file" :label="$t('splitFile')" prop="file">
|
||||
{{form.file}}
|
||||
<a-button type="primary" class="button-text"
|
||||
@click="fileUpload()">
|
||||
<split-upload ref="uploadFile" :accept="accept" :disabled="disabled" :module="'split'" @uploadSuccess="uploadSuccess"></split-upload>
|
||||
<!-- <a-button type="primary" class="button-text"-->
|
||||
<!-- @click="fileUpload()">-->
|
||||
|
||||
{{ (form.file === 'null' || form.file === '' ||
|
||||
form.file == null) ? $t('upload1') : $t('viewUploadedFiles')
|
||||
}}
|
||||
</a-button>
|
||||
<!-- {{ (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">
|
||||
<!-- <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" type="primary" @click="cancleImports">{{$t('cancel')}}</a-button>
|
||||
</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>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
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 TableData from '@/components/SplitTable/DocTable'
|
||||
import axios from 'axios'
|
||||
@@ -123,7 +123,7 @@
|
||||
form:{},
|
||||
rules:{
|
||||
file:[
|
||||
{ required: true, message: this.$t('noFile'), trigger: 'change' },
|
||||
{ required: true, message: this.$t('pleaseUploadFile'), trigger: 'blur' },
|
||||
],
|
||||
},
|
||||
spinning:false, //loading标识
|
||||
@@ -139,6 +139,7 @@
|
||||
accept:'application/zip',
|
||||
rows:[],
|
||||
token:Vue.ls.get(ACCESS_TOKEN),
|
||||
flag:false, //提交表单标识
|
||||
}
|
||||
},
|
||||
props:{
|
||||
@@ -209,9 +210,11 @@
|
||||
uploadSuccess(data) {
|
||||
// console.log('updata',data)
|
||||
let attIdList = []
|
||||
data.map(item => {
|
||||
attIdList.push(item.id || data.name)
|
||||
})
|
||||
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)
|
||||
@@ -223,47 +226,69 @@
|
||||
},
|
||||
//保存
|
||||
handleSubmit(){
|
||||
console.log('seleced',this.selectedRowKeys,this.rows)
|
||||
if(!this.rows){
|
||||
// console.log('seleced',this.selectedRowKeys,this.rows)
|
||||
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,
|
||||
fileId:this.form.file,
|
||||
fileName:this.rows[0].file_name,
|
||||
fileType:this.rows[0].text_info,
|
||||
serialNumber:this.rows[0].serial_number,
|
||||
title:this.rows[0].title
|
||||
}
|
||||
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) {
|
||||
this.$refs.ruleForm.validate(valid=>{
|
||||
if(valid){
|
||||
this.flag=true
|
||||
if(this.flag){
|
||||
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)
|
||||
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