张涛 1 year ago
parent
commit
97d2d7193b
1 changed files with 7 additions and 4 deletions
  1. 7
    4
      src/pages/package/components/ModalPackageItem.jsx

+ 7
- 4
src/pages/package/components/ModalPackageItem.jsx View File

31
         .then(() => {
31
         .then(() => {
32
           setOpen(false);
32
           setOpen(false);
33
           ref?.current?.reload();
33
           ref?.current?.reload();
34
+          formRef.current?.resetFields();
34
         })
35
         })
35
         .catch((e) => ref?.current?.reload());
36
         .catch((e) => ref?.current?.reload());
36
     } else {
37
     } else {
39
         .then(() => {
40
         .then(() => {
40
           setOpen(false);
41
           setOpen(false);
41
           ref?.current?.reload();
42
           ref?.current?.reload();
43
+          formRef.current?.resetFields();
42
         })
44
         })
43
         .catch((e) => ref?.current?.reload());
45
         .catch((e) => ref?.current?.reload());
44
     }
46
     }
45
   };
47
   };
46
 
48
 
47
   useEffect(() => {
49
   useEffect(() => {
48
-    formRef.current?.resetFields();
49
-
50
     if (curd != "new" && curd) {
50
     if (curd != "new" && curd) {
51
       formRef.current?.setFieldsValue(curd);
51
       formRef.current?.setFieldsValue(curd);
52
     }
52
     }
65
       })
65
       })
66
       .catch((err) => {});
66
       .catch((err) => {});
67
   }, []);
67
   }, []);
68
-
68
+  const onCancel = () => {
69
+    setOpen(false);
70
+    formRef.current?.resetFields();
71
+  };
69
   return (
72
   return (
70
     <Modal
73
     <Modal
71
       title="套餐内容维护"
74
       title="套餐内容维护"
72
       open={open}
75
       open={open}
73
       footer={null}
76
       footer={null}
74
       maskClosable={false}
77
       maskClosable={false}
75
-      onCancel={() => setOpen(false)}
78
+      onCancel={onCancel}
76
     >
79
     >
77
       <ProForm
80
       <ProForm
78
         {...formItemLayout}
81
         {...formItemLayout}