Commit 59c2f5dc by 前端

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

1 parent 4fe9392f
......@@ -40,7 +40,7 @@ function errorLog(error) {
// 创建一个 axios 实例
const service = axios.create({
// baseURL: baseURL,
timeout: 100000, // 请求超时时间
timeout: 300000, // 请求超时时间
transformRequest: [
function (data) {
return Qs.stringify(data)
......
......@@ -132,6 +132,7 @@ import { Util, deepClone } from '@/common/util'
import { mapActions, mapState, mapMutations } from 'vuex'
import { cdSignOpt, receiptStatusOpt, associationOpt } from '@/common/constants.js'
import { receiptImport, association, saveAssociation, getImportTask } from '@api/theAssetData'
import alyOss from '@/common/oss.js'
export default {
name: 'ImportTwo',
props: {
......@@ -453,17 +454,19 @@ export default {
if (size < 10) {
this.$set(this.fileForm, 'fileName', e.target.files[0].name)
// // 转码base64
const reader = new FileReader()
reader.readAsDataURL(e.target.files[0])
reader.onload = event => {
const imgFile = event.target.result
const arrBase64 = imgFile.split(',')
this.fileInfo = e.target.files[0].name.split('.')[e.target.files[0].name.split('.')?.length - 1] + '@' + arrBase64[1]
document.getElementById('fileUpload').value = ''
}
// const reader = new FileReader()
// reader.readAsDataURL(e.target.files[0])
// reader.onload = event => {
// const imgFile = event.target.result
// const arrBase64 = imgFile.split(',')
// this.fileInfo = e.target.files[0].name.split('.')[e.target.files[0].name.split('.')?.length - 1] + '@' + arrBase64[1]
// document.getElementById('fileUpload').value = ''
// }
this.fileInfo = e.target.files[0]
} else {
this.notice.errorTips('上传文件不可超过10M')
}
document.getElementById('fileUpload').value = ''
},
handleImport() {
this.fileForm = {
......@@ -475,22 +478,53 @@ export default {
handleConfirmImport() {
this.$refs.fileRuleForm.validate(valid => {
if (valid) {
var params = {
file: this.fileInfo,
fileName: this.fileForm.fileName,
fileType: this.fileForm.fileName.substr(this.fileForm.fileName.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)
}
})
// var params = {
// file: this.fileInfo,
// fileName: this.fileForm.fileName,
// fileType: this.fileForm.fileName.substr(this.fileForm.fileName.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)
// }
// })
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 {
{
confId: 1,
confLabel: '一页一张'
}, {
confId: 2,
confLabel: '一页两张'
}
// {
// confId: 2,
// confLabel: '一页两张'
// }
],
printIds: [],
// pdfList: [
......@@ -775,25 +776,25 @@ export default {
},
changePageType(val) {
if (val == 1) {
this.usageList = [
{
confId: 1,
confLabel: '一页一张'
}, {
confId: 2,
confLabel: '一页两张'
}
]
} else if (val == 2) {
this.usageList = [
{
confId: 1,
confLabel: '一页一张'
}
]
}
this.printForm.usage = this.usageList[0].confId
// if (val == 1) {
// this.usageList = [
// {
// confId: 1,
// confLabel: '一页一张'
// }, {
// confId: 2,
// confLabel: '一页两张'
// }
// ]
// } else if (val == 2) {
// this.usageList = [
// {
// confId: 1,
// confLabel: '一页一张'
// }
// ]
// }
// 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!