Commit 36c79ec8 authored by 田翔's avatar 田翔

fix: 支持xls格式

parent 6db57b86
{ {
"name": "panda-xform", "name": "panda-xform",
"version": "5.1.9", "version": "5.2.0",
"description": "5.1.9 excel表格预览优化", "description": "5.2.0 支持xls格式",
"keywords": [ "keywords": [
"panda-xform" "panda-xform"
], ],
......
...@@ -36,6 +36,9 @@ const getFileType = (fileName) => { ...@@ -36,6 +36,9 @@ const getFileType = (fileName) => {
if (fileName.includes('docx')) { if (fileName.includes('docx')) {
return 'docx' return 'docx'
} }
if (fileName.includes('xls')) {
return 'xls'
}
if (fileName.includes('xlsx')) { if (fileName.includes('xlsx')) {
return 'xlsx' return 'xlsx'
} }
...@@ -124,7 +127,7 @@ const FileUpload = (props) => { ...@@ -124,7 +127,7 @@ const FileUpload = (props) => {
if (!preview) return message.info('该附件禁止预览') if (!preview) return message.info('该附件禁止预览')
let fileType = getFileType(file.name) let fileType = getFileType(file.name)
if (fileType) { if (fileType) {
if (fileType === 'xlsx') { if (['xlsx', 'xls'].includes(fileType)) {
downloadFile(file.sourcePath) downloadFile(file.sourcePath)
.then(response => response.arrayBuffer()) .then(response => response.arrayBuffer())
.then(buffer => { .then(buffer => {
...@@ -154,7 +157,7 @@ const FileUpload = (props) => { ...@@ -154,7 +157,7 @@ const FileUpload = (props) => {
<img style={{ maxWidth: '100%', maxHeight: '100%' }} src={window.location.origin + showFile.filePath}></img> <img style={{ maxWidth: '100%', maxHeight: '100%' }} src={window.location.origin + showFile.filePath}></img>
</div> </div>
) )
} else if (['xlsx'.includes(showFile.fileType)]) { } else if (['xlsx', 'xls'].includes(showFile.fileType)) {
return ( return (
<div> <div>
<Tabs> <Tabs>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment