import React from "react";
import $ from "jquery/src/ajax";
import moment from "moment";
import {
Button,
Form,
Input,
Spin,
Table,
Select,
message,
Tabs,
Tag,
Tooltip,
DatePicker,
Modal,
} from "antd";
import { ShowModal } from "@/tools";
import { ChooseList } from "../../order/orderNew/chooseList";
import ShowModalDiv from "@/showModal.jsx";
import { clockState, salesList, accountType, accountStatus } from "@/dataDic";
const FormItem = Form.Item;
const { RangePicker } = DatePicker;
const { TabPane } = Tabs;
const AccountReview = React.createClass({
getInitialState() {
return {
searchValues: {}, // 列表筛选条件
loading: false, //加载动画
changeList: undefined, // 更改后的表格显示数据
dataSource: [], // 列表数据
pagination: {
defaultCurrent: 1,
defaultPageSize: 10,
showQuickJumper: true,
pageSize: 10,
onChange: function (page) {
this.loadData(page);
}.bind(this),
showTotal: function (total) {
return "共" + total + "条数据";
},
},
columns: [
{
title: "类型",
dataIndex: "type",
key: "type",
render: (text, record) => {
return (
{accountType.find(item => item.value === text).label}
);
},
},
{
title: "报销金额",
dataIndex: "totalAmount",
key: "totalAmount",
},
{
title: "报销至订单",
dataIndex: "orderName",
key: "orderName",
render: (text, record) => {
return (
{text || ""}
{record.contractNo || ""}
);
},
},
{
title: "报销至部门",
dataIndex: "appDepName",
key: "appDepName",
},
{
title: "报销人",
dataIndex: "aname",
key: "aname",
},
{
title: "财务负责人",
dataIndex: "financeName",
key: "financeName",
},
{
title: "状态",
dataIndex: "status",
key: "status",
render: (text, record) => {
return (
{accountStatus[text].label}
);
},
},
{
title: "报销公司/支付公司",
dataIndex: "payDepName",
key: "payDepName",
render: (text, record) => {
return (
{record.appDepName || ""}
{text || ""}
);
},
},
{
title: "报销时间",
dataIndex: "createTimeStr",
key: "createTimeStr",
},
],
};
},
componentWillMount() {
this.loadData();
},
// 列表接口
loadData(pageNo) {
const { searchValues, pagination } = this.state;
this.setState({
loading: true,
});
let datas = Object.assign(searchValues, {
pageNo: pageNo || 1,
pageSize: pagination.pageSize,
processStatus: 1,
});
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/expenseAccount/pageList",
data: datas,
success: function (data) {
ShowModal(this);
this.setState({
loading: false,
});
if (data.error && data.error.length === 0) {
if (data.data.list) {
pagination.current = data.data.pageNo;
pagination.total = data.data.totalCount;
if (data.data && data.data.list && !data.data.list.length) {
pagination.current = 0;
pagination.total = 0;
}
this.setState({
dataSource: data.data.list,
pagination: this.state.pagination,
pageNo: data.data.pageNo,
});
} else {
this.setState({
dataSource: data.data,
pagination: false,
});
}
} else {
message.warning(data.error[0].message);
}
}.bind(this),
}).always(
function () {
this.setState({
loading: false,
});
}.bind(this)
);
},
// 搜索
search() {
this.loadData();
},
// 重置
reset() {
this.setState({
searchValues: JSON.parse(JSON.stringify({})),
}, () => {
this.loadData();
})
},
changeList(arr) {
const newArr = [];
this.state.columns.forEach((item) => {
arr.forEach((val) => {
if (val === item.title) {
newArr.push(item);
}
});
});
this.setState({
changeList: newArr,
});
},
render() {
const { searchValues } = this.state
return (
报销审核
报销时间:
{
this.setState({
searchValues: Object.assign(searchValues, {
startTime: dataString[0],
endTime: dataString[1],
}),
});
}}
/>
{/* 驳回备注 */}
);
},
});
export default AccountReview;