From fdddfe8db61b5f26ec42a16cac9892ef6d256610 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Thu, 8 Aug 2024 13:57:44 +0800 Subject: [PATCH 1/7] =?UTF-8?q?perf:=20=E4=BA=A7=E5=93=81=E7=AE=A1?= =?UTF-8?q?=E7=90=86:=20=E6=A0=91=E7=BB=84=E4=BB=B6=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/products/Detail/ProductsTree.jsx | 29 +++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/views/products/Detail/ProductsTree.jsx b/src/views/products/Detail/ProductsTree.jsx index d3aeae4..132356f 100644 --- a/src/views/products/Detail/ProductsTree.jsx +++ b/src/views/products/Detail/ProductsTree.jsx @@ -4,6 +4,7 @@ import { CaretDownOutlined } from '@ant-design/icons'; import { useTranslation } from 'react-i18next'; import useProductsStore from '@/stores/Products/Index'; import { useProductsTypes, useProductsAuditStatesMapVal } from '@/hooks/useProductsSets'; +import { groupBy, sortBy } from '@/utils/commons'; const flattenTreeFun = (tree) => { let flatList = []; @@ -52,6 +53,13 @@ const ProductsTree = ({ onNodeSelect, ...props }) => { // 只显示有产品的类型; // const title = text || r.lgc_details?.['2']?.title || r.lgc_details?.['1']?.title || ''; const hasDataTypes = Object.keys(agencyProducts); + // const cityData = groupBy(productsSortByHT, (row) => `${row.info.city_id}-${row.info.city_name}`); + const copyAgencyProducts = structuredClone(agencyProducts); + Object.keys(copyAgencyProducts).map((key) => { + const _cityProductsData = groupBy(copyAgencyProducts[key], (row) => `${row.info.city_name || '(空)'}`); + copyAgencyProducts[key] = _cityProductsData; + }); + // console.log(copyAgencyProducts); const _show = productsTypes .filter((kk) => hasDataTypes.includes(kk.value)) .map((ele) => ({ @@ -62,10 +70,20 @@ const ProductsTree = ({ onNodeSelect, ...props }) => { const lgc_map = product.lgc_details.reduce((rlgc, clgc) => ({...rlgc, [clgc.lgc]: clgc}), {}); return { title: product.info.title || lgc_map?.['2']?.title || lgc_map?.['1']?.title || '', + // title: `【${product.info.city_name}】` + (product.info.title || lgc_map?.['2']?.title || lgc_map?.['1']?.title || ''), // key: `${ele.value}-${product.info.id}`, key: product.info.id, _raw: product, + isLeaf: true, }}), + // 增加`城市`层级 + _children: Object.keys(copyAgencyProducts[ele.value] || []).map(city => { + return { + title: city, + key: `${ele.value}-${city}`, + children: copyAgencyProducts[ele.value][city], + }; + }), })); setTreeData(_show); setRawTreeData(_show); @@ -88,12 +106,17 @@ const ProductsTree = ({ onNodeSelect, ...props }) => { setSearchValue(value); setAutoExpandParent(true); }; - const handleNodeSelect = (_, { node }) => { + const handleNodeSelect = (selectedKeys, { node }) => { if (node._raw) { setEditingProduct(node._raw); + } else { + // 单击: 折叠/展开 + // const isExpand = expandedKeys.includes(selectedKeys[0]); + // const _keys = isExpand ? expandedKeys.filter(k => k !== node.key) : [].concat(expandedKeys, selectedKeys); + // setExpandedKeys(_keys); } if (typeof onNodeSelect === 'function') { - onNodeSelect(_, { node }); + onNodeSelect(selectedKeys, { node }); } }; const onExpand = (keys) => { @@ -123,7 +146,7 @@ const ProductsTree = ({ onNodeSelect, ...props }) => { } onSelect={handleNodeSelect} From ef8cda500237934d840a4f5b4da42f532b79b062 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Thu, 8 Aug 2024 15:51:38 +0800 Subject: [PATCH 2/7] =?UTF-8?q?perf:=20=E4=BA=A7=E5=93=81=E7=AE=A1?= =?UTF-8?q?=E7=90=86:=20form=20tooltip:=20new=20Product?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/locales/en/products.json | 55 +++++++++++++++++-- public/locales/zh/products.json | 25 ++++++--- src/hooks/useProductsSets.js | 2 +- src/views/products/Detail/NewProductModal.jsx | 18 ++++-- src/views/products/Detail/ProductInfoLgc.jsx | 7 ++- 5 files changed, 84 insertions(+), 23 deletions(-) diff --git a/public/locales/en/products.json b/public/locales/en/products.json index b468364..6ae1f9f 100644 --- a/public/locales/en/products.json +++ b/public/locales/en/products.json @@ -48,7 +48,7 @@ "OpenHours": "Open Hours", "Duration": "Duration", "KM": "KM", - "RecommendsRate": "RecommendsRate", + "RecommendsRate": "Recommends Rate", "OpenWeekdays": "Open Weekdays", "DisplayToC": "Display To C", "Dept": "Dept", @@ -120,16 +120,59 @@ "Type": "Product Type", "Title": "Title", "Code": "Code", - "City": "City", + "City": "起始城市,举例:北京", "Dept": "Department", - "Duration": "Duration", - "RecommendsRate": "RecommendsRate", + "Duration": "", + "RecommendsRate": "Recommends Rate", "OpenHours": "Open Hours", "OpenWeekdays": "Open Weekdays", "DisplayToC": "Display Type", - "KM": "KM", + "KM": "往返", "Description": "Description", - "Remarks": "Memo" + "Remarks": "", + "NewTitle": { + "6": "", + "B": "A点-B点,举例:桂林-龙胜", + "J": "A点-B点时长车费,举例:张家界5晚6天车费", + "Q": "城市语种导游工资单位,举例:北京英文导游工资(元/天/团)", + "7": "官方景点名称,举例:陕西历史博物馆", + "R": "普通、豪华、特色餐标,举例:普通餐标", + "8": "举例:故宫导游门票", + "D": "城市A点-B点时间包含内容,举例:北京市区一日游车导" + }, + "----Todo: 下面一组待定": "#", + "6": { + "Title": "", + "#": "" + }, + "B": { + "Title": "A点-B点,举例:桂林-龙胜", + "#": "" + }, + "J": { + "Title": "A点-B点时长车费,举例:张家界5晚6天车费", + "#": "" + }, + "Q": { + "Title": "城市语种导游工资单位,举例:北京英文导游工资(元/天/团)", + "#": "" + }, + "7": { + "Title": "官方景点名称,举例:陕西历史博物馆", + "#": "" + }, + "R": { + "Title": "普通、豪华、特色餐标,举例:普通餐标", + "#": "" + }, + "8": { + "Title": "举例:故宫导游门票", + "#": "" + }, + "D": { + "Title": "城市A点-B点时间包含内容,举例:北京市区一日游车导", + "#": "" + } }, "LgcModal": { diff --git a/public/locales/zh/products.json b/public/locales/zh/products.json index 1778f9d..50d586c 100644 --- a/public/locales/zh/products.json +++ b/public/locales/zh/products.json @@ -104,20 +104,31 @@ "Weekdays": "周末", "Operation": "Operation" }, - "FormTooltop": { + + "FormTooltip": { "Type": "Product Type", "Title": "Title", "Code": "Code", - "City": "City", - "dept": "Department", - "Duration": "Duration", - "RecommendsRate": "RecommendsRate", + "City": "起始城市,举例:北京", + "Dept": "Department", + "Duration": "", + "RecommendsRate": "Recommends Rate", "OpenHours": "Open Hours", "OpenWeekdays": "Open Weekdays", "DisplayToC": "Display Type", - "KM": "KM", + "KM": "往返", "Description": "Description", - "Remarks": "Remarks" + "Remarks": "", + "NewTitle": { + "6": "", + "B": "A点-B点,举例:桂林-龙胜", + "J": "A点-B点时长车费,举例:张家界5晚6天车费", + "Q": "城市语种导游工资单位,举例:北京英文导游工资(元/天/团)", + "7": "官方景点名称,举例:陕西历史博物馆", + "R": "普通、豪华、特色餐标,举例:普通餐标", + "8": "举例:故宫导游门票", + "D": "城市A点-B点时间包含内容,举例:北京市区一日游车导" + } }, "LgcModal": { diff --git a/src/hooks/useProductsSets.js b/src/hooks/useProductsSets.js index b4e9abb..1900465 100644 --- a/src/hooks/useProductsSets.js +++ b/src/hooks/useProductsSets.js @@ -145,7 +145,7 @@ export const useNewProductRecord = () => { 'dept_id': 0, 'dept_name': '', 'display_to_c': 0, - 'km': 0, + 'km': undefined, 'city_id': 0, 'city_name': '', 'open_hours': '', diff --git a/src/views/products/Detail/NewProductModal.jsx b/src/views/products/Detail/NewProductModal.jsx index 4903d4e..2315feb 100644 --- a/src/views/products/Detail/NewProductModal.jsx +++ b/src/views/products/Detail/NewProductModal.jsx @@ -17,15 +17,21 @@ export const NewProductsForm = ({ initialValues, onFormInstanceReady, ...props } onFormInstanceReady(form); }, []); - const onValuesChange = (changeValues, allValues) => {}; + const [pickType, setPickType] = useState({ value: "6"}); + const onValuesChange = (changeValues, allValues) => { + if ('products_type' in changeValues) { + setPickType(changeValues.products_type); + } + }; return (
- - + + - - + + {/* ${pickType.value} */} + ); @@ -84,7 +90,7 @@ export const NewProductModal = ({ source, action = '#' | 'o', open, onSubmit, on { forceRender: true, children: ( - + handleChange('title', e.target.value)} // disabled={ignoreEditable ? false : (!isEmpty(ele.title) || !editable)} // disabled={ignoreEditable ? false : !editable} @@ -86,8 +87,8 @@ const ProductInfoLgc = ({ editable, formInstance, ...props }) => { key: lgcItem.value, children: ( - - + + From 53407fa57a926abd8295b4dd5c1e9c73d1d922d6 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Thu, 8 Aug 2024 16:44:31 +0800 Subject: [PATCH 3/7] =?UTF-8?q?perf:=20=E4=BA=A7=E5=93=81=E7=AE=A1?= =?UTF-8?q?=E7=90=86:=20form=20:=20=E5=BF=85=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/products/Detail/ProductInfo.jsx | 2 +- src/views/products/Detail/ProductInfoForm.jsx | 25 ++++++++++++------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/views/products/Detail/ProductInfo.jsx b/src/views/products/Detail/ProductInfo.jsx index 87f148e..4065ef5 100644 --- a/src/views/products/Detail/ProductInfo.jsx +++ b/src/views/products/Detail/ProductInfo.jsx @@ -42,7 +42,7 @@ const ProductInfo = ({ ...props }) => { values.travel_agency_id = activeAgency.travel_agency_id; const copyNewProduct = structuredClone(newProductRecord); const poster = { - 'audit_state': '-1', + ...(topPerm ? {} : {'audit_state': '-1',}), // 高级权限: 不变更状态值 // "create_date": dayjs().format('YYYY-MM-DD HH:mm:ss'), // "created_by": userId, 'travel_agency_id': activeAgency.travel_agency_id, diff --git a/src/views/products/Detail/ProductInfoForm.jsx b/src/views/products/Detail/ProductInfoForm.jsx index c0fefe6..a35c483 100644 --- a/src/views/products/Detail/ProductInfoForm.jsx +++ b/src/views/products/Detail/ProductInfoForm.jsx @@ -1,5 +1,5 @@ import { useEffect, useState } from 'react'; -import { Form, Input, Row, Col, Select, Button, InputNumber, Checkbox } from 'antd'; +import { App, Form, Input, Row, Col, Select, Button, InputNumber, Checkbox } from 'antd'; import { objectMapper, isEmpty, isNotEmpty } from '@/utils/commons'; import { useTranslation } from 'react-i18next'; import { useWeekdays } from '@/hooks/useDatePresets'; @@ -12,6 +12,7 @@ import ProductInfoQuotation from './ProductInfoQuotation'; import { useHTLanguageSetsMapVal } from '@/hooks/useHTLanguageSets'; const InfoForm = ({ onSubmit, onReset, onValuesChange, editable: _editable, showSubmit, confirmText, formName, ...props }) => { + const { notification } = App.useApp(); const { t } = useTranslation('products'); const HTLanguageSetsMapVal = useHTLanguageSetsMapVal(); const [loading, editingProduct] = useProductsStore((state) => [state.loading, state.editingProduct]); @@ -31,7 +32,7 @@ const InfoForm = ({ onSubmit, onReset, onValuesChange, editable: _editable, show const [editable, setEditable] = useState(true); useEffect(() => { form.resetFields(); - form.setFieldValue('city', { value: editingProduct?.info?.city_id, label: editingProduct?.info?.city_name }); + form.setFieldValue('city', editingProduct?.info?.city_id ? { value: editingProduct?.info?.city_id, label: editingProduct?.info?.city_name } : undefined); 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); @@ -53,6 +54,12 @@ const InfoForm = ({ onSubmit, onReset, onValuesChange, editable: _editable, show const onFinishFailed = ({ values, errorFields }) => { console.log('form validate failed', '\nform values:', values, '\nerrorFields', errorFields); + notification.warning({ + message: '数据未填写完整', + // description: '数据未填写完整', + placement: 'top', + duration: 4, + }) }; const handleReset = () => { @@ -84,7 +91,7 @@ const InfoForm = ({ onSubmit, onReset, onValuesChange, editable: _editable, show onValuesChange={onIValuesChange} // onFieldsChange={onFieldsChange} initialValues={editingProduct?.info} - onFinishFailed={onFinishFailed}> + onFinishFailed={onFinishFailed} scrollToFirstError > {getFields({ sort, initialValue: editingProduct?.info, hides, shows, fieldProps, fieldComProps, form, t, dataSets: { weekdays }, editable })} {/* {showSubmit && ( @@ -196,8 +203,8 @@ function getFields(props) { item( 'city', 99, - - + + , fieldProps?.city?.col || midCol ), @@ -212,7 +219,7 @@ function getFields(props) { item( 'duration', 99, - + {/* */} , @@ -221,8 +228,8 @@ function getFields(props) { item( 'km', 99, - - + + , fieldProps?.km?.col || midCol ), @@ -297,7 +304,7 @@ function getFields(props) { 'remarks', 99, - + , fieldProps?.remarks?.col || 24 ), From d83f39efe6c0bb2c2ce1c7d8a4db33ee98aed73c Mon Sep 17 00:00:00 2001 From: Lei OT Date: Fri, 9 Aug 2024 13:47:50 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E4=BA=A7=E5=93=81=E7=AE=A1=E7=90=86:=20?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/locales/en/products.json | 1 + public/locales/zh/products.json | 1 + src/views/products/Detail/Header.jsx | 6 +-- src/views/products/Detail/ProductInfo.jsx | 38 ++++++++++++------- src/views/products/Detail/ProductInfoForm.jsx | 25 +++++++----- .../products/Detail/ProductInfoQuotation.jsx | 5 ++- 6 files changed, 48 insertions(+), 28 deletions(-) diff --git a/public/locales/en/products.json b/public/locales/en/products.json index 6ae1f9f..e5e841c 100644 --- a/public/locales/en/products.json +++ b/public/locales/en/products.json @@ -116,6 +116,7 @@ "Weekdays": "Weekdays" }, + "sureSubmitAudit": "确认提交所有产品审核? 提交后,所有产品将进入待审核流程. ", "FormTooltip": { "Type": "Product Type", "Title": "Title", diff --git a/public/locales/zh/products.json b/public/locales/zh/products.json index 50d586c..37cfb4f 100644 --- a/public/locales/zh/products.json +++ b/public/locales/zh/products.json @@ -105,6 +105,7 @@ "Operation": "Operation" }, + "sureSubmitAudit": "确认提交所有产品审核? 提交后,所有产品将进入待审核流程. ", "FormTooltip": { "Type": "Product Type", "Title": "Title", diff --git a/src/views/products/Detail/Header.jsx b/src/views/products/Detail/Header.jsx index 84d7bb0..493a207 100644 --- a/src/views/products/Detail/Header.jsx +++ b/src/views/products/Detail/Header.jsx @@ -181,10 +181,10 @@ const Header = ({ refresh, newActionable, ...props }) => { )} - {activeAgencyState === 0 && ( + {/* {activeAgencyState === 0 && ( */} <> - + - + + ) }, From 31abdfefea67718446d648b89911edfff0e60c46 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Fri, 9 Aug 2024 13:48:26 +0800 Subject: [PATCH 5/7] =?UTF-8?q?fix:=20=E8=AF=AD=E7=A7=8D=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/App.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/views/App.jsx b/src/views/App.jsx index 0ff7fa7..4323b0e 100644 --- a/src/views/App.jsx +++ b/src/views/App.jsx @@ -15,6 +15,8 @@ import useNoticeStore from '@/stores/Notice'; import useAuthStore from '@/stores/Auth'; import { useThemeContext } from '@/stores/ThemeContext'; import { usingStorage } from '@/hooks/usingStorage'; +import { useDefaultLgc } from '@/i18n/LanguageSwitcher'; +import { appendRequestParams } from '@/utils/request' import { PERM_ACCOUNT_MANAGEMENT, PERM_ROLE_NEW, PERM_OVERSEA, PERM_AIR_TICKET, PERM_PRODUCTS_MANAGEMENT } from '@/config'; @@ -63,9 +65,11 @@ function App() { defaultPath = splitPath[1] } + const { language } = useDefaultLgc(); const [antdLng, setAntdLng] = useState(enLocale); useEffect(() => { setAntdLng(i18n.language === 'en' ? enLocale : zhLocale); + appendRequestParams('lgc', language); }, [i18n.language]) return ( From 4829b0c12cfc95b7b0dbdc7fd6ff3333562b6b6d Mon Sep 17 00:00:00 2001 From: Lei OT Date: Fri, 9 Aug 2024 14:09:55 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E4=BA=A7=E5=93=81=E7=AE=A1=E7=90=86:=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/products/Detail.jsx | 2 -- src/views/products/Detail/Header.jsx | 8 ++--- src/views/products/Detail/NewProductModal.jsx | 33 ++++++++++++------- src/views/products/Detail/ProductInfo.jsx | 9 +++-- src/views/products/Detail/ProductInfoForm.jsx | 2 +- 5 files changed, 31 insertions(+), 23 deletions(-) diff --git a/src/views/products/Detail.jsx b/src/views/products/Detail.jsx index 6f55b5c..5967b20 100644 --- a/src/views/products/Detail.jsx +++ b/src/views/products/Detail.jsx @@ -60,8 +60,6 @@ function Detail() { - - setAddProductVisible(false)} onCancel={() => setAddProductVisible(false)} /> )} diff --git a/src/views/products/Detail/Header.jsx b/src/views/products/Detail/Header.jsx index 493a207..93beec6 100644 --- a/src/views/products/Detail/Header.jsx +++ b/src/views/products/Detail/Header.jsx @@ -12,6 +12,7 @@ import { PERM_PRODUCTS_OFFER_AUDIT, PERM_PRODUCTS_OFFER_PUT } from '@/config'; import dayjs from 'dayjs'; import VendorSelector from '@/components/VendorSelector'; import AuditStateSelector from '@/components/AuditStateSelector'; +import NewProductModal from './NewProductModal'; const Header = ({ refresh, newActionable, ...props }) => { const location = useLocation(); @@ -174,12 +175,7 @@ const Header = ({ refresh, newActionable, ...props }) => { {/* 编辑 */} {isEditPage && ( - - - + )} {/* {activeAgencyState === 0 && ( */} <> diff --git a/src/views/products/Detail/NewProductModal.jsx b/src/views/products/Detail/NewProductModal.jsx index 2315feb..3319910 100644 --- a/src/views/products/Detail/NewProductModal.jsx +++ b/src/views/products/Detail/NewProductModal.jsx @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react'; -import { Form, Modal, Input } from 'antd'; +import { Form, Modal, Input, Button } from 'antd'; import { objectMapper } from '@/utils/commons'; import { useTranslation } from 'react-i18next'; @@ -7,7 +7,8 @@ import ProductsTypesSelector from '@/components/ProductsTypesSelector'; import useProductsStore from '@/stores/Products/Index'; import { useNewProductRecord, useProductsTypesMapVal } from '@/hooks/useProductsSets'; import { useDefaultLgc } from '@/i18n/LanguageSwitcher'; -import dayjs from 'dayjs' +import RequireAuth from '@/components/RequireAuth'; +import { PERM_PRODUCTS_OFFER_PUT } from '@/config'; export const NewProductsForm = ({ initialValues, onFormInstanceReady, ...props }) => { const { t } = useTranslation('products'); @@ -17,7 +18,7 @@ export const NewProductsForm = ({ initialValues, onFormInstanceReady, ...props } onFormInstanceReady(form); }, []); - const [pickType, setPickType] = useState({ value: "6"}); + const [pickType, setPickType] = useState({ value: '6' }); const onValuesChange = (changeValues, allValues) => { if ('products_type' in changeValues) { setPickType(changeValues.products_type); @@ -60,12 +61,13 @@ const formValuesMapper = (values) => { /** * */ -export const NewProductModal = ({ source, action = '#' | 'o', open, onSubmit, onCancel, initialValues }) => { +export const NewProductModal = ({ initialValues }) => { const { t } = useTranslation(); const [formInstance, setFormInstance] = useState(); const [setEditingProduct] = useProductsStore((state) => [state.setEditingProduct]); const [switchParams] = useProductsStore((state) => [state.switchParams]); + const [open, setOpen] = useState(false); const [copyLoading, setCopyLoading] = useState(false); const productsTypesMapVal = useProductsTypesMapVal(); const newProduct = useNewProductRecord(); @@ -77,16 +79,24 @@ export const NewProductModal = ({ source, action = '#' | 'o', open, onSubmit, on copyNewProduct.info.product_type_name = productsTypesMapVal[param.products_type.value].label; copyNewProduct.lgc_details[0].lgc = language; copyNewProduct.lgc_details[0].title = param.title; - copyNewProduct.quotation[0].use_dates_start = (`${switchParams.use_year}-01-01`); - copyNewProduct.quotation[0].use_dates_end = (`${switchParams.use_year}-12-31`); + copyNewProduct.quotation[0].use_dates_start = `${switchParams.use_year}-01-01`; + copyNewProduct.quotation[0].use_dates_end = `${switchParams.use_year}-12-31`; setEditingProduct(copyNewProduct); - if (typeof onSubmit === 'function') { - onSubmit(); - } + // if (typeof onSubmit === 'function') { + // onSubmit(); + // } + setOpen(false); return false; }; return ( <> + + + + { - onCancel(); + // onCancel(); + setOpen(false); formInstance?.resetFields(); }} destroyOnClose @@ -111,8 +122,6 @@ export const NewProductModal = ({ source, action = '#' | 'o', open, onSubmit, on } }}> { setFormInstance(instance); diff --git a/src/views/products/Detail/ProductInfo.jsx b/src/views/products/Detail/ProductInfo.jsx index c6fe6eb..95e759a 100644 --- a/src/views/products/Detail/ProductInfo.jsx +++ b/src/views/products/Detail/ProductInfo.jsx @@ -9,6 +9,7 @@ import { isEmpty, pick } from '@/utils/commons'; import ProductInfoForm from './ProductInfoForm'; import { usingStorage } from '@/hooks/usingStorage'; import Extras from './Extras'; +import NewProductModal from './NewProductModal'; const ProductInfo = ({ ...props }) => { const { t } = useTranslation(); @@ -37,7 +38,7 @@ const ProductInfo = ({ ...props }) => { // console.log('editable', hasAuditPer, (notAudit && hasEditPer)); setInfoEditable(topPerm || (!hasHT && hasEditPer)); - const _priceEditable = [-1, 3].includes(activeAgency?.audit_state_id); + const _priceEditable = [-1, 3].includes(activeAgency?.audit_state_id) || isEmpty(editingProduct?.info?.id); setPriceEditable(topPerm || (_priceEditable && hasEditPer)); const showExtras = topPerm && hasHT; // !isEmpty(editingProduct) && @@ -98,7 +99,11 @@ const ProductInfo = ({ ...props }) => { ]} /> - {isEmpty(editingProduct) ? null : ( + {isEmpty(editingProduct) ? ( +
+ +
+ ) : ( <>

{t('products:EditComponents.info')}

diff --git a/src/views/products/Detail/ProductInfoForm.jsx b/src/views/products/Detail/ProductInfoForm.jsx index b3305b6..f7dff06 100644 --- a/src/views/products/Detail/ProductInfoForm.jsx +++ b/src/views/products/Detail/ProductInfoForm.jsx @@ -42,7 +42,7 @@ const InfoForm = ({ onSubmit, onReset, onValuesChange, editablePerm, infoEditabl setFormEditable(infoEditable || priceEditable); - const editable0 = isEmpty(editingProduct) ? false : editablePerm; // 空对象未操作 + // const editable0 = isEmpty(editingProduct) ? false : editablePerm; // 空对象未操作 setShowSave(infoEditable || priceEditable); // setEditable(editable0); return () => {}; From acaf5a3de7b7197af62517e06d7fdbb7a4a48ace Mon Sep 17 00:00:00 2001 From: Lei OT Date: Fri, 9 Aug 2024 14:10:19 +0800 Subject: [PATCH 7/7] # --- src/views/products/Detail/PriceCompactInput.jsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/views/products/Detail/PriceCompactInput.jsx b/src/views/products/Detail/PriceCompactInput.jsx index dd246bb..598ebc7 100644 --- a/src/views/products/Detail/PriceCompactInput.jsx +++ b/src/views/products/Detail/PriceCompactInput.jsx @@ -104,4 +104,6 @@ export const PriceCompactInput = (props) => { /> ) -} \ No newline at end of file +} + +export default PriceCompactInput