import React from 'react';
import { Radio, Icon, Button, AutoComplete,Cascader,Input, Select, Spin, Popconfirm, Table, Switch, message,Calendar , DatePicker, Upload, Form ,Modal,Tabs,Card ,Col} from 'antd';
import ajax from 'jquery/src/ajax/xhr.js';
import $ from 'jquery/src/ajax';
import Jquery from 'jquery/dist/jquery.js';
import moment from 'moment';
import {boutique } from '@/dataDic.js';
import { getLiquidationStatus,getApprovedState,getProcessStatus,splitUrl,getjiedian,getboutique,getNewOrderStatus,getProjectStatus} from '@/tools.js';
const TabPane = Tabs.TabPane;
const Dragger = Upload.Dragger;
//图片组件
const PicturesWall = React.createClass({
getInitialState() {
return {
previewVisible: false,
previewImage: '',
fileList: [],
}
},
handleCancel() {
this.setState({
previewVisible: false
})
},
handlePreview(file) {
this.setState({
previewImage: file.url || file.thumbUrl,
previewVisible: true,
});
},
handleChange(info) {
let fileList = info.fileList;
this.setState({
fileList
});
this.props.fileList(fileList);
},
componentWillReceiveProps(nextProps) {
this.state.fileList = nextProps.pictureUrl;
this.state.pojectApplicationUrl = undefined;
},
render() {
const {
previewVisible,
previewImage,
fileList
} = this.state;
const uploadButton = (
);
return(
{fileList.length >= 1 ? null : uploadButton}
);
}
});
const IntentionCustomer = Form.create()(React.createClass({
loadData(pageNo, apiUrl) {
this.setState({
visitModul:false,
loading: true,
ispage:pageNo,
modalVisible:false
});
$.ajax({
method: "get",
dataType: "json",
crossDomain: false,
url: globalConfig.context +"/api/admin/orderProject/taskHoursList",
data: {
pageNo: pageNo || 1,
pageSize: this.state.pagination.pageSize,
name: this.state.customerName,//名称
taskId: this.state.orderNo,//订单编号
starTime: this.state.releaseDate[0],//开始时间
endTime: this.state.releaseDate[1],//结束时间
},
success: function(data) {
let theArr = [];
if(data.error.length || data.data.list == "") {
if(data.error && data.error.length) {
message.warning(data.error[0].message);
};
} else {
for(let i = 0; i < data.data.list.length; i++) {
let thisdata = data.data.list[i];
theArr.push({
key: i,
id:thisdata.id,//ID
orderNo: thisdata.orderNo,//订单编号
taskName:thisdata.taskName,//任务名称
userName:thisdata.userName,//客户名称
cname:thisdata.cname,//项目品类
taskStatus:thisdata.taskStatus,//任务状态
receiverName:thisdata.receiverName,//负责人
hours:thisdata.hours,//任务工时
depName:thisdata.depName,//派单公司
});
};
this.state.pagination.total = data.data.totalCount;
};
if(data.data&&data.data.list&&!data.data.list.length){
this.state.pagination.total=0
}
this.setState({
dataSource: theArr,
pageNo: pageNo,
pagination: this.state.pagination,
selectedRowKeys:[]
});
}.bind(this),
}).always(function() {
this.setState({
loading: false
});
}.bind(this));
},
getInitialState() {
return {
page:1,
releaseDate: [],
selectedRowKeys: [],
orgCodeUrl:[],
paginations:false,
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: 'id',
key: 'id'
},{
title: '任务名称',
dataIndex: 'taskName',
key: 'taskName'
},{
title: '订单编号',
dataIndex: 'orderNo',
key: 'orderNo'
}, {
title: '业务类别',
dataIndex: 'cname',
key: 'cname'
},{
title: '客户名称',
dataIndex: 'userName',
key: 'userName',
render:(text)=>{
return (text&&text.length>9?text.substr(0,9)+'...':text)
}
},{
title: '任务负责人',
dataIndex: 'receiverName',
key: 'receiverName'
},{
title: '派单公司',
dataIndex: 'depName',
key: 'depName'
},{
title: '任务状态',
dataIndex: 'taskStatus',
key: 'taskStatus',
render:text=>{return getNewOrderStatus(text)}
}, {
title: '工时',
dataIndex: 'hours',
key: 'hours'
}
],
data: [],
dataSource: [],
columnsX: [
{
title: '催款人',
dataIndex: 'dumBy',
key: 'dumBy'
}, {
title: '催款时间',
dataIndex: 'dumTime',
key: 'dumTime',
},{
title: '催款情况',
dataIndex: 'remarks',
key: 'remarks'
}
],
dataSources: [],
}
},
//页面加载函数
componentWillMount() {
this.loadData();
},
// //整行点击
tableRowClick(record, index) {
this.setState({
visibles:true,
});
this.loadDatas(record.id);
},
//关闭输入理由框
noCancel(){
this.setState({
noVisible:false
})
},
//搜索
search() {
this.setState({
//signBillVisible:false
})
this.loadData();
},
//重置
reset() {
this.setState({
signBillVisible:false
})
this.state.orderNo='';
this.state.customerName='';
this.state.releaseDate[0] = undefined;
this.state.releaseDate[1] = undefined;
this.loadData(this.state.page);
},
resets(){
this.state.orderNo='';
this.state.customerName='';
this.state.releaseDate[0] = undefined;
this.state.releaseDate[1] = undefined;
},
getOrgCodeUrl(e) {
this.setState({ orgCodeUrl: e });
},
//关闭详情
visitCancel(e){
this.setState({
visible:false
})
this.resets();
},
visitOk(e){
this.setState({
visible:false
})
this.resets();
},
//关闭详情
visitCancels(e){
this.setState({
visibles:false
})
this.resets();
},
//导出
exportExec(){
var data = {
name: this.state.customerName?this.state.customerName:undefined,//订单负责人
taskId: this.state.orderNo?this.state.orderNo:undefined,//订单编号
starTime: this.state.releaseDate[0]?this.state.releaseDate[0]:undefined,
endTime: this.state.releaseDate[1]?this.state.releaseDate[1]:undefined,
}
window.location.href=(globalConfig.context+'/api/admin/orderProject/exportTaskHoursListData?'+$.param(data));
},
visitOks(e){
this.setState({
visibles:false
})
this.resets();
},
render() {
const formItemLayout = {
labelCol: { span: 8 },
wrapperCol: { span: 14 },
};
const FormItem = Form.Item;
const { RangePicker } = DatePicker;
const rowSelection = {
selectedRowKeys: this.state.selectedRowKeys,
onChange: (selectedRowKeys, selectedRows) => {
this.setState({
modalVisible:false,
selectedRows: selectedRows.slice(-1),
selectedRowKeys: selectedRowKeys.slice(-1)
});
},
onSelect: (recordt, selected, selectedRows) => {
this.setState({
modalVisible:false,
recordt: recordt.id
})
},
};
const hasSelected = this.state.selectedRowKeys.length > 0;
return(
);
}
}));
export default IntentionCustomer;