From a66ed759f8c3345a1ecfd53d63ca1108f9bf2b25 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Tue, 13 Jan 2026 16:28:45 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E8=80=81=E5=AE=A2=E6=88=B7.=20?= =?UTF-8?q?=E6=98=8E=E7=BB=86;=20-->zustand?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/charts/Customer_care_regular.jsx | 72 +++++++++++++++++++++------- src/zustand/CustomerRelations.js | 5 +- 2 files changed, 57 insertions(+), 20 deletions(-) diff --git a/src/charts/Customer_care_regular.jsx b/src/charts/Customer_care_regular.jsx index a3fec65..1facca9 100644 --- a/src/charts/Customer_care_regular.jsx +++ b/src/charts/Customer_care_regular.jsx @@ -11,13 +11,13 @@ import { TableExportBtn, RenderVSDataCell } from '../components/Data'; import useCustomerRelationsStore from '../zustand/CustomerRelations'; import { useShallow } from 'zustand/shallow'; -import { fixTo2Decimals } from '@haina/utils-commons'; +import { fixTo2Decimals, isEmpty } from '@haina/utils-commons'; const Customer_care_regular = () => { const { date_picker_store, customer_store } = useContext(stores_Context); const regular_data = customer_store.regular_data; - const [loading, loading2, searchValues, ] = useCustomerRelationsStore(useShallow((state) => [state.loading, state.loading2, state.searchValues,])); + const [loading, loading2, searchValues, searchValuesToSub] = useCustomerRelationsStore(useShallow((state) => [state.loading, state.loading2, state.searchValues, state.searchValuesToSub])); const [setSearchValues] = useCustomerRelationsStore(useShallow((state) => [state.setSearchValues])); const [regular] = useCustomerRelationsStore(useShallow((state) => [state.regular])); @@ -284,14 +284,15 @@ const Customer_care_regular = () => { key: 'OrderNum', render: (text, record, index) => ( <> - - {/* {text} */} -    - { - - {index === 0 && regular.total_data_tips !== '' && } - - } + + {index === 0 && regular.total_data_tips !== '' && ( + <> +    + + + + + )} ), }, @@ -299,49 +300,84 @@ const Customer_care_regular = () => { title: '订单数占比', dataIndex: 'OrderRate', key: 'OrderRate', - render: (text, record) => + render: (text, record) => ( + + ), }, { title: '订单数占比(市场)', dataIndex: 'OrderRate2', key: 'OrderRate2', - render: (text, record) => + render: (text, record) => ( + + ), }, { title: '成行数', dataIndex: 'SUCOrderNum', key: 'SUCOrderNum', - render: (text, record) => + render: (text, record) => , }, { title: '成行率', dataIndex: 'SUCRate', key: 'SUCRate', - render: (text, record) => + render: (text, record) => ( + + ), }, { title: '毛利', dataIndex: 'ML', key: 'ML', - render: (text, record) => + render: (text, record) => , }, { title: '毛利占比', dataIndex: 'OrderMLRate', key: 'OrderMLRate', - render: (text, record) => + render: (text, record) => ( + + ), }, { title: '毛利占比(市场)', dataIndex: 'OrderMLRate2', key: 'OrderMLRate2', - render: (text, record) => + render: (text, record) => ( + + ), }, { title: '人数(含成人+儿童)', dataIndex: 'PersonNum', key: 'PersonNum', - render: (text, record) => + render: (text, record) => , }, ]} size="small" diff --git a/src/zustand/CustomerRelations.js b/src/zustand/CustomerRelations.js index e832d61..5ec9a23 100644 --- a/src/zustand/CustomerRelations.js +++ b/src/zustand/CustomerRelations.js @@ -26,7 +26,7 @@ export const fetchRegularCustomer = async (params) => { ...params, }; const { WebCode, DepartmentList, DateType, Date1, Date2, ...readyParams } = _params; - const [result1, result2] = await Promise.all([ + const [result1=[], result2=[]] = await Promise.all([ fetchJSON(HT_HOST + '/service-tourdesign/RegularCusOrder', { ...defaultParams, ...readyParams }), ...(params.DateDiff1 && params.IsDetail === 0 ? [ @@ -55,7 +55,6 @@ export const fetchRegularCustomer = async (params) => { x[key] = { ...(result1Mapped?.[key] || { ItemName: key }), diff: result2Mapped[key] || {} }; }); ret.result1 = Object.values(x); - console.log(ret); return { result1: ret.result1 }; // { result1, result2 }; }; @@ -154,10 +153,12 @@ const useCustomerRelationsStore = create( state.regular.pivotX = pivotByDate; state.regular.pivotY = pivotByOrder; } else { + console.log('0000'); state.regular.data = result1; } }); } catch (error) { + console.error(error); } finally { setLoading(false); IsDetail === 1 && setLoading2(false);