diff --git a/src/config.js b/src/config.js index d353614..8c7446c 100644 --- a/src/config.js +++ b/src/config.js @@ -4,27 +4,27 @@ import dayjs from "dayjs"; export const DATE_FORMAT = "YYYY-MM-DD"; export const DATE_PRESETS = [ { - label: "本周", + label: "This Week", value: [dayjs().startOf("w"), dayjs().endOf("w")], }, { - label: "上周", + label: "Last Week", value: [dayjs().startOf("w").subtract(7, "days"), dayjs().endOf("w").subtract(7, "days")], }, { - label: "本月", + label: "This Month", value: [dayjs().startOf("M"), dayjs().endOf("M")], }, { - label: "上个月", + label: "Last Month", value: [dayjs().subtract(1, "M").startOf("M"), dayjs().subtract(1, "M").endOf("M")], }, { - label: "近三月", + label: "Last Three Month", value: [dayjs().subtract(2, "M").startOf("M"), dayjs().endOf("M")], }, { - label: "今年", + label: "This Year", value: [dayjs().startOf("y"), dayjs().endOf("y")], }, // 本月: [dayjs().startOf("month"), moment().endOf("month")], diff --git a/src/stores/Feedback.js b/src/stores/Feedback.js index cafe688..cf014e0 100644 --- a/src/stores/Feedback.js +++ b/src/stores/Feedback.js @@ -1,5 +1,5 @@ import { makeAutoObservable, runInAction } from "mobx"; -import * as req from "@/utils/request"; +import { fetchJSON, postForm } from "@/utils/request"; import { prepareUrl } from "@/utils/commons"; import * as config from "@/config"; import dayjs from "dayjs"; @@ -34,19 +34,16 @@ class Feedback { this.loading = true; let url = `/service-Cooperate/Cooperate/SearchFeedbackList`; url += `?PageSize=2000&PageIndex=1&PageTotal=0&veisn=${veisn}&GruopNo=${EOI_Group_Name}&TimeStart=${TimeStart}&TimeEnd=${TimeEnd}`; - fetch(config.HT_HOST + url) - .then(response => response.json()) - .then(json => { - console.log(json); - runInAction(() => { - this.feedbackList = json.Result; - this.loading = false; - }); - }) - .catch(error => { + url += `&token=${this.root.authStore.login.token}`; + return fetchJSON(config.HT_HOST + url).then(json => { + runInAction(() => { + this.feedbackList = json.Result; this.loading = false; - console.log("fetch data failed", error); }); + if (json.errcode !== 0) { + throw new Error(json.errmsg + ": " + json.errcode); + } + }); } /* 查询反馈表信息 @@ -56,6 +53,7 @@ class Feedback { getFeedbackDetail(VEI_SN, GRI_SN) { let url = `/service-Cooperate/Cooperate/getFeedbackDetail`; url += `?GRI_SN=${GRI_SN}&VEI_SN=${VEI_SN}`; + url += `&token=${this.root.authStore.login.token}`; fetch(config.HT_HOST + url) .then(response => response.json()) .then(json => { @@ -74,6 +72,7 @@ class Feedback { getFeedbackImages(VEI_SN, GRI_SN) { let url = `/service-fileServer/ListFile`; url += `?GRI_SN=${GRI_SN}&VEI_SN=${VEI_SN}`; + url += `&token=${this.root.authStore.login.token}`; fetch(config.HT_HOST + url) .then(response => response.json()) .then(json => { @@ -98,6 +97,7 @@ class Feedback { getFeedbackInfo(VEI_SN, GRI_SN) { let url = `/service-Cooperate/Cooperate/getVEIFeedbackInfo`; url += `?GRI_SN=${GRI_SN}&VEI_SN=${VEI_SN}`; + url += `&token=${this.root.authStore.login.token}`; return fetch(config.HT_HOST + url) .then(response => response.json()) .then(json => { @@ -115,6 +115,7 @@ class Feedback { removeFeedbackImages(fileurl) { let url = `/service-fileServer/FileDelete`; url += `?fileurl=${fileurl}`; + url += `&token=${this.root.authStore.login.token}`; return fetch(config.HT_HOST + url) .then(response => response.json()) .then(json => { @@ -134,6 +135,7 @@ class Feedback { formData.append("GRI_SN", GRI_SN); formData.append("EOI_SN", EOI_SN); formData.append("FeedbackInfo", info_content); + formData.append("token", this.root.authStore.login.token); return fetch(config.HT_HOST + url, { method: "POST", body: formData, diff --git a/src/stores/Notice.js b/src/stores/Notice.js index 3a17be2..c2b15eb 100644 --- a/src/stores/Notice.js +++ b/src/stores/Notice.js @@ -17,6 +17,7 @@ class Notice { getBulletinList(LMI_SN) { let url = `/service-Cooperate/Cooperate/GetBulletinList`; url += `?LMI_SN=${LMI_SN}`; + url+=`&token=${this.root.authStore.login.token}`; fetch(config.HT_HOST + url) .then(response => response.json()) .then(json => { @@ -37,6 +38,7 @@ class Notice { getNoticeDetail(LMI_SN, CCP_BLID) { let url = `/service-Cooperate/Cooperate/GetBulletinDetail`; url += `?LMI_SN=${LMI_SN}&CCP_BLID=${CCP_BLID}`; + url+=`&token=${this.root.authStore.login.token}`; fetch(config.HT_HOST + url) .then(response => response.json()) .then(json => { @@ -54,6 +56,7 @@ class Notice { getBulletinUnReadCount(LMI_SN) { let url = `/service-Cooperate/Cooperate/GetBulletinUnReadCount`; url += `?LMI_SN=${LMI_SN}`; + url+=`&token=${this.root.authStore.login.token}`; fetch(config.HT_HOST + url) .then(response => response.json()) .then(json => { diff --git a/src/stores/Reservation.js b/src/stores/Reservation.js index 0705a94..ada1565 100644 --- a/src/stores/Reservation.js +++ b/src/stores/Reservation.js @@ -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; diff --git a/src/views/feedback/Detail.jsx b/src/views/feedback/Detail.jsx index 323a81e..b9cefd6 100644 --- a/src/views/feedback/Detail.jsx +++ b/src/views/feedback/Detail.jsx @@ -60,7 +60,7 @@ function Detail() { feedbackStore.postFeedbackInfo(feedbackInfo.EEF_VEI_SN, feedbackInfo.EEF_GRI_SN, feedbackInfo.EEF_EOI_SN, values.info_content).then(() => { notification.success({ message: `Notification`, - description: "提交成功", + description: "Submit Successful", placement: "top", duration: 4, }); @@ -141,7 +141,7 @@ function Detail() { - 站外好评 + External Reviews @@ -155,7 +155,7 @@ function Detail() { - 地接社的反馈 + Send Feedback @@ -164,7 +164,7 @@ function Detail() {
- 上传照片 + Upload photos - 地接社反馈信息 - + diff --git a/src/views/reservation/Newest.jsx b/src/views/reservation/Newest.jsx index 84fa80d..d628940 100644 --- a/src/views/reservation/Newest.jsx +++ b/src/views/reservation/Newest.jsx @@ -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); @@ -186,10 +189,10 @@ function Newest() { - Newest Reservations + - { reservationStore.updatePropertyValue('referenceNo', e.target.value)} } /> + { reservationStore.updatePropertyValue('referenceNo', e.target.value)} } /> @@ -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} />