薪资账套中薪资项目添加 新项时排序的问题处理

This commit is contained in:
黎永顺 2023-02-07 11:25:21 +08:00
parent 3eec4e4726
commit 7020f1ec2e
3 changed files with 6 additions and 5 deletions

View File

@ -81,15 +81,16 @@ export default class LedgerSalaryItemAddModal extends React.Component {
handleAdd = () => {
const { dataSource, selectedRowKeys } = this.state;
const { onAddSalaryItems, id, onCancel } = this.props;
const { onAddSalaryItems, id, onCancel, itemGroups } = this.props;
const arrItems = _.find(itemGroups, it => it.id === id).items || [];
let selectItems = [];
dataSource.map((item) => {
item = { ...item };
selectedRowKeys.map(key => {
selectedRowKeys.map((key, keyIdx) => {
if (item.id === key) {
item.salaryItemId = item.id;
item.key = item.id;
item.sortedIndex = dataSource.length + 1;
item.sortedIndex = arrItems.length + keyIdx + 1;
selectItems.push(item);
}
});

View File

@ -175,6 +175,7 @@ class LedgerSalaryItemNormal extends Component {
>
<LedgerSalaryItemTable
dataSource={items}
selectedRowKeys={field.selectedRowKeys || []}
onDropCategoryItem={(data) => onDropCategoryItem(field, data)}
onHandleItemhide={(data) => onHandleItemhide(field, data)}
onChangeSelectedRowKeys={(data) => onChangeSelectedRowKeys(field, data)}

View File

@ -48,8 +48,7 @@ class LedgerSalaryItemTable extends Component {
};
render() {
const { dataSource, onDropCategoryItem, onChangeSelectedRowKeys, onEditFormnul } = this.props;
const { selectedRowKeys } = this.state;
const { dataSource, onDropCategoryItem, onChangeSelectedRowKeys, onEditFormnul, selectedRowKeys } = this.props;
const rowSelection = {
selectedRowKeys,
onChange: (selectedRowKeys) => this.setState({ selectedRowKeys }, () => {