Merge branch 'main' of github.com:hainatravel/GHHub

release
YCC 2 years ago
commit c4c940ee52

@ -108,7 +108,32 @@ class Reservation {
});
}
fetchGuideList() {
updateReservationGuide() {
const fetchUrl = prepareUrl(HT_HOST + '/service-cusservice/PTGetCityGuide')
.append('VEI_SN', this.root.authStore.login.travelAgencyId)
.append('GRI_SN', this.selectedReservation.reservationId)
.append('LGC', 1)
.build();
return fetchJSON(fetchUrl)
.then(json => {
if (json.errcode == 0) {
const reservationGuide = (json?.Result??[]).filter((data) => {
return data.TGI_SN != 0;
}).map((data) => {
return data.GuideName;
}).join(',');
runInAction(() => {
this.selectedReservation.guide = reservationGuide;
});
return reservationGuide;
} else {
throw new Error(json.errmsg + ': ' + json.errcode);
}
});
}
fetchAllGuideList() {
const fetchUrl = prepareUrl(HT_HOST + '/service-cusservice/PTGetGuideList')
.append('VEI_SN', this.root.authStore.login.travelAgencyId)
.build();
@ -117,8 +142,7 @@ class Reservation {
.then(json => {
runInAction(() => {
if (json.errcode == 0) {
console.info(json.Result);
this.guideList = (json?.Result??[]).map((data, index) => {
this.cityGuideList = (json?.Result??[]).map((data, index) => {
return {
guideId: data.TGI_SN,
guideName: data.TGI2_Name,
@ -144,7 +168,9 @@ class Reservation {
return postForm(postUrl, formData)
.then(json => {
console.info(json);
if (json.errcode != 0) {
throw new Error(json.errmsg + ': ' + json.errcode);
}
});
}
@ -183,7 +209,7 @@ class Reservation {
});
}
guideList = [];
cityGuideList = [];
cityList = [];
selectedReservation = null;

@ -73,7 +73,7 @@ function Newest() {
allowClear
placeholder="Select a guide"
optionFilterProp="children"
defaultValue={guideSelectOptions.length == 0 ? null : city.tourGuideId}
defaultValue={(guideSelectOptions.length == 0 || city.tourGuideId == 0) ? null : city.tourGuideId}
onChange={(guideId) => {
reservationStore.setupCityGuide(city.cityId, guideId);
}}
@ -90,11 +90,11 @@ function Newest() {
const location = useLocation();
const { reservationStore } = useStore();
const { reservationList, reservationPage, referenceNo, arrivalDateRange, cityList, guideList } = reservationStore;
const { reservationList, reservationPage, referenceNo, arrivalDateRange, cityList, cityGuideList } = reservationStore;
const [isModalOpen, setIsModalOpen] = useState(false);
const [dataLoading, setDataLoading] = useState(false);
const { notification } = App.useApp();
const guideSelectOptions = guideList.map((data, index) => {
const guideSelectOptions = cityGuideList.map((data, index) => {
return {
value: data.guideId,
label: data.guideName
@ -110,11 +110,11 @@ function Newest() {
};
}, []);
const showCityGuideModal = (reservation) => {
const showCityGuideModal = (reservation) => {
setDataLoading(true);
setIsModalOpen(true);
reservationStore.editReservation(reservation);
reservationStore.fetchGuideList();
reservationStore.fetchAllGuideList();
reservationStore.fetchCityList(reservation.reservationId)
.catch(ex => {
notification.error({
@ -129,8 +129,11 @@ function Newest() {
});
};
const handleOk = () => {
setIsModalOpen(false);
setDataLoading(false);
reservationStore.updateReservationGuide()
.finally(() => {
setIsModalOpen(false);
setDataLoading(false);
});
};
const handleCancel = () => {
setIsModalOpen(false);
@ -222,7 +225,7 @@ function Newest() {
simple: true
}}
onChange={(pagination, filters, sorter, extra) => {onSearchClick(pagination.current);}}
columns={reservationListColumns} dataSource={toJS(reservationList)}
columns={reservationListColumns} dataSource={reservationList}
/>
</Col>
</Row>

Loading…
Cancel
Save