浏览代码

问题修改

1178232204@qq.com 3 年之前
父节点
当前提交
ab9cb4e125

+ 1 - 1
src/components/BlockLossManage/editBlock.js

@@ -110,7 +110,7 @@ function EditBlock(props) {
         })
     }
     function cancel() {
-        props.userChange()
+        props.cancel()
     }
     return (
         <>

+ 1 - 1
src/components/BlockLossManage/index.js

@@ -379,7 +379,7 @@ function BlockLossManage() {
                     maskClosable={false}
                 >
                     <BlockContext.Provider value={{ blockDetail, type }}>
-                        <EditBlock userChange={userChange} />
+                        <EditBlock cancel={cancel} userChange={userChange} />
                     </BlockContext.Provider>
 
                 </Modal>

+ 6 - 4
src/components/RegularManage/addRegular.js

@@ -12,6 +12,7 @@ function EditBlock(props) {
     }, []);
     const [form] = Form.useForm();
     const [visible, setVisible] = useState(false);
+    const [data, setData] = useState(false);
     const { regularDetail, type, flag } = useContext(RegularContext);
     const initialValues = regularDetail;
     const onFinish = values => {
@@ -19,19 +20,20 @@ function EditBlock(props) {
         if (flag == 1) {
             setVisible(true)
         } else {
-            addRegular(values)
+            addRegular()
         }
+        setData(values)
     };
     //添加
-    function addRegular(params) {
+    function addRegular() {
         let url
         if (type == 1) {
             url = api.addRegular
         } else {
             url = api.upRegularById
-            params.id = regularDetail.id
+            data.id = regularDetail.id
         }
-        post(url, params).then((res) => {
+        post(url, data).then((res) => {
             if (res.data.code === 200) {
                 props.userChange()
                 message.success(res.data.message);