From 1ab0c7d0c75677ada982c83bdfa3bfa26fdfcca0 Mon Sep 17 00:00:00 2001 From: lyt Date: Wed, 9 Aug 2023 10:17:58 +0800 Subject: [PATCH] eslint autofix . --- src/App.js | 328 ++++++++++++++++++++------------- src/charts/Orders.js | 135 +++++++------- src/stores/AuthStore.js | 22 +-- src/stores/ChatSessionStore.js | 24 +-- src/stores/CustomerServices.js | 4 +- src/stores/CustomerStore.js | 42 ++--- src/stores/DashboardStore.js | 12 +- src/stores/DatePickerStore.js | 10 +- src/stores/FinancialStore.js | 22 +-- src/stores/Index.js | 2 +- src/stores/OrdersStore.js | 83 ++++----- src/stores/SaleStore.js | 80 ++++---- src/stores/Wechat.js | 2 +- src/stores/WhatsApp.js | 2 +- src/utils/commons.js | 46 ++--- src/views/AgentGroupCount.js | 167 +++++++++++------ 16 files changed, 558 insertions(+), 423 deletions(-) diff --git a/src/App.js b/src/App.js index 07f93a2..9689a1b 100644 --- a/src/App.js +++ b/src/App.js @@ -1,139 +1,203 @@ -import "./App.css"; -import React, { useContext } from "react"; -import { HomeOutlined, TeamOutlined, DashboardOutlined, FileProtectOutlined, CustomerServiceTwoTone, SnippetsTwoTone, DollarOutlined, AreaChartOutlined, WechatOutlined, UserOutlined } from "@ant-design/icons"; -import { Layout, Menu, Image, Spin } from "antd"; -import { BrowserRouter, Route, Routes, NavLink } from "react-router-dom"; -import Home from "./views/Home"; -import Dashboard from "./views/Dashboard"; -import Orders from "./views/Orders"; -import Orders_sub from "./views/Orders_sub"; -import ProtectedRoute from "./views/ProtectedRoute"; -import Customer_care_inchina from "./charts/Customer_care_inchina"; -import Customer_care_potential from "./charts/Customer_care_potential"; -import Customer_care_regular from "./charts/Customer_care_regular"; -import Wechat_session from "./charts/Wechat_session"; -import WhatsApp_session from "./charts/WhatsApp_session"; -import AgentGroupCount from "./views/AgentGroupCount"; -import AgentGroupList from "./views/AgentGroupList"; -import DestinationGroupCount from "./views/DestinationGroupCount"; -import DestinationGroupList from "./views/DestinationGroupList"; -import Credit_card_bill from "./views/Credit_card_bill"; -import exchange_rate from "./charts/ExchangeRate"; -import Sale from "./views/Sale"; -import Sale_sub from "./views/Sale_sub"; -import Logo from "./logo.png"; -import { stores_Context } from "./config"; -import { observer } from "mobx-react"; -import ExchangeRate from "./charts/ExchangeRate"; +import './App.css'; +import React, { useContext } from 'react'; +import { + HomeOutlined, + TeamOutlined, + DashboardOutlined, + FileProtectOutlined, + CustomerServiceTwoTone, + SnippetsTwoTone, + DollarOutlined, + AreaChartOutlined, + WechatOutlined, + UserOutlined, +} from '@ant-design/icons'; +import { Layout, Menu, Image, Spin } from 'antd'; +import { BrowserRouter, Route, Routes, NavLink } from 'react-router-dom'; +import Home from './views/Home'; +import Dashboard from './views/Dashboard'; +import Orders from './views/Orders'; +import Orders_sub from './views/Orders_sub'; +import ProtectedRoute from './views/ProtectedRoute'; +import Customer_care_inchina from './charts/Customer_care_inchina'; +import Customer_care_potential from './charts/Customer_care_potential'; +import Customer_care_regular from './charts/Customer_care_regular'; +import Wechat_session from './charts/Wechat_session'; +import WhatsApp_session from './charts/WhatsApp_session'; +import AgentGroupCount from './views/AgentGroupCount'; +import AgentGroupList from './views/AgentGroupList'; +import DestinationGroupCount from './views/DestinationGroupCount'; +import DestinationGroupList from './views/DestinationGroupList'; +import Credit_card_bill from './views/Credit_card_bill'; +import Sale from './views/Sale'; +import Sale_sub from './views/Sale_sub'; +import Logo from './logo.png'; +import { stores_Context } from './config'; +import { observer } from 'mobx-react'; +import ExchangeRate from './charts/ExchangeRate'; const App = () => { - const { Content, Footer, Sider } = Layout; - const { auth_store } = useContext(stores_Context); + const { Content, Footer, Sider } = Layout; + const { auth_store } = useContext(stores_Context); - const menu_items = [ - { key: 1, label: 主页, icon: }, - { - key: 2, - label: "市场", - icon: , - children: [ - { key: 21, label: 订单数据, icon: }, - { key: 22, label: 仪表盘, icon: }, - ], - }, - { - key: 5, - label: "销售", - icon: , - children: [{ key: 51, label: 业绩数据 }], - }, - { - key: 3, - label: "客运", - icon: , - children: [ - { key: 31, label: 潜力客户 }, - { key: 32, label: 老客户 }, - { key: 33, label: 在华客户 }, - { key: 34, label: 微信会话存档 }, - { key: 35, label: WhatsApp会话存档 }, - ], - }, - { - key: 4, - label: "财务", - icon: , - children: [ - { key: 41, label: 信用卡账单 }, - { key: 42, label: 汇率 }, - ], - }, - { - key: 6, - label: "客服", - icon: , - children: [ - { key: 61, label: 地接社接团 }, - { key: 62, label: 目的地接团 }, - ], - } - ]; + const menu_items = [ + { key: 1, label: 主页, icon: }, + { + key: 2, + label: '市场', + icon: , + children: [ + { + key: 21, + label: 订单数据, + icon: , + }, + { + key: 22, + label: 仪表盘, + icon: , + }, + ], + }, + { + key: 5, + label: '销售', + icon: , + children: [{ key: 51, label: 业绩数据 }], + }, + { + key: 3, + label: '客运', + icon: , + children: [ + { + key: 31, + label: 潜力客户, + }, + { + key: 32, + label: 老客户, + }, + { + key: 33, + label: 在华客户, + }, + { + key: 34, + label: 微信会话存档, + }, + { + key: 35, + label: WhatsApp会话存档, + }, + ], + }, + { + key: 4, + label: '财务', + icon: , + children: [ + { + key: 41, + label: 信用卡账单, + }, + { key: 42, label: 汇率 }, + ], + }, + { + key: 6, + label: '客服', + icon: , + children: [ + { + key: 61, + label: 地接社接团, + }, + { + key: 62, + label: 目的地接团, + }, + ], + }, + ]; - return ( - - - - - - - - - - } /> - }> - } /> - } /> - } /> - - }> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - } /> - - }> - } /> - } /> - - }> - } /> - } /> - - - -
- {auth_store.user.name} ({auth_store.user.userid})
- Hainatravel Dashboard ©2022 Created by IT -
-
- - - ); + return ( + + + + + + + + + + } /> + }> + } /> + } /> + } /> + + }> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + + }> + } /> + } /> + + }> + } /> + } /> + + + +
+ {auth_store.user.name} ({auth_store.user.userid}) +
+ Hainatravel Dashboard ©2022 Created by IT +
+
+ + + ); }; export default observer(App); diff --git a/src/charts/Orders.js b/src/charts/Orders.js index 2cfebc3..8a00b80 100644 --- a/src/charts/Orders.js +++ b/src/charts/Orders.js @@ -1,74 +1,83 @@ -import React, {Component} from 'react'; -import {Row, Col, Button, Tabs, Table, Space} from 'antd'; +import React, { Component } from 'react'; +import { Row, Col, Button, Tabs, Table, Space } from 'antd'; import { - ContainerOutlined, CarryOutOutlined, - SmileOutlined, TagsOutlined, GlobalOutlined, - SearchOutlined, + ContainerOutlined, + CarryOutOutlined, + SmileOutlined, + TagsOutlined, + GlobalOutlined, + SearchOutlined, } from '@ant-design/icons'; -import {stores_Context} from '../config' -import {Line} from "@ant-design/charts"; -import SiteSelect from "./SiteSelect"; -import {observer} from 'mobx-react'; -import DatePickerCharts from './DatePickerCharts' +import { stores_Context } from '../config'; +import { Line } from '@ant-design/charts'; +import SiteSelect from './SiteSelect'; +import { observer } from 'mobx-react'; +import DatePickerCharts from './DatePickerCharts'; class Orders extends Component { + static contextType = stores_Context; - static contextType = stores_Context; + constructor(props) { + super(props); + } - constructor(props) { - super(props); - } + // componentDidMount() { + // const {orders_store} = this.context; + // orders_store.getOrderCount(); + // orders_store.onChange_Tabs(orders_store.active_tab_key); + // } - // componentDidMount() { - // const {orders_store} = this.context; - // orders_store.getOrderCount(); - // orders_store.onChange_Tabs(orders_store.active_tab_key); - // } + render() { + const { dashboard_store } = this.context; + const orders_data = dashboard_store.orders_data; + const line_config = { + data: orders_data.data, + padding: 'auto', + xField: 'ApplyDate', + yField: 'orderCount', + seriesField: 'WebCode', + xAxis: { + type: 'timeCat', + }, + smooth: true, + legend: { + position: 'right-top', + title: { + text: '总合计 ' + orders_data.data.reduce((a, b) => a + b.orderCount, 0), + }, + itemMarginBottom: 12, // 垂直间距 + itemValue: { + formatter: (text, item) => { + const items = orders_data.data.filter((d) => d.WebCode === item.value); // 按站点筛选 + return items.length ? items.reduce((a, b) => a + b.orderCount, 0) : ''; // 计算总数 + }, + }, + }, + }; - render() { - const {dashboard_store} = this.context; - const orders_data = dashboard_store.orders_data; - const line_config = { - data: orders_data.data, - padding: 'auto', - xField: 'ApplyDate', - yField: 'orderCount', - seriesField: 'WebCode', - xAxis: { - type: 'timeCat', - }, - smooth: true, - legend: { - position: 'right-top', - title: { - text: '总合计 ' + orders_data.data.reduce((a, b) => a + b.orderCount, 0), - }, - itemMarginBottom: 12,//垂直间距 - itemValue: { - formatter: (text, item) => { - const items = orders_data.data.filter((d) => d.WebCode === item.value);//按站点筛选 - return items.length ? items.reduce((a, b) => a + b.orderCount, 0) : '';//计算总数 - }, - }, - }, - } - - return ( -
-

全网站订单数统计

-
- - - - -
-
- -
- ); - } + return ( +
+

全网站订单数统计

+
+ + + + +
+
+ +
+ ); + } } export default observer(Orders); diff --git a/src/stores/AuthStore.js b/src/stores/AuthStore.js index 0d1b910..5e51f7f 100644 --- a/src/stores/AuthStore.js +++ b/src/stores/AuthStore.js @@ -2,41 +2,41 @@ import { makeAutoObservable, runInAction } from "mobx"; import * as dd from "dingtalk-jsapi"; import * as config from "../config"; -//权限管理 +// 权限管理 class AuthStore { constructor(rootStore) { this.rootStore = rootStore; makeAutoObservable(this); if (process.env.NODE_ENV == "production") { - this.get_auth(); //放到钉钉环境才能开启 + this.get_auth(); // 放到钉钉环境才能开启 } } - auth = ["admin"]; //开发时候用,正式环境留空 - user = { name: "loading", userid: "..." }; //开发时候用,正式环境留空 + auth = ["admin"]; // 开发时候用,正式环境留空 + user = { name: "loading", userid: "..." }; // 开发时候用,正式环境留空 has_permission(requireds) { if (Object.keys(requireds).length == 0) { return true; } - let has_permission = requireds.filter(item => this.auth.includes(item)); + const has_permission = requireds.filter(item => this.auth.includes(item)); if (Object.keys(has_permission).length !== 0) { return true; } return false; } - //请求权限 + // 请求权限 get_auth() { - let _this = this; - const CORPID = "ding48bce8fd3957c96b"; //企业的id + const _this = this; + const CORPID = "ding48bce8fd3957c96b"; // 企业的id dd.runtime.permission.requestAuthCode({ corpId: CORPID, onSuccess: function (res) { console.log(res); - let code = res.code; - let url = "/dingtalk/dingtalkwork/Getusers_auth?code=" + code; - //请求获取HT接口获取用户权限和用户信息 + const code = res.code; + const url = "/dingtalk/dingtalkwork/Getusers_auth?code=" + code; + // 请求获取HT接口获取用户权限和用户信息 fetch(config.HT_HOST + url) .then(response => response.json()) .then(json => { diff --git a/src/stores/ChatSessionStore.js b/src/stores/ChatSessionStore.js index 47abd6f..d9595de 100644 --- a/src/stores/ChatSessionStore.js +++ b/src/stores/ChatSessionStore.js @@ -3,7 +3,7 @@ import * as dd from 'dingtalk-jsapi'; import * as config from "../config"; -//会话管理 +// 会话管理 class ChatSessionStore { constructor(rootStore) { @@ -12,36 +12,36 @@ class ChatSessionStore { } wechat_data = { - counselors: [],//顾问列表 - customers: [],//客户列表 - } + counselors: [],// 顾问列表 + customers: [],// 客户列表 + }; - //请求权限 + // 请求权限 get_auth() { - let _this = this; - const CORPID = 'ding48bce8fd3957c96b';//企业的id + const _this = this; + const CORPID = 'ding48bce8fd3957c96b';// 企业的id dd.runtime.permission.requestAuthCode({ corpId: CORPID, onSuccess: function (res) { console.log(res); - let code = res.code; - let url = '/dingtalk/dingtalkwork/Getusers_auth?code=' + code; - //请求获取HT接口获取用户权限和用户信息 + const code = res.code; + const url = '/dingtalk/dingtalkwork/Getusers_auth?code=' + code; + // 请求获取HT接口获取用户权限和用户信息 fetch(config.HT_HOST + url) .then((response) => response.json()) .then((json) => { runInAction(() => { _this.user = json.result; _this.auth = json.result.authlist; - }) + }); }) .catch((error) => { console.log('fetch data failed', error); }); }, onFail: function (err) { - console.log(err) + console.log(err); } }); } diff --git a/src/stores/CustomerServices.js b/src/stores/CustomerServices.js index 75693eb..8ad1619 100644 --- a/src/stores/CustomerServices.js +++ b/src/stores/CustomerServices.js @@ -1,4 +1,4 @@ -import {makeAutoObservable, runInAction} from "mobx" +import {makeAutoObservable, runInAction} from "mobx"; import moment from "moment"; import { NavLink } from "react-router-dom"; import * as config from "../config"; @@ -512,7 +512,7 @@ class CustomerServices { if (record.EOI_ObjSN === -1) { return text; } else { - return {text} + return {text}; } } }, diff --git a/src/stores/CustomerStore.js b/src/stores/CustomerStore.js index 910d916..0eeb1c7 100644 --- a/src/stores/CustomerStore.js +++ b/src/stores/CustomerStore.js @@ -14,7 +14,7 @@ class CustomerStore { potential_customer_order(get_detail = false) { this.potential_data.loading = true; const date_picker_store = this.rootStore.date_picker_store; - let url = '/service-tourdesign/PotentialCusOrder' + let url = '/service-tourdesign/PotentialCusOrder'; url += '?Website=' + this.potential_data.webcode + '&DEI_SNList=' + this.potential_data.groups.toString(); if (this.potential_data.date_type == 'applyDate') { url += '&ApplydateCheck=1&EntrancedateCheck=0&ConfirmDateCheck=0'; @@ -27,9 +27,9 @@ class CustomerStore { url += '&EntrancedateStart=' + date_picker_store.start_date.format(config.DATE_FORMAT) + '&EntrancedateEnd=' + date_picker_store.end_date.format(config.DATE_FORMAT) + '%2023:59:59'; url += '&ConfirmdateStart=' + date_picker_store.start_date.format(config.DATE_FORMAT) + '&ConfirmdateEnd=' + date_picker_store.end_date.format(config.DATE_FORMAT) + '%2023:59:59'; if (get_detail) { - url += '&IsDetail=1' + url += '&IsDetail=1'; } else { - url += '&IsDetail=0' + url += '&IsDetail=0'; } fetch(config.HT_HOST + url) .then((response) => response.json()) @@ -41,7 +41,7 @@ class CustomerStore { this.potential_data.data = json; } this.potential_data.loading = false; - }) + }); }) .catch((error) => { this.potential_data.loading = false; @@ -70,8 +70,8 @@ class CustomerStore { data: [], data_detail: [], webcode: 'GHKYZG', - site_select_mode: false,//站点是否多选 - group_select_mode: 'multiple',//是否多选分组 + site_select_mode: false,// 站点是否多选 + group_select_mode: 'multiple',// 是否多选分组 groups: ['1', '2', '7'], date_type: 'applyDate', group_handleChange: this.handleChange_group_select.bind(this), @@ -79,7 +79,7 @@ class CustomerStore { potential_customer_order: this.potential_customer_order.bind(this), onChange_show_detail_table: this.onChange_show_detail_table.bind(this), handleChange_webcode: this.handleChange_webcode.bind(this), - } + }; // 潜力客户 end @@ -87,7 +87,7 @@ class CustomerStore { regular_customer_order(get_detail = false) { this.regular_data.loading = true; const date_picker_store = this.rootStore.date_picker_store; - let url = '/service-tourdesign/RegularCusOrder' + let url = '/service-tourdesign/RegularCusOrder'; url += '?Website=' + this.regular_data.webcode + '&DEI_SNList=' + this.regular_data.groups.toString(); if (this.regular_data.date_type == 'applyDate') { url += '&ApplydateCheck=1&EntrancedateCheck=0&ConfirmDateCheck=0'; @@ -100,9 +100,9 @@ class CustomerStore { url += '&EntrancedateStart=' + date_picker_store.start_date.format(config.DATE_FORMAT) + '&EntrancedateEnd=' + date_picker_store.end_date.format(config.DATE_FORMAT) + '%2023:59:59'; url += '&ConfirmdateStart=' + date_picker_store.start_date.format(config.DATE_FORMAT) + '&ConfirmdateEnd=' + date_picker_store.end_date.format(config.DATE_FORMAT) + '%2023:59:59'; if (get_detail) { - url += '&IsDetail=1' + url += '&IsDetail=1'; } else { - url += '&IsDetail=0' + url += '&IsDetail=0'; } fetch(config.HT_HOST + url) .then((response) => response.json()) @@ -114,7 +114,7 @@ class CustomerStore { this.regular_data.data = json; } this.regular_data.loading = false; - }) + }); }) .catch((error) => { this.regular_data.loading = false; @@ -143,8 +143,8 @@ class CustomerStore { data: [], data_detail: [], webcode: 'ALL', - site_select_mode: false,//站点是否多选 - group_select_mode: 'multiple',//是否多选分组 + site_select_mode: false,// 站点是否多选 + group_select_mode: 'multiple',// 是否多选分组 groups: ['1', '2', '28', '7'], date_type: 'applyDate', group_handleChange: this.handleChange_group_select_regular.bind(this), @@ -152,7 +152,7 @@ class CustomerStore { regular_customer_order: this.regular_customer_order.bind(this), onChange_show_detail_table: this.onChange_show_detail_table_regular.bind(this), handleChange_webcode: this.handleChange_webcode_regular.bind(this), - } + }; // 老客户 end @@ -160,7 +160,7 @@ class CustomerStore { inchina_customer_order(get_detail = false) { this.inchina_data.loading = true; const date_picker_store = this.rootStore.date_picker_store; - let url = '/service-tourdesign/RegularCusInChinaOrder' + let url = '/service-tourdesign/RegularCusInChinaOrder'; url += '?Website=' + this.inchina_data.webcode + '&DEI_SNList=' + this.inchina_data.groups.toString(); if (this.inchina_data.date_type == 'applyDate') { url += '&ApplydateCheck=1&EntrancedateCheck=0&ConfirmDateCheck=0'; @@ -170,9 +170,9 @@ class CustomerStore { url += '&ApplydateCheck=0&EntrancedateCheck=1&ConfirmDateCheck=0'; } if (get_detail) { - url += '&IsDetail=1' + url += '&IsDetail=1'; } else { - url += '&IsDetail=0' + url += '&IsDetail=0'; } url += '&ApplydateStart=' + date_picker_store.start_date.format(config.DATE_FORMAT) + '&ApplydateEnd=' + date_picker_store.end_date.format(config.DATE_FORMAT) + '%2023:59:59'; url += '&EntrancedateStart=' + date_picker_store.start_date.format(config.DATE_FORMAT) + '&EntrancedateEnd=' + date_picker_store.end_date.format(config.DATE_FORMAT) + '%2023:59:59'; @@ -187,7 +187,7 @@ class CustomerStore { this.inchina_data.data = json; } this.inchina_data.loading = false; - }) + }); }) .catch((error) => { this.inchina_data.loading = false; @@ -216,8 +216,8 @@ class CustomerStore { data: [], data_detail: [], webcode: 'ALL', - site_select_mode: false,//站点是否多选 - group_select_mode: 'multiple',//是否多选分组 + site_select_mode: false,// 站点是否多选 + group_select_mode: 'multiple',// 是否多选分组 groups: ['1', '2', '28', '7'], date_type: 'applyDate', group_handleChange: this.handleChange_group_select_inchina.bind(this), @@ -225,7 +225,7 @@ class CustomerStore { inchina_customer_order: this.inchina_customer_order.bind(this), onChange_show_detail_table: this.onChange_show_detail_table_inchina.bind(this), handleChange_webcode: this.handleChange_webcode_inchina.bind(this), - } + }; // 在华客人 end } diff --git a/src/stores/DashboardStore.js b/src/stores/DashboardStore.js index e722cbd..1c7069b 100644 --- a/src/stores/DashboardStore.js +++ b/src/stores/DashboardStore.js @@ -8,10 +8,10 @@ class DashboardStore { } loading = false; - site_select_mode = "multiple"; //是否多选站点 + site_select_mode = "multiple"; // 是否多选站点 webcode = ["CHT", "AH", "GH"]; - //订单统计 begin + // 订单统计 begin orders_data = { loading: false, data: [], @@ -19,7 +19,7 @@ class DashboardStore { }; getOrderCount_all() { - //统计所有站点订单数量 + // 统计所有站点订单数量 this.orders_data.loading = true; const date_picker_store = this.rootStore.date_picker_store; let url = "/service-web/QueryData/GetOrderCount"; @@ -39,7 +39,7 @@ class DashboardStore { }); } - //订单统计 end + // 订单统计 end // 临时订单 begin @@ -131,7 +131,7 @@ class DashboardStore { fetch(config.HT_HOST + url) .then(response => response.json()) .then(json => { - let table_data = []; + const table_data = []; json && json.map((item, index) => { table_data.push({ @@ -156,7 +156,7 @@ class DashboardStore { mobile_data = { loading: false, data: [], - group_select_mode: "multiple", //是否多选分组 + group_select_mode: "multiple", // 是否多选分组 groups: ["1", "2", "28", "7", "8", "9", "11", "12", "20", "21", "18"], columns: [ { diff --git a/src/stores/DatePickerStore.js b/src/stores/DatePickerStore.js index 93e3f39..ff7ac74 100644 --- a/src/stores/DatePickerStore.js +++ b/src/stores/DatePickerStore.js @@ -1,4 +1,4 @@ -import {makeAutoObservable} from "mobx" +import {makeAutoObservable} from "mobx"; import moment from "moment"; class DatePickerStore { @@ -16,7 +16,7 @@ class DatePickerStore { onChange_dataPicker = (dates) => { this.start_date = dates[0]; this.end_date = dates[1]; - } + }; onChange_dataPicker_cp = (dates) => { if (dates) { @@ -26,14 +26,14 @@ class DatePickerStore { this.start_date_cp = false; this.end_date_cp = false; } - } + }; - //计算上一个时间段 + // 计算上一个时间段 previous_date() { return [moment(this.start_date).subtract(this.end_date.diff(this.start_date, 'days') + 1, 'days'), moment(this.start_date).subtract(1, 'days')]; } - //去年同期 + // 去年同期 previous_year() { return [moment(this.start_date).subtract(1, 'year'), moment(this.end_date).subtract(1, 'year')]; } diff --git a/src/stores/FinancialStore.js b/src/stores/FinancialStore.js index 245ff2d..2557007 100644 --- a/src/stores/FinancialStore.js +++ b/src/stores/FinancialStore.js @@ -1,10 +1,10 @@ import {makeAutoObservable, runInAction} from "mobx"; import * as dd from 'dingtalk-jsapi'; import * as config from "../config"; -import * as comm from '../utils/commons' +import * as comm from '../utils/commons'; -//财务管理 +// 财务管理 class FinancialStore { constructor(rootStore) { @@ -18,7 +18,7 @@ class FinancialStore { bill_type_mode: false, bill_types: ['ALL'], bt_handleChange: this.bt_handleChange.bind(this), - } + }; bt_handleChange(value) { this.bill_type_data.bill_types = value; @@ -26,13 +26,13 @@ class FinancialStore { get_bill_types() { const date_picker_store = this.rootStore.date_picker_store; - let url = '/service-web/QueryData/GetCreditCardBillType'; + const url = '/service-web/QueryData/GetCreditCardBillType'; fetch(config.HT_HOST + url) .then((response) => response.json()) .then((json) => { runInAction(() => { this.bill_type_data.data = json.billtype; - }) + }); }) .catch((error) => { console.log('fetch data failed', error); @@ -54,7 +54,7 @@ class FinancialStore { } set_table_handleChange = (pagination, filters, sorter) => { - let filters_arr = Object.values(filters); + const filters_arr = Object.values(filters); if (!comm.empty(filters_arr)) { this.set_bill_filtered(filters_arr[0]); } @@ -69,7 +69,7 @@ class FinancialStore { business_units: ['ALL'], group_select_mode: false, groups: ['ALL'], - filteredValue: [],//默认的筛选值 + filteredValue: [],// 默认的筛选值 bu_handleChange: this.bu_handleChange.bind(this), group_handleChange: this.group_handleChange.bind(this), set_bill_filtered: this.set_bill_filtered.bind(this), @@ -85,7 +85,7 @@ class FinancialStore { this.credit_card_data.groups = value; }; - //请求信用卡账单 + // 请求信用卡账单 get_credit_card_bills() { const date_picker_store = this.rootStore.date_picker_store; let url = '/service-web/QueryData/GetCreditCardBills'; @@ -99,14 +99,14 @@ class FinancialStore { .then((json) => { runInAction(() => { this.credit_card_data.data = json; - }) + }); }) .catch((error) => { console.log('fetch data failed', error); }); } - //请求信用卡账单 + // 请求信用卡账单 get_credit_card_bills_by_type() { const date_picker_store = this.rootStore.date_picker_store; let url = '/service-web/QueryData/GetCreditCardBillsByType'; @@ -120,7 +120,7 @@ class FinancialStore { .then((json) => { runInAction(() => { this.credit_card_data.data_by_type = json; - }) + }); }) .catch((error) => { console.log('fetch data failed', error); diff --git a/src/stores/Index.js b/src/stores/Index.js index 47b66b8..becfcde 100644 --- a/src/stores/Index.js +++ b/src/stores/Index.js @@ -1,4 +1,4 @@ -import {makeAutoObservable} from "mobx" +import {makeAutoObservable} from "mobx"; import OrdersStore from "./OrdersStore"; import DashboardStore from "./DashboardStore"; import DatePickerStore from "./DatePickerStore"; diff --git a/src/stores/OrdersStore.js b/src/stores/OrdersStore.js index 0b25f8c..58f2f87 100644 --- a/src/stores/OrdersStore.js +++ b/src/stores/OrdersStore.js @@ -13,62 +13,63 @@ class OrdersStore { } loading = false; - site_select_mode = false; //是否多选站点 + site_select_mode = false; // 是否多选站点 group_select_mode = false; groups = ["1,2,28,7,33"]; webcode = "ALL"; date_type = "applyDate"; - include_tickets = "1"; //是否包含门票,1是含有,0不含 - //diff_count_day = 0; //开始日期和结束日期的间隔,用于计算平均数 - active_tab_key = "Form"; //当前切换的标签页 - active_tab_key_sub = "detail"; //当前切换的子维度标签页 - orderCountData = []; //订单统计数据源 - orderCountData_type = []; //子维度订单统计 - orderCountData_Form = []; //表单类型统计数据源 - orderCountData_Form_sub = []; //子维度类型统计 - diff_days1 = 0; //日期相差天数,用于计算日平均值 - diff_days2 = 0; //日期相差天数,比较数据时使用 + include_tickets = "1"; // 是否包含门票,1是含有,0不含 + // diff_count_day = 0; //开始日期和结束日期的间隔,用于计算平均数 + active_tab_key = "Form"; // 当前切换的标签页 + active_tab_key_sub = "detail"; // 当前切换的子维度标签页 + orderCountData = []; // 订单统计数据源 + orderCountData_type = []; // 子维度订单统计 + orderCountData_Form = []; // 表单类型统计数据源 + orderCountData_Form_sub = []; // 子维度类型统计 + diff_days1 = 0; // 日期相差天数,用于计算日平均值 + diff_days2 = 0; // 日期相差天数,比较数据时使用 - //选择事业部 + // 选择事业部 group_handleChange(value) { this.groups = value; } - //计算两个时间段的有多少天 + // 计算两个时间段的有多少天 get diff_count_day() { const date_picker_store = this.rootStore.date_picker_store; - let _start_date = moment(date_picker_store.start_date.format(config.DATE_FORMAT)); - let _end_date = moment(date_picker_store.end_date.format(config.DATE_FORMAT)); + const _start_date = moment(date_picker_store.start_date.format(config.DATE_FORMAT)); + const _end_date = moment(date_picker_store.end_date.format(config.DATE_FORMAT)); return _end_date.diff(_start_date, "days") + 1; } - //下单日期、确认日期、出发日期 + // 下单日期、确认日期、出发日期 onChange_datetype(value) { this.date_type = value; } - //选择来源网站 + // 选择来源网站 handleChange_webcode = value => { this.webcode = value; }; - //是否包含门票 + + // 是否包含门票 handleChange_include_tickets = value => { this.include_tickets = value; }; - //切换标签页 + // 切换标签页 onChange_Tabs_sub(ordertype, ordertype_sub, active_key) { this.active_tab_key_sub = active_key; this.getOrderCountByType_sub(ordertype, ordertype_sub, this.active_tab_key_sub); } - //格式化一下数据 - //映射时间,做时间段对比的时候需要把对比时间段映射到开始时间上才能在同一个x轴显示 - //比如2022-10-01~2022-10-30 vs 2021-10-01~2021-10-30 ,则需要在2021年的时间段加365天的时间映射成2022起始时间段 - //相差的天数用a.diff(b, 'days')计算 + // 格式化一下数据 + // 映射时间,做时间段对比的时候需要把对比时间段映射到开始时间上才能在同一个x轴显示 + // 比如2022-10-01~2022-10-30 vs 2021-10-01~2021-10-30 ,则需要在2021年的时间段加365天的时间映射成2022起始时间段 + // 相差的天数用a.diff(b, 'days')计算 format_data_source(data_source, start_date, end_date) { - let result = []; - for (let item of data_source.ordercount1) { + const result = []; + for (const item of data_source.ordercount1) { if (result[item.ApplyDate]) { result[item.ApplyDate].yField += item.orderCount; } else { @@ -80,13 +81,13 @@ class OrdersStore { } } if (data_source.ordercount2 && end_date) { - //不能直接用diff计算,因为日期是含有时间的,会导致计算差一天,先转成格式化的日期再比较 - let _start_date = moment(start_date.format(config.DATE_FORMAT)); - let _end_date = moment(end_date.format(config.DATE_FORMAT)); - let diff_days = _start_date.diff(_end_date, "days"); - for (let item of data_source.ordercount2) { - let ApplyDate = moment(item.ApplyDate).add(diff_days, "days").format(config.DATE_FORMAT); - let ApplyDate_key = ApplyDate + "_";//这个作为key + // 不能直接用diff计算,因为日期是含有时间的,会导致计算差一天,先转成格式化的日期再比较 + const _start_date = moment(start_date.format(config.DATE_FORMAT)); + const _end_date = moment(end_date.format(config.DATE_FORMAT)); + const diff_days = _start_date.diff(_end_date, "days"); + for (const item of data_source.ordercount2) { + const ApplyDate = moment(item.ApplyDate).add(diff_days, "days").format(config.DATE_FORMAT); + const ApplyDate_key = ApplyDate + "_";// 这个作为key if (result[ApplyDate_key]) { result[ApplyDate_key].yField += item.orderCount; } else { @@ -101,7 +102,7 @@ class OrdersStore { return comm.set_array_index(result); } - //网站订单数量,根据类型 + // 网站订单数量,根据类型 getOrderCount_type(ordertype, ordertype_sub) { this.loading = true; const date_picker_store = this.rootStore.date_picker_store; @@ -126,11 +127,11 @@ class OrdersStore { }); } - //网站订单数量 + // 网站订单数量 getOrderCount() { this.loading = true; const date_picker_store = this.rootStore.date_picker_store; - let url = "/service-web/QueryData/GetOrderCount"; //?WebCode=cht&COLI_ApplyDate1=2022-08-01&COLI_ApplyDate2=2022-08-31&COLI_ApplyDateold1=2021-08-01&COLI_ApplyDateold2=2021-08-31'; + let url = "/service-web/QueryData/GetOrderCount"; // ?WebCode=cht&COLI_ApplyDate1=2022-08-01&COLI_ApplyDate2=2022-08-31&COLI_ApplyDateold1=2021-08-01&COLI_ApplyDateold2=2021-08-31'; url += "?WebCode=" + this.webcode + "&IncludeTickets=" + this.include_tickets; url += "&COLI_ApplyDate1=" + date_picker_store.start_date.format(config.DATE_FORMAT) + "&COLI_ApplyDate2=" + date_picker_store.end_date.format(config.DATE_FORMAT) + "%2023:59:59"; url += `&DepartmentList=${this.groups.toString()}&DateType=${this.date_type}`; @@ -151,7 +152,7 @@ class OrdersStore { }); } - //网站订单类型 + // 网站订单类型 getOrderCountByType(order_type) { const date_picker_store = this.rootStore.date_picker_store; let url = "/service-web/QueryData/GetOrderCountByType"; @@ -165,7 +166,7 @@ class OrdersStore { .then(response => response.json()) .then(json => { runInAction(() => { - //错误:[MOBX]由于启用了严格模式,所以不允许改变观察到的在动作之外的值。如果此更改是有意的,请将代码包在“Actudio”中。 + // 错误:[MOBX]由于启用了严格模式,所以不允许改变观察到的在动作之外的值。如果此更改是有意的,请将代码包在“Actudio”中。 this.orderCountData_Form = json; }); }) @@ -174,12 +175,12 @@ class OrdersStore { }); } - //子维度查询 + // 子维度查询 getOrderCountByType_sub(ordertype, ordertype_sub, sub_type) { const date_picker_store = this.rootStore.date_picker_store; let url = "/service-web/QueryData/GetOrderCountByType_Sub"; if (sub_type == "page_cxstate1") { - //统计成行订单的路径 + // 统计成行订单的路径 sub_type = "page&cxstate=1"; } url += `?WebCode=${this.webcode}&OrderType=${ordertype}&OrderType_val=${ordertype_sub}&SubOrderType=${sub_type}` + "&IncludeTickets=" + this.include_tickets; @@ -192,7 +193,7 @@ class OrdersStore { .then(response => response.json()) .then(json => { runInAction(() => { - //错误:[MOBX]由于启用了严格模式,所以不允许改变观察到的在动作之外的值。如果此更改是有意的,请将代码包在“Actudio”中。 + // 错误:[MOBX]由于启用了严格模式,所以不允许改变观察到的在动作之外的值。如果此更改是有意的,请将代码包在“Actudio”中。 this.orderCountData_Form_sub = json; }); }) @@ -201,7 +202,7 @@ class OrdersStore { }); } - //切换标签页 + // 切换标签页 onChange_Tabs(active_key) { this.active_tab_key = active_key; this.getOrderCountByType(this.active_tab_key); diff --git a/src/stores/SaleStore.js b/src/stores/SaleStore.js index 8e2c441..e890d39 100644 --- a/src/stores/SaleStore.js +++ b/src/stores/SaleStore.js @@ -4,7 +4,7 @@ import * as config from "../config"; import * as comm from "../utils/commons"; import { NavLink } from "react-router-dom"; -//销售数据 +// 销售数据 class SaleStore { constructor(rootStore) { this.rootStore = rootStore; @@ -13,55 +13,57 @@ class SaleStore { loading = false; loading_table = false; - spinning = false; //加载状态 - active_tab_key = "All"; //当前选择的标签 + spinning = false; // 加载状态 + active_tab_key = "All"; // 当前选择的标签 group_select_mode = false; - groups = ["1,2,28,7,33"]; //默认GH事业部 - filter_country=[];//筛选国籍 - filter_guest_type=[];//筛选客户关系 - site_select_mode = false; //是否多选站点 - include_tickets = "1"; //是否包含门票,1是含有,0不含 + groups = ["1,2,28,7,33"]; // 默认GH事业部 + filter_country=[];// 筛选国籍 + filter_guest_type=[];// 筛选客户关系 + site_select_mode = false; // 是否多选站点 + include_tickets = "1"; // 是否包含门票,1是含有,0不含 webcode = "ALL"; date_type = "ConfirmDate"; - ml_data = []; //毛利数据 - type_data = []; //类型的数据 - type_data_sub = []; //类型的子维度数据 - date_title = "date_title"; //日期段,只用于显示,防止日期选择控件的变化导致页面刷新 + ml_data = []; // 毛利数据 + type_data = []; // 类型的数据 + type_data_sub = []; // 类型的子维度数据 + date_title = "date_title"; // 日期段,只用于显示,防止日期选择控件的变化导致页面刷新 - //是否包含门票 + // 是否包含门票 handleChange_include_tickets = value => { this.include_tickets = value; }; - //选择事业部 + // 选择事业部 group_handleChange(value) { this.groups = value; } - //选择站点 + + // 选择站点 handleChange_webcode = value => { this.webcode = value; }; - //切换标签页 + // 切换标签页 onChange_Tabs(active_key) { this.active_tab_key = active_key; } - //下单日期或者出发日期 + // 下单日期或者出发日期 onChange_datetype(value) { this.date_type = value; } - //选择客源国 + // 选择客源国 onChange_Country(value) { this.filter_country = value; } - //选择成员关系 + + // 选择成员关系 onChange_GuestGroupType(value) { this.filter_guest_type = value; } - //获取业绩信息 + // 获取业绩信息 get_department_order_ml(date_moment) { let result = []; const date1_start = date_moment.start_date.format(config.DATE_FORMAT); @@ -103,9 +105,9 @@ class SaleStore { }); } - //按类型获取业绩 + // 按类型获取业绩 get_department_order_ml_by_type(date_moment) { - let result = { dataSource: [], columns: [] }; + const result = { dataSource: [], columns: [] }; const date1_start = date_moment.start_date.format(config.DATE_FORMAT); const date1_end = date_moment.end_date.format(config.DATE_FORMAT); const date2_start = comm.empty(date_moment.start_date_cp) ? "" : date_moment.start_date_cp.format(config.DATE_FORMAT); @@ -279,20 +281,20 @@ class SaleStore { ]; result.dataSource = json.result1; } else { - //if (this.active_tab_key == "Country") - //获取类型的项目,去掉重复,作为列名 - let type_name_arr = []; + // if (this.active_tab_key == "Country") + // 获取类型的项目,去掉重复,作为列名 + const type_name_arr = []; json.result1.map(item => { type_name_arr[item.SubTypeSN] = { SubTypeSN: item.SubTypeSN, SubTypeName: item.SubTypeName }; }); - let type_data = []; - let type_data_arr = []; + const type_data = []; + const type_data_arr = []; - for (let item of json.result1) { - let op_sn = "OP_" + item.OPI_SN; //顾问的SN - let items = json.result1.filter(d => d.OPI_SN == item.OPI_SN); //筛选出有当前顾问的记录 - let total_data_value = items.length ? items.reduce((a, b) => a + b.COLI_YJLY, 0) : ""; //记录累加 + for (const item of json.result1) { + const op_sn = "OP_" + item.OPI_SN; // 顾问的SN + const items = json.result1.filter(d => d.OPI_SN == item.OPI_SN); // 筛选出有当前顾问的记录 + const total_data_value = items.length ? items.reduce((a, b) => a + b.COLI_YJLY, 0) : ""; // 记录累加 if (comm.empty(type_data[op_sn])) { type_data[op_sn] = [{ key: item.OPI_SN }, { T_name: item.OPI_Name }, { T_total: total_data_value }]; } @@ -312,9 +314,9 @@ class SaleStore { { title: "合计", children: [{ title: type_data_arr.reduce((a, b) => a + b.T_total, 0), dataIndex: "T_total" }], sorter: (a, b) => b.T_total - a.T_total } ); Object.values(type_name_arr).map((item, index) => { - let data_index = "T_" + item.SubTypeSN; - let items = type_data_arr.filter(d => d[data_index]); //筛选出有对应类型的记录 - let total_data_value = items.length ? items.reduce((a, b) => a + b[data_index], 0) : ""; //记录累加 + const data_index = "T_" + item.SubTypeSN; + const items = type_data_arr.filter(d => d[data_index]); // 筛选出有对应类型的记录 + const total_data_value = items.length ? items.reduce((a, b) => a + b[data_index], 0) : ""; // 记录累加 result.columns.push({ title: item.SubTypeName, children: [{ title: total_data_value, dataIndex: data_index }], @@ -335,10 +337,10 @@ class SaleStore { }); } - //子维度查询 + // 子维度查询 get_department_order_ml_by_type_sub(date_moment, type_sub) { this.spinning = true; - let result = { dataSource: [], columns: [] }; + const result = { dataSource: [], columns: [] }; const date1_start = date_moment.start_date.format(config.DATE_FORMAT); const date1_end = date_moment.end_date.format(config.DATE_FORMAT); const date2_start = comm.empty(date_moment.start_date_cp) ? "" : date_moment.start_date_cp.format(config.DATE_FORMAT); @@ -388,11 +390,11 @@ class SaleStore { dataIndex: "COLI_Cycle", }, ]; - //数据处理,把相同类型放入同一个数组 - let type_data = []; + // 数据处理,把相同类型放入同一个数组 + const type_data = []; !comm.empty(json.result1) && Object.values(json.result1).map(item => { - let subtype_sn = "type_" + item.subType; + const subtype_sn = "type_" + item.subType; if (comm.empty(type_data[subtype_sn])) { type_data[subtype_sn] = { subType: item.subType, subType_name: item.subTypeVal, data: [item] }; } else { diff --git a/src/stores/Wechat.js b/src/stores/Wechat.js index 95e5204..810e563 100644 --- a/src/stores/Wechat.js +++ b/src/stores/Wechat.js @@ -1,4 +1,4 @@ -import {makeAutoObservable, runInAction} from "mobx" +import {makeAutoObservable, runInAction} from "mobx"; import * as config from "../config"; import * as req from '../utils/request'; diff --git a/src/stores/WhatsApp.js b/src/stores/WhatsApp.js index 320a259..3281ed5 100644 --- a/src/stores/WhatsApp.js +++ b/src/stores/WhatsApp.js @@ -1,4 +1,4 @@ -import {makeAutoObservable, runInAction} from "mobx" +import {makeAutoObservable, runInAction} from "mobx"; import * as config from "../config"; import * as req from '../utils/request'; diff --git a/src/utils/commons.js b/src/utils/commons.js index 210672f..d5fd7cb 100644 --- a/src/utils/commons.js +++ b/src/utils/commons.js @@ -6,14 +6,14 @@ import moment from "moment"; if (!String.prototype.padStart) { String.prototype.padStart = function padStart(targetLength, padString) { - targetLength = targetLength >> 0; //floor if number or convert non-number to 0; + targetLength = targetLength >> 0; // floor if number or convert non-number to 0; padString = String(typeof padString !== "undefined" ? padString : " "); if (this.length > targetLength) { return String(this); } else { targetLength = targetLength - this.length; if (targetLength > padString.length) { - padString += padString.repeat(targetLength / padString.length); //append to original to ensure we are longer than needed + padString += padString.repeat(targetLength / padString.length); // append to original to ensure we are longer than needed } return padString.slice(0, targetLength) + String(this); } @@ -48,10 +48,10 @@ export function formatPrice(price) { return Math.ceil(price).toLocaleString(); } -//千分符的金额转成数字,默认为0 +// 千分符的金额转成数字,默认为0 export function price_to_number(price) { - let num_string = (price + "").replace(/,/g, ""); - let number = parseFloat(num_string); + const num_string = (price + "").replace(/,/g, ""); + const number = parseFloat(num_string); return isNaN(number) ? 0 : number; } @@ -128,7 +128,7 @@ export class UrlBuilder { append(name, value) { if (isNotEmpty(value)) { - this.paramList.push({ name: name, value: value }); + this.paramList.push({ name, value }); } return this; } @@ -155,12 +155,12 @@ export function isEmpty(val) { } export function empty(a) { - if (a === "") return true; //检验空字符串 - if (a === "null") return true; //检验字符串类型的null - if (a === "undefined") return true; //检验字符串类型的 undefined - if (!a && a !== 0 && a !== "") return true; //检验 undefined 和 null - if (Array.prototype.isPrototypeOf(a) && a.length === 0) return true; //检验空数组 - if (Object.prototype.isPrototypeOf(a) && Object.keys(a).length === 0) return true; //检验空对象 + if (a === "") return true; // 检验空字符串 + if (a === "null") return true; // 检验字符串类型的null + if (a === "undefined") return true; // 检验字符串类型的 undefined + if (!a && a !== 0 && a !== "") return true; // 检验 undefined 和 null + if (Array.prototype.isPrototypeOf(a) && a.length === 0) return true; // 检验空数组 + if (Object.prototype.isPrototypeOf(a) && Object.keys(a).length === 0) return true; // 检验空对象 return false; } @@ -180,10 +180,10 @@ export function debounce(fn, delay = 500) { } export function throttle(fn, delay, atleast) { - let timeout = null, - startTime = new Date(); + let timeout = null; + let startTime = new Date(); return function () { - let curTime = new Date(); + const curTime = new Date(); clearTimeout(timeout); if (curTime - startTime >= atleast) { fn(); @@ -226,15 +226,15 @@ export function show_vs_tag(vs, vs_diff, data1, data2) { ); } -//数组去掉重复 +// 数组去掉重复 export function unique(arr) { - let x = new Set(arr); + const x = new Set(arr); return [...x]; } export function getWeek(date) { // 参数时间戳 - let week = moment(date).day(); + const week = moment(date).day(); switch (week) { case 1: return "周一"; @@ -253,12 +253,12 @@ export function getWeek(date) { } } -//把非数字下标的数组设置下标,因为非数字数组的length为0导致读取失败 +// 把非数字下标的数组设置下标,因为非数字数组的length为0导致读取失败 export function set_array_index(result) { - let result_array = []; - let result_keys = Object.keys(result); - result_keys.sort(); //必须做一次排序,用for in循环会导致顺序错误 - for (let key of result_keys) { + const result_array = []; + const result_keys = Object.keys(result); + result_keys.sort(); // 必须做一次排序,用for in循环会导致顺序错误 + for (const key of result_keys) { result_array.push(result[key]); } return result_array; diff --git a/src/views/AgentGroupCount.js b/src/views/AgentGroupCount.js index a45a90c..2b64d47 100644 --- a/src/views/AgentGroupCount.js +++ b/src/views/AgentGroupCount.js @@ -1,31 +1,28 @@ -import React, {useContext, useEffect} from 'react'; +import React, { useContext, useEffect } from 'react'; import { Row, Col, Typography, Space, DatePicker, Button, Select, Table, Divider } from 'antd'; -import { - SearchOutlined, -} from '@ant-design/icons'; -import { stores_Context } from '../config' -import * as config from "../config"; +import { SearchOutlined } from '@ant-design/icons'; +import { stores_Context } from '../config'; +import * as config from '../config'; import { observer } from 'mobx-react'; import 'moment/locale/zh-cn'; -import moment from "moment"; +import moment from 'moment'; import zhCNlocale from 'antd/es/date-picker/locale/zh_CN'; -import { utils, writeFileXLSX } from "xlsx"; +import { utils, writeFileXLSX } from 'xlsx'; const AgentGroupCount = () => { - - const {customerServicesStore} = useContext(stores_Context); + const { customerServicesStore } = useContext(stores_Context); const agentList = customerServicesStore.agentList; const agentGroupList = customerServicesStore.agentGroupList; const agentGroupListColumns = customerServicesStore.agentGroupListColumns; - const {startDate, endDate, dateType, inProgress} = customerServicesStore; + const { startDate, endDate, dateType, inProgress } = customerServicesStore; useEffect(() => { - customerServicesStore.fetchAllAgent(); - }, []); + customerServicesStore.fetchAllAgent(); + }, []); const handleSearchClick = () => { customerServicesStore.fetchAgentGroupCount(); - } + }; const renderAgentItem = (agent) => { return ( @@ -33,16 +30,16 @@ const AgentGroupCount = () => { {agent.VEI2_CompanyBN} ); - } + }; return ( <> - - customerServicesStore.selectCountry(value)} + > - 所有国家 + 所有国家 国内 @@ -96,7 +138,11 @@ const AgentGroupCount = () => { - customerServicesStore.selectDateType(value)} + > 走团日期 @@ -107,19 +153,28 @@ const AgentGroupCount = () => { { customerServicesStore.selectDateRange(dates[0], dates[1]) }} + onChange={(dates) => { + customerServicesStore.selectDateRange(dates[0], dates[1]); + }} ranges={{ '本周': [moment().startOf('week'), moment().endOf('week')], '上周': [moment().startOf('week').subtract(7, 'days'), moment().endOf('week').subtract(7, 'days')], '本月': [moment().startOf('month'), moment().endOf('month')], - '上个月': [moment().subtract(1, 'months').startOf('month'), moment(new Date()).subtract(1, 'months').endOf('month')], + '上个月': [ + moment().subtract(1, 'months').startOf('month'), + moment(new Date()).subtract(1, 'months').endOf('month'), + ], '近30天': [moment().subtract(30, 'days'), moment()], '近三个月': [moment().subtract(2, 'month').startOf('month'), moment().endOf('month')], '今年': [moment().startOf('year').subtract(1, 'month'), moment().endOf('year').subtract(1, 'month')], - '去年': [moment().subtract(1, 'year').startOf('year').subtract(1, 'month'), moment().subtract(1, 'year').endOf('year').subtract(1, 'month')], + '去年': [ + moment().subtract(1, 'year').startOf('year').subtract(1, 'month'), + moment().subtract(1, 'year').endOf('year').subtract(1, 'month'), + ], }} /> @@ -130,7 +185,8 @@ const AgentGroupCount = () => { loading={inProgress} onClick={() => { handleSearchClick(); - }}> + }} + > 统计 @@ -146,14 +202,17 @@ const AgentGroupCount = () => { rowKey={(record) => record.key} loading={inProgress} pagination={false} - scroll={{ x: "100%" }} + scroll={{ x: '100%' }} /> { - const wb = utils.table_to_book(document.getElementById("agentGroupList").getElementsByTagName("table")[0]); - writeFileXLSX(wb, "地接社团信息.xlsx"); - }}> + const wb = utils.table_to_book( + document.getElementById('agentGroupList').getElementsByTagName('table')[0] + ); + writeFileXLSX(wb, '地接社团信息.xlsx'); + }} + > 导出excel @@ -162,6 +221,6 @@ const AgentGroupCount = () => { ); -} +}; -export default observer(AgentGroupCount); \ No newline at end of file +export default observer(AgentGroupCount);