|
@@ -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);
|