/* * Author: 黎永顺 * name: 补差 * Description: * Date: 2022/12/16 */ import React, { Component } from "react"; import RegTop from "./regTop"; import { message, Modal } from "antd"; import * as API from "../../../../apis/standingBook"; import { calcPageNo } from "../../../../util"; import RegList from "./regList"; import RegEditDetial from "./regEditDetial"; import AddCompensationPersonnelDialog from "./addCompensationPersonnelDialog"; import StandingBookCalcImportDialog from "./standingBookCalcImportDialog"; import { convertToUrlString } from "../../../../util/url"; import "./index.less"; class MakeupDifference extends Component { constructor(props) { super(props); this.state = { selectKey: [], loading: { save: false }, importDiffModal: { visible: false, fieldUrl: "getBalanceWelfareList", tmpUrl: "exportSiaccountWelfarebalanceimporttemplatetetemplate", cacheUrl: "cacheBalanceWelfareList", importUrl: "importBalanceInsuranceDetail", importparams: {}, ..._.pick(this.props, ["billMonth", "paymentOrganization"]) }, returnEditPersonSlide: { title: "", editId: "", visible: false }, addPersonalDialog: { visible: false, paymentOrganization: "", billMonth: "" } }; this.diffListRef = null; this.regTopRef = null; } delBalance = () => { const { selectKey: ids } = this.state; const payload = { ids, ..._.pick(this.props, ["billMonth", "paymentOrganization", "fsdSbjndw"]) }; API.delBalance(payload).then(({ status, errormsg }) => { if (status) { message.success("删除成功"); const current = calcPageNo(this.diffListRef.state.pageInfo.total, this.diffListRef.state.pageInfo.current, 10, ids.length); this.diffListRef.recessionList({ current }); this.diffListRef.handleResetSelectRowKeys([]); this.setState({ selectKey: [] }); } else { message.error(errormsg || "删除失败"); } }); }; handleChangeOpt = (key) => { const { importDiffModal, addPersonalDialog } = this.state; const name = this.regTopRef.state.name; const workcode = this.regTopRef.state.workcode; const departmentIds = this.regTopRef.state.departmentIds ? this.regTopRef.state.departmentIds.split(",") : []; const subCompanyIds = this.regTopRef.state.subCompanyIds ? this.regTopRef.state.subCompanyIds.split(",") : []; switch (key) { case "delete": Modal.confirm({ title: "信息确认", content: "确定删除数据吗?", onOk: () => this.delBalance() }); break; case "import": this.setState({ importDiffModal: { ...importDiffModal, visible: true, importparams: { ..._.pick(this.props, ["billMonth", "fsdSbjndw"]) } } }); break; case "export": const url = `/api/bs/hrmsalary/welfare/balance/export?${convertToUrlString(_.pick(this.props, ["billMonth", "paymentOrganization", "fsdSbjndw"]))}`; window.open(url, "_blank"); break; case "search": this.diffListRef.recessionList({ userName: name, workcode, departmentIds, subCompanyIds, current: 1 }); break; case "add": this.setState({ addPersonalDialog: { ...addPersonalDialog, ..._.pick(this.props, ["billMonth", "paymentOrganization", "fsdSbjndw"]), visible: true } }); break; default: break; } }; handleEdit = (record) => { const { userName, id: editId } = record; const { returnEditPersonSlide } = this.state; this.setState({ returnEditPersonSlide: { ...returnEditPersonSlide, visible: true, title: userName, editId } }); }; handleCloseModal = (refreshList = false) => { const { returnEditPersonSlide } = this.state; this.setState({ returnEditPersonSlide: { ...returnEditPersonSlide, visible: false, title: "", editId: "" } }, () => { refreshList && this.diffListRef.recessionList(); }); }; render() { const { selectKey, importDiffModal, returnEditPersonSlide, addPersonalDialog } = this.state; return (
this.regTopRef = dom} onChange={this.handleChangeOpt} selectKey={selectKey} />
this.diffListRef = dom} onChangeRowkey={(selectKey) => this.setState({ selectKey })} onEdit={this.handleEdit} /> {/*编辑弹框*/} {/*添加补差人员*/} this.setState({ addPersonalDialog: { ...addPersonalDialog, visible: false } }, () => isRefresh && this.diffListRef.recessionList())} /> {/*导入补差*/} this.setState({ importDiffModal: { ...importDiffModal, visible: false } }, () => isInit && this.diffListRef.recessionList())}/>
); } } export default MakeupDifference;