perf: 编辑好评初始化团、城市信息

main
LiaoYijun 6 months ago
parent e121682eba
commit 136919ac77

@ -1,6 +1,6 @@
{
"ArrivalDate": "Arrival Date",
"RefNo": "Reference number",
"RefNo": "Reference Number",
"unconfirmed": "Unconfirmed",
"Pax": "Pax",
"Status": "Status",

@ -153,6 +153,17 @@ function ReviewList() {
const searchReview = (submitValues) => {
setDataLoading(true);
fetchReviewList(submitValues, travelAgencyId)
.then((result) => {
//
const currentGroupList = result.map((r) => ({ value: r.referenceId, label: r.referenceNumber }))
const mergedGroupList = [...currentGroupList,...groupListOptions]
const uniqueMergedGroupList = Array.from(
new Map(mergedGroupList.map(item => [item.value, item])).values()
)
setGroupListOptions(
uniqueMergedGroupList
);
})
.catch((ex) => {
notification.error({
message: `Notification`,
@ -162,11 +173,24 @@ function ReviewList() {
});
})
.finally(() => {
setDataLoading(false);
});
setDataLoading(false)
})
}
const initCityList = async (referenceId) => {
const cityList = await fetchCityList(travelAgencyId, referenceId);
setCityListOptions(
cityList.map((city) => {
return {
value: city.CII_SN,
label: city.CityName,
};
})
);
};
const onReviewSeleted = async (review) => {
initCityList(review.referenceId)
// Form.Item DatePicker
review.datePosted = dayjs(review.datePosted);
formReview.setFieldsValue(review);
@ -249,16 +273,8 @@ function ReviewList() {
showSearch
placeholder="Select a Reference Number"
optionFilterProp="children"
onChange={async (groupId) => {
const cityList = await fetchCityList(travelAgencyId, groupId);
setCityListOptions(
cityList.map((city) => {
return {
value: city.CII_SN,
label: city.CityName,
};
})
);
onChange={referenceId => {
initCityList(referenceId)
}}
filterOption={(input, option) =>
(option?.label ?? "")
@ -342,6 +358,7 @@ function ReviewList() {
<Row>
<Col span={24}>
<Table
rowKey={record => record.reviewId}
bordered
loading={dataLoading}
pagination={{

Loading…
Cancel
Save