/* * Author: 黎永顺 * name: 社保福利台账-核算-导入表头设置 * Description: * Date: 2024/3/5 */ import React, { Component } from "react"; import { Button, Col, Row } from "antd"; import { WeaCheckbox, WeaDialog, WeaLocaleProvider } from "ecCom"; import "./index.less"; const getLabel = WeaLocaleProvider.getLabel; class ImportHeaderSetDialog extends Component { constructor(props) { super(props); this.state = { itemsCheckeds: [], showOnlyChecked: false }; } componentWillReceiveProps(nextProps, nextContext) { if (nextProps.visible !== this.props.visible && nextProps.visible) { this.setState({ itemsCheckeds: nextProps.selectItems }); } else { this.setState({ itemsCheckeds: [], showOnlyChecked: false }); } } handleShowOnlyChecked = (showOnlyChecked) => this.setState({ showOnlyChecked: !!Number(showOnlyChecked) }); handleSelectAll = (checked) => { const { itemsByGroup } = this.props; if (checked === "1") { this.setState({ itemsCheckeds: _.map(itemsByGroup, it => it.fieldId) }); } else { this.setState({ itemsCheckeds: [] }); } }; render() { const { showOnlyChecked, itemsCheckeds } = this.state; const { itemsByGroup } = this.props; let dataSource = _.map(itemsByGroup, it => { return { ...it, checked: itemsCheckeds.includes(it.fieldId) }; }); if (showOnlyChecked) { dataSource = _.filter(dataSource, it => !!it.checked); } return ( this.props.onAdd(itemsCheckeds)}>{getLabel(111, "添加")}, ]} bottomLeft={ } > { { !_.isEmpty(dataSource) ? _.map(dataSource, it => { const { fieldId, salaryItemName, checked } = it; return this.setState({ itemsCheckeds: _.xorWith(itemsCheckeds, [fieldId], _.isEqual) })}/> ; }) : 暂无数据 } } ); } } export default ImportHeaderSetDialog;