feature/2.14.5.2406.03-工资单查看详情列表添加自定义列的功能

This commit is contained in:
黎永顺 2024-07-15 18:18:57 +08:00
parent b349327088
commit 6d73b146c4
2 changed files with 24 additions and 12 deletions

View File

@ -39,9 +39,7 @@ class Index extends Component {
}
componentWillReceiveProps(nextProps, nextContext) {
if (nextProps.isQuery !== this.props.isQuery) {
console.log("componentWillReceiveProps", nextProps.isQuery);
}
if (nextProps.isQuery !== this.props.isQuery) this.setState({ updateSum: true }, () => this.getPayrollDetailList());
}
handleReceive = async ({ data }) => {
@ -50,6 +48,13 @@ class Index extends Component {
this.getPayrollDetailList();
} else if (type === "turn") {
switch (id) {
case "PAGEINFO":
const { pageNum: current, size: pageSize } = params;
this.setState({
pageInfo: { ...this.state.pageInfo, current, pageSize },
updateSum: false
}, () => this.getPayrollDetailList());
break;
default:
break;
}
@ -64,11 +69,13 @@ class Index extends Component {
departmentIds: form.getFormParams().departmentIds ? form.getFormParams().departmentIds.split(",") : [],
subCompanyIds: form.getFormParams().subCompanyIds ? form.getFormParams().subCompanyIds.split(",") : []
};
this.setState({ loading: true });
API.getPayrollDetailList(payload).then(({ status, data }) => {
this.setState({ loading: false });
if (status) {
const { dataKey, pageInfo, datas: dataSource } = data;
const { dataKey, pageInfo: pageResult, datas: dataSource } = data;
const { datas } = dataKey;
const { pageNum: current, pageSize, total } = pageInfo;
const { pageNum: current, pageSize, total } = pageResult;
salaryTableStore.getDatas(datas);
this.setState({ payload, dataSource, pageInfo: { ...pageInfo, current, pageSize, total } });
}
@ -99,6 +106,13 @@ class Index extends Component {
const childFrameObj = document.getElementById("atdTable");
childFrameObj && childFrameObj.contentWindow.postMessage(JSON.stringify({ ...payload, i18n }), "*");
};
handleSetCustomCols = () => {
const { payrollStore: { salaryTableStore } } = this.props;
this.setState({ updateSum: true }, () => {
salaryTableStore.setColSetVisible(true);
salaryTableStore.tableColSet(true);
});
};
render() {
@ -108,9 +122,9 @@ class Index extends Component {
const columnNum = total > 10 ? pageSize + 1 : total + 1;
return (
<div style={{
height: `calc((39px * ${columnNum + 2}) + 92px)`,
height: `calc((39px * ${columnNum}) + 126.84px)`,
maxHeight: "678px",
minHeight: "342px"
minHeight: "270px"
}}>
<Spin spinning={loading}>
<iframe

View File

@ -33,6 +33,7 @@ class PayrollDetail extends Component {
salarySendDetailBaseInfo: {}, showSearchAd: false, isQuery: false, conditions: [],
showTotalCell: false
};
this.listRef = null;
}
async componentDidMount() {
@ -57,10 +58,7 @@ class PayrollDetail extends Component {
key: "BTN_COLUMN",
icon: <i className="icon-coms-Custom"/>,
content: getLabel(111, "显示列定制"),
onClick: () => {
salaryTableStore.setColSetVisible(true);
salaryTableStore.tableColSet(true);
}
onClick: () => this.listRef.wrappedInstance.handleSetCustomCols()
}
];
const btns = [
@ -96,7 +94,7 @@ class PayrollDetail extends Component {
conditions={conditions}/>
</div>
{/*列表*/}
<SalaryDetailList isQuery={isQuery} showTotalCell={showTotalCell}/>
<SalaryDetailList isQuery={isQuery} showTotalCell={showTotalCell} ref={dom => this.listRef = dom}/>
</div>
</WeaTop>
);