|
|
@@ -1,4 +1,4 @@
|
|
|
-import React from 'react'
|
|
|
+import React, { useRef } from 'react'
|
|
|
import { Button, Form, message } from 'antd'
|
|
|
import {
|
|
|
ModalForm,
|
|
|
@@ -21,6 +21,7 @@ export const mediaType = {
|
|
|
|
|
|
const AddMessage = props => {
|
|
|
const { onConfirm } = props
|
|
|
+ const formRef = useRef(null)
|
|
|
const handleFormValues = values => {
|
|
|
const newValues = { ...values }
|
|
|
switch (values.msgType) {
|
|
|
@@ -47,6 +48,7 @@ const AddMessage = props => {
|
|
|
<ModalForm
|
|
|
isKeyPressSubmit={false}
|
|
|
key="modalForm"
|
|
|
+ formRef={formRef}
|
|
|
trigger={
|
|
|
<Button type="primary">
|
|
|
<Plus className="mr-1" />
|
|
|
@@ -58,6 +60,7 @@ const AddMessage = props => {
|
|
|
try {
|
|
|
const nValues = handleFormValues(values)
|
|
|
await onConfirm(nValues)
|
|
|
+ formRef.current?.resetFields()
|
|
|
message.success('添加成功')
|
|
|
return true
|
|
|
} catch (error) {
|