From 22fddce3a0ab99a7d92b10c28bbf167feec2861f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com>
Date: Wed, 10 May 2023 10:50:58 +0800
Subject: [PATCH 1/8] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=BB=9F=E8=AE=A1?=
=?UTF-8?q?=E6=8A=A5=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/hrmSalary/pages/reportView/components/reportContent.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js
index c4b78c01..413740e6 100644
--- a/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js
+++ b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js
@@ -100,7 +100,7 @@ class ReportContent extends Component {
{/*侧边栏*/}
- {/**/}
+
);
}
From 8bd124c7dc4a34f5ae71c7952557e3a4f05abfec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com>
Date: Fri, 12 May 2023 10:18:39 +0800
Subject: [PATCH 2/8] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E8=96=AA=E9=85=AC?=
=?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=88=86=E6=9E=90=E6=8A=A5=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/hrmSalary/apis/statistics.js | 8 +
pc4mobx/hrmSalary/common/Icon-empty-file.svg | 38 ++
.../pages/analysisOfSalaryStatistics/index.js | 3 +-
.../components/chartsRangeSettingsModal.js | 404 ++++++++++++++++++
.../pages/reportView/components/index.less | 50 +++
.../reportView/components/reportContent.js | 85 +++-
.../reportView/components/rightOptions.js | 14 +-
pc4mobx/hrmSalary/pages/reportView/index.less | 31 ++
8 files changed, 616 insertions(+), 17 deletions(-)
create mode 100644 pc4mobx/hrmSalary/common/Icon-empty-file.svg
create mode 100644 pc4mobx/hrmSalary/pages/reportView/components/chartsRangeSettingsModal.js
create mode 100644 pc4mobx/hrmSalary/pages/reportView/components/index.less
diff --git a/pc4mobx/hrmSalary/apis/statistics.js b/pc4mobx/hrmSalary/apis/statistics.js
index 767d8c7e..4abd90fb 100644
--- a/pc4mobx/hrmSalary/apis/statistics.js
+++ b/pc4mobx/hrmSalary/apis/statistics.js
@@ -54,3 +54,11 @@ export const reportStatisticsItemDelete = (params) => {
export const reportStatisticsGetSearchCondition = (params) => {
return WeaTools.callApi("/api/bs/hrmsalary/report/statistics/report/getSearchCondition", "GET", params);
};
+//分析图数据展示范围设置查询
+export const queryRangeSetting = (params) => {
+ return WeaTools.callApi("/api/bs/hrmsalary/report/statistics/echarts/queryRangeSetting", "GET", params);
+};
+//分析图数据展示范围设置保存
+export const saveRangeSetting = (params) => {
+ return postFetch("/api/bs/hrmsalary/report/statistics/echarts/saveRangeSetting", params);
+};
diff --git a/pc4mobx/hrmSalary/common/Icon-empty-file.svg b/pc4mobx/hrmSalary/common/Icon-empty-file.svg
new file mode 100644
index 00000000..cfab82a9
--- /dev/null
+++ b/pc4mobx/hrmSalary/common/Icon-empty-file.svg
@@ -0,0 +1,38 @@
+
+
\ No newline at end of file
diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.js
index 5fc4c40b..fe08d250 100644
--- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.js
+++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.js
@@ -212,8 +212,9 @@ class Index extends Component {
...modalReq, visible: false, id: ""
}
}, () => {
- const { selectedKey, reportName } = this.state;
+ const { selectedKey, reportName, modalReq: { typeKey } } = this.state;
selectedKey === "statistics" && reportForm.resetForm();
+ typeKey === "dimension" && this.initReportFormCondition();
refresh && selectedKey === "statistics" && this.reportListRef.reportStatisticsReportList({ reportName });
});
};
diff --git a/pc4mobx/hrmSalary/pages/reportView/components/chartsRangeSettingsModal.js b/pc4mobx/hrmSalary/pages/reportView/components/chartsRangeSettingsModal.js
new file mode 100644
index 00000000..f9dc7cfa
--- /dev/null
+++ b/pc4mobx/hrmSalary/pages/reportView/components/chartsRangeSettingsModal.js
@@ -0,0 +1,404 @@
+/*
+ * Author: 黎永顺
+ * name: 分析图标范围数据设置弹框
+ * Description:
+ * Date: 2023/5/11
+ */
+import React, { Component } from "react";
+import { Button, Col, message, Row } from "antd";
+import {
+ WeaDialog,
+ WeaError,
+ WeaFormItem,
+ WeaHelpfulTip,
+ WeaInputNumber,
+ WeaLocaleProvider,
+ WeaReqTop,
+ WeaSearchGroup,
+ WeaSelect
+} from "ecCom";
+import { saveRangeSetting } from "../../../apis/statistics";
+import "./index.less";
+
+const { getLabel } = WeaLocaleProvider;
+
+class ChartsRangeSettingsModal extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ loading: false,
+ selectedKey: "1",
+ rangeSetting: {
+ itemValues: "",
+ itemColValue: "",
+ dimensionRange: "0"
+ },
+ rangeSettingExtra: {
+ itemSortValue: "",
+ itemColSortValue: "",
+ sortType: "0",
+ sortNum: ""
+ },
+ statisticalItemsOptions: [],
+ statisticalColsOptions: [],
+ rangeSettingExtraOptions: {
+ sortStatisticsOptions: [],
+ sortColumnsOptions: []
+ }
+ };
+ }
+
+ componentWillReceiveProps(nextProps, nextContext) {
+ if (nextProps.visible !== this.props.visible && nextProps.visible) {
+ const { columns } = nextProps;
+ this.setState({
+ statisticalItemsOptions: _.map(_.filter(columns, item => !_.isEmpty(item.children)), it => ({
+ key: it.column, showname: it.text,
+ children: _.map(it.children, child => ({ key: child.column, showname: child.text }))
+ }))
+ });
+ }
+ if (nextProps.rangeVal !== this.props.rangeVal && nextProps.rangeVal) {
+ const { rangeVal } = nextProps;
+ const { rangeSetting, rangeSettingExtra } = this.state;
+ this.setState({
+ rangeSetting: {
+ ...rangeSetting,
+ ..._.reduce(Object.keys(rangeSetting), (pre, cur) => {
+ return {
+ ...pre,
+ [cur]: Array.isArray(rangeVal[cur]) ? rangeVal[cur].join(",") :
+ !_.isNil(rangeVal[cur]) ? rangeVal[cur].toString() : cur === "dimensionRange" ? "0" : ""
+ };
+ }, {})
+ },
+ rangeSettingExtra: {
+ ...rangeSettingExtra,
+ ..._.reduce(Object.keys(rangeSettingExtra), (pre, cur) => {
+ return {
+ ...pre,
+ [cur]: !_.isNil(rangeVal[cur]) ? rangeVal[cur].toString() : cur === "sortType" ? "0" : ""
+ };
+ }, {})
+ }
+ }, () => {
+ const { statisticalItemsOptions } = this.state;
+ const { itemValues, itemSortValue } = rangeVal;
+ let statisticalColsOptions = [], sortStatisticsOptions = [];
+ _.forEach(itemValues, item => {
+ _.forEach(statisticalItemsOptions, child => {
+ if (item === child.key) {
+ statisticalColsOptions = [...statisticalColsOptions, ...child.children];
+ sortStatisticsOptions = [...sortStatisticsOptions, child];
+ }
+ });
+ });
+ this.setState({
+ statisticalColsOptions,
+ rangeSettingExtraOptions: {
+ sortStatisticsOptions
+ }
+ }, () => {
+ const { rangeSettingExtraOptions } = this.state;
+ const { sortStatisticsOptions } = rangeSettingExtraOptions;
+ this.setState({
+ rangeSettingExtraOptions: {
+ ...rangeSettingExtraOptions,
+ sortColumnsOptions: !_.isEmpty(_.find(sortStatisticsOptions, it => it.key === itemSortValue)) ? _.find(sortStatisticsOptions, it => it.key === itemSortValue).children : []
+ }
+ });
+ });
+ });
+ }
+ }
+
+ handleSaveChartsRangeSettings = () => {
+ const { reportId, chartsType, rangeVal } = this.props;
+ const { rangeSetting, rangeSettingExtra } = this.state;
+ const { itemValues, itemColValue, dimensionRange } = rangeSetting;
+ if (!itemColValue && !itemValues) {
+ this.refs.itemValues.showError();
+ this.refs.itemColValue.showError();
+ return;
+ }
+ if (!itemValues) {
+ this.refs.itemValues.showError();
+ return;
+ }
+ if (!itemColValue) {
+ this.refs.itemColValue.showError();
+ return;
+ }
+ const payload = {
+ reportId, chartsType, id: rangeVal.id,
+ ...rangeSetting,
+ itemValues: itemValues.split(",")
+ };
+ this.setState({ loading: true });
+ saveRangeSetting(
+ dimensionRange === "0" ? payload : { ...payload, ...rangeSettingExtra }
+ ).then(({ status, errormsg }) => {
+ this.setState({ loading: false });
+ if (status) {
+ message.success(getLabel(111, "保存成功"));
+ this.handleCancel();
+ } else {
+ message.error(errormsg || getLabel(111, "保存失败"));
+ }
+ }).catch(() => this.setState({ loading: false }));
+ };
+ handleCancel = () => {
+ this.setState({
+ rangeSetting: {
+ itemValues: "",
+ itemColValue: "",
+ dimensionRange: "0"
+ },
+ rangeSettingExtra: {
+ itemSortValue: "",
+ itemColSortValue: "",
+ sortType: "0",
+ sortNum: ""
+ },
+ selectedKey: "1",
+ statisticalItemsOptions: [],
+ statisticalColsOptions: []
+ }, () => this.props.onCancel());
+ };
+ handleResetFormVal = () => {
+ const { selectedKey: chartsType } = this.state;
+ const { reportId } = this.props;
+ this.props.onChange({ reportId, chartsType });
+ };
+ handleChange = ({ key, val }) => {
+ const { rangeSetting } = this.state;
+ this.setState({
+ rangeSetting: {
+ ...rangeSetting,
+ [key]: val
+ }
+ }, () => {
+ if (key === "itemValues") {
+ const { statisticalItemsOptions } = this.state;
+ let statisticalColsOptions = [], sortStatisticsOptions = [];
+ _.forEach(val.split(","), item => {
+ _.forEach(statisticalItemsOptions, child => {
+ if (item === child.key) {
+ statisticalColsOptions = [...statisticalColsOptions, ...child.children];
+ sortStatisticsOptions = [...sortStatisticsOptions, child];
+ }
+ });
+ });
+ this.setState({
+ statisticalColsOptions,
+ rangeSettingExtra: {
+ itemSortValue: "",
+ itemColSortValue: "",
+ sortType: "0",
+ sortNum: ""
+ },
+ rangeSettingExtraOptions: {
+ sortStatisticsOptions
+ }
+ });
+ }
+ });
+ };
+ handleChangeRange = ({ key, val }) => {
+ const { rangeSettingExtra } = this.state;
+ this.setState({
+ rangeSettingExtra: {
+ ...rangeSettingExtra,
+ [key]: val
+ }
+ }, () => {
+ if (key === "itemSortValue") {
+ const { rangeSettingExtraOptions } = this.state;
+ const { sortStatisticsOptions } = rangeSettingExtraOptions;
+ this.setState({
+ rangeSettingExtraOptions: {
+ ...rangeSettingExtraOptions,
+ sortColumnsOptions: _.find(sortStatisticsOptions, it => it.key === val).children
+ }
+ });
+ }
+ });
+ };
+
+ render() {
+ const {
+ selectedKey,
+ rangeSetting,
+ statisticalItemsOptions,
+ statisticalColsOptions,
+ rangeSettingExtra,
+ rangeSettingExtraOptions,
+ loading
+ } = this.state;
+ const dataShowItems = [
+ {
+ com: RangSelect({
+ name: "itemValues",
+ label: getLabel(111, "统计项"),
+ onChange: this.handleChange,
+ value: rangeSetting.itemValues,
+ options: statisticalItemsOptions,
+ multiple: true
+ })
+ },
+ {
+ com: RangSelect({
+ name: "itemColValue",
+ label: getLabel(111, "统计列"),
+ onChange: this.handleChange,
+ value: rangeSetting.itemColValue,
+ options: statisticalColsOptions
+ })
+ }
+ ];
+ const rangValItems = [
+ {
+ com: RangSelect({
+ name: "dimensionRange",
+ label: getLabel(111, "统计维度查看范围"),
+ onChange: this.handleChange,
+ value: rangeSetting.dimensionRange,
+ options: [
+ { key: "0", showname: getLabel(111, "全部") },
+ { key: "1", showname: getLabel(111, "设置范围") }
+ ],
+ detailtype: 3,
+ helpfulTip: getLabel(111, "通过某个统计项统计值的排序,确定统计维度的查看范围。 例:查看统计项【薪资成本】的统计值降序为前10的部门的分析图情况")
+ })
+ }
+ ];
+ const rangValExtraItems = [
+ {
+ com: RangMultiItem({
+ label: getLabel(111, "设置范围"),
+ onChange: this.handleChangeRange,
+ value: rangeSettingExtra,
+ options: rangeSettingExtraOptions
+ })
+ }
+ ];
+ const { dimensionRange } = rangeSetting;
+ return (
+ this.setState({ selectedKey }, () => this.handleResetFormVal())}
+ onSaveChartsRangeSettings={this.handleSaveChartsRangeSettings}
+ />}
+ >
+
+ {getLabel(111, "统计项数据展示范围设置")}
+
+
+ }
+ showGroup items={dataShowItems} needTigger col={1}
+ />
+
+
+ );
+ }
+}
+
+export default ChartsRangeSettingsModal;
+
+const RangSetingTitle = (props) => {
+ const { selectedKey, onChange, onSaveChartsRangeSettings, loading } = props;
+ const btns = [];
+ return }
+ iconBgcolor="#F14A2D" buttons={btns} showDropIcon={false}
+ tabDatas={[
+ { key: "1", title: "柱状图" },
+ { key: "2", title: "折线图" },
+ { key: "0", title: "饼图" }
+ ]} selectedKey={selectedKey} onChange={onChange}
+ />;
+};
+const RangSelect = payload => {
+ const {
+ label, onChange, value, options = [],
+ viewAttr = 3, multiple = false, name,
+ detailtype = 1, helpfulTip
+ } = payload;
+ return (
+
+ {label}
+ {
+ helpfulTip &&
+
+ }
+
+ } labelCol={{ span: 8 }} wrapperCol={{ span: 12 }}>
+
+ onChange({ key: name, val })}/>
+
+
+ );
+};
+const RangMultiItem = payload => {
+ const { label, onChange, value, options } = payload;
+ const { itemSortValue, itemColSortValue, sortType, sortNum } = value;
+ const { sortStatisticsOptions, sortColumnsOptions } = options;
+ return (
+
+
+ {getLabel(111, "排序统计项:")}
+ onChange({ key: "itemSortValue", val })}/>
+
+
+ {getLabel(111, "排序列:")}
+ onChange({ key: "itemColSortValue", val })}/>
+
+
+
+ onChange({ key: "sortType", val })}
+ />
+
+
+ {getLabel(111, "前")}
+ onChange({ key: "sortNum", val })}/>
+
+
+
+ );
+};
diff --git a/pc4mobx/hrmSalary/pages/reportView/components/index.less b/pc4mobx/hrmSalary/pages/reportView/components/index.less
new file mode 100644
index 00000000..33c5aed0
--- /dev/null
+++ b/pc4mobx/hrmSalary/pages/reportView/components/index.less
@@ -0,0 +1,50 @@
+.rangSettingWrapper {
+ .wea-search-group {
+ .wea-error, .wea-select, .ant-select, .ant-select-selection {
+ width: 100%;
+ }
+ }
+
+ .ant-modal-content {
+ .wea-browser-single-icon-circle {
+ display: none;
+ }
+
+ .wea-new-top-req-main {
+ border-radius: 10px;
+ background: transparent;
+ }
+
+ .wea-new-top-req, .wea-new-top-req-title > div:last-child {
+ background: transparent;
+ }
+
+ .wea-new-top-req-title {
+ & > div:first-child {
+ width: 216px !important;
+
+ & > div:first-child {
+ max-width: 415px !important;
+ }
+ }
+ }
+
+ .ant-col-22, .text-elli {
+ padding-left: 0 !important;
+ }
+ }
+
+ .rangSettingItemTitle {
+ display: flex;
+ align-items: center;
+
+ & > span {
+ margin-right: 8px;
+ }
+ }
+
+ .extraCol {
+ display: flex;
+ align-items: center;
+ }
+}
diff --git a/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js
index 413740e6..902396c5 100644
--- a/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js
+++ b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js
@@ -7,7 +7,8 @@
import React, { Component } from "react";
import { Spin } from "antd";
import RightOptions from "./rightOptions";
-import { reportStatisticsReportGetData } from "../../../apis/statistics";
+import ChartsRangeSettingsModal from "./chartsRangeSettingsModal";
+import { queryRangeSetting, reportStatisticsReportGetData } from "../../../apis/statistics";
import "../index.less";
class ReportContent extends Component {
@@ -17,7 +18,13 @@ class ReportContent extends Component {
columns: [],
dataSource: [],
countResult: {},
- loading: false
+ loading: false,
+ viewType: "dataView",
+ chartsType: "0",
+ rangSet: {
+ visible: false, reportId: "",
+ chartsType: "1", rangeVal: {}
+ }
};
}
@@ -28,6 +35,7 @@ class ReportContent extends Component {
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.report !== this.props.report && nextProps.report.dimensionId) {
this.reportStatisticsReportGetData(nextProps.report.id, nextProps.report.dimensionId);
+ this.setState({ viewType: "dataView" });
}
}
@@ -53,7 +61,6 @@ class ReportContent extends Component {
dataSource, columns, showSum, countResult
}), "*");
};
-
reportStatisticsReportGetData = (id, dimensionId) => {
const payload = { id, dimensionId };
this.setState({ loading: true });
@@ -84,26 +91,82 @@ class ReportContent extends Component {
}
}).catch(() => this.setState({ loading: false }));
};
+ queryRangeSetting = (payload) => {
+ this.setState({ loading: true });
+ queryRangeSetting(payload).then(({ status, data }) => {
+ this.setState({ loading: false });
+ if (status) {
+ const { rangSet } = this.state;
+ this.setState({
+ rangSet: {
+ ...rangSet,
+ rangeVal: data
+ }
+ });
+ }
+ }).catch(() => this.setState({ loading: false }));
+ };
+ handleChangeChartOpts = (chartsType, viewType) => {
+ const { report: { id: reportId, dimensionId } } = this.props;
+ const { rangSet } = this.state;
+ viewType !== "setting" && this.setState({ chartsType, viewType }, () => {
+ const { viewType, chartsType } = this.state;
+ viewType !== "dataView" ?
+ this.queryRangeSetting({ reportId, chartsType }) :
+ this.reportStatisticsReportGetData(reportId, dimensionId);
+ });
+ viewType === "setting" && this.setState({ rangSet: { ...rangSet, visible: true, reportId, chartsType } }, () => {
+ this.queryRangeSetting({ reportId, chartsType });
+ });
+ };
+ handleCancel = () => {
+ this.setState({
+ rangSet: {
+ visible: false, reportId: "",
+ chartsType: "1", rangeVal: {}
+ }
+ });
+ };
render() {
- const { loading } = this.state;
+ const { loading, viewType, rangSet, columns } = this.state;
return (
-
+ {
+ viewType === "dataView" ?
+ :
+ }
{/*侧边栏*/}
-
+
+ {/* 图表范围数据设置框 */}
+
);
}
}
export default ReportContent;
+
+const ChartEmptyComp = () => {
+ return
+
+
+
+
暂无数据
+
您还没有设置报表统计项,请先设置一下哦~
+
;
+};
diff --git a/pc4mobx/hrmSalary/pages/reportView/components/rightOptions.js b/pc4mobx/hrmSalary/pages/reportView/components/rightOptions.js
index d5144ee6..1cb4a075 100644
--- a/pc4mobx/hrmSalary/pages/reportView/components/rightOptions.js
+++ b/pc4mobx/hrmSalary/pages/reportView/components/rightOptions.js
@@ -19,17 +19,21 @@ class RightOptions extends Component {
}
render() {
+ const { onChange } = this.props;
const { show } = this.state;
return (
-
-
-
-
-
+ onChange("", "dataView")}/>
+ onChange("1", "bar")}/>
+ onChange("2", "line")}/>
+ onChange("0", "pie")}/>
+ onChange("1", "setting")}/>
span:first-child {
+ display: inline-block;
+ text-align: center;
+
+ img {
+ width: 100px;
+ height: 100px;
+ }
+ }
+
+ & > span:nth-child(2) {
+ font-size: 16px;
+ color: #666;
+ font-weight: 400;
+ margin-bottom: 8px;
+ }
+
+ & > span:nth-child(3) {
+ width: 100%;
+ font-size: 12px;
+ color: #999;
+ text-align: center;
+ }
+ }
}
.layoutSide {
From 185230b3572efa061374d0a43be3d233e5635197 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com>
Date: Fri, 12 May 2023 16:38:07 +0800
Subject: [PATCH 3/8] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E8=96=AA=E9=85=AC?=
=?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=88=86=E6=9E=90=E6=8A=A5=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../components/chartsRangeSettingsModal.js | 7 +-
.../pages/reportView/components/condition.js | 184 ++++++++++++++++++
.../reportView/components/reportContent.js | 77 +++++++-
pc4mobx/hrmSalary/pages/reportView/index.less | 5 +
4 files changed, 264 insertions(+), 9 deletions(-)
diff --git a/pc4mobx/hrmSalary/pages/reportView/components/chartsRangeSettingsModal.js b/pc4mobx/hrmSalary/pages/reportView/components/chartsRangeSettingsModal.js
index f9dc7cfa..143f16a7 100644
--- a/pc4mobx/hrmSalary/pages/reportView/components/chartsRangeSettingsModal.js
+++ b/pc4mobx/hrmSalary/pages/reportView/components/chartsRangeSettingsModal.js
@@ -113,8 +113,8 @@ class ChartsRangeSettingsModal extends Component {
}
handleSaveChartsRangeSettings = () => {
- const { reportId, chartsType, rangeVal } = this.props;
- const { rangeSetting, rangeSettingExtra } = this.state;
+ const { reportId, rangeVal } = this.props;
+ const { rangeSetting, rangeSettingExtra, selectedKey: chartsType } = this.state;
const { itemValues, itemColValue, dimensionRange } = rangeSetting;
if (!itemColValue && !itemValues) {
this.refs.itemValues.showError();
@@ -141,6 +141,7 @@ class ChartsRangeSettingsModal extends Component {
this.setState({ loading: false });
if (status) {
message.success(getLabel(111, "保存成功"));
+ this.props.onGetData();
this.handleCancel();
} else {
message.error(errormsg || getLabel(111, "保存失败"));
@@ -243,7 +244,7 @@ class ChartsRangeSettingsModal extends Component {
onChange: this.handleChange,
value: rangeSetting.itemValues,
options: statisticalItemsOptions,
- multiple: true
+ multiple: selectedKey !== "0"
})
},
{
diff --git a/pc4mobx/hrmSalary/pages/reportView/components/condition.js b/pc4mobx/hrmSalary/pages/reportView/components/condition.js
index 0e86091c..15ef59ce 100644
--- a/pc4mobx/hrmSalary/pages/reportView/components/condition.js
+++ b/pc4mobx/hrmSalary/pages/reportView/components/condition.js
@@ -151,3 +151,187 @@ export const condition = [
defaultshow: true
}
];
+export const mapBarOptions = (params) => ({
+ tooltip: {
+ trigger: "axis",
+ axisPointer: {
+ type: "shadow"
+ },
+ backgroundColor: "#FFF",
+ borderColor: "#FFF",
+ borderWidth: "1",
+ borderRadius: "5",
+ textStyle: {
+ color: "#333"
+ },
+ formatter: function (params) {
+ let str = params[0].axisValue + "
";
+ for (let item of params) {
+ str += item.seriesName + "" + item.value + "
";
+ }
+ return str;
+ }
+ },
+ legend: {
+ icon: "rect",
+ top: "0%",
+ right: "center",
+ itemGap: 10,
+ textStyle: {
+ fontSize: 12,//字体大小
+ color: "#B8B8B8"//字体颜色
+ }
+ },
+ grid: {
+ top: "10%",
+ right: "8%",
+ left: "1%",
+ bottom: "0%",
+ containLabel: true
+ },
+ xAxis: {
+ type: "category",
+ axisTick: {
+ alignWithLabel: true,
+ show: false
+ },
+ data: params.xAxis,
+ axisLabel: {
+ interval: 0,
+ margin: 10,
+ textStyle: {
+ fontSize: 11
+ }
+ }
+ },
+ yAxis: {
+ name: params.name,
+ axisLabel: {
+ padding: [3, 0, 0, 0],
+ formatter: "{value}",
+ color: "#666",
+ textStyle: {
+ fontSize: 11
+ }
+ },
+ nameTextStyle: {
+ color: "#787E95",
+ fontSize: 12
+ },
+ axisLine: {
+ show: true,
+ lineStyle: {
+ color: "transparent"
+ }
+ },
+ axisTick: {
+ show: false // 不显示坐标轴刻度线
+ },
+ splitLine: {
+ show: false,
+ lineStyle: {
+ color: "rgba(66, 192, 255, 0.1)"
+ }
+ }
+ },
+ series: _.map(params.data, item => {
+ return {
+ name: item.name,
+ // barWidth: "32",
+ data: item.data,
+ type: "bar",
+ itemStyle: {
+ // barBorderRadius: 12,
+ // color: '#21D1FD'
+ },
+ label: {
+ show: true,
+ position: "inside",
+ color: "#333"
+ }
+ };
+ })
+});
+export const mapLineOptions = (params) => ({
+ tooltip: {
+ // 坐标轴指示器,坐标轴触发有效
+ trigger: "axis",
+ axisPointer: {
+ // 默认为直线,可选为:'line' | 'shadow'
+ type: "line"
+ }
+ },
+ legend: {
+ icon: "circle",
+ top: "0%",
+ right: "center",
+ itemGap: 20,
+ textStyle: {
+ fontSize: 12,//字体大小
+ color: "#787E95"//字体颜色
+ }
+ },
+ grid: {
+ top: "10%",
+ left: "3%",
+ right: "2%",
+ bottom: "3%",
+ containLabel: true
+ },
+ xAxis: [
+ {
+ type: "category",
+ boundaryGap: false,
+ data: params.xAxis,
+ axisTick: {
+ alignWithLabel: true,
+ show: false
+ },
+ // 修改坐标值样式
+ axisLabel: {
+ color: "#B8B8B8",
+ fontSize: 12,
+ show: true
+ },
+ axisLine: {
+ show: false
+ }
+ }
+ ],
+ yAxis: [
+ {
+ type: "value",
+ // 修改坐标值样式
+ axisLabel: {
+ color: "#787E95",
+ fontSize: 14
+ },
+ nameTextStyle: {
+ color: "#787E95",
+ fontSize: 16
+ },
+ // 修改坐标轴线样式
+ axisLine: {
+ show: true,
+ lineStyle: {
+ color: "transparent"
+ }
+ },
+ axisTick: {
+ show: false // 不显示坐标轴刻度线
+ },
+ splitLine: {
+ lineStyle: {
+ color: "rgba(93,126,158,1)"
+ }
+ }
+ }
+ ],
+ series: _.map(params.data, item => {
+ return {
+ name: item.name,
+ data: item.data,
+ type: "line"
+ };
+ })
+});
diff --git a/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js
index 902396c5..b567e8e3 100644
--- a/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js
+++ b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js
@@ -6,8 +6,10 @@
*/
import React, { Component } from "react";
import { Spin } from "antd";
+import { WeaEchart } from "ecCom";
import RightOptions from "./rightOptions";
import ChartsRangeSettingsModal from "./chartsRangeSettingsModal";
+import { mapBarOptions, mapLineOptions } from "./condition";
import { queryRangeSetting, reportStatisticsReportGetData } from "../../../apis/statistics";
import "../index.less";
@@ -21,21 +23,23 @@ class ReportContent extends Component {
loading: false,
viewType: "dataView",
chartsType: "0",
+ chartsInfo: {},
rangSet: {
visible: false, reportId: "",
- chartsType: "1", rangeVal: {}
+ rangeVal: {}
}
};
}
componentDidMount() {
window.addEventListener("message", this.handleReceive, false);
+ if (this.refs.chart) this.refs.chart.paint();
}
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.report !== this.props.report && nextProps.report.dimensionId) {
this.reportStatisticsReportGetData(nextProps.report.id, nextProps.report.dimensionId);
- this.setState({ viewType: "dataView" });
+ this.setState({ viewType: "dataView", chartsInfo: {} });
}
}
@@ -92,17 +96,63 @@ class ReportContent extends Component {
}).catch(() => this.setState({ loading: false }));
};
queryRangeSetting = (payload) => {
+ const { dataSource, columns } = this.state;
this.setState({ loading: true });
queryRangeSetting(payload).then(({ status, data }) => {
this.setState({ loading: false });
if (status) {
- const { rangSet } = this.state;
+ const { rangSet, viewType } = this.state;
+ const { itemValues, itemColValue, id } = data;
this.setState({
rangSet: {
...rangSet,
rangeVal: data
}
+ }, () => {
+ if (this.refs.chart) this.refs.chart.clear();
+ if (this.refs.chart) this.refs.chart.paint();
});
+ if (id) {
+ switch (viewType) {
+ case "bar":
+ this.setState({
+ chartsInfo: {
+ name: _.find(_.reduce(_.filter(columns, col => !_.isNil(col.children)), (pre, cur) => ([...pre, ...cur.children]), []), it => it.column === itemColValue).text,
+ xAxis: _.reduce(itemValues, (pre, cur) => ([...pre, _.find(columns, item => item.column === cur).text]), []),
+ data: _.map(dataSource, item => {
+ return {
+ name: item.dimension,
+ data: _.map(itemValues, child => {
+ const key = child + itemColValue.slice(_.indexOf(itemColValue, "_"));
+ return item[key];
+ })
+ };
+ })
+ }
+ }, () => console.log(this.state.chartsInfo));
+ break;
+ case "line":
+ this.setState({
+ chartsInfo: {
+ xAxis: _.map(dataSource, it => it.dimension),
+ data: _.map(itemValues, item => {
+ return {
+ name: _.find(_.reduce(_.filter(columns, col => !_.isNil(col.children)), (pre, cur) => ([...pre, ...cur.children]), []), it => it.column === itemColValue).text,
+ data: _.map(dataSource, child => {
+ const key = item + itemColValue.slice(_.indexOf(itemColValue, "_"));
+ return child[key];
+ })
+ };
+ })
+ }
+ }, () => console.log(this.state.chartsInfo));
+ break;
+ default:
+ break;
+ }
+ } else {
+ this.setState({ chartsInfo: {} });
+ }
}
}).catch(() => this.setState({ loading: false }));
};
@@ -115,7 +165,7 @@ class ReportContent extends Component {
this.queryRangeSetting({ reportId, chartsType }) :
this.reportStatisticsReportGetData(reportId, dimensionId);
});
- viewType === "setting" && this.setState({ rangSet: { ...rangSet, visible: true, reportId, chartsType } }, () => {
+ viewType === "setting" && this.setState({ rangSet: { ...rangSet, visible: true, reportId } }, () => {
this.queryRangeSetting({ reportId, chartsType });
});
};
@@ -123,10 +173,24 @@ class ReportContent extends Component {
this.setState({
rangSet: {
visible: false, reportId: "",
- chartsType: "1", rangeVal: {}
+ rangeVal: {}
}
});
};
+ handleGetData = () => {
+ const { report } = this.props;
+ const { id, dimensionId } = report;
+ this.setState({ viewType: "dataView" }, () => this.reportStatisticsReportGetData(id, dimensionId));
+ };
+ renderCharts = () => {
+ const { chartsInfo, viewType } = this.state;
+ return _.isEmpty(chartsInfo) ? : (viewType === "bar" || viewType === "line") ?
+ :
+ 123
;
+ };
render() {
const { loading, viewType, rangSet, columns } = this.state;
@@ -141,7 +205,7 @@ class ReportContent extends Component {
// src="http://localhost:7607/#/reportTable"
src="/spa/hrmSalary/hrmSalaryCalculateDetail/index.html#/reportTable"
id="atdTable"
- /> :
+ /> : this.renderCharts()
}
@@ -153,6 +217,7 @@ class ReportContent extends Component {
columns={columns}
onCancel={this.handleCancel}
onChange={this.queryRangeSetting}
+ onGetData={this.handleGetData}
/>
);
diff --git a/pc4mobx/hrmSalary/pages/reportView/index.less b/pc4mobx/hrmSalary/pages/reportView/index.less
index 80cba57f..99d4d917 100644
--- a/pc4mobx/hrmSalary/pages/reportView/index.less
+++ b/pc4mobx/hrmSalary/pages/reportView/index.less
@@ -116,6 +116,11 @@
.ant-spin-nested-loading, .ant-spin-container {
height: 100%;
+
+ .chart {
+ width: 100%;
+ height: 100%;
+ }
}
.chartsEmptyWrapper {
From ef46215d0fc7671c6cdb78622699968256469e35 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com>
Date: Fri, 12 May 2023 16:51:30 +0800
Subject: [PATCH 4/8] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E8=96=AA=E9=85=AC?=
=?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=88=86=E6=9E=90=E6=8A=A5=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../pages/reportView/components/reportContent.js | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js
index b567e8e3..b69121cd 100644
--- a/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js
+++ b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js
@@ -95,7 +95,7 @@ class ReportContent extends Component {
}
}).catch(() => this.setState({ loading: false }));
};
- queryRangeSetting = (payload) => {
+ queryRangeSetting = (payload, isTab) => {
const { dataSource, columns } = this.state;
this.setState({ loading: true });
queryRangeSetting(payload).then(({ status, data }) => {
@@ -108,11 +108,9 @@ class ReportContent extends Component {
...rangSet,
rangeVal: data
}
- }, () => {
- if (this.refs.chart) this.refs.chart.clear();
- if (this.refs.chart) this.refs.chart.paint();
});
if (id) {
+ if (!isTab) return;
switch (viewType) {
case "bar":
this.setState({
@@ -150,6 +148,7 @@ class ReportContent extends Component {
default:
break;
}
+ if (this.refs.chart) this.refs.chart.paint();
} else {
this.setState({ chartsInfo: {} });
}
@@ -157,12 +156,13 @@ class ReportContent extends Component {
}).catch(() => this.setState({ loading: false }));
};
handleChangeChartOpts = (chartsType, viewType) => {
+ if (this.refs.chart && viewType !== "setting" && viewType !== "dataView" && !this.state.rangSet.visible) this.refs.chart.clear();
const { report: { id: reportId, dimensionId } } = this.props;
const { rangSet } = this.state;
viewType !== "setting" && this.setState({ chartsType, viewType }, () => {
const { viewType, chartsType } = this.state;
viewType !== "dataView" ?
- this.queryRangeSetting({ reportId, chartsType }) :
+ this.queryRangeSetting({ reportId, chartsType }, true) :
this.reportStatisticsReportGetData(reportId, dimensionId);
});
viewType === "setting" && this.setState({ rangSet: { ...rangSet, visible: true, reportId } }, () => {
From 13d21af0e417b508dd3be05d2acf59f0bf9aafd8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com>
Date: Mon, 15 May 2023 09:09:19 +0800
Subject: [PATCH 5/8] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E8=96=AA=E9=85=AC?=
=?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=8A=A5=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../pages/reportView/components/condition.js | 31 ++++++++++++++
.../reportView/components/reportContent.js | 42 +++++++++++++------
2 files changed, 61 insertions(+), 12 deletions(-)
diff --git a/pc4mobx/hrmSalary/pages/reportView/components/condition.js b/pc4mobx/hrmSalary/pages/reportView/components/condition.js
index 15ef59ce..17249524 100644
--- a/pc4mobx/hrmSalary/pages/reportView/components/condition.js
+++ b/pc4mobx/hrmSalary/pages/reportView/components/condition.js
@@ -335,3 +335,34 @@ export const mapLineOptions = (params) => ({
};
})
});
+export const mapPieOptions = (params) => ({
+ tooltip: {
+ show: true,
+ formatter: function (params) {
+ let str = params.seriesName + "
";
+ str += params.marker + params.name + "" + params.value + "(" + params.percent + "%" + ")" + "
";
+ return str;
+ }
+ },
+ legend: {
+ icon: "rect",
+ top: "0%",
+ left: "2%",
+ orient: "vertical",
+ itemGap: 10,
+ textStyle: {
+ fontSize: 12,//字体大小
+ color: "#787E95"//字体颜色
+ }
+ },
+ series: _.map(params.data, item => {
+ return {
+ name: item.name,
+ data: item.data,
+ type: "pie",
+ radius: "60%",
+ avoidLabelOverlap: false,
+ animation: false
+ };
+ })
+});
diff --git a/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js
index b69121cd..71fcd1a1 100644
--- a/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js
+++ b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js
@@ -9,7 +9,7 @@ import { Spin } from "antd";
import { WeaEchart } from "ecCom";
import RightOptions from "./rightOptions";
import ChartsRangeSettingsModal from "./chartsRangeSettingsModal";
-import { mapBarOptions, mapLineOptions } from "./condition";
+import { mapBarOptions, mapLineOptions, mapPieOptions } from "./condition";
import { queryRangeSetting, reportStatisticsReportGetData } from "../../../apis/statistics";
import "../index.less";
@@ -122,12 +122,12 @@ class ReportContent extends Component {
name: item.dimension,
data: _.map(itemValues, child => {
const key = child + itemColValue.slice(_.indexOf(itemColValue, "_"));
- return item[key];
+ return item[key] || "0";
})
};
})
}
- }, () => console.log(this.state.chartsInfo));
+ });
break;
case "line":
this.setState({
@@ -135,15 +135,32 @@ class ReportContent extends Component {
xAxis: _.map(dataSource, it => it.dimension),
data: _.map(itemValues, item => {
return {
- name: _.find(_.reduce(_.filter(columns, col => !_.isNil(col.children)), (pre, cur) => ([...pre, ...cur.children]), []), it => it.column === itemColValue).text,
+ name: `${_.find(_.reduce(_.filter(columns, col => !_.isNil(col.children)), (pre, cur) => ([...pre, ...cur.children]), []), it => it.column === itemColValue).text}(${_.find(columns, it => it.column === item).text})`,
data: _.map(dataSource, child => {
const key = item + itemColValue.slice(_.indexOf(itemColValue, "_"));
- return child[key];
+ return child[key] || "0";
})
};
})
}
- }, () => console.log(this.state.chartsInfo));
+ });
+ break;
+ case "pie":
+ this.setState({
+ chartsInfo: {
+ data: _.map(itemValues, item => {
+ return {
+ name: _.find(_.reduce(_.filter(columns, col => !_.isNil(col.children)), (pre, cur) => ([...pre, ...cur.children]), []), it => it.column === itemColValue).text,
+ data: _.map(dataSource, child => {
+ return {
+ name: child["dimension"],
+ value: child[itemColValue]
+ };
+ })
+ };
+ })
+ }
+ });
break;
default:
break;
@@ -184,12 +201,13 @@ class ReportContent extends Component {
};
renderCharts = () => {
const { chartsInfo, viewType } = this.state;
- return _.isEmpty(chartsInfo) ? : (viewType === "bar" || viewType === "line") ?
- :
- 123
;
+ return _.isEmpty(chartsInfo) ?
+ : (viewType === "bar" || viewType === "line" || viewType === "pie") ?
+ :
+ 123
;
};
render() {
From 6c615453f73e0826770355f2ac3fbbf7d2b1c4d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com>
Date: Mon, 15 May 2023 18:21:23 +0800
Subject: [PATCH 6/8] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E8=96=AA=E9=85=AC?=
=?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=88=86=E6=9E=90=E9=A1=B5=E9=9D=A2=E5=BC=80?=
=?UTF-8?q?=E5=8F=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/hrmSalary/apis/statistics.js | 4 +
.../pages/reportView/components/condition.js | 82 +++++++++++++++----
.../reportView/components/reportContent.js | 3 +-
.../statisticalMicroSettingsSlide.js | 2 +
pc4mobx/hrmSalary/util/index.js | 12 +++
5 files changed, 86 insertions(+), 17 deletions(-)
diff --git a/pc4mobx/hrmSalary/apis/statistics.js b/pc4mobx/hrmSalary/apis/statistics.js
index 4abd90fb..197339b5 100644
--- a/pc4mobx/hrmSalary/apis/statistics.js
+++ b/pc4mobx/hrmSalary/apis/statistics.js
@@ -58,6 +58,10 @@ export const reportStatisticsGetSearchCondition = (params) => {
export const queryRangeSetting = (params) => {
return WeaTools.callApi("/api/bs/hrmsalary/report/statistics/echarts/queryRangeSetting", "GET", params);
};
+//分析图数据展示范围设置删除
+export const deleteRangeSetting = (params) => {
+ return WeaTools.callApi("/api/bs/hrmsalary/report/statistics/echarts/deleteRangeSetting", "GET", params);
+};
//分析图数据展示范围设置保存
export const saveRangeSetting = (params) => {
return postFetch("/api/bs/hrmsalary/report/statistics/echarts/saveRangeSetting", params);
diff --git a/pc4mobx/hrmSalary/pages/reportView/components/condition.js b/pc4mobx/hrmSalary/pages/reportView/components/condition.js
index 17249524..5aafca6c 100644
--- a/pc4mobx/hrmSalary/pages/reportView/components/condition.js
+++ b/pc4mobx/hrmSalary/pages/reportView/components/condition.js
@@ -1,4 +1,5 @@
import { WeaLocaleProvider } from "ecCom";
+import { format_with_regex } from "../../../util";
const { getLabel } = WeaLocaleProvider;
export const condition = [
@@ -151,6 +152,8 @@ export const condition = [
defaultshow: true
}
];
+
+const colorList = ["#709DF7", "#73DEB3", "#7585A2", "#F7C739", "#5FC3E3", "#AEE279", "#FF7F81"];
export const mapBarOptions = (params) => ({
tooltip: {
trigger: "axis",
@@ -167,7 +170,7 @@ export const mapBarOptions = (params) => ({
formatter: function (params) {
let str = params[0].axisValue + "
";
for (let item of params) {
- str += item.seriesName + "" + item.value + "
";
+ str += `${item.marker}${item.seriesName}${format_with_regex(item.value)}
`;
}
return str;
}
@@ -184,8 +187,8 @@ export const mapBarOptions = (params) => ({
},
grid: {
top: "10%",
- right: "8%",
- left: "1%",
+ right: "0%",
+ left: "2%",
bottom: "0%",
containLabel: true
},
@@ -234,20 +237,50 @@ export const mapBarOptions = (params) => ({
}
}
},
- series: _.map(params.data, item => {
+ series: _.map(params.data, (item, index) => {
return {
name: item.name,
- // barWidth: "32",
- data: item.data,
+ barWidth: "32",
+ data: _.map(item.data, (it) => it.replace(/,/g, "")),
type: "bar",
itemStyle: {
- // barBorderRadius: 12,
- // color: '#21D1FD'
+ normal: {
+ color: function (params) {
+ return colorList[params.seriesIndex] || colorList[Math.floor((Math.random() * colorList.length))];
+ },
+ lineStyle: {
+ color: colorList[index] || colorList[Math.floor((Math.random() * colorList.length))]
+ }
+ }
},
label: {
show: true,
- position: "inside",
- color: "#333"
+ position: "insideBottom",
+ distance: 15,
+ align: "left",
+ verticalAlign: "middle",
+ rotate: "90",
+ formatter: function (params) {
+ if (parseInt(params.value) === 0) {
+ return `${format_with_regex(params.value)} ${params.seriesName}`;
+ } else {
+ return [
+ `{a|${format_with_regex(params.value)}} {b|${params.seriesName}}`
+ ];
+ }
+ },
+ rich: {
+ a: {
+ fontWeight: "bold",
+ fontSize: 14,
+ color: "#333",
+ marginRight: 10
+ },
+ b: {
+ fontSize: 12,
+ color: "#333"
+ }
+ }
}
};
})
@@ -327,11 +360,21 @@ export const mapLineOptions = (params) => ({
}
}
],
- series: _.map(params.data, item => {
+ series: _.map(params.data, (item, index) => {
return {
name: item.name,
- data: item.data,
- type: "line"
+ data: _.map(item.data, (it) => it.replace(/,/g, "")),
+ type: "line",
+ itemStyle: {
+ normal: {
+ color: function (params) {
+ return colorList[params.seriesIndex] || colorList[Math.floor((Math.random() * colorList.length))];
+ },
+ lineStyle: {
+ color: colorList[index] || colorList[Math.floor((Math.random() * colorList.length))]
+ }
+ }
+ }
};
})
});
@@ -340,7 +383,7 @@ export const mapPieOptions = (params) => ({
show: true,
formatter: function (params) {
let str = params.seriesName + "
";
- str += params.marker + params.name + "" + params.value + "(" + params.percent + "%" + ")" + "
";
+ str += params.marker + params.name + ":" + format_with_regex(params.value) + "(" + params.percent + "%" + ")" + "
";
return str;
}
},
@@ -358,11 +401,18 @@ export const mapPieOptions = (params) => ({
series: _.map(params.data, item => {
return {
name: item.name,
- data: item.data,
+ data: _.map(item.data, (it) => ({ ...it, value: it.value.replace(/,/g, "") })),
type: "pie",
radius: "60%",
avoidLabelOverlap: false,
- animation: false
+ animation: false,
+ itemStyle: {
+ normal: {
+ color: function (colors) {
+ return colorList[colors.dataIndex] || colorList[Math.floor((Math.random() * colorList.length))];
+ }
+ }
+ }
};
})
});
diff --git a/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js
index 71fcd1a1..3e0747f2 100644
--- a/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js
+++ b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js
@@ -61,7 +61,7 @@ class ReportContent extends Component {
postMessageToChild = (payload) => {
const childFrameObj = document.getElementById("atdTable");
const { dataSource, columns, showSum, countResult } = payload;
- childFrameObj.contentWindow.postMessage(JSON.stringify({
+ childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({
dataSource, columns, showSum, countResult
}), "*");
};
@@ -173,6 +173,7 @@ class ReportContent extends Component {
}).catch(() => this.setState({ loading: false }));
};
handleChangeChartOpts = (chartsType, viewType) => {
+ this.setState({ chartsInfo: {} });
if (this.refs.chart && viewType !== "setting" && viewType !== "dataView" && !this.state.rangSet.visible) this.refs.chart.clear();
const { report: { id: reportId, dimensionId } } = this.props;
const { rangSet } = this.state;
diff --git a/pc4mobx/hrmSalary/pages/reportView/components/statisticalMicroSettingsSlide.js b/pc4mobx/hrmSalary/pages/reportView/components/statisticalMicroSettingsSlide.js
index 6c39dd46..f06a8ea9 100644
--- a/pc4mobx/hrmSalary/pages/reportView/components/statisticalMicroSettingsSlide.js
+++ b/pc4mobx/hrmSalary/pages/reportView/components/statisticalMicroSettingsSlide.js
@@ -24,6 +24,7 @@ import { Button, message, Modal } from "antd";
import { condition } from "./condition";
import { getSearchs } from "../../../util";
import {
+ deleteRangeSetting,
reportStatisticsGetSearchCondition,
reportStatisticsItemDelete,
reportStatisticsSaveSearchCondition,
@@ -153,6 +154,7 @@ class StatisticalMicroSettingsSlide extends Component {
selectedRowKeys: []
}, () => {
this.statisticsItemList(this.props.id).then(r => {
+ deleteRangeSetting({ reportId: this.props.id });
});
});
} else {
diff --git a/pc4mobx/hrmSalary/util/index.js b/pc4mobx/hrmSalary/util/index.js
index 0608b1d1..de115ede 100644
--- a/pc4mobx/hrmSalary/util/index.js
+++ b/pc4mobx/hrmSalary/util/index.js
@@ -93,3 +93,15 @@ export function calcPageNo(total, pageNo = 1, pageSize = 10, selectDelDataLen =
return pageNo;
}
+//金额格式化
+export const format_with_regex = (number) => {
+ return !(number + "").includes(".")
+ ? // 就是说1-3位后面一定要匹配3位
+ (number + "").replace(/\d{1,3}(?=(\d{3})+$)/g, (match) => {
+ return match + ",";
+ })
+ : (number + "").replace(/\d{1,3}(?=(\d{3})+(\.))/g, (match) => {
+ return match + ",";
+ });
+};
+
From e08ba046575e177d12c8adace3a432dd5480b27d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com>
Date: Tue, 16 May 2023 09:00:51 +0800
Subject: [PATCH 7/8] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E8=96=AA=E9=85=AC?=
=?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=88=86=E6=9E=90=E9=A1=B5=E9=9D=A2=E5=BC=80?=
=?UTF-8?q?=E5=8F=91?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pc4mobx/hrmSalary/pages/reportView/components/condition.js | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/pc4mobx/hrmSalary/pages/reportView/components/condition.js b/pc4mobx/hrmSalary/pages/reportView/components/condition.js
index 5aafca6c..5b38c364 100644
--- a/pc4mobx/hrmSalary/pages/reportView/components/condition.js
+++ b/pc4mobx/hrmSalary/pages/reportView/components/condition.js
@@ -247,9 +247,6 @@ export const mapBarOptions = (params) => ({
normal: {
color: function (params) {
return colorList[params.seriesIndex] || colorList[Math.floor((Math.random() * colorList.length))];
- },
- lineStyle: {
- color: colorList[index] || colorList[Math.floor((Math.random() * colorList.length))]
}
}
},
@@ -262,7 +259,7 @@ export const mapBarOptions = (params) => ({
rotate: "90",
formatter: function (params) {
if (parseInt(params.value) === 0) {
- return `${format_with_regex(params.value)} ${params.seriesName}`;
+ return ``;
} else {
return [
`{a|${format_with_regex(params.value)}} {b|${params.seriesName}}`
From aa7c407f9fd88227f057cf6c5b371bc040b63a15 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com>
Date: Tue, 16 May 2023 14:06:12 +0800
Subject: [PATCH 8/8] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E8=96=AA=E9=85=AC?=
=?UTF-8?q?=E7=BB=9F=E8=AE=A1=E5=88=86=E6=9E=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../hrmSalary/pages/reportView/components/condition.js | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/pc4mobx/hrmSalary/pages/reportView/components/condition.js b/pc4mobx/hrmSalary/pages/reportView/components/condition.js
index 5b38c364..c8422666 100644
--- a/pc4mobx/hrmSalary/pages/reportView/components/condition.js
+++ b/pc4mobx/hrmSalary/pages/reportView/components/condition.js
@@ -401,8 +401,15 @@ export const mapPieOptions = (params) => ({
data: _.map(item.data, (it) => ({ ...it, value: it.value.replace(/,/g, "") })),
type: "pie",
radius: "60%",
- avoidLabelOverlap: false,
+ avoidLabelOverlap: true,
animation: false,
+ labelLine: {
+ show: true,
+ normal: {
+ length: 5,
+ align: "center"
+ }
+ },
itemStyle: {
normal: {
color: function (colors) {