From 772ef954163aa133dc757f480370d2d420a769be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Thu, 22 Aug 2024 17:40:15 +0800 Subject: [PATCH] =?UTF-8?q?custom/=E9=A2=86=E6=82=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apis/custom-apis/lingyue/index.js | 6 + pc4mobx/hrmSalary/index.js | 2 + pc4mobx/hrmSalary/pages/custom-pages/index.js | 9 ++ .../custom-pages/lingyue/components/list.js | 123 ++++++++++++++++++ .../pages/custom-pages/lingyue/index.js | 43 ++++++ .../pages/custom-pages/lingyue/index.less | 20 +++ 6 files changed, 203 insertions(+) create mode 100644 pc4mobx/hrmSalary/apis/custom-apis/lingyue/index.js create mode 100644 pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/list.js create mode 100644 pc4mobx/hrmSalary/pages/custom-pages/lingyue/index.js create mode 100644 pc4mobx/hrmSalary/pages/custom-pages/lingyue/index.less diff --git a/pc4mobx/hrmSalary/apis/custom-apis/lingyue/index.js b/pc4mobx/hrmSalary/apis/custom-apis/lingyue/index.js new file mode 100644 index 00000000..e9d5111a --- /dev/null +++ b/pc4mobx/hrmSalary/apis/custom-apis/lingyue/index.js @@ -0,0 +1,6 @@ +import { postFetch } from "../../../util/request"; + +// 薪资项目调整记录列表 +export const getLYSalaryReportList = (params) => { + return postFetch("/api/bs/hrmsalary/ly/salaryReport/list", params); +}; diff --git a/pc4mobx/hrmSalary/index.js b/pc4mobx/hrmSalary/index.js index 8c605118..c2137579 100644 --- a/pc4mobx/hrmSalary/index.js +++ b/pc4mobx/hrmSalary/index.js @@ -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 = ( + {CustomRoutes} ); diff --git a/pc4mobx/hrmSalary/pages/custom-pages/index.js b/pc4mobx/hrmSalary/pages/custom-pages/index.js index e69de29b..fb99e300 100644 --- a/pc4mobx/hrmSalary/pages/custom-pages/index.js +++ b/pc4mobx/hrmSalary/pages/custom-pages/index.js @@ -0,0 +1,9 @@ +import React from "react"; +import Route from "react-router/lib/Route"; +import CustomPageLingYue from "./lingyue"; + +const CustomRoutes = [ + +]; + +export default CustomRoutes; diff --git a/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/list.js b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/list.js new file mode 100644 index 00000000..c83fcf3b --- /dev/null +++ b/pc4mobx/hrmSalary/pages/custom-pages/lingyue/components/list.js @@ -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 ( +
+ +