diff --git a/components/apolloTable/component/Column.tsx b/components/apolloTable/component/Column.tsx index 2f9dd88f32fe4834cd0523e797b952afddc79b50..0e1b463ded756295718c9fe2b78df4685c59214b 100644 --- a/components/apolloTable/component/Column.tsx +++ b/components/apolloTable/component/Column.tsx @@ -73,6 +73,7 @@ export default class TableColumn extends PureComponent { showIndex, columnIndex, questionText, + remark, rowSelection, icon, required, @@ -90,6 +91,7 @@ export default class TableColumn extends PureComponent { marginLeft = `${leftMargin + 70}px`; } } + const tip = remark || questionText; return (
{rowSelection && columnIndex === 0 &&
{this.getCheckbox()}
} @@ -97,8 +99,8 @@ export default class TableColumn extends PureComponent { {icon &&
{icon()}
} {columnChsName} - {questionText && ( - + {tip && ( +
?
)} diff --git a/components/apolloTable/component/base/extra/upload/index.tsx b/components/apolloTable/component/base/extra/upload/index.tsx index 5877b4e75e5098b09c51165faeded2ffea75f5d7..28a0da81000eb5cd5ee262b5bcae32bf7457c0c1 100644 --- a/components/apolloTable/component/base/extra/upload/index.tsx +++ b/components/apolloTable/component/base/extra/upload/index.tsx @@ -10,11 +10,17 @@ message.config({ maxCount: 1, }); -const UploadCom = (props) => { - const { - onChange, CDN_HOST, getFormat, setFormat, data, maxLength, disabled, - } = props; - const selfProps = antiAssign(props, ['onChange', 'CDN_HOST', 'data']); +const UploadCom = (props: any) => { + const { onChange, CDN_HOST, getFormat, setFormat, data, maxLength, disabled, fileSize = 5 } = props; + const selfProps = antiAssign(props, [ + 'onChange', + 'CDN_HOST', + 'data', + 'fileSize', + 'maxLength', + 'getFormat', + 'setFormat', + ]); const getFormatFileList = (fileList = []) => { if (!fileList) { return []; @@ -37,7 +43,7 @@ const UploadCom = (props) => { }; }); }; - const setFormatFile = (file) => { + const setFormatFile = (file: any) => { if (!file) { return {}; } @@ -68,7 +74,7 @@ const UploadCom = (props) => { const time = moment().format('YYYYMMDDHHmmss'); return time + rand6 + suffix; }; - const [extraData, setExtraData] = useState({}); + const [extraData, setExtraData] = useState({}); // 七牛上传额外数据,token和key const getToken = async () => { let extData = data || {}; @@ -93,22 +99,22 @@ const UploadCom = (props) => { } }; - const changeFileList = ({ file, fileList }) => { + const changeFileList = ({ file, fileList }: any) => { let newList = fileList; if (maxLength) { newList = fileList.slice(-maxLength); } if (file.status === 'done' && file.response) { const itemObj = setFormatFile(file); - newList = fileList.map((item) => { + newList = fileList.map((item: any) => { return item.uid === itemObj.uid ? itemObj : item; }); onSaveFileList(newList); } setFileList(newList); }; - const previewFile = (file) => { - return new Promise((res, rej) => { + const previewFile = (file: any) => { + return new Promise((res) => { const obj = checkoutFileType(file.name); const typeArr = file.name.match(/\.[a-zA-Z0-9]+$/); const type = typeArr && typeArr[0] ? typeArr[0].replace('.', '') : ''; @@ -117,23 +123,27 @@ const UploadCom = (props) => { } }); }; - const onPreview = (file) => { + const onPreview = (file: any) => { if (previewModel.current && previewModel.current.onPreview) { previewModel.current.onPreview(file.value, file.name); } }; - const onRemove = (file) => { - const newFileList = fileList.filter((item) => { + const onRemove = (file: any) => { + const newFileList = fileList.filter((item: any) => { return item.uid !== file.uid; }); onSaveFileList(newFileList); }; - const onDownload = (file) => { + const onDownload = (file: any) => { window.open(file.value); }; - const beforeUpload = async () => { + const beforeUpload = async (file: any) => { + if (fileSize && file.size / 1000 > fileSize) { + message.error('文件太大了,请按要求重新上传'); + return Promise.reject(); + } await getToken(); return true; };