salary-management-front/pc4mobx/hrmSalary/pages/ledgerPage/components/ledgerSalaryItemTable.js

136 lines
3.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* Author: 黎永顺
* name: 薪资项目-列表数据
* Description:
* Date: 2022/12/13
*/
import React, { Component } from "react";
import { WeaCheckbox, WeaHelpfulTip, WeaTable } from "ecCom";
class LedgerSalaryItemTable extends Component {
constructor(props) {
super(props);
this.state = {
selectedRowKeys: []
};
}
/*
* Author: 黎永顺
* Description: 列表操作隐藏复选框
* Params:
* Date: 2022/12/14
*/
handleChangeItem = (value, id) => {
const { dataSource, onHandleItemhide } = this.props;
onHandleItemhide(
_.map([...dataSource], item => {
if (id === item.id) {
return {
...item,
itemHide: String(value)
};
}
return { ...item };
})
);
};
handleChangeAllItem = (value) => {
const { dataSource, onHandleItemhide } = this.props;
onHandleItemhide(
_.map([...dataSource], item => {
return {
...item,
itemHide: String(value)
};
})
);
};
render() {
const { dataSource, onDropCategoryItem, onChangeSelectedRowKeys, onEditFormnul } = this.props;
const { selectedRowKeys } = this.state;
const rowSelection = {
selectedRowKeys,
onChange: (selectedRowKeys) => this.setState({ selectedRowKeys }, () => {
onChangeSelectedRowKeys(this.state.selectedRowKeys);
}),
getCheckboxProps: record => ({
disabled: !record.canDelete
})
};
const checkValue = _.every(dataSource, it => it.itemHide && it.itemHide === "1") ? "1" : "0";
const columns = [
{
title: "名称",
dataIndex: "name",
key: "name"
},
{
title: <span>
<span style={{ marginRight: 8 }}>核算公式</span>
<WeaHelpfulTip title={<HelpContent/>} placement="bottom" width={200}/>
</span>,
dataIndex: "formulaContent",
key: "formulaContent",
render: (text, record) => {
if (record.canEdit) {
return (
<span className="linkWapper">
<a href="javascript: void(0);" onClick={() => onEditFormnul(record)}> {text} </a>
</span>
);
} else {
return <span> {text} </span>;
}
}
},
{
title: "个税申请表对应字段",
dataIndex: "taxDeclarationColumn",
key: "taxDeclarationColumn"
},
{
title: <span>
<WeaCheckbox
value={checkValue}
onChange={value => this.handleChangeAllItem(value)}
/>
<span style={{ marginLeft: 8 }}>隐藏</span>
</span>,
dataIndex: "itemHide",
key: "itemHide",
render: (text, record) => <WeaCheckbox
value={text ? String(text) : !text ? "0" : "1"}
onChange={value => this.handleChangeItem(value, record.id)}
/>
}
];
return (
<WeaTable
rowKey="id"
rowSelection={rowSelection}
dataSource={dataSource}
columns={columns}
onRow={(record, index) => ({
index,
moveRow: record
})}
pagination={false}
onDrop={onDropCategoryItem}
draggable={true}
/>
);
}
}
export default LedgerSalaryItemTable;
const HelpContent = () => {
return <span>
<span>1新建薪资账套时核算公式与薪资项目管理菜单一致</span><br/>
<span>2取值方式为公式的薪资项目核算公式显示为具体公式点击公式可编辑公式核算时按照当前薪资项目的公式进行核算</span><br/>
<span>3薪资账套内的薪资项目的公式或SQL的修改或公式的修改都不影响薪资项目管理菜单的薪资项目取值方式或公式只对当前账套生效</span><br/>
</span>;
};