From cb0c2a9e8ea45b9fce090e9c1a7afeee18986dba Mon Sep 17 00:00:00 2001 From: Lei OT Date: Thu, 8 Aug 2024 09:35:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=93=81=E7=AE=A1=E7=90=86:=20?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=8A=A5=E4=BB=B7=E6=95=B0=E6=8D=AE;=20?= =?UTF-8?q?=E4=BA=A7=E5=93=81=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/locales/en/products.json | 4 ++-- src/hooks/useProductsSets.js | 2 +- src/views/products/Detail/ProductInfo.jsx | 3 ++- src/views/products/Detail/ProductInfoForm.jsx | 18 ++++++++---------- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/public/locales/en/products.json b/public/locales/en/products.json index 02689b7..b468364 100644 --- a/public/locales/en/products.json +++ b/public/locales/en/products.json @@ -56,7 +56,7 @@ "productProject": "Product project", "Code": "Code", "City": "City", - "Remarks": "Remarks", + "Remarks": "Memo", "tourTime": "Tour time", "recommendationRate": "Recommends rate", "Name": "Name", @@ -129,7 +129,7 @@ "DisplayToC": "Display Type", "KM": "KM", "Description": "Description", - "Remarks": "Remarks" + "Remarks": "Memo" }, "LgcModal": { diff --git a/src/hooks/useProductsSets.js b/src/hooks/useProductsSets.js index b83efad..b4e9abb 100644 --- a/src/hooks/useProductsSets.js +++ b/src/hooks/useProductsSets.js @@ -101,7 +101,7 @@ export const useProductsAuditStatesMapVal = (value) => { export const useProductsTypesFieldsets = (type) => { const [isPermitted] = useAuthStore((state) => [state.isPermitted]); const infoDefault = [['city'], ['title']]; - const infoAdmin = ['title', 'code', 'remarks', 'dept']; // 'display_to_c' + const infoAdmin = ['title', 'product_title', 'code', 'remarks', 'dept']; // 'display_to_c' const infoDisplay = isPermitted(PERM_PRODUCTS_MANAGEMENT) ? ['display_to_c'] : []; const infoRecDisplay = isPermitted(PERM_PRODUCTS_MANAGEMENT) ? ['recommends_rate'] : []; const infoTypesMap = { diff --git a/src/views/products/Detail/ProductInfo.jsx b/src/views/products/Detail/ProductInfo.jsx index 99806fc..87f148e 100644 --- a/src/views/products/Detail/ProductInfo.jsx +++ b/src/views/products/Detail/ProductInfo.jsx @@ -64,7 +64,7 @@ const ProductInfo = ({ ...props }) => { travel_agency_id: activeAgency.travel_agency_id, info: readyToSubInfo, lgc_details: Object.values(mergedLgc), - quotation: values.quotation, + quotation: values.quotation, // || editingProduct.quotation, // 没改动, 就用原来的 }).catch(ex => { setLoading(false); notification.error({ @@ -77,6 +77,7 @@ const ProductInfo = ({ ...props }) => { setLoading(false); success ? message.success(t('Success')) : message.error(t('Failed')); // 保存后更新数据 + // result.quotation = isEmpty(result.quotation) ? editingProduct.quotation : result.quotation; appendNewProduct(result); setEditingProduct(result); }; diff --git a/src/views/products/Detail/ProductInfoForm.jsx b/src/views/products/Detail/ProductInfoForm.jsx index c99cdef..68ef83f 100644 --- a/src/views/products/Detail/ProductInfoForm.jsx +++ b/src/views/products/Detail/ProductInfoForm.jsx @@ -35,6 +35,7 @@ const InfoForm = ({ onSubmit, onReset, onValuesChange, editable: _editable, show form.setFieldValue('dept', { value: editingProduct?.info?.dept_id, label: editingProduct?.info?.dept_name }); const lgc_details_mapped = (editingProduct?.lgc_details || []).reduce((r, c) => ({ ...r, [c.lgc]: c }), {}); form.setFieldValue('lgc_details_mapped', lgc_details_mapped); + form.setFieldValue('quotation', editingProduct?.quotation); const editable0 = isEmpty(editingProduct) ? false : _editable; // 空对象未操作 setEditable(editable0); @@ -135,7 +136,7 @@ const InfoForm = ({ onSubmit, onReset, onValuesChange, editable: _editable, show )} - + @@ -176,12 +177,12 @@ function getFields(props) { let baseChildren = []; baseChildren = [ item( - 'title', + 'product_title', 99, - - + + , - fieldProps?.title?.col || midCol + fieldProps?.product_title?.col || midCol ), item( 'code', @@ -392,13 +393,10 @@ const formValuesMapper = (values) => { }, }, ], - 'quotation_mapped': { - key: 'quotation', - transform: value => value - }, + 'product_title': { key: 'title' }, }; let dest = {}; - const { city, ...omittedValue } = values; + const { city, product_title, ...omittedValue } = values; dest = { ...omittedValue, ...objectMapper(values, destinationObject) }; for (const key in dest) { if (Object.prototype.hasOwnProperty.call(dest, key)) {