From d6320d700b1d1924f23782b719e92c3465e75aa8 Mon Sep 17 00:00:00 2001 From: Ycc Date: Mon, 7 Jul 2025 16:08:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=A0=E9=80=92=E8=BD=A6=E7=A5=A8=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E5=88=B0=E5=90=8E=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ImageUploader.jsx | 14 +++++++++++++- src/stores/Trainticket.js | 3 ++- src/views/trainticket/plan.jsx | 25 ++++++++++++++----------- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/components/ImageUploader.jsx b/src/components/ImageUploader.jsx index b08c89b..3437e70 100644 --- a/src/components/ImageUploader.jsx +++ b/src/components/ImageUploader.jsx @@ -95,6 +95,10 @@ const ImageUploader = props => { setIsLoading(true); const images = await getImageList(key); setFileList(images); + if (props.onChange) { + //作用是回调函数,给外面的组件传递数据 + props.onChange(images); + } setIsLoading(false); }; @@ -107,7 +111,11 @@ const ImageUploader = props => { const handleDelete = async file => { const success = await deleteImage(file.encrypt_key); if (success) { - setFileList(prevList => prevList.filter(item => item.key !== file.key)); + const newImages = fileList.filter(item => item.encrypt_key !== file.encrypt_key); + if (props.onChange) { + props.onChange(newImages); + } + setFileList(newImages); console.log("删除成功"); } else { console.error("删除失败"); @@ -125,6 +133,9 @@ const ImageUploader = props => { key, (response, file) => { getImageList(key).then(newImages => { + if (props.onChange) { + props.onChange(newImages); + } setFileList(prevList => { // 找到当前正在上传的文件并移除 const index = prevList.findIndex(item => item.status === "uploading"); @@ -136,6 +147,7 @@ const ImageUploader = props => { // 将新增元素添加到过滤后的列表末尾 return [...newPrevList, ...newItems]; } + return prevList; }); }); diff --git a/src/stores/Trainticket.js b/src/stores/Trainticket.js index d83371e..5366915 100644 --- a/src/stores/Trainticket.js +++ b/src/stores/Trainticket.js @@ -172,13 +172,14 @@ const trainTicketStore = create((set, get) => ({ }); }, //通知顾问查看车票信息 - async ticketIssuedNotifications(LMI_SN, CLF_SN, OPI_SN, FlightMemo_messages) { + async ticketIssuedNotifications(LMI_SN, CLF_SN, OPI_SN, FlightMemo_messages,ticketImages) { const searchParams = { CLF_SN: CLF_SN, OPI_SN: OPI_SN, LMI_SN: LMI_SN, ServiceType: 2, FlightMemo_messages: FlightMemo_messages, + ticketImages: JSON.stringify(ticketImages), }; const { errcode, result } = await fetchJSON(`${HT_HOST}/Service_BaseInfoWeb/TicketIssuedNotifications`, searchParams); const _result = errcode !== 0 ? [] : result; diff --git a/src/views/trainticket/plan.jsx b/src/views/trainticket/plan.jsx index 7933724..c57c1a4 100644 --- a/src/views/trainticket/plan.jsx +++ b/src/views/trainticket/plan.jsx @@ -245,7 +245,9 @@ const TrainticketPlan = props => { - + @@ -272,15 +274,6 @@ const TrainticketPlan = props => { - - 车票图片 - - - - - - -
{ }} initialValues={{ ...trainInfo }} onFinish={values => { - ticketIssuedNotifications(userId, trainInfo.CLF_SN, trainInfo.OPI_SN, values.FlightMemo_messages) + ticketIssuedNotifications(userId, trainInfo.CLF_SN, trainInfo.OPI_SN, values.FlightMemo_messages,values.ticketImages) .then(() => { notification.success({ message: `成功`, @@ -314,6 +307,16 @@ const TrainticketPlan = props => { }); }} autoComplete="off"> + 车票图片 + + + + fileList}> + + + + + 出票完成通知