From d978f1e28070e42e94563077789e4d26b2157f79 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Tue, 16 Sep 2025 16:11:31 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=AE=A2=E6=9C=8D-=E9=85=92=E5=BA=97:?= =?UTF-8?q?=20=E7=AD=9B=E9=80=89=E7=BB=93=E6=9E=9C:=20=E5=9F=8E=E5=B8=82?= =?UTF-8?q?=E5=90=8D=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/stores/HotelCruise.js | 6 ++++-- src/views/Hotel.jsx | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/stores/HotelCruise.js b/src/stores/HotelCruise.js index 3b1ea38..60656c4 100644 --- a/src/stores/HotelCruise.js +++ b/src/stores/HotelCruise.js @@ -157,9 +157,11 @@ class HotelCruise { {} ); summaryDelta.RecommendRateDelta = queryParam.Compare === '0' ? undefined : fixTo2Decimals((summaryRow.RecommendRate - (summaryRow.CPRecommendRate || 0)) * 100); + const resfilter = resCP.map(row => ({text: row.CityName, value: row.CityName})).sort((a, b) => a.text.localeCompare(b.text)); runInAction(() => { this.hotel.loading = false; this.hotel.dataSource = resCP; + this.hotel.filters = resfilter; this.hotel.summaryRow = { ...summaryRow, ...summaryDelta }; }); } @@ -181,8 +183,8 @@ class HotelCruise { this.searchValuesToSub = obj; } - cruise = { loading: false, dataSource: [], summaryRow: {} }; - hotel = { loading: false, dataSource: [], summaryRow: {} }; + cruise = { loading: false, dataSource: [], summaryRow: {}, filters: [] }; + hotel = { loading: false, dataSource: [], summaryRow: {}, filters: [] }; resetData = () => { this.results.loading = false; for (const key of Object.keys(this.results)) { diff --git a/src/views/Hotel.jsx b/src/views/Hotel.jsx index 1ea44f3..1d6135a 100644 --- a/src/views/Hotel.jsx +++ b/src/views/Hotel.jsx @@ -9,7 +9,7 @@ const { Text } = Typography; export default observer((props) => { const { date_picker_store: searchFormStore } = useContext(stores_Context); const { date_picker_store, HotelCruiseStore } = useContext(stores_Context); - const { loading, dataSource, summaryRow } = HotelCruiseStore.hotel; + const { loading, dataSource, summaryRow, filters } = HotelCruiseStore.hotel; const { formValues, siderBroken } = searchFormStore; @@ -25,6 +25,9 @@ export default observer((props) => { title: '目的地', sorter: (a, b) => a.CityName.localeCompare(b.CityName, 'zh-CN'), children: [{ title: summaryRow.CityName, dataIndex: 'CityName', key: 'CityName' }], + filters: filters, + onFilter: (value, record) => record.CityName === value, + filterSearch: true, }, { title: '总间夜',