主页
import React from 'react';
import {
connect } from 'dva';
import {
Breadcrumb, Table, Divider, Row, Col, DatePicker, Button, Form ,Popconfirm} from 'antd';
import router from 'umi/router';
import moment from 'moment';
@connect(({
add }) => ({
add
}))
@Form.create()
class Once extends React.Component {
constructor(props) {
super(props);
this.state = {
pagination: {
pageSize: 10,
pageNumber: 1,
},
list: []
}
}
componentDidMount() {
this.query();
}
pageNumChange = ({
pageSize, current }) => {
const pagination = this.state.pagination;
pagination.pageSize = pageSize;
pagination.pageNumber = current;
this.setState({
pagination
})
this.query({
pageSize, pageNumber: current })
}
query = (page) => {
console.log(page, "查询");
let values = this.props.form.getFieldsValue().yearMonth;
let yearMonth = moment(values).format('YYYY-MM');
console.log(yearMonth, values)
let data = {
yearMonth:values?yearMonth:"",
pageSize: 10,
pageNumber: 1,
status: ''
}
if (page) {
data = {
...data, ...page }
}
const {
dispatch } = this.props;
dispatch({
type: 'add/Add',
payload: {
...data
},
}).then((res) => {
console.log(res , res,"活动经费申请res")
if (res.code == "0" && res.message == "请求成功!") {
const pagination = this.state.pagination;
pagination.pageNumber = res.data.pageNumber;
pagination.pageSize = res.data.pageSize;
pagination.current = res.data.pageNumber;
console.log(res.data.list, "我是数据")
if (!res.data.list[0]&&pagination.pageNumber!==1) {
pagination.current = pagination.current - 1;
this.query({
pageSize:pagination.pageSize,pageNumber:pagination.current})
}
console.log(pagination.current, "我是当前页数")
pagination.total = res.data.totalRow;
this.setState({
list: res.data.list,
pagination
})
} else {
alert("请求失败")
}
})
}
details = (record) => {
const {
dispatch } = this.props;
dispatch({
type: 'add/Detalis',
payload: {
id: record.id
},
}).then((res) => {
if (res.code == 0 && res.message == "请求成功!") {
router.push('/manage/details', res.data);
} else {
}
})
}
delete = (record) => {
const {
dispatch } = this.props;
dispatch({
type: 'add/Button',
payload: {
id: record.id,
actionType: 5,
},
}).then((res) => {
const {
pageSize, pageNumber } = this.state.pagination;
this.query({
pageSize, pageNumber });
})
}
withdraw=(record)=>{
const {
dispatch } = this.props;
dispatch({
type: 'add/Button',
payload