diff --git a/pc4mobx/hrmSalary/config.js b/pc4mobx/hrmSalary/config.js index 1dcdda0d..5b30910f 100644 --- a/pc4mobx/hrmSalary/config.js +++ b/pc4mobx/hrmSalary/config.js @@ -18,6 +18,6 @@ export const PAGE = { "salaryField": ["/hrmSalary/fieldManagement"], //字段管理 "salaryItem": ["/hrmSalary/salaryItem"], //薪资项目管理 "siScheme": ["/socialSecurityBenefits/programme"], //社保福利方案 - "report": ["/hrmSalary/analysisOfSalaryStatistics", "/hrmSalary/reportView"], //报表 - "nc": ["lingyue"] //领悦报表业务线权限 + "report": ["/hrmSalary/analysisOfSalaryStatistics", "/hrmSalary/reportView"] //报表 }; +export const EXCLUDE_PAGE = ["mobilepayroll"]; diff --git a/pc4mobx/hrmSalary/layout.js b/pc4mobx/hrmSalary/layout.js index b90b53c0..5b411456 100644 --- a/pc4mobx/hrmSalary/layout.js +++ b/pc4mobx/hrmSalary/layout.js @@ -11,6 +11,8 @@ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; import { WeaLocaleProvider, WeaTools } from "ecCom"; import Authority from "./pages/mySalary/authority"; +import { EXCLUDE_PAGE } from "./config"; +import store from "./stores"; const { ls } = WeaTools; const { getLabel } = WeaLocaleProvider; @@ -43,8 +45,11 @@ class Layout extends Component { let header = document.getElementById("container"); header.appendChild(link); top.$(".ant-message").remove(); - (window.location.hash.indexOf("mobilepayroll") === -1 || window.location.hash.indexOf("_lingyue") === -1) && allStore.taxAgentStore.getPermission(); - (window.location.hash.indexOf("mobilepayroll") !== -1 && window.location.hash.indexOf("_lingyue") !== -1) && allStore.taxAgentStore.initPageAndOptAuth(); + if (_.every(EXCLUDE_PAGE, page => window.location.hash.indexOf(page) === -1)) { + store.taxAgentStore.getPermission(); + } else { + store.taxAgentStore.initPageAndOptAuth(); + } } window.addEventListener("storage", this.setFontSize); } @@ -73,8 +78,10 @@ class Layout extends Component { render() { const { taxAgentStore: { PageAndOptAuth, loading } } = this.props; + // 领悦二开权限 + const lingyueRight = window.location.hash.indexOf("lingyue") !== -1; return ( - {this.props.children} + {this.props.children} ); } } diff --git a/pc4mobx/hrmSalary/single.js b/pc4mobx/hrmSalary/single.js index 51938f7b..059cc59f 100644 --- a/pc4mobx/hrmSalary/single.js +++ b/pc4mobx/hrmSalary/single.js @@ -1,14 +1,10 @@ import React from "react"; import ReactDOM from "react-dom"; - import { createHashHistory } from "History"; - import { IndexRedirect, Route, Router, useRouterHistory } from "react-router"; - import { RouterStore, syncHistoryWithStore } from "mobx-react-router"; - +import { EXCLUDE_PAGE } from "./config"; import { Provider } from "mobx-react"; - import Module from "weaHrmSalary"; const routing = new RouterStore(); @@ -37,8 +33,11 @@ class Root extends React.Component { let header = document.getElementById("container"); header.appendChild(link); top.$(".ant-message").remove(); - (window.location.hash.indexOf("mobilepayroll") === -1 && window.location.hash.indexOf("_lingyue") === -1) && allStore.taxAgentStore.getPermission(); - (window.location.hash.indexOf("mobilepayroll") !== -1 || window.location.hash.indexOf("_lingyue") !== -1) && allStore.taxAgentStore.initPageAndOptAuth(); + if (_.every(EXCLUDE_PAGE, page => window.location.hash.indexOf(page) === -1)) { + allStore.taxAgentStore.getPermission(); + } else { + allStore.taxAgentStore.initPageAndOptAuth(); + } if (window.location.hash.indexOf("payroll") !== -1) { window.localStorage.removeItem("template-basedata"); window.localStorage.removeItem("salary-showset");