diff --git a/src/components/AttachmentUpload.vue b/src/components/AttachmentUpload.vue index 0b49812..77c66a6 100644 --- a/src/components/AttachmentUpload.vue +++ b/src/components/AttachmentUpload.vue @@ -72,8 +72,9 @@ const tableConfig = reactive({ ] }) const rules = reactive({ - attachment: [{required: true, message: '请上传附件', trigger: 'blur'}], + attachment: [{required: true, message: '请上传附件', trigger: ['blur','change']}], }) +const applyForm=ref() const props = defineProps({ showFileList: { type: Boolean, @@ -117,7 +118,7 @@ const deleteOtherFile = (row) => { deleteFile(row.fileId).then(res => { if (res.code === 1000) { ElMessage.success("删除成功"); - otherFileList.value.splice(otherFileList.value.findIndex((item) => item.id === row.fileId), 1); + props.otherFileList.splice(props.otherFileList.findIndex((item) => item.id === row.fileId), 1); } }); }).catch(() => { @@ -133,6 +134,14 @@ const handleDownload = (row) => { a.click() }) } +defineExpose({ + validate(){ + return applyForm.value.validate() + }, + clearValidate(){ + return applyForm.value.clearValidate() + } +})