Commit 239ecde8 authored by 熊成伟's avatar 熊成伟

debug

parent 7b2f71fc
Pipeline #16610 passed with stages
in 1 minute and 6 seconds
import React, {useEffect, useState} from 'react';
import {WingBlank, List, InputItem, WhiteSpace, Picker, Toast} from 'antd-mobile'
import {WingBlank, List, InputItem, WhiteSpace, Picker, Toast, ActivityIndicator} from 'antd-mobile'
import Document from 'react-document-title';
import moment from 'moment'
import axios from 'axios'
......@@ -10,35 +10,40 @@ const Receive = (props) => {
const {id} = props.match.params;
const {getFieldProps} = props.form;
const [defaultV, setDefaultV] = useState({});
useEffect(() => {
const [loading, setLoading] = useState(false);
const getListItem = () => {
axios({
method: 'get',
url: `/demo/leaveForm/${id}`,
data: {},
withCredentials: false,
}).then(res => {
console.log(res.data)
setDefaultV(res.data.data.result)
res.data.data.result && setDefaultV(res.data.data.result)
})
};
useEffect(() => {
getListItem()
}, []);
const onSubmit = () => {
props.form.validateFields({ force: true }, (error) => {
const values = props.form.getFieldsValue();
if (!error) {
console.log(values);
setLoading(true);
axios({
method: 'patch',
url: `/demo/reviewAndApproval`,
params: {status: values.status[0], id},
withCredentials: false,
}).then(res => {
res.data.data.result && Toast.success('审核成功')
setLoading(false);
res.data.data.result && Toast.success('审核成功', 1, () => {
getListItem()
})
})
}
});
};
console.log(defaultV)
return (
<Document title="请假审批">
......@@ -63,6 +68,13 @@ const Receive = (props) => {
<div className="event-footer-button" onClick={onSubmit}>提交</div>
</div>
)}
{loading && (
<ActivityIndicator
toast
text="提交中..."
animating={loading}
/>
)}
</WingBlank>
</Document>
......
import React, {useState} from 'react';
import {WingBlank, List, InputItem, WhiteSpace, DatePicker, Toast} from 'antd-mobile'
import {WingBlank, List, InputItem, WhiteSpace, DatePicker, Toast, ActivityIndicator} from 'antd-mobile'
import Document from 'react-document-title';
import moment from 'moment'
import axios from 'axios'
......@@ -14,6 +14,7 @@ const Send = (props) => {
const onSubmit = () => {
props.form.validateFields({ force: true }, (error) => {
if (!error) {
const values = props.form.getFieldsValue();
const keys = Object.keys(values);
keys.map(item => {
......@@ -22,10 +23,11 @@ const Send = (props) => {
values[item] instanceof Date && ( values[item] = moment(values[item]).valueOf());
return null;
});
if (!error) {
setLoading(true);
values.toUid = sP.value;
values.uid = 'cgcPcPoo';
axios.patch('/demo/initiateApproval', values).then(res => {
setLoading(false);
res.data.success && Toast.success('提交成功')
})
}
......@@ -33,6 +35,7 @@ const Send = (props) => {
};
const [sP, setSP] = useState({});
const [personVisible, setPersonVisible] = useState(false);
const [loading, setLoading] = useState(false);
return (
<Document title="请假申请">
<WingBlank>
......@@ -65,6 +68,13 @@ const Send = (props) => {
<div className="event-footer">
<div className="event-footer-button" onClick={onSubmit}>提交</div>
</div>
{loading && (
<ActivityIndicator
toast
text="提交中..."
animating={loading}
/>
)}
</WingBlank>
</Document>
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment