From 8f7a8e41923a0a1c17cf2b06edcccb5be759c668 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, 8 Jun 2023 11:24:05 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E6=95=B0=E6=8D=AE=E7=BB=9F?=
=?UTF-8?q?=E8=AE=A1-=E6=95=B0=E6=8D=AE=E9=80=8F=E8=A7=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/hrmSalary/apis/statistics.js | 4 +
.../pages/reportView/components/index.less | 15 +++
.../components/povitpivotChartModal.js | 115 ++++++++++++++++++
.../reportView/components/reportContent.js | 29 ++++-
pc4mobx/hrmSalary/stores/payrollFiles.js | 21 +++-
5 files changed, 181 insertions(+), 3 deletions(-)
create mode 100644 pc4mobx/hrmSalary/pages/reportView/components/povitpivotChartModal.js
diff --git a/pc4mobx/hrmSalary/apis/statistics.js b/pc4mobx/hrmSalary/apis/statistics.js
index e88c8267..f5f4aff6 100644
--- a/pc4mobx/hrmSalary/apis/statistics.js
+++ b/pc4mobx/hrmSalary/apis/statistics.js
@@ -74,3 +74,7 @@ export const statisticsEmployeeList = (params) => {
export const statisticsEmployeeDetailList = (params) => {
return postFetch("/api/bs/hrmsalary/report/statistics/employee/detailList", params);
};
+//数据透视-列表查询
+export const getDataPerspective = (params) => {
+ return postFetch("/api/bs/hrmsalary/report/statistics/report/getDataPerspective", params);
+};
diff --git a/pc4mobx/hrmSalary/pages/reportView/components/index.less b/pc4mobx/hrmSalary/pages/reportView/components/index.less
index 33c5aed0..322df827 100644
--- a/pc4mobx/hrmSalary/pages/reportView/components/index.less
+++ b/pc4mobx/hrmSalary/pages/reportView/components/index.less
@@ -48,3 +48,18 @@
align-items: center;
}
}
+
+.pivot-wrapper {
+ .wea-dialog-body {
+ height: 80vh !important;
+ padding: 16px;
+
+ .wea-new-scroll {
+ height: 100% !important;
+ }
+ }
+
+ .ant-spin-nested-loading, .ant-spin-container {
+ height: 100%;
+ }
+}
diff --git a/pc4mobx/hrmSalary/pages/reportView/components/povitpivotChartModal.js b/pc4mobx/hrmSalary/pages/reportView/components/povitpivotChartModal.js
new file mode 100644
index 00000000..16c0893c
--- /dev/null
+++ b/pc4mobx/hrmSalary/pages/reportView/components/povitpivotChartModal.js
@@ -0,0 +1,115 @@
+/*
+ * Author: 黎永顺
+ * name: 数据透视弹框
+ * Description:
+ * Date: 2023/6/8
+ */
+import React, { Component } from "react";
+import { WeaDialog, WeaLocaleProvider } from "ecCom";
+import { Spin } from "antd";
+import { toJS } from "mobx";
+import { inject, observer } from "mobx-react";
+import "./index.less";
+
+const { getLabel } = WeaLocaleProvider;
+
+@inject("payrollFilesStore")
+@observer
+class PovitpivotChartModal extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ dataSource: [],
+ loading: false,
+ pageInfo: {
+ current: 1, pageSize: 10, total: 0
+ }
+ };
+ }
+
+ componentDidMount() {
+ window.addEventListener("message", this.handleReceive, false);
+ }
+
+ componentWillReceiveProps(nextProps, nextContext) {
+ if (nextProps.visible !== this.props.visible && nextProps.visible) {
+ const { id, dimensionId, dimensionValue } = nextProps;
+ this.getDataPerspective({ id, dimensionId, dimensionValue });
+ }
+ }
+
+ componentWillUnmount() {
+ window.removeEventListener("message", this.handleReceive, false);
+ }
+
+ handleReceive = ({ data }) => {
+ const { type, payload: { id, params } = {} } = data;
+ const { dataSource, pageInfo } = this.state;
+ if (type === "init") {
+ this.postMessageToChild({
+ dataSource, showSum: false, pageInfo
+ });
+ } else if (type === "turn") {
+ if (id === "PAGEINFO") {
+ const { id, dimensionId, dimensionValue } = this.props;
+ const { pageNum: current, size: pageSize } = params;
+ this.setState({ pageInfo: { ...pageInfo, current, pageSize } }, () =>
+ this.getDataPerspective({
+ id,
+ dimensionId,
+ dimensionValue
+ }));
+ }
+ }
+ };
+ postMessageToChild = (payload) => {
+ const childFrameObj = document.getElementById("commonTable");
+ const { dataSource, showSum = false, pageInfo } = payload;
+ const { payrollFilesStore: { pivotTableStore } } = this.props;
+ const columns = toJS(pivotTableStore.columns);
+ childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({
+ dataSource, columns, showSum, pageInfo
+ }), "*");
+ };
+ getDataPerspective = (payload) => {
+ const { pageInfo } = this.state;
+ const { payrollFilesStore: { getDataPerspective } } = this.props;
+ this.setState({ loading: true });
+ getDataPerspective({ ...payload, ...pageInfo }).then(({ status, data }) => {
+ this.setState({ loading: false });
+ if (status) {
+ const { pageInfo: { list, pageNum: current, pageSize, total } } = data;
+ this.setState({
+ dataSource: list || [],
+ pageInfo: { ...pageInfo, current, pageSize, total }
+ }, () => {
+ this.postMessageToChild({
+ dataSource: this.state.dataSource,
+ showSum: false, pageInfo: this.state.pageInfo
+ });
+ });
+ }
+ }).catch(() => this.setState({ loading: false }));
+ };
+
+ render() {
+ const { loading } = this.state;
+ return (
+