更新分配导游会显示错误

release
Jimmy Liow 2 years ago
parent 0352fc9f5d
commit 3c62ca03ab

@ -93,6 +93,9 @@ class Reservation {
.append('LGC', 1) .append('LGC', 1)
.build(); .build();
runInAction(() => {
this.cityList = [];
});
return fetchJSON(fetchUrl) return fetchJSON(fetchUrl)
.then(json => { .then(json => {
runInAction(() => { runInAction(() => {
@ -145,19 +148,18 @@ class Reservation {
return fetchJSON(fetchUrl) return fetchJSON(fetchUrl)
.then(json => { .then(json => {
runInAction(() => { if (json.errcode == 0) {
if (json.errcode == 0) { const guideList = (json?.Result??[]).map((data, index) => {
this.cityGuideList = (json?.Result??[]).map((data, index) => { return {
return { guideId: data.TGI_SN,
guideId: data.TGI_SN, guideName: data.TGI2_Name,
guideName: data.TGI2_Name, mobileNo: data.TGI_Mobile
mobileNo: data.TGI_Mobile }
} });
}); return guideList;
} else { } else {
throw new Error(json.errmsg + ': ' + json.errcode); throw new Error(json.errmsg + ': ' + json.errcode);
} }
});
}); });
} }
@ -211,7 +213,6 @@ class Reservation {
}); });
} }
cityGuideList = [];
cityList = []; cityList = [];
selectedReservation = null; selectedReservation = null;

@ -98,22 +98,27 @@ function Newest() {
} }
const location = useLocation(); const location = useLocation();
const { reservationStore } = useStore();
const { reservationList, reservationPage, referenceNo, arrivalDateRange, cityList, cityGuideList } = reservationStore;
const [isModalOpen, setIsModalOpen] = useState(false); const [isModalOpen, setIsModalOpen] = useState(false);
const [dataLoading, setDataLoading] = useState(false); const [dataLoading, setDataLoading] = useState(false);
const [guideSelectOptions, setGuideSelectOptions] = useState([]);
const { reservationStore } = useStore();
const { reservationList, reservationPage, referenceNo, arrivalDateRange, cityList } = reservationStore;
const { notification } = App.useApp(); const { notification } = App.useApp();
const guideSelectOptions = cityGuideList.map((data, index) => {
return {
value: data.guideId,
label: data.guideName
}
});
useEffect (() => { useEffect (() => {
if (location.search !== '?back') { if (location.search !== '?back') {
// //
onSearchClick(1, 1); onSearchClick(1, 1);
reservationStore.fetchAllGuideList()
.then((guideList) => {
const selectOptions = guideList.map((data, index) => {
return {
value: data.guideId,
label: data.guideName
}
});
setGuideSelectOptions(selectOptions);
});
} }
return () => { return () => {
// unmount... // unmount...
@ -124,7 +129,6 @@ function Newest() {
setDataLoading(true); setDataLoading(true);
setIsModalOpen(true); setIsModalOpen(true);
reservationStore.editReservation(reservation); reservationStore.editReservation(reservation);
reservationStore.fetchAllGuideList();
reservationStore.fetchCityList(reservation.reservationId) reservationStore.fetchCityList(reservation.reservationId)
.catch(ex => { .catch(ex => {
notification.error({ notification.error({

Loading…
Cancel
Save