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 00000000..0a1cadfc Binary files /dev/null and b/pc4mobx/hrmSalary/common/leftTree-hide.png differ diff --git a/pc4mobx/hrmSalary/common/leftTree-show.png b/pc4mobx/hrmSalary/common/leftTree-show.png new file mode 100644 index 00000000..cc791aad Binary files /dev/null and b/pc4mobx/hrmSalary/common/leftTree-show.png differ diff --git a/pc4mobx/hrmSalary/pages/reportView/components/condition.js b/pc4mobx/hrmSalary/pages/reportView/components/condition.js new file mode 100644 index 00000000..a971b2b3 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/reportView/components/condition.js @@ -0,0 +1,153 @@ +import { WeaLocaleProvider } from "ecCom"; + +const { getLabel } = WeaLocaleProvider; +export const condition = [ + { + items: [ + { + colSpan: 2, + checkbox: false, + checkboxValue: false, + conditionType: "SELECT", + domkey: ["taxAgent"], + fieldcol: 18, + label: getLabel(111, "个税扣缴义务人"), + labelcol: 6, + options: [], + multiple: true, + viewAttr: 2 + }, + { + browserConditionParam: { + completeParams: {}, + conditionDataParams: {}, + dataParams: {}, + destDataParams: {}, + hasAddBtn: false, + hasAdvanceSerach: true, + idSeparator: ",", + isAutoComplete: 1, + isDetail: 0, + isMultCheckbox: false, + isSingle: false, + linkUrl: "", + pageSize: 10, + quickSearchName: "", + replaceDatas: [], + title: getLabel(111, "分部"), + type: "164", + viewAttr: 2 + }, + colSpan: 2, + conditionType: "BROWSER", + domkey: ["subCompany"], + fieldcol: 18, + isQuickSearch: false, + label: getLabel(111, "分部"), + labelcol: 6, + viewAttr: 2 + }, + { + browserConditionParam: { + completeParams: {}, + conditionDataParams: {}, + dataParams: {}, + destDataParams: {}, + hasAddBtn: false, + hasAdvanceSerach: true, + idSeparator: ",", + isAutoComplete: 1, + isDetail: 0, + isMultCheckbox: false, + isSingle: false, + linkUrl: "", + pageSize: 10, + quickSearchName: "", + replaceDatas: [], + title: getLabel(111, "部门"), + type: "57", + viewAttr: 2 + }, + colSpan: 2, + conditionType: "BROWSER", + domkey: ["department"], + fieldcol: 18, + isQuickSearch: false, + label: getLabel(111, "部门"), + labelcol: 6, + viewAttr: 2 + }, + { + browserConditionParam: { + completeParams: {}, + conditionDataParams: {}, + dataParams: {}, + destDataParams: {}, + hasAddBtn: false, + hasAdvanceSerach: true, + idSeparator: ",", + isAutoComplete: 1, + isDetail: 0, + isMultCheckbox: false, + isSingle: false, + linkUrl: "", + pageSize: 10, + quickSearchName: "", + replaceDatas: [], + title: getLabel(111, "岗位"), + type: "278", + viewAttr: 2 + }, + colSpan: 2, + conditionType: "BROWSER", + domkey: ["position"], + fieldcol: 18, + isQuickSearch: false, + label: getLabel(111, "岗位"), + labelcol: 6, + viewAttr: 2 + }, + { + browserConditionParam: { + completeParams: {}, + conditionDataParams: {}, + dataParams: {}, + destDataParams: {}, + hasAddBtn: false, + hasAdvanceSerach: true, + idSeparator: ",", + isAutoComplete: 1, + isDetail: 0, + isMultCheckbox: false, + isSingle: false, + linkUrl: "", + pageSize: 10, + quickSearchName: "", + replaceDatas: [], + title: getLabel(111, "人员"), + type: "17", + viewAttr: 2 + }, + colSpan: 2, + conditionType: "BROWSER", + domkey: ["employee"], + fieldcol: 18, + isQuickSearch: false, + label: getLabel(111, "人员"), + labelcol: 6, + viewAttr: 2 + }, + { + colSpan: 2, + conditionType: "RANGEPICKER", + domkey: ["hiredate"], + fieldcol: 18, + label: getLabel(111, "入职日期"), + labelcol: 6, + viewAttr: 2 + } + ], + title: "", + defaultshow: true + } +]; diff --git a/pc4mobx/hrmSalary/pages/reportView/components/customStatisticsItemsModal.js b/pc4mobx/hrmSalary/pages/reportView/components/customStatisticsItemsModal.js new file mode 100644 index 00000000..c5503b27 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/reportView/components/customStatisticsItemsModal.js @@ -0,0 +1,205 @@ +/* + * Author: 黎永顺 + * name: 新建自定义统计项目弹框 + * Description: + * Date: 2023/4/10 + */ +import React, { Component } from "react"; +import { Button } from "antd"; +import { + WeaCheckbox, + WeaDialog, + WeaError, + WeaFormItem, + WeaHelpfulTip, + WeaInput, + WeaInputNumber, + WeaLocaleProvider, + WeaTable +} from "ecCom"; +import { statisticsItemGetform } from "../../../apis/statistics"; +import "../index.less"; + +const { getLabel } = WeaLocaleProvider; + +class CustomStatisticsItemsModal extends Component { + constructor(props) { + super(props); + this.state = { + loading: false, + columns: [], + dataSource: [], + formData: {} + }; + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) { + this.statisticsItemGetform(); + } + } + + statisticsItemGetform = (payload) => { + 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 ( +
+
+ +