feature/2.9.9.2312.01-薪资核算列表在线编辑

This commit is contained in:
黎永顺 2023-12-05 17:15:55 +08:00
parent 36eb6eae6a
commit 72d02ad754
2 changed files with 27 additions and 8 deletions

View File

@ -22,7 +22,7 @@ class EditCalcTable extends Component {
this.state = {
loading: false, pageInfo: { current: 1, pageSize: 10, total: 0 },
selectedRowKeys: [], progressVisible: false, progress: 0,
salaryCalcSlide: { visible: false, id: "" }
salaryCalcSlide: { visible: false, id: "" }, originPayloadData: {}
};
this.timerLock = null;
}
@ -127,6 +127,7 @@ class EditCalcTable extends Component {
"总计": getLabel(523, "总计"), "批量解锁": getLabel(111, "批量解锁"),
"批量锁定": getLabel(111, "批量锁定")
};
this.setState({ originPayloadData: { ...payload, i18n } });
const childFrameObj = document.getElementById("atdTable");
childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*");
};
@ -151,7 +152,9 @@ class EditCalcTable extends Component {
const { pageInfo, selectedRowKeys } = this.state;
const sumRowlistUrl = this.props.showTotalCell ? "/api/bs/hrmsalary/salaryacct/acctresult/sum" : "";
this.postMessageToChild({
dataSource, pageInfo, selectedRowKeys, showTotalCell: this.props.showTotalCell, sumRowlistUrl, payload,
dataSource, pageInfo, selectedRowKeys,
showTotalCell: this.props.showTotalCell, sumRowlistUrl,
payload, editable: false,
columns: _.every(traverse(columns), (it, idx) => !it.fixed) ? _.map(traverse(columns), (it, idx) => ({
...it,
fixed: idx < 2 ? "left" : false
@ -161,6 +164,7 @@ class EditCalcTable extends Component {
}
}).catch(() => this.setState({ loading: false }));
};
handleBatchEditing = (editable) => this.postMessageToChild({ ...this.state.originPayloadData, editable });
render() {
const { loading, progressVisible, progress, salaryCalcSlide } = this.state;
@ -169,8 +173,8 @@ class EditCalcTable extends Component {
<Spin spinning={loading}>
<iframe
style={{ border: 0, width: "100%", height: "100%" }}
// src="http://localhost:7607/#/calcTable"
src="/spa/hrmSalary/hrmSalaryCalculateDetail/index.html#/calcTable"
src="http://localhost:7607/#/calcTable"
// src="/spa/hrmSalary/hrmSalaryCalculateDetail/index.html#/calcTable"
id="atdTable"
/>
<EditSalaryCalcSlide {...salaryCalcSlide}
@ -210,7 +214,8 @@ const traverse = (arr) => {
} else {
return {
title: item.text, width: item.width + "px", fixed: item.fixed || false,
dataIndex: item.column, ellipsis: true, lockStatus: item.lockStatus
dataIndex: item.column, ellipsis: true, lockStatus: item.lockStatus,
pattern: item.pattern
};
}
});

View File

@ -6,6 +6,7 @@
*/
import React, { Component } from "react";
import { WeaHelpfulTip, WeaLocaleProvider } from "ecCom";
import { Button } from "antd";
import { getColumnDesc, getSalarySobCycle } from "../../../../../apis/calculate";
import { sysConfCodeRule } from "../../../../../apis/ruleconfig";
import EditCalcAdvanceSearchPannel from "./editCalcAdvanceSearchPannel";
@ -20,7 +21,7 @@ class Index extends Component {
constructor(props) {
super(props);
this.state = {
salarySobCycle: {}, showSearchAd: false,
salarySobCycle: {}, showSearchAd: false, editable: false,
columnDesc: {}, formulaTd: "", showTotalCell: false
};
}
@ -48,9 +49,14 @@ class Index extends Component {
}
};
handleShowFormulaTa = (dataIndex) => this.setState({ formulaTd: dataIndex });
handleBatchEditing = (editable) => {
this.setState({ editable: !this.state.editable }, () => {
this.calcTableRef.wrappedInstance.handleBatchEditing(editable);
});
};
render() {
const { salarySobCycle, showSearchAd, formulaTd, columnDesc, showTotalCell } = this.state;
const { salarySobCycle, showSearchAd, formulaTd, columnDesc, showTotalCell, editable } = this.state;
const { routeParams: { salaryAcctRecordId } } = this.props;
const formulaObj = _.get(columnDesc, [formulaTd]) || {};
return (
@ -72,7 +78,15 @@ class Index extends Component {
<span>{getLabel(18125, "公式")}=</span>
<span>{formulaObj.formulaContent}</span>
</div>
<div></div>
<div style={{ paddingRight: 8 }}>
{
!editable ?
<Button type="primary"
onClick={() => this.handleBatchEditing(true)}>{getLabel(545071, "批量编辑")}</Button> :
<Button type="primary"
onClick={() => this.handleBatchEditing(false)}>{getLabel(537558, "保存")}</Button>
}
</div>
</div>
<div className={cs("searchAdvanced-condition-container", { "searchAdvanced-condition-hide": !showSearchAd })}>
<EditCalcAdvanceSearchPannel