|
|
|
@ -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 (
|
|
|
|
|
<>
|
|
|
|
|