feature/2.17.1.2411.01-薪酬报表薪资明细显示模式

This commit is contained in:
lys 2024-12-03 18:38:14 +08:00
parent 373e093321
commit b61dc20db5
4 changed files with 53 additions and 75 deletions

View File

@ -133,18 +133,19 @@ class CustomTransferDialog extends Component {
renderTitle = () => {
return (<div className="wea-hr-muti-dialog-title">
<span>{getLabel(111, "数据选择")}</span>
<div/>
<div>{this.props.titleOptsComs}</div>
</div>);
};
render() {
const { loading, listDatas, query, leftListSelectedKeys, rightDatas, rightCheckedKeys } = this.state;
const { searchParamsKey, saveLoading, btns = [] } = this.props;
const buttons = [
<Button type="primary" loading={saveLoading} onClick={this.handleOk}
disabled={_.isEmpty(rightDatas)}>{getLabel(111, "确 定")}</Button>,
...btns,
<Button type="ghost" onClick={this.props.onCancel}>{getLabel(111, "取 消")}</Button>];
const {
searchParamsKey, saveLoading, buttons = [
<Button type="primary" loading={saveLoading} onClick={this.handleOk}
disabled={_.isEmpty(rightDatas)}>{getLabel(111, "确 定")}</Button>,
<Button type="ghost" onClick={this.props.onCancel}>{getLabel(111, "取 消")}</Button>
]
} = this.props;
let rightActive = false, leftActive = false, rightAllActive = false;
if (leftListSelectedKeys && leftListSelectedKeys.length > 0) rightActive = true;
if (rightCheckedKeys && rightCheckedKeys.length > 0) leftActive = true;

View File

@ -35,7 +35,7 @@ class SalaryDetails extends Component {
showTotalCell: false, updateSum: true, tempDialog: { visible: false, setting: [], id: "", template: {} },
transferDialog: {
visible: false, searchParamsKey: "name", saveLoading: false,
dataParams: { page: "salary_details_report", defaultSetting: "0" },
dataParams: { page: "salary_details_report" },
completeURL: "", convertDatasource: datas => {
return {
listDatas: _.map(datas.setting, o => ({ id: o.id || o.column, name: o.name || o.text })),
@ -49,9 +49,7 @@ class SalaryDetails extends Component {
async componentDidMount() {
const [{ data: confCode }] = await Promise.all([sysConfCodeRule({ code: "OPEN_ACCT_RESULT_SUM" })]);
this.setState({ showTotalCell: confCode === "1" }, () => {
this.props.salaryDetailShowType === "1" && this.getPageListTemplatelist();
});
this.setState({ showTotalCell: confCode === "1" });
window.addEventListener("message", this.handleReceive, false);
window.addEventListener("resize", () => this.forceUpdate(), false);
}
@ -73,8 +71,7 @@ class SalaryDetails extends Component {
if (status) {
this.setState({
tempPageList: _.map(data, o => ({ ...o, key: String(o.id), showname: o.name })),
templateId: !_.isEmpty(_.find(data, o => !!o.checked)) ? String(_.find(data, o => !!o.checked).id) : "",
transferDialog: { ...this.state.transferDialog, visible: false, type: "default" }
templateId: !_.isEmpty(_.find(data, o => !!o.checked)) ? String(_.find(data, o => !!o.checked).id) : ""
});
}
});
@ -173,12 +170,13 @@ class SalaryDetails extends Component {
}
return [];
};
handleSetDefCols = (params) => this.setState({
handleSetDefCols = (params = {}) => this.setState({
transferDialog: {
...this.state.transferDialog, completeURL: "/api/bs/hrmsalary/common/pageList/get/setting", visible: true,
dataParams: { ...this.state.transferDialog.dataParams, ...params }
...this.state.transferDialog, visible: true, type: "temp",
dataParams: { ...this.state.transferDialog.dataParams, ...params },
completeURL: "/api/bs/hrmsalary/common/pageList/template/get"
}
});
}, () => this.getPageListTemplatelist());
converCheckedCol = (data) => {
return _.reduce(data.checked || [], (pre, cur) => {
const item = _.find(data.setting, k => k.column === cur.column);
@ -186,14 +184,9 @@ class SalaryDetails extends Component {
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) }
});
return;
}
const { transferDialog } = this.state;
const payload = {
...transferDialog.dataParams, setting: _.map(values, o => o.id)
};
@ -211,13 +204,8 @@ class SalaryDetails extends Component {
});
};
handelAddTemp = (templateId) => {
const { transferDialog, tempDialog, tempPageList } = this.state;
const { tempDialog, tempPageList } = this.state;
this.setState({
transferDialog: {
...transferDialog, visible: true, type: "temp",
dataParams: { ...transferDialog.dataParams, id: templateId },
completeURL: "/api/bs/hrmsalary/common/pageList/template/get"
},
tempDialog: { ...tempDialog, id: templateId, template: _.find(tempPageList, o => o.key === templateId) }
});
};
@ -226,7 +214,15 @@ class SalaryDetails extends Component {
API.changePageListTemplate({ page: "salary_details_report", templateId }).then(({ status, errormsg }) => {
if (status) {
message.success(getLabel(111, "操作成功!"));
this.getSalaryList();
this.setState({
transferDialog: {
...this.state.transferDialog,
dataParams: { ...this.state.transferDialog.dataParams, id: templateId }
}
}, () => {
this.transferRef.getData(true);
this.getSalaryList();
});
} else {
message.error(errormsg);
}
@ -252,21 +248,6 @@ class SalaryDetails extends Component {
const { dataParams: { defaultSetting } } = transferDialog;
return (<React.Fragment>
<div className="query-div">
{
salaryDetailShowType === "1" &&
<div className="custom-select">
<WeaSelect style={{ width: 200 }} hasAddBtn options={tempPageList} addOnClick={this.handelAddTemp}
showSearch optionFilterProp="children" value={templateId}
onChange={this.changePageListTemplate}/>
{
templateId &&
<span className="custom-select-edit" title={getLabel(111, "编辑模板")}
onClick={() => this.handelAddTemp(templateId)}>
<i className="icon-coms-BatchEditing-Hot"></i>
</span>
}
</div>
}
<MonthRangePicker dateRange={dateRange} viewAttr={2} onChange={this.props.onChange}/>
<AdvanceInputBtn onOpenAdvanceSearch={this.props.handleOpenAdvanceSearch}
onAdvanceSearch={this.props.handleAdvanceSearch}/>
@ -291,10 +272,16 @@ class SalaryDetails extends Component {
{/* columns={this.getColumns()}*/}
{/*/>*/}
{/*默认显示列,薪资模板列表*/}
<CustomTransferDialog {...transferDialog} onChange={this.savePageListSetting}
btns={defaultSetting === "0" ?
[<Button type="primary"
onClick={this.resetColsSetting}>{getLabel(111, "恢复默认显示列")}</Button>] : []}
<CustomTransferDialog {...transferDialog} ref={dom => this.transferRef = dom}
buttons={[
<Button type="primary"
onClick={() => this.handelAddTemp(templateId)}>{getLabel(111, "存为模板")}</Button>,
<Button type="ghost">{getLabel(111, "模板管理")}</Button>
]}
titleOptsComs={
<WeaSelect style={{ width: 200 }} options={tempPageList}
showSearch optionFilterProp="children" value={templateId}
onChange={this.changePageListTemplate}/>}
onCancel={() => this.setState({
transferDialog: {
...transferDialog, completeURL: "", visible: false, type: "default"

View File

@ -9,7 +9,7 @@ import { inject, observer } from "mobx-react";
import { WeaDatePicker, WeaInputSearch, WeaLocaleProvider, WeaReqTop } from "ecCom";
import { Button, Dropdown, Menu } from "antd";
import { condition, reportCondition } from "./components/conditions";
import { commonEnumList, reportGetForm, sysinfo } from "../../apis/ruleconfig";
import { commonEnumList, reportGetForm } from "../../apis/ruleconfig";
import { dimensionGetForm } from "../../apis/statistics";
import EmployeeDetails from "./components/employeeDetails";
import SalaryDetails from "./components/salaryDetails";
@ -50,16 +50,12 @@ class Index extends Component {
title: "", visible: false,
typeKey: "", id: ""
},
logDialogVisible: false, filterConditions: "[]",
salaryDetailShowType: "0" //薪资明细列表显示方式
logDialogVisible: false, filterConditions: "[]"
};
}
componentDidMount() {
this.initReportFormCondition();
sysinfo().then(({ status, data }) => {
if (status) this.setState({ salaryDetailShowType: data.SALARY_DETAILS_REPORT_SHOW_TYPE });
});
}
initReportFormCondition = (payload = {}) => {
@ -281,7 +277,7 @@ class Index extends Component {
const {
selectedKey, modalReq, slideReq, conditions, reportConditions,
reportName, keyword, year, logDialogVisible, filterConditions,
dateRange, showSearchAd, isQuery, salaryDetailShowType
dateRange, showSearchAd, isQuery
} = this.state;
const buttons = selectedKey === "statistics" ? [
<Button type="primary" onClick={() => this.handleReqBtnsClick("addReport")}>{getLabel(111, "新建报表")}</Button>,
@ -319,7 +315,7 @@ class Index extends Component {
icon: <i className="icon-coms-Custom"/>,
content: getLabel(111, "显示列定制"),
onClick: () => {
this.salaryRef.wrappedInstance.handleSetDefCols({ defaultSetting: "0" });
this.salaryRef.wrappedInstance.handleSetDefCols();
// tableStore.setColSetVisible(true);
// tableStore.tableColSet(true);
}
@ -331,18 +327,13 @@ class Index extends Component {
{ key: "salaryDetail", title: getLabel(111, "薪资明细") }
];
dropMenuDatas = selectedKey === "salaryDetail" ? dropMenuDatas.slice(-1) : dropMenuDatas.slice(0, 1);
(PageAndOptAuth.isChief && selectedKey === "salaryDetail") && (dropMenuDatas = [...dropMenuDatas, {
key: "DEF_COLUMN", icon: <i className="icon-coms-Custom"/>, content: getLabel(111, "默认显示列"),
onClick: () => this.salaryRef.wrappedInstance.handleSetDefCols({ defaultSetting: "1" })
}]);
return (
<WeaReqTop
title={getLabel(111, "薪酬统计报表")} icon={<i className="icon-coms-fa"/>} selectedKey={selectedKey}
iconBgcolor="#F14A2D" tabDatas={tabs} className="xc_tj_fx_wrapper"
buttons={(!statisticsReportBtn && selectedKey === "statistics") ? buttons.slice(-1) : buttons} buttonSpace={10}
onChange={selectedKey => this.setState({ selectedKey }, () => this.state.selectedKey === "statistics" && this.initReportFormCondition())}
showDropIcon={(selectedKey === "statistics") || (selectedKey === "salaryDetail" && salaryDetailShowType !== "1")}
onDropMenuClick={this.onDropMenuClick} dropMenuDatas={dropMenuDatas}>
showDropIcon={selectedKey !== "detail"} onDropMenuClick={this.onDropMenuClick} dropMenuDatas={dropMenuDatas}>
{
selectedKey === "statistics" ?
<ReportList
@ -355,7 +346,6 @@ class Index extends Component {
keyword={keyword} year={year}
onFilterLog={(type, targetid) => this.onDropMenuClick(type, targetid)}
/> : <SalaryDetails ref={dom => this.salaryRef = dom} dateRange={dateRange} isQuery={isQuery}
salaryDetailShowType={salaryDetailShowType}
showSearchAd={showSearchAd} handleOpenAdvanceSearch={this.handleOpenAdvanceSearch}
handleAdvanceSearch={this.handleAdvanceSearch} onAdSearch={this.onAdSearch}
onCancel={() => this.setState({ showSearchAd: false })}

View File

@ -215,16 +215,16 @@ export const conditions = [
labelcol: 8,
viewAttr: 2
},
{
conditionType: "SELECT",
domkey: ["SALARY_DETAILS_REPORT_SHOW_TYPE"],
fieldcol: 10,
label: "薪资明细显示模式",
lanId: 111,
options: [],
labelcol: 8,
viewAttr: 2
}
// {
// conditionType: "SELECT",
// domkey: ["SALARY_DETAILS_REPORT_SHOW_TYPE"],
// fieldcol: 10,
// label: "薪资明细显示模式",
// lanId: 111,
// options: [],
// labelcol: 8,
// viewAttr: 2
// }
],
title: "薪资报表",
lanId: 111,