diff --git a/pc4mobx/hrmSalary/apis/calculate.js b/pc4mobx/hrmSalary/apis/calculate.js index e44dfc25..013bddee 100644 --- a/pc4mobx/hrmSalary/apis/calculate.js +++ b/pc4mobx/hrmSalary/apis/calculate.js @@ -520,6 +520,39 @@ export const siaccountDetailCommonListSum = (params) => { body: JSON.stringify(params) }).then(res => res.json()); }; +// 社保福利台账补缴合计接口 +export const siaccountDetailSupplementaryListSum = (params) => { + return fetch("/api/bs/hrmsalary/siaccount/detail/supplementary/list/sum", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; +// 社保福利台账退差合计接口 +export const siaccountDetailRecessionListSum = (params) => { + return fetch("/api/bs/hrmsalary/siaccount/detail/recession/list/sum", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; +// 社保福利台账补差合计接口 +export const siaccountDetailBalanceListSum = (params) => { + return fetch("/api/bs/hrmsalary/siaccount/detail/balance/list/sum", { + method: "POST", + mode: "cors", + headers: { + "Content-Type": "application/json" + }, + body: JSON.stringify(params) + }).then(res => res.json()); +}; // 导入薪资核算添加表头字段缓存 export const cacheImportField = (params) => { return fetch("/api/bs/hrmsalary/salaryacct/acctresult/cacheImportField", { diff --git a/pc4mobx/hrmSalary/apis/ruleconfig.js b/pc4mobx/hrmSalary/apis/ruleconfig.js index 2e5967fc..b0639647 100644 --- a/pc4mobx/hrmSalary/apis/ruleconfig.js +++ b/pc4mobx/hrmSalary/apis/ruleconfig.js @@ -43,3 +43,11 @@ export const getEncryptProgress = params => { export const operateTaxDeclarationFunction = (params) => { return postFetch('/api/bs/hrmsalary/sys/operateTaxDeclarationFunction', params); } +//保存薪酬统计报表 +export const reportStatisticsReportSave = (params) => { + return postFetch('/api/bs/hrmsalary/report/statistics/report/save', params); +} +//薪酬统计维度下拉列表 +export const reportGetForm = params => { + return WeaTools.callApi('/api/bs/hrmsalary/report/statistics/report/getForm', 'GET', params); +} diff --git a/pc4mobx/hrmSalary/apis/statistics.js b/pc4mobx/hrmSalary/apis/statistics.js new file mode 100644 index 00000000..767d8c7e --- /dev/null +++ b/pc4mobx/hrmSalary/apis/statistics.js @@ -0,0 +1,56 @@ +import { WeaTools } from "ecCom"; +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); +}; +// 薪酬统计维度列表 +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); +}; + +//保存薪酬统计报表 +export const reportStatisticsReportList = (params) => { + return postFetch("/api/bs/hrmsalary/report/statistics/report/list", params); +}; +//删除薪酬统计报表 +export const reportStatisticsReportDelete = (params) => { + return postFetch("/api/bs/hrmsalary/report/statistics/report/delete", 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); +}; +//保存数据范围及负责设置 +export const reportStatisticsSaveSearchCondition = (params) => { + return postFetch("/api/bs/hrmsalary/report/statistics/report/saveSearchCondition", params); +}; +//删除自定义统计项目 +export const reportStatisticsItemDelete = (params) => { + return postFetch("/api/bs/hrmsalary/report/statistics/item/delete", params); +}; +//获取薪酬统计报表查询条件 +export const reportStatisticsGetSearchCondition = (params) => { + return WeaTools.callApi("/api/bs/hrmsalary/report/statistics/report/getSearchCondition", "GET", params); +}; diff --git a/pc4mobx/hrmSalary/common/leftTree-hide.png b/pc4mobx/hrmSalary/common/leftTree-hide.png new file mode 100644 index 00000000..0a1cadfc Binary files /dev/null and b/pc4mobx/hrmSalary/common/leftTree-hide.png differ diff --git a/pc4mobx/hrmSalary/common/leftTree-show.png b/pc4mobx/hrmSalary/common/leftTree-show.png new file mode 100644 index 00000000..cc791aad Binary files /dev/null and b/pc4mobx/hrmSalary/common/leftTree-show.png differ diff --git a/pc4mobx/hrmSalary/index.js b/pc4mobx/hrmSalary/index.js index 64a4f803..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 EquationEditor from "./pages/equationEditor"; +import AnalysisOfSalaryStatistics from "./pages/analysisOfSalaryStatistics"; +import ReportView from "./pages/reportView"; import stores from "./stores"; import "./style/index"; @@ -79,6 +80,8 @@ const DataAcquisition = (props) => props.children; // sysconfig-1 规则配置 // appconfig 应用配置 // fieldManagement 字段管理 +// analysisOfSalaryStatistics 薪酬统计分析 +// reportView 薪酬报表查看 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..a622aefb --- /dev/null +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/conditions.js @@ -0,0 +1,101 @@ +import { WeaLocaleProvider } from "ecCom"; + +const { getLabel } = WeaLocaleProvider; +export const condition = [ + { + items: [ + { + colSpan: 1, + checkbox: false, + checkboxValue: false, + conditionType: "SELECT", + domkey: ["dimType"], + fieldcol: 14, + label: getLabel(111, "维度类型"), + labelcol: 6, + options: [], + detailtype: 3, + rules: "required|string", + viewAttr: 3 + }, + { + colSpan: 1, + conditionType: "SELECT", + domkey: ["setting4Qualitative"], + fieldcol: 14, + label: getLabel(111, "统计维度"), + labelcol: 6, + options: [], + rules: "required|string", + viewAttr: 3 + }, + { + colSpan: 1, + conditionType: "INPUT", + domkey: ["dimName"], + fieldcol: 14, + label: getLabel(111, "统计维度名称"), + labelcol: 6, + value: "", + rules: "required|string", + viewAttr: 3 + }, + { + colSpan: 1, + conditionType: "SELECT", + domkey: ["dimCode"], + fieldcol: 14, + label: getLabel(111, "分组所属字段"), + labelcol: 6, + options: [], + viewAttr: 2, + helpfulTip: "", + hide: true + }, + { + colSpan: 1, + conditionType: "TEXTAREA", + domkey: ["remark"], + fieldcol: 14, + label: getLabel(111, "描述"), + labelcol: 6, + value: "", + viewAttr: 2 + } + ], + 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: [], + rules: "required|string", + viewAttr: 3, + helpfulTip: "", + hide: true + } + ], + 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..b7bd9c2e --- /dev/null +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionSlide.js @@ -0,0 +1,205 @@ +/* + * Author: 黎永顺 + * name: 新增统计维度弹框 + * Description: + * Date: 2023/4/11 + */ +import React, { Component } from "react"; +import { WeaDialog, WeaLocaleProvider, 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 { getLabel } = WeaLocaleProvider; +const keyObj = { + "RATION_GROUP_SPACING": "setting4RationGroupSpacing", + "RATION_GROUP_INDIVIDUAL": "setting4RationGroupIndividual" +}; + +class DimensionSlide extends Component { + constructor(props) { + super(props); + this.state = { + loading: false, + dimType: "QUALITATIVE", + setting4RationGroupSpacing: [], + setting4RationGroupIndividual: [] + }; + } + + componentDidMount() { + this.props.initCondition(); + } + + componentWillReceiveProps(nextProps, nextContext) { + 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"); + } + 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 setting = formData.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; + const { setting4Qualitative, dimCode, ...extraParams } = this.props.form.getFormParams(); + let payload = { id: formId, ...extraParams }; + if (dimType === "QUALITATIVE") { + if (!setting4Qualitative || !extraParams.dimName) { + Modal.warning({ + title: getLabel(111, "信息确认"), + content: getLabel(111, "必要信息不完整,红色*为必填项!") + }); + return; + } + 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: getLabel(111, "信息确认"), + content: getLabel(111, "必要信息不完整,红色*为必填项!") + }); + 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(getLabel(111, "请完善分组设置相关数据!分组设置不能为空,起始值结束值必填,且起始值需小于结束值!")); + 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(getLabel(111, "请完善分组设置相关数据!分组设置不能为空,且数值必填")); + 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(getLabel(111, "保存成功")); + onCancel(true); + this.props.form.resetForm(); + } else { + message.error(errormsg || getLabel(111, "保存失败")); + } + }).catch(() => this.setState({ loading: false })); + }; + formItemChange = (formObj) => { + const { onChangeCondition } = this.props; + const filedKey = _.keys(formObj)[0]; + 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, dimType, setting4RationGroupSpacing, setting4RationGroupIndividual } = this.state; + const { form, condition, formId } = this.props; + return ( + + {formId ? getLabel(111, "编辑统计维度") : getLabel(111, "新建统计维度")} + + + } + > + {getSearchs(form, condition, 1, false, this.formItemChange)} + { + dimType !== "QUALITATIVE" && + + { + dimType === "RATION_GROUP_SPACING" && + + } + { + dimType === "RATION_GROUP_INDIVIDUAL" && + + } + + } + + ); + } +} + +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..fb5a4cb1 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/dimensionTable.js @@ -0,0 +1,115 @@ +/* + * Author: 黎永顺 + * name: 统计维度管理列表 + * Description: + * Date: 2023/4/11 + */ +import React, { Component } from "react"; +import { WeaLocaleProvider, WeaTable } from "ecCom"; +import { message, Modal } from "antd"; +import { dimensionDelete, dimensionList } from "../../../apis/statistics"; +import "../index.less"; + +const { getLabel } = WeaLocaleProvider; + +class DimensionTable extends Component { + constructor(props) { + super(props); + this.state = { + loading: false, + dataSource: [], + pageInfo: { + current: 1, 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: current, pageSize, total, list: dataSource } = data; + this.setState({ + dataSource, + pageInfo: { + ...pageInfo, + current, pageSize, total + } + }); + } + }).catch(() => this.setState({ loading: false })); + }; + dimensionDelete = (payload) => { + Modal.confirm({ + title: getLabel(111, "信息确认"), + content: getLabel(111, "确认要删除吗?"), + onOk: () => { + dimensionDelete(payload).then(({ status, errormsg }) => { + if (status) { + message.success(getLabel(111, "删除成功")); + this.dimensionList(); + } else { + message.error(errormsg || getLabel(111, "删除失败")); + } + }); + } + }); + }; + + render() { + const { dataSource, loading, pageInfo } = this.state; + const { onEdit } = this.props; + const pagination = { + ...pageInfo, + showTotal: total => `${getLabel(111, "共")} ${total} ${getLabel(111, "条")}`, + 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: getLabel(111, "统计维度") }, + { dataIndex: "remark", title: getLabel(111, "描述") }, + { dataIndex: "dimType", title: getLabel(111, "维度类型") }, + { + dataIndex: "operate", title: getLabel(111, "操作"), + render: (_, record) => { + return ( + + onEdit(record.id)}>{getLabel(111, "编辑")} + this.dimensionDelete([record.id])}>{getLabel(111, "删除")} + + ); + } + } + ]; + return ( + + ); + } +} + +export default DimensionTable; diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/groupIndividualEditTable.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/groupIndividualEditTable.js new file mode 100644 index 00000000..1d709bc6 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/groupIndividualEditTable.js @@ -0,0 +1,52 @@ +/* + * Author: 黎永顺 + * name: 分组设置-定量-单项式分组编辑表格 + * Description: + * Date: 2023/4/12 + */ +import React, { Component } from "react"; +import { WeaLocaleProvider, WeaTableEdit } from "ecCom"; + +const { getLabel } = WeaLocaleProvider; +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: getLabel(111, "分组设置值"), + 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..c976cd93 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/groupSpacingEditTable.js @@ -0,0 +1,100 @@ +/* + * Author: 黎永顺 + * name: 分组设置-定量-组距式分组编辑表格 + * Description: + * Date: 2023/4/12 + */ +import React, { Component } from "react"; +import { WeaLocaleProvider, WeaTableEdit } from "ecCom"; + +const { getLabel } = WeaLocaleProvider; + +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: getLabel(111, "起始值"), + dataIndex: "startValue", + key: "startValue", + com: [ + { label: "", key: "startValue", type: "INPUTNUMBER" } + ] + }, + { + title: getLabel(111, "含"), + dataIndex: "includeStart", + key: "includeStart", + com: [ + { + type: "CHECKBOX", + key: "includeStart", + otherParams: { content: getLabel(111, "含") } + } + ] + }, + { + title: getLabel(111, "至"), + dataIndex: "to", + key: "to", + com: [ + { label: "", type: "TEXT" } + ] + }, + { + title: getLabel(111, "结束值"), + dataIndex: "endValue", + key: "endValue", + com: [ + { label: "", key: "endValue", type: "INPUTNUMBER" } + ] + }, + { + title: getLabel(111, "含"), + dataIndex: "includeEnd", + key: "includeEnd", + com: [ + { + type: "CHECKBOX", + key: "includeEnd", + otherParams: { content: getLabel(111, "含") } + } + ] + } + ]; + return ( + ({ ...item, to: getLabel(111, "至") }))} + showCopy={false} onChange={this.handleChangeTableData} + /> + ); + } +} + +export default GroupSpacingEditTable; 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..6510d5b1 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/reportList.js @@ -0,0 +1,106 @@ +/* + * Author: 黎永顺 + * name: 统计表 + * Description: + * Date: 2023/4/17 + */ +import React, { Component } from "react"; +import { WeaLocaleProvider } from "ecCom"; +import { Button, Col, Dropdown, Menu, message, Modal, Row } from "antd"; +import { reportStatisticsReportDelete, reportStatisticsReportList } from "../../../apis/statistics"; +import "../index.less"; + +const SubMenu = Menu.SubMenu; +const { getLabel } = WeaLocaleProvider; + +class ReportList extends Component { + constructor(props) { + super(props); + this.state = { + dataSource: [] + }; + } + + componentDidMount() { + this.reportStatisticsReportList(); + } + + handleOptsClick = ({ key }, id, dimensionId) => { + if (key === "delete") { + this.reportStatisticsReportDelete(id.split(",")); + } else if (key === "edit") { + this.props.onEdit("addReport", id); + } + }; + reportStatisticsReportDelete = (payload) => { + Modal.confirm({ + title: getLabel(111, "信息确认"), + content: getLabel(111, "确认删除本条数据吗?"), + onOk: () => { + const { reportName = "" } = this.props; + reportStatisticsReportDelete(payload).then(({ status, errormsg }) => { + if (status) { + message.success(getLabel(111, "删除成功")); + this.reportStatisticsReportList({ reportName }); + } else { + message.error(errormsg || getLabel(111, "删除失败")); + } + }); + } + }); + }; + reportStatisticsReportList = (payload = {}) => { + reportStatisticsReportList(payload).then(({ status, data: dataSource }) => { + if (status) { + this.setState({ dataSource }); + } + }); + }; + /* + * 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; + return ( + + { + _.isEmpty(dataSource) ?
{getLabel(111, "暂无数据")}
: + _.map(dataSource, it => { + const { reportName, dimension, id, dimensionId } = it; + return this.handleGoReportView(id)}> +
+
+
+ {reportName} +
+
{getLabel(111, "统计维度")}:
+
{dimension}
+
+
+
+ this.handleOptsClick(e, id, dimensionId)}> + {getLabel(111, "编辑")} + {getLabel(111, "删除")} + + }> + + +
+
+ ; + }) + } +
+ ); + } +} + +export default ReportList; diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/statisticsModal.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/statisticsModal.js new file mode 100644 index 00000000..c8920887 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/statisticsModal.js @@ -0,0 +1,70 @@ +/* + * Author: 黎永顺 + * name: 统计弹框 + * Description: + * Date: 2023/4/10 + */ +import React, { Component } from "react"; +import { Button, message, Modal } from "antd"; +import { WeaDialog, WeaLocaleProvider } from "ecCom"; +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 ( + + {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..5fc4c40b --- /dev/null +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.js @@ -0,0 +1,296 @@ +/* + * Author: 黎永顺 + * name: 薪酬统计分析 + * Description: + * Date: 2023/4/10 + */ +import React, { Component } from "react"; +import { inject, observer } from "mobx-react"; +import { WeaInputSearch, WeaLocaleProvider, WeaReqTop } from "ecCom"; +import { Button } from "antd"; +import { condition, reportCondition } from "./components/conditions"; +import { commonEnumList, reportGetForm } from "../../apis/ruleconfig"; +import { dimensionGetForm } from "../../apis/statistics"; +import StatisticsModal from "./components/statisticsModal"; +import DimensionSlide from "./components/dimensionSlide"; +import DimensionTable from "./components/dimensionTable"; +import ReportList from "./components/reportList"; +import ReportForm from "./components/reportForm"; +import "./index.less"; + +const { getLabel } = WeaLocaleProvider; + +@inject("taxAgentStore", "attendanceStore") +@observer +class Index extends Component { + constructor(props) { + super(props); + this.state = { + conditions: [], + convertConditions: [], + reportConditions: [], + selectedKey: "statistics", + reportName: "", + slideReq: { + visible: false, formId: "" + }, + modalReq: { + title: "", visible: false, + typeKey: "", id: "" + } + }; + } + + componentDidMount() { + this.initReportFormCondition(); + } + + initReportFormCondition = (payload = {}) => { + const { attendanceStore: { reportForm } } = this.props; + reportGetForm(payload).then(({ status, data }) => { + if (status) { + 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(",") + }); + } + } + }); + }; + initCondition = async () => { + 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 } } = this.props; + 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 }; + }) + }; + }) + }, () => { + statisticsForm.setCondition(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 }; + }) + }; + }) + }, () => { + statisticsForm.setCondition(this.state.conditions); + }); + } + }; + handleReqBtnsClick = (key, id = "") => { + if (key === "search") { + const { reportName } = this.state; + this.reportListRef.reportStatisticsReportList({ reportName }); + } else { + const { modalReq } = this.state; + const title = key === "dimension" ? +
+ {getLabel(111, "统计维度管理")} + +
+ : getLabel(111, id ? "编辑报表" : "新建报表"); + this.setState({ + modalReq: { + ...modalReq, id, title, + visible: true, typeKey: key + } + }, () => id && this.initReportFormCondition({ id })); + } + }; + handleCancel = (refresh = false) => { + const { attendanceStore: { reportForm } } = this.props; + const { modalReq } = this.state; + this.setState({ + modalReq: { + ...modalReq, visible: false, id: "" + } + }, () => { + const { selectedKey, reportName } = this.state; + selectedKey === "statistics" && reportForm.resetForm(); + refresh && selectedKey === "statistics" && this.reportListRef.reportStatisticsReportList({ reportName }); + }); + }; + handleAddDimension = (formId = "") => { + const { slideReq } = this.state; + this.setState({ + slideReq: { + ...slideReq, visible: true, + formId + } + }); + }; + handleClose = (initTable = false) => { + const { attendanceStore: { statisticsForm } } = this.props; + const { slideReq } = this.state; + this.setState({ + slideReq: { + ...slideReq, visible: false, formId: "" + } + }, () => { + statisticsForm.resetForm(); + initTable && this.dimensionTableRef.dimensionList(); + }); + }; + + render() { + const { taxAgentStore: { statisticsReportBtn }, attendanceStore: { statisticsForm, reportForm } } = this.props; + const { selectedKey, modalReq, slideReq, conditions, reportConditions, reportName } = this.state; + const buttons = [ + , + , + this.setState({ reportName })} + onSearch={() => this.handleReqBtnsClick("search")}/> + ]; + const tabs = [ + { key: "statistics", title: getLabel(111, "统计表") } + // { key: "detail", title: getLabel(111, "员工明细") } + ]; + return ( + } + iconBgcolor="#F14A2D" buttons={!statisticsReportBtn ? buttons.slice(-1) : buttons} buttonSpace={10} + showDropIcon={false} tabDatas={tabs} className="xc_tj_fx_wrapper" + selectedKey={selectedKey} + onChange={selectedKey => this.setState({ selectedKey }, () => this.state.selectedKey === "statistics" && this.initReportFormCondition())} + > + { + this.state.selectedKey === "statistics" && + this.reportListRef = dom} + reportName={reportName} + onEdit={this.handleReqBtnsClick} + /> + } + + { + modalReq.typeKey === "dimension" && + this.dimensionTableRef = dom} + onEdit={id => this.handleAddDimension(id)} + /> + } + { + modalReq.typeKey === "addReport" && + + } + + + + ); + } +} + +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..97860916 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less @@ -0,0 +1,141 @@ +.xc_tj_fx_wrapper { + .search { + top: -3px; + margin-right: 10px; + width: 220px; + } + + .wea-new-top-req-content { + background: #FFF; + + .reportRow { + padding: 16px; + + .gutter-row { + margin-bottom: 16px; + border-radius: 6px; + + .card-item { + border-radius: 6px; + display: flex; + height: 90px; + justify-content: space-between; + padding: 22px 0 22px 16px; + border: 1px solid #e5e5e5; + + .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; + } + } + } + } + + .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 { + width: 100%; + display: flex; + align-items: center; + justify-content: space-between; + } + + .dimensionTableWrapper { + .space10 { + a:first-child { + margin-right: 10px; + } + } + } + +} + +.dimensionSlideWrapper, .dimensionModalWrapper { + .wea-search-group { + .wea-select, .ant-select, .ant-select-selection { + width: 100%; + } + } +} diff --git a/pc4mobx/hrmSalary/pages/calculateDetail/acctResult/importModal/selectFieldModal.js b/pc4mobx/hrmSalary/pages/calculateDetail/acctResult/importModal/selectFieldModal.js index bacbe74c..f288cc35 100644 --- a/pc4mobx/hrmSalary/pages/calculateDetail/acctResult/importModal/selectFieldModal.js +++ b/pc4mobx/hrmSalary/pages/calculateDetail/acctResult/importModal/selectFieldModal.js @@ -109,7 +109,10 @@ export default class SelectFieldModal extends React.Component { // 添加按钮点击回调 handleAddClick = async () => { - const { status } = await this.cacheImportField(); + //薪资核算详情页面的导入表单字段缓存功能 + if (window.location.hash.indexOf("calculateDetail") !== -1) { + const { status } = await this.cacheImportField(); + } this.props.onAdd(this.fieldData); this.props.onCancel(); }; 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/calculateDetail/index.js b/pc4mobx/hrmSalary/pages/calculateDetail/index.js index 668a798e..f0cf2f8d 100644 --- a/pc4mobx/hrmSalary/pages/calculateDetail/index.js +++ b/pc4mobx/hrmSalary/pages/calculateDetail/index.js @@ -4,7 +4,7 @@ import { inject, observer } from "mobx-react"; import SalaryDetail from "./salaryDetail"; import { Button, Dropdown, Menu, message, Modal } from "antd"; import { WeaBrowser, WeaCheckbox, WeaDropdown, WeaFormItem, WeaInput, WeaSearchGroup, WeaSelect, WeaTab } from "ecCom"; -import { getQueryString } from "../../util/url"; +import { convertToUrlString, getQueryString } from "../../util/url"; import AcctResultImportModal from "./acctResult/importModal/acctResultImportModal"; import ProgressModal from "../../components/progressModal"; @@ -172,7 +172,7 @@ export default class CalculateDetail extends React.Component { url: "/api/bs/hrmsalary/salaryacct/acctresult/list", selectedRowKeys: [], queryParams: { - salaryAcctRecordId, + salaryAcctRecordId } }; childFrameObj.contentWindow.postMessage(JSON.stringify(payload), "*"); @@ -208,8 +208,11 @@ export default class CalculateDetail extends React.Component { this.id ); } else if (e.key == "3") { + const { searchItemsValue } = this.state; + const { consolidatedTaxation, ...extra } = searchItemsValue; + const payload = { ...extra, consolidatedTaxation: consolidatedTaxation === "0" ? "" : consolidatedTaxation }; window.open( - "/api/bs/hrmsalary/salaryacct/acctresult/export?salaryAcctRecordId=" + this.id + "&ids=" + `/api/bs/hrmsalary/salaryacct/acctresult/export?salaryAcctRecordId=${this.id}&ids=&${convertToUrlString(payload)}` ); } }; 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/dataAcquisition/cumDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js index 731b6cc9..0e106ae3 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumDeduct/index.js @@ -19,6 +19,7 @@ import ImportFormCom from "./components/importFormCom"; import TableRecord from "../components/tableRecord"; import { dataCollectCondition, modalColumns } from "./columns"; import { removePropertyCondition } from "../../../util/response"; +import { convertToUrlString } from "../../../util/url"; import Layout from "../layout"; import moment from "moment"; @@ -52,6 +53,7 @@ class Index extends Component { slideDataSource: [] }, exportPayloadUrl: "", + exportPayloadType: false, advanceCondition: null }; this.tableRef = null; @@ -160,9 +162,11 @@ class Index extends Component { * Date: 2023/2/20 */ handleExportAll = () => { - const { declareMonth, taxAgentId } = this.state; + const { cumDeductStore: { form } } = this.props; + const { declareMonth, taxAgentId, exportPayloadType } = this.state; this.setState({ - exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/addUpDeduction/export?ids=&declareMonth=${declareMonth}&taxAgentId=${taxAgentId}` + exportPayloadType: !exportPayloadType, + exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/addUpDeduction/export?ids=&declareMonth=${declareMonth}&taxAgentId=${taxAgentId}&${convertToUrlString(form.getFormParams())}` }); }; /* @@ -173,12 +177,13 @@ class Index extends Component { */ handleExportSelect = () => { const { selectedRowKeys: ids } = this.tableRef.state; - const { declareMonth, taxAgentId } = this.state; + const { declareMonth, taxAgentId, exportPayloadType } = this.state; if (ids.length === 0) { message.warning("请选择需要导出的数据"); return; } this.setState({ + exportPayloadType: !exportPayloadType, exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/addUpDeduction/export?ids=${ids.join(",")}&declareMonth=${declareMonth}&taxAgentId=${taxAgentId}` }); }; @@ -497,7 +502,7 @@ class Index extends Component { const { taxAgentStore: { showOperateBtn }, cumDeductStore: { form } } = this.props; const { declareMonth, taxAgentId, slidePayload, saveLoading, exportPayloadUrl, advanceCondition, - importPayload + importPayload, exportPayloadType } = this.state; const tablePayload = { declareMonth: [declareMonth], taxAgentId }; return ( @@ -505,6 +510,7 @@ class Index extends Component { onResizeWindowInnerWidth={this.handleResize} slidePayload={slidePayload} onClose={this.handleCloseSlide} onSave={this.handleSaveData} slideLoading={saveLoading} exportPayloadUrl={exportPayloadUrl} + exportPayloadType={exportPayloadType} form={form} condition={advanceCondition} onAdSearch={this.handleAdSearch} onImportSetStep={this.handleImportSetStep} onCancel={this.handleCloseImport} importPayload={importPayload} onImportFile={this.handleImportFile} diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js index ef5e134b..78c77a40 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/cumSituation/index.js @@ -28,6 +28,7 @@ import { dataCollectCondition, taxOptions } from "./columns"; import AddItems from "../addItems"; import TableRecord from "../components/tableRecord"; import { situationModalColumns } from "../cumDeduct/columns"; +import { convertToUrlString } from "../../../util/url"; @inject("taxAgentStore", "cumSituationStore") @observer @@ -59,6 +60,7 @@ class Index extends Component { slideDataSource: [] }, exportPayloadUrl: "", + exportPayloadType: false, advanceCondition: null }; this.tableRef = null; @@ -277,9 +279,11 @@ class Index extends Component { * Date: 2023/2/20 */ handleExportAll = () => { - const { declareMonth, taxAgentId, year } = this.state; + const { cumSituationStore: { form } } = this.props; + const { declareMonth, taxAgentId, year, exportPayloadType } = this.state; this.setState({ - exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/addUpSituation/export?ids=&year=${year}&taxYearMonth=${year}-${declareMonth}&taxAgentId=${taxAgentId}` + exportPayloadType: !exportPayloadType, + exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/addUpSituation/export?ids=&year=${year}&taxYearMonth=${year}-${declareMonth}&taxAgentId=${taxAgentId}&${convertToUrlString(form.getFormParams())}` }); }; /* @@ -290,12 +294,13 @@ class Index extends Component { */ handleExportSelect = () => { const { selectedRowKeys: ids } = this.tableRef.state; - const { declareMonth, taxAgentId, year } = this.state; + const { declareMonth, taxAgentId, year, exportPayloadType } = this.state; if (ids.length === 0) { message.warning("请选择需要导出的数据"); return; } this.setState({ + exportPayloadType: !exportPayloadType, exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/addUpSituation/export?ids=${ids.join(",")}&year=${year}&taxYearMonth=${year}-${declareMonth}&taxAgentId=${taxAgentId}` }); }; @@ -511,7 +516,7 @@ class Index extends Component { const { taxAgentStore: { showOperateBtn }, cumSituationStore: { form } } = this.props; const { declareMonth, taxAgentId, slidePayload, saveLoading, exportPayloadUrl, advanceCondition, - importPayload, year + importPayload, year, exportPayloadType } = this.state; const tablePayload = { taxYearMonth: `${year}-${declareMonth}`, year, taxAgentId }; return ( @@ -519,6 +524,7 @@ class Index extends Component { onResizeWindowInnerWidth={this.handleResize} slidePayload={slidePayload} onClose={this.handleCloseSlide} onSave={this.handleSaveData} slideLoading={saveLoading} exportPayloadUrl={exportPayloadUrl} + exportPayloadType={exportPayloadType} form={form} condition={advanceCondition} onAdSearch={this.handleAdSearch} onImportSetStep={this.handleImportSetStep} onCancel={this.handleCloseImport} importPayload={{ ...importPayload, importOpts: { taxYearMonth: importPayload.importOpts.declareMonth } }} diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js b/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js index 8bc29bd1..579cb872 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/dataTables.js @@ -154,7 +154,7 @@ class DataTables extends Component { dataSource={dataSource} pagination={pagination} loading={loading.query} - xWidth={getColumns.length * 120} + xWidth={getColumns.length * 150} />; } } diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/layout.js b/pc4mobx/hrmSalary/pages/dataAcquisition/layout.js index ed2969e8..631d0586 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/layout.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/layout.js @@ -30,7 +30,7 @@ class Layout extends Component { } componentWillReceiveProps(nextProps, nextContext) { - if (nextProps.exportPayloadUrl !== this.props.exportPayloadUrl) { + if (nextProps.exportPayloadType !== this.props.exportPayloadType) { /* * Author: 黎永顺 * Description:导出数据采集数据 diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/columns.js b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/columns.js index cb2efd8f..6f542381 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/columns.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/columns.js @@ -103,6 +103,15 @@ export const dataCollectCondition = [ labelcol: 8, value: "", viewAttr: 2 + }, + { + conditionType: "INPUT", + domkey: ["privatePension"], + fieldcol: 14, + label: "个人养老金", + labelcol: 8, + value: "", + viewAttr: 2 } ], title: "数据采集", diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js index caa24c1f..5e5aec09 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/otherDeduct/index.js @@ -29,6 +29,7 @@ import { dataCollectCondition } from "./columns"; import AddItems from "../addItems"; import TableRecord from "../components/tableRecord"; import { otherModalColumns } from "../cumDeduct/columns"; +import { convertToUrlString } from "../../../util/url"; @inject("taxAgentStore", "otherDeductStore") @observer @@ -59,6 +60,7 @@ class Index extends Component { slideDataSource: [] }, exportPayloadUrl: "", + exportPayloadType: false, advanceCondition: null }; this.tableRef = null; @@ -250,9 +252,11 @@ class Index extends Component { * Date: 2023/2/20 */ handleExportAll = () => { - const { declareMonth, taxAgentId } = this.state; + const { otherDeductStore: { form } } = this.props; + const { declareMonth, taxAgentId, exportPayloadType } = this.state; this.setState({ - exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/otherDeduction/export?ids=&declareMonth=${declareMonth}&taxAgentId=${taxAgentId}` + exportPayloadType: !exportPayloadType, + exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/otherDeduction/export?ids=&declareMonth=${declareMonth}&taxAgentId=${taxAgentId}&${convertToUrlString(form.getFormParams())}` }); }; /* @@ -263,12 +267,13 @@ class Index extends Component { */ handleExportSelect = () => { const { selectedRowKeys: ids } = this.tableRef.state; - const { declareMonth, taxAgentId } = this.state; + const { declareMonth, taxAgentId, exportPayloadType } = this.state; if (ids.length === 0) { message.warning("请选择需要导出的数据"); return; } this.setState({ + exportPayloadType: !exportPayloadType, exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/otherDeduction/export?ids=${ids.join(",")}&declareMonth=${declareMonth}&taxAgentId=${taxAgentId}` }); }; @@ -504,7 +509,7 @@ class Index extends Component { const { taxAgentStore: { showOperateBtn }, otherDeductStore: { form } } = this.props; const { declareMonth, taxAgentId, slidePayload, saveLoading, exportPayloadUrl, advanceCondition, - importPayload + importPayload, exportPayloadType } = this.state; const tablePayload = { declareMonth: [declareMonth], taxAgentId }; return ( @@ -512,6 +517,7 @@ class Index extends Component { onResizeWindowInnerWidth={this.handleResize} slidePayload={slidePayload} onClose={this.handleCloseSlide} onSave={this.handleSaveData} slideLoading={saveLoading} exportPayloadUrl={exportPayloadUrl} + exportPayloadType={exportPayloadType} form={form} condition={advanceCondition} onAdSearch={this.handleAdSearch} onImportSetStep={this.handleImportSetStep} onCancel={this.handleCloseImport} importPayload={importPayload} onImportFile={this.handleImportFile} diff --git a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js index 2629381c..5ea6f81c 100644 --- a/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js +++ b/pc4mobx/hrmSalary/pages/dataAcquisition/specialAddDeduction/index.js @@ -21,6 +21,7 @@ import { condition } from "./components/condition"; import AddItems from "../addItems"; import TableRecord from "../components/tableRecord"; import { specialModalColumns } from "../cumDeduct/columns"; +import { convertToUrlString } from "../../../util/url"; @inject("taxAgentStore", "specialAddStore") @observer @@ -49,6 +50,7 @@ class Index extends Component { slideDataSource: [] }, exportPayloadUrl: "", + exportPayloadType: false, advanceCondition: null }; this.tableRef = null; @@ -207,9 +209,11 @@ class Index extends Component { * Date: 2023/2/20 */ handleExportAll = () => { - const { taxAgentId } = this.state; + const { specialAddStore: { advanceForm } } = this.props; + const { taxAgentId, exportPayloadType } = this.state; this.setState({ - exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/specialAddDeduction/export?ids=&taxAgentId=${taxAgentId}` + exportPayloadType: !exportPayloadType, + exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/specialAddDeduction/export?ids=&taxAgentId=${taxAgentId}&${convertToUrlString(advanceForm.getFormParams())}` }); }; /* @@ -220,12 +224,13 @@ class Index extends Component { */ handleExportSelect = () => { const { selectedRowKeys: ids } = this.tableRef.state; - const { taxAgentId } = this.state; + const { taxAgentId, exportPayloadType } = this.state; if (ids.length === 0) { message.warning("请选择需要导出的数据"); return; } this.setState({ + exportPayloadType: !exportPayloadType, exportPayloadUrl: `${window.location.origin}/api/bs/hrmsalary/specialAddDeduction/export?ids=${ids.join(",")}&taxAgentId=${taxAgentId}` }); }; @@ -414,7 +419,8 @@ class Index extends Component { render() { const { taxAgentStore: { showOperateBtn }, specialAddStore: { advanceForm } } = this.props; const { - taxAgentId, slidePayload, saveLoading, exportPayloadUrl, advanceCondition, importPayload + taxAgentId, slidePayload, saveLoading, exportPayloadUrl, advanceCondition, importPayload, + exportPayloadType } = this.state; const tablePayload = { taxAgentId }; return ( @@ -422,6 +428,7 @@ class Index extends Component { onResizeWindowInnerWidth={this.handleResize} slidePayload={slidePayload} onClose={this.handleCloseSlide} onSave={this.handleSaveData} slideLoading={saveLoading} exportPayloadUrl={exportPayloadUrl} + exportPayloadType={exportPayloadType} form={advanceForm} condition={advanceCondition} onAdSearch={this.handleAdSearch} onImportSetStep={this.handleImportSetStep} onCancel={this.handleCloseImport} importPayload={importPayload} onImportFile={this.handleImportFile} diff --git a/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js b/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js index 9e4370ca..2d40f912 100644 --- a/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js +++ b/pc4mobx/hrmSalary/pages/fieldManagement/components/fieldSlide.js @@ -232,17 +232,17 @@ class FieldSlide extends Component { {/* />*/} {/* */} {/*}*/} - - this.handleChangeFields("useDefault", value)} - /> - - + {/**/} + {/* this.handleChangeFields("useDefault", value)}*/} + {/* />*/} + {/* */} + {/**/} { 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/pages/ledgerPage/components/ledgerSalaryItem.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItem.js index 736867cf..abcf4aa1 100644 --- a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItem.js +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItem.js @@ -301,10 +301,10 @@ class LedgerSalaryItem extends Component { * Params: * Date: 2023/3/8 */ - handleMoveSalaryItem = (moveToItemId, items) => { + handleMoveSalaryItem = (moveToItemId, items, titleName) => { const { itemGroups } = this.state; const { salaryItemGroupId: deleteItemId, id, key } = items; - if (moveToItemId === deleteItemId) return; + if (moveToItemId === deleteItemId || (deleteItemId === "0" && titleName === "未分类")) return; this.setState({ itemGroups: _.map(itemGroups, it => { if (moveToItemId === it.uuid) { 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) { diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItemNormal.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItemNormal.js index d1017f60..f6e4e295 100644 --- a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItemNormal.js +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItemNormal.js @@ -175,11 +175,11 @@ class LedgerSalaryItemNormal extends Component { }); }; handleSubmitMoveTo = () => { - const { onMoveSalaryItem } = this.props; + const { onMoveSalaryItem, dataSource } = this.props; const { moveModalPayload } = this.state; const { record, value } = moveModalPayload; this.handleCancelMove(); - onMoveSalaryItem(value, record); + onMoveSalaryItem(value, record, _.find(dataSource, it => (it.id === value || it.uuid === value)).name); }; render() { diff --git a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItemTable.js b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItemTable.js index 28508dce..925e04e7 100644 --- a/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItemTable.js +++ b/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItemTable.js @@ -25,7 +25,7 @@ class LedgerSalaryItemTable extends Component { const { dataSource, onHandleItemhide } = this.props; onHandleItemhide( _.map([...dataSource], item => { - if (id === item.id) { + if (id === item.id || id === item.key) { return { ...item, itemHide: String(value) @@ -48,7 +48,14 @@ class LedgerSalaryItemTable extends Component { }; render() { - const { dataSource, onDropCategoryItem, onChangeSelectedRowKeys, onEditFormnul, selectedRowKeys, onMoveTo } = this.props; + const { + dataSource, + onDropCategoryItem, + onChangeSelectedRowKeys, + onEditFormnul, + selectedRowKeys, + onMoveTo + } = this.props; const rowSelection = { selectedRowKeys, onChange: (selectedRowKeys) => this.setState({ selectedRowKeys }, () => { @@ -58,7 +65,7 @@ class LedgerSalaryItemTable extends Component { disabled: !record.canDelete }) }; - const checkValue = _.every(dataSource, it => it.itemHide && it.itemHide === "1") ? "1" : "0"; + const checkValue = (!_.isEmpty(dataSource) && _.every(dataSource, it => it.itemHide && it.itemHide === "1")) ? "1" : "0"; const columns = [ { title: "名称", @@ -102,7 +109,7 @@ class LedgerSalaryItemTable extends Component { width: 80, render: (text, record) => this.handleChangeItem(value, record.id)} + onChange={value => this.handleChangeItem(value, record.id || record.key)} /> }, { diff --git a/pc4mobx/hrmSalary/pages/mobilePayroll/index.js b/pc4mobx/hrmSalary/pages/mobilePayroll/index.js index dc79d451..4d08a972 100644 --- a/pc4mobx/hrmSalary/pages/mobilePayroll/index.js +++ b/pc4mobx/hrmSalary/pages/mobilePayroll/index.js @@ -24,7 +24,8 @@ export default class MobilePayroll extends React.Component { const type = getQueryString("type"); this.id = getQueryString("id"); const { mySalaryStore: { init } } = this.props; - type !== "phone" && init(false); + // type !== "phone" && init(false); + init(false); this.getMySalaryBill(this.id); } diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollDetail/index.js b/pc4mobx/hrmSalary/pages/payroll/payrollDetail/index.js index 6c0a5a3f..03ff17c6 100644 --- a/pc4mobx/hrmSalary/pages/payroll/payrollDetail/index.js +++ b/pc4mobx/hrmSalary/pages/payroll/payrollDetail/index.js @@ -5,8 +5,7 @@ import { Button, Spin } from "antd"; import { getQueryString } from "../../../util/url"; import { removePropertyCondition } from "../../../util/response"; import { getSearchs } from "../../../util"; -import { getPayrollDetailList, getPayrollDetailSa, getPayrollInfo, salaryBillSendSum } from "../../../apis/payroll"; -import { sysConfCodeRule } from "../../../apis/ruleconfig"; +import { getPayrollDetailList, getPayrollDetailSa, getPayrollInfo } from "../../../apis/payroll"; import "./index.less"; @inject("payrollStore") @@ -17,8 +16,7 @@ export default class PayrollDetail extends React.Component { this.state = { salarySendDetailBaseInfo: {}, loading: false, condition: [], dataSource: [], columns: [], - pageInfo: { current: 1, pageSize: 10, total: 0 }, - salaryBillSendSum: {}, showSum: false + pageInfo: { current: 1, pageSize: 10, total: 0 } }; } @@ -54,16 +52,11 @@ export default class PayrollDetail extends React.Component { } } if (type === "init") { - const { status, data: sysData } = await this.sysConfCodeRule(); - const { data: { sumRow } } = await this.salaryBillSendSum(); - const salaryBillSendSum = _.reduce(_.keys(sumRow), (pre, cur) => (_.assign(pre, { [`${cur}_salaryItem`]: sumRow[cur] })), {}); - this.setState({ showSum: status && sysData === "1", salaryBillSendSum }); childFrameObj.contentWindow.postMessage(JSON.stringify({ dataSource, columns, pageInfo, - showSum: status && sysData === "1", - salaryBillSendSum + sumpayload: { salarySendId: getQueryString("id") } }), "*"); this.getPayrollDetailList({ child: type }); } @@ -110,25 +103,18 @@ export default class PayrollDetail extends React.Component { })), pageInfo: { ...pageInfo, current, pageSize, total } }, () => { - const { pageInfo, dataSource, columns, salaryBillSendSum, showSum } = this.state; + const { pageInfo, dataSource, columns } = this.state; (child === "PAGEINFO" || child === "init") && childFrameObj.contentWindow.postMessage(JSON.stringify({ dataSource, columns, - pageInfo, showSum, - salaryBillSendSum + pageInfo, + sumpayload: { salarySendId: getQueryString("id") } }), "*"); }); } }).catch(() => this.setState({ loading: false })); }; - salaryBillSendSum = () => { - const salarySendId = getQueryString("id"); - return salaryBillSendSum({ salarySendId }); - }; - sysConfCodeRule = () => { - return sysConfCodeRule({ code: "OPEN_ACCT_RESULT_SUM" }); - }; handleExportAll = () => { const salarySendId = getQueryString("id"); const url = `${window.location.origin}/api/bs/hrmsalary/salaryBill/send/exportDetailList?salarySendId=${salarySendId}`; diff --git a/pc4mobx/hrmSalary/pages/reportView/components/condition.js b/pc4mobx/hrmSalary/pages/reportView/components/condition.js new file mode 100644 index 00000000..0e86091c --- /dev/null +++ b/pc4mobx/hrmSalary/pages/reportView/components/condition.js @@ -0,0 +1,153 @@ +import { WeaLocaleProvider } from "ecCom"; + +const { getLabel } = WeaLocaleProvider; +export const condition = [ + { + items: [ + { + colSpan: 2, + checkbox: false, + checkboxValue: false, + conditionType: "SELECT", + domkey: ["taxAgent"], + fieldcol: 18, + label: getLabel(111, "个税扣缴义务人"), + labelcol: 6, + options: [], + multiple: true, + viewAttr: 2 + }, + { + browserConditionParam: { + completeParams: {}, + conditionDataParams: {}, + dataParams: {}, + destDataParams: {}, + hasAddBtn: false, + hasAdvanceSerach: true, + idSeparator: ",", + isAutoComplete: 1, + isDetail: 0, + isMultCheckbox: false, + isSingle: false, + linkUrl: "", + pageSize: 10, + quickSearchName: "", + replaceDatas: [], + title: getLabel(111, "分部"), + type: "164", + viewAttr: 2 + }, + colSpan: 2, + conditionType: "BROWSER", + domkey: ["subCompany"], + fieldcol: 18, + isQuickSearch: false, + label: getLabel(111, "分部"), + labelcol: 6, + viewAttr: 2 + }, + { + browserConditionParam: { + completeParams: {}, + conditionDataParams: {}, + dataParams: {}, + destDataParams: {}, + hasAddBtn: false, + hasAdvanceSerach: true, + idSeparator: ",", + isAutoComplete: 1, + isDetail: 0, + isMultCheckbox: false, + isSingle: false, + linkUrl: "", + pageSize: 10, + quickSearchName: "", + replaceDatas: [], + title: getLabel(111, "部门"), + type: "57", + viewAttr: 2 + }, + colSpan: 2, + conditionType: "BROWSER", + domkey: ["department"], + fieldcol: 18, + isQuickSearch: false, + label: getLabel(111, "部门"), + labelcol: 6, + viewAttr: 2 + }, + // { + // browserConditionParam: { + // completeParams: {}, + // conditionDataParams: {}, + // dataParams: {}, + // destDataParams: {}, + // hasAddBtn: false, + // hasAdvanceSerach: true, + // idSeparator: ",", + // isAutoComplete: 1, + // isDetail: 0, + // isMultCheckbox: false, + // isSingle: false, + // linkUrl: "", + // pageSize: 10, + // quickSearchName: "", + // replaceDatas: [], + // title: getLabel(111, "岗位"), + // type: "278", + // viewAttr: 2 + // }, + // colSpan: 2, + // conditionType: "BROWSER", + // domkey: ["position"], + // fieldcol: 18, + // isQuickSearch: false, + // label: getLabel(111, "岗位"), + // labelcol: 6, + // viewAttr: 2 + // }, + { + browserConditionParam: { + completeParams: {}, + conditionDataParams: {}, + dataParams: {}, + destDataParams: {}, + hasAddBtn: false, + hasAdvanceSerach: true, + idSeparator: ",", + isAutoComplete: 1, + isDetail: 0, + isMultCheckbox: false, + isSingle: false, + linkUrl: "", + pageSize: 10, + quickSearchName: "", + replaceDatas: [], + title: getLabel(111, "人员"), + type: "17", + viewAttr: 2 + }, + colSpan: 2, + conditionType: "BROWSER", + domkey: ["employee"], + fieldcol: 18, + isQuickSearch: false, + label: getLabel(111, "人员"), + labelcol: 6, + viewAttr: 2 + }, + { + colSpan: 2, + conditionType: "RANGEPICKER", + domkey: ["hiredate1", "hiredate2"], + fieldcol: 18, + label: getLabel(111, "入职日期"), + labelcol: 6, + viewAttr: 2 + } + ], + title: "", + defaultshow: true + } +]; diff --git a/pc4mobx/hrmSalary/pages/reportView/components/customStatisticsItemsModal.js b/pc4mobx/hrmSalary/pages/reportView/components/customStatisticsItemsModal.js new file mode 100644 index 00000000..f87d7912 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/reportView/components/customStatisticsItemsModal.js @@ -0,0 +1,416 @@ +/* + * Author: 黎永顺 + * name: 新建自定义统计项目弹框 + * Description: + * Date: 2023/4/10 + */ +import React, { Component } from "react"; +import { Button, message, Modal } from "antd"; +import { + WeaBrowser, + WeaCheckbox, + WeaDialog, + WeaError, + WeaFormItem, + WeaHelpfulTip, + WeaInput, + WeaInputNumber, + WeaLocaleProvider, + WeaTable +} from "ecCom"; +import { reportStatisticsItemSave, statisticsItemGetform } from "../../../apis/statistics"; +import "../index.less"; + +const { getLabel } = WeaLocaleProvider; + +class CustomStatisticsItemsModal extends Component { + constructor(props) { + super(props); + this.state = { + loading: false, + columns: [], + dataSource: [], + formData: { + itemValue: "", itemValueSpan: "", + itemName: "" + } + }; + } + + componentWillReceiveProps(nextProps, nextContext) { + if (nextProps.visible !== this.props.visible && nextProps.visible) { + this.statisticsItemGetform({ id: nextProps.statisticsItemId }); + } else { + this.setState({ + columns: [], + dataSource: [], + formData: { + itemValue: "", itemValueSpan: "", + itemName: "" + } + }); + } + } + + handleSaveStatisticalItems = () => { + const { dataSource, formData } = this.state; + const { id: statReportId, statisticsItemId } = this.props; + const { itemValue, itemName } = formData; + const isNoRules = _.some(dataSource, it => !!it.m2mValue || !!it.ratioValue || !!it.totalValue || !!it.y2yValue); + const isChainRequired = _.some(dataSource, it => !!it.m2mValue && (!it.m2mLowerLimit || !it.m2mUpperLimit)); + const isChainValRight = _.some(dataSource, it => !!it.m2mValue && it.m2mLowerLimit !== 0 && it.m2mUpperLimit !== 0 && (Number(it.m2mLowerLimit) > Number(it.m2mUpperLimit))); + const isYoyRequired = _.some(dataSource, it => !!it.y2yValue && (!it.y2yLowerLimit || !it.y2yUpperLimit)); + const isYoyValRight = _.some(dataSource, it => !!it.y2yValue && it.y2yLowerLimit !== 0 && it.y2yUpperLimit !== 0 && (Number(it.y2yLowerLimit) > Number(it.y2yUpperLimit))); + if (!itemValue && !itemName) { + this.refs.proError.showError(); + this.refs.nameError.showError(); + return; + } + if (!itemValue) { + this.refs.proError.showError(); + return; + } + if (!itemName) { + this.refs.nameError.showError(); + return; + } + if (!isNoRules) { + message.warning(getLabel(111, "请至少设置一个统计规则")); + return; + } + if (isChainRequired) { + message.warning(getLabel(111, "请完善环比增幅正常区间设置上下限")); + return; + } + if (isChainValRight) { + message.warning(getLabel(111, "环比增幅上下限设置错误")); + return; + } + if (isYoyRequired) { + message.warning(getLabel(111, "请完善同比增幅正常区间设置上下限")); + return; + } + if (isYoyValRight) { + message.warning(getLabel(111, "同比增幅上下限设置错误")); + return; + } + let payload = { statReportId, itemValue: itemValue.split(","), itemName }; + payload = { + id: statisticsItemId, + ...payload, + ..._.reduce(dataSource, (pre, cur) => { + if (!!cur.m2mValue || !!cur.ratioValue || !!cur.totalValue || !!cur.y2yValue) { + const { y2yLowerLimit, y2yUpperLimit, m2mLowerLimit, m2mUpperLimit } = cur; + if (!!cur.m2mValue) { + return { + ...pre, + [`${cur["id"]}Rule`]: { + m2mValue: cur.m2mValue.toString(), + ratioValue: cur.ratioValue.toString(), + totalValue: cur.totalValue.toString(), + y2yValue: cur.y2yValue.toString(), + m2mLowerLimit: m2mLowerLimit.toString(), + m2mUpperLimit: m2mUpperLimit.toString() + } + }; + } + if (!!cur.m2mValue) { + return { + ...pre, + [`${cur["id"]}Rule`]: { + m2mValue: cur.m2mValue.toString(), + ratioValue: cur.ratioValue.toString(), + totalValue: cur.totalValue.toString(), + y2yValue: cur.y2yValue.toString(), + y2yLowerLimit: y2yLowerLimit.toString(), + y2yUpperLimit: y2yUpperLimit.toString() + } + }; + } + if (!!cur.y2yValue && !!cur.y2yValue) { + return { + ...pre, + [`${cur["id"]}Rule`]: { + m2mValue: cur.m2mValue.toString(), + ratioValue: cur.ratioValue.toString(), + totalValue: cur.totalValue.toString(), + y2yValue: cur.y2yValue.toString(), + m2mLowerLimit: m2mLowerLimit.toString(), + m2mUpperLimit: m2mUpperLimit.toString(), + y2yLowerLimit: y2yLowerLimit.toString(), + y2yUpperLimit: y2yUpperLimit.toString() + } + }; + } + return { + ...pre, + [`${cur["id"]}Rule`]: { + m2mValue: cur.m2mValue.toString(), + ratioValue: cur.ratioValue.toString(), + totalValue: cur.totalValue.toString(), + y2yValue: cur.y2yValue.toString() + } + }; + } + return { ...pre }; + }, {}) + }; + if (statisticsItemId) { + Modal.confirm({ + title: getLabel(111, "信息确认"), + content: getLabel(111, `确定要编辑统计项吗?编辑后,可能需要重新设置分析图设置。`), + onOk: () => this.reportStatisticsItemSave(payload) + }); + } else { + this.reportStatisticsItemSave(payload); + } + }; + reportStatisticsItemSave = (payload) => { + this.setState({ loading: true }); + reportStatisticsItemSave(payload).then(({ status, errormsg }) => { + this.setState({ loading: false }); + if (status) { + this.setState({ + formData: { + itemValue: "", itemName: "" + } + }, () => this.props.onCancel(true)); + } else { + message.error(errormsg); + } + }).catch(() => this.setState({ loading: false })); + }; + + + statisticsItemGetform = (payload) => { + statisticsItemGetform(payload).then(({ status, data }) => { + if (status) { + const { formData } = this.state; + const { ruleData, baseForm } = data; + const { data: dataDetail } = baseForm; + const { columns, data: dataSource } = ruleData; + this.setState({ + columns, dataSource, + formData: { + ...formData, + itemName: dataDetail ? dataDetail.itemName : "", + itemValue: dataDetail ? _.map(dataDetail.itemValue, it => it.id).join() : "", + itemValueSpan: dataDetail ? _.map(dataDetail.itemValue, it => it.name).join() : "" + } + }); + } + }); + }; + handleChangeColumnCheckBox = (key, value, id) => { + const { dataSource } = this.state; + this.setState({ + dataSource: _.map(dataSource, it => { + if (it.id === id) { + if (key !== "totalValue" && !!value && value !== "0") { + return { + ...it, + totalValue: Number(value), + [key]: Number(value) + }; + } + return { + ...it, + [key]: Number(value) + }; + } + return { ...it }; + }) + }); + }; + handleChangeColumnAllChecked = (key, val) => { + const { dataSource } = this.state; + this.setState({ + dataSource: _.map(dataSource, it => { + if (key !== "totalValue" && !!val && val !== "0") { + return { + ...it, + totalValue: Number(val), + [key]: Number(val) + }; + } + 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 }; + }) + }); + }; + handleChangeStatisticalItems = (itemValue, _names, datas) => { + const { formData } = this.state; + this.setState({ + formData: { + ...formData, + itemValue, + itemValueSpan: _.map(datas, it => it.name).join(","), + itemName: datas.length === 1 ? _.map(datas, it => it.names).join(",") : "" + } + }); + }; + + render() { + const { loading, columns, dataSource, formData } = this.state; + const { itemName, itemValue, itemValueSpan } = formData; + const { statisticsItemId } = this.props; + 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 ( + + {statisticsItemId ? getLabel(111, "编辑自定义统计项目") : getLabel(111, "新建自定义统计项目")} + +
+ } + style={{ width: 900, height: 450 }} + className="statisticItemsWrapper" + > +
+ + + ({ + id: it, + name: itemValueSpan.split(",")[idx] + })) : []} + completeParams={{ + type: 162, + fielddbtype: "browser.salaryItemBrowser", + f_weaver_belongto_usertype: "0" + }} + conditionDataParams={{ + type: "browser.salaryItemBrowser", + fielddbtype: "browser.salaryItemBrowser", + f_weaver_belongto_usertype: "0" + }} + dataParams={{ + type: "browser.salaryItemBrowser", + f_weaver_belongto_usertype: "0" + }} + destDataParams={{ + type: "browser.salaryItemBrowser", + f_weaver_belongto_usertype: "0" + }} + isMultCheckbox + inputStyle={{ width: "100%" }} + onChange={this.handleChangeStatisticalItems} + /> + + + + + this.setState({ formData: { ...formData, itemName } })}/> + + +
+ +
+
+ + ); + } +} + +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 new file mode 100644 index 00000000..c4c1494f --- /dev/null +++ b/pc4mobx/hrmSalary/pages/reportView/components/leftTab.js @@ -0,0 +1,83 @@ +/* + * Author: 黎永顺 + * name: 报表查看-左侧tab标题 + * Description: + * Date: 2023/4/20 + */ +import React, { Component } from "react"; +import { WeaInputSearch, WeaLocaleProvider } from "ecCom"; +import { reportStatisticsReportList } from "../../../apis/statistics"; +import { Menu } from "antd"; +import { getQueryString } from "../../../util/url"; +import "../index.less"; + + +const { getLabel } = WeaLocaleProvider; + +class LeftTab extends Component { + constructor(props) { + super(props); + this.state = { + reportName: "", + selectedKeys: getQueryString("id").split(","), + reportList: [] + }; + } + + componentDidMount() { + this.reportStatisticsReportList(); + } + + reportStatisticsReportList = () => { + 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])); + }); + }); + }; + 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; + 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/components/reportContent.js b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js new file mode 100644 index 00000000..c4b78c01 --- /dev/null +++ b/pc4mobx/hrmSalary/pages/reportView/components/reportContent.js @@ -0,0 +1,109 @@ +/* + * 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, width: 150, + title: it.text, align: "center", + children: !_.isNil(it.children) ? _.map(it.children, child => ({ + ...child, + dataIndex: child.column, width: 150, + title: child.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 ( +
+
+ +