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: '总间夜',