Commit 59c2f5dc by 前端

打印屏蔽一页两张,关联数据上传会带改为OSS,接口访问超时时间改为300秒

1 parent 4fe9392f
...@@ -40,7 +40,7 @@ function errorLog(error) { ...@@ -40,7 +40,7 @@ function errorLog(error) {
// 创建一个 axios 实例 // 创建一个 axios 实例
const service = axios.create({ const service = axios.create({
// baseURL: baseURL, // baseURL: baseURL,
timeout: 100000, // 请求超时时间 timeout: 300000, // 请求超时时间
transformRequest: [ transformRequest: [
function (data) { function (data) {
return Qs.stringify(data) return Qs.stringify(data)
......
...@@ -132,6 +132,7 @@ import { Util, deepClone } from '@/common/util' ...@@ -132,6 +132,7 @@ import { Util, deepClone } from '@/common/util'
import { mapActions, mapState, mapMutations } from 'vuex' import { mapActions, mapState, mapMutations } from 'vuex'
import { cdSignOpt, receiptStatusOpt, associationOpt } from '@/common/constants.js' import { cdSignOpt, receiptStatusOpt, associationOpt } from '@/common/constants.js'
import { receiptImport, association, saveAssociation, getImportTask } from '@api/theAssetData' import { receiptImport, association, saveAssociation, getImportTask } from '@api/theAssetData'
import alyOss from '@/common/oss.js'
export default { export default {
name: 'ImportTwo', name: 'ImportTwo',
props: { props: {
...@@ -453,17 +454,19 @@ export default { ...@@ -453,17 +454,19 @@ export default {
if (size < 10) { if (size < 10) {
this.$set(this.fileForm, 'fileName', e.target.files[0].name) this.$set(this.fileForm, 'fileName', e.target.files[0].name)
// // 转码base64 // // 转码base64
const reader = new FileReader() // const reader = new FileReader()
reader.readAsDataURL(e.target.files[0]) // reader.readAsDataURL(e.target.files[0])
reader.onload = event => { // reader.onload = event => {
const imgFile = event.target.result // const imgFile = event.target.result
const arrBase64 = imgFile.split(',') // const arrBase64 = imgFile.split(',')
this.fileInfo = e.target.files[0].name.split('.')[e.target.files[0].name.split('.')?.length - 1] + '@' + arrBase64[1] // this.fileInfo = e.target.files[0].name.split('.')[e.target.files[0].name.split('.')?.length - 1] + '@' + arrBase64[1]
document.getElementById('fileUpload').value = '' // document.getElementById('fileUpload').value = ''
} // }
this.fileInfo = e.target.files[0]
} else { } else {
this.notice.errorTips('上传文件不可超过10M') this.notice.errorTips('上传文件不可超过10M')
} }
document.getElementById('fileUpload').value = ''
}, },
handleImport() { handleImport() {
this.fileForm = { this.fileForm = {
...@@ -475,22 +478,53 @@ export default { ...@@ -475,22 +478,53 @@ export default {
handleConfirmImport() { handleConfirmImport() {
this.$refs.fileRuleForm.validate(valid => { this.$refs.fileRuleForm.validate(valid => {
if (valid) { if (valid) {
var params = { // var params = {
file: this.fileInfo, // file: this.fileInfo,
fileName: this.fileForm.fileName, // fileName: this.fileForm.fileName,
fileType: this.fileForm.fileName.substr(this.fileForm.fileName.lastIndexOf('.') + 1) // fileType: this.fileForm.fileName.substr(this.fileForm.fileName.lastIndexOf('.') + 1)
} // }
receiptImport(params).then(res => { // receiptImport(params).then(res => {
console.log('res', res) // console.log('res', res)
if (res && res.data && res.data.length > 0) { // if (res && res.data && res.data.length > 0) {
this.notice.okTips('上传成功') // this.notice.okTips('上传成功')
this.handleImport() // this.handleImport()
this.tableData.find(item => item === this.currentRow).receipt = res.data[0] // this.tableData.find(item => item === this.currentRow).receipt = res.data[0]
this.allData.find(item => item === this.currentRow).receipt = res.data[0] // this.allData.find(item => item === this.currentRow).receipt = res.data[0]
// this.statReceiptCount(this.allData) // 重新统计关联数 // // this.statReceiptCount(this.allData) // 重新统计关联数
console.log('this.tableData', this.tableData) // console.log('this.tableData', this.tableData)
} // }
}) // })
const bucketName = 'zzl-filerepostorypublic' // 桶名
const file = this.fileInfo
const fileType = this.fileForm.fileName.substr(this.fileForm.fileName.lastIndexOf('.') + 1)
alyOss.bucketUpload(
file,
(res) => {
var params = {
fileUrl: res.aliyunAddress,
fileName: res.attachment,
fileType: res.attachment.substr(res.attachment.lastIndexOf('.') + 1)
}
receiptImport(params).then(res => {
console.log('res', res)
if (res && res.data && res.data.length > 0) {
this.notice.okTips('上传成功')
this.handleImport()
this.tableData.find(item => item === this.currentRow).receipt = res.data[0]
this.allData.find(item => item === this.currentRow).receipt = res.data[0]
// this.statReceiptCount(this.allData) // 重新统计关联数
console.log('this.tableData', this.tableData)
}
})
},
(err) => {
console.log(err)
this.btLoading = false
},
bucketName,
fileType
)
} }
}) })
}, },
......
...@@ -447,10 +447,11 @@ export default { ...@@ -447,10 +447,11 @@ export default {
{ {
confId: 1, confId: 1,
confLabel: '一页一张' confLabel: '一页一张'
}, {
confId: 2,
confLabel: '一页两张'
} }
// {
// confId: 2,
// confLabel: '一页两张'
// }
], ],
printIds: [], printIds: [],
// pdfList: [ // pdfList: [
...@@ -775,25 +776,25 @@ export default { ...@@ -775,25 +776,25 @@ export default {
}, },
changePageType(val) { changePageType(val) {
if (val == 1) { // if (val == 1) {
this.usageList = [ // this.usageList = [
{ // {
confId: 1, // confId: 1,
confLabel: '一页一张' // confLabel: '一页一张'
}, { // }, {
confId: 2, // confId: 2,
confLabel: '一页两张' // confLabel: '一页两张'
} // }
] // ]
} else if (val == 2) { // } else if (val == 2) {
this.usageList = [ // this.usageList = [
{ // {
confId: 1, // confId: 1,
confLabel: '一页一张' // confLabel: '一页一张'
} // }
] // ]
} // }
this.printForm.usage = this.usageList[0].confId // this.printForm.usage = this.usageList[0].confId
}, },
// 批量打印 // 批量打印
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!