|
|
|
@ -15,6 +15,7 @@ import AuditStateSelector from '@/components/AuditStateSelector';
|
|
|
|
|
|
|
|
|
|
const Header = ({ refresh, newActionable, ...props }) => {
|
|
|
|
|
const location = useLocation();
|
|
|
|
|
const isEditPage = location.pathname.includes('edit');
|
|
|
|
|
const showEditA = !location.pathname.includes('edit');
|
|
|
|
|
const showAuditA = !location.pathname.includes('audit');
|
|
|
|
|
const { travel_agency_id, use_year, audit_state } = useParams();
|
|
|
|
@ -22,6 +23,7 @@ const Header = ({ refresh, newActionable, ...props }) => {
|
|
|
|
|
const isPermitted = useAuthStore((state) => state.isPermitted);
|
|
|
|
|
const [activeAgency, setActiveAgency] = useProductsStore((state) => [state.activeAgency, state.setActiveAgency]);
|
|
|
|
|
const [switchParams, setSwitchParams] = useProductsStore((state) => [state.switchParams, state.setSwitchParams]);
|
|
|
|
|
const [activeAgencyState] = useProductsStore((state) => [state.activeAgencyState]);
|
|
|
|
|
const stateMapVal = useProductsAuditStatesMapVal();
|
|
|
|
|
const { message, notification } = App.useApp();
|
|
|
|
|
const navigate = useNavigate();
|
|
|
|
@ -38,7 +40,7 @@ const Header = ({ refresh, newActionable, ...props }) => {
|
|
|
|
|
const [pickAgency, setPickAgency] = useState({ value: activeAgency.travel_agency_id, label: activeAgency.travel_agency_name });
|
|
|
|
|
const [pickAuditState, setPickAuditState] = useState();
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
const _param = objectMapper(param, { pick_year: 'use_year', pick_agency: 'travel_agency_id', pick_state: 'audit_state' })
|
|
|
|
|
const _param = objectMapper(param, { pick_year: 'use_year', pick_agency: 'travel_agency_id', pick_state: 'audit_state' });
|
|
|
|
|
setSwitchParams({ ..._param });
|
|
|
|
|
refresh(param);
|
|
|
|
|
|
|
|
|
@ -171,14 +173,16 @@ const Header = ({ refresh, newActionable, ...props }) => {
|
|
|
|
|
</RequireAuth>
|
|
|
|
|
{/* 编辑 */}
|
|
|
|
|
<Divider type='vertical' />
|
|
|
|
|
{newActionable && (
|
|
|
|
|
{isEditPage && (
|
|
|
|
|
<RequireAuth subject={PERM_PRODUCTS_OFFER_PUT}>
|
|
|
|
|
<Button size='small' type={'primary'} onClick={props.handleNewProduct}>
|
|
|
|
|
{t('New')}
|
|
|
|
|
{t('products:#')}
|
|
|
|
|
</Button>
|
|
|
|
|
</RequireAuth>
|
|
|
|
|
)}
|
|
|
|
|
{activeAgencyState === 0 && (
|
|
|
|
|
<>
|
|
|
|
|
<RequireAuth subject={PERM_PRODUCTS_OFFER_PUT}>
|
|
|
|
|
<Button size='small' type={'primary'} onClick={props.handleNewProduct}>
|
|
|
|
|
{t('New')}
|
|
|
|
|
{t('products:#')}
|
|
|
|
|
</Button>
|
|
|
|
|
</RequireAuth>
|
|
|
|
|
<RequireAuth subject={PERM_PRODUCTS_OFFER_PUT}>
|
|
|
|
|
<Button size='small' type={'primary'} onClick={handleSubmitForAudit}>
|
|
|
|
|
{t('Submit')}
|
|
|
|
|