diff --git a/src/api/eam/eamProject.js b/src/api/eam/eamProject.js index aa35ad5..fe6021b 100644 --- a/src/api/eam/eamProject.js +++ b/src/api/eam/eamProject.js @@ -39,3 +39,6 @@ export const saveHandle= data => createAPI(`/pms/eamProject/saveHandle`,'post',d export const searchMassProductionBomList= data => createAPI(`/pms/eamProject/searchMassProductionBomList`,'post',data) export const searchRoutingList= data => createAPI(`/pms/eamProject/searchRoutingList`,'post',data) + +export const selectFileDataList= data => createAPI(`/pms/eamProject/selectFileDataList`,'post',data) +export const previewEamProjectInfoForUploadFile = data => createAPI(`/pms/eamProject/previewEamProjectInfoForUploadFile`,'post',data,'download') diff --git a/src/views/modules/eam/eamProjectInfoForUploads.vue b/src/views/modules/eam/eamProjectInfoForUploads.vue index 2c93fb0..29e9a89 100644 --- a/src/views/modules/eam/eamProjectInfoForUploads.vue +++ b/src/views/modules/eam/eamProjectInfoForUploads.vue @@ -238,6 +238,7 @@ 复制 提醒 + 查看附件 @@ -365,6 +366,50 @@ + + + + + + + + + + + + + + + + @@ -383,7 +428,12 @@ import { queryProjectUploadsDocumentList, queryAllProjectUploadsDocumentList, deleteProofDocument, getCopyDocumentFileList, copyDocumentFileToDoc } from "../../../api/eam/eamProofing"; -import {searchConfirmProgressPusherList, warnSendMailHandle} from "../../../api/eam/eamProject"; +import { + previewEamProjectInfoForUploadFile, + searchConfirmProgressPusherList, + searchProjectConfirmatorFileList, selectFileDataList, + warnSendMailHandle +} from "../../../api/eam/eamProject"; import {getSiteAndBuByUserName} from "../../../api/qc/qc"; import {removeUserFavorite, saveUserFavorite, userFavoriteList} from "../../../api/userFavorite"; import {getTableDefaultListLanguage, getTableUserListLanguage, updateColumnSize} from "../../../api/table"; @@ -434,6 +484,8 @@ export default { confirmProgressList: [], projectPartDocumentList: [], allPersonnelInfoList: [], + fileDataList: [], + viewMassDocumentFileVisible: false, height: 200, pageIndex: 1, pageSize: 20, @@ -3197,6 +3249,46 @@ export default { }); }, + selectFileDataList(row){ + selectFileDataList(row).then(({data}) => { + if (data && data.code === 0){ + this.fileDataList = data.list; + } + }) + this.viewMassDocumentFileVisible = true + }, + + viewFile(row){ + previewEamProjectInfoForUploadFile(row).then(({data}) => { + let type = 'application/pdf;charset=UTF-8' + const blob = new Blob([data], { type: type }) + console.log(blob,type) + // 创建URL来生成预览 + const fileURL = URL.createObjectURL(blob) + // 在新标签页中打开文件预览 + window.open(fileURL, '_blank') + }) + }, + + downloadFile (row) { + previewEamProjectInfoForUploadFile(row) + .then(({data}) => { + // 不限制文件下载类型 + const blob = new Blob([data], {type:'application/octet-stream;charset=utf-8'}) + // 下载文件名称 + const fileName = row.fileName + // a标签下载 + const linkNode = document.createElement('a') + linkNode.download = fileName // a标签的download属性规定下载文件的名称 + linkNode.style.display = 'none' + linkNode.href = URL.createObjectURL(blob) // 生成一个Blob URL + document.body.appendChild(linkNode) + linkNode.click() // 模拟在按钮上的一次鼠标单击 + URL.revokeObjectURL(linkNode.href) // 释放URL 对象 + document.body.removeChild(linkNode) + }) + }, + copyFile (row) { this.copyModalData = { ...row,