Browse Source

下载指定文件夹文件

master
han\hanst 20 hours ago
parent
commit
c172588fda
  1. 3
      src/api/part/partInformation.js
  2. 21
      src/views/modules/project/projectInfo/project_part_upload.vue

3
src/api/part/partInformation.js

@ -224,6 +224,9 @@ export const readPartFromFile = data => createAPI(`/plm/partInformation/readPart
// 下载文件 // 下载文件
export const downLoadFile = data => createAPI(`/plm/partInformation/downLoadFile?id=`+data.id,'post','download') export const downLoadFile = data => createAPI(`/plm/partInformation/downLoadFile?id=`+data.id,'post','download')
// 下载指定文件夹文件
export const downLoadFile2 = data => createAPI(`/plm/partInformation/downLoadFile2`,'post','download')
export const getPartRevisionEngChgLevel = data => createAPI(`/plm/partInformation/getPartRevisionEngChgLevel`,'post',data) export const getPartRevisionEngChgLevel = data => createAPI(`/plm/partInformation/getPartRevisionEngChgLevel`,'post',data)
export const queryPartUnitCostList = data => createAPI(`/plm/partInformation/queryPartUnitCostList`,'post',data) export const queryPartUnitCostList = data => createAPI(`/plm/partInformation/queryPartUnitCostList`,'post',data)

21
src/views/modules/project/projectInfo/project_part_upload.vue

@ -25,7 +25,7 @@
import { import {
uploadProjectPartExcel, // uploadProjectPartExcel, //
queryFileId, // ID queryFileId, // ID
downLoadFile, //
downLoadFile, downLoadFile2,
} from '@/api/part/partInformation.js' } from '@/api/part/partInformation.js'
export default { export default {
name:'projectPartUpload', name:'projectPartUpload',
@ -105,24 +105,9 @@ export default {
// //
async downloadFile () { async downloadFile () {
let file = { let file = {
id: 0,
fileName: ''
fileName: '项目物料导入模板.xlsx'
} }
let tempData = {
orderRef1: this.pageData.site,
orderRef2: 'projectPart'
}
await queryFileId(tempData).then(({data}) => {
if (data && data.code === 0) {
file.id = data.data.id
file.fileName = data.data.fileName
} else {
this.$alert(data.msg, '错误', {
confirmButtonText: '确定'
})
}
})
await downLoadFile(file).then(({data}) => {
await downLoadFile2(file).then(({data}) => {
// //
const blob = new Blob([data], {type: "application/octet-stream"}) const blob = new Blob([data], {type: "application/octet-stream"})
// //

Loading…
Cancel
Save