diff --git a/pc4mobx/hrmSalary/apis/statistics.js b/pc4mobx/hrmSalary/apis/statistics.js index 17323093..929f41b9 100644 --- a/pc4mobx/hrmSalary/apis/statistics.js +++ b/pc4mobx/hrmSalary/apis/statistics.js @@ -138,3 +138,15 @@ export const exportSalaryList = (params) => { export const savePageListSetting = (params) => { return postFetch("/api/bs/hrmsalary/common/pageList/save/setting", params); }; +//薪酬统计报表-保存页面模板 +export const savePageListTemplate = (params) => { + return postFetch("/api/bs/hrmsalary/common/pageList/template/save", params); +}; +//薪酬统计报表-获取页面模板 +export const getPageListTemplatelist = (params) => { + return postFetch("/api/bs/hrmsalary/common/pageList/template/list", params); +}; +//薪酬统计报表-切换个体页面模板 +export const changePageListTemplate = (params) => { + return postFetch("/api/bs/hrmsalary/common/pageList/template/change", params); +}; diff --git a/pc4mobx/hrmSalary/components/CustomBrowser/components/customTransferDialog.js b/pc4mobx/hrmSalary/components/CustomBrowser/components/customTransferDialog.js index 919ec05c..af640c34 100644 --- a/pc4mobx/hrmSalary/components/CustomBrowser/components/customTransferDialog.js +++ b/pc4mobx/hrmSalary/components/CustomBrowser/components/customTransferDialog.js @@ -34,7 +34,7 @@ class CustomTransferDialog extends Component { componentWillReceiveProps(nextProps, nextContext) { if (nextProps.visible !== this.props.visible && nextProps.visible) { - this.getData(true); + this.getData(true, nextProps); if (nextProps.datas) { this.setState({ leftListSelectedData: _.values(nextProps.datas), rightDatas: _.values(nextProps.datas) @@ -49,9 +49,9 @@ class CustomTransferDialog extends Component { } } - getData = (init = false) => { + getData = (init = false, props) => { const { query } = this.state; - const { completeURL, convertDatasource, dataParams = {} } = this.props; + const { completeURL, convertDatasource, dataParams = {} } = props || this.props; let payload = { ...dataParams, ...query }; this.setState({ loading: true }); postFetch(completeURL, payload).then(({ status, data }) => { diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/conditions.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/conditions.js index 6a19614c..924662b3 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/conditions.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/conditions.js @@ -1,4 +1,3 @@ -import React from "react"; import { WeaLocaleProvider } from "ecCom"; const { getLabel } = WeaLocaleProvider; @@ -219,3 +218,47 @@ export const salaryDetailSearchConditions = [ col: 2 } ]; +export const tempCondition = [ + { + items: [ + { + conditionType: "INPUT", + domkey: ["name"], + fieldcol: 14, + label: "模板名称", + lanId: 111, + labelcol: 6, + value: "", + rules: "required|string", + viewAttr: 3 + }, + { + conditionType: "SELECT", + domkey: ["sharedType"], + fieldcol: 14, + label: "可见性", + lanId: 111, + labelcol: 6, + options: [], + rules: "required|string", + viewAttr: 3 + }, + { + conditionType: "SELECT", + domkey: ["limitIds"], + fieldcol: 14, + label: "可见性范围", + lanId: 111, + labelcol: 6, + options: [], + detailtype: 3, + multiple: true, + rules: "", + viewAttr: 1, + hide: true + } + ], + title: "", + defaultshow: true + } +]; diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/employeeDetails.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/employeeDetails.js index 48816b74..6429bba6 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/employeeDetails.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/employeeDetails.js @@ -108,7 +108,7 @@ class EmployeeDetails extends Component { pagination={pagination} loading={loading} columns={columns} - scroll={{ y: `calc(100vh - 174px)` }} + scroll={{ y: `calc(100vh - 182px)` }} /> ); } diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryDetails.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryDetails.js index cb427e5a..f49bf4ac 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryDetails.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryDetails.js @@ -5,14 +5,14 @@ * Date: 2024/3/26 */ import React, { Component } from "react"; -import { toJS } from "mobx"; import { inject, observer } from "mobx-react"; import { WeaTableNew } from "comsMobx"; -import { WeaLoadingGlobal, WeaLocaleProvider } from "ecCom"; +import { WeaLoadingGlobal, WeaLocaleProvider, WeaSelect } from "ecCom"; import { message, Spin } from "antd"; import { getIframeParentHeight } from "../../../util"; import { sysConfCodeRule } from "../../../apis/ruleconfig"; import CustomTransferDialog from "../../../components/CustomBrowser/components/customTransferDialog"; +import SalaryDetailsTempDialog from "./salaryDetailsTempDialog"; import { MonthRangePicker } from "../../reportView/components/statisticalMicroSettingsSlide"; import AdvanceInputBtn from "../components/advanceInputBtn"; import SearchPannel from "../components/searchPannel"; @@ -29,24 +29,29 @@ class SalaryDetails extends Component { constructor(props) { super(props); this.state = { - loading: false, dataSource: [], columns: [], selectedRowKeys: [], - pageInfo: { current: 1, pageSize: 10, total: 0 }, payload: {}, - showTotalCell: false, updateSum: true, + loading: false, dataSource: [], columns: [], selectedRowKeys: [], tempPageList: [], + pageInfo: { current: 1, pageSize: 10, total: 0 }, payload: {}, templateId: "", + showTotalCell: false, updateSum: true, tempDialog: { visible: false, setting: [] }, transferDialog: { visible: false, searchParamsKey: "name", dataParams: { page: "salary_details_report" }, saveLoading: false, - completeURL: "/api/bs/hrmsalary/common/pageList/get/setting", convertDatasource: datas => { + completeURL: "", convertDatasource: datas => { return { - listDatas: _.map(datas.setting, o => ({ id: o.id, name: o.name })), + listDatas: _.map(datas.setting, o => ({ id: o.id || o.column, name: o.name || o.text })), checked: this.converCheckedCol(datas) }; - } + }, + type: "default" } }; } componentDidMount() { this.getSalaryList(this.props); + this.getPageListTemplatelist(); window.addEventListener("message", this.handleReceive, false); + window.addEventListener("resize", () => this.setState({ + transferDialog: { ...this.state.transferDialog, cancel: true } + }, () => this.forceUpdate()), false); } componentWillReceiveProps(nextProps, nextContext) { @@ -57,9 +62,22 @@ class SalaryDetails extends Component { componentWillUnmount() { window.removeEventListener("message", this.handleReceive, false); + window.removeEventListener("message", () => this.setState({ + transferDialog: { ...this.state.transferDialog, cancel: true } + }, () => this.forceUpdate()), false); this.setState(({ selectedRowKeys: [] })); } + getPageListTemplatelist = () => { + API.getPageListTemplatelist({ page: "salary_details_report" }).then(({ status, data }) => { + if (status) { + this.setState({ + tempPageList: _.map(data, o => ({ key: String(o.id), showname: o.name })), + templateId: String(_.find(data, o => !!o.checked).id) + }); + } + }); + }; handleReceive = ({ data }) => { const { type, payload: { id, params } = {} } = data; const { pageInfo } = this.state; @@ -103,40 +121,38 @@ class SalaryDetails extends Component { const [{ data: confCode }] = await Promise.all([sysConfCodeRule({ code: "OPEN_ACCT_RESULT_SUM" })]); this.setState({ loading: false }); if (status) { - const { dataKey, pageInfo: pageparams } = data; + const { columns, dataKey, pageInfo: pageparams } = data; const { list: dataSource, pageNum: current, total, pageSize } = pageparams; this.setState({ - dataSource, pageInfo: { ...pageInfo, current, total, pageSize }, payload, + columns, dataSource, pageInfo: { ...pageInfo, current, total, pageSize }, payload, showTotalCell: confCode === "1", transferDialog: { ...transferDialog, cancel: false } }, () => tableStore.getDatas(dataKey.datas)); } }).catch(() => this.setState({ loading: false })); }; handleExportSalaryList = (key) => { - const { attendanceStore: { tableStore } } = this.props; - let { selectedRowKeys, payload } = this.state; + let { selectedRowKeys, payload, columns } = this.state; if (key === "SELECTED" && selectedRowKeys.length === 0) { message.warning(getLabel(543345, "请选择需要导出的数据!")); return; } WeaLoadingGlobal.start(); const promise = API.exportSalaryList({ - ...payload, ids: key === "SELECTED" ? selectedRowKeys : [], - columns: _.map(_.filter(toJS(tableStore.columns), (item) => item.display === "true" && item.dataIndex !== "acctTimes"), o => o.dataIndex) + ...payload, ids: key === "SELECTED" ? selectedRowKeys : [], columns: _.map(columns, o => o.column) }); }; getColumns = () => { - const { attendanceStore: { tableStore } } = this.props; - const { dataSource, pageInfo, selectedRowKeys, showTotalCell, payload, updateSum, transferDialog } = this.state; - const columns = _.filter(toJS(tableStore.columns), (item) => item.display === "true" && item.dataIndex !== "acctTimes"); + const { + columns, dataSource, pageInfo, selectedRowKeys, showTotalCell, payload, updateSum, transferDialog + } = this.state; const sumRowlistUrl = showTotalCell ? "/api/bs/hrmsalary/report/statistics/employee/salaryListSum" : ""; if (!_.isEmpty(columns) && !transferDialog.visible && !transferDialog.cancel) { this.postMessageToChild({ dataSource, pageInfo, selectedRowKeys, showTotalCell, calcDetail: true, tableScrollHeight: 154, sumRowlistUrl, payload: { ...payload, updateSum }, columns: _.map(columns, (it, idx) => ({ - ...it, calcDetail: true, - width: (it.dataIndex === "taxAgent" || it.dataIndex === "salarySob") ? 176 : it.oldWidth, + dataIndex: it.column, title: it.text, calcDetail: true, + width: (it.dataIndex === "taxAgent" || it.dataIndex === "salarySob") ? 176 : it.width, fixed: (idx === 1 || idx === 0 || idx === 2) ? "left" : "", ellipsis: true })) @@ -144,15 +160,27 @@ class SalaryDetails extends Component { } return []; }; - handleSetDefCols = () => this.setState({ transferDialog: { ...this.state.transferDialog, visible: true } }); + handleSetDefCols = () => this.setState({ + transferDialog: { + ...this.state.transferDialog, completeURL: "/api/bs/hrmsalary/common/pageList/get/setting", visible: true + } + }); converCheckedCol = (data) => { - return _.reduce(data.checked, (pre, cur) => { + return _.reduce(data.checked || [], (pre, cur) => { const item = _.find(data.setting, k => k.id === cur); if (!_.isEmpty(item)) return [...pre, item]; return pre; }, []); }; savePageListSetting = (values) => { + const { transferDialog, tempDialog } = this.state, { type } = transferDialog; + if (type === "temp") { + this.setState({ + tempDialog: { ...tempDialog, visible: true, setting: _.map(values, o => o.id) }, + transferDialog: { ...this.state.transferDialog, visible: false, cancel: true, type: "default" } + }); + return; + } const payload = { page: "salary_details_report", setting: _.map(values, o => o.id) @@ -162,27 +190,54 @@ class SalaryDetails extends Component { this.setState({ transferDialog: { ...this.state.transferDialog, saveLoading: false } }); if (status) { message.success(getLabel(111, "操作成功!")); - this.setState({ transferDialog: { ...this.state.transferDialog, visible: false } }, () => this.getSalaryList()); + this.setState({ + transferDialog: { ...this.state.transferDialog, visible: false, type: "default" } + }, () => this.getSalaryList()); } else { message.error(errormsg); } }); }; + handelAddTemp = () => this.setState({ + transferDialog: { + ...this.state.transferDialog, visible: true, type: "temp", + completeURL: "/api/bs/hrmsalary/common/pageList/template/get" + } + }); + changePageListTemplate = (templateId) => { + this.setState({ templateId }, () => { + API.changePageListTemplate({ page: "salary_details_report", templateId }).then(({ status, errormsg }) => { + if (status) { + message.success(getLabel(111, "操作成功!")); + this.getSalaryList(); + } else { + message.error(errormsg); + } + }); + }); + }; render() { - const { loading, dataSource, transferDialog } = this.state; + const { loading, dataSource, transferDialog, tempDialog, tempPageList, templateId } = this.state; const { attendanceStore: { tableStore }, dateRange, showSearchAd } = this.props; return (
+ - + this.setState({ + transferDialog: { ...this.state.transferDialog, cancel: true } + }, () => this.props.handleOpenAdvanceSearch())} onAdvanceSearch={this.props.handleAdvanceSearch}/>
- + { + this.setState({ + transferDialog: { ...this.state.transferDialog, cancel: true } + }, () => this.props.onCancel()); + }} onAdSearch={this.props.onAdSearch}/>
+ style={{ height: getIframeParentHeight(".wea-new-top-req-content", dataSource.length, 70) + "px" }}>