123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454 |
- import React, { Component } from 'react';
- import { AutoComplete, Button, DatePicker, Input, Spin, Table, Select, message, Tabs, Tag, Tooltip, } from "antd";
- import $ from "jquery/src/ajax";
- import ShowModalDiv from "@/showModal.jsx";
- import { ChooseList } from "../../../order/orderNew/chooseList";
- import moment from "moment";
- import './index.less';
- const { TabPane } = Tabs;
- const { RangePicker } = DatePicker;
- class FinalFollowup extends Component {
- constructor(props) {
- super(props);
- this.state = {
- pageNo: 1,
- totalPage: 0,
- searchInfor: {},//查询条件
- loading: false,
- changeList: undefined,// 子组件改变的表格title数组
- pagination: {
- defaultCurrent: 1,
- defaultPageSize: 10,
- showQuickJumper: true,
- pageSize: 10,
- onChange: function (page) {
- this.setState({
- pageNo: page,
- });
- this.loadData(page);
- }.bind(this),
- showTotal: function (total) {
- return "共" + total + "条数据";
- },
- },
- columns: [
- {
- title: "客户名称",
- dataIndex: "nickname",
- key: "nickname",
- },
- {
- title: "签单类型",
- dataIndex: "shareType",
- key: "shareType",
- render: (text) => (
- <div>{["私有", "公共", "签单", "外联", "渠道"][text]}</div>
- )
- },
- {
- title: "跟单人",
- dataIndex: "name",
- key: "name",
- },
- {
- title: "最新跟进时间",
- dataIndex: "lastFollowTimeStr",
- key: "lastFollowTimeStr",
- },
- {
- title: "未跟进天数",
- dataIndex: "days",
- key: "days",
- }
- ],
- dataSource: [],
- };
- this.loadData = this.loadData.bind(this);
- this.exportAll = this.exportAll.bind(this);
- this.search = this.search.bind(this);
- this.reset = this.reset.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.selectAuto = this.selectAuto.bind(this);
- this.blurChange = this.blurChange.bind(this);
- }
- componentWillMount() {
- this.loadData();
- }
- // 列表数据
- loadData(pageNo, pageSize) {
- const { searchInfor, pagination } = this.state
- this.setState({
- loading: true,
- });
- let datas = Object.assign(searchInfor, {
- pageNo: pageNo || 1,
- pageSize: pageSize || 10,
- });
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + "/api/admin/customer/selectUserLastSign",
- data: datas,
- success: function (data) {
- 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,
- totalPage: data.data.totalPage,
- });
- } 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)
- );
- }
- // 更改表格显示数据
- changeList(arr) {
- const newArr = [];
- this.state.columns.forEach((item) => {
- arr.forEach((val) => {
- if (val === item.title) {
- newArr.push(item);
- }
- });
- });
- this.setState({
- changeList: newArr,
- });
- }
- // 导出当前列表
- exportAll() {
- message.config({
- duration: 20,
- });
- let loading = message.loading("下载中...");
- this.setState({
- exportPendingLoading: true,
- });
- let obj1 = JSON.parse(JSON.stringify(this.state.searchInfor));
- // data = Object.assign(data, obj1);
- $.ajax({
- method: "get",
- dataType: "json",
- crossDomain: false,
- url: "/api/admin/customer/selectUserLastSign/export",
- data: obj1,
- 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;
- }
- //获取上级组织
- 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(
- <Select.Option value={theData.id} key={theData.id}>
- {theData.name}
- </Select.Option>
- );
- }
- this.setState({
- contactsOption: theArr,
- });
- } else {
- message.warning(data.error[0].message);
- }
- }.bind(this),
- }).always(
- function () {
- this.setState({
- // loading: false,
- });
- }.bind(this)
- );
- }
- 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({
- followAname: e,
- });
- }
- selectAuto(value, options) {
- this.setState({
- followAname: value,
- });
- }
- blurChange(e) {
- const { searchInfor } = this.state
- let theType = undefined;
- let contactLists = this.state.customerArr || [];
- if (e) {
- contactLists.map(function (item) {
- if (item.name == e.toString()) {
- theType = item.id;
- }
- });
- }
- this.setState({
- searchInfor: Object.assign(searchInfor, {
- aid: theType,
- }),
- });
- }
- // 搜索
- search() {
- this.setState({
- selectedRowKeys: []
- })
- this.loadData();
- }
- // 重置
- reset() {
- this.setState({
- searchInfor: JSON.parse(JSON.stringify({})),
- followAname: undefined
- }, () => {
- this.loadData();
- })
- }
- render() {
- const { searchInfor } = this.state
- const dataSources = this.state.customerArr || [];
- const options = dataSources.map((group) => (
- <Select.Option key={group.id} value={group.name}>
- {group.name}
- </Select.Option>
- ));
- return (
- <div className="user-content finalfollowup">
- <ShowModalDiv ShowModal={this.state.showModal} onClose={() => { this.setState({ showModal: false }) }} />
- <div className="content-title" style={{ marginBottom: 10 }}>
- <span style={{ fontWeight: 900, fontSize: 16 }}>客户最后跟进表</span>
- </div>
- <Tabs defaultActiveKey="1">
- <TabPane tab="搜索" key="1">
- <div
- className="user-search"
- style={{
- marginTop: "10px",
- marginLeft: "10px",
- marginRight: "10px",
- }}
- >
- <span style={{ marginRight: "10px" }}>
- <Input
- style={{ width: 160 }}
- placeholder="输入客户名称"
- value={searchInfor.nickname}
- onChange={e => {
- this.setState({
- searchInfor: Object.assign(searchInfor, {
- nickname: e.target.value,
- }),
- });
- }}
- />
- </span>
- <span style={{ marginRight: "10px" }}>
- <AutoComplete
- className="certain-category-search"
- dropdownClassName="certain-category-search-dropdown"
- dropdownMatchSelectWidth={false}
- style={{ width: 160 }}
- dataSource={options}
- placeholder="跟进人姓名"
- value={this.state.followAname}
- onChange={this.httpChange}
- filterOption={true}
- onBlur={this.blurChange}
- onSelect={this.selectAuto}
- >
- <Input />
- </AutoComplete>
- </span>
- <span style={{ marginRight: "10px" }}>
- <Select
- style={{ width: 120 }}
- placeholder="类型"
- value={searchInfor.shareType}
- onChange={(e) => {
- this.setState({
- searchInfor: Object.assign(searchInfor, {
- shareType: e,
- }),
- });
- }}
- >
- <Option value={0}>私有</Option>
- <Option value={2}>签单</Option>
- <Option value={3}>外联</Option>
- <Option value={4}>渠道</Option>
- </Select>
- </span>
- <span style={{ marginRight: "10px" }}>
- <Select
- style={{ width: 120 }}
- placeholder="未跟进天数"
- value={searchInfor.daysType}
- onChange={(e) => {
- this.setState({
- searchInfor: Object.assign(searchInfor, {
- daysType: e,
- }),
- });
- }}
- >
- <Option value={0}>15天</Option>
- <Option value={1}>30天</Option>
- <Option value={2}>60天</Option>
- <Option value={3}>90天</Option>
- <Option value={4}>180天</Option>
- <Option value={5}>1年</Option>
- <Option value={6}>2年</Option>
- </Select>
- </span>
- <Button
- type="primary"
- onClick={this.search}
- style={{ marginRight: "10px", marginBottom: "10px" }}
- >
- 搜索
- </Button>
- <Button
- onClick={this.reset}
- style={{ marginRight: "10px", marginBottom: "10px" }}
- >
- 重置
- </Button>
- </div>
- </TabPane>
- <TabPane tab="更改表格显示数据" key="2">
- <div style={{ marginLeft: 10 }}>
- <ChooseList
- columns={this.state.columns}
- changeFn={this.changeList}
- changeList={this.state.changeList}
- top={55}
- margin={11}
- />
- </div>
- </TabPane>
- <TabPane tab="导出Excel" key="3">
- <Button
- type="primary"
- style={{ margin: "11px 0px 10px 10px" }}
- onClick={this.exportAll}
- >
- 导出当前列表
- </Button>
- </TabPane>
- </Tabs>
- <div className="patent-table">
- <Spin spinning={this.state.loading}>
- <Table
- bordered
- columns={
- this.state.changeList == undefined
- ? this.state.columns
- : this.state.changeList
- }
- dataSource={this.state.dataSource}
- pagination={this.state.pagination}
- />
- </Spin>
- </div>
- </div>
- )
- }
- }
- export default FinalFollowup;
|