salary-management-front/pc4mobx/hrmSalary/pages/analysisOfSalaryStatistics/components/groupSpacingEditTable.js

101 lines
2.4 KiB
JavaScript
Raw Normal View History

2023-04-12 15:53:32 +08:00
/*
* Author: 黎永顺
* name: 分组设置-定量-组距式分组编辑表格
* Description:
* Date: 2023/4/12
*/
import React, { Component } from "react";
2023-04-17 17:32:16 +08:00
import { WeaLocaleProvider, WeaTableEdit } from "ecCom";
const { getLabel } = WeaLocaleProvider;
2023-04-12 15:53:32 +08:00
class GroupSpacingEditTable extends Component {
constructor(props) {
super(props);
this.state = {
dataSource: []
};
}
componentDidMount() {
const { setting4RationGroupSpacing } = this.props;
this.setState({
dataSource: _.map(setting4RationGroupSpacing, item => {
return {
...item,
includeStart: item.includeStart ? "1" : "0",
includeEnd: item.includeEnd ? "1" : "0"
};
})
});
}
handleChangeTableData = (dataSource) => {
const { onChange } = this.props;
this.setState({ dataSource }, () => onChange(this.state.dataSource));
};
render() {
const { dataSource } = this.state;
const columns = [
{
2023-04-17 17:32:16 +08:00
title: getLabel(111, "起始值"),
2023-04-12 15:53:32 +08:00
dataIndex: "startValue",
key: "startValue",
com: [
{ label: "", key: "startValue", type: "INPUTNUMBER" }
]
},
{
2023-04-17 17:32:16 +08:00
title: getLabel(111, "含"),
2023-04-12 15:53:32 +08:00
dataIndex: "includeStart",
key: "includeStart",
com: [
{
type: "CHECKBOX",
key: "includeStart",
2023-04-17 17:32:16 +08:00
otherParams: { content: getLabel(111, "含") }
2023-04-12 15:53:32 +08:00
}
]
},
{
2023-04-17 17:32:16 +08:00
title: getLabel(111, "至"),
2023-04-12 15:53:32 +08:00
dataIndex: "to",
key: "to",
com: [
{ label: "", type: "TEXT" }
]
},
{
2023-04-17 17:32:16 +08:00
title: getLabel(111, "结束值"),
2023-04-12 15:53:32 +08:00
dataIndex: "endValue",
key: "endValue",
com: [
{ label: "", key: "endValue", type: "INPUTNUMBER" }
]
},
{
2023-04-17 17:32:16 +08:00
title: getLabel(111, "含"),
2023-04-12 15:53:32 +08:00
dataIndex: "includeEnd",
key: "includeEnd",
com: [
{
type: "CHECKBOX",
key: "includeEnd",
2023-04-17 17:32:16 +08:00
otherParams: { content: getLabel(111, "含") }
2023-04-12 15:53:32 +08:00
}
]
}
];
return (
<WeaTableEdit
draggable={true} deleteConfirm columns={columns}
2023-04-17 17:32:16 +08:00
datas={_.map(dataSource, item => ({ ...item, to: getLabel(111, "至") }))}
2023-04-12 15:53:32 +08:00
showCopy={false} onChange={this.handleChangeTableData}
/>
);
}
}
export default GroupSpacingEditTable;