custom/领悦

This commit is contained in:
黎永顺 2024-08-22 17:40:15 +08:00
parent 69fd955592
commit 772ef95416
6 changed files with 203 additions and 0 deletions

View File

@ -0,0 +1,6 @@
import { postFetch } from "../../../util/request";
// 薪资项目调整记录列表
export const getLYSalaryReportList = (params) => {
return postFetch("/api/bs/hrmsalary/ly/salaryReport/list", params);
};

View File

@ -54,6 +54,7 @@ import TopologyMap from "./pages/topologyMap";
import SupplementaryCalc from "./pages/supplementaryCalc";
import Layout from "./layout";
import CustomRoutes from "./pages/custom-pages";
import stores from "./stores";
import "./style/index";
@ -167,6 +168,7 @@ const Routes = (
<Route key="externalPersonManage" path="externalPersonManage" component={ExternalPersonManage}/>
<Route key="topologyView" path="topologyView/:salarySobId/:salaryItemId" component={TopologyMap}/>
<Route key="supplementaryCalc" path="supplementaryCalc" component={SupplementaryCalc}/>
{CustomRoutes}
</Route>
);

View File

@ -0,0 +1,9 @@
import React from "react";
import Route from "react-router/lib/Route";
import CustomPageLingYue from "./lingyue";
const CustomRoutes = [
<Route key="customPage_lingyue" path="customPage_lingyue" component={CustomPageLingYue}/>
];
export default CustomRoutes;

View File

@ -0,0 +1,123 @@
/*
* 薪酬二开项目
* 列表
* @Author: 黎永顺
* @Date: 2024/8/22
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
import { WeaLocaleProvider } from "ecCom";
import { Spin } from "antd";
import { getIframeParentHeight } from "../../../../util";
import * as API from "../../../../apis/custom-apis/lingyue";
const getLabel = WeaLocaleProvider.getLabel;
class List extends Component {
constructor(props) {
super(props);
this.state = {
dataSource: [], columns: [], pageInfo: { current: 1, pageSize: 10, total: 0 }, loading: false
};
this.handleDebounce = null;
}
componentDidMount() {
window.addEventListener("message", this.handleReceive, false);
}
componentWillUnmount() {
window.removeEventListener("message", this.handleReceive, false);
}
componentWillReceiveProps(nextProps, nextContext) {
if (!this.handleDebounce) {
this.handleDebounce = _.debounce(() => {
this.getLYSalaryReportList(nextProps);
}, 500);
}
this.handleDebounce();
}
handleReceive = ({ data }) => {
const { pageInfo } = this.state;
const { type, payload: { id, params } = {} } = data;
if (type === "init") {
this.getLYSalaryReportList(this.props);
} else if (type === "turn") {
switch (id) {
case "PAGEINFO":
this.setState({ pageInfo: { ...pageInfo, ...params } }, () => this.getLYSalaryReportList(this.props));
break;
default:
break;
}
}
};
postMessageToChild = (payload = {}) => {
const i18n = {
"共": getLabel(18609, "共"), "条": getLabel(18256, "条"),
"总计": getLabel(523, "总计")
};
const childFrameObj = document.getElementById("unitTable");
childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*");
};
getLYSalaryReportList = (props) => {
const { query } = props;
const { pageInfo } = this.state;
const payload = { ...pageInfo, ...query };
API.getLYSalaryReportList(payload).then(({ status, data }) => {
if (status) {
const { columns, data: result } = data;
const { list: dataSource, pageNum: current, pageSize, total } = result;
this.setState({
pageInfo: { ...pageInfo, current, pageSize, total },
dataSource, columns
}, () => this.postMessageToChild({
scrollHeight: 108, dataSource, pageInfo: this.state.pageInfo,
unitTableType: "custom_lingyue", columns: traverseCols(columns)
}));
}
});
};
render() {
const { loading, dataSource } = this.state;
return (
<div className="custom_lingyue_list"
style={{ height: getIframeParentHeight(".wea-new-top-content", dataSource.length, 0) + "px" }}>
<Spin spinning={loading}>
<iframe
style={{ border: 0, width: "100%", height: "100%" }}
// src="http://localhost:7607/#/unitTable"
src="/spa/hrmSalary/hrmSalaryCalculateDetail/index.html#/unitTable"
id="unitTable"
/>
</Spin>
</div>
);
}
}
export default List;
const traverseCols = arr => {
return _.map(arr, item => {
if (!_.isEmpty(item.children)) {
return {
title: item.text, width: item.width + "px", ellipsis: true,
dataIndex: item.column, children: traverseCols(item.children),
fixed: item.fixed || false, align: "center"
};
} else {
return {
title: item.text, width: item.width + "px", fixed: item.fixed || false,
dataIndex: item.column, ellipsis: true, align: "center"
};
}
});
};

View File

@ -0,0 +1,43 @@
/*
* 薪酬二开项目
* 领悦
* @Author: 黎永顺
* @Date: 2024/8/22
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
import { WeaDatePicker, WeaInputSearch, WeaLocaleProvider, WeaTop } from "ecCom";
import List from "./components/list";
import moment from "moment";
import "./index.less";
const getLabel = WeaLocaleProvider.getLabel;
class Index extends Component {
constructor(props) {
super(props);
this.state = {
query: { salaryMonth: moment().format("YYYY-MM"), ffgsqc: "" }
};
}
render() {
const { query } = this.state;
const { salaryMonth, ffgsqc } = query;
const buttons = [
<WeaDatePicker format="YYYY-MM" value={salaryMonth}
onChange={value => this.setState({ query: { ...query, salaryMonth: value } })}/>,
<WeaInputSearch value={ffgsqc} onChange={value => this.setState({ query: { ...query, ffgsqc: value } })}/>
];
return (
<WeaTop
title={getLabel(111, "薪资汇总表")} icon={<i className="icon-coms-fa"/>} buttons={buttons}
iconBgcolor="#F14A2D" showDropIcon={false} className="custom_salary_lingyue">
<div className="lingyue-body"><List query={query}/></div>
</WeaTop>);
}
}
export default Index;

View File

@ -0,0 +1,20 @@
.custom_salary_lingyue {
.wea-new-top {
.wea-input-focus {
height: 30px;
line-height: 0;
}
}
.lingyue-body {
height: 100%;
padding: 16px 16px 0 16px;
background: #F6F6F6;
.custom_lingyue_list {
.ant-spin-nested-loading, .ant-spin-container {
height: 100%;
}
}
}
}