Commit f8795e4f authored by zhangwenshuai's avatar zhangwenshuai

update

parent a44d57d5
......@@ -73,6 +73,7 @@ export default class TableColumn extends PureComponent<ColumnProps> {
showIndex,
columnIndex,
questionText,
remark,
rowSelection,
icon,
required,
......@@ -90,6 +91,7 @@ export default class TableColumn extends PureComponent<ColumnProps> {
marginLeft = `${leftMargin + 70}px`;
}
}
const tip = remark || questionText;
return (
<div className={s.colContainer}>
{rowSelection && columnIndex === 0 && <div className={s.checkbox}>{this.getCheckbox()}</div>}
......@@ -97,8 +99,8 @@ export default class TableColumn extends PureComponent<ColumnProps> {
{icon && <div className={s.colIcon}>{icon()}</div>}
<span className={required ? classNames(s.colTitle, s.required) : s.colTitle}>
{columnChsName}
{questionText && (
<Tooltip title={questionText}>
{tip && (
<Tooltip title={tip}>
<div className={s.tipContainer}>?</div>
</Tooltip>
)}
......
......@@ -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<any>({});
// 七牛上传额外数据,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;
};
......
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