diff --git a/src/views/App.jsx b/src/views/App.jsx index 6800622..4665957 100644 --- a/src/views/App.jsx +++ b/src/views/App.jsx @@ -71,6 +71,10 @@ function App() { } } + // 地接和客服权限不同,产品管理页面也不同 + const isProductPermitted = isPermitted(PERM_PRODUCTS_MANAGEMENT) || isPermitted(PERM_PRODUCTS_INFO_PUT) + const productLink = isPermitted(PERM_PRODUCTS_MANAGEMENT) ? '/products' : '/products/edit' + return ( {t('menu.Feedback')} } : null, isPermitted(PERM_OVERSEA) ? { key: 'report', label: {t('menu.Report')} } : null, isPermitted(PERM_AIR_TICKET) ? { key: 'airticket', label: {t('menu.Airticket')} } : null, - isPermitted(PERM_PRODUCTS_MANAGEMENT) ? { key: 'products', label: {t('menu.Products')} } : null, - isPermitted(PERM_PRODUCTS_INFO_PUT) ? { key: 'products', label: {t('menu.Products')} } : null, + isProductPermitted ? { key: 'products', label: {t('menu.Products')} } : null, { key: 'notice', label: ( diff --git a/src/views/products/Detail/ProductsTree.jsx b/src/views/products/Detail/ProductsTree.jsx index 65cff51..fff21cd 100644 --- a/src/views/products/Detail/ProductsTree.jsx +++ b/src/views/products/Detail/ProductsTree.jsx @@ -1,4 +1,5 @@ import { createContext, useEffect, useState } from 'react'; +import { useLocation } from 'react-router-dom'; import { Tree, Input, Divider } from 'antd'; import { CaretDownOutlined } from '@ant-design/icons'; import { useTranslation } from 'react-i18next'; @@ -42,7 +43,7 @@ const getParentKey = (key, tree) => { const ProductsTree = ({ onNodeSelect, ...props }) => { const { t } = useTranslation(); - + const location = useLocation(); const isEditPage = location.pathname.includes('edit'); const [agencyProducts, editingProduct, setEditingProduct] = useProductsStore((state) => [state.agencyProducts, state.editingProduct, state.setEditingProduct]); const [activeAgency] = useProductsStore((state) => [state.activeAgency]);