diff --git a/src/route/AppElectron/components/File/File.tsx b/src/route/AppElectron/components/File/File.tsx index b38b72a..6ca8237 100644 --- a/src/route/AppElectron/components/File/File.tsx +++ b/src/route/AppElectron/components/File/File.tsx @@ -325,6 +325,7 @@ export default function File(props: any) { // 清空上传的文件数组 setUpFileArray([]) + // 清空表单 form.resetFields(); // setCorrectionType(record.correctionType) diff --git a/src/route/TrademarkMall/TrademarkMall.tsx b/src/route/TrademarkMall/TrademarkMall.tsx index 9b897b8..058fbfe 100644 --- a/src/route/TrademarkMall/TrademarkMall.tsx +++ b/src/route/TrademarkMall/TrademarkMall.tsx @@ -81,7 +81,7 @@ export default function TrademarkMall() { // 自定义验证函数 const validateContentOrFile = (_rule: any, _value: any, callback: (error?: string) => void, form: any) => { const { upCorrectionRemark, upFile } = form.getFieldsValue(); - if (upCorrectionRemark || (upFile && Array.isArray(upFile.fileList) && upFile.fileList.length > 0)) { + if (upCorrectionRemark || upFile ) { callback(); } else { callback('内容和附件至少需要填写或上传一项'); @@ -523,6 +523,7 @@ export default function TrademarkMall() { setDetailData(res) if (res.correctionFiles) { await getFileTypeByIdsArray(res.correctionFiles) + } if (res.buyId) { setDisabled(true) @@ -614,11 +615,11 @@ export default function TrademarkMall() { dataIndex: 'buyId', align: 'center', width: 100, - render: (text,record) => ( + render: (text, record) => ( <> - {record.correctionReply=='0'?'未读':'待补充'} - {record.correctionReply=='0'?'已读':'已补充'} + {record.correctionReply == '0' ? '未读' : '待补充'} + {record.correctionReply == '0' ? '已读' : '已补充'} {/* {text == '4' ? '不予受理' : text == '5' ? '已受理' : text == '6' ? '已发初审公告' : text == '7' ? '部分驳回' : text == '8' ? '全部驳回' : text == '9' ? '商标注册完成' : "未知"} */} ) @@ -630,6 +631,8 @@ export default function TrademarkMall() { width: 100, render: (record: any) => ( { + setFileList([]) + setUpFileArray([]) // console.log(record); setCorrectionReply(record.correctionReply) // console.log(record.correctionId); @@ -882,10 +885,10 @@ export default function TrademarkMall() { form={form} layout="vertical" onFinish={(value) => { - const uids = upFileArray.map((file: any) => file.response.data.fileId).join(','); + // const uids = upFileArray.map((file: any) => file.response.data.fileId).join(','); // console.log('提取的 uid 字符串:', uids); submitData({ - correctionFiles: uids, + correctionFiles:value.upFile ? value.upFile : '', correctionRemark: value.upCorrectionRemark, }) @@ -966,10 +969,31 @@ export default function TrademarkMall() { { - setUpFileArray(info.fileList) + // setUpFileArray(info.fileList) // console.log(info.fileList); + const { fileList } = info; + const newFileArray = fileList.map((file) => { + if (file.status === 'done' && file.response) { + return { + uid: file.response.data.fileId, + name: file.response.data.fileName, + status: 'done', + url: showImage(file.response.data.fileId, false) + }; + } + return file; + }); + setUpFileArray(newFileArray); + // console.log(newFileArray); + const uids = newFileArray.map((file: any) => file.uid).join(','); + // console.log(uids); + + // 给form 赋值 + form.setFieldsValue({ + upFile: uids, + }) }} headers={{ 'Auth': `Bearer ${token}` }}