解决Back导致刷新;解决导游为空出错

release
Jimmy Liow 2 years ago
parent 00b8fba222
commit f29e656b89

@ -80,21 +80,6 @@ class Reservation {
});
}
// get confirmationList() {
// return computed(() => {
// return json.PlanChange.map((data, index) => {
// return {
// key: data.PCI_SN,
// PCI_Changetext: data.PCI_Changetext,
// PCI_SendDate: data.PCI_SendDate,
// ConfirmPerson: data.ConfirmPerson,
// PCI_ConfirmText: data.PCI_ConfirmText,
// PCI_ConfirmDate: data.PCI_ConfirmDate
// }
// });
// }).get();
// }
fetchCityList(reservationId) {
const fetchUrl = prepareUrl(HT_HOST + '/service-cusservice/PTGetCityGuide')
.append('VEI_SN', this.root.authStore.login.travelAgencyId)
@ -106,7 +91,7 @@ class Reservation {
.then(json => {
runInAction(() => {
if (json.errcode == 0) {
this.cityList = json.Result.map((data, index) => {
this.cityList = (json?.Result ?? []).map((data, index) => {
return {
key: data.CII_SN,
cityId: data.CII_SN,
@ -124,14 +109,15 @@ class Reservation {
fetchGuideList() {
const fetchUrl = prepareUrl(HT_HOST + '/service-cusservice/PTGetGuideList')
.append('VEI_SN', 628)//this.root.authStore.login.travelAgencyId)
.append('VEI_SN', this.root.authStore.login.travelAgencyId)
.build();
return fetchJSON(fetchUrl)
.then(json => {
runInAction(() => {
if (json.errcode == 0) {
this.guideList = json.Result.map((data, index) => {
console.info(json.Result);
this.guideList = (json?.Result ?? []).map((data, index) => {
return {
guideId: data.TGI_SN,
guideName: data.TGI2_Name,

@ -121,7 +121,7 @@ function Detail() {
<Title level={4}>Reference Number: {reservationDetail.referenceNumber}; Arrival date: {reservationDetail.arrivalDate};</Title>
</Col>
<Col span={4}>
<Button type="link" onClick={() => navigate('/reservation/newest')}>Back</Button>
<Button type="link" onClick={() => navigate('/reservation/newest?back')}>Back</Button>
</Col>
</Row>
<Row gutter={{ md: 24 }}>

@ -1,5 +1,5 @@
import { NavLink } from "react-router-dom";
import { useState, useRef, useEffect } from 'react';
import { NavLink, useLocation } from "react-router-dom";
import { useState, useEffect } from 'react';
import { observer } from "mobx-react";
import { toJS } from "mobx";
import { Row, Col, Space, Button, Table, Input, Typography, DatePicker, Radio, Modal, App, Select } from 'antd';
@ -73,7 +73,7 @@ function Newest() {
allowClear
placeholder="Select a guide"
optionFilterProp="children"
defaultValue={city.tourGuideId}
defaultValue={guideSelectOptions.length == 0 ? null : city.tourGuideId}
onChange={(guideId) => {
reservationStore.setupCityGuide(city.cityId, guideId);
}}
@ -88,8 +88,7 @@ function Newest() {
);
}
// const href = useHref();
// const isMountedRef = useRef(false);
const location = useLocation();
const { reservationStore } = useStore();
const { reservationList, reservationPage, referenceNo, arrivalDateRange, cityList, guideList } = reservationStore;
const [isModalOpen, setIsModalOpen] = useState(false);
@ -106,10 +105,14 @@ function Newest() {
}
});
useEffect(() => {
onSearchClick();
console.info('Newest...');
}, [123]);
useEffect (() => {
if (location.search !== '?back') {
onSearchClick();
}
return () => {
console.info('unmount...');
};
}, []);
const showCityGuideModal = (reservation) => {
setDataLoading(true);

Loading…
Cancel
Save