import React from 'react'; import { Form, Table, Spin, message, Modal, Button, Select } from 'antd'; import ajax from 'jquery/src/ajax/xhr.js'; import $ from 'jquery/src/ajax'; const Detail = React.createClass({ getInitialState() { return { visible: false, loading: false, dataSource: [], gdataSource: [], columns: [ { title: '业务名称', dataIndex: 'businessProjectName', key: 'businessProjectName', }, { title: '签单时间', dataIndex: 'lockTime', key: 'lockTime', }, { title: '营销员', dataIndex: 'salesmanName', key: 'salesmanName', } ], gcolumns: [ { title: '限定项目', dataIndex: 'projectName', key: 'projectName', }, { title: '状态', dataIndex: 'type', key: 'type', render: (text) => {["公共", "私有", "签单"][text]} }, { title: '营销员', dataIndex: 'adminName', key: 'adminName', }, { title: '操作', dataIndex: 'op', key: 'op', render: (text, record) => (record.type == 0 && this.props.data.shareType == 2) && }, ], followList: [ { key: "已发项目介绍资料", value: 0 }, { key: "已约面谈", value: 1 }, { key: "已发合同计划书", value: 2 }, { key: "已报价", value: 3 }, { key: "已发合同", value: 4 }, { key: "已签合同", value: 5 }, { key: "面谈中", value: 6 }, { key: "已面签", value: 7 }, { key: "无进度", value: 8 }, ], customerList: [ { key: "新客户", value: 0 }, { key: "意向客户", value: 1 }, { key: "重点客户", value: 2 }, { key: "面谈客户", value: 3 }, { key: "签单客户", value: 4 }, { key: "被拒客户", value: 5 }, { key: "停止跟进", value: 6 }, ], followSituation: 6, customerStatus: 4, } }, loadData(data, apiUrl) { this.setState({ loading: true, }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + apiUrl, data: { uid: data.id, }, success: function (data) { let listArr = []; let thedata = data.data; if (!thedata) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; thedata = {}; return; }; for (let i = 0; i < data.data.length; i++) { let thisdata = data.data[i]; listArr.push({ id: thisdata.id, businessProjectName: thisdata.businessProjectName, salesmanName: thisdata.salesmanName, lockTime: thisdata.lockTime && thisdata.lockTime.split(' ')[0], }); }; this.setState({ dataSource: listArr, }); }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); }, gloadData(id) { this.setState({ loading: true, }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + '/api/restrict/Project/list', data: { uid: id, }, success: function (data) { let thedata = data.data; if (!thedata) { if (data.error && data.error.length) { message.warning(data.error[0].message); }; } else { this.setState({ gdataSource: thedata }) } }.bind(this), }).always(function () { this.setState({ loading: false }); }.bind(this)); }, visitCancel() { this.setState({ visitModul: false }) this.props.closeDesc(false); }, add() { if (!this.state.followSituation && this.state.followSituation != 0) { message.warning("请选择跟进进度!") return } if (!this.state.customerStatus && this.state.customerStatus != 0) { message.warning("请选择客户状态!") return } this.setState({ loading: true, }); $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/restrict/Project/add", data: { pid: this.state.pid, uid: this.state.uid, followSituation: this.state.followSituation, customerStatus: this.state.customerStatus, }, success: function (data) { if (data.error && data.error.length) { message.warning(data.error[0].message); } else { Modal.success({ title: '领取成功!', content: (
本次领取的项目为 【{this.state.pName}】 ,请在我的“客户管理-限定项目列表“查看
), }); this.setState({ visible: false, followSituation: 6, customerStatus: 4, }) this.gloadData(this.state.uid) } }.bind(this), }).always( function () { this.setState({ loading: false, }); }.bind(this) ); }, componentWillReceiveProps(nextProps) { if (nextProps.visitModul) { this.setState({ visitModul: true, uid: nextProps.data.id, }) this.loadData(nextProps.data, nextProps.detailApi); this.gloadData(nextProps.data.id) } }, render() { const FormItem = Form.Item return (
限定项目
已签业务
{ this.setState({ visible: false, followSituation: 6, customerStatus: 4, }) }} > ) } }) export default Detail;