From 05a4106fd80ab79b209ab8fddf10e34cf0a56b69 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Mon, 8 Jul 2024 16:41:12 +0800 Subject: [PATCH] =?UTF-8?q?conf:=20=E5=AE=A1=E6=A0=B8=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/products/Audit.jsx | 46 +++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/src/views/products/Audit.jsx b/src/views/products/Audit.jsx index 69f4722..9a7333a 100644 --- a/src/views/products/Audit.jsx +++ b/src/views/products/Audit.jsx @@ -6,7 +6,10 @@ import SecondHeaderWrapper from '@/components/SecondHeaderWrapper'; import { useTranslation } from 'react-i18next'; import useProductsStore, { postProductsQuoteAuditAction, } from '@/stores/Products/Index'; import { isEmpty } from '@/utils/commons'; +import useAuthStore from '@/stores/Auth'; +import RequireAuth from '@/components/RequireAuth'; // import PrintContractPDF from './PrintContractPDF'; +import { PERM_PRODUCTS_OFFER_AUDIT, PERM_PRODUCTS_OFFER_PUT } from '@/config'; const Header = ({ title, agency, refresh, ...props }) => { const { travel_agency_id, use_year, audit_state } = useParams(); @@ -35,20 +38,32 @@ const Header = ({ title, agency, refresh, ...props }) => { return (
-

{title}{(use_year || '').replace('all', '')}

+

+ {title} + + {(use_year || '').replace('all', '')} +

{/* */} {/* */} - {t('Edit')} - + + + {t('Edit')} + + + + + {/* */} - + + + {/* todo: export, 审核完成之后才能导出 */} {/* */} @@ -59,6 +74,7 @@ const Header = ({ title, agency, refresh, ...props }) => { const PriceTable = ({ productType, dataSource, refresh }) => { const { t } = useTranslation('products'); const { travel_agency_id, use_year, audit_state } = useParams(); + const isPermitted = useAuthStore(state => state.isPermitted); const [loading, activeAgency] = useProductsStore((state) => [state.loading, state.activeAgency]); const [setEditingProduct] = useProductsStore((state) => [state.setEditingProduct]); const { message, notification } = App.useApp(); @@ -96,7 +112,7 @@ const PriceTable = ({ productType, dataSource, refresh }) => { const columns = [ { key: 'title', dataIndex: ['info', 'title'], width: '16rem', title: t('Title'), onCell: (r, index) => ({ rowSpan: r.rowSpan, }), className: 'bg-white', render: (text, r) => { const title = text || r.lgc_details?.['2']?.title || r.lgc_details?.['1']?.title || ''; - return setEditingProduct(r.info)}>{title}; + return isPermitted(PERM_PRODUCTS_OFFER_PUT) ? setEditingProduct(r.info)}>{title} : title; } }, // ...(productType === 'B' ? [{ key: 'km', dataIndex: ['info', 'km'], title: t('KM')}] : []), { key: 'adult', title: t('AgeType.Adult'), render: (_, { adult_cost, currency, unit_id, unit_name }) => `${adult_cost} ${currency} / ${t(`PriceUnit.${unit_id}`)}` }, @@ -119,7 +135,7 @@ const PriceTable = ({ productType, dataSource, refresh }) => { key: 'state', title: t('State'), render: (_, r) => { - const stateCls = `text-${stateMapVal[`${r.audit_state_id}`]?.color} `; + const stateCls = ` text-${stateMapVal[`${r.audit_state_id}`]?.color} `; return {stateMapVal[`${r.audit_state_id}`]?.label}; }, }, @@ -128,10 +144,12 @@ const PriceTable = ({ productType, dataSource, refresh }) => { key: 'action', render: (_, r) => r.audit_state_id <= 0 ? ( - - - - + + + + + + ) : null, }, ];