|
|
|
@ -813,6 +813,7 @@ export default { |
|
|
|
this.dataList = data.rows2 |
|
|
|
// 遍历sopFileList,将每个对象的orderRef4赋值给versionNumber |
|
|
|
data.rows3.forEach((item) => { |
|
|
|
item.fileType = item.fileSuffix |
|
|
|
item.versionNumber = item.orderRef4 |
|
|
|
item.resourceInfo = item.orderRef3 + '(' + item.resourceDesc + ')' |
|
|
|
if (item.expiryDate !== null) { |
|
|
|
@ -841,7 +842,6 @@ export default { |
|
|
|
let image = ['jpg', 'jpeg', 'png', 'gif', 'bmp'] |
|
|
|
let pdf = ['pdf'] |
|
|
|
let type = '' |
|
|
|
row.fileType = row.fileSuffix |
|
|
|
if (image.includes(row.fileType.toLowerCase())) { |
|
|
|
this.pdfUrl = '/file/' + row.newFileName |
|
|
|
} |
|
|
|
@ -862,74 +862,38 @@ export default { |
|
|
|
viewSopFile(row) { |
|
|
|
// 预览文件 |
|
|
|
let image = ['jpg', 'jpeg', 'png', 'gif', 'bmp'] |
|
|
|
let video = ['mp4', 'avi', 'mov', 'wmv', 'flv'] |
|
|
|
let office = ['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx'] |
|
|
|
let txt = ['txt'] |
|
|
|
let type = '' |
|
|
|
let pdf = ['pdf'] |
|
|
|
row.fileType = row.fileType |
|
|
|
if (image.includes(row.fileType.toLowerCase())) { |
|
|
|
type = 'image/' + row.fileType |
|
|
|
downLoadObjectFile(row).then(({data}) => { |
|
|
|
const blob = new Blob([data], { type: type }); |
|
|
|
// 创建URL来生成预览 |
|
|
|
const fileURL = URL.createObjectURL(blob); |
|
|
|
// 在新标签页中打开文件预览 |
|
|
|
const newTab = window.open(fileURL, '_blank') |
|
|
|
}) |
|
|
|
} |
|
|
|
else if (video.includes(row.fileType.toLowerCase())) { |
|
|
|
let video = ['mp4', 'avi', 'mov', 'wmv', 'flv'] |
|
|
|
if (video.includes(row.fileType.toLowerCase())) { |
|
|
|
type = 'video/' + row.fileType |
|
|
|
downLoadObjectFile(row).then(({data}) => { |
|
|
|
const blob = new Blob([data], { type: type }); |
|
|
|
// 创建URL来生成预览 |
|
|
|
const fileURL = URL.createObjectURL(blob); |
|
|
|
// 在新标签页中打开文件预览 |
|
|
|
const newTab = window.open(fileURL, '_blank') |
|
|
|
}) |
|
|
|
} |
|
|
|
else if (txt.includes(row.fileType.toLowerCase())) { |
|
|
|
let txt = ['txt'] |
|
|
|
if (txt.includes(row.fileType.toLowerCase())) { |
|
|
|
type = 'text/plain' |
|
|
|
downLoadObjectFile(row).then(({data}) => { |
|
|
|
const blob = new Blob([data], { type: type }); |
|
|
|
// 创建URL来生成预览 |
|
|
|
const fileURL = URL.createObjectURL(blob); |
|
|
|
// 在新标签页中打开文件预览 |
|
|
|
const newTab = window.open(fileURL, '_blank') |
|
|
|
}) |
|
|
|
} |
|
|
|
else if (office.includes(row.fileType.toLowerCase())) { |
|
|
|
if (row.fileType.toLowerCase() === 'doc' || row.fileType.toLowerCase() === 'docx') { |
|
|
|
type = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' |
|
|
|
} else if (row.fileType.toLowerCase() === 'ppt' || row.fileType.toLowerCase() === 'pptx') { |
|
|
|
type = 'application/vnd.openxmlformats-officedocument.presentationml.presentation' |
|
|
|
} else { |
|
|
|
type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' |
|
|
|
} |
|
|
|
downLoadObjectFile(row).then(({data}) => { |
|
|
|
const blob = new Blob([data], { type: type }); |
|
|
|
// 创建URL来生成预览 |
|
|
|
const fileURL = URL.createObjectURL(blob); |
|
|
|
// 在新标签页中打开文件预览 |
|
|
|
const newTab = window.open(fileURL, '_blank') |
|
|
|
}) |
|
|
|
let office = ['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx'] |
|
|
|
if (office.includes(row.fileType.toLowerCase())) { |
|
|
|
this.$message.warning(`暂不支持预览${row.fileType.toLowerCase()}文件`) |
|
|
|
return |
|
|
|
} |
|
|
|
else if (pdf.includes(row.fileType.toLowerCase())) { |
|
|
|
let pdf = ['pdf'] |
|
|
|
if (pdf.includes(row.fileType.toLowerCase())) { |
|
|
|
type = 'application/pdf' |
|
|
|
downLoadObjectFile(row).then(({data}) => { |
|
|
|
const blob = new Blob([data], { type: type }); |
|
|
|
// 创建URL来生成预览 |
|
|
|
const fileURL = URL.createObjectURL(blob); |
|
|
|
// 在新标签页中打开文件预览 |
|
|
|
const newTab = window.open(fileURL, '_blank') |
|
|
|
}) |
|
|
|
} |
|
|
|
else { |
|
|
|
this.$message({ |
|
|
|
message: '不支持的文件类型', |
|
|
|
type: 'warning' |
|
|
|
}) |
|
|
|
if (type === ''){ |
|
|
|
this.$message.warning(`暂不支持预览${row.fileType.toLowerCase()}文件`) |
|
|
|
return; |
|
|
|
} |
|
|
|
downLoadObjectFile(row).then(({data}) => { |
|
|
|
const blob = new Blob([data], { type: type }); |
|
|
|
// 创建URL来生成预览 |
|
|
|
const fileURL = URL.createObjectURL(blob); |
|
|
|
// 在新标签页中打开文件预览 |
|
|
|
const newTab = window.open(fileURL, '_blank') |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 下载 |
|
|
|
downloadFile (row) { |
|
|
|
|