import React from 'react';
import { Icon, Button, Input, Select, Spin, Table, DatePicker, message, Cascader, Switch, Modal } from 'antd';
import { contractStateList, contractTypeList } from '../../../dataDic.js';
import { getTime, companySearch, getContractState, getContractType, getSearchUrl } from '../../../tools.js';
import ajax from 'jquery/src/ajax/xhr.js';
import $ from 'jquery/src/ajax';
import ContractAdd from './contractAdd.jsx';
import ContractDetail from './contractDetail.jsx';
import moment from 'moment';
import './contract.less';
const Contract = React.createClass({
loadData(pageNo) {
this.setState({
loading: true
});
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/user/contract/list",
data: {
pageNo: pageNo || 1,
pageSize: this.state.pagination.pageSize,
type: this.state.contractType,
status: this.state.contractState,
serialNumber: this.state.serialNumber,
startDateFormattedDate: this.state.startDateFormattedDate[0],
endDateFormattedDate: this.state.startDateFormattedDate[1],
completeStartDate: this.state.endDateFormattedDate[0],
completeEndDate: this.state.endDateFormattedDate[1]
},
success: function (data) {
let theArr = [];
if (!data.data || !data.data.list) {
if (data.error && data.error.length) {
message.warning(data.error[0].message);
};
return;
};
for (let i = 0; i < data.data.list.length; i++) {
let thisdata = data.data.list[i];
theArr.push({
key: i,
id: thisdata.id,
uid: thisdata.uid,
contacts: thisdata.contacts,
serialNumber: thisdata.serialNumber,
type: thisdata.type,
signDate: thisdata.signDate,
depict: thisdata.depict,
status: thisdata.status,
completeDate: thisdata.completeDate,
signDateFormattedDate: thisdata.signDateFormattedDate,
completeDateFormattedDate: thisdata.completeDateFormattedDate
});
};
this.state.pagination.defaultCurrent = data.data.pageNo;
this.state.pagination.total = data.data.totalCount;
this.setState({
dataSource: theArr,
pagination: this.state.pagination
});
}.bind(this),
}).always(function () {
this.setState({
loading: false
});
}.bind(this));
},
getContactsList() {
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context + "/api/user/cognizance/getContacts",
success: function (data) {
let theOption = [];
if (data.error.length || !data.data) {
return;
};
for (let item in data.data) {
let theData = data.data[item];
theOption.push(