salary-management-front/pc4mobx/hrmSalary/single.js

64 lines
1.8 KiB
JavaScript
Raw Normal View History

2022-12-07 14:15:46 +08:00
import React from "react";
import ReactDOM from "react-dom";
2022-02-25 09:24:56 +08:00
2022-12-07 14:15:46 +08:00
import { createHashHistory } from "History";
2022-02-25 09:24:56 +08:00
2022-12-07 14:15:46 +08:00
import { IndexRedirect, Route, Router, useRouterHistory } from "react-router";
2022-02-25 09:24:56 +08:00
2022-12-07 14:15:46 +08:00
import { RouterStore, syncHistoryWithStore } from "mobx-react-router";
2022-02-25 09:24:56 +08:00
2022-12-07 14:15:46 +08:00
import { Provider } from "mobx-react";
2022-02-25 09:24:56 +08:00
2022-12-07 14:15:46 +08:00
import Module from "weaHrmSalary";
2022-02-25 09:24:56 +08:00
const routing = new RouterStore();
const allStore = {
routing,
2022-12-07 14:15:46 +08:00
...Module.store
2022-02-25 09:24:56 +08:00
};
const browserHistory = useRouterHistory(createHashHistory)({
2022-12-07 14:15:46 +08:00
queryKey: "_key",
basename: "/"
2022-02-25 09:24:56 +08:00
});
const history = syncHistoryWithStore(browserHistory, allStore.routing);
const Home = props => props.children;
2022-06-02 13:51:45 +08:00
class Root extends React.Component {
componentWillMount() {
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)
2022-06-21 11:33:00 +08:00
top.$(".ant-message").remove();
window.location.hash.indexOf("mobilepayroll") === -1 && allStore.taxAgentStore.getPermission();
if (window.location.hash.indexOf("payroll") !== -1) {
2023-01-09 14:04:08 +08:00
window.localStorage.removeItem("template-basedata");
window.localStorage.removeItem("salary-showset");
}
2022-06-02 13:51:45 +08:00
}
2022-12-07 14:15:46 +08:00
2022-06-02 13:51:45 +08:00
render() {
return (
<Provider {...allStore}>
<Router history={history}>
2022-12-07 14:15:46 +08:00
<Route name="root" breadcrumbName="根路由" path="/" component={Home}>
<IndexRedirect to="main/hrmSalary/index"/>
<Route name="main" breadcrumbName="入口" path="/main" component={Home}>
{Module.Route}
2022-06-02 13:51:45 +08:00
</Route>
</Route>
</Router>
</Provider>
2022-12-07 14:15:46 +08:00
);
2022-06-02 13:51:45 +08:00
}
}
2022-02-25 09:24:56 +08:00
2022-12-07 14:15:46 +08:00
ReactDOM.render(<Root/>, document.getElementById("container"));