From dfae2661a68cfc2840251bf945c903d8834a2a7d 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, 11 Apr 2023 13:41:56 +0800 Subject: [PATCH 001/142] =?UTF-8?q?=E4=BA=A7=E5=93=81=E5=8A=9F=E8=83=BD-?= =?UTF-8?q?=E8=96=AA=E9=85=AC=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 --- pc4mobx/hrmSalary/apis/statistics.js | 11 ++ pc4mobx/hrmSalary/index.js | 3 + .../components/conditions.js | 54 +++++++++ .../components/dimensionSlide.js | 76 +++++++++++++ .../components/dimensionTable.js | 19 ++++ .../components/statisticsModal.js | 33 ++++++ .../pages/analysisOfSalaryStatistics/index.js | 107 ++++++++++++++++++ .../analysisOfSalaryStatistics/index.less | 21 ++++ pc4mobx/hrmSalary/stores/attendanceStore.js | 2 + 9 files changed, 326 insertions(+) create mode 100644 pc4mobx/hrmSalary/apis/statistics.js create mode 100644 pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/conditions.js create mode 100644 pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionSlide.js create mode 100644 pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionTable.js create mode 100644 pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/statisticsModal.js create mode 100644 pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.js create mode 100644 pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less diff --git a/pc4mobx/hrmSalary/apis/statistics.js b/pc4mobx/hrmSalary/apis/statistics.js new file mode 100644 index 00000000..2536ea8c --- /dev/null +++ b/pc4mobx/hrmSalary/apis/statistics.js @@ -0,0 +1,11 @@ +import { WeaTools } from "ecCom"; +import { postFetch } from "../util/request"; + +//薪酬统计维度下拉列表 +export const dimensionSelectList = (params) => { + return WeaTools.callApi("/api/bs/hrmsalary/report/statistics/dimension/selectList", "GET", params); +}; +// 保存薪酬统计维度 +export const dimensionSave = (params) => { + return postFetch("/api/bs/hrmsalary/report/statistics/dimension/save", params); +}; diff --git a/pc4mobx/hrmSalary/index.js b/pc4mobx/hrmSalary/index.js index b59a534a..24931140 100644 --- a/pc4mobx/hrmSalary/index.js +++ b/pc4mobx/hrmSalary/index.js @@ -32,6 +32,7 @@ import SysConfig from "./pages/sysConfig"; import RuleConfig from "./pages/ruleConfig"; import Appconfig from "./pages/appConfig"; import FieldManagement from "./pages/fieldManagement"; +import AnalysisOfSalaryStatistics from "./pages/analysisOfSalaryStatistics" import stores from "./stores"; import "./style/index"; @@ -78,6 +79,7 @@ const DataAcquisition = (props) => props.children; // sysconfig-1 规则配置 // appconfig 应用配置 // fieldManagement 字段管理 +// analysisOfSalaryStatistics 薪酬统计分析 const Routes = ( + ); diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/conditions.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/conditions.js new file mode 100644 index 00000000..260115e5 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/conditions.js @@ -0,0 +1,54 @@ +export const condition = [ + { + items: [ + { + colSpan: 1, + checkbox: false, + checkboxValue: false, + conditionType: "SELECT", + domkey: ["dimType"], + fieldcol: 14, + label: "维度类型", + labelcol: 6, + options: [], + detailtype: 2, + rules: "required|string", + viewAttr: 3 + }, + { + colSpan: 1, + conditionType: "SELECT", + domkey: ["dimCode"], + fieldcol: 14, + label: "统计维度", + labelcol: 6, + options: [], + rules: "required|string", + viewAttr: 3 + }, + { + colSpan: 1, + conditionType: "INPUT", + domkey: ["dimName"], + fieldcol: 14, + label: "统计维度名称", + labelcol: 6, + value: "", + rules: "required|string", + viewAttr: 3, + }, + { + colSpan: 1, + conditionType: "TEXTAREA", + domkey: ["remark"], + fieldcol: 14, + label: "描述", + labelcol: 6, + value: "", + viewAttr: 2, + }, + ], + title: "基础设置", + defaultshow: true, + }, +]; diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionSlide.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionSlide.js new file mode 100644 index 00000000..f905b5a4 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionSlide.js @@ -0,0 +1,76 @@ +/* + * Author: 黎永顺 + * name: 新增统计维度弹框 + * Description: + * Date: 2023/4/11 + */ +import React, { Component } from "react"; +import { WeaDialog } from "ecCom"; +import { Button } from "antd"; +import { condition } from "./conditions"; +import { commonEnumList } from "../../../apis/ruleconfig"; +import { dimensionSelectList } from "../../../apis/statistics"; +import { getSearchs } from "../../../util"; +import "../index.less"; + +class DimensionSlide extends Component { + constructor(props) { + super(props); + this.state = { + date: "" + }; + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) { + const promise = this.initCondition(); + nextProps.form.initFormFields(condition); + } + } + + + initCondition = async () => { + const [dimTypeEnum, dimCodeList] = await Promise.all([this.commonEnumList(), this.dimensionSelectList()]); + console.log(dimTypeEnum, dimCodeList, condition); + }; + commonEnumList = () => { + const payload = { + enumClass: "com.engine.salary.report.enums.SalaryStatisticsDimensionTypeEnum" + }; + return commonEnumList(payload); + }; + dimensionSelectList = () => { + return dimensionSelectList(); + }; + handleSave = () => { + this.props.form.validateForm().then(f => { + if (f.isValid) { + } else { + f.showErrors(); + this.setState({ date: new Date() }); + } + }); + }; + + render() { + const { form } = this.props; + return ( + + 新建统计维度 + + + } + > + {getSearchs(form, condition, 1)} + + ); + } +} + +export default DimensionSlide; diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionTable.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionTable.js new file mode 100644 index 00000000..8cdb57c9 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionTable.js @@ -0,0 +1,19 @@ +/* + * Author: 黎永顺 + * name: 统计维度管理列表 + * Description: + * Date: 2023/4/11 + */ +import React, { Component } from "react"; + +class DimensionTable extends Component { + render() { + return ( +
+ +
+ ); + } +} + +export default DimensionTable; diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/statisticsModal.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/statisticsModal.js new file mode 100644 index 00000000..de45c1c3 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/statisticsModal.js @@ -0,0 +1,33 @@ +/* + * Author: 黎永顺 + * name: 统计弹框 + * Description: + * Date: 2023/4/10 + */ +import React, { Component } from "react"; +import { WeaDialog } from "ecCom"; +import { Button } from "antd"; +import "../index.less"; + +class StatisticsModal extends Component { + render() { + const { typeKey, onCancel } = this.props; + const buttons = typeKey === "addReport" ? [ + + ] : []; + return ( + + {this.props.children} + + ); + } +} + +export default StatisticsModal; diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.js new file mode 100644 index 00000000..e3460063 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.js @@ -0,0 +1,107 @@ +/* + * Author: 黎永顺 + * name: 薪酬统计分析 + * Description: + * Date: 2023/4/10 + */ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { WeaInputSearch, WeaReqTop } from "ecCom"; +import { Button } from "antd"; +import StatisticsModal from "./components/statisticsModal"; +import DimensionSlide from "./components/dimensionSlide"; +import "./index.less"; + +@inject("taxAgentStore", "attendanceStore") +@observer +class Index extends Component { + constructor(props) { + super(props); + this.state = { + selectedKey: "statistics", + slideReq: { + visible: false + }, + modalReq: { + title: "", visible: false, + typeKey: "" + } + }; + } + + handleReqBtnsClick = (key) => { + if (key === "search") { + + } else { + const { modalReq } = this.state; + const title = key === "dimension" ? +
+ 统计维度管理 + +
+ : "新建报表"; + this.setState({ + modalReq: { + ...modalReq, + title, visible: true, typeKey: key + } + }); + } + }; + handleCancel = () => { + const { modalReq } = this.state; + this.setState({ + modalReq: { + ...modalReq, visible: false + } + }); + }; + handleAddDimension = () => { + const { slideReq } = this.state; + this.setState({ + slideReq: { + ...slideReq, visible: true + } + }); + }; + handleClose = () => { + const { slideReq } = this.state; + this.setState({ + slideReq: { + ...slideReq, visible: false + } + }); + }; + + render() { + const { taxAgentStore: { showOperateBtn }, attendanceStore: { statisticsForm } } = this.props; + const { selectedKey, modalReq, slideReq } = this.state; + const buttons = [ + , + , + this.handleReqBtnsClick("search")}/> + ]; + const tabs = [ + { key: "statistics", title: "统计表" }, + { key: "detail", title: "员工明细" } + ]; + return ( + } + iconBgcolor="#F14A2D" buttons={!showOperateBtn ? buttons.slice(-1) : buttons} buttonSpace={10} + showDropIcon={false} tabDatas={tabs} className="xc_tj_fx_wrapper" + selectedKey={selectedKey} onChange={selectedKey => this.setState({ selectedKey })} + > +
+ +
123
+
+ +
+
+ ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less new file mode 100644 index 00000000..9840ad74 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less @@ -0,0 +1,21 @@ +.xc_tj_fx_wrapper { + .search { + top: -3px; + margin-right: 10px; + width: 220px; + } +} + +//统计维度弹框 +.dimensionModalWrapper, .dimensionSlideWrapper { + .dimensionTitle { + width: 100%; + display: flex; + align-items: center; + justify-content: space-between; + } + + .wea-select, .ant-select, .ant-select-selection { + width: 100%; + } +} diff --git a/pc4mobx/hrmSalary/stores/attendanceStore.js b/pc4mobx/hrmSalary/stores/attendanceStore.js index 3f3d2912..ed18f076 100644 --- a/pc4mobx/hrmSalary/stores/attendanceStore.js +++ b/pc4mobx/hrmSalary/stores/attendanceStore.js @@ -5,4 +5,6 @@ import { WeaForm } from "comsMobx"; export class AttendanceStore { @observable form = new WeaForm(); @observable refenceform = new WeaForm(); + //薪酬统计 新增form + @observable statisticsForm = new WeaForm(); } From 6846e8149815a76ac3bdd2f304a0f8e927705d9b 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, 11 Apr 2023 14:34:17 +0800 Subject: [PATCH 002/142] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E8=96=AA=E9=85=AC?= =?UTF-8?q?=E5=88=86=E6=9E=90=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/statistics.js | 4 ++-- .../components/conditions.js | 2 +- .../components/dimensionSlide.js | 11 +++++++---- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/pc4mobx/hrmSalary/apis/statistics.js b/pc4mobx/hrmSalary/apis/statistics.js index 2536ea8c..3ac89281 100644 --- a/pc4mobx/hrmSalary/apis/statistics.js +++ b/pc4mobx/hrmSalary/apis/statistics.js @@ -2,8 +2,8 @@ import { WeaTools } from "ecCom"; import { postFetch } from "../util/request"; //薪酬统计维度下拉列表 -export const dimensionSelectList = (params) => { - return WeaTools.callApi("/api/bs/hrmsalary/report/statistics/dimension/selectList", "GET", params); +export const dimensionGetForm = (params) => { + return WeaTools.callApi("/api/bs/hrmsalary/report/statistics/dimension/getForm", "GET", params); }; // 保存薪酬统计维度 export const dimensionSave = (params) => { diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/conditions.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/conditions.js index 260115e5..e8066d81 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/conditions.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/conditions.js @@ -11,7 +11,7 @@ export const condition = [ label: "维度类型", labelcol: 6, options: [], - detailtype: 2, + detailtype: 3, rules: "required|string", viewAttr: 3 }, diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionSlide.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionSlide.js index f905b5a4..046c14c1 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionSlide.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionSlide.js @@ -9,7 +9,7 @@ import { WeaDialog } from "ecCom"; import { Button } from "antd"; import { condition } from "./conditions"; import { commonEnumList } from "../../../apis/ruleconfig"; -import { dimensionSelectList } from "../../../apis/statistics"; +import { dimensionGetForm } from "../../../apis/statistics"; import { getSearchs } from "../../../util"; import "../index.less"; @@ -30,7 +30,10 @@ class DimensionSlide extends Component { initCondition = async () => { - const [dimTypeEnum, dimCodeList] = await Promise.all([this.commonEnumList(), this.dimensionSelectList()]); + const [dimTypeEnum, dimCodeList] = await Promise.all([this.commonEnumList(), this.dimensionGetForm()]); + const { data: dimTypeData } = dimTypeEnum, { data: dimCodeData } = dimCodeList; + + console.log(dimTypeEnum, dimCodeList, condition); }; commonEnumList = () => { @@ -39,8 +42,8 @@ class DimensionSlide extends Component { }; return commonEnumList(payload); }; - dimensionSelectList = () => { - return dimensionSelectList(); + dimensionGetForm = () => { + return dimensionGetForm(); }; handleSave = () => { this.props.form.validateForm().then(f => { From 8fe5f201c67c488d176c34f217c4be0317cb7449 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, 12 Apr 2023 10:47:51 +0800 Subject: [PATCH 003/142] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B5=B1=E8=A8=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/apis/statistics.js | 8 + .../components/conditions.js | 24 ++- .../components/dimensionSlide.js | 94 ++++++++---- .../components/dimensionTable.js | 102 ++++++++++++- .../components/statisticsModal.js | 4 +- .../pages/analysisOfSalaryStatistics/index.js | 143 ++++++++++++++++-- .../analysisOfSalaryStatistics/index.less | 11 ++ pc4mobx/hrmSalary/stores/attendanceStore.js | 9 +- pc4mobx/hrmSalary/util/index.js | 103 +++++-------- 9 files changed, 386 insertions(+), 112 deletions(-) diff --git a/pc4mobx/hrmSalary/apis/statistics.js b/pc4mobx/hrmSalary/apis/statistics.js index 3ac89281..6fcc827b 100644 --- a/pc4mobx/hrmSalary/apis/statistics.js +++ b/pc4mobx/hrmSalary/apis/statistics.js @@ -9,3 +9,11 @@ export const dimensionGetForm = (params) => { export const dimensionSave = (params) => { return postFetch("/api/bs/hrmsalary/report/statistics/dimension/save", params); }; +// 薪酬统计维度列表 +export const dimensionList = (params) => { + return postFetch("/api/bs/hrmsalary/report/statistics/dimension/list", params); +}; +// 删除薪酬统计维度 +export const dimensionDelete = (params) => { + return postFetch("/api/bs/hrmsalary/report/statistics/dimension/delete", params); +}; diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/conditions.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/conditions.js index e8066d81..42ef8654 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/conditions.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/conditions.js @@ -18,7 +18,7 @@ export const condition = [ { colSpan: 1, conditionType: "SELECT", - domkey: ["dimCode"], + domkey: ["setting4Qualitative"], fieldcol: 14, label: "统计维度", labelcol: 6, @@ -35,7 +35,19 @@ export const condition = [ labelcol: 6, value: "", rules: "required|string", - viewAttr: 3, + viewAttr: 3 + }, + { + colSpan: 1, + conditionType: "SELECT", + domkey: ["dimCode"], + fieldcol: 14, + label: "分组所属字段", + labelcol: 6, + options: [], + viewAttr: 2, + helpfulTip: "", + hide: true }, { colSpan: 1, @@ -45,10 +57,10 @@ export const condition = [ label: "描述", labelcol: 6, value: "", - viewAttr: 2, - }, + viewAttr: 2 + } ], title: "基础设置", - defaultshow: true, - }, + defaultshow: true + } ]; diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionSlide.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionSlide.js index 046c14c1..c3ba1159 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionSlide.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionSlide.js @@ -6,10 +6,8 @@ */ import React, { Component } from "react"; import { WeaDialog } from "ecCom"; -import { Button } from "antd"; -import { condition } from "./conditions"; -import { commonEnumList } from "../../../apis/ruleconfig"; -import { dimensionGetForm } from "../../../apis/statistics"; +import { Button, message } from "antd"; +import { dimensionGetForm, dimensionSave } from "../../../apis/statistics"; import { getSearchs } from "../../../util"; import "../index.less"; @@ -17,46 +15,90 @@ class DimensionSlide extends Component { constructor(props) { super(props); this.state = { + loading: false, date: "" }; } + componentDidMount() { + this.props.initCondition(); + } + componentWillReceiveProps(nextProps, nextContext) { - if (nextProps.visible !== this.props.visible && nextProps.visible) { - const promise = this.initCondition(); - nextProps.form.initFormFields(condition); + if (nextProps.visible !== this.props.visible && nextProps.formId) this.dimensionGetForm({ id: nextProps.formId }); + if (nextProps.visible !== this.props.visible && !nextProps.formId) { + nextProps.form.updateFields({ + dimType: "QUALITATIVE" + }); + nextProps.onChangeCondition("QUALITATIVE"); } } - - initCondition = async () => { - const [dimTypeEnum, dimCodeList] = await Promise.all([this.commonEnumList(), this.dimensionGetForm()]); - const { data: dimTypeData } = dimTypeEnum, { data: dimCodeData } = dimCodeList; - - - console.log(dimTypeEnum, dimCodeList, condition); - }; - commonEnumList = () => { - const payload = { - enumClass: "com.engine.salary.report.enums.SalaryStatisticsDimensionTypeEnum" - }; - return commonEnumList(payload); - }; - dimensionGetForm = () => { - return dimensionGetForm(); + dimensionGetForm = (payload) => { + dimensionGetForm(payload).then(({ status, data }) => { + if (status) { + const { baseForm: { data: formData } } = data; + const fields = _.map(this.props.condition[0].items, it => { + return it.domkey[0]; + }); + fields.map(item => { + if (item !== "setting4Qualitative") { + this.props.form.updateFields({ + [item]: formData[item] || "" + }); + } else { + this.props.form.updateFields({ + setting4Qualitative: formData.statsDim + }); + } + }); + this.props.onChangeCondition(formData["dimType"], 1); + } + }); }; + handleSave = () => { + const { condition, onCancel, formId } = this.props; this.props.form.validateForm().then(f => { + console.log(f); + console.log(this.props.form.getFormParams()); if (f.isValid) { + console.log(this.props.form.getFormParams()); + return; + const { setting4Qualitative, ...extraParams } = this.props.form.getFormParams(); + const options = _.find(condition[0].items, item => item.domkey[0] === "setting4Qualitative").options; + const obj = _.find(options, item => item.key === setting4Qualitative); + const payload = { + id: formId, + ...extraParams, + setting4Qualitative: { id: obj.key, name: obj.showname } + }; + this.setState({ loading: true }); + dimensionSave(payload).then(({ status, errormsg }) => { + this.setState({ loading: false }); + if (status) { + message.success("保存成功"); + onCancel(true); + this.props.form.resetForm(); + } else { + message.error(errormsg || "保存失败"); + } + }).catch(() => this.setState({ loading: false })); } else { f.showErrors(); this.setState({ date: new Date() }); } }); }; + formItemChange = (formObj) => { + const { onChangeCondition } = this.props; + const filedKey = _.keys(formObj)[0]; + if (filedKey === "dimType") onChangeCondition(formObj[filedKey].value); + }; render() { - const { form } = this.props; + const { loading } = this.state; + const { form, condition } = this.props; return ( 新建统计维度 - + } > - {getSearchs(form, condition, 1)} + {getSearchs(form, condition, 1, false, this.formItemChange)} ); } diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionTable.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionTable.js index 8cdb57c9..c94e4910 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionTable.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionTable.js @@ -5,13 +5,107 @@ * Date: 2023/4/11 */ import React, { Component } from "react"; +import { WeaTable } from "ecCom"; +import { message, Modal } from "antd"; +import { dimensionDelete, dimensionList } from "../../../apis/statistics"; +import "../index.less"; + class DimensionTable extends Component { - render() { - return ( -
+ constructor(props) { + super(props); + this.state = { + loading: false, + dataSource: [], + pageInfo: { + current: 0, pageSize: 10, total: 0 + } + }; + } -
+ componentDidMount() { + this.dimensionList(); + } + + dimensionList = (extra = {}) => { + const { pageInfo } = this.state; + this.setState({ loading: true }); + dimensionList({ ...pageInfo, ...extra }).then(({ status, data }) => { + this.setState({ loading: false }); + if (status) { + const { pageNum: curren, pageSize, total, list: dataSource } = data; + this.setState({ + dataSource, + pageInfo: { + ...pageInfo, + curren, pageSize, total + } + }); + } + }).catch(() => this.setState({ loading: false })); + }; + dimensionDelete = (payload) => { + Modal.confirm({ + title: "信息确认", + content: "确认要删除吗?", + onOk: () => { + dimensionDelete(payload).then(({ status, errormsg }) => { + if (status) { + message.success("删除成功"); + this.dimensionList(); + } else { + message.error(errormsg || "删除失败"); + } + }); + } + }); + }; + + render() { + const { dataSource, loading, pageInfo } = this.state; + const { onEdit } = this.props; + const pagination = { + ...pageInfo, + showTotal: total => `共 ${total} 条`, + showQuickJumper: true, + showSizeChanger: true, + pageSizeOptions: ["10", "20", "50", "100"], + onShowSizeChange: (current, pageSize) => { + this.setState({ + pageInfo: { ...pageInfo, current, pageSize } + }, () => this.dimensionList()); + }, + onChange: current => { + this.setState({ + pageInfo: { ...pageInfo, current } + }, () => this.dimensionList()); + } + }; + const columns = [ + { dataIndex: "dimName", title: "统计维度" }, + { dataIndex: "remark", title: "描述" }, + { dataIndex: "dimType", title: "维度类型" }, + { + dataIndex: "operate", title: "操作", + render: (_, record) => { + return ( + + onEdit(record.id)}>编辑 + this.dimensionDelete([record.id])}>删除 + + ); + } + } + ]; + return ( + ); } } diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/statisticsModal.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/statisticsModal.js index de45c1c3..8354993a 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/statisticsModal.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/statisticsModal.js @@ -17,8 +17,8 @@ class StatisticsModal extends Component { ] : []; return ( { + const { attendanceStore: { statisticsForm } } = this.props; + const [dimTypeEnum, dimCodeList] = await Promise.all([this.commonEnumList(), this.dimensionGetForm()]); + const { data: dimTypeData } = dimTypeEnum, { data: dimCodeData } = dimCodeList; + const { baseForm: { statsDimOptions, groupDimOptions, data: dimTypeValue } } = dimCodeData; + this.setState({ + conditions: _.map(condition, item => { + return { + ...item, + items: _.map(item.items, child => { + if (child.domkey[0] === "dimType") { + return { + ...child, + value: dimTypeValue.dimType, + options: _.map(dimTypeData, dimTypeItem => ({ + key: dimTypeItem.value, + showname: dimTypeItem.defaultLabel + })) + }; + } + if (child.domkey[0] === "setting4Qualitative") { + return { + ...child, + options: _.map(statsDimOptions, dimCodeItem => ({ + key: dimCodeItem.id, + showname: dimCodeItem.content + })) + }; + } + if (child.domkey[0] === "dimCode") { + return { + ...child, + options: _.map(groupDimOptions, dimCodeItem => ({ + key: dimCodeItem.id, + showname: dimCodeItem.content + })) + }; + } + return { ...child }; + }) + }; + }) + }, () => { + this.setState({ convertConditions: this.state.conditions }); + statisticsForm.initFormFields(this.state.conditions); + }); + }; + commonEnumList = () => { + const payload = { + enumClass: "com.engine.salary.report.enums.SalaryStatisticsDimensionTypeEnum" + }; + return commonEnumList(payload); + }; + dimensionGetForm = () => { + return dimensionGetForm(); + }; + handleChangeCondition = (val, viewAttr) => { + const { attendanceStore: { statisticsForm, initStatisticsForm } } = this.props; + console.log(val); + const helpfulTitle = val === "RATION_GROUP_SPACING" ? + "例:\n" + + " 若:所属字段为【工龄】,分组设置为【0-5】,【5-10】;统计项为【税前薪资】,对应的统计规则为【求和】; 则统计结果为:【工龄】为【0-5】的所有人的【税前薪资】求和,【工龄】为【5-10】的所有人的【税前薪资】求和;\n" + + "若:未选择所属字段,分组设置为【0-10,000.00】,【10,000.00-20,000.00】;若统计项为【税前薪资】,对应的统计规则为【计数】; 则统计结果为:【税前薪资】为【0-10,000.00】有多少人,【税前薪资】为【10,000.00-20,000.00】有多少人;" : + val === "RATION_GROUP_INDIVIDUAL" ? + "例:\n" + + " 若:所属字段为【职级】,分组设置为【1】,【2】,【3】;统计项为【税前薪资】,对应的统计规则为【平均值】; 则统计结果为:【职级】为【1】的所有人的【税前薪资】的平均值,【职级】为【2】的所有人的【税前薪资】的平均值;【职级】为【3】的所有人的【税前薪资】的平均值;\n" + + "若:未选择所属字段,分组设置为【1】,【2】,【3】;若统计项为【绩效】,对应的统计规则为【计数】; 则统计结果为:【绩效】为【1】有多少人,绩效为【2】有多少人,绩效为【3】有多少人;" : ""; + + if (val === "QUALITATIVE") { + this.setState({ + conditions: _.map(this.state.convertConditions, item => { + return { + ...item, + items: _.map(_.filter(item.items, child => child.domkey[0] !== "dimCode"), it => { + if (it.domkey[0] === "dimType") { + return { ...it, value: val, viewAttr: viewAttr ? viewAttr : it.viewAttr }; + } + return { ...it }; + }) + }; + }) + }, () => { + initStatisticsForm(this.state.conditions); + }); + } else { + this.setState({ + conditions: _.map(this.state.convertConditions, item => { + return { + ...item, + items: _.map(_.filter(item.items, child => child.domkey[0] !== "setting4Qualitative"), it => { + if (it.domkey[0] === "dimType") { + return { ...it, value: val, viewAttr: viewAttr ? viewAttr : it.viewAttr }; + } else if (it.domkey[0] === "dimCode") { + return { ...it, helpfulTitle }; + } + return { ...it }; + }) + }; + }) + }, () => { + initStatisticsForm(this.state.conditions); + // statisticsForm.initFormFields(this.state.conditions); + }); + } + }; handleReqBtnsClick = (key) => { if (key === "search") { @@ -37,7 +148,7 @@ class Index extends Component { const title = key === "dimension" ?
统计维度管理 - +
: "新建报表"; this.setState({ @@ -56,26 +167,31 @@ class Index extends Component { } }); }; - handleAddDimension = () => { + handleAddDimension = (formId = "") => { const { slideReq } = this.state; this.setState({ slideReq: { - ...slideReq, visible: true + ...slideReq, visible: true, + formId } }); }; - handleClose = () => { + handleClose = (initTable = false) => { + const { attendanceStore: { statisticsForm } } = this.props; const { slideReq } = this.state; this.setState({ slideReq: { - ...slideReq, visible: false + ...slideReq, visible: false, formId: "" } + }, () => { + statisticsForm.resetForm(); + initTable && this.dimensionTableRef.dimensionList(); }); }; render() { const { taxAgentStore: { showOperateBtn }, attendanceStore: { statisticsForm } } = this.props; - const { selectedKey, modalReq, slideReq } = this.state; + const { selectedKey, modalReq, slideReq, conditions } = this.state; const buttons = [ , , @@ -95,9 +211,18 @@ class Index extends Component { >
-
123
+ { + modalReq.typeKey === "dimension" && + this.dimensionTableRef = dom} + onEdit={id => this.handleAddDimension(id)} + /> + }
- +
); diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less index 9840ad74..d53b539c 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less @@ -15,6 +15,17 @@ justify-content: space-between; } + .dimensionTableWrapper { + .space10 { + a:first-child { + margin-right: 10px; + } + } + } + +} + +.dimensionSlideWrapper { .wea-select, .ant-select, .ant-select-selection { width: 100%; } diff --git a/pc4mobx/hrmSalary/stores/attendanceStore.js b/pc4mobx/hrmSalary/stores/attendanceStore.js index ed18f076..48730bb5 100644 --- a/pc4mobx/hrmSalary/stores/attendanceStore.js +++ b/pc4mobx/hrmSalary/stores/attendanceStore.js @@ -1,4 +1,4 @@ -import { observable } from "mobx"; +import { action, observable } from "mobx"; import { WeaForm } from "comsMobx"; @@ -7,4 +7,11 @@ export class AttendanceStore { @observable refenceform = new WeaForm(); //薪酬统计 新增form @observable statisticsForm = new WeaForm(); + + @action + initStatisticsForm = (condition) => { + this.statisticsForm && this.statisticsForm.updateIsFormInit(false); + this.statisticsForm = new WeaForm(); + this.statisticsForm.setCondition(condition, true); + }; } diff --git a/pc4mobx/hrmSalary/util/index.js b/pc4mobx/hrmSalary/util/index.js index ffaa1956..7c1344f7 100644 --- a/pc4mobx/hrmSalary/util/index.js +++ b/pc4mobx/hrmSalary/util/index.js @@ -1,65 +1,35 @@ -import { Spin } from 'antd'; -import { WeaSwitch } from 'comsMobx'; -import { WeaLocaleProvider, WeaAlertPage, WeaSearchGroup, WeaFormItem } from 'ecCom'; +import { Spin } from "antd"; +import { WeaSwitch } from "comsMobx"; +import { WeaAlertPage, WeaFormItem, WeaHelpfulTip, WeaLocaleProvider, WeaSearchGroup } from "ecCom"; + const getLabel = WeaLocaleProvider.getLabel; -// 渲染form表单: 一般对form的渲染都统一使用该方法 -export const getCustomSearchs = (form, condition, col, isCenter) => { - const { isFormInit } = form; - const formParams = form.getFormParams(); - let items = []; - let group = []; - isFormInit && condition && - condition.map(c =>{ - c.items.map(fields => { - items.push({ - com:( - - - ), - colSpan:1, - }) - }); +// 获取condition的domKey值 +export const getConditionDomkeys = (condition) => { + let domkeyList = []; + _.forEach(condition, item => { + const tmpV = _.reduce(item.items, (pre, cur) => { + return [...pre, cur["domkey"][0]]; + }, []); + domkeyList = domkeyList.concat(tmpV); }); - - if(items.length > 0) { - group.push( - ) - return group; - } -} + return domkeyList; +}; // 渲染form表单: 一般对form的渲染都统一使用该方法 -export const getSearchs = (form, condition, col, isCenter) => { +export const getSearchs = (form, condition, col, isCenter, onChange = () => void (0)) => { const { isFormInit } = form; const formParams = form.getFormParams(); let group = []; - isFormInit && condition && condition.map(c =>{ + isFormInit && condition && condition.map(c => { let items = []; c.items.map(fields => { items.push({ - com:( + com: ( @@ -67,39 +37,44 @@ export const getSearchs = (form, condition, col, isCenter) => { fieldConfig={fields} form={form} formParams={formParams} + onChange={onChange} /> + { + fields.helpfulTitle && + + } ), - colSpan:1, - }) + colSpan: 1 + }); }); group.push( ) + />); }); return group; -} +}; // 页面加载中效果处理 export const renderLoading = (loading) => (
- +
-) +); // 无权限处理 export const renderNoright = () => (
- {getLabel(2012,'对不起,您暂时没有权限!')} + {getLabel(2012, "对不起,您暂时没有权限!")}
-) +); // 暂无数据处理 export const renderNoData = () => ( @@ -108,13 +83,13 @@ export const renderNoData = () => ( 暂无数据 -) +); //分页计算 -export function calcPageNo (total, pageNo = 1, pageSize = 10, selectDelDataLen = 1) { - const totalPage = Math.ceil((total - selectDelDataLen) / pageSize) // 总页数 - pageNo = pageNo > totalPage ? totalPage : pageNo - pageNo = pageNo < 1 ? 1 : pageNo - return pageNo +export function calcPageNo(total, pageNo = 1, pageSize = 10, selectDelDataLen = 1) { + const totalPage = Math.ceil((total - selectDelDataLen) / pageSize); // 总页数 + pageNo = pageNo > totalPage ? totalPage : pageNo; + pageNo = pageNo < 1 ? 1 : pageNo; + return pageNo; } From 167caa4f5b85c303684ce5dd350a3fecfa363cf5 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, 12 Apr 2023 15:53:32 +0800 Subject: [PATCH 004/142] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B5=B1=E8=A8=88?= =?UTF-8?q?=E6=96=B0=E5=8A=9F=E8=83=BD=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/dimensionSlide.js | 179 +++++++++++++----- .../components/groupIndividualEditTable.js | 51 +++++ .../components/groupSpacingEditTable.js | 98 ++++++++++ .../pages/analysisOfSalaryStatistics/index.js | 8 +- pc4mobx/hrmSalary/stores/attendanceStore.js | 9 +- 5 files changed, 284 insertions(+), 61 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/groupIndividualEditTable.js create mode 100644 pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/groupSpacingEditTable.js diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionSlide.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionSlide.js index c3ba1159..16866f49 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionSlide.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionSlide.js @@ -5,18 +5,27 @@ * Date: 2023/4/11 */ import React, { Component } from "react"; -import { WeaDialog } from "ecCom"; -import { Button, message } from "antd"; +import { WeaDialog, WeaSearchGroup } from "ecCom"; +import { Button, message, Modal } from "antd"; import { dimensionGetForm, dimensionSave } from "../../../apis/statistics"; import { getSearchs } from "../../../util"; +import GroupSpacingEditTable from "./groupSpacingEditTable"; +import GroupIndividualEditTable from "./groupIndividualEditTable"; import "../index.less"; +const keyObj = { + "RATION_GROUP_SPACING": "setting4RationGroupSpacing", + "RATION_GROUP_INDIVIDUAL": "setting4RationGroupIndividual" +}; + class DimensionSlide extends Component { constructor(props) { super(props); this.state = { loading: false, - date: "" + dimType: "QUALITATIVE", + setting4RationGroupSpacing: [], + setting4RationGroupIndividual: [] }; } @@ -32,72 +41,131 @@ class DimensionSlide extends Component { }); nextProps.onChangeCondition("QUALITATIVE"); } + if (nextProps.visible !== this.props.visible && !nextProps.visible) { + this.setState({ + loading: false, + dimType: "QUALITATIVE", + setting4RationGroupSpacing: [], + setting4RationGroupIndividual: [] + }); + } } + dimensionGetForm = (payload) => { dimensionGetForm(payload).then(({ status, data }) => { if (status) { const { baseForm: { data: formData } } = data; - const fields = _.map(this.props.condition[0].items, it => { - return it.domkey[0]; - }); - fields.map(item => { - if (item !== "setting4Qualitative") { - this.props.form.updateFields({ - [item]: formData[item] || "" - }); - } else { - this.props.form.updateFields({ - setting4Qualitative: formData.statsDim - }); - } - }); + const setting = JSON.parse(formData.setting); this.props.onChangeCondition(formData["dimType"], 1); + this.setState({ + dimType: formData.dimType, + [keyObj[formData["dimType"]]]: setting + }, () => { + const fields = _.map(this.props.condition[0].items, it => { + return it.domkey[0]; + }); + fields.map(item => { + if (item !== "setting4Qualitative") { + this.props.form.updateFields({ + [item]: formData[item] || "" + }); + } else if (item === "setting4Qualitative" && formData.statsDim) { + this.props.form.updateFields({ + setting4Qualitative: formData.statsDim + }); + } + }); + }); } }); }; - handleSave = () => { + const { dimType } = this.state; const { condition, onCancel, formId } = this.props; - this.props.form.validateForm().then(f => { - console.log(f); - console.log(this.props.form.getFormParams()); - if (f.isValid) { - console.log(this.props.form.getFormParams()); + const { setting4Qualitative, dimCode, ...extraParams } = this.props.form.getFormParams(); + let payload = { id: formId, ...extraParams }; + if (dimType === "QUALITATIVE") { + if (!setting4Qualitative || !extraParams.dimName) { + Modal.warning({ + title: "信息确认", + content: "必要信息不完整,红色*为必填项!" + }); return; - const { setting4Qualitative, ...extraParams } = this.props.form.getFormParams(); - const options = _.find(condition[0].items, item => item.domkey[0] === "setting4Qualitative").options; - const obj = _.find(options, item => item.key === setting4Qualitative); - const payload = { - id: formId, - ...extraParams, - setting4Qualitative: { id: obj.key, name: obj.showname } - }; - this.setState({ loading: true }); - dimensionSave(payload).then(({ status, errormsg }) => { - this.setState({ loading: false }); - if (status) { - message.success("保存成功"); - onCancel(true); - this.props.form.resetForm(); - } else { - message.error(errormsg || "保存失败"); - } - }).catch(() => this.setState({ loading: false })); - } else { - f.showErrors(); - this.setState({ date: new Date() }); } - }); + const tjOptions = _.find(condition[0].items, item => item.domkey[0] === "setting4Qualitative").options; + const tjObj = _.find(tjOptions, item => item.key === setting4Qualitative); + payload = { ...payload, setting4Qualitative: { id: tjObj.key, name: tjObj.showname } }; + } else { + if (!extraParams.dimName) { + Modal.warning({ + title: "信息确认", + content: "必要信息不完整,红色*为必填项!" + }); + return; + } + if (dimType === "RATION_GROUP_SPACING") { + const { setting4RationGroupSpacing } = this.state; + const bool = _.every(setting4RationGroupSpacing, it => it.startValue !== "" && it.endValue !== "" && it.startValue <= it.endValue); + if (_.isEmpty(setting4RationGroupSpacing) || !bool) { + message.warning("请完善分组设置相关数据!分组设置不能为空,起始值结束值必填,且起始值需小于结束值!"); + return; + } else { + payload = { + ...payload, dimCode, + setting4RationGroupSpacing: _.map(setting4RationGroupSpacing, (it, index) => ({ + id: index + 1, + endValue: it.endValue, + startValue: it.startValue, + includeEnd: it.includeEnd === "1", + includeStart: it.includeStart === "1" + })) + }; + } + } else if (dimType === "RATION_GROUP_INDIVIDUAL") { + const { setting4RationGroupIndividual } = this.state; + const bool = _.every(setting4RationGroupIndividual, it => it.value !== ""); + if (_.isEmpty(setting4RationGroupIndividual) || !bool) { + message.warning("请完善分组设置相关数据!分组设置不能为空,且数值必填"); + return; + } else { + payload = { + ...payload, dimCode, + setting4RationGroupIndividual: _.map(setting4RationGroupIndividual, (it, index) => ({ id: index + 1, ...it })) + }; + } + } + } + this.setState({ loading: true }); + dimensionSave(payload).then(({ status, errormsg }) => { + this.setState({ loading: false }); + if (status) { + message.success("保存成功"); + onCancel(true); + this.props.form.resetForm(); + } else { + message.error(errormsg || "保存失败"); + } + }).catch(() => this.setState({ loading: false })); }; formItemChange = (formObj) => { const { onChangeCondition } = this.props; const filedKey = _.keys(formObj)[0]; - if (filedKey === "dimType") onChangeCondition(formObj[filedKey].value); + if (filedKey === "dimType") { + this.setState({ + dimType: formObj[filedKey].value, + setting4RationGroupSpacing: [], + setting4RationGroupIndividual: [] + }, () => onChangeCondition(formObj[filedKey].value)); + } + }; + handleConvertGroupDatasource = (data) => { + const { dimType } = this.state; + this.setState({ [keyObj[dimType]]: data }); }; render() { - const { loading } = this.state; + const { loading, dimType, setting4RationGroupSpacing, setting4RationGroupIndividual } = this.state; const { form, condition } = this.props; return ( {getSearchs(form, condition, 1, false, this.formItemChange)} + { + dimType !== "QUALITATIVE" && + + { + dimType === "RATION_GROUP_SPACING" && + + } + { + dimType === "RATION_GROUP_INDIVIDUAL" && + + } + + } ); } diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/groupIndividualEditTable.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/groupIndividualEditTable.js new file mode 100644 index 00000000..5d2ba0e3 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/groupIndividualEditTable.js @@ -0,0 +1,51 @@ +/* + * Author: 黎永顺 + * name: 分组设置-定量-单项式分组编辑表格 + * Description: + * Date: 2023/4/12 + */ +import React, { Component } from "react"; +import { WeaTableEdit } from "ecCom"; + +class GroupIndividualEditTable extends Component { + constructor(props) { + super(props); + this.state = { + dataSource: [] + }; + } + + componentDidMount() { + const { setting4RationGroupIndividual } = this.props; + this.setState({ + dataSource: setting4RationGroupIndividual + }); + } + + handleChangeTableData = (dataSource) => { + const { onChange } = this.props; + this.setState({ dataSource }, () => onChange(this.state.dataSource)); + }; + + render() { + const { dataSource } = this.state; + const columns = [ + { + title: "分组设置值", + dataIndex: "value", + key: "value", + com: [ + { label: "", key: "value", type: "INPUTNUMBER" } + ] + } + ]; + return ( + + ); + } +} + +export default GroupIndividualEditTable; diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/groupSpacingEditTable.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/groupSpacingEditTable.js new file mode 100644 index 00000000..76720774 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/groupSpacingEditTable.js @@ -0,0 +1,98 @@ +/* + * Author: 黎永顺 + * name: 分组设置-定量-组距式分组编辑表格 + * Description: + * Date: 2023/4/12 + */ +import React, { Component } from "react"; +import { WeaTableEdit } from "ecCom"; + +class GroupSpacingEditTable extends Component { + constructor(props) { + super(props); + this.state = { + dataSource: [] + }; + } + + componentDidMount() { + const { setting4RationGroupSpacing } = this.props; + this.setState({ + dataSource: _.map(setting4RationGroupSpacing, item => { + return { + ...item, + includeStart: item.includeStart ? "1" : "0", + includeEnd: item.includeEnd ? "1" : "0" + }; + }) + }); + } + + handleChangeTableData = (dataSource) => { + const { onChange } = this.props; + this.setState({ dataSource }, () => onChange(this.state.dataSource)); + }; + + render() { + const { dataSource } = this.state; + const columns = [ + { + title: "起始值", + dataIndex: "startValue", + key: "startValue", + com: [ + { label: "", key: "startValue", type: "INPUTNUMBER" } + ] + }, + { + title: "含", + dataIndex: "includeStart", + key: "includeStart", + com: [ + { + type: "CHECKBOX", + key: "includeStart", + otherParams: { content: "含" } + } + ] + }, + { + title: "至", + dataIndex: "to", + key: "to", + com: [ + { label: "", type: "TEXT" } + ] + }, + { + title: "结束值", + dataIndex: "endValue", + key: "endValue", + com: [ + { label: "", key: "endValue", type: "INPUTNUMBER" } + ] + }, + { + title: "含", + dataIndex: "includeEnd", + key: "includeEnd", + com: [ + { + type: "CHECKBOX", + key: "includeEnd", + otherParams: { content: "含" } + } + ] + } + ]; + return ( + ({ ...item, to: "至" }))} + showCopy={false} onChange={this.handleChangeTableData} + /> + ); + } +} + +export default GroupSpacingEditTable; diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.js index bb6fe300..4bdd4f6e 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.js @@ -92,8 +92,7 @@ class Index extends Component { return dimensionGetForm(); }; handleChangeCondition = (val, viewAttr) => { - const { attendanceStore: { statisticsForm, initStatisticsForm } } = this.props; - console.log(val); + const { attendanceStore: { statisticsForm } } = this.props; const helpfulTitle = val === "RATION_GROUP_SPACING" ? "例:\n" + " 若:所属字段为【工龄】,分组设置为【0-5】,【5-10】;统计项为【税前薪资】,对应的统计规则为【求和】; 则统计结果为:【工龄】为【0-5】的所有人的【税前薪资】求和,【工龄】为【5-10】的所有人的【税前薪资】求和;\n" + @@ -117,7 +116,7 @@ class Index extends Component { }; }) }, () => { - initStatisticsForm(this.state.conditions); + statisticsForm.setCondition(this.state.conditions); }); } else { this.setState({ @@ -135,8 +134,7 @@ class Index extends Component { }; }) }, () => { - initStatisticsForm(this.state.conditions); - // statisticsForm.initFormFields(this.state.conditions); + statisticsForm.setCondition(this.state.conditions); }); } }; diff --git a/pc4mobx/hrmSalary/stores/attendanceStore.js b/pc4mobx/hrmSalary/stores/attendanceStore.js index 48730bb5..ed18f076 100644 --- a/pc4mobx/hrmSalary/stores/attendanceStore.js +++ b/pc4mobx/hrmSalary/stores/attendanceStore.js @@ -1,4 +1,4 @@ -import { action, observable } from "mobx"; +import { observable } from "mobx"; import { WeaForm } from "comsMobx"; @@ -7,11 +7,4 @@ export class AttendanceStore { @observable refenceform = new WeaForm(); //薪酬统计 新增form @observable statisticsForm = new WeaForm(); - - @action - initStatisticsForm = (condition) => { - this.statisticsForm && this.statisticsForm.updateIsFormInit(false); - this.statisticsForm = new WeaForm(); - this.statisticsForm.setCondition(condition, true); - }; } From 644113efcbd606e4b3134fac7142b3491ce8bc1c 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, 13 Apr 2023 10:00:24 +0800 Subject: [PATCH 005/142] =?UTF-8?q?=E5=85=AC=E5=BC=8F=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8=E7=BB=84=E4=BB=B6=E5=B0=81=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/excelEditor/constants.js | 16 + .../excelEditor/extendCodeMirror.js | 111 +++++ .../hrmSalary/components/excelEditor/index.js | 112 +++++ .../components/excelEditor/index.less | 450 ++++++++++++++++++ pc4mobx/hrmSalary/index.js | 2 + .../hrmSalary/pages/equationEditor/index.js | 12 + 6 files changed, 703 insertions(+) create mode 100644 pc4mobx/hrmSalary/components/excelEditor/constants.js create mode 100644 pc4mobx/hrmSalary/components/excelEditor/extendCodeMirror.js create mode 100644 pc4mobx/hrmSalary/components/excelEditor/index.js create mode 100644 pc4mobx/hrmSalary/components/excelEditor/index.less create mode 100644 pc4mobx/hrmSalary/pages/equationEditor/index.js diff --git a/pc4mobx/hrmSalary/components/excelEditor/constants.js b/pc4mobx/hrmSalary/components/excelEditor/constants.js new file mode 100644 index 00000000..a113371b --- /dev/null +++ b/pc4mobx/hrmSalary/components/excelEditor/constants.js @@ -0,0 +1,16 @@ +export const keyboardBaseBtns=[ + { key:"1", label: "+" }, + { key:"2", label: "-" }, + { key:"3", label: ">" }, + { key:"4", label: ">=" }, + { key:"5", label: "=" }, + { key:"6", label: "*" }, + { key:"7", label: "/" }, + { key:"8", label: "<" }, + { key:"9", label: "<=" }, + { key:"10", label: "!=" }, + { key:"11", label: "(" }, + { key:"12", label: ")" }, + { key:"13", label: "%" }, + { key:"space", label: "space" }, +] diff --git a/pc4mobx/hrmSalary/components/excelEditor/extendCodeMirror.js b/pc4mobx/hrmSalary/components/excelEditor/extendCodeMirror.js new file mode 100644 index 00000000..342f2761 --- /dev/null +++ b/pc4mobx/hrmSalary/components/excelEditor/extendCodeMirror.js @@ -0,0 +1,111 @@ +// extendCodeMirror.js +/* eslint-disable */ +import * as CodeMirror from 'codemirror'; + +CodeMirror.extendMode("css", { + commentStart: "/*", + commentEnd: "*/", + newlineAfterToken: function(type, content) { + return /^[;{}]$/.test(content); + } +}); + +CodeMirror.extendMode("javascript", { + commentStart: "/*", + commentEnd: "*/", +// FIXME semicolons inside of for + newlineAfterToken: function(type, content, textAfter, state) { + if (this.jsonMode) { + return /^[\[,{]$/.test(content) || /^}/.test(textAfter)|| /^]/.test(textAfter); + } else { + if (content == ";" && state.lexical && state.lexical.type == ")") return false; + return /^[;{}]$/.test(content) && !/^;/.test(textAfter); + } + } +}); + +CodeMirror.extendMode("xml", { + commentStart: "", + newlineAfterToken: function(type, content, textAfter) { + return type == "tag" && />$/.test(content) || /^ -1 && endIndex > -1 && endIndex > startIndex) { + // Take string till comment start + selText = selText.substr(0, startIndex) + // From comment start till comment end + + selText.substring(startIndex + curMode.commentStart.length, endIndex) + // From comment end till string end + + selText.substr(endIndex + curMode.commentEnd.length); + } + cm.replaceRange(selText, from, to); + } + }); +}); + +// Applies automatic mode-aware indentation to the specified range +CodeMirror.defineExtension("autoIndentRange", function (from, to) { + var cmInstance = this; + this.operation(function () { + for (var i = from.line; i <= to.line; i++) { + cmInstance.indentLine(i, "smart"); + } + }); +}); + +// Applies automatic formatting to the specified range +CodeMirror.defineExtension("autoFormatRange", function (from, to) { + var cm = this; + var outer = cm.getMode(), text = cm.getRange(from, to).split("\n"); + var state = CodeMirror.copyState(outer, cm.getTokenAt(from).state); + var tabSize = cm.getOption("tabSize"); + + var out = "", lines = 0, atSol = from.ch == 0; + function newline() { + out += "\n"; + atSol = true; + ++lines; + } + + for (var i = 0; i < text.length; ++i) { + var stream = new CodeMirror.StringStream(text[i], tabSize); + while (!stream.eol()) { + var inner = CodeMirror.innerMode(outer, state); + var style = outer.token(stream, state), cur = stream.current(); + stream.start = stream.pos; + if (!atSol || /\S/.test(cur)) { + out += cur; + atSol = false; + } + if (!atSol && inner.mode.newlineAfterToken && + inner.mode.newlineAfterToken(style, cur, stream.string.slice(stream.pos) || text[i+1] || "", inner.state)) + newline(); + } + if (!stream.pos && outer.blankLine) outer.blankLine(state); + if (!atSol) newline(); + } + + cm.operation(function () { + cm.replaceRange(out, from, to); + for (var cur = from.line + 1, end = from.line + lines; cur <= end; ++cur) + cm.indentLine(cur, "smart"); + cm.setSelection(from, cm.getCursor(false)); + }); +}); +// console.log("初始化CodeMirror完成"); +export default CodeMirror; diff --git a/pc4mobx/hrmSalary/components/excelEditor/index.js b/pc4mobx/hrmSalary/components/excelEditor/index.js new file mode 100644 index 00000000..6d9db2d2 --- /dev/null +++ b/pc4mobx/hrmSalary/components/excelEditor/index.js @@ -0,0 +1,112 @@ +import React, { Component } from "react"; +import { Button } from "antd"; +import { UnControlled as CodeMirror } from "react-codemirror2"; +import { keyboardBaseBtns } from "./constants"; +import cs from "classnames"; +import "./index.less"; + +import "codemirror/lib/codemirror.css"; +import "codemirror/lib/codemirror.js"; + +import "codemirror/theme/dracula.css"; //主题 +//代码折叠 +import "codemirror/addon/fold/foldgutter.css"; +import "codemirror/addon/lint/lint.css"; +import "codemirror/addon/fold/foldcode.js"; +import "codemirror/addon/fold/foldgutter.js"; +import "codemirror/addon/fold/brace-fold.js"; +import "codemirror/addon/hint/javascript-hint.js"; +import "codemirror/addon/hint/show-hint.js"; +import "codemirror/addon/lint/lint.js"; +import "codemirror/addon/lint/json-lint.js"; +import "codemirror/addon/lint/javascript-lint.js"; +import "codemirror/addon/display/placeholder.js"; +import "codemirror/mode/javascript/javascript.js"; +import "codemirror/mode/sql/sql.js"; + +// const sqlFormatter = require('sql-formatter'); + +class ExcelEditor extends Component { + constructor(props) { + super(props); + this.state = { + value: "" + }; + } + + + render() { + return ( + +
+
+ { + this.setState({ value }); + }} + onChange={(editor, value) => { + console.log("controlled", { value }); + }} + options={{ + lineNumbers: false, + mode: { name: this.props.type === "sql" ? "text/x-sql" : "application/json" }, + autofocus: false, + styleActiveLine: true, + lineWrapping: true, + foldGutter: true, + gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"], + lint: false, + indentUnit: 2, + cursorHeight: 0.85, + placeholder: "" + }} + /> +
+
+
+
+ { + _.map(keyboardBaseBtns, item => { + const { key, label } = item; + return ; + }) + } +
+
+ + +
+
+
+
+
+
+
+
变量
+
+
+
+
+
+
函数
+
+
+
+
+
+
提示
+
+
+
+
+
+ ); + } +} + +export default ExcelEditor; diff --git a/pc4mobx/hrmSalary/components/excelEditor/index.less b/pc4mobx/hrmSalary/components/excelEditor/index.less new file mode 100644 index 00000000..0cb45a6b --- /dev/null +++ b/pc4mobx/hrmSalary/components/excelEditor/index.less @@ -0,0 +1,450 @@ +.excel-codeWrap { + width: 100%; + display: flex; + justify-content: space-around; + padding: 0 0 8px; + + .excel-codeBox { + flex: 1; + overflow: auto; + background: #fff; + box-sizing: content-box; + border: 1px solid #e5e5e5; + + .esb-algorithm-sourceContent { + .CodeMirror { + } + } + } + + .excel-codeBox-keyboard { + width: 272px; + min-height: 232px; + padding: 20px; + background: #fff; + border: 1px solid #e5e5e5; + border-left: none; + + .excel-codeBox-keyboard-operate { + display: flex; + + .excel-codeBox-keyboard-operate-content { + display: flex; + flex-wrap: wrap; + flex: 1; + + .excel-codeBox-keyboard-base { + width: 30px; + height: 30px; + text-align: center; + margin: 0 10px 10px 0; + } + + .excel-codeBox-keyboard-space { + width: 70px; + height: 30px; + } + } + + .excel-codeBox-keyboard-operate-clear { + width: 30px; + + .excel-codeBox-keyboard-del { + width: 30px; + height: 70px; + } + + .excel-codeBox-keyboard-clear { + width: 30px; + height: 30px; + margin-top: 10px; + } + } + } + } +} + +.excel-codeAction { + width: 100%; + display: flex; + justify-content: space-between; + + .excel-codeAction-item:last-child { + margin-right: 0; + + .excel-codeAction-header-title { + color: rgb(217, 82, 189); + } + } + + .excel-codeAction-item { + width: 33%; + min-height: 317px; + flex: 1; + background: #fff; + border: 1px solid #e5e5e5; + margin-right: 16px; + + .excel-codeAction-header { + display: flex; + padding: 10px 16px; + border-bottom: 1px solid #e5e5e5; + + .excel-codeAction-header-title { + flex: 1; + font-weight: 600; + } + } + } +} +// +///* BASICS */ +// +//.CodeMirror { +// /* Set height, width, borders, and global font properties here */ +// font-family: monospace; +// height: 300px; +// color: black; +// direction: ltr; +//} +// +///* PADDING */ +// +//.CodeMirror-lines { +// padding: 4px 0; /* Vertical padding around content */ +//} +//.CodeMirror pre.CodeMirror-line, +//.CodeMirror pre.CodeMirror-line-like { +// padding: 0 4px; /* Horizontal padding of content */ +//} +// +//.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { +// background-color: white; /* The little square between H and V scrollbars */ +//} +// +///* GUTTER */ +// +//.CodeMirror-gutters { +// border-right: 1px solid #ddd; +// background-color: #f7f7f7; +// white-space: nowrap; +//} +//.CodeMirror-linenumbers {} +//.CodeMirror-linenumber { +// padding: 0 3px 0 5px; +// min-width: 20px; +// text-align: right; +// color: #999; +// white-space: nowrap; +//} +// +//.CodeMirror-guttermarker { color: black; } +//.CodeMirror-guttermarker-subtle { color: #999; } +// +///* CURSOR */ +// +//.CodeMirror-cursor { +// border-left: 1px solid black; +// border-right: none; +// width: 0; +//} +///* Shown when moving in bi-directional text */ +//.CodeMirror div.CodeMirror-secondarycursor { +// border-left: 1px solid silver; +//} +//.cm-fat-cursor .CodeMirror-cursor { +// width: auto; +// border: 0 !important; +// background: #7e7; +//} +//.cm-fat-cursor div.CodeMirror-cursors { +// z-index: 1; +//} +//.cm-fat-cursor-mark { +// background-color: rgba(20, 255, 20, 0.5); +// -webkit-animation: blink 1.06s steps(1) infinite; +// -moz-animation: blink 1.06s steps(1) infinite; +// animation: blink 1.06s steps(1) infinite; +//} +//.cm-animate-fat-cursor { +// width: auto; +// border: 0; +// -webkit-animation: blink 1.06s steps(1) infinite; +// -moz-animation: blink 1.06s steps(1) infinite; +// animation: blink 1.06s steps(1) infinite; +// background-color: #7e7; +//} +//@-moz-keyframes blink { +// 0% {} +// 50% { background-color: transparent; } +// 100% {} +//} +//@-webkit-keyframes blink { +// 0% {} +// 50% { background-color: transparent; } +// 100% {} +//} +//@keyframes blink { +// 0% {} +// 50% { background-color: transparent; } +// 100% {} +//} +// +///* Can style cursor different in overwrite (non-insert) mode */ +//.CodeMirror-overwrite .CodeMirror-cursor {} +// +//.cm-tab { display: inline-block; text-decoration: inherit; } +// +//.CodeMirror-rulers { +// position: absolute; +// left: 0; right: 0; top: -50px; bottom: 0; +// overflow: hidden; +//} +//.CodeMirror-ruler { +// border-left: 1px solid #ccc; +// top: 0; bottom: 0; +// position: absolute; +//} +// +///* DEFAULT THEME */ +// +//.cm-s-default .cm-header {color: blue;} +//.cm-s-default .cm-quote {color: #090;} +//.cm-negative {color: #d44;} +//.cm-positive {color: #292;} +//.cm-header, .cm-strong {font-weight: bold;} +//.cm-em {font-style: italic;} +//.cm-link {text-decoration: underline;} +//.cm-strikethrough {text-decoration: line-through;} +// +//.cm-s-default .cm-keyword {color: #708;} +//.cm-s-default .cm-atom {color: #219;} +//.cm-s-default .cm-number {color: #164;} +//.cm-s-default .cm-def {color: #00f;} +//.cm-s-default .cm-variable, +//.cm-s-default .cm-punctuation, +//.cm-s-default .cm-property, +//.cm-s-default .cm-operator {} +//.cm-s-default .cm-variable-2 {color: #05a;} +//.cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;} +//.cm-s-default .cm-comment {color: #a50;} +//.cm-s-default .cm-string {color: #a11;} +//.cm-s-default .cm-string-2 {color: #f50;} +//.cm-s-default .cm-meta {color: #555;} +//.cm-s-default .cm-qualifier {color: #555;} +//.cm-s-default .cm-builtin {color: #30a;} +//.cm-s-default .cm-bracket {color: #997;} +//.cm-s-default .cm-tag {color: #170;} +//.cm-s-default .cm-attribute {color: #00c;} +//.cm-s-default .cm-hr {color: #999;} +//.cm-s-default .cm-link {color: #00c;} +// +//.cm-s-default .cm-error {color: #f00;} +//.cm-invalidchar {color: #f00;} +// +//.CodeMirror-composing { border-bottom: 2px solid; } +// +///* Default styles for common addons */ +// +//div.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;} +//div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;} +//.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); } +//.CodeMirror-activeline-background {background: #e8f2ff;} +// +///* STOP */ +// +///* The rest of this file contains styles related to the mechanics of +// the editor. You probably shouldn't touch them. */ +// +//.CodeMirror { +// position: relative; +// overflow: hidden; +// background: white; +//} +// +//.CodeMirror-scroll { +// overflow: scroll !important; /* Things will break if this is overridden */ +// /* 50px is the magic margin used to hide the element's real scrollbars */ +// /* See overflow: hidden in .CodeMirror */ +// margin-bottom: -50px; margin-right: -50px; +// padding-bottom: 50px; +// height: 100%; +// outline: none; /* Prevent dragging from highlighting the element */ +// position: relative; +//} +//.CodeMirror-sizer { +// position: relative; +// border-right: 50px solid transparent; +//} +// +///* The fake, visible scrollbars. Used to force redraw during scrolling +// before actual scrolling happens, thus preventing shaking and +// flickering artifacts. */ +//.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { +// position: absolute; +// z-index: 6; +// display: none; +// outline: none; +//} +//.CodeMirror-vscrollbar { +// right: 0; top: 0; +// overflow-x: hidden; +// overflow-y: scroll; +//} +//.CodeMirror-hscrollbar { +// bottom: 0; left: 0; +// overflow-y: hidden; +// overflow-x: scroll; +//} +//.CodeMirror-scrollbar-filler { +// right: 0; bottom: 0; +//} +//.CodeMirror-gutter-filler { +// left: 0; bottom: 0; +//} +// +//.CodeMirror-gutters { +// position: absolute; left: 0; top: 0; +// min-height: 100%; +// z-index: 3; +//} +//.CodeMirror-gutter { +// white-space: normal; +// height: 100%; +// display: inline-block; +// vertical-align: top; +// margin-bottom: -50px; +//} +//.CodeMirror-gutter-wrapper { +// position: absolute; +// z-index: 4; +// background: none !important; +// border: none !important; +//} +//.CodeMirror-gutter-background { +// position: absolute; +// top: 0; bottom: 0; +// z-index: 4; +//} +//.CodeMirror-gutter-elt { +// position: absolute; +// cursor: default; +// z-index: 4; +//} +//.CodeMirror-gutter-wrapper ::selection { background-color: transparent } +//.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent } +// +//.CodeMirror-lines { +// cursor: text; +// min-height: 1px; /* prevents collapsing before first draw */ +//} +//.CodeMirror pre.CodeMirror-line, +//.CodeMirror pre.CodeMirror-line-like { +// /* Reset some styles that the rest of the page might have set */ +// -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0; +// border-width: 0; +// background: transparent; +// font-family: inherit; +// font-size: inherit; +// margin: 0; +// white-space: pre; +// word-wrap: normal; +// line-height: inherit; +// color: inherit; +// z-index: 2; +// position: relative; +// overflow: visible; +// -webkit-tap-highlight-color: transparent; +// -webkit-font-variant-ligatures: contextual; +// font-variant-ligatures: contextual; +//} +//.CodeMirror-wrap pre.CodeMirror-line, +//.CodeMirror-wrap pre.CodeMirror-line-like { +// word-wrap: break-word; +// white-space: pre-wrap; +// word-break: normal; +//} +// +//.CodeMirror-linebackground { +// position: absolute; +// left: 0; right: 0; top: 0; bottom: 0; +// z-index: 0; +//} +// +//.CodeMirror-linewidget { +// position: relative; +// z-index: 2; +// padding: 0.1px; /* Force widget margins to stay inside of the container */ +//} +// +//.CodeMirror-widget {} +// +//.CodeMirror-rtl pre { direction: rtl; } +// +//.CodeMirror-code { +// outline: none; +//} +// +///* Force content-box sizing for the elements where we expect it */ +//.CodeMirror-scroll, +//.CodeMirror-sizer, +//.CodeMirror-gutter, +//.CodeMirror-gutters, +//.CodeMirror-linenumber { +// -moz-box-sizing: content-box; +// box-sizing: content-box; +//} +// +//.CodeMirror-measure { +// position: absolute; +// width: 100%; +// height: 0; +// overflow: hidden; +// visibility: hidden; +//} +// +//.CodeMirror-cursor { +// position: absolute; +// pointer-events: none; +//} +//.CodeMirror-measure pre { position: static; } +// +//div.CodeMirror-cursors { +// visibility: hidden; +// position: relative; +// z-index: 3; +//} +//div.CodeMirror-dragcursors { +// visibility: visible; +//} +// +//.CodeMirror-focused div.CodeMirror-cursors { +// visibility: visible; +//} +// +//.CodeMirror-selected { background: #d9d9d9; } +//.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; } +//.CodeMirror-crosshair { cursor: crosshair; } +//.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; } +//.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; } +// +//.cm-searching { +// background-color: #ffa; +// background-color: rgba(255, 255, 0, .4); +//} +// +///* Used to force a border model for a node */ +//.cm-force-border { padding-right: .1px; } +// +//@media print { +// /* Hide the cursor when printing */ +// .CodeMirror div.CodeMirror-cursors { +// visibility: hidden; +// } +//} +// +///* See issue #2901 */ +//.cm-tab-wrap-hack:after { content: ''; } +// +///* Help users use markselection to safely style text background */ +//span.CodeMirror-selectedtext { background: none; } diff --git a/pc4mobx/hrmSalary/index.js b/pc4mobx/hrmSalary/index.js index b59a534a..64a4f803 100644 --- a/pc4mobx/hrmSalary/index.js +++ b/pc4mobx/hrmSalary/index.js @@ -32,6 +32,7 @@ import SysConfig from "./pages/sysConfig"; import RuleConfig from "./pages/ruleConfig"; import Appconfig from "./pages/appConfig"; import FieldManagement from "./pages/fieldManagement"; +import EquationEditor from "./pages/equationEditor"; import stores from "./stores"; import "./style/index"; @@ -150,6 +151,7 @@ const Routes = ( + ); diff --git a/pc4mobx/hrmSalary/pages/equationEditor/index.js b/pc4mobx/hrmSalary/pages/equationEditor/index.js new file mode 100644 index 00000000..e205a1a5 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/equationEditor/index.js @@ -0,0 +1,12 @@ +import React, { Component } from "react"; +import ExcelEditor from "../../components/excelEditor"; + +class Index extends Component { + render() { + return ( + + ); + } +} + +export default Index; From 247432ebdeb3e285a9d3f9d75840e1feb9be6f47 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, 13 Apr 2023 13:26:43 +0800 Subject: [PATCH 006/142] =?UTF-8?q?=E5=85=AC=E5=BC=8F=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8=E7=BB=84=E4=BB=B6=E5=B0=81=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hrmSalary/components/excelEditor/index.js | 89 ++++- .../components/excelEditor/index.less | 368 +----------------- 2 files changed, 97 insertions(+), 360 deletions(-) diff --git a/pc4mobx/hrmSalary/components/excelEditor/index.js b/pc4mobx/hrmSalary/components/excelEditor/index.js index 6d9db2d2..6f69e51c 100644 --- a/pc4mobx/hrmSalary/components/excelEditor/index.js +++ b/pc4mobx/hrmSalary/components/excelEditor/index.js @@ -1,6 +1,6 @@ import React, { Component } from "react"; import { Button } from "antd"; -import { UnControlled as CodeMirror } from "react-codemirror2"; +import { Controlled as CodeMirror } from "react-codemirror2"; import { keyboardBaseBtns } from "./constants"; import cs from "classnames"; import "./index.less"; @@ -8,7 +8,6 @@ import "./index.less"; import "codemirror/lib/codemirror.css"; import "codemirror/lib/codemirror.js"; -import "codemirror/theme/dracula.css"; //主题 //代码折叠 import "codemirror/addon/fold/foldgutter.css"; import "codemirror/addon/lint/lint.css"; @@ -30,24 +29,102 @@ class ExcelEditor extends Component { constructor(props) { super(props); this.state = { - value: "" + value: "", + widgets: [] }; + this.editorRef = null; } + replaceToWidget = (editor, data, value, inlineWidgetOpts) => { + editor.getAllMarks().forEach(m => m.clear()); + let posInfos = _.flatMap(_.keys(inlineWidgetOpts), widgetName => { + let { regex, render } = inlineWidgetOpts[widgetName]; + let res = [], newRe = new RegExp(regex, "g"), m; + do { + m = newRe.exec(value); + if (m) { + const mountToDom = document.createElement("span"); + let text = m[0]; + res.push({ + widgetName, + text, + startAt: m.index, + endAt: m.index + text.length, + render: () => { + let x = `((...args) => args)${text.replace(new RegExp(`^${widgetName}`), "")}`; + let args = eval(x); + return render(...args); + }, + mountToDom: mountToDom + }); + } + } while (m); + return res; + }); + posInfos.forEach(posInfo => { + let from = { line: 0, ch: posInfo.startAt }; + let to = { line: 0, ch: posInfo.endAt }; + editor.markText(from, to, { + replacedWith: posInfo.mountToDom, + clearWhenEmpty: false + }); + }); + this.setState({ + widgets: posInfos + }, () => { + editor.refresh(); + editor.focus(); + }); + }; + /* + * Author: 黎永顺 + * Description:格式化 + * Params: + * Date: 2023/4/13 + */ + autoFormatSelection = () => { + let editor = this.editorRef.editor; + if (this.props.type != "sql") { + const script_length = editor.getValue().length; + const startPos = { line: 0, ch: 0, sticky: null }; + const endPos = editor.doc.posFromIndex(script_length); + // editor.setSelection(startPos, endPos); + // editor.autoFormatRange(startPos, endPos); + // editor.commentRange(false, startPos, endPos); + } else { + let splCont = ""; + splCont = editor.getValue(); + // editor.setValue(sqlFormatter.format(splCont)); + } + }; render() { + const inlineWidgetOpts = { + useObject: { + regex: /useObject\("[^)]+"\)/, + render: (objId) => { + return ( +
alert(objId)} + >{objId}
+ ); + } + } + }; return (
this.editorRef = editor} value={this.state.value} onBeforeChange={(editor, data, value) => { this.setState({ value }); }} - onChange={(editor, value) => { - console.log("controlled", { value }); + onChange={(editor, data, value) => { + this.replaceToWidget(editor, data, value, inlineWidgetOpts); }} options={{ lineNumbers: false, diff --git a/pc4mobx/hrmSalary/components/excelEditor/index.less b/pc4mobx/hrmSalary/components/excelEditor/index.less index 0cb45a6b..964e9395 100644 --- a/pc4mobx/hrmSalary/components/excelEditor/index.less +++ b/pc4mobx/hrmSalary/components/excelEditor/index.less @@ -11,9 +11,20 @@ box-sizing: content-box; border: 1px solid #e5e5e5; - .esb-algorithm-sourceContent { - .CodeMirror { - } + .CodeMirror-scroll { + overflow-x: visible !important; + padding: 4px; + } + + .CodeMirror-sizer { + margin-left: 0 !important; + } + + .CodeMirror-gutters { + border-right: none; + background-color: #f7f7f7; + opacity: 0; + display: none; } } @@ -97,354 +108,3 @@ } } } -// -///* BASICS */ -// -//.CodeMirror { -// /* Set height, width, borders, and global font properties here */ -// font-family: monospace; -// height: 300px; -// color: black; -// direction: ltr; -//} -// -///* PADDING */ -// -//.CodeMirror-lines { -// padding: 4px 0; /* Vertical padding around content */ -//} -//.CodeMirror pre.CodeMirror-line, -//.CodeMirror pre.CodeMirror-line-like { -// padding: 0 4px; /* Horizontal padding of content */ -//} -// -//.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { -// background-color: white; /* The little square between H and V scrollbars */ -//} -// -///* GUTTER */ -// -//.CodeMirror-gutters { -// border-right: 1px solid #ddd; -// background-color: #f7f7f7; -// white-space: nowrap; -//} -//.CodeMirror-linenumbers {} -//.CodeMirror-linenumber { -// padding: 0 3px 0 5px; -// min-width: 20px; -// text-align: right; -// color: #999; -// white-space: nowrap; -//} -// -//.CodeMirror-guttermarker { color: black; } -//.CodeMirror-guttermarker-subtle { color: #999; } -// -///* CURSOR */ -// -//.CodeMirror-cursor { -// border-left: 1px solid black; -// border-right: none; -// width: 0; -//} -///* Shown when moving in bi-directional text */ -//.CodeMirror div.CodeMirror-secondarycursor { -// border-left: 1px solid silver; -//} -//.cm-fat-cursor .CodeMirror-cursor { -// width: auto; -// border: 0 !important; -// background: #7e7; -//} -//.cm-fat-cursor div.CodeMirror-cursors { -// z-index: 1; -//} -//.cm-fat-cursor-mark { -// background-color: rgba(20, 255, 20, 0.5); -// -webkit-animation: blink 1.06s steps(1) infinite; -// -moz-animation: blink 1.06s steps(1) infinite; -// animation: blink 1.06s steps(1) infinite; -//} -//.cm-animate-fat-cursor { -// width: auto; -// border: 0; -// -webkit-animation: blink 1.06s steps(1) infinite; -// -moz-animation: blink 1.06s steps(1) infinite; -// animation: blink 1.06s steps(1) infinite; -// background-color: #7e7; -//} -//@-moz-keyframes blink { -// 0% {} -// 50% { background-color: transparent; } -// 100% {} -//} -//@-webkit-keyframes blink { -// 0% {} -// 50% { background-color: transparent; } -// 100% {} -//} -//@keyframes blink { -// 0% {} -// 50% { background-color: transparent; } -// 100% {} -//} -// -///* Can style cursor different in overwrite (non-insert) mode */ -//.CodeMirror-overwrite .CodeMirror-cursor {} -// -//.cm-tab { display: inline-block; text-decoration: inherit; } -// -//.CodeMirror-rulers { -// position: absolute; -// left: 0; right: 0; top: -50px; bottom: 0; -// overflow: hidden; -//} -//.CodeMirror-ruler { -// border-left: 1px solid #ccc; -// top: 0; bottom: 0; -// position: absolute; -//} -// -///* DEFAULT THEME */ -// -//.cm-s-default .cm-header {color: blue;} -//.cm-s-default .cm-quote {color: #090;} -//.cm-negative {color: #d44;} -//.cm-positive {color: #292;} -//.cm-header, .cm-strong {font-weight: bold;} -//.cm-em {font-style: italic;} -//.cm-link {text-decoration: underline;} -//.cm-strikethrough {text-decoration: line-through;} -// -//.cm-s-default .cm-keyword {color: #708;} -//.cm-s-default .cm-atom {color: #219;} -//.cm-s-default .cm-number {color: #164;} -//.cm-s-default .cm-def {color: #00f;} -//.cm-s-default .cm-variable, -//.cm-s-default .cm-punctuation, -//.cm-s-default .cm-property, -//.cm-s-default .cm-operator {} -//.cm-s-default .cm-variable-2 {color: #05a;} -//.cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;} -//.cm-s-default .cm-comment {color: #a50;} -//.cm-s-default .cm-string {color: #a11;} -//.cm-s-default .cm-string-2 {color: #f50;} -//.cm-s-default .cm-meta {color: #555;} -//.cm-s-default .cm-qualifier {color: #555;} -//.cm-s-default .cm-builtin {color: #30a;} -//.cm-s-default .cm-bracket {color: #997;} -//.cm-s-default .cm-tag {color: #170;} -//.cm-s-default .cm-attribute {color: #00c;} -//.cm-s-default .cm-hr {color: #999;} -//.cm-s-default .cm-link {color: #00c;} -// -//.cm-s-default .cm-error {color: #f00;} -//.cm-invalidchar {color: #f00;} -// -//.CodeMirror-composing { border-bottom: 2px solid; } -// -///* Default styles for common addons */ -// -//div.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;} -//div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;} -//.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); } -//.CodeMirror-activeline-background {background: #e8f2ff;} -// -///* STOP */ -// -///* The rest of this file contains styles related to the mechanics of -// the editor. You probably shouldn't touch them. */ -// -//.CodeMirror { -// position: relative; -// overflow: hidden; -// background: white; -//} -// -//.CodeMirror-scroll { -// overflow: scroll !important; /* Things will break if this is overridden */ -// /* 50px is the magic margin used to hide the element's real scrollbars */ -// /* See overflow: hidden in .CodeMirror */ -// margin-bottom: -50px; margin-right: -50px; -// padding-bottom: 50px; -// height: 100%; -// outline: none; /* Prevent dragging from highlighting the element */ -// position: relative; -//} -//.CodeMirror-sizer { -// position: relative; -// border-right: 50px solid transparent; -//} -// -///* The fake, visible scrollbars. Used to force redraw during scrolling -// before actual scrolling happens, thus preventing shaking and -// flickering artifacts. */ -//.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { -// position: absolute; -// z-index: 6; -// display: none; -// outline: none; -//} -//.CodeMirror-vscrollbar { -// right: 0; top: 0; -// overflow-x: hidden; -// overflow-y: scroll; -//} -//.CodeMirror-hscrollbar { -// bottom: 0; left: 0; -// overflow-y: hidden; -// overflow-x: scroll; -//} -//.CodeMirror-scrollbar-filler { -// right: 0; bottom: 0; -//} -//.CodeMirror-gutter-filler { -// left: 0; bottom: 0; -//} -// -//.CodeMirror-gutters { -// position: absolute; left: 0; top: 0; -// min-height: 100%; -// z-index: 3; -//} -//.CodeMirror-gutter { -// white-space: normal; -// height: 100%; -// display: inline-block; -// vertical-align: top; -// margin-bottom: -50px; -//} -//.CodeMirror-gutter-wrapper { -// position: absolute; -// z-index: 4; -// background: none !important; -// border: none !important; -//} -//.CodeMirror-gutter-background { -// position: absolute; -// top: 0; bottom: 0; -// z-index: 4; -//} -//.CodeMirror-gutter-elt { -// position: absolute; -// cursor: default; -// z-index: 4; -//} -//.CodeMirror-gutter-wrapper ::selection { background-color: transparent } -//.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent } -// -//.CodeMirror-lines { -// cursor: text; -// min-height: 1px; /* prevents collapsing before first draw */ -//} -//.CodeMirror pre.CodeMirror-line, -//.CodeMirror pre.CodeMirror-line-like { -// /* Reset some styles that the rest of the page might have set */ -// -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0; -// border-width: 0; -// background: transparent; -// font-family: inherit; -// font-size: inherit; -// margin: 0; -// white-space: pre; -// word-wrap: normal; -// line-height: inherit; -// color: inherit; -// z-index: 2; -// position: relative; -// overflow: visible; -// -webkit-tap-highlight-color: transparent; -// -webkit-font-variant-ligatures: contextual; -// font-variant-ligatures: contextual; -//} -//.CodeMirror-wrap pre.CodeMirror-line, -//.CodeMirror-wrap pre.CodeMirror-line-like { -// word-wrap: break-word; -// white-space: pre-wrap; -// word-break: normal; -//} -// -//.CodeMirror-linebackground { -// position: absolute; -// left: 0; right: 0; top: 0; bottom: 0; -// z-index: 0; -//} -// -//.CodeMirror-linewidget { -// position: relative; -// z-index: 2; -// padding: 0.1px; /* Force widget margins to stay inside of the container */ -//} -// -//.CodeMirror-widget {} -// -//.CodeMirror-rtl pre { direction: rtl; } -// -//.CodeMirror-code { -// outline: none; -//} -// -///* Force content-box sizing for the elements where we expect it */ -//.CodeMirror-scroll, -//.CodeMirror-sizer, -//.CodeMirror-gutter, -//.CodeMirror-gutters, -//.CodeMirror-linenumber { -// -moz-box-sizing: content-box; -// box-sizing: content-box; -//} -// -//.CodeMirror-measure { -// position: absolute; -// width: 100%; -// height: 0; -// overflow: hidden; -// visibility: hidden; -//} -// -//.CodeMirror-cursor { -// position: absolute; -// pointer-events: none; -//} -//.CodeMirror-measure pre { position: static; } -// -//div.CodeMirror-cursors { -// visibility: hidden; -// position: relative; -// z-index: 3; -//} -//div.CodeMirror-dragcursors { -// visibility: visible; -//} -// -//.CodeMirror-focused div.CodeMirror-cursors { -// visibility: visible; -//} -// -//.CodeMirror-selected { background: #d9d9d9; } -//.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; } -//.CodeMirror-crosshair { cursor: crosshair; } -//.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; } -//.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; } -// -//.cm-searching { -// background-color: #ffa; -// background-color: rgba(255, 255, 0, .4); -//} -// -///* Used to force a border model for a node */ -//.cm-force-border { padding-right: .1px; } -// -//@media print { -// /* Hide the cursor when printing */ -// .CodeMirror div.CodeMirror-cursors { -// visibility: hidden; -// } -//} -// -///* See issue #2901 */ -//.cm-tab-wrap-hack:after { content: ''; } -// -///* Help users use markselection to safely style text background */ -//span.CodeMirror-selectedtext { background: none; } From 7bdf55be6affb82b8cbb96c09c1d294cb8b5d61b 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, 13 Apr 2023 16:42:57 +0800 Subject: [PATCH 007/142] =?UTF-8?q?=E5=85=AC=E5=BC=8F=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8=E7=BB=84=E4=BB=B6=E5=B0=81=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/excelEditor/constants.js | 28 ++--- .../hrmSalary/components/excelEditor/index.js | 118 +++++++++++------- .../components/excelEditor/index.less | 10 ++ 3 files changed, 98 insertions(+), 58 deletions(-) diff --git a/pc4mobx/hrmSalary/components/excelEditor/constants.js b/pc4mobx/hrmSalary/components/excelEditor/constants.js index a113371b..2bb11e58 100644 --- a/pc4mobx/hrmSalary/components/excelEditor/constants.js +++ b/pc4mobx/hrmSalary/components/excelEditor/constants.js @@ -1,16 +1,16 @@ export const keyboardBaseBtns=[ - { key:"1", label: "+" }, - { key:"2", label: "-" }, - { key:"3", label: ">" }, - { key:"4", label: ">=" }, - { key:"5", label: "=" }, - { key:"6", label: "*" }, - { key:"7", label: "/" }, - { key:"8", label: "<" }, - { key:"9", label: "<=" }, - { key:"10", label: "!=" }, - { key:"11", label: "(" }, - { key:"12", label: ")" }, - { key:"13", label: "%" }, - { key:"space", label: "space" }, + { key:"+", label: "+" }, + { key:"-", label: "-" }, + { key:">", label: ">" }, + { key:">=", label: ">=" }, + { key:"=", label: "=" }, + { key:"*", label: "*" }, + { key:"/", label: "/" }, + { key:"<", label: "<" }, + { key:"<=", label: "<=" }, + { key:"!=", label: "!=" }, + { key:"()", label: "(" }, + { key:")", label: ")" }, + { key:"%", label: "%" }, + { key:" ", label: "space" }, ] diff --git a/pc4mobx/hrmSalary/components/excelEditor/index.js b/pc4mobx/hrmSalary/components/excelEditor/index.js index 6f69e51c..639e3ac4 100644 --- a/pc4mobx/hrmSalary/components/excelEditor/index.js +++ b/pc4mobx/hrmSalary/components/excelEditor/index.js @@ -1,4 +1,5 @@ import React, { Component } from "react"; +import ReactDOM from "react-dom"; import { Button } from "antd"; import { Controlled as CodeMirror } from "react-codemirror2"; import { keyboardBaseBtns } from "./constants"; @@ -35,46 +36,60 @@ class ExcelEditor extends Component { this.editorRef = null; } + /* + * Author: 黎永顺 + * Description: 插入字符 + * Params: + * Date: 2023/4/13 + */ + insertText = text => { + let cursor = this.editorRef.getCursor(); + console.log(cursor); + this.editorRef.replaceRange(text, cursor); + }; + replaceToWidget = (editor, data, value, inlineWidgetOpts) => { editor.getAllMarks().forEach(m => m.clear()); - let posInfos = _.flatMap(_.keys(inlineWidgetOpts), widgetName => { - let { regex, render } = inlineWidgetOpts[widgetName]; - let res = [], newRe = new RegExp(regex, "g"), m; - do { - m = newRe.exec(value); - if (m) { - const mountToDom = document.createElement("span"); - let text = m[0]; - res.push({ - widgetName, - text, - startAt: m.index, - endAt: m.index + text.length, - render: () => { - let x = `((...args) => args)${text.replace(new RegExp(`^${widgetName}`), "")}`; - let args = eval(x); - return render(...args); - }, - mountToDom: mountToDom - }); - } - } while (m); - return res; - }); - posInfos.forEach(posInfo => { - let from = { line: 0, ch: posInfo.startAt }; - let to = { line: 0, ch: posInfo.endAt }; - editor.markText(from, to, { - replacedWith: posInfo.mountToDom, - clearWhenEmpty: false - }); - }); - this.setState({ - widgets: posInfos - }, () => { editor.refresh(); editor.focus(); - }); + // let posInfos = _.flatMap(_.keys(inlineWidgetOpts), widgetName => { + // let { regex, render } = inlineWidgetOpts[widgetName]; + // let res = [], newRe = new RegExp(regex, "g"), m; + // do { + // m = newRe.exec(value); + // if (m) { + // const mountToDom = document.createElement("span"); + // let text = m[0]; + // res.push({ + // widgetName, + // text, + // startAt: m.index, + // endAt: m.index + text.length, + // render: () => { + // let x = `((...args) => args)${text.replace(new RegExp(`^${widgetName}`), "")}`; + // let args = eval(x); + // return render(...args); + // }, + // mountToDom: mountToDom + // }); + // } + // } while (m); + // return res; + // }); + // posInfos.forEach(posInfo => { + // let from = { line: 0, ch: posInfo.startAt }; + // let to = { line: 0, ch: posInfo.endAt }; + // editor.markText(from, to, { + // replacedWith: posInfo.mountToDom, + // clearWhenEmpty: false + // }); + // }); + // this.setState({ + // widgets: posInfos + // }, () => { + // editor.refresh(); + // editor.focus(); + // }); }; /* * Author: 黎永顺 @@ -104,15 +119,12 @@ class ExcelEditor extends Component { regex: /useObject\("[^)]+"\)/, render: (objId) => { return ( -
alert(objId)} - >{objId}
+ {objId} ); } } }; + const { widgets } = this.state; return (
@@ -140,6 +152,11 @@ class ExcelEditor extends Component { placeholder: "" }} /> + {widgets.map((w, i) => { + return ( + + ); + })}
@@ -149,14 +166,17 @@ class ExcelEditor extends Component { const { key, label } = item; return ; }) }
- - + +
@@ -187,3 +207,13 @@ class ExcelEditor extends Component { } export default ExcelEditor; + +class Widget extends React.Component { + render() { + let { info } = this.props; + return ReactDOM.createPortal( + info.render(), + info.mountToDom + ); + } +} diff --git a/pc4mobx/hrmSalary/components/excelEditor/index.less b/pc4mobx/hrmSalary/components/excelEditor/index.less index 964e9395..064ecd12 100644 --- a/pc4mobx/hrmSalary/components/excelEditor/index.less +++ b/pc4mobx/hrmSalary/components/excelEditor/index.less @@ -11,6 +11,16 @@ box-sizing: content-box; border: 1px solid #e5e5e5; + span { + font-family: Liberation Mono, LiberationMonoRegular, Courier New, monospace; + } + + .CodeMirror-code { + font-size: 16px; + + + } + .CodeMirror-scroll { overflow-x: visible !important; padding: 4px; From 8e36bc89be015ce2c439ab48b8a376c971e83d63 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, 17 Apr 2023 11:53:21 +0800 Subject: [PATCH 008/142] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E8=96=AA=E8=B3=87?= =?UTF-8?q?=E5=BC=B5=E6=BF=A4=E6=9C=88=E4=BB=BD=E8=AF=B4=E6=98=8E=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=9A=84=E9=94=99=E8=AF=AF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/ledgerBaseSetting.js | 209 +++++++++++------- pc4mobx/hrmSalary/util/date.js | 86 ++++++- 2 files changed, 202 insertions(+), 93 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerBaseSetting.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerBaseSetting.js index cfe0f90b..2da6a2ac 100644 --- a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerBaseSetting.js +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerBaseSetting.js @@ -8,10 +8,16 @@ import React, { Component } from "react"; import { WeaCheckbox, WeaFormItem, WeaHelpfulTip, WeaInput, WeaSelect, WeaTextarea } from "ecCom"; import { Col, Row } from "antd"; import { inject, observer } from "mobx-react"; -import {toJS} from 'mobx'; import { baseSettingFormItem } from "../config"; import { getLedgerBasicForm } from "../../../apis/ledger"; -import { getAddMonthYearMonth, getCurrentYearMonth, getSubtractMonthYearMonth } from "../../../util/date"; +import { + generateBasicInfo, + getAddMonthYearMonth, + getCurrentYearMonth, + getMonthDays, + getSubtractMonthYearMonth, + prefixAddZero +} from "../../../util/date"; import { commonEnumList } from "../../../apis/ruleconfig"; import moment from "moment"; import "./index.less"; @@ -206,9 +212,8 @@ export default LedgerBaseSetting; const CustomSelect = (props) => { const { list, baseInfo, onChange, inputStr } = props; - const { salaryCycleType, salaryCycleFromDay, attendCycleType, attendCycleFromDay, canEdit } = baseInfo; - const salaryCycleStrObj = initPeriodStr("inputStr", salaryCycleType, salaryCycleFromDay); - const attendCycleStrObj = initPeriodStr("inputStr", attendCycleType, attendCycleFromDay); + const { canEdit } = baseInfo; + const selectInfo = buildEditBasicInfo(baseInfo); return { _.map(list, item => { @@ -221,20 +226,12 @@ const CustomSelect = (props) => { }) } {inputStr === "salaryCycleStrObj" ? salaryCycleStrObj.inputStr : attendCycleStrObj.inputStr} + className="desc">{inputStr === "salaryCycleStrObj" ? selectInfo.salaryCycleInfo.salaryPeriodTip : selectInfo.attendCycleInfo.attendancePeriodTip} ; }; const MonthCycleDesc = (props) => { - const { - taxCycleType, - socialSecurityCycleType, - salaryCycleFromDay, - salaryCycleType, - attendCycleType, - attendCycleFromDay - } = props; - const salaryCycleStrObj = initPeriodStr("salaryCycleStr", salaryCycleType, salaryCycleFromDay); - const attendCycleStrObj = initPeriodStr("attendCycleStr", attendCycleType, attendCycleFromDay); + const { taxCycleType, socialSecurityCycleType } = props; + const selectInfo = buildEditBasicInfo({ ...props }); return
月份周期说明
@@ -245,28 +242,131 @@ const MonthCycleDesc = (props) => {
根据您当前的选择,相应的周期为:
薪资周期
- {getStartDate(salaryCycleType, salaryCycleFromDay)}至 - {salaryCycleStrObj.date} + {selectInfo.salaryCycleInfo.salaryPeriodStart}至 + {selectInfo.salaryCycleInfo.salaryPeriodEnd}
税款所属期
{getMonth(taxCycleType)}
考勤取值周期
- {getStartDate(attendCycleType, attendCycleFromDay)}至 - {attendCycleStrObj.date} + {selectInfo.attendCycleInfo.attendancePeriodStart}至 + {selectInfo.attendCycleInfo.attendancePeriodEnd}
福利台账月份
引用{getMonth(socialSecurityCycleType)}的福利台账数据
; }; - -// 获取开始日期 -const getStartDate = (salaryCycleType, day) => { - day = Number(day); - return getMonth(salaryCycleType) + "-" + (day < 10 ? "0" + day : day); +const buildEditBasicInfo = (editBasicInfo) => { + const { attendCycleType, salaryCycleType } = editBasicInfo; + const now = new Date(); + let nowYear = now.getFullYear(); + let nowMonth = now.getMonth() + 1; + let tmpV = {}; + // 薪资联动 + switch (salaryCycleType) { + case "1" : + tmpV["salaryCycleInfo"] = buildSalaryInfo(editBasicInfo, -2, nowYear, nowMonth); + break; + case "2" : + tmpV["salaryCycleInfo"] = buildSalaryInfo(editBasicInfo, -1, nowYear, nowMonth); + break; + case "3" : + tmpV["salaryCycleInfo"] = buildSalaryInfo(editBasicInfo, 0, nowYear, nowMonth); + break; + case "4" : + tmpV["salaryCycleInfo"] = buildSalaryInfo(editBasicInfo, 1, nowYear, nowMonth); + break; + } + // 考勤联动 + switch (attendCycleType) { + case "1" : + tmpV["attendCycleInfo"] = buildAttendanceInfo(editBasicInfo, -2, nowYear, nowMonth); + break; + case "2" : + tmpV["attendCycleInfo"] = buildAttendanceInfo(editBasicInfo, -1, nowYear, nowMonth); + break; + case "3" : + tmpV["attendCycleInfo"] = buildAttendanceInfo(editBasicInfo, 0, nowYear, nowMonth); + break; + case "4" : + tmpV["attendCycleInfo"] = buildAttendanceInfo(editBasicInfo, 1, nowYear, nowMonth); + break; + } + return tmpV; }; +/* + * Author: 黎永顺 + * Description:构建薪资周期联动信息 + * Params: + * Date: 2023/4/17 + */ +const buildSalaryInfo = (editBasicInfo, monthCal, nowYear, nowMonth) => { + const { salaryCycleFromDay } = editBasicInfo; + let salaryCycleFromDayNum = Number(salaryCycleFromDay), customInfo = {}; + const basicInfo = generateBasicInfo(monthCal, nowYear, nowMonth); + const { nowMonthStr, nextMonthStr, year, month } = basicInfo; + customInfo.salaryYear = year; + customInfo.salaryMonth = month; + if (salaryCycleFromDayNum === 1) { + customInfo.salaryPeriodTip = "至" + nowMonthStr + "最后一天"; + customInfo.salaryPeriodStart = customInfo.salaryYear + "-" + + prefixAddZero(customInfo.salaryMonth, 2) + "-01"; + customInfo.salaryPeriodEnd = customInfo.salaryYear + "-" + + prefixAddZero(customInfo.salaryMonth, 2) + "-" + + prefixAddZero(getMonthDays(customInfo.salaryYear, customInfo.salaryMonth), 2); + } else { + customInfo.salaryPeriodTip = "至" + nextMonthStr + (salaryCycleFromDayNum - 1) + "号"; + customInfo.salaryPeriodStart = customInfo.salaryYear + "-" + + prefixAddZero(customInfo.salaryMonth, 2) + "-" + prefixAddZero(salaryCycleFromDayNum, 2); + let year = customInfo.salaryYear; + let month = customInfo.salaryMonth; + if (month === "12") { + year = Number(year) + 1; + month = 1; + } else { + month = Number(month) + 1; + } + customInfo.salaryPeriodEnd = year + "-" + + prefixAddZero(month, 2) + "-" + + prefixAddZero(salaryCycleFromDayNum - 1, 2); + } + return customInfo; +}; +const buildAttendanceInfo = (editBasicInfo, monthCal, nowYear, nowMonth) => { + const { attendCycleFromDay } = editBasicInfo; + let attendCycleFromDayNum = Number(attendCycleFromDay), customInfo = {}; + + const basicInfo = generateBasicInfo(monthCal, nowYear, nowMonth); + const { nowMonthStr, nextMonthStr } = basicInfo; + let year = basicInfo.year; + let month = basicInfo.month; + + if (attendCycleFromDayNum === 1) { + customInfo.attendancePeriodTip = "至" + nowMonthStr + "最后一天"; + + customInfo.attendancePeriodStart = year + "-" + + prefixAddZero(month, 2) + "-01"; + customInfo.attendancePeriodEnd = year + "-" + + prefixAddZero(month, 2) + "-" + + prefixAddZero(getMonthDays(year, month), 2); + } else { + customInfo.attendancePeriodTip = "至" + nextMonthStr + (attendCycleFromDayNum - 1) + "号"; + customInfo.attendancePeriodStart = year + "-" + + prefixAddZero(month, 2) + "-" + prefixAddZero(attendCycleFromDayNum, 2); + if (month === "12") { + year = (Number(year) + 1).toString(); + month = "1"; + } else { + month = (Number(month) + 1).toString(); + } + customInfo.attendancePeriodEnd = year + "-" + + prefixAddZero(month, 2) + "-" + + prefixAddZero(attendCycleFromDayNum - 1, 2); + } + return customInfo; +}; const getMonth = (salaryCycleType) => { switch (salaryCycleType) { case "1": // 上上月 @@ -279,62 +379,3 @@ const getMonth = (salaryCycleType) => { return getAddMonthYearMonth(1); } }; -const initPeriodStr = (periodStrType, types, fromDay) => { - let str = "", tmpDate = null; - switch (types) { - case "1": - tmpDate = moment().subtract(2, "month"); - const is_31H = moment(tmpDate, "YYYY-MM").daysInMonth() === 31; - if (fromDay == 1) { - tmpDate = moment().subtract(2, "month").endOf("month"); - str = `至上上月最后一天`; - } else { - tmpDate = moment(new Date(`${moment(tmpDate).format("YYYY-MM")}-0${fromDay}`)) - .add(is_31H ? 30 : 27, "days"); - str = `至上月${moment(tmpDate).date()}号`; - } - break; - case "2": - tmpDate = moment().subtract(1, "month"); - const is_31 = moment(tmpDate, "YYYY-MM").daysInMonth() === 31; - if (fromDay == 1) { - tmpDate = moment().subtract(1, "month").endOf("month"); - str = `至上月最后一天`; - } else { - tmpDate = moment(new Date(`${moment(tmpDate).format("YYYY-MM")}-0${fromDay}`)) - .add(is_31 ? 30 : 27, "days"); - str = `至本月${moment(tmpDate).date()}号`; - } - break; - case "3": - tmpDate = moment().add(0, "month"); - const is_31K = moment(tmpDate, "YYYY-MM").daysInMonth() === 31; - if (fromDay == 1) { - tmpDate = moment().endOf("month"); - str = `至本月最后一天`; - } else { - tmpDate = moment(new Date(`${moment(tmpDate).format("YYYY-MM")}-0${fromDay}`)) - .add(is_31K ? 30 : 27, "days"); - str = `至下月${moment(tmpDate).date()}号`; - } - break; - case "4": - tmpDate = moment().add(1, "month"); - const is_31L = moment(tmpDate, "YYYY-MM").daysInMonth() === 31; - if (fromDay == 1) { - tmpDate = moment().add(1, "month").endOf("month"); - str = `至下月最后一天`; - } else { - tmpDate = moment(new Date(`${moment(tmpDate).format("YYYY-MM")}-0${fromDay}`)) - .add(is_31L ? 30 : 29, "days"); - str = `至下下月${moment(tmpDate).date()}号`; - } - break; - default: - break; - } - return { - [periodStrType]: str, - date: moment(tmpDate).format("YYYY-MM-DD") - }; -}; diff --git a/pc4mobx/hrmSalary/util/date.js b/pc4mobx/hrmSalary/util/date.js index e014265e..e82f9039 100644 --- a/pc4mobx/hrmSalary/util/date.js +++ b/pc4mobx/hrmSalary/util/date.js @@ -1,21 +1,89 @@ -import moment from 'moment' +import moment from "moment"; +import { WeaLocaleProvider } from "ecCom"; + +const getLabel = WeaLocaleProvider.getLabel; // 获取当前年月 export const getCurrentYearMonth = () => { - return moment(new Date()).format("YYYY-MM") -} + return moment(new Date()).format("YYYY-MM"); +}; // 获取当前月份 export const getCurrentMonth = () => { - return (new Date()).getMonth() + 1 -} + return (new Date()).getMonth() + 1; +}; // 获取前几个月的年月 export const getSubtractMonthYearMonth = (subtract = 1) => { - return moment(new Date()).subtract(subtract,'months').startOf('month').format('YYYY-MM') -} + return moment(new Date()).subtract(subtract, "months").startOf("month").format("YYYY-MM"); +}; // 获取后几个月的年月 export const getAddMonthYearMonth = (add = 1) => { - return moment(new Date()).add(add,'months').startOf('month').format('YYYY-MM') -} \ No newline at end of file + return moment(new Date()).add(add, "months").startOf("month").format("YYYY-MM"); +}; +/** + * 数字前面补零 + * @param num + * @param length + */ +export const prefixAddZero = (num, length) => { + return (Array(length).join("0") + num).slice(-length); +}; +/** + * 获取月份天数 + * @param year + * @param month + */ +export const getMonthDays = (year, month) => { + const d = new Date(Number(year), Number(month), 0); + return d.getDate(); +}; + +export const generateBasicInfo = (monthCal, nowYear, nowMonth) => { + let nowMonthStr = "", nextMonthStr = ""; + switch (monthCal) { + case -2: + nowMonthStr = getLabel(111, "上上月"); + nextMonthStr = getLabel(111, "上月"); + break; + case -1: + nowMonthStr = getLabel(111, "上月"); + nextMonthStr = getLabel(111, "本月"); + break; + case 0: + nowMonthStr = getLabel(111, "本月"); + nextMonthStr = getLabel(111, "下月"); + break; + case 1: + nowMonthStr = getLabel(111, "下月"); + nextMonthStr = getLabel(111, "下下月"); + break; + } + + let year, month; + if (monthCal < 0) { + let monthCalAbs = Math.abs(monthCal); + if (nowMonth <= monthCalAbs) { + // 跨年 + year = (nowYear - 1).toString(); + month = (12 - (monthCalAbs - nowMonth)).toString(); + } else { + // 未跨年 + year = nowYear.toString(); + month = (nowMonth - monthCalAbs).toString(); + } + } else if (monthCal === 0) { + year = nowYear.toString(); + month = nowMonth.toString(); + } else { + if (nowMonth + monthCal > 12) { + year = (nowYear + 1).toString(); + month = (nowMonth + monthCal - 12).toString(); + } else { + year = nowYear.toString(); + month = (nowMonth + monthCal).toString(); + } + } + return { year, month, nowMonthStr, nextMonthStr }; +}; From 4929ff4db51147f28507ab96627d6a44831ce0c7 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, 17 Apr 2023 17:32:16 +0800 Subject: [PATCH 009/142] =?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 --- pc4mobx/hrmSalary/apis/ruleconfig.js | 4 + .../components/conditions.js | 46 +++++++++-- .../components/dimensionSlide.js | 25 +++--- .../components/dimensionTable.js | 26 ++++--- .../components/groupIndividualEditTable.js | 5 +- .../components/groupSpacingEditTable.js | 20 ++--- .../components/reportForm.js | 19 +++++ .../components/reportList.js | 42 ++++++++++ .../components/statisticsModal.js | 6 +- .../pages/analysisOfSalaryStatistics/index.js | 76 ++++++++++++------- .../analysisOfSalaryStatistics/index.less | 32 ++++++++ pc4mobx/hrmSalary/stores/attendanceStore.js | 1 + 12 files changed, 230 insertions(+), 72 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/reportForm.js create mode 100644 pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/reportList.js diff --git a/pc4mobx/hrmSalary/apis/ruleconfig.js b/pc4mobx/hrmSalary/apis/ruleconfig.js index 2e5967fc..ee00eb90 100644 --- a/pc4mobx/hrmSalary/apis/ruleconfig.js +++ b/pc4mobx/hrmSalary/apis/ruleconfig.js @@ -43,3 +43,7 @@ export const getEncryptProgress = params => { export const operateTaxDeclarationFunction = (params) => { return postFetch('/api/bs/hrmsalary/sys/operateTaxDeclarationFunction', params); } +//薪酬统计维度下拉列表 +export const reportGetForm = params => { + return WeaTools.callApi('/api/bs/hrmsalary/report/statistics/report/getForm', 'GET', params); +} diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/conditions.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/conditions.js index 42ef8654..1a2d794f 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/conditions.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/conditions.js @@ -1,3 +1,6 @@ +import { WeaLocaleProvider } from "ecCom"; + +const { getLabel } = WeaLocaleProvider; export const condition = [ { items: [ @@ -8,7 +11,7 @@ export const condition = [ conditionType: "SELECT", domkey: ["dimType"], fieldcol: 14, - label: "维度类型", + label: getLabel(111, "维度类型"), labelcol: 6, options: [], detailtype: 3, @@ -20,7 +23,7 @@ export const condition = [ conditionType: "SELECT", domkey: ["setting4Qualitative"], fieldcol: 14, - label: "统计维度", + label: getLabel(111, "统计维度"), labelcol: 6, options: [], rules: "required|string", @@ -31,7 +34,7 @@ export const condition = [ conditionType: "INPUT", domkey: ["dimName"], fieldcol: 14, - label: "统计维度名称", + label: getLabel(111, "统计维度名称"), labelcol: 6, value: "", rules: "required|string", @@ -42,7 +45,7 @@ export const condition = [ conditionType: "SELECT", domkey: ["dimCode"], fieldcol: 14, - label: "分组所属字段", + label: getLabel(111, "分组所属字段"), labelcol: 6, options: [], viewAttr: 2, @@ -54,13 +57,44 @@ export const condition = [ conditionType: "TEXTAREA", domkey: ["remark"], fieldcol: 14, - label: "描述", + label: getLabel(111, "描述"), labelcol: 6, value: "", viewAttr: 2 } ], - title: "基础设置", + title: getLabel(111, "基础设置"), + defaultshow: true + } +]; +export const reportCondition = [ + { + items: [ + { + colSpan: 1, + conditionType: "INPUT", + domkey: ["reportName"], + fieldcol: 14, + label: getLabel(111, "报表名称"), + labelcol: 6, + value: "", + rules: "required|string", + viewAttr: 3 + }, + { + colSpan: 1, + conditionType: "SELECT", + domkey: ["dimensionIds"], + fieldcol: 14, + label: getLabel(111, "统计维度"), + labelcol: 6, + options: [], + viewAttr: 2, + helpfulTip: "", + hide: true + } + ], + title: "", defaultshow: true } ]; diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionSlide.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionSlide.js index 16866f49..9d65ac16 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionSlide.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionSlide.js @@ -5,7 +5,7 @@ * Date: 2023/4/11 */ import React, { Component } from "react"; -import { WeaDialog, WeaSearchGroup } from "ecCom"; +import { WeaDialog, WeaSearchGroup, WeaLocaleProvider } from "ecCom"; import { Button, message, Modal } from "antd"; import { dimensionGetForm, dimensionSave } from "../../../apis/statistics"; import { getSearchs } from "../../../util"; @@ -13,6 +13,7 @@ import GroupSpacingEditTable from "./groupSpacingEditTable"; import GroupIndividualEditTable from "./groupIndividualEditTable"; import "../index.less"; +const { getLabel } = WeaLocaleProvider; const keyObj = { "RATION_GROUP_SPACING": "setting4RationGroupSpacing", "RATION_GROUP_INDIVIDUAL": "setting4RationGroupIndividual" @@ -88,8 +89,8 @@ class DimensionSlide extends Component { if (dimType === "QUALITATIVE") { if (!setting4Qualitative || !extraParams.dimName) { Modal.warning({ - title: "信息确认", - content: "必要信息不完整,红色*为必填项!" + title: getLabel(111, "信息确认"), + content: getLabel(111, "必要信息不完整,红色*为必填项!") }); return; } @@ -99,8 +100,8 @@ class DimensionSlide extends Component { } else { if (!extraParams.dimName) { Modal.warning({ - title: "信息确认", - content: "必要信息不完整,红色*为必填项!" + title: getLabel(111, "信息确认"), + content: getLabel(111, "必要信息不完整,红色*为必填项!") }); return; } @@ -108,7 +109,7 @@ class DimensionSlide extends Component { const { setting4RationGroupSpacing } = this.state; const bool = _.every(setting4RationGroupSpacing, it => it.startValue !== "" && it.endValue !== "" && it.startValue <= it.endValue); if (_.isEmpty(setting4RationGroupSpacing) || !bool) { - message.warning("请完善分组设置相关数据!分组设置不能为空,起始值结束值必填,且起始值需小于结束值!"); + message.warning(getLabel(111, "请完善分组设置相关数据!分组设置不能为空,起始值结束值必填,且起始值需小于结束值!")); return; } else { payload = { @@ -126,7 +127,7 @@ class DimensionSlide extends Component { const { setting4RationGroupIndividual } = this.state; const bool = _.every(setting4RationGroupIndividual, it => it.value !== ""); if (_.isEmpty(setting4RationGroupIndividual) || !bool) { - message.warning("请完善分组设置相关数据!分组设置不能为空,且数值必填"); + message.warning(getLabel(111, "请完善分组设置相关数据!分组设置不能为空,且数值必填")); return; } else { payload = { @@ -140,11 +141,11 @@ class DimensionSlide extends Component { dimensionSave(payload).then(({ status, errormsg }) => { this.setState({ loading: false }); if (status) { - message.success("保存成功"); + message.success(getLabel(111, "保存成功")); onCancel(true); this.props.form.resetForm(); } else { - message.error(errormsg || "保存失败"); + message.error(errormsg || getLabel(111, "保存失败")); } }).catch(() => this.setState({ loading: false })); }; @@ -175,15 +176,15 @@ class DimensionSlide extends Component { className="dimensionSlideWrapper" title={
- 新建统计维度 - + {getLabel(111, "新建统计维度")} +
} > {getSearchs(form, condition, 1, false, this.formItemChange)} { dimType !== "QUALITATIVE" && - + { dimType === "RATION_GROUP_SPACING" && { Modal.confirm({ - title: "信息确认", - content: "确认要删除吗?", + title: getLabel(111, "信息确认"), + content: getLabel(111, "确认要删除吗?"), onOk: () => { dimensionDelete(payload).then(({ status, errormsg }) => { if (status) { - message.success("删除成功"); + message.success(getLabel(111, "删除成功")); this.dimensionList(); } else { - message.error(errormsg || "删除失败"); + message.error(errormsg || getLabel(111, "删除失败")); } }); } @@ -66,7 +67,7 @@ class DimensionTable extends Component { const { onEdit } = this.props; const pagination = { ...pageInfo, - showTotal: total => `共 ${total} 条`, + showTotal: total => `${getLabel(111, "共")} ${total} ${getLabel(111, "条")}`, showQuickJumper: true, showSizeChanger: true, pageSizeOptions: ["10", "20", "50", "100"], @@ -82,16 +83,17 @@ class DimensionTable extends Component { } }; const columns = [ - { dataIndex: "dimName", title: "统计维度" }, - { dataIndex: "remark", title: "描述" }, - { dataIndex: "dimType", title: "维度类型" }, + { dataIndex: "dimName", title: getLabel(111, "统计维度") }, + { dataIndex: "remark", title: getLabel(111, "描述") }, + { dataIndex: "dimType", title: getLabel(111, "维度类型") }, { - dataIndex: "operate", title: "操作", + dataIndex: "operate", title: getLabel(111, "操作"), render: (_, record) => { return ( - onEdit(record.id)}>编辑 - this.dimensionDelete([record.id])}>删除 + onEdit(record.id)}>{getLabel(111, "编辑")} + this.dimensionDelete([record.id])}>{getLabel(111, "删除")} ); } diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/groupIndividualEditTable.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/groupIndividualEditTable.js index 5d2ba0e3..1d709bc6 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/groupIndividualEditTable.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/groupIndividualEditTable.js @@ -5,8 +5,9 @@ * Date: 2023/4/12 */ import React, { Component } from "react"; -import { WeaTableEdit } from "ecCom"; +import { WeaLocaleProvider, WeaTableEdit } from "ecCom"; +const { getLabel } = WeaLocaleProvider; class GroupIndividualEditTable extends Component { constructor(props) { super(props); @@ -31,7 +32,7 @@ class GroupIndividualEditTable extends Component { const { dataSource } = this.state; const columns = [ { - title: "分组设置值", + title: getLabel(111, "分组设置值"), dataIndex: "value", key: "value", com: [ diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/groupSpacingEditTable.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/groupSpacingEditTable.js index 76720774..c976cd93 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/groupSpacingEditTable.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/groupSpacingEditTable.js @@ -5,7 +5,9 @@ * Date: 2023/4/12 */ import React, { Component } from "react"; -import { WeaTableEdit } from "ecCom"; +import { WeaLocaleProvider, WeaTableEdit } from "ecCom"; + +const { getLabel } = WeaLocaleProvider; class GroupSpacingEditTable extends Component { constructor(props) { @@ -37,7 +39,7 @@ class GroupSpacingEditTable extends Component { const { dataSource } = this.state; const columns = [ { - title: "起始值", + title: getLabel(111, "起始值"), dataIndex: "startValue", key: "startValue", com: [ @@ -45,19 +47,19 @@ class GroupSpacingEditTable extends Component { ] }, { - title: "含", + title: getLabel(111, "含"), dataIndex: "includeStart", key: "includeStart", com: [ { type: "CHECKBOX", key: "includeStart", - otherParams: { content: "含" } + otherParams: { content: getLabel(111, "含") } } ] }, { - title: "至", + title: getLabel(111, "至"), dataIndex: "to", key: "to", com: [ @@ -65,7 +67,7 @@ class GroupSpacingEditTable extends Component { ] }, { - title: "结束值", + title: getLabel(111, "结束值"), dataIndex: "endValue", key: "endValue", com: [ @@ -73,14 +75,14 @@ class GroupSpacingEditTable extends Component { ] }, { - title: "含", + title: getLabel(111, "含"), dataIndex: "includeEnd", key: "includeEnd", com: [ { type: "CHECKBOX", key: "includeEnd", - otherParams: { content: "含" } + otherParams: { content: getLabel(111, "含") } } ] } @@ -88,7 +90,7 @@ class GroupSpacingEditTable extends Component { return ( ({ ...item, to: "至" }))} + datas={_.map(dataSource, item => ({ ...item, to: getLabel(111, "至") }))} showCopy={false} onChange={this.handleChangeTableData} /> ); diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/reportForm.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/reportForm.js new file mode 100644 index 00000000..0308e2ed --- /dev/null +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/reportForm.js @@ -0,0 +1,19 @@ +/* + * Author: 黎永顺 + * name: 报表表单 + * Description: + * Date: 2023/4/17 + */ +import React, { Component } from "react"; +import { getSearchs } from "../../../util"; + +class ReportForm extends Component { + render() { + const { form, condition } = this.props; + return ( + {getSearchs(form, condition, 1, false)} + ); + } +} + +export default ReportForm; diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/reportList.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/reportList.js new file mode 100644 index 00000000..11353df4 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/reportList.js @@ -0,0 +1,42 @@ +/* + * Author: 黎永顺 + * name: 统计表 + * Description: + * Date: 2023/4/17 + */ +import React, { Component } from "react"; +import { WeaLocaleProvider } from "ecCom"; +import { Col, Row } from "antd"; +import "../index.less"; + +const { getLabel } = WeaLocaleProvider; + +class ReportList extends Component { + render() { + const { dataSource } = this.props; + return ( + + { + _.isEmpty(dataSource) ?
{getLabel(111, "暂无数据")}
: + _.map(dataSource, it => { + return +
+
+
+ +
+
{getLabel(111, "统计维度")}:
+
+
+
+
+
+ ; + }) + } +
+ ); + } +} + +export default ReportList; diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/statisticsModal.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/statisticsModal.js index 8354993a..e1e18e83 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/statisticsModal.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/statisticsModal.js @@ -5,15 +5,17 @@ * Date: 2023/4/10 */ import React, { Component } from "react"; -import { WeaDialog } from "ecCom"; +import { WeaDialog, WeaLocaleProvider } from "ecCom"; import { Button } from "antd"; import "../index.less"; +const { getLabel } = WeaLocaleProvider; + class StatisticsModal extends Component { render() { const { typeKey, onCancel } = this.props; const buttons = typeKey === "addReport" ? [ - + ] : []; return ( { + reportGetForm({}).then(({ status, data }) => { + console.log(data, reportCondition); + }); + }; initCondition = async () => { const { attendanceStore: { statisticsForm } } = this.props; const [dimTypeEnum, dimCodeList] = await Promise.all([this.commonEnumList(), this.dimensionGetForm()]); @@ -145,10 +158,10 @@ class Index extends Component { const { modalReq } = this.state; const title = key === "dimension" ?
- 统计维度管理 - + {getLabel(111, "统计维度管理")} +
- : "新建报表"; + : getLabel(111, "新建报表"); this.setState({ modalReq: { ...modalReq, @@ -188,40 +201,45 @@ class Index extends Component { }; render() { - const { taxAgentStore: { showOperateBtn }, attendanceStore: { statisticsForm } } = this.props; + const { taxAgentStore: { showOperateBtn }, attendanceStore: { statisticsForm, reportForm } } = this.props; const { selectedKey, modalReq, slideReq, conditions } = this.state; const buttons = [ - , - , - this.handleReqBtnsClick("addReport")}>{getLabel(111, "新建报表")}, + , + this.handleReqBtnsClick("search")}/> ]; const tabs = [ - { key: "statistics", title: "统计表" }, - { key: "detail", title: "员工明细" } + { key: "statistics", title: getLabel(111, "统计表") }, + { key: "detail", title: getLabel(111, "员工明细") } ]; return ( } + title={getLabel(111, "薪酬统计分析")} icon={} iconBgcolor="#F14A2D" buttons={!showOperateBtn ? buttons.slice(-1) : buttons} buttonSpace={10} showDropIcon={false} tabDatas={tabs} className="xc_tj_fx_wrapper" - selectedKey={selectedKey} onChange={selectedKey => this.setState({ selectedKey })} + selectedKey={selectedKey} + onChange={selectedKey => this.setState({ selectedKey }, () => this.state.selectedKey === "statistics" && this.initReportFormCondition())} > -
- - { - modalReq.typeKey === "dimension" && - this.dimensionTableRef = dom} - onEdit={id => this.handleAddDimension(id)} - /> - } - - -
+ {this.state.selectedKey === "statistics" && } + + { + modalReq.typeKey === "dimension" && + this.dimensionTableRef = dom} + onEdit={id => this.handleAddDimension(id)} + /> + } + { + modalReq.typeKey === "addReport" && + + } + +
); } diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less index d53b539c..b238f208 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less @@ -4,6 +4,38 @@ margin-right: 10px; width: 220px; } + + .wea-new-top-req-content { + background: #FFF; + + .reportRow { + .gutter-row { + margin-bottom: 16px; + border-radius: 6px; + + .card-item { + border-radius: 6px; + display: flex; + + .center { + display: flex; + flex-direction: column; + + .dimension { + display: flex; + } + } + } + } + + .empty { + font-size: 16px; + width: 100%; + text-align: center; + margin-top: 26px; + } + } + } } //统计维度弹框 diff --git a/pc4mobx/hrmSalary/stores/attendanceStore.js b/pc4mobx/hrmSalary/stores/attendanceStore.js index ed18f076..324d3400 100644 --- a/pc4mobx/hrmSalary/stores/attendanceStore.js +++ b/pc4mobx/hrmSalary/stores/attendanceStore.js @@ -7,4 +7,5 @@ export class AttendanceStore { @observable refenceform = new WeaForm(); //薪酬统计 新增form @observable statisticsForm = new WeaForm(); + @observable reportForm = new WeaForm(); } From 0bc5590c046304b674882036662a73f55ef5616b 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, 18 Apr 2023 10:51:38 +0800 Subject: [PATCH 010/142] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E8=96=AA=E8=B5=84?= =?UTF-8?q?=E8=B4=A6=E5=A5=97=E7=9A=84=E8=96=AA=E8=B5=84=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BF=BB=E9=A1=B5=E7=9A=84bug=E4=BB=A5?= =?UTF-8?q?=E5=8F=8A=E7=A4=BE=E4=BF=9D=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6?= =?UTF-8?q?=E7=9A=84=E7=BA=BF=E4=B8=8B=E5=AF=B9=E6=AF=94=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=9A=84=E5=AF=BC=E5=85=A5=E4=B8=8B=E8=BD=BD=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=9A=84=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/calculateDetail/compareDetailImportModal.js | 9 +++++++-- .../ledgerPage/components/ledgerSalaryItemAddModal.js | 10 ++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/calculateDetail/compareDetailImportModal.js b/pc4mobx/hrmSalary/pages/calculateDetail/compareDetailImportModal.js index 1c276127..9fc924e1 100644 --- a/pc4mobx/hrmSalary/pages/calculateDetail/compareDetailImportModal.js +++ b/pc4mobx/hrmSalary/pages/calculateDetail/compareDetailImportModal.js @@ -1,7 +1,7 @@ import React from "react"; import ImportModal from "../../components/importModal"; import { inject, observer } from "mobx-react"; -import { getQueryString } from "../../util/url"; +import { convertToUrlString, getQueryString } from "../../util/url"; @inject("calculateStore", "standingBookStore") @observer @@ -35,7 +35,12 @@ export default class CompareDetailImportModal extends React.Component { if (this.props.id) { url = "/api/bs/hrmsalary/salaryacct/comparisonresult/importtemplate/export?salaryAcctRecordId=" + this.props.id; } else { - url = `/api/bs/hrmsalary/siaccount/comparisonwelfare/importtemplate/export`; + const payload = { + billMonth: getQueryString("billMonth"), + paymentOrganization: getQueryString("paymentOrganization"), + paymentStatus: 0 + }; + url = `/api/bs/hrmsalary/siaccount/comparisonwelfare/importtemplate/export?${convertToUrlString(payload)}`; } window.open(url); } diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItemAddModal.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItemAddModal.js index 20562453..de378287 100644 --- a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItemAddModal.js +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItemAddModal.js @@ -13,6 +13,7 @@ export default class LedgerSalaryItemAddModal extends React.Component { name: "", selectedRowKeys: [], dataSource: [], + dataSourceCopy: [], columns: [], pageInfo: { current: 1, @@ -24,7 +25,7 @@ export default class LedgerSalaryItemAddModal extends React.Component { componentWillReceiveProps(nextProps, nextContext) { if (nextProps.visible !== this.props.visivle && nextProps.visible) { - this.setState({ selectedRowKeys: [] }, () => { + this.setState({ selectedRowKeys: [], dataSourceCopy: [] }, () => { this.listSalaryItem(); }); } @@ -32,7 +33,7 @@ export default class LedgerSalaryItemAddModal extends React.Component { listSalaryItem = () => { const { itemGroups } = this.props; - const { name, pageInfo, loading } = this.state; + const { name, pageInfo, loading, dataSourceCopy } = this.state; let excludeIds = []; itemGroups.map(item => { item.items && item.items.map(i => { @@ -50,6 +51,7 @@ export default class LedgerSalaryItemAddModal extends React.Component { if (status) { const { pageNum: current, pageSize, total, columns, list: dataSource } = data; this.setState({ + dataSourceCopy: [...dataSourceCopy, ...dataSource], pageInfo: { ...pageInfo, current, pageSize, total }, dataSource, columns @@ -80,11 +82,11 @@ export default class LedgerSalaryItemAddModal extends React.Component { }; handleAdd = () => { - const { dataSource, selectedRowKeys } = this.state; + const { dataSourceCopy, selectedRowKeys } = this.state; const { onAddSalaryItems, id, onCancel, itemGroups } = this.props; const arrItems = _.find(itemGroups, it => it.uuid === id).items || []; let selectItems = []; - dataSource.map((item) => { + dataSourceCopy.map((item) => { item = { ...item }; selectedRowKeys.map((key, keyIdx) => { if (item.id === key) { From ccfb84930b96285f16d00277469d34f81c645067 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, 18 Apr 2023 13:24:12 +0800 Subject: [PATCH 011/142] =?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=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hrmSalary/pages/analysisOfSalaryStatistics/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.js index baffb50f..f3dca9fd 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.js @@ -28,6 +28,7 @@ class Index extends Component { this.state = { conditions: [], convertConditions: [], + reportConditions: [], selectedKey: "statistics", slideReq: { visible: false, formId: "" @@ -44,8 +45,13 @@ class Index extends Component { } initReportFormCondition = () => { + const { attendanceStore: { reportForm } } = this.props; reportGetForm({}).then(({ status, data }) => { console.log(data, reportCondition); + if (status) { + + } + reportForm.initFormFields(reportCondition); }); }; initCondition = async () => { @@ -202,7 +208,7 @@ class Index extends Component { render() { const { taxAgentStore: { showOperateBtn }, attendanceStore: { statisticsForm, reportForm } } = this.props; - const { selectedKey, modalReq, slideReq, conditions } = this.state; + const { selectedKey, modalReq, slideReq, conditions, reportConditions } = this.state; const buttons = [ , + +
; }) diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/statisticsModal.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/statisticsModal.js index df8132e5..fcddfaab 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/statisticsModal.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/statisticsModal.js @@ -5,17 +5,52 @@ * Date: 2023/4/10 */ import React, { Component } from "react"; +import { Button, message, Modal } from "antd"; import { WeaDialog, WeaLocaleProvider } from "ecCom"; -import { Button } from "antd"; +import { reportStatisticsReportSave } from "../../../apis/ruleconfig"; import "../index.less"; const { getLabel } = WeaLocaleProvider; class StatisticsModal extends Component { + constructor(props) { + super(props); + this.state = { + loading: false + }; + } + + handleSaveReportList = () => { + const { form, id, onCancel } = this.props; + form.validateForm().then(f => { + if (f.isValid) { + const { dimensionIds, reportName } = form.getFormParams(); + const payload = { id, reportName, dimensionIds: dimensionIds.split(",") }; + this.setState({ loading: true }); + reportStatisticsReportSave(payload).then(({ status, errormsg }) => { + this.setState({ loading: false }); + if (status) { + onCancel(true); + message.success(getLabel(111, "保存成功")); + form.resetForm(); + } else { + message.error(errormsg || getLabel(111, "保存失败")); + } + }).catch(() => this.setState({ loading: false })); + } else { + Modal.warning({ + title: getLabel(111, "信息确认"), + content: getLabel(111, "必要信息不完整,红色*为必填项!") + }); + } + }); + }; + render() { + const { loading } = this.state; const { typeKey, onCancel } = this.props; const buttons = typeKey === "addReport" ? [ - + ] : []; return ( { + initReportFormCondition = (payload = {}) => { const { attendanceStore: { reportForm } } = this.props; - reportGetForm({}).then(({ status, data }) => { + reportGetForm(payload).then(({ status, data }) => { if (status) { - const { statsDimOptions } = data; - this.setState({ - reportConditions: _.map(reportCondition, item => { - return { - ...item, - items: _.map(item.items, child => { - if (child.domkey[0] === "dimensionIds") { - return { - ...child, - options: _.map(statsDimOptions, dimTypeItem => ({ - key: dimTypeItem.id, - showname: dimTypeItem.content - })) - }; - } - return { ...child }; - }) - }; - }) - }, () => { - reportForm.initFormFields(this.state.reportConditions); - }); + const { statsDimOptions, data: detailData } = data; + if (_.isEmpty(payload)) { + this.setState({ + reportConditions: _.map(reportCondition, item => { + return { + ...item, + items: _.map(item.items, child => { + if (child.domkey[0] === "dimensionIds") { + return { + ...child, + options: _.map(statsDimOptions, dimTypeItem => ({ + key: dimTypeItem.id, + showname: dimTypeItem.content + })) + }; + } + return { ...child }; + }) + }; + }) + }, () => { + reportForm.initFormFields(this.state.reportConditions); + }); + } else { + reportForm.updateFields({ + reportName: detailData.reportName, + dimensionIds: detailData.dimension.join(",") + }); + } } }); }; @@ -176,9 +184,10 @@ class Index extends Component { }); } }; - handleReqBtnsClick = (key) => { + handleReqBtnsClick = (key, id = "") => { if (key === "search") { - + const { reportName } = this.state; + this.reportListRef.reportStatisticsReportList({ reportName }); } else { const { modalReq } = this.state; const title = key === "dimension" ? @@ -186,21 +195,26 @@ class Index extends Component { {getLabel(111, "统计维度管理")} - : getLabel(111, "新建报表"); + : getLabel(111, id ? "编辑报表" : "新建报表"); this.setState({ modalReq: { - ...modalReq, - title, visible: true, typeKey: key + ...modalReq, id, title, + visible: true, typeKey: key } - }); + }, () => id && this.initReportFormCondition({ id })); } }; - handleCancel = () => { + handleCancel = (refresh = false) => { + const { attendanceStore: { reportForm } } = this.props; const { modalReq } = this.state; this.setState({ modalReq: { - ...modalReq, visible: false + ...modalReq, visible: false, id: "" } + }, () => { + const { selectedKey, reportName } = this.state; + selectedKey === "statistics" && reportForm.resetForm(); + refresh && selectedKey === "statistics" && this.reportListRef.reportStatisticsReportList({ reportName }); }); }; handleAddDimension = (formId = "") => { @@ -227,12 +241,14 @@ class Index extends Component { render() { const { taxAgentStore: { showOperateBtn }, attendanceStore: { statisticsForm, reportForm } } = this.props; - const { selectedKey, modalReq, slideReq, conditions, reportConditions } = this.state; + const { selectedKey, modalReq, slideReq, conditions, reportConditions, reportName } = this.state; const buttons = [ , , this.setState({ reportName })} onSearch={() => this.handleReqBtnsClick("search")}/> ]; const tabs = [ @@ -247,8 +263,15 @@ class Index extends Component { selectedKey={selectedKey} onChange={selectedKey => this.setState({ selectedKey }, () => this.state.selectedKey === "statistics" && this.initReportFormCondition())} > - {this.state.selectedKey === "statistics" && } - + { + this.state.selectedKey === "statistics" && + this.reportListRef = dom} + reportName={reportName} + onEdit={this.handleReqBtnsClick} + /> + } + { modalReq.typeKey === "dimension" && this.dimensionTableRef = dom} diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less index b238f208..97860916 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less @@ -9,6 +9,8 @@ background: #FFF; .reportRow { + padding: 16px; + .gutter-row { margin-bottom: 16px; border-radius: 6px; @@ -16,28 +18,101 @@ .card-item { border-radius: 6px; display: flex; + height: 90px; + justify-content: space-between; + padding: 22px 0 22px 16px; + border: 1px solid #e5e5e5; - .center { + .cardLeft { display: flex; + align-items: center; + justify-content: center; + + i { + padding: 10px; + color: #FFF; + font-size: 20px; + border-radius: 50%; + background-color: #ff666a; + } + } + + .cardCenter { + display: flex; + flex: 1; flex-direction: column; + justify-content: space-between; + margin-left: 10px; + + .reportName { + font-size: 14px; + color: #111; + font-weight: 600; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } .dimension { display: flex; + + .label { + height: 12px; + font-size: 12px; + color: #999; + line-height: 12px; + font-weight: 400; + } + + .value { + height: 12px; + font-size: 12px; + color: #111; + line-height: 12px; + font-weight: 400; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + } + } + + .cardRight { + display: flex; + align-items: center; + justify-content: center; + + .ant-btn-ghost { + color: #999; + border: 1px solid transparent; + } + + .ant-btn-ghost:focus, .ant-btn-ghost:hover, + .ant-btn-ghost.active, .ant-btn-ghost:active { + color: #2baee9; + background-color: #FFF; + border: 1px solid #e5e5e5; } } } } - .empty { - font-size: 16px; - width: 100%; - text-align: center; - margin-top: 26px; + .card-item:hover { + cursor: pointer; + box-shadow: 0 3px 12px 0 rgba(0, 0, 0, .12); } } + + .empty { + font-size: 16px; + width: 100%; + text-align: center; + margin-top: 26px; + } } } + //统计维度弹框 .dimensionModalWrapper, .dimensionSlideWrapper { .dimensionTitle { @@ -57,8 +132,10 @@ } -.dimensionSlideWrapper { - .wea-select, .ant-select, .ant-select-selection { - width: 100%; +.dimensionSlideWrapper, .dimensionModalWrapper { + .wea-search-group { + .wea-select, .ant-select, .ant-select-selection { + width: 100%; + } } } From 7c60a44e6699390e18f009641f06ddf80201b748 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, 20 Apr 2023 15:36:51 +0800 Subject: [PATCH 015/142] =?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=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pc4mobx/hrmSalary/index.js | 5 +- .../components/reportList.js | 13 ++- .../components/statisticsModal.js | 2 +- .../pages/reportView/components/leftTab.js | 72 +++++++++++++ pc4mobx/hrmSalary/pages/reportView/index.js | 78 ++++++++++++++ pc4mobx/hrmSalary/pages/reportView/index.less | 100 ++++++++++++++++++ 6 files changed, 266 insertions(+), 4 deletions(-) create mode 100644 pc4mobx/hrmSalary/pages/reportView/components/leftTab.js create mode 100644 pc4mobx/hrmSalary/pages/reportView/index.js create mode 100644 pc4mobx/hrmSalary/pages/reportView/index.less diff --git a/pc4mobx/hrmSalary/index.js b/pc4mobx/hrmSalary/index.js index 24931140..3037a01b 100644 --- a/pc4mobx/hrmSalary/index.js +++ b/pc4mobx/hrmSalary/index.js @@ -32,7 +32,8 @@ import SysConfig from "./pages/sysConfig"; import RuleConfig from "./pages/ruleConfig"; import Appconfig from "./pages/appConfig"; import FieldManagement from "./pages/fieldManagement"; -import AnalysisOfSalaryStatistics from "./pages/analysisOfSalaryStatistics" +import AnalysisOfSalaryStatistics from "./pages/analysisOfSalaryStatistics"; +import ReportView from "./pages/reportView"; import stores from "./stores"; import "./style/index"; @@ -80,6 +81,7 @@ const DataAcquisition = (props) => props.children; // appconfig 应用配置 // fieldManagement 字段管理 // analysisOfSalaryStatistics 薪酬统计分析 +// reportView 薪酬报表查看 const Routes = ( + ); diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/reportList.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/reportList.js index 7ff65ad2..6510d5b1 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/reportList.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/reportList.js @@ -27,7 +27,7 @@ class ReportList extends Component { handleOptsClick = ({ key }, id, dimensionId) => { if (key === "delete") { - this.reportStatisticsReportDelete({ ids: id.split(",") }); + this.reportStatisticsReportDelete(id.split(",")); } else if (key === "edit") { this.props.onEdit("addReport", id); } @@ -56,6 +56,15 @@ class ReportList extends Component { } }); }; + /* + * Author: 黎永顺 + * Description: 报表查看 + * Params: + * Date: 2023/4/20 + */ + handleGoReportView = (id) => { + window.open(`${window.location.origin}/spa/hrmSalary/static/index.html#/main/hrmSalary/reportView?id=${id}`); + }; render() { const { dataSource } = this.state; @@ -65,7 +74,7 @@ class ReportList extends Component { _.isEmpty(dataSource) ?
{getLabel(111, "暂无数据")}
: _.map(dataSource, it => { const { reportName, dimension, id, dimensionId } = it; - return + return this.handleGoReportView(id)}>
diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/statisticsModal.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/statisticsModal.js index fcddfaab..c8920887 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/statisticsModal.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/statisticsModal.js @@ -55,7 +55,7 @@ class StatisticsModal extends Component { return ( { + const { reportName, selectedKeys } = this.state; + const { onChangeTab } = this.props; + reportStatisticsReportList({ reportName }).then(({ status, data: reportList }) => { + if (status) this.setState({ reportList }, () => { + onChangeTab(_.find(this.state.reportList, it => it.id === selectedKeys[0])); + }); + }); + }; + + render() { + const { reportName, selectedKeys, reportList } = this.state; + const { onChangeTab } = this.props; + return ( +
+
+ this.setState({ reportName })} + placeholder={getLabel(111, "请输入报表名称")} onSearch={this.reportStatisticsReportList} + /> +
+ { + this.setState({ selectedKeys: key.split(",") }, () => { + onChangeTab(_.find(reportList, it => it.id === key)); + }); + }} + > + { + _.map(reportList, item => { + const { reportName, id } = item; + return {reportName}; + }) + } + +
+ ); + } +} + +export default LeftTab; diff --git a/pc4mobx/hrmSalary/pages/reportView/index.js b/pc4mobx/hrmSalary/pages/reportView/index.js new file mode 100644 index 00000000..0b80f004 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/reportView/index.js @@ -0,0 +1,78 @@ +/* + * Author: 黎永顺 + * name: 薪酬报表查看 + * Description: + * Date: 2023/4/20 + */ +import React, { Component } from "react"; +import { WeaLeftRightLayout, WeaLocaleProvider, WeaSelect, WeaTop } from "ecCom"; +import LeftTab from "./components/leftTab"; +import { reportGetForm } from "../../apis/ruleconfig"; +import "./index.less"; + + +const { getLabel } = WeaLocaleProvider; + +class Index extends Component { + constructor(props) { + super(props); + this.state = { + report: {}, + dimensionList: [] + }; + } + + componentDidMount() { + this.reportGetForm(); + } + + reportGetForm = () => { + reportGetForm().then(({ status, data }) => { + if (status) { + const { statsDimOptions } = data; + this.setState({ + dimensionList: _.map(statsDimOptions, it => ({ key: it.id, showname: it.content })) + }); + } + }); + }; + + render() { + const { report, dimensionList } = this.state; + return ( + } + iconBgcolor="#F14A2D" + showDropIcon={false} + className="reportViewWrapper" + > + this.setState({ report })}/>} + > +
+
+
+
{report.reportName}
+
+
+
+ {getLabel(111, "统计维度")}: + +
+
+
+
+
+
+ {/* 内容区 */} + +
+
+
+ ); + } +} + +export default Index; diff --git a/pc4mobx/hrmSalary/pages/reportView/index.less b/pc4mobx/hrmSalary/pages/reportView/index.less new file mode 100644 index 00000000..8baa98f2 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/reportView/index.less @@ -0,0 +1,100 @@ +.reportViewWrapper { + height: 100%; + display: flex; + flex-direction: column; + + .wea-new-top-content { + flex: 1; + + .leftTabWrapper { + background: #FFF; + height: 100%; + overflow-y: auto; + + .searchArea { + width: 100%; + height: 49px; + line-height: 49px; + padding: 0 6px; + + .wea-input-focus { + width: 100%; + } + } + + .ant-menu { + border-right-color: transparent !important; + + .ant-menu-item, .ant-menu-item { + border-left: 4px solid transparent; + border-right: none; + } + + .ant-menu-item-selected, .ant-menu-selected { + border-left: 4px solid #2db7f5; + background: #f5f5f5; + border-right: none; + } + + .ant-menu-item-active, .ant-menu-item:hover, .ant-menu-submenu-active, .ant-menu-submenu-title:hover { + background: #f5f5f5; + } + } + } + + .rightLayout { + .layoutHeader { + height: 50px; + + .layoutRow { + height: 100%; + display: flex; + align-content: center; + padding: 8px 16px; + background-color: #f9f9f9; + border-bottom: 1px solid #e5e5e5; + + .layoutCol { + flex: 1; + height: 100%; + display: flex; + align-items: center; + + .rightColTitle { + height: 100%; + display: flex; + align-items: center; + white-space: nowrap; + + .icon-coms02-currency { + font-size: 16px; + color: #2db7f5; + margin: 0 10px; + cursor: pointer; + } + + .dimension { + display: flex; + align-items: center; + + .wea-select { + width: 150px; + margin-left: 10px; + } + } + + .iconWrapper { + display: flex; + align-items: center; + } + } + } + + .layoutColRight { + justify-content: flex-end; + } + } + } + } + } +} From 335624d91b167fb7b9f3817f55359e36dc2ab2ac 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, 20 Apr 2023 15:51:08 +0800 Subject: [PATCH 016/142] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E7=A4=BE=E4=BF=9D?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=9A=84=E5=90=88=E8=AE=A1=E8=A1=8Cbug=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E4=BB=A5=E5=8F=8A=E8=80=83=E6=83=85=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9A=84=E6=8C=89=E9=92=AE=E6=9D=83=E9=99=90?= =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/dataAcquisition/attendance/index.js | 10 +++++----- .../standingBookDetail/components/normal.js | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js index 4e5d734f..fca6e52a 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/attendance/index.js @@ -56,17 +56,17 @@ class Index extends Component { }; handleChangeSalaryMonth = (salaryMonth) => this.setState({ salaryMonth }, () => this.attendanceTableRef.getAttendanceList({ salaryYearMonth: _.compact(this.state.salaryMonth) })); handleAddAttendFileds = () => this.fieldMangRef.handleTriggerAttendFileds(); - handleImportAttendanceData= ()=>{ + handleImportAttendanceData = () => { this.attendanceTableRef.handleImportAttendanceData({ visiable: true, params: {}, step: 0, columns: [], slideDataSource: [], importResult: [] }); - } - handleQuoteAttendanceData= ()=>{ + }; + handleQuoteAttendanceData = () => { this.attendanceTableRef.handleQuoteAttendanceData({ visible: true, title: "引用考勤数据" }); - } + }; render() { const { selectedKey, salaryMonth, fieldName } = this.state; @@ -82,7 +82,7 @@ class Index extends Component { return (
this.setState({ selectedKey: v })} searchsBaseValue={fieldName} onSearchChange={fieldName => this.setState({ fieldName })} diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/normal.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/normal.js index b3b61565..08b5c839 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/normal.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/normal.js @@ -78,7 +78,7 @@ export default class NormalIndex extends Component { if (type === "init") { const { selectedKey } = this.props; const { status, data: sysData } = await this.sysConfCodeRule(); - const { data: { sumRow: siaccountSum } } = await this.siaccountDetailCommonListSum(); + const { data: { sumRow: siaccountSum } } = status && sysData === "1" ? await this.siaccountDetailCommonListSum() : { data: { sumRow: {} } }; this.setState({ showSum: selectedKey === "1" && status && sysData === "1", siaccountSum @@ -243,7 +243,7 @@ export default class NormalIndex extends Component { }; getNormalList = async (payload = {}) => { const { status, data: sysData } = await this.sysConfCodeRule(); - const { data: { sumRow: siaccountSum } } = await this.siaccountDetailCommonListSum(); + const { data: { sumRow: siaccountSum } } = status && sysData === "1" ? await this.siaccountDetailCommonListSum() : { data: { sumRow: {} } }; const { getNormalList } = this.props.standingBookStore; getNormalList({ ...payload }).then(({ list, columns = [], total }) => { this.setState({ @@ -255,7 +255,7 @@ export default class NormalIndex extends Component { }; getSupplementaryList = async (payload = {}) => { const { status, data: sysData } = await this.sysConfCodeRule(); - const { data: { sumRow: siaccountSum } } = await this.siaccountDetailCommonListSum(); + const { data: { sumRow: siaccountSum } } = status && sysData === "1" ? await this.siaccountDetailCommonListSum() : { data: { sumRow: {} } }; const { getSupplementaryList } = this.props.standingBookStore; getSupplementaryList({ ...payload From e59adcc7d50d601796af21f4cb4e06ddc50ccb0b 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, 20 Apr 2023 16:14:39 +0800 Subject: [PATCH 017/142] =?UTF-8?q?=E4=BA=A7=E5=93=81-=E7=A4=BE=E4=BF=9D?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=9A=84=E5=90=88=E8=AE=A1=E8=A1=8Cbug=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E4=BB=A5=E5=8F=8A=E8=80=83=E6=83=85=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=9A=84=E6=8C=89=E9=92=AE=E6=9D=83=E9=99=90?= =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../standingBookDetail/components/normal.js | 2 +- .../standingBookDetail/components/regList.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/normal.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/normal.js index 1fe2eab1..40f9fc83 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/normal.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/normal.js @@ -84,7 +84,7 @@ export default class NormalIndex extends Component { const { status, data: sysData } = await this.sysConfCodeRule(); const { data: { sumRow: siaccountSum } } = status && sysData === "1" && selectedKey === "1" ? await this.siaccountDetailCommonListSum() : - status && sysData === "1" && await this.siaccountDetailSupplementaryListSum(); + status && sysData === "1" ? await this.siaccountDetailSupplementaryListSum() : { data: { sumRow: {} } }; this.setState({ showSum: status && sysData === "1", siaccountSum: (status && sysData === "1") ? siaccountSum : {} diff --git a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/regList.js b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/regList.js index 477de105..65f8b835 100644 --- a/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/regList.js +++ b/pc4mobx/hrmSalary/pages/socialSecurityBenefits/standingBookDetail/components/regList.js @@ -47,12 +47,12 @@ class RegList extends Component { const { type, payload: { id, params } = {} } = data; if (type === "init") { const { status, data: sysData } = await this.sysConfCodeRule(); - const { data: { sumRow: siaccountSum } } = listType === "regression" ? + const { data: { sumRow: siaccountSum } } = status && sysData === "1" && listType === "regression" ? await this.siaccountDetailRecessionListSum() : - await this.siaccountDetailBalanceListSum(); + status && sysData === "1" ? await this.siaccountDetailBalanceListSum() : { data: { sumRow: {} } }; this.setState({ showSum: status && sysData === "1", - siaccountSum + siaccountSum: (status && sysData === "1") ? siaccountSum : {} }, () => this.postMessageToChild()); } else if (type === "turn") { if (id === "PAGEINFO") { @@ -110,9 +110,9 @@ class RegList extends Component { recessionList = async (module) => { const { type } = this.props; const { status: sysStatus, data: sysData } = await this.sysConfCodeRule(); - const { data: { sumRow: siaccountSum } } = type === "regression" ? + const { data: { sumRow: siaccountSum } } = sysStatus && sysData === "1" && type === "regression" ? await this.siaccountDetailRecessionListSum({ ...module }) : - await this.siaccountDetailBalanceListSum({ ...module }); + sysStatus && sysData === "1" ? await this.siaccountDetailBalanceListSum({ ...module }) : { data: { sumRow: {} } }; const { loading, pageInfo } = this.state; const billMonth = getQueryString("billMonth"); const paymentOrganization = getQueryString("paymentOrganization"); 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 018/142] =?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=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)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4 ze(nJRiw;=Qb^t(r^DT@T3y}a2XEZW-_W%Hszxj_qD**t_m!#tW0KDiJT&R>6OvVTR z07RgHDzHHZ48atvzz&?j9lXF70$~P3Knx_nJP<+#`N z#-MZ2bTkiLfR>_b(HgWKJ%F~Nr_oF3b#wrIijHG|(J>BYjM-sajE6;FiC7vY#};Gd zST$CUHDeuEH+B^pz@B062qXfFfD`NpUW5?BY=V%GM_5c)L#QR}BeW8_2v-S%gfYS= zB9o|3v?Y2H`NVi)In3rTB8+ej^> zQ=~r95NVuDChL%G$=>7$vVg20myx%S50Foi`^m%Pw-h?Xh~i8Mq9jtJloCocWk2Nv zrJpiFnV_ms&8eQ$2&#xWpIS+6pmtC%Q-`S&GF4Q#^mhymh7E(qNMa}%YZ-ePrx>>xFPTiH1=E+A$W$=bG8>s^ zm=Bn5Rah$aDtr}@$`X}2l~$F0mFKEdRdZE8)p@E5RI61Ft6o-prbbn>P~)iy)E2AN zsU20jsWz_8Qg>31P|s0cqrPALg8E|(vWA65poU1JRAaZs8I2(p#xiB`SVGovRs-uS zYnV-9TeA7=Om+qP8+I>yOjAR1s%ETak!GFdam@h^# z)@rS0t$wXH+Irf)+G6c;?H29p+V6F6oj{!|o%K3xI`?%6x;DB|x`n#ibhIR?(H}Q3Gzd138Ei2)WAMz7W9Vy`X}HnwgyEn!VS)>mv$8&{hQn>w4zwy3R}t;BYlZQm5)6pty=DfLrs+A-|>>;~;Q z_F?uV_HFjh9n2gO9o9Q^JA86v({H5aB!kjoO6 zc9$1ZZKsN-Zl8L~mE{`ly3)1N^`o1+o7}D0ZPeY&J;i;i`%NyJ8_8Y6J?}yE@b_5a zam?eLr<8@mESk|3$_SkmS{wQ>%qC18))9_|&j{ZT zes8AvOzF(F2#DZEY>2oYX&IRp`F#{ADl)1r>QS^)ba8a|EY_^#S^HO&t^Rgqwv=MZThqqEWH8 zxJo>d=ABlR_Bh=;eM9Tw|Ih34~oTE|= zX_mAr*D$vzw@+p(E0Yc6dFE}(8oqt`+R{gE3x4zjX+Sb3_cYE^= zgB=w+-tUy`ytONMS8KgRef4hA?t0j zufM;t32jm~jUGrkaOInTZ`zyfns>EuS}G30LFK_G-==(f<51|K&cocp&EJ`SxAh3? zNO>#LI=^+SEu(FqJ)ynt=!~PC9bO$rzPJB=?=j6w@a-(u02P7 zaQ)#(uUl{HW%tYNS3ItC^iAtK(eKlL`f9+{bJzISE?u8_z3;~C8@FyI-5j_jy7l;W z_U#vU3hqqYU3!mrul&B+{ptt$59)uk{;_4iZQ%G|z+lhASr6|H35TBkl>gI*;nGLU zN7W-nBaM%pA0HbH8olyl&XeJ%vZoWz%6?Y=dFykl=imL}`%BMQ{Mhgd`HRoLu6e2R za__6DuR6yg#~-}Tc|Gx_{H@O0eebyMy5GmWADJlpK>kqk(fVV@r_fLLKIeS?{4e)} z^ZO;zpECde03c&XQcVB=dL;k=fP(-4`Tqa_faw4Lbua(`>RI+y?e7jKeZ#YO-C z0vSm}K~#9!?A6Vy5>Xh(@vkrA3yO_%5JN$TY2~(6s}RI(TnK{ODvIF#0rdx5Xmf*B z(IRSD6hZ3?casYjW8@+^3>YS;S4-5=v@qy>?Jiim_cDwt) zD}0n`n&b(=UP7z$L$}kw_%S z=ko|5ZUSF{=i7kc)dOAEF--L`gLcq=fh^0S*XyZ6p65}o*XeXR>aES^bDGU2tyU|T zJ8HMvG#U+cD3wZ4E|=Fr(REKztyUwMO!|ikg#wjI1x?d7x})fyUfF83N;tgvm_`2* z?z>&vLH`t*&1L|$GURz4zz=0;GMNB;P=PtkloHFb`oJyV^VX2-y4bdjZQEaf>%jM|5^_47BBex1*#{1RXTaIU!RC1$wrwM& zw1LNqZ@5)L4h94I{k{!60-mf+?^?)pU8Iyaj&lOsUY**FcWr?@0BU}abI5U=!$mtv q+usEq1`#7KfS*A?CqV?;uK@s@d7jXCNDNs30000KLZ*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)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4 ze(nJRiw;=Qb^t(r^DT@T3y}a2XEZW-_W%Hszxj_qD**t_m!#tW0KDiJT&R>6OvVTR z07RgHDzHHZ48atvzz&?j9lXF70$~P3Knx_nJP<+#`N z#-MZ2bTkiLfR>_b(HgWKJ%F~Nr_oF3b#wrIijHG|(J>BYjM-sajE6;FiC7vY#};Gd zST$CUHDeuEH+B^pz@B062qXfFfD`NpUW5?BY=V%GM_5c)L#QR}BeW8_2v-S%gfYS= zB9o|3v?Y2H`NVi)In3rTB8+ej^> zQ=~r95NVuDChL%G$=>7$vVg20myx%S50Foi`^m%Pw-h?Xh~i8Mq9jtJloCocWk2Nv zrJpiFnV_ms&8eQ$2&#xWpIS+6pmtC%Q-`S&GF4Q#^mhymh7E(qNMa}%YZ-ePrx>>xFPTiH1=E+A$W$=bG8>s^ zm=Bn5Rah$aDtr}@$`X}2l~$F0mFKEdRdZE8)p@E5RI61Ft6o-prbbn>P~)iy)E2AN zsU20jsWz_8Qg>31P|s0cqrPALg8E|(vWA65poU1JRAaZs8I2(p#xiB`SVGovRs-uS zYnV-9TeA7=Om+qP8+I>yOjAR1s%ETak!GFdam@h^# z)@rS0t$wXH+Irf)+G6c;?H29p+V6F6oj{!|o%K3xI`?%6x;DB|x`n#ibhIR?(H}Q3Gzd138Ei2)WAMz7W9Vy`X}HnwgyEn!VS)>mv$8&{hQn>w4zwy3R}t;BYlZQm5)6pty=DfLrs+A-|>>;~;Q z_F?uV_HFjh9n2gO9o9Q^JA86v({H5aB!kjoO6 zc9$1ZZKsN-Zl8L~mE{`ly3)1N^`o1+o7}D0ZPeY&J;i;i`%NyJ8_8Y6J?}yE@b_5a zam?eLr<8@mESk|3$_SkmS{wQ>%qC18))9_|&j{ZT zes8AvOzF(F2#DZEY>2oYX&IRp`F#{ADl)1r>QS^)ba8a|EY_^#S^HO&t^Rgqwv=MZThqqEWH8 zxJo>d=ABlR_Bh=;eM9Tw|Ih34~oTE|= zX_mAr*D$vzw@+p(E0Yc6dFE}(8oqt`+R{gE3x4zjX+Sb3_cYE^= zgB=w+-tUy`ytONMS8KgRef4hA?t0j zufM;t32jm~jUGrkaOInTZ`zyfns>EuS}G30LFK_G-==(f<51|K&cocp&EJ`SxAh3? zNO>#LI=^+SEu(FqJ)ynt=!~PC9bO$rzPJB=?=j6w@a-(u02P7 zaQ)#(uUl{HW%tYNS3ItC^iAtK(eKlL`f9+{bJzISE?u8_z3;~C8@FyI-5j_jy7l;W z_U#vU3hqqYU3!mrul&B+{ptt$59)uk{;_4iZQ%G|z+lhASr6|H35TBkl>gI*;nGLU zN7W-nBaM%pA0HbH8olyl&XeJ%vZoWz%6?Y=dFykl=imL}`%BMQ{Mhgd`HRoLu6e2R za__6DuR6yg#~-}Tc|Gx_{H@O0eebyMy5GmWADJlpK>kqk(fVV@r_fLLKIeS?{4e)} z^ZO;zpECde03c&XQcVB=dL;k=fP(-4`Tqa_faw4Lbua(`>RI+y?e7jKeZ#YO-C z0v$<2K~#9!?A6bU5@8s?@vqv93S#5Dh{1pm)A*oX*f4wuPtInuhbPpn=^A4SS;DzBme3PR zatI;r0zZM*yMWR44Z|?7Z967}c(4Rt0#|m1)X%(86eyKSXqu+}YL;bDsZ>ZNlj_fJnkMCP zIh=$H<&XA7yN5Q!d_D(olp){u0sbgMlgR|&i!wAA3;;eTL9XjE8jZdIr-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 ( +
+
+ +