import React, { Component } from "react"; import { AutoComplete, Button, DatePicker, Input, message, Modal, Select, Spin, Table, Tabs, Tag, Tooltip, } from "antd"; import { ShowModal, splitUrl, getClockState } from "@/tools"; import { ChooseList } from "../../order/orderNew/chooseList"; import $ from "jquery/src/ajax"; import "./index.less"; import moment from "moment"; const { TabPane } = Tabs; const { RangePicker } = DatePicker; class PublicSummary extends Component { constructor(props) { super(props); this.state = { pageNo: 1, loading: false, changeList: undefined, selectedRowKeys: [], columns: [ { title: "客户名称", dataIndex: "nickname", key: "nickname", width: 150, // fixed: "left", render: (text) => { return (
{text}
); }, }, { title: "标签", dataIndex: "status", key: "status", width: 200, render: (text, record) => (
{ record.type === 0 ? "业务公出" : record.type === 1 ? "技术公出" : record.type === 2 ? "行政公出" : record.type === 3 ? "技术协单" : record.type === 4 ? "协单助手" : "" } {getClockState(text).title} {record.updateStatus == 1 && }
), }, { title: "签单次数", dataIndex: "userName", key: "userName", }, { title: "签单金额", dataIndex: "sname", key: "sname", }, { title: "首次签单时间", dataIndex: "createTimes", key: "createTimes", }, { title: "最新签单时间", dataIndex: "createTime", key: "createTime", }, { title: "最新签单类型", dataIndex: "duration", key: "duration", }, { title: "跟进人", dataIndex: "remarks", key: "remarks", }, { title: "跟进部门", dataIndex: "plan", key: "plan", }, { title: "跟进方式", dataIndex: "expectedEffect", key: "expectedEffect", }, { title: "跟进说明", dataIndex: "supplement", key: "supplement", }, { title: "次数", dataIndex: "nextPlan", key: "nextPlan", }, { title: "最新跟进时间", dataIndex: "auditInfo", key: "auditInfo", }, { title: "累计以前项目", dataIndex: "annexUrls", key: "annexUrls", }, ], pagination: { defaultCurrent: 1, defaultPageSize: 10, showQuickJumper: true, pageSize: 10, onChange: function (page) { this.loadData(page); }.bind(this), showTotal: function (total) { return "共" + total + "条数据"; }, }, dataSource: [], searchInfor: {} }; this.loadData = this.loadData.bind(this); this.resetAll = this.resetAll.bind(this); this.changeList = this.changeList.bind(this); this.selectSuperId = this.selectSuperId.bind(this); this.supervisor = this.supervisor.bind(this); this.httpChange = this.httpChange.bind(this); this.blurChange = this.blurChange.bind(this); this.selectAuto = this.selectAuto.bind(this); this.getCustomer = this.getCustomer.bind(this); this.selectCustomerAuto = this.selectCustomerAuto.bind(this); this.httpCustomerChange = this.httpCustomerChange.bind(this); this.blurCustomerChange = this.blurCustomerChange.bind(this); this.exportExec = this.exportExec.bind(this); } //获取上级组织 selectSuperId() { $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/organization/selectSuperId", data: {}, success: function (data) { let theArr = []; if (data.error && data.error.length === 0) { for (let i = 0; i < data.data.length; i++) { let theData = data.data[i]; theArr.push( {theData.name} ); } this.setState({ contactsOption: theArr, }); } else { message.warning(data.error[0].message); } }.bind(this), }).always( function () { this.setState({ loading: false, }); }.bind(this) ); } changeList(arr) { const newArr = []; this.state.columns.forEach((item) => { arr.forEach((val) => { if (val === item.title) { newArr.push(item); } }); }); this.setState({ changeList: newArr, }); } loadData(pageNo) { const { searchInfor, pagination } = this.state; this.setState({ loading: true, }); let datas = Object.assign(searchInfor, { pageNo: pageNo || 1, pageSize: pagination.pageSize, }); $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/release/publicReleaseDtails", data: datas, success: function (data) { ShowModal(this); this.setState({ loading: false, }); if (data.error && data.error.length === 0) { if (data.data.list) { pagination.current = data.data.pageNo; pagination.total = data.data.totalCount; if (data.data && data.data.list && !data.data.list.length) { pagination.current = 0; pagination.total = 0; } this.setState({ dataSource: data.data.list, pagination: this.state.pagination, pageNo: data.data.pageNo, }); } else { this.setState({ dataSource: data.data, pagination: false, }); } } else { message.warning(data.error[0].message); } }.bind(this), }).always( function () { this.setState({ loading: false, }); }.bind(this) ); } resetAll() { this.setState( { searchInfor: JSON.parse(JSON.stringify({})), selectedRowKeys: [], }, () => { this.loadData(); } ); } supervisor(e) { $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/customer/listAdminByName", data: { adminName: e, status: "2", }, success: function (data) { if (data.error && data.error.length === 0) { this.setState({ customerArr: data.data, }); } else { message.warning(data.error[0].message); } }.bind(this), }).always(function () { }.bind(this)); } httpChange(e) { if (e.length >= 1) { this.supervisor(e); } this.setState({ auto: e, }); } selectAuto(value, options) { this.setState({ auto: value, }); } httpCustomerChange(e) { if (e.length >= 1) { this.getCustomer(e); } this.setState({ customer: e, }); } selectCustomerAuto(value, options) { this.setState({ customer: value, }); } getCustomer(e) { $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/customer/getUserByName", data: { name: e, }, success: function (data) { if (data.error && data.error.length === 0) { this.setState({ customerList: data.data, }); } else { message.warning(data.error[0].message); } }.bind(this), }).always(function () { }.bind(this)); } blurCustomerChange(e) { let theType = ""; let contactLists = this.state.customerList || []; if (e) { contactLists.map(function (item) { if (item.name == e.toString()) { theType = item.id; } }); } this.setState({ theCustomerTypes: theType, }); } blurChange(e) { let theType = ""; let contactLists = this.state.customerArr || []; if (e) { contactLists.map(function (item) { if (item.name == e.toString()) { theType = item.id; } }); } this.setState({ theTypes: theType, }); } componentWillMount() { this.loadData(); this.selectSuperId(); } // 导出Excel exportExec() { this.setState({ exportPendingLoading: true, }); message.config({ duration: 20, }); let loading = message.loading("下载中..."); let data = this.state.searchInfor; $.ajax({ method: "get", dataType: "json", crossDomain: false, url: globalConfig.context + "/api/admin/release/publicReleaseDtails/export", data, success: function (data) { if (data.error.length === 0) { this.download(data.data); } else { message.warning(data.error[0].message); } }.bind(this), }).always( function () { loading(); this.setState({ exportPendingLoading: false, }); }.bind(this) ); } // 下载 download(fileName) { window.location.href = globalConfig.context + "/open/download?fileName=" + fileName; } // 选择行 onSelectChange(selectedRowKeys, selectedRows) { this.setState({ selectedRowKeys, selectedRows, }); } // 关闭弹窗 closeDesc() { this.setState({ mvisible: "", }); this.loadData(this.state.pageNo); } render() { const { searchInfor, selectedRowKeys } = this.state const dataSources = this.state.customerArr || []; const options = dataSources.map((group) => ( {group.name} )); const customerList = this.state.customerList || []; const customerOptions = customerList.map((group) => ( {group.name} )); const rowSelection = { hideDefaultSelections: true, selectedRowKeys, onChange: this.onSelectChange.bind(this), }; return (
签单客户汇总
跟进时间 : { this.setState({ searchInfor: Object.assign(searchInfor, { startDate: dataString[0], endDate: dataString[1], }), }); }} /> 首次签单 : { this.setState({ searchInfor: Object.assign(searchInfor, { startDate: dataString[0], endDate: dataString[1], }), }); }} /> 最新签单 : { this.setState({ searchInfor: Object.assign(searchInfor, { startDate: dataString[0], endDate: dataString[1], }), }); }} />
); } } export default PublicSummary;