获取变更计划所绑定的附件

release
Jimmy Liow 2 years ago
parent f55f65c2f1
commit 81a4ab819a

@ -53,23 +53,51 @@ class Reservation {
} }
fetchReservation(reservationId) { fetchReservation(reservationId) {
const fetchUrl = prepareUrl(HT_HOST + '/service-cusservice/GetPlanInfo') const fetchDetailUrl = prepareUrl(HT_HOST + '/service-cusservice/GetPlanInfo')
.append('VEI_SN', this.root.authStore.login.travelAgencyId) .append('VEI_SN', this.root.authStore.login.travelAgencyId)
.append('GRI_SN', reservationId) .append('GRI_SN', reservationId)
.append("token", this.root.authStore.login.token) .append("token", this.root.authStore.login.token)
.build(); .build();
// https://p9axztuwd7x8a7.mycht.cn/service-fileServer/PlanChangeFileList
const fetchAttachmentUrl = prepareUrl(HT_HOST + '/service-fileServer/PlanChangeFileList')
.append('GRI_SN', reservationId)
.append("token", this.root.authStore.login.token)
.build();
return fetchJSON(fetchUrl) const attachmentPromise = fetchJSON(fetchAttachmentUrl)
.then(json => {
if (json.errcode == 0) {
return json;
} else {
throw new Error(json.errmsg + ': ' + json.errcode);
}
});
const detailPromise = fetchJSON(fetchDetailUrl)
.then(json => { .then(json => {
if (json.errcode == 0) { if (json.errcode == 0) {
return json;
} else {
throw new Error(json.errmsg + ': ' + json.errcode);
}
});
return Promise.all([attachmentPromise, detailPromise])
.then(results => {
const attachList = results[0].result;
const planDetail = results[1].PlanDetail[0];
const planChange = results[1]?.PlanChange??[];
runInAction(() => { runInAction(() => {
this.reservationDetail = { this.reservationDetail = {
referenceNumber: json.PlanDetail[0].GRI_Name, referenceNumber: planDetail.GRI_Name,
tourGuide: json.PlanDetail[0].Guide, tourGuide: planDetail.Guide,
arrivalDate: json.PlanDetail[0].eoi_getdate, arrivalDate: planDetail.eoi_getdate,
reservationId: reservationId reservationId: reservationId
}; };
this.confirmationList = (json?.PlanChange??[]).map((data, index) => { this.confirmationList = planChange.map((data, index) => {
const filterAttchList = attachList.filter(attch => {
return attch.PCI_SN === data.PCI_SN;
});
return { return {
key: data.PCI_SN, key: data.PCI_SN,
PCI_Changetext: data.PCI_Changetext, PCI_Changetext: data.PCI_Changetext,
@ -77,14 +105,11 @@ class Reservation {
ConfirmPerson: data.ConfirmPerson, ConfirmPerson: data.ConfirmPerson,
PCI_ConfirmText: data.PCI_ConfirmText, PCI_ConfirmText: data.PCI_ConfirmText,
PCI_ConfirmDate: data.PCI_ConfirmDate, PCI_ConfirmDate: data.PCI_ConfirmDate,
VAS_SN: data.PCI_VAS_SN VAS_SN: data.PCI_VAS_SN,
attachmentList: filterAttchList
} }
}); });
}); });
return json;
} else {
throw new Error(json.errmsg + ': ' + json.errcode);
}
}); });
} }

@ -2,7 +2,10 @@ import { useParams, useNavigate } from "react-router-dom";
import { useEffect, useState } from 'react'; import { useEffect, useState } from 'react';
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import { toJS } from "mobx"; import { toJS } from "mobx";
import { Row, Col, Space, Button, Table, Input, Typography, Modal, App } from 'antd'; import { Row, Col, Space, Button, Table, Input, Typography, Modal, Tag, App } from 'antd';
import {
FileOutlined
} from '@ant-design/icons';
import { useStore } from '@/stores/StoreContext.js'; import { useStore } from '@/stores/StoreContext.js';
const { Title, Paragraph } = Typography; const { Title, Paragraph } = Typography;
@ -23,6 +26,10 @@ function Detail() {
title: 'Confirmation Details', title: 'Confirmation Details',
dataIndex: 'PCI_ConfirmText', dataIndex: 'PCI_ConfirmText',
}, },
{
title: 'Attachments',
render: attachmentRender
},
{ {
title: 'Confirmation Date', title: 'Confirmation Date',
dataIndex: 'PCI_ConfirmDate', dataIndex: 'PCI_ConfirmDate',
@ -33,6 +40,18 @@ function Detail() {
}, },
]; ];
function attachmentRender(text, confirm) {
return (
<>
{confirm.attachmentList.map(attch => {
return (
<Tag bordered={false} icon={<FileOutlined />}><a href={attch.file_url} target="_blank">{attch.file_name}</a></Tag>
)}
)}
</>
);
}
function confirmRender(text, confirm) { function confirmRender(text, confirm) {
return ( return (
<Button type="link" onClick={() => showConfirmModal(confirm)}>Confirm</Button> <Button type="link" onClick={() => showConfirmModal(confirm)}>Confirm</Button>

Loading…
Cancel
Save