/*
* Author: 黎永顺
* name: 薪资项目-员工基本信息
* Description:
* Date: 2022/12/13
*/
import React, { Component } from "react";
import { WeaHelpfulTip, WeaSearchGroup, WeaSelect, WeaSortable } from "ecCom";
import { Button, Icon } from "antd";
import { empFieldList } from "../../../apis/ledger";
class LedgerSalaryItemBaseInfo extends Component {
constructor(props) {
super(props);
this.state = {
empFieldListOptions: []
};
}
componentDidMount() {
this.empFieldList();
}
empFieldList = () => {
empFieldList().then(({ status, data }) => {
if (status) {
const dataFilter = _.filter(data, it => !["taxAgentName", "username", "departmentName"].includes(it.id));
this.setState({
empFieldListOptions: _.map(dataFilter, it => ({ key: it.id, showname: it.name }))
});
}
});
};
handleAddEmpList = (key, showname) => {
const { dataSource, onChangeSortableList } = this.props;
const obj = {
canDelete: true,
fieldId: key,
fieldName: showname,
id: dataSource.length,
salarySobId: "",
sortedIndex: dataSource.length
};
onChangeSortableList([...dataSource, obj]);
};
handleDeleteEmplist = (item) => {
const { dataSource, onChangeSortableList } = this.props;
onChangeSortableList(_.xorWith(dataSource, [item], _.isEqual));
};
render() {
const { dataSource, onChangeSortableList, onPreview } = this.props;
const { empFieldListOptions } = this.state;
return (