84 lines
2.9 KiB
JavaScript
84 lines
2.9 KiB
JavaScript
/*
|
|
* 薪酬管理-
|
|
* layout组件
|
|
* @Author: 黎永顺
|
|
* @Date: 2024/8/15
|
|
* @Wechat:
|
|
* @Email: 971387674@qq.com
|
|
* @description:
|
|
*/
|
|
import React, { Component } from "react";
|
|
import { inject, observer } from "mobx-react";
|
|
import { WeaLocaleProvider, WeaTools } from "ecCom";
|
|
import Authority from "./pages/mySalary/authority";
|
|
import stores from "./stores";
|
|
|
|
const { ls } = WeaTools;
|
|
const { getLabel } = WeaLocaleProvider;
|
|
|
|
@inject("taxAgentStore")
|
|
@observer
|
|
class Layout extends Component {
|
|
constructor(props) {
|
|
super(props);
|
|
this.state = {};
|
|
}
|
|
|
|
componentWillReceiveProps(nextProps, nextContext) {
|
|
if (window.e9LibsConfigCustomF && _.some(window.e9LibsConfigCustomF, o => (_.some(o, k => k === "h_hrmSalary")))) {
|
|
if (window.location.hash.indexOf("payroll") !== -1) {
|
|
window.localStorage.removeItem("template-basedata");
|
|
window.localStorage.removeItem("salary-showset");
|
|
}
|
|
}
|
|
}
|
|
|
|
componentDidMount() {
|
|
this.setFontSize();
|
|
if (window.e9LibsConfigCustomF && _.some(window.e9LibsConfigCustomF, o => (_.some(o, k => k === "h_hrmSalary")))) {
|
|
const src = "/spa/hrmSalary/hrmSalaryCalculateDetail/css/iconfont/iconfont.css";
|
|
const link = document.createElement("link");
|
|
link.setAttribute("rel", "stylesheet");
|
|
link.setAttribute("type", "text/css");
|
|
link.setAttribute("href", src);
|
|
let header = document.getElementById("container");
|
|
header.appendChild(link);
|
|
top.$(".ant-message").remove();
|
|
window.location.hash.indexOf("mobilepayroll") === -1 && stores.taxAgentStore.getPermission();
|
|
window.location.hash.indexOf("mobilepayroll") !== -1 && stores.taxAgentStore.initPageAndOptAuth();
|
|
}
|
|
window.addEventListener("storage", this.setFontSize);
|
|
}
|
|
|
|
componentWillUnmount() {
|
|
window.removeEventListener("storage", this.setFontSize);
|
|
}
|
|
|
|
setFontSize = () => {
|
|
const { themeFontSize } = JSON.parse(localStorage.getItem("theme-themeInfo")) || { themeFontSize: "12" };
|
|
if (window.location.href.indexOf("/spa/hrmSalary/") !== -1) {
|
|
const href = `/cloudstore/resource/pc/com/font-size/${themeFontSize}px.css`;
|
|
jQuery("#theme-font").remove();
|
|
window.parent.jQuery("#theme-font1").remove();
|
|
jQuery(jQuery("head")[0]).append(`<link id="theme-font" rel="stylesheet" type="text/css" href="${href}" />`);
|
|
const link = document.createElement("link");
|
|
link.setAttribute("rel", "stylesheet");
|
|
link.setAttribute("type", "text/css");
|
|
link.setAttribute("href", href);
|
|
link.setAttribute("id", "theme-font1");
|
|
setTimeout(() => {
|
|
window.parent.document.head.appendChild(link);
|
|
}, 500);
|
|
}
|
|
};
|
|
|
|
render() {
|
|
const { taxAgentStore: { PageAndOptAuth, loading } } = this.props;
|
|
return (<WeaLocaleProvider>
|
|
<Authority store={{ loading, hasRight: PageAndOptAuth.able }}>{this.props.children}</Authority>
|
|
</WeaLocaleProvider>);
|
|
}
|
|
}
|
|
|
|
export default Layout;
|