/* * Author: 黎永顺 * name: 补差 * Description: * Date: 2022/12/16 */ import React, { Component } from "react"; import RegTop from "./regTop"; import { message, Modal } from "antd"; import { WeaNewScroll } from "ecCom"; import { getQueryString } from "../../../../util/url"; import * as API from "../../../../apis/standingBook"; import { calcPageNo } from "../../../../util"; import RegList from "./regList"; import RegEditDetial from "./regEditDetial"; import AcctResultImportModal from "../../../calculateDetail/acctResult/importModal/acctResultImportModal"; import "./index.less"; class MakeupDifference extends Component { constructor(props) { super(props); this.state = { selectKey: [], fieldData: {}, returnEditPersonSlide: { title: "", editId: "", visible: false }, importDiffModal: { visible: false }, loading: { save: false } }; this.diffListRef = null; this.regTopRef = null; } delBalance = () => { const { selectKey: ids } = this.state; const billMonth = getQueryString("billMonth"); const paymentOrganization = getQueryString("paymentOrganization"); const payload = { ids, billMonth, paymentOrganization }; 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 } = this.state; const name = this.regTopRef.state.name; const workcode = this.regTopRef.state.workcode; const billMonth = getQueryString("billMonth"); const paymentOrganization = getQueryString("paymentOrganization"); switch (key) { case "delete": Modal.confirm({ title: "信息确认", content: "确定删除数据吗?", onOk: () => this.delBalance() }); break; case "import": this.setState({ importDiffModal: { ...importDiffModal, visible: true } }); break; case "export": const url = `${window.location.origin}/api/bs/hrmsalary/welfare/balance/export?billMonth=${billMonth}&paymentOrganization=${paymentOrganization}`; window.open(url, "_self"); break; case "search": this.diffListRef.recessionList({ userName: name, workcode, current: 1 }); 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 billMonth = getQueryString("billMonth"); const { selectKey, importDiffModal, fieldData, returnEditPersonSlide } = this.state; return (
this.regTopRef = dom} billMonth={billMonth} onChange={this.handleChangeOpt} selectKey={selectKey} />
this.diffListRef = dom} onChangeRowkey={(selectKey) => this.setState({ selectKey })} onEdit={this.handleEdit} /> {/*编辑弹框*/} {/*导入补差*/} { importDiffModal.visible && this.setState({ fieldData })} onCancel={() => { this.setState({ importDiffModal: { ...importDiffModal, visible: false }, fieldData: {} }, () => { const name = this.regTopRef.state.name; this.diffListRef.recessionList({ userName: name }); }); }} isStandingBook standingBookType="difference" /> }
); } } export default MakeupDifference;