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 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 Document from 'react-document-title';
import moment from 'moment' import moment from 'moment'
import axios from 'axios' import axios from 'axios'
...@@ -10,35 +10,40 @@ const Receive = (props) => { ...@@ -10,35 +10,40 @@ const Receive = (props) => {
const {id} = props.match.params; const {id} = props.match.params;
const {getFieldProps} = props.form; const {getFieldProps} = props.form;
const [defaultV, setDefaultV] = useState({}); const [defaultV, setDefaultV] = useState({});
useEffect(() => { const [loading, setLoading] = useState(false);
const getListItem = () => {
axios({ axios({
method: 'get', method: 'get',
url: `/demo/leaveForm/${id}`, url: `/demo/leaveForm/${id}`,
data: {}, data: {},
withCredentials: false, withCredentials: false,
}).then(res => { }).then(res => {
console.log(res.data) res.data.data.result && setDefaultV(res.data.data.result)
setDefaultV(res.data.data.result)
}) })
};
useEffect(() => {
getListItem()
}, []); }, []);
const onSubmit = () => { const onSubmit = () => {
props.form.validateFields({ force: true }, (error) => { props.form.validateFields({ force: true }, (error) => {
const values = props.form.getFieldsValue(); const values = props.form.getFieldsValue();
if (!error) { if (!error) {
console.log(values); setLoading(true);
axios({ axios({
method: 'patch', method: 'patch',
url: `/demo/reviewAndApproval`, url: `/demo/reviewAndApproval`,
params: {status: values.status[0], id}, params: {status: values.status[0], id},
withCredentials: false, withCredentials: false,
}).then(res => { }).then(res => {
res.data.data.result && Toast.success('审核成功') setLoading(false);
res.data.data.result && Toast.success('审核成功', 1, () => {
getListItem()
})
}) })
} }
}); });
}; };
console.log(defaultV)
return ( return (
<Document title="请假审批"> <Document title="请假审批">
...@@ -63,6 +68,13 @@ const Receive = (props) => { ...@@ -63,6 +68,13 @@ const Receive = (props) => {
<div className="event-footer-button" onClick={onSubmit}>提交</div> <div className="event-footer-button" onClick={onSubmit}>提交</div>
</div> </div>
)} )}
{loading && (
<ActivityIndicator
toast
text="提交中..."
animating={loading}
/>
)}
</WingBlank> </WingBlank>
</Document> </Document>
......
import React, {useState} from 'react'; 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 Document from 'react-document-title';
import moment from 'moment' import moment from 'moment'
import axios from 'axios' import axios from 'axios'
...@@ -14,18 +14,20 @@ const Send = (props) => { ...@@ -14,18 +14,20 @@ const Send = (props) => {
const onSubmit = () => { const onSubmit = () => {
props.form.validateFields({ force: true }, (error) => { props.form.validateFields({ force: true }, (error) => {
const values = props.form.getFieldsValue();
const keys = Object.keys(values);
keys.map(item => {
!values[item] && (delete values[item]);
Array.isArray(values[item]) && values[item].length === 1 && (values[item] = values[item][0]);
values[item] instanceof Date && ( values[item] = moment(values[item]).valueOf());
return null;
});
if (!error) { if (!error) {
const values = props.form.getFieldsValue();
const keys = Object.keys(values);
keys.map(item => {
!values[item] && (delete values[item]);
Array.isArray(values[item]) && values[item].length === 1 && (values[item] = values[item][0]);
values[item] instanceof Date && ( values[item] = moment(values[item]).valueOf());
return null;
});
setLoading(true);
values.toUid = sP.value; values.toUid = sP.value;
values.uid = 'cgcPcPoo'; values.uid = 'cgcPcPoo';
axios.patch('/demo/initiateApproval', values).then(res => { axios.patch('/demo/initiateApproval', values).then(res => {
setLoading(false);
res.data.success && Toast.success('提交成功') res.data.success && Toast.success('提交成功')
}) })
} }
...@@ -33,6 +35,7 @@ const Send = (props) => { ...@@ -33,6 +35,7 @@ const Send = (props) => {
}; };
const [sP, setSP] = useState({}); const [sP, setSP] = useState({});
const [personVisible, setPersonVisible] = useState(false); const [personVisible, setPersonVisible] = useState(false);
const [loading, setLoading] = useState(false);
return ( return (
<Document title="请假申请"> <Document title="请假申请">
<WingBlank> <WingBlank>
...@@ -65,6 +68,13 @@ const Send = (props) => { ...@@ -65,6 +68,13 @@ const Send = (props) => {
<div className="event-footer"> <div className="event-footer">
<div className="event-footer-button" onClick={onSubmit}>提交</div> <div className="event-footer-button" onClick={onSubmit}>提交</div>
</div> </div>
{loading && (
<ActivityIndicator
toast
text="提交中..."
animating={loading}
/>
)}
</WingBlank> </WingBlank>
</Document> </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