import React from 'react'; import { Icon, Table, Modal, message, Spin, Input, Select, Button, Form ,Upload,Popconfirm,AutoComplete} from 'antd'; import ajax from 'jquery/src/ajax/xhr.js'; import $ from 'jquery/src/ajax'; import '../userMangagement.less'; import {lvl} from '../../../../dataDic.js'; const MySettlementDetaile = Form.create()(React.createClass({ loadData() { this.setState({ loading: true }); $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/admin/roles', data: { }, success: function (data) { let theArr =[]; if (!data.data) { 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; theArr.push({ key:i, roleName5:thisdata[i].id }); }; } this.setState({ dataSource: theArr, pagination: false, }); }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); }, getInitialState() { return { loading: false, visible: false, contractState:false, projectVisible:false, orgCodeUrl:[], checkedKeys: [], columns: [ { title: '业务项目名称', dataIndex: 'roleName', key: 'roleName' }, { title: '项目类别', dataIndex: 'creater1', key: 'creater1' },{ title: '项目数量', dataIndex: 'roleName2', key: 'roleName2' }, { title: '下单时间', dataIndex: 'creater4', key: 'creater4' }, { title: '项目说明', dataIndex: 'roleName5', key: 'roleName5', render:(text) => { return( text?text.substr(0,6)+'...':'' ) } } ] }; }, //查看基本详情基本信息 loaduser(record){ if(record){ $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/admin/role/rolePermission', data: { id: record.id }, success: function (data) { let thisData = data.data; if (!thisData) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; thisData = {}; }; this.setState({ ids:record.id, roleName:thisData[0].rname, }); }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); } }, //订单编辑保存 handleOk(e) { this.setState({ visible: false, }); this.props.closeDesc(false, true); }, handleCancel(e) { this.setState({ visible: false, }); this.props.closeDesc(false); }, //新建项目 projectOk(e) { this.setState({ projectVisible: false, }); this.props.closeDesc(false, true); }, projectCancel(e) { this.setState({ projectVisible: false, }); this.props.closeDesc(false); }, componentWillMount() { }, nextCancel() { this.setState({ addnextVisible: false }) }, //查看订单明细 orderDetails(record){ if(record){ $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/admin/role/rolePermission', data: { id: record.id }, success: function (data) { let thisData = data.data; if (!thisData) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; thisData = {}; }; let idList=[]; thisData.map(function(item){ idList.push( item.pid ) }) this.setState({ ids:record.id, }); }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); } }, //创建项目保存 admissibleOrder(){ if(this.state.Names==''||this.state.Names==null){ message.warning('请输入客户名称'); this.refs.Names.focus() return false; }; if(this.state.projectType==undefined){ message.warning('请选择项目类型'); return false; }; if(this.state.pName==''||this.state.pName==null){ message.warning('请输入项目负责人'); this.refs.pName.focus() return false; }; this.setState({ loading: true }); $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/xinjianbaocun', data: { } }).done(function(data) { this.setState({ loading: false }); if(!data.error.length) { message.success('保存成功!'); this.projectOk() } else { message.warning(data.error[0].message); } }.bind(this)); }, //编辑订单保存 handleSubmit(e) { e.preventDefault(); this.props.form.validateFields((err, values) => { if(!err) { this.setState({ loading: true }); $.ajax({ method: "POST", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/000', data: { id:this.props.datauser.id } }).done(function(data) { this.setState({ loading: false }); if(!data.error.length) { message.success('保存成功!'); this.handleOk() } else { message.warning(data.error[0].message); } }.bind(this)); } }); }, tableRowClick(record, index) { this.setState({ addnextVisible:true, }); this.orderDetails(record) }, componentWillReceiveProps(nextProps) { //props改变时触发 this.state.projectVisible = nextProps.newProject; this.state.visible = nextProps.showDesc; if(nextProps.userDetaile && nextProps.showDesc ) { if(nextProps.datauser && nextProps.datauser.id ) { this.loaduser(nextProps.datauser); this.loadData(); } } }, render() { const FormItem = Form.Item const formItemLayout = { labelCol: { span: 8 }, wrapperCol: { span: 14 }, }; const orderDetaiel=this.state.orderList || []; return(