import React from "react"; import $ from "jquery/src/ajax"; import "react-quill/dist/quill.bubble.css"; import moment from "moment"; import { Form, Icon, Button, Input, Table, message, Modal, Select, DatePicker, Popconfirm, Tooltip, } from "antd"; import SpinContainer from '../../SpinContainer'; import {companyList, getCompanyName} from "../../common/configure"; const { Option } = Select; const { TextArea } = Input; const { RangePicker } = DatePicker; //主体 const Customers = Form.create()( React.createClass({ loadData(pageNo = 1) { this.state.data = []; this.setState({ loading: true, }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/visitingCustomers/listVisitingCustomers", data: { pageNo: pageNo, pageSize: this.state.pagination.pageSize, name: this.state.name, startTime: this.state.time[0], endTime: this.state.time[1], location:this.state.locationSearch, }, success: function(data) { let theArr = []; if (!data.data || !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]; thisdata.key = i + 1; theArr.push(thisdata); } this.state.pagination.current = data.data.pageNo; this.state.pagination.total = data.data.totalCount; } this.setState({ dataSource: theArr, pagination: this.state.pagination, page: data.data.pageNo }); }.bind(this) }).always( function() { this.setState({ loading: false }); }.bind(this) ); }, getInitialState() { return { //数据类型 loading: false, visible: false, time: [], locationSearch:[], pagination: { defaultCurrent: 1, defaultPageSize: 10, showQuickJumper: true, pageSize: 10, onChange: function(page) { this.loadData(page); this.setState({ selectedRowKeys: [] }); }.bind(this), showTotal: function(total) { return "共" + total + "条数据"; } }, columns: [ { title: "序号", dataIndex: "id", key: "id" }, { title: "姓名", dataIndex: "name", key: "name" }, { title: "联系方式", dataIndex: "mobile", key: "mobile" }, { title: "提交时间", dataIndex: "createTimes", key: "createTimes" }, { title: "是否查看", dataIndex: "status", key: "status", render: text => { if (text == 0) { return "未读"; } else if (text == 1) { return "已读"; } } }, { title: "公司", dataIndex: "location", key: "location", width:150, render: r => { return( getCompanyName(r) ) } }, { title: "回复备注", dataIndex: "remark", key: "remark" }, { title: "操作", dataIndex: "aab", key: "aab", render: (text, record) => { return (
{ this.delete(record); }} okText="确认" cancelText="取消" >
); } } ], //数据列表 dataSource: [] }; }, componentWillMount() { this.loadData(); }, stopPropagation(e) { e.stopPropagation(); e.nativeEvent.stopImmediatePropagation(); }, addRemarks(record) { let status = record.status + "" this.setState({ visible: true, id: record.id, status, remark: record.remark }) }, cancel() { this.setState({ visible: false, remarks: undefined, status: [] }) }, delete(record) { this.setState({ loading: true }); $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/visitingCustomers/updateVisitingCustomers", data: { id: record.id, status: 2, remark: record.remark }, success: function(data) { let theArr = []; if (data.error && data.error.length) { message.warning(data.error[0].message); } else { message.success("删除成功!"); this.loadData(); } }.bind(this) }).always( function() { this.setState({ loading: false }); }.bind(this) ); }, tijiao() { this.setState({ loading: true }) $.ajax({ method: "post", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/visitingCustomers/updateVisitingCustomers", data: { id: this.state.id, status: this.state.status, remark: this.state.remark }, success: function(data) { let theArr = []; if (data.error && data.error.length) { message.warning(data.error[0].message); }else { this.loadData() this.cancel() message.success("提交成功!"); } }.bind(this) }).always( function() { this.setState({ loading: false }); }.bind(this) ); }, reset() { this.setState({ locationSearch: [], time: [], name: undefined, },()=>{ this.loadData() }) }, render() { const FormItem = Form.Item; return (
客户访问列表
{ this.setState({ name: e.target.value }); }} /> 提交日期: { this.setState({ time: dataString }); }} />