Commit e2d30212 authored by XieZhiXiong's avatar XieZhiXiong

chore: 完善类型;内部处理格式化逻辑

parent e529843a
...@@ -5,19 +5,38 @@ ...@@ -5,19 +5,38 @@
* @LastEditTime: 2020-11-06 10:02:30 * @LastEditTime: 2020-11-06 10:02:30
* @Description: 附件列表 * @Description: 附件列表
*/ */
import React from 'react'; import React, { useState, useEffect } from 'react';
import { Upload } from 'antd'; import { Upload } from 'antd';
import { FileData } from '@/utils'; import { normalizeFiledata, FileData } from '@/utils';
import MellowCard from '@/components/MellowCard'; import MellowCard from '@/components/MellowCard';
import styles from './index.less'; import styles from './index.less';
export type FaultFileListItem = {
/**
* 文件名
*/
fileName: string
/**
* 文件地址
*/
filePath: string
}
interface FileListProps { interface FileListProps {
fileList: FileData[]; fileList: FaultFileListItem[];
}; };
const FileList: React.FC<FileListProps> = ({ const FileList: React.FC<FileListProps> = ({
fileList = [], fileList = [],
}) => { }) => {
const [innerFileList, setInnerFileList] = useState<FileData[]>();
useEffect(() => {
if (fileList && fileList.length) {
setInnerFileList(fileList?.map(item => normalizeFiledata(item.filePath)),);
}
}, [fileList]);
return ( return (
<MellowCard <MellowCard
title="相关不良原因举证附件" title="相关不良原因举证附件"
...@@ -25,7 +44,7 @@ const FileList: React.FC<FileListProps> = ({ ...@@ -25,7 +44,7 @@ const FileList: React.FC<FileListProps> = ({
> >
<Upload <Upload
className={styles.file} className={styles.file}
fileList={fileList} fileList={innerFileList}
/> />
</MellowCard> </MellowCard>
); );
......
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