2024-08-15 17:43:03 +08:00
|
|
|
/*
|
|
|
|
|
* 薪酬管理-
|
|
|
|
|
* layout组件
|
|
|
|
|
* @Author: 黎永顺
|
|
|
|
|
* @Date: 2024/8/15
|
|
|
|
|
* @Wechat:
|
|
|
|
|
* @Email: 971387674@qq.com
|
|
|
|
|
* @description:
|
|
|
|
|
*/
|
|
|
|
|
import React, { Component } from "react";
|
2024-09-11 18:37:01 +08:00
|
|
|
import { inject, observer } from "mobx-react";
|
2024-08-15 17:43:03 +08:00
|
|
|
import { WeaLocaleProvider, WeaTools } from "ecCom";
|
2024-09-11 18:37:01 +08:00
|
|
|
import Authority from "./pages/mySalary/authority";
|
2025-02-20 11:32:32 +08:00
|
|
|
import { EXCLUDE_PAGE } from "./config";
|
2024-08-15 17:43:03 +08:00
|
|
|
import stores from "./stores";
|
|
|
|
|
|
|
|
|
|
const { ls } = WeaTools;
|
|
|
|
|
const { getLabel } = WeaLocaleProvider;
|
|
|
|
|
|
2024-09-11 18:37:01 +08:00
|
|
|
@inject("taxAgentStore")
|
|
|
|
|
@observer
|
2024-08-15 17:43:03 +08:00
|
|
|
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")))) {
|
2025-02-17 18:28:21 +08:00
|
|
|
stores.baseFormStore.initForm();
|
|
|
|
|
stores.baseFormStore.initFormExtra();
|
2024-08-15 17:43:03 +08:00
|
|
|
if (window.location.hash.indexOf("payroll") !== -1) {
|
|
|
|
|
window.localStorage.removeItem("template-basedata");
|
|
|
|
|
window.localStorage.removeItem("salary-showset");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
2024-10-10 15:32:41 +08:00
|
|
|
this.setFontSize();
|
2024-08-15 17:43:03 +08:00
|
|
|
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();
|
2025-02-20 13:44:55 +08:00
|
|
|
if (_.every(EXCLUDE_PAGE, page => window.location.hash.indexOf(page) === -1)) {
|
|
|
|
|
stores.taxAgentStore.getPermission();
|
|
|
|
|
} else {
|
|
|
|
|
stores.taxAgentStore.initPageAndOptAuth();
|
|
|
|
|
}
|
2024-08-15 17:43:03 +08:00
|
|
|
}
|
2024-10-10 13:57:09 +08:00
|
|
|
window.addEventListener("storage", this.setFontSize);
|
2024-08-15 17:43:03 +08:00
|
|
|
}
|
|
|
|
|
|
2024-10-09 18:12:06 +08:00
|
|
|
componentWillUnmount() {
|
2024-10-10 13:57:09 +08:00
|
|
|
window.removeEventListener("storage", this.setFontSize);
|
2024-10-09 18:12:06 +08:00
|
|
|
}
|
|
|
|
|
|
2024-10-10 15:32:41 +08:00
|
|
|
setFontSize = () => {
|
2024-10-09 18:12:06 +08:00
|
|
|
const { themeFontSize } = JSON.parse(localStorage.getItem("theme-themeInfo")) || { themeFontSize: "12" };
|
|
|
|
|
if (window.location.href.indexOf("/spa/hrmSalary/") !== -1) {
|
2024-10-10 13:57:09 +08:00
|
|
|
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}" />`);
|
2024-10-09 18:12:06 +08:00
|
|
|
const link = document.createElement("link");
|
|
|
|
|
link.setAttribute("rel", "stylesheet");
|
|
|
|
|
link.setAttribute("type", "text/css");
|
2024-10-10 13:57:09 +08:00
|
|
|
link.setAttribute("href", href);
|
|
|
|
|
link.setAttribute("id", "theme-font1");
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
window.parent.document.head.appendChild(link);
|
|
|
|
|
}, 500);
|
2024-10-09 18:12:06 +08:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2024-08-15 17:43:03 +08:00
|
|
|
render() {
|
2024-09-11 18:37:01 +08:00
|
|
|
const { taxAgentStore: { PageAndOptAuth, loading } } = this.props;
|
|
|
|
|
return (<WeaLocaleProvider>
|
|
|
|
|
<Authority store={{ loading, hasRight: PageAndOptAuth.able }}>{this.props.children}</Authority>
|
|
|
|
|
</WeaLocaleProvider>);
|
2024-08-15 17:43:03 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default Layout;
|