import React from 'react';
import {
DatePicker,
Tooltip,
Button,
AutoComplete,
Input,
Select,
Spin,
Table,
message,
Form,
Tabs,
Switch
} from 'antd';
import $ from 'jquery/src/ajax';
import moment from 'moment';
import { ShowModal, getApprovedType } from "@/tools.js";
import { } from "@/dataDic";
import ShowModalDiv from "@/showModal.jsx";
import { ChooseList } from "../../order/orderNew/chooseList";
import './index.less';
const TabPane = Tabs.TabPane;
const { RangePicker, } = DatePicker;
const Unlimited = Form.create()(React.createClass({
getInitialState() {
return {
searchValues: {},
loading: false,
exportPendingLoading: 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",
width: 110,
render: (text, record) => {
return (
{getApprovedType(text ? text.split(",").map(Number) : [], record.typeExplain)}
);
},
},
{
title: "合同编号",
dataIndex: "contractNo",
key: "contractNo",
},
{
title: '客户名称',
dataIndex: 'userName',
key: 'userName',
render: (text, record) => {
return (
{text}
);
}
},
{
title: "订单部门",
dataIndex: "depName",
key: "depName",
width: 100,
},
{
title: "订单负责人",
dataIndex: "salesmanName",
key: "salesmanName"
},
{
title: "签单日期",
dataIndex: "time",
key: "time",
},
{
title: "下单时间",
dataIndex: "createDate",
key: "createTime",
width: 80,
render: (text) => {
return
{text}
},
},
{
title: "签单金额(万元)",
dataIndex: "totalAmount",
key: "totalAmount",
render: (text) => {
return {text}
},
},
{
title: "开票金额(万元)",
dataIndex: "invoiceAmount",
key: "invoiceAmount",
render: (text) => {
return {text}
},
},
{
title: "已收款(万元)",
dataIndex: "settlementAmount",
key: "settlementAmount",
render: (text) => {
return {text}
},
},
{
title: "应收款(万元)",
dataIndex: "orderReceivables",
key: "orderReceivables",
render: (text) => {
return {text}
},
},
{
title: "欠款(万元)",
dataIndex: "orderArrears",
key: "orderArrears",
render: (text) => {
return {text}
},
},
{
title: "总成本/实付",
dataIndex: "costAmount",
key: "costAmount",
render: (text) => {
return {text}
},
},
{
title: "公出时长(时)",
dataIndex: "duration",
key: "duration",
},
],
dataSource: [],
departmentArr: [],
};
},
componentWillMount() {
// this.departmentList();
// this.selectSuperId();
this.loadData();
},
loadData(pageNo) {
const { searchValues, pagination } = this.state;
this.setState({
loading: true,
});
let datas = Object.assign(searchValues, {
pageNo: pageNo || 1,
pageSize: pagination.pageSize,
});
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/statistis/orderProject",
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)
);
},
// 部门
departmentList() {
this.setState({
loading: true,
});
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/organization/selectSuperId",
data: {},
success: function (data) {
let thedata = data.data;
let theArr = [];
if (!thedata) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
}
thedata = {};
} else {
thedata.map(function (item, index) {
theArr.push({
key: index,
name: item.name,
id: item.id,
});
});
}
this.setState({
departmentArr: theArr,
});
}.bind(this),
}).always(
function () {
this.setState({
loading: false,
});
}.bind(this)
);
},
// 项目类别
selectSuperId() {
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/admin/ProjectSize/getAllCname",
data: {
flag: 0
},
success: function (data) {
let theArr = [];
let thedata = data.data;
if (!thedata) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
}
}
for (let i = 0; i < data.data.length; i++) {
let theData = data.data[i];
theArr.push(
{theData.cname}
);
}
this.setState({
contactsOption: theArr,
contactsOptionData: data.data,
});
}.bind(this)
}).always(
);
},
changeList(arr) {
const newArr = [];
let list = this.state.columns
list.forEach((item) => {
arr.forEach((val) => {
if (val === item.title) {
newArr.push(item);
}
});
});
this.setState({
changeList: newArr,
});
},
search() {
this.loadData();
},
reset() {
this.setState({
searchValues: JSON.parse(JSON.stringify({})),
}, () => {
this.loadData();
})
},
render() {
const { searchValues } = this.state
let departmentArr = this.state.departmentArr || [];
return (
{ this.setState({ showModal: false }) }} />
无限制公出管理
);
}
}));
export default Unlimited;