From c03a8fd1fef59ecf49672efa904f3c65e07740af Mon Sep 17 00:00:00 2001 From: Lei OT Date: Mon, 5 Aug 2024 11:06:14 +0800 Subject: [PATCH] =?UTF-8?q?Revert=20"=E4=BA=A7=E5=93=81=E7=AE=A1=E7=90=86:?= =?UTF-8?q?=20=E7=BC=96=E8=BE=91:=20=E4=BB=85=E4=BF=A1=E6=81=AF,=20?= =?UTF-8?q?=E5=A4=9A=E8=AF=AD=E7=A7=8D"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit aae952f5e33d9fe29c12f55b7012eb13a05a3049. --- src/views/products/Detail/ProductInfo.jsx | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/views/products/Detail/ProductInfo.jsx b/src/views/products/Detail/ProductInfo.jsx index be29df2..79f0eb0 100644 --- a/src/views/products/Detail/ProductInfo.jsx +++ b/src/views/products/Detail/ProductInfo.jsx @@ -53,7 +53,7 @@ const ProductInfo = ({ ...props }) => { const copyFields = pick(editingProduct.info, ['product_type_id']); // 'title', const readyToSubInfo = { ...copyNewProduct.info, ...editingProduct.info, ...values.info, ...copyFields, type: copyFields.product_type_id, ...poster }; // console.log('onSave', editingProduct.info, readyToSubInfo); - const prevLgcDetailsMapped = editingProduct.lgc_details.reduce((r, c) => ({ ...r, [c.lgc]: { ...c, description: c.descriptions } }), {}); + const prevLgcDetailsMapped = editingProduct.lgc_details.reduce((r, c) => ({ ...r, [c.lgc]: { ...c, description: c.descriptions } }), {}); // todo: description字段不一致 const mergedLgc = { ...prevLgcDetailsMapped, ...values.lgc_details_mapped }; /** quotation */ @@ -67,18 +67,13 @@ const ProductInfo = ({ ...props }) => { travel_agency_id: activeAgency.travel_agency_id, info: readyToSubInfo, lgc_details: Object.values(mergedLgc), - // 新增: 需要默认年份数据一条; 编辑: 仅提交信息数据 - // ...(isEmpty(readyToSubInfo.id) ? { quotation: Object.values(mergedQ) } : {}), quotation: Object.values(mergedQ), }); setLoading(false); success ? message.success(t('Success')) : message.error(t('Failed')); // 保存后更新数据 - const _result = structuredClone(result); - // _result.quotation = editingProduct.quotation; - // const title = result.info.title || result.lgc_details?.['2']?.title || result.lgc_details?.['1']?.title || ''; - appendNewProduct(_result); - setEditingProduct(_result); + appendNewProduct(result); + setEditingProduct(result); }; return ( <>