diff --git a/components/apolloTable/component/base/extra/upload/index.tsx b/components/apolloTable/component/base/extra/upload/index.tsx index 99e767eaa3685cb35b6236ed4e7a8e0ce0a982a2..1713a0af5f208a9eaa899eea7faeaa7170db1d69 100644 --- a/components/apolloTable/component/base/extra/upload/index.tsx +++ b/components/apolloTable/component/base/extra/upload/index.tsx @@ -20,15 +20,19 @@ const UploadCom = (props) => { if (typeof getFormat === 'function') { return getFormat(fileList); } - return fileList.map((item: any) => { - return { - name: item.name, - value: item.value, - size: item.size, - uid: item.value, - ...checkoutFileType(item.value), - }; - }); + return fileList + .filter((item: any) => { + return item.value; + }) + .map((item: any) => { + return { + name: item.name, + value: item.value, + size: item.size, + uid: item.value, + ...checkoutFileType(item.value), + }; + }); }; const setFormatFile = (file) => { if (!file) { diff --git a/components/apolloTable/component/base/extra/upload/preview.tsx b/components/apolloTable/component/base/extra/upload/preview.tsx index be20902d5726ab6411ec381b8b59598d52cd0e3e..6987c4a1891b831c9068b85404b42ac342eeed71 100644 --- a/components/apolloTable/component/base/extra/upload/preview.tsx +++ b/components/apolloTable/component/base/extra/upload/preview.tsx @@ -9,8 +9,10 @@ export default class uploadDetail extends React.Component { url: '', }; - onPreview = (url, name) => { - const typeArr = (name || url).match(/\.[a-zA-Z]+$/); + onPreview = (url:string, name:string) => { + const nameTypeArr = name.match(/\.[a-zA-Z]+$/); + const urlTypeArr = url.match(/\.[a-zA-Z]+$/); + const typeArr = nameTypeArr || urlTypeArr; let type = typeArr && typeArr[0] ? typeArr[0].replace('.', '') : ''; type = type.toLowerCase(); if (['png', 'gif', 'bmp', 'jpg', 'jpeg'].includes(type)) { @@ -24,7 +26,7 @@ export default class uploadDetail extends React.Component { } }; - handleCancel = (e) => { + handleCancel = (e:any) => { e.stopPropagation(); this.setState({ showDialog: false }); };