From 0fc595256d7f27e0dba072ee9836102777f24d96 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Thu, 24 Aug 2023 16:28:36 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=B0=8F=E7=BB=84=E9=80=89=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libs/ht.js | 2 + src/stores/OrdersStore.js | 3 +- src/stores/SaleStore.js | 3 +- src/views/AgentGroupCount.jsx | 66 ++--------------------------- src/views/AgentGroupList.jsx | 54 ++++++++--------------- src/views/DestinationGroupCount.jsx | 30 +++---------- src/views/DestinationGroupList.jsx | 53 ++++++++--------------- 7 files changed, 49 insertions(+), 162 deletions(-) diff --git a/src/libs/ht.js b/src/libs/ht.js index ad23b01..d133d26 100644 --- a/src/libs/ht.js +++ b/src/libs/ht.js @@ -31,6 +31,8 @@ export const groups = [ { key: '30', label: 'Trippest', code: 'TP', children: [] }, { key: '31', label: '花梨鹰', code: '', children: [] }, ]; +export const groupsMappedByCode = groups.reduce((a, c) => ({ ...a, [String(c.code || c.key)]: c }), {}); + /** * 来源 */ diff --git a/src/stores/OrdersStore.js b/src/stores/OrdersStore.js index 58f2f87..f3f942d 100644 --- a/src/stores/OrdersStore.js +++ b/src/stores/OrdersStore.js @@ -5,6 +5,7 @@ import * as config from "../config"; import * as comm from "../utils/commons"; import moment from "moment"; import { NavLink } from "react-router-dom"; +import { groupsMappedByCode } from './../libs/ht'; class OrdersStore { constructor(rootStore) { @@ -15,7 +16,7 @@ class OrdersStore { loading = false; site_select_mode = false; // 是否多选站点 group_select_mode = false; - groups = ["1,2,28,7,33"]; + groups = [groupsMappedByCode.GH.key]; // 默认GH事业部 webcode = "ALL"; date_type = "applyDate"; include_tickets = "1"; // 是否包含门票,1是含有,0不含 diff --git a/src/stores/SaleStore.js b/src/stores/SaleStore.js index 5e29814..66baf58 100644 --- a/src/stores/SaleStore.js +++ b/src/stores/SaleStore.js @@ -3,6 +3,7 @@ import moment from "moment"; import * as config from "../config"; import * as comm from "../utils/commons"; import { NavLink } from "react-router-dom"; +import { groupsMappedByCode } from './../libs/ht'; // 销售数据 class SaleStore { @@ -16,7 +17,7 @@ class SaleStore { spinning = false; // 加载状态 active_tab_key = "All"; // 当前选择的标签 group_select_mode = false; - groups = ["1,2,28,7,33"]; // 默认GH事业部 + groups = [groupsMappedByCode.GH.key]; // 默认GH事业部 filter_country=[];// 筛选国籍 filter_guest_type=[];// 筛选客户关系 site_select_mode = false; // 是否多选站点 diff --git a/src/views/AgentGroupCount.jsx b/src/views/AgentGroupCount.jsx index 2b64d47..2cc8697 100644 --- a/src/views/AgentGroupCount.jsx +++ b/src/views/AgentGroupCount.jsx @@ -8,6 +8,7 @@ import 'moment/locale/zh-cn'; import moment from 'moment'; import zhCNlocale from 'antd/es/date-picker/locale/zh_CN'; import { utils, writeFileXLSX } from 'xlsx'; +import GroupSelect from './../components/search/GroupSelect'; const AgentGroupCount = () => { const { customerServicesStore } = useContext(stores_Context); @@ -56,69 +57,10 @@ const AgentGroupCount = () => { - + style={{ width: '95%' }} show_all={true} + /> customerServicesStore.selectTeam(value)} - > - 所有小组 - GH事业部 - 国际事业部 - 孵化学院 - CH直销 - CH大客户 - AH - 市场推广 - 德语 - 日语 - 法语 - 西语 - 俄语 - 意语 - 商旅 - CT - APP - Trippest - 花梨鹰 - - + style={{ width: '95%' }} show_all={true} + /> + - { {customerServicesStore.agentCompany} - record.key} - loading={inProgress} - pagination={false} +
record.key} + loading={inProgress} + pagination={false} scroll={{ x: "100%" }} expandable={{ expandedRowRender: (record) => ( @@ -136,7 +116,7 @@ const AgentGroupList = () => { - ); + ); }; export default observer(AgentGroupList); diff --git a/src/views/DestinationGroupCount.jsx b/src/views/DestinationGroupCount.jsx index c572919..69669af 100644 --- a/src/views/DestinationGroupCount.jsx +++ b/src/views/DestinationGroupCount.jsx @@ -10,6 +10,7 @@ import 'moment/locale/zh-cn'; import moment from "moment"; import zhCNlocale from 'antd/es/date-picker/locale/zh_CN'; import { utils, writeFileXLSX } from "xlsx"; +import GroupSelect from './../components/search/GroupSelect'; const DestinationGroupCount = () => { @@ -31,31 +32,10 @@ const DestinationGroupCount = () => { - + style={{ width: '95%' }} show_all={true} + /> customerServicesStore.selectTeam(value)} - > - 所有小组 - GH事业部 - 国际事业部 - 孵化学院 - CH直销 - CH大客户 - AH - 市场推广 - 德语 - 日语 - 法语 - 西语 - 俄语 - 意语 - 商旅 - CT - APP - Trippest - 花梨鹰 - + style={{ width: '95%' }} show_all={true} + /> - { -
record.key} - loading={inProgress} - pagination={false} +
record.key} + loading={inProgress} + pagination={false} scroll={{ x: "100%" }} expandable={{ expandedRowRender: (record) => ( @@ -135,7 +116,7 @@ const DestinationGroupList = () => { - ); + ); }; export default observer(DestinationGroupList);