diff --git a/pc4mobx/hrmSalary/apis/statistics.js b/pc4mobx/hrmSalary/apis/statistics.js index a4d16bbc..9f2aa6d4 100644 --- a/pc4mobx/hrmSalary/apis/statistics.js +++ b/pc4mobx/hrmSalary/apis/statistics.js @@ -142,6 +142,10 @@ export const savePageListSetting = (params) => { export const savePageListTemplate = (params) => { return postFetch("/api/bs/hrmsalary/common/pageList/template/save", params); }; +// 薪酬统计报表-导出模板示例下载 +export const downloadPageListTemplate = (params) => { + return postExportFetch("/api/bs/hrmsalary/common/pageList/template/file/download", params); +}; //薪酬统计报表-获取页面模板 export const getPageListTemplatelist = (params) => { return postFetch("/api/bs/hrmsalary/common/pageList/template/list", params); diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryDetails.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryDetails.js index 718ed21f..e791e76e 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryDetails.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryDetails.js @@ -32,7 +32,8 @@ class SalaryDetails extends Component { this.state = { loading: false, dataSource: [], columns: [], selectedRowKeys: [], tempPageList: [], sumRow: {}, pageInfo: { current: 1, pageSize: 10, total: 0 }, payload: {}, templateId: "", tempManageQuery: false, - showTotalCell: false, updateSum: true, tempDialog: { visible: false, setting: [], id: "", template: {} }, + showTotalCell: false, updateSum: true, + tempDialog: { visible: false, setting: [], heads: [], id: "", template: {} }, transferDialog: { visible: false, searchParamsKey: "name", saveLoading: false, dataParams: { page: "salary_details_report" }, @@ -206,7 +207,8 @@ class SalaryDetails extends Component { } this.setState({ tempDialog: { - ...tempDialog, visible: true, setting: _.map(this.transferRef.state.rightDatas, o => o.id) + ...tempDialog, visible: true, setting: _.map(this.transferRef.state.rightDatas, o => o.id), + heads: _.map(this.transferRef.state.rightDatas, o => o.name) // template: _.find(tempPageList, o => o.key === templateId) } }); @@ -307,7 +309,7 @@ class SalaryDetails extends Component { {/*薪资明细模板设置*/} this.setState({ - tempDialog: { ...tempDialog, visible: false, setting: [] } + tempDialog: { ...tempDialog, visible: false, setting: [], heads: [] } }, () => callback && callback())} onSuccess={this.getPageListTemplatelist}/> {/*薪资明细自定义列模板管理*/} diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryDetailsTempDialog.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryDetailsTempDialog.js index 47ecfbb5..8c971aae 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryDetailsTempDialog.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryDetailsTempDialog.js @@ -9,10 +9,11 @@ */ import React, { Component } from "react"; import { inject, observer } from "mobx-react"; -import { WeaDialog, WeaLocaleProvider, WeaTools } from "ecCom"; +import { WeaDialog, WeaLoadingGlobal, WeaLocaleProvider, WeaTools } from "ecCom"; import { tempCondition } from "./conditions"; import { getTaxAgentSelectList } from "../../../apis/taxAgent"; import * as API from "../../../apis/statistics"; +import { downloadPageListTemplate } from "../../../apis/statistics"; import { Button, message } from "antd"; import { getSearchs } from "../../../util"; @@ -62,7 +63,7 @@ class SalaryDetailTempDialog extends Component { ...o, label: getLabel(o.lanId, o.label), value: id ? template[getKey(o)] : "", datas: id && template[getKey(o)] ? [ { fileid: template[getKey(o)], filename: template["fileName"], showDelete: true } - ] : [] + ] : [], labelExtra: getLabel(111, "下载示例"), labelType: "download" }; } return { ...o, label: getLabel(o.lanId, o.label), value: id ? template[getKey(o)] : "" }; @@ -100,6 +101,12 @@ class SalaryDetailTempDialog extends Component { }).catch(() => this.setState({ loading: false })); }; formFieldChange = (field) => { + if (field === "download") { + const { setting, heads } = this.props; + WeaLoadingGlobal.start(); + const promise = downloadPageListTemplate({ setting, heads }); + return; + } const key = Object.keys(field)[0], value = field[key].value; this.setState({ conditions: _.map(this.state.conditions, item => ({ @@ -109,7 +116,7 @@ class SalaryDetailTempDialog extends Component { ...o, hide: value !== "0", viewAttr: value === "0" ? 3 : 1, rules: value === "0" ? "required|string" : "" }; - } else if (getKey(o) === "fileId") { + } else if (key === "fileId" && getKey(o) === "fileId") { return { ...o, value, datas: value ? _.map(field[key].valueSpan, o => ({ fileid: o.fileid, filename: o.filename, showDelete: true @@ -132,7 +139,8 @@ class SalaryDetailTempDialog extends Component { {getLabel(537558, "保存")}]}> -
{getSearchs(tempForm, conditions, 1, false, this.formFieldChange)}
+
{getSearchs(tempForm, conditions, 1, false, this.formFieldChange)}
); } diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryTempAdminDialog.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryTempAdminDialog.js index 0006cac0..bfebf988 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryTempAdminDialog.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryTempAdminDialog.js @@ -40,6 +40,12 @@ class SalaryTempAdminDialog extends Component { render() { const { dataSource, selectedKeys } = this.state, { dataParams } = this.props; + const heads = _.reduce(dataSource, (pre, cur) => { + if (selectedKeys.includes(cur.id)) { + return [...pre, cur.name]; + } + return pre; + }, []); return ( this.dialog = dom} title={getLabel(111, "模板管理")} className="temp_admin_dialog" style={{ @@ -47,7 +53,7 @@ class SalaryTempAdminDialog extends Component { maxHeight: "90%", maxWidth: "90%", overflow: "hidden", transform: "translate(0px, 0px)" }} buttons={[ , + onClick={() => this.props.onAddTemp(dataParams.id, selectedKeys, heads)}>{getLabel(111, "确 定")}, ]}> this.setState({ selectedKeys: v })} diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryTempMangerDialog.js b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryTempMangerDialog.js index 4f5696c9..9b309e4d 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryTempMangerDialog.js +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/salaryTempMangerDialog.js @@ -20,7 +20,7 @@ class SalaryTempMangerDialog extends Component { super(props); this.state = { selectedRowKeys: [], tempAdminDialog: { visible: false, dataParams: { page: "salary_details_report" } }, - tempDialog: { visible: false, setting: [], id: "", template: {} } + tempDialog: { visible: false, setting: [], heads: [], id: "", template: {} } }; } @@ -31,10 +31,10 @@ class SalaryTempMangerDialog extends Component { handleTempAdminCols = (params = {}) => this.setState({ tempAdminDialog: { visible: true, dataParams: { ...this.state.tempAdminDialog.dataParams, ...params } } }); - handelAddTemp = (id = "", setting = []) => { + handelAddTemp = (id = "", setting = [], heads = []) => { this.setState({ tempDialog: { - visible: true, setting, id, template: _.find(this.tempManageRef.state.listDatas, o => o.id === id) + visible: true, setting, heads, id, template: _.find(this.tempManageRef.state.listDatas, o => o.id === id) } }); }; @@ -76,7 +76,7 @@ class SalaryTempMangerDialog extends Component { {/*薪资明细模板设置*/} this.setState({ - tempDialog: { ...tempDialog, visible: false, setting: [] } + tempDialog: { ...tempDialog, visible: false, setting: [], heads: [] } }, () => callback && callback())} onSuccess={() => this.setState({ tempAdminDialog: { visible: false, dataParams: { page: "salary_details_report" } } diff --git a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less index 40c137f0..7d481333 100644 --- a/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less +++ b/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/index.less @@ -382,3 +382,17 @@ } } + +.tempDialog { + .wea-form-item-label { + min-height: 50px; + } + + .wea-form-item-label-extra { + position: absolute; + left: 0; + bottom: 0; + cursor: pointer; + color: #4d7ad8; + } +} diff --git a/pc4mobx/hrmSalary/util/index.js b/pc4mobx/hrmSalary/util/index.js index a7be61b0..0b63ffda 100644 --- a/pc4mobx/hrmSalary/util/index.js +++ b/pc4mobx/hrmSalary/util/index.js @@ -36,7 +36,13 @@ export const getSearchs = (form, condition, col, isCenter, onChange = () => void items.push({ com: ( + {`${fields.label}`} + { + fields.labelExtra && onChange(fields.labelType)}>{fields.labelExtra} + } + } // label 标签的文本 labelCol={{ span: `${fields.labelcol}` }} // label标签占一行比例 wrapperCol={{ span: `${fields.fieldcol}` }} // 右侧控件占一行比例 error={form.getError(fields)} // 错误提示: 处理表单中有必填项,保存的校验