feature/2.19.1.2501.01-套打功能

This commit is contained in:
lys 2025-02-08 11:16:43 +08:00
parent 7fd6edb02d
commit 6b8b604f55
7 changed files with 53 additions and 13 deletions

View File

@ -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);

View File

@ -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 {
{/*薪资明细模板设置*/}
<SalaryDetailsTempDialog {...tempDialog}
onCancel={callback => this.setState({
tempDialog: { ...tempDialog, visible: false, setting: [] }
tempDialog: { ...tempDialog, visible: false, setting: [], heads: [] }
}, () => callback && callback())}
onSuccess={this.getPageListTemplatelist}/>
{/*薪资明细自定义列模板管理*/}

View File

@ -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 {
<WeaDialog
{...this.props} style={{ width: 480, height: 127 }} initLoadCss title={getLabel(111, "模板保存")}
buttons={[<Button type="primary" onClick={this.save} loading={loading}>{getLabel(537558, "保存")}</Button>]}>
<div className="form-dialog-layout">{getSearchs(tempForm, conditions, 1, false, this.formFieldChange)}</div>
<div
className="form-dialog-layout tempDialog">{getSearchs(tempForm, conditions, 1, false, this.formFieldChange)}</div>
</WeaDialog>
);
}

View File

@ -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 (<WeaDialog
{...this.props} initLoadCss ref={dom => 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={[
<Button type="primary"
onClick={() => this.props.onAddTemp(dataParams.id, selectedKeys)}>{getLabel(111, "确 定")}</Button>,
onClick={() => this.props.onAddTemp(dataParams.id, selectedKeys, heads)}>{getLabel(111, "确 定")}</Button>,
<Button type="ghost" onClick={this.props.onCancel}>{getLabel(111, "取 消")}</Button>
]}>
<WeaTransfer data={dataSource} selectedKeys={selectedKeys} onChange={v => this.setState({ selectedKeys: v })}

View File

@ -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 {
{/*薪资明细模板设置*/}
<SalaryDetailsTempDialog {...tempDialog}
onCancel={callback => 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" } }

View File

@ -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;
}
}

View File

@ -36,7 +36,13 @@ export const getSearchs = (form, condition, col, isCenter, onChange = () => void
items.push({
com: (
<WeaFormItem
label={`${fields.label}`} // label 标签的文本
label={<span>
<span>{`${fields.label}`}</span>
{
fields.labelExtra && <span className="wea-form-item-label-extra"
onClick={() => onChange(fields.labelType)}>{fields.labelExtra}</span>
}
</span>} // label 标签的文本
labelCol={{ span: `${fields.labelcol}` }} // label标签占一行比例
wrapperCol={{ span: `${fields.fieldcol}` }} // 右侧控件占一行比例
error={form.getError(fields)} // 错误提示: 处理表单中有必填项,保存的校验