diff --git a/src/pages/Quark/components/FileUploader.tsx b/src/pages/Quark/components/FileUploader.tsx index 6a99a03..239d013 100644 --- a/src/pages/Quark/components/FileUploader.tsx +++ b/src/pages/Quark/components/FileUploader.tsx @@ -1,6 +1,6 @@ import React, { useState } from 'react'; -import { Upload, message } from 'antd'; -import { PlusOutlined } from '@ant-design/icons'; +import { Upload, message, Button } from 'antd'; +import { UploadOutlined } from '@ant-design/icons'; export interface FileUploader { title: string; @@ -33,14 +33,14 @@ const FileUploader: React.FC = ({ title, action, limitType, limitS size:null, status:'' }; - if (file.response) { - fileInfo.uid = file.response.data.id; - fileInfo.id = file.response.data.id; - fileInfo.name = file.response.data.name; - fileInfo.url = file.response.data.url; - fileInfo.size = file.response.data.size; - fileInfo.status = 'done'; - } + + fileInfo.uid = file.id; + fileInfo.id = file.id; + fileInfo.name = file.name; + fileInfo.url = file.url; + fileInfo.size = file.size; + fileInfo.status = 'done'; + fileList[key] = fileInfo; }); triggerChange({ ...fileList }); @@ -48,10 +48,7 @@ const FileUploader: React.FC = ({ title, action, limitType, limitS const uploadButton = (title:string) => { return( -
- -
{title}
-
+ ) } diff --git a/src/pages/Quark/components/FormItem.tsx b/src/pages/Quark/components/FormItem.tsx index 97075f7..6226b0a 100644 --- a/src/pages/Quark/components/FormItem.tsx +++ b/src/pages/Quark/components/FormItem.tsx @@ -13,7 +13,7 @@ import { ProFormDateRangePicker, ProFormDateTimeRangePicker } from '@ant-design/pro-form'; -import { createFromIconfontCN,MinusCircleOutlined,PlusOutlined } from '@ant-design/icons'; +import { createFromIconfontCN,PlusOutlined } from '@ant-design/icons'; import { Tree, Form, @@ -26,8 +26,7 @@ import { InputNumber, Checkbox, Radio, - Switch, - Divider + Switch } from 'antd'; import locale from 'antd/es/date-picker/locale/zh_CN'; @@ -317,6 +316,7 @@ const FormItem: React.FC = (props:any) => { component = = ({ title, action, limitType, limi size:null, status:'' }; - if (file.response) { - fileInfo.uid = file.response.data.id; - fileInfo.id = file.response.data.id; - fileInfo.name = file.response.data.name; - fileInfo.url = file.response.data.url; - fileInfo.size = file.response.data.size; - fileInfo.status = 'done'; - } + + fileInfo.uid = file.id; + fileInfo.id = file.id; + fileInfo.name = file.name; + fileInfo.url = file.url; + fileInfo.size = file.size; + fileInfo.status = 'done'; + fileList[key] = fileInfo; }); triggerChange({ ...fileList }); @@ -149,7 +149,6 @@ const ImageUploader: React.FC = ({ title, action, limitType, limi return false; } }); - // 重组数据 fileList = fileList.map((file: any,key: number) => { if (file.response) { @@ -160,7 +159,6 @@ const ImageUploader: React.FC = ({ title, action, limitType, limi } return file; }); - onFileListChange(fileList); }} >