feature/2.15.1.2407.01-薪资项目以及字段管理页面改造

This commit is contained in:
黎永顺 2024-08-16 17:06:42 +08:00
parent b9e7b37439
commit 6ec8cb76ce
3 changed files with 25 additions and 8 deletions

View File

@ -324,7 +324,9 @@ export default class SalaryItem extends React.Component {
<WeaTop title={getLabel(111, "薪资项目管理")} icon={<i className="icon-coms-fa"/>} iconBgcolor="#F14A2D"
buttons={buttons} showDropIcon onDropMenuClick={this.onDropMenuClick} dropMenuDatas={dropMenuDatas}
className="salaryProjectManagement">
<div className="salaryItems_content"><SalaryItemsTable {...this.props} name={name} isQuery={isQuery}/>
<div className="salaryItems_content"><SalaryItemsTable {...this.props} name={name} isQuery={isQuery}
selectedRowKeys={selectedRowKeys}
onChange={val => this.setState({ selectedRowKeys: val })}/>
{/*<WeaNewScroll height="100%">*/}
{/* <CustomPaginationTable*/}
{/* rowKey={record => record.id}*/}

View File

@ -7,8 +7,6 @@
.salaryItems_content {
height: 100%;
padding: 16px 16px 0 16px;
//background: #e5e5e5;
}
}

View File

@ -8,7 +8,7 @@
* @description:
*/
import React, { Component } from "react";
import { WeaLocaleProvider, WeaTable } from "ecCom";
import { WeaCheckbox, WeaLocaleProvider, WeaTable } from "ecCom";
import * as API from "../../apis/item";
const getLabel = WeaLocaleProvider.getLabel;
@ -17,7 +17,7 @@ class SalaryItemsTable extends Component {
constructor(props) {
super(props);
this.state = {
loading: false, columns: [], dataSource: [],
loading: false, columns: [], dataSource: [], selectedRowKeys: [],
pageInfo: { current: 1, pageSize: 10, total: 0 }
};
}
@ -41,14 +41,20 @@ class SalaryItemsTable extends Component {
const { columns, list: dataSource, pageNum: current, pageSize, total } = data;
this.setState({
dataSource, pageInfo: { ...pageInfo, current, pageSize, total },
columns
columns: _.map(columns, o => {
if (o.dataIndex === "useDefault" || o.dataIndex === "hideDefault" || o.dataIndex === "useInEmployeeSalary") {
return { ...o, width: 80, render: text => <WeaCheckbox value={String(text)} disabled display="switch"/> };
}
return { ...o };
})
});
}
});
};
render() {
const { dataSource, columns, pageInfo } = this.state;
const { dataSource, columns, pageInfo, selectedRowKeys } = this.state;
// const { selectedRowKeys, onChange } = this.props;
const pagination = {
...pageInfo,
showTotal: total => `${getLabel(111, "共")} ${total} ${getLabel(111, "条")}`,
@ -64,7 +70,18 @@ class SalaryItemsTable extends Component {
this.setState({ pageInfo: { ...pageInfo, current } }, () => this.getItemList(this.props));
}
};
return (<WeaTable dataSource={dataSource} columns={columns} pagination={pagination}/>);
const rowSelection = {
selectedRowKeys,
onChange: (selectedRowKeys) => this.setState({ selectedRowKeys }),
getCheckboxProps: record => {
console.log(record)
return ({
disabled: !record.canDelete
})
}
};
return (<WeaTable dataSource={dataSource} columns={columns} pagination={pagination} rowSelection={rowSelection}
scroll={{ y: `calc(100vh - 155px)` }}/>);
}
}