From 8f3320ae117167098ffb5adfc6c9b2e55794a56f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Sun, 23 Apr 2023 11:28:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E8=96=AA=E9=85=AC=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E5=88=86=E6=9E=90=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/statistics.js | 12 + pc4mobx/hrmSalary/common/leftTree-hide.png | Bin 0 -> 3308 bytes pc4mobx/hrmSalary/common/leftTree-show.png | Bin 0 -> 3312 bytes .../pages/reportView/components/condition.js | 153 +++++++++++++ .../components/customStatisticsItemsModal.js | 205 +++++++++++++++++ .../pages/reportView/components/leftTab.js | 11 + .../reportView/components/reportContent.js | 99 +++++++++ .../reportView/components/rightOptions.js | 45 ++++ .../statisticalMicroSettingsSlide.js | 206 ++++++++++++++++++ pc4mobx/hrmSalary/pages/reportView/index.js | 81 ++++++- pc4mobx/hrmSalary/pages/reportView/index.less | 196 +++++++++++++++++ pc4mobx/hrmSalary/stores/attendanceStore.js | 2 + pc4mobx/hrmSalary/util/index.js | 4 +- 13 files changed, 1004 insertions(+), 10 deletions(-) create mode 100644 pc4mobx/hrmSalary/common/leftTree-hide.png create mode 100644 pc4mobx/hrmSalary/common/leftTree-show.png create mode 100644 pc4mobx/hrmSalary/pages/reportView/components/condition.js create mode 100644 pc4mobx/hrmSalary/pages/reportView/components/customStatisticsItemsModal.js create mode 100644 pc4mobx/hrmSalary/pages/reportView/components/reportContent.js create mode 100644 pc4mobx/hrmSalary/pages/reportView/components/rightOptions.js create mode 100644 pc4mobx/hrmSalary/pages/reportView/components/statisticalMicroSettingsSlide.js diff --git a/pc4mobx/hrmSalary/apis/statistics.js b/pc4mobx/hrmSalary/apis/statistics.js index ed8f9d37..248a9037 100644 --- a/pc4mobx/hrmSalary/apis/statistics.js +++ b/pc4mobx/hrmSalary/apis/statistics.js @@ -5,6 +5,14 @@ import { postFetch } from "../util/request"; export const dimensionGetForm = (params) => { return WeaTools.callApi("/api/bs/hrmsalary/report/statistics/dimension/getForm", "GET", params); }; +//获取自定义统计项目表单 +export const statisticsItemGetform = (params) => { + return WeaTools.callApi("/api/bs/hrmsalary/report/statistics/item/getForm", "GET", params); +}; +//自定义统计项目列表 +export const statisticsItemList = (params) => { + return WeaTools.callApi("/api/bs/hrmsalary/report/statistics/item/list", "GET", params); +}; // 保存薪酬统计维度 export const dimensionSave = (params) => { return postFetch("/api/bs/hrmsalary/report/statistics/dimension/save", params); @@ -30,3 +38,7 @@ export const reportStatisticsReportDelete = (params) => { export const reportStatisticsReportGetData = (params) => { return postFetch("/api/bs/hrmsalary/report/statistics/report/getData", params); }; +//保存自定义统计项目 +export const reportStatisticsItemSave = (params) => { + return postFetch("/api/bs/hrmsalary/report/statistics/item/save", params); +}; diff --git a/pc4mobx/hrmSalary/common/leftTree-hide.png b/pc4mobx/hrmSalary/common/leftTree-hide.png new file mode 100644 index 0000000000000000000000000000000000000000..0a1cadfc7d8c3d490ae14f41fd32197bdd2cda31 GIT binary patch literal 3308 zcmVKLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf zVxhe-O!X z{f;To;xw^bEES6JSc$k$B2CA6xl)lt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dIr-7m2a7eq| zJ_jCd)w4H+l#*_@+XL$+#a{q?Nfy4IG+6W~@5 { + statisticsItemGetform(payload).then(({ status, data }) => { + if (status) { + const { ruleData } = data; + const { columns, data: dataSource } = ruleData; + this.setState({ columns, dataSource }); + } + }); + }; + handleChangeColumnCheckBox = (key, value, id) => { + const { dataSource } = this.state; + this.setState({ + dataSource: _.map(dataSource, it => { + if (it.id === id) { + return { + ...it, + [key]: Number(value) + }; + } + return { ...it }; + }) + }); + }; + handleChangeColumnAllChecked = (key, val) => { + const { dataSource } = this.state; + this.setState({ + dataSource: _.map(dataSource, it => { + return { + ...it, + [key]: Number(val) + }; + }) + }); + }; + handleChangeColumnM2MValue = (key, value, id) => { + const { dataSource } = this.state; + this.setState({ + dataSource: _.map(dataSource, it => { + if (it.id === id) { + return { + ...it, + [key]: value + }; + } + return { ...it }; + }) + }); + }; + + render() { + const { loading, columns, dataSource, formData } = this.state; + const { itemName } = formData; + const cols = _.map(columns, it => { + const { text, column } = it; + if (column === "ruleName" || column === "ratio" || column === "m2m" || column === "y2y") { + const key = column === "ruleName" ? "total" : column; + return { + ...it, + title: + !!child[`${key}Value`])} + onChange={val => this.handleChangeColumnAllChecked(`${key}Value`, val)} + /> + {text} + , + render: (txt, record) => { + return + this.handleChangeColumnCheckBox(`${key}Value`, val, record.id)} + /> + + {column === "ruleName" ? record["ruleName"] : text} + + ; + } + }; + } else if (column === "m2mLimit") { + return { + ...it, + title: + {text} + 10%,差值和增幅标记为红色,增幅<-10%标记为绿色")} + placement="top" width={200}/> + , + render: (txt, record) => { + return !!record["m2mValue"] && this.handleChangeColumnM2MValue(`${column.replace("Limit", "")}${type === "min" ? "LowerLimit" : "UpperLimit"}`, val, record.id)} + />; + } + }; + } else if (column === "y2yLimit") { + return { + ...it, + title: + {text} + 10%,差值和增幅标记为红色,增幅<-10%标记为绿色")} + placement="top" width={200}/> + , + render: (txt, record) => { + return !!record["y2yValue"] && this.handleChangeColumnM2MValue(`${column.replace("Limit", "")}${type === "min" ? "LowerLimit" : "UpperLimit"}`, val, record.id)} + />; + } + }; + } + }); + return ( + + {getLabel(111, "新建自定义统计项目")} + + + } + style={{ width: 900, height: 500 }} + className="statisticItemsWrapper" + > +
+ + + + + + + + + +
+ +
+
+
+ ); + } +} + +export default CustomStatisticsItemsModal; +/* + * Author: 黎永顺 + * Description: 区间设置 + * Params: + * Date: 2023/4/23 + */ +const IntervalSettingsComp = (props) => { + const { LowerLimit, UpperLimit, onChange } = props; + return
+ onChange("min", val)}/> + {`% <${getLabel(111, "增幅")}<`} + onChange("max", val)}/> + % +
; +}; diff --git a/pc4mobx/hrmSalary/pages/reportView/components/leftTab.js b/pc4mobx/hrmSalary/pages/reportView/components/leftTab.js index 329d23ab..c4c1494f 100644 --- a/pc4mobx/hrmSalary/pages/reportView/components/leftTab.js +++ b/pc4mobx/hrmSalary/pages/reportView/components/leftTab.js @@ -37,6 +37,17 @@ class LeftTab extends Component { }); }); }; + updateReportList = (report) => { + const { reportList } = this.state; + this.setState({ + reportList: _.reduce(reportList, (pre, cur) => { + if (report.id === cur.id) { + return [...pre, report]; + } + return [...pre, cur]; + }, []) + }); + }; render() { const { reportName, selectedKeys, reportList } = this.state; diff --git a/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js new file mode 100644 index 00000000..529004c1 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js @@ -0,0 +1,99 @@ +/* + * Author: 黎永顺 + * name: 报表内容区 + * Description: + * Date: 2023/4/21 + */ +import React, { Component } from "react"; +import { Spin } from "antd"; +import RightOptions from "./rightOptions"; +import { reportStatisticsReportGetData } from "../../../apis/statistics"; +import "../index.less"; + +class ReportContent extends Component { + constructor(props) { + super(props); + this.state = { + columns: [], + dataSource: [], + countResult: {}, + loading: false + }; + } + + componentDidMount() { + window.addEventListener("message", this.handleReceive, false); + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.report !== this.props.report && nextProps.report.dimensionId) { + this.reportStatisticsReportGetData(nextProps.report.id, nextProps.report.dimensionId); + } + } + + componentWillUnmount() { + window.removeEventListener("message", this.handleReceive, false); + } + + handleReceive = ({ data }) => { + const { type } = data; + if (type === "init") { + const { columns, countResult, dataSource } = this.state; + this.postMessageToChild({ + columns, countResult, dataSource, + showSum: !_.isEmpty(countResult) + }); + } else if (type === "turn") { + } + }; + postMessageToChild = (payload) => { + const childFrameObj = document.getElementById("atdTable"); + const { dataSource, columns, showSum, countResult } = payload; + childFrameObj.contentWindow.postMessage(JSON.stringify({ + dataSource, columns, showSum, countResult + }), "*"); + }; + + reportStatisticsReportGetData = (id, dimensionId) => { + const payload = { id, dimensionId }; + this.setState({ loading: true }); + reportStatisticsReportGetData(payload).then(({ status, data }) => { + this.setState({ loading: false }); + if (status) { + const { countResult, columns, pageInfo: { list } } = data; + this.setState({ + countResult, + columns: _.map(columns, it => ({ ...it, dataIndex: it.column, title: it.text, align: "center" })), + dataSource: list || [] + }, () => { + this.postMessageToChild({ + columns: this.state.columns, countResult: this.state.countResult, + dataSource: this.state.dataSource, + showSum: !_.isEmpty(this.state.countResult) + }); + }); + } + }).catch(() => this.setState({ loading: false })); + }; + + render() { + const { loading } = this.state; + return ( +
+
+ +