From e8e4efe7967433797506fbfa002e836828cde8f2 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Fri, 3 Nov 2023 14:34:18 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=BA=94=E7=94=A8=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E7=BB=84=E4=BB=B6:=20=E5=AE=A2=E8=BF=90,=20=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/charts/Customer_care_inchina.jsx | 69 +++++++++-------------- src/charts/Customer_care_potential.jsx | 70 ++++++++++-------------- src/charts/Customer_care_regular.jsx | 70 ++++++++++-------------- src/charts/Orders.jsx | 8 +-- src/components/search/SearchForm.jsx | 4 +- src/components/search/SiteSelect.jsx | 7 ++- src/libs/ht.js | 2 + src/stores/CustomerStore.js | 26 +++++++++ src/views/Orders.jsx | 8 +-- src/views/Orders_sub.jsx | 76 +++++++++----------------- src/views/Sale.jsx | 14 ++--- 11 files changed, 151 insertions(+), 203 deletions(-) diff --git a/src/charts/Customer_care_inchina.jsx b/src/charts/Customer_care_inchina.jsx index 13cd8cb..0a7ba91 100644 --- a/src/charts/Customer_care_inchina.jsx +++ b/src/charts/Customer_care_inchina.jsx @@ -1,19 +1,9 @@ import React, {useContext, useEffect} from 'react'; -import {Row, Col, Button, Divider, Table, Space, Radio, Tooltip} from 'antd'; -import { - ContainerOutlined, - SearchOutlined, -} from '@ant-design/icons'; +import {Row, Col, Divider, Table} from 'antd'; import {stores_Context} from '../config'; -import {Line} from "@ant-design/charts"; import {observer} from 'mobx-react'; -import DatePickerCharts from '../components/search/DatePickerCharts'; -import {NavLink, useParams} from "react-router-dom"; -import * as comm from "../utils/commons"; -import * as config from "../config"; -import SiteSelect from "../components/search/SiteSelect"; -import GroupSelect from "../components/search/GroupSelect"; import {utils, writeFileXLSX} from "xlsx"; +import SearchForm from './../components/search/SearchForm'; const Customer_care_inchina = () => { @@ -27,38 +17,33 @@ const Customer_care_inchina = () => { return (
- - + + + { + customer_store.setSearchValues(obj, form, 'inchina_data'); + customer_store.inchina_customer_order(); + customer_store.inchina_customer_order(true); + }} + /> + +

在华客人

- - - - - - - - - - - - 提交日期 - 出发日期 - 确认日期 - - - - - - - - { const wb = utils.table_to_book(document.getElementById("table_to_xlsx").getElementsByTagName('table')[0]); writeFileXLSX(wb, "在华客人.xlsx"); }}>导出excel -
{ @@ -21,43 +11,39 @@ const Customer_care_potential = () => { const potential_data = customer_store.potential_data; useEffect(() => { - }, []); return (
- -
+ + + { + customer_store.setSearchValues(obj, form, 'potential_data'); + customer_store.potential_customer_order(); + customer_store.potential_customer_order(true); + }} + /> + +

潜力客户

- - - - - - - - - - - 预定日期 - 出发日期 - 确认日期 - - - - - - - + {/* */} -
{ const wb = utils.table_to_book(document.getElementById("table_to_xlsx").getElementsByTagName('table')[0]); writeFileXLSX(wb, "潜力客户.xlsx"); }}>导出excel -
{ @@ -27,37 +17,33 @@ const Customer_care_regular = () => { return (
- -
+ + + { + customer_store.setSearchValues(obj, form, 'regular_data'); + customer_store.regular_customer_order(); + customer_store.regular_customer_order(true); + }} + /> + +

老客户

- - - - - - - - - - - 预定日期 - 出发日期 - 确认日期 - - - - - - - -
{ const wb = utils.table_to_book(document.getElementById("table_to_xlsx").getElementsByTagName('table')[0]); writeFileXLSX(wb, "老客户.xlsx"); }}>导出excel -
{ 'WebCode': { key: 'WebCode', transform: (value) => { - return Array.isArray(value) ? value.map((ele) => ele.key).join(',') : value ? value.key : ''; + return isEmpty(value) ? 'ALL': Array.isArray(value) ? value.map((ele) => ele.key).filter(ele => ele !== 'ALL').join(',') : value ? value.key : ''; }, default: '', }, diff --git a/src/components/search/SiteSelect.jsx b/src/components/search/SiteSelect.jsx index b5406f7..832b47e 100644 --- a/src/components/search/SiteSelect.jsx +++ b/src/components/search/SiteSelect.jsx @@ -13,13 +13,14 @@ class SiteSelect extends Component { const { store, mode, value, onChange, show_all, ...extProps } = this.props; const _mode = mode || store?.group_select_mode || null; const _show_all = ['tags', 'multiple'].includes(_mode) ? false : show_all; + const _value = !['tags', 'multiple'].includes(_mode) ? (value || store?.webcode || undefined) : (value || store?.webcode || []).filter(item => item.value !== 'ALL'); return (
); diff --git a/src/libs/ht.js b/src/libs/ht.js index 89eb3ca..0704ebe 100644 --- a/src/libs/ht.js +++ b/src/libs/ht.js @@ -57,6 +57,7 @@ export const groups = [ { value: '31', key: '31', label: '花梨鹰', code: '', children: [] }, ]; export const groupsMappedByCode = groups.reduce((a, c) => ({ ...a, [String(c.code || c.key)]: c }), {}); +export const groupsMappedByKey = groups.reduce((a, c) => ({ ...a, [String(c.key)]: c }), {}); export const leafGroup = groups.slice(3); export const overviewGroup = groups.slice(0, 3); // todo: 花梨鹰 APP Trippest /** @@ -87,6 +88,7 @@ export const sites = [ { value: '30', key: '30', label: 'TP', code: 'trippest' }, { value: '31', key: '31', label: '花梨鹰', code: 'HLY' }, ]; +export const sitesMappedByCode = sites.reduce((a, c) => ({ ...a, [String(c.code)]: {...c, key: c.code, value: c.code } }), {}); export const dateTypes = [ { key: 'applyDate', value: 'applyDate', label: '提交日期' }, { key: 'ConfirmDate', value: 'ConfirmDate', label: '确认日期' }, diff --git a/src/stores/CustomerStore.js b/src/stores/CustomerStore.js index bfc715a..727b790 100644 --- a/src/stores/CustomerStore.js +++ b/src/stores/CustomerStore.js @@ -1,5 +1,6 @@ import {makeAutoObservable, runInAction} from "mobx"; import * as config from "../config"; +import { groupsMappedByKey, dataFieldAlias, sitesMappedByCode } from './../libs/ht'; class CustomerStore { @@ -79,6 +80,12 @@ 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), + + searchValues: { + DepartmentList: ['1', '2', '7'].map(kk => groupsMappedByKey[kk]), + WebCode: ['GHKYZG'].map(kk => sitesMappedByCode[kk]), + DateType: { key: 'applyDate', label: '提交日期'}, + }, }; // 潜力客户 end @@ -152,6 +159,12 @@ 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), + + searchValues: { + DepartmentList: ['1', '2', '28', '7'].map(kk => groupsMappedByKey[kk]), + WebCode: undefined, // ['ALL'].map(kk => sitesMappedByCode[kk]), + DateType: { key: 'applyDate', label: '提交日期'}, + }, }; // 老客户 end @@ -225,9 +238,22 @@ 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), + + searchValues: { + DepartmentList: ['1', '2', '28', '7'].map(kk => groupsMappedByKey[kk]), + WebCode: undefined, // ['ALL'].map(kk => sitesMappedByCode[kk]), + DateType: { key: 'applyDate', label: '提交日期'}, + }, }; // 在华客人 end + setSearchValues(obj, values, target) { + this[target].groups = obj.DepartmentList; + this[target].webcode = obj.WebCode; + this[target].include_tickets = obj.IncludeTickets; + this[target].date_type = obj.DateType; + } + } diff --git a/src/views/Orders.jsx b/src/views/Orders.jsx index aee44ed..817a2c8 100644 --- a/src/views/Orders.jsx +++ b/src/views/Orders.jsx @@ -1,13 +1,9 @@ import React, { Component } from "react"; -import { Row, Col, Button, Tabs, Table, Divider, Select, Radio, Spin } from "antd"; -import { ContainerOutlined, CarryOutOutlined, BlockOutlined, SmileOutlined, TagsOutlined, GlobalOutlined, SearchOutlined, FullscreenOutlined, DingtalkOutlined } from "@ant-design/icons"; +import { Row, Col, Tabs, Table, Divider, Spin } from "antd"; +import { ContainerOutlined, BlockOutlined, SmileOutlined, TagsOutlined, GlobalOutlined, FullscreenOutlined, DingtalkOutlined } from "@ant-design/icons"; import { stores_Context } from "../config"; import { Line, Pie } from "@ant-design/charts"; -import SiteSelect from "../components/search/SiteSelect"; -import GroupSelect from "../components/search/GroupSelect"; -import DataTypeSelect from "../components/search/DataTypeSelect"; import { observer } from "mobx-react"; -import DatePickerCharts from "../components/search/DatePickerCharts"; import * as config from "../config"; import { NavLink } from "react-router-dom"; import * as comm from "../utils/commons"; diff --git a/src/views/Orders_sub.jsx b/src/views/Orders_sub.jsx index e8e9bd8..453ec5d 100644 --- a/src/views/Orders_sub.jsx +++ b/src/views/Orders_sub.jsx @@ -1,18 +1,15 @@ import React, { useContext, useEffect } from "react"; -import { Row, Col, Button, Tabs, Table, Select, Divider } from "antd"; -import { ContainerOutlined, SearchOutlined } from "@ant-design/icons"; +import { Row, Col, Tabs, Table, Divider } from "antd"; +import { ContainerOutlined } from "@ant-design/icons"; import { stores_Context } from "../config"; import { Line } from "@ant-design/charts"; import { observer } from "mobx-react"; -import DatePickerCharts from "../components/search/DatePickerCharts"; -import SiteSelect from "../components/search/SiteSelect"; -import GroupSelect from "../components/search/GroupSelect"; -import DataTypeSelect from "../components/search/DataTypeSelect"; import { NavLink, useParams } from "react-router-dom"; import * as comm from "../utils/commons"; import * as config from "../config"; import { utils, writeFileXLSX } from "xlsx"; import DateGroupRadio from '../components/DateGroupRadio'; +import SearchForm from './../components/search/SearchForm'; const Orders_sub = () => { const { ordertype, ordertype_sub, ordertype_title } = useParams(); @@ -184,49 +181,27 @@ const Orders_sub = () => { 返回 - - - - - - - - - - - - - - - - - - - - - - - - - - - + + { + orders_store.setSearchValues(obj, form); + orders_store.getOrderCount_type(ordertype, ordertype_sub); + orders_store.getOrderCountByType_sub(ordertype, ordertype_sub, orders_store.active_tab_key_sub); + }} + /> + { fieldMapper={orders_store.orderCount_type_dateRadio.orderCountDataFieldMapper} /> + + + diff --git a/src/views/Sale.jsx b/src/views/Sale.jsx index e343529..16de43c 100644 --- a/src/views/Sale.jsx +++ b/src/views/Sale.jsx @@ -1,16 +1,10 @@ -import React, { useContext, useEffect } from 'react'; -import { Row, Col, Button, Tabs, Table, Divider, Radio, Select, Spin } from 'antd'; -import { ContainerOutlined, SearchOutlined, UserSwitchOutlined } from '@ant-design/icons'; +import React, { useContext } from 'react'; +import { Row, Col, Tabs, Table, Divider, Spin } from 'antd'; +import { ContainerOutlined, UserSwitchOutlined } from '@ant-design/icons'; import { stores_Context } from '../config'; -import { Column, Pie, Treemap } from '@ant-design/charts'; +import { Column, Pie } from '@ant-design/charts'; import { observer } from 'mobx-react'; -import DatePickerCharts from '../components/search/DatePickerCharts'; -import DataTypeSelect from '../components/search/DataTypeSelect'; -import { NavLink, useParams } from 'react-router-dom'; import * as comm from '../utils/commons'; -import * as config from '../config'; -import SiteSelect from '../components/search/SiteSelect'; -import GroupSelect from '../components/search/GroupSelect'; import { utils, writeFileXLSX } from 'xlsx'; import SearchForm from './../components/search/SearchForm';