From 5e23404b32ffb659cd798b345994d481ff5f75fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E6=B0=B8=E9=A1=BA?= <971387674@qq.com> Date: Fri, 2 Dec 2022 16:12:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E8=B5=84=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/customPaginationTable/index.js | 3 +- .../pages/payroll/payrollGrant/index.js | 192 +++++++++----- .../payrollGrant/payrollGrantDetail.js | 62 ----- .../payroll/payrollGrant/payrollGrantModal.js | 248 ------------------ .../payrollGrant/payrollWithdrawModal.js | 247 ----------------- 5 files changed, 131 insertions(+), 621 deletions(-) delete mode 100644 pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollGrantDetail.js delete mode 100644 pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollGrantModal.js delete mode 100644 pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollWithdrawModal.js diff --git a/pc4mobx/hrmSalary/components/customPaginationTable/index.js b/pc4mobx/hrmSalary/components/customPaginationTable/index.js index c7192db2..72fcddd5 100644 --- a/pc4mobx/hrmSalary/components/customPaginationTable/index.js +++ b/pc4mobx/hrmSalary/components/customPaginationTable/index.js @@ -3,8 +3,7 @@ import CustomTable from "../../components/customTable"; class CustomPaginationTable extends PureComponent { shouldComponentUpdate(nextProps, nextState, nextContext) { - if (nextProps.columnIndex && this.props.columnIndex !== nextProps.columnIndex) return false; - return true; + return !(nextProps.columnIndex && this.props.columnIndex !== nextProps.columnIndex); } render() { diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js index 101a31b1..1a6092ca 100644 --- a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js +++ b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/index.js @@ -1,15 +1,15 @@ import React from "react"; import { inject, observer } from "mobx-react"; import { toJS } from "mobx"; -import { WeaHelpfulTip, WeaTab, WeaTop } from "ecCom"; +import { WeaDropdown, WeaHelpfulTip, WeaTab, WeaTop } from "ecCom"; import { Button, Dropdown, Menu, message } from "antd"; import "./index.less"; -import PayrollGrantModal from "./payrollGrantModal"; -import PayrollWithdrawModal from "./payrollWithdrawModal"; import { getQueryString } from "../../../util/url"; import { getSearchs } from "../../../util"; import CustomPaginationTable from "../../../components/customPaginationTable"; +const { ButtonSelect } = WeaDropdown; + @inject("payrollStore") @observer export default class PayrollGrant extends React.Component { @@ -17,8 +17,6 @@ export default class PayrollGrant extends React.Component { super(props); this.state = { selectedRowKeys: [], - payrollGrantVisible: false, - payrollWithdrawVisible: false, currentId: "", selectedKey: "0" }; @@ -56,7 +54,7 @@ export default class PayrollGrant extends React.Component { }); }; - // 发送 + // 发放 handleGrant(record) { const { payrollStore } = this.props; const { currentId, selectedKey } = this.state; @@ -72,8 +70,64 @@ export default class PayrollGrant extends React.Component { }); } + /* + * Author: 黎永顺 + * Description:工资单发放 + * Params: + * Date: 2022/12/2 + */ + sendPayroll = (key) => { + const { selectedRowKeys, currentId } = this.state; + switch (key) { + case "ALL": + this.handleGrantAll(); + break; + case "SELECT": + if (selectedRowKeys.length === 0) { + message.warning("未选择发放条目"); + return; + } + this.fetchGrantPayRoll({ + ids: selectedRowKeys, + salarySendId: currentId + }); + break; + case "PART": + break; + default: + break; + } + }; + /* + * Author: 黎永顺 + * Description:工资单撤回 + * Params: + * Date: 2022/12/2 + */ + withdrawalPayroll = (key) => { + const { selectedRowKeys, currentId } = this.state; + switch (key) { + case "withdrawAll": + this.handleWithdrawAll(); + break; + case "recallSelected": + if (selectedRowKeys.length === 0) { + message.warning("未选择撤回条目"); + return; + } + this.fetchWithdrawPayroll({ + ids: selectedRowKeys, + salarySendId: currentId + }); + break; + case "partialWithdrawal": + break; + default: + break; + } + }; // 全部发送 - handleGrantAll() { + handleGrantAll = () => { const { payrollStore } = this.props; const { currentId, selectedKey } = this.state; const { grantPayroll, getInfoList } = payrollStore; @@ -86,7 +140,19 @@ export default class PayrollGrant extends React.Component { isGranted: selectedKey !== "0" }); }); - } + }; + // 发放所选 + fetchGrantPayRoll = (payload) => { + const { selectedKey, currentId } = this.state; + const { payrollStore: { grantPayroll, getInfoList } } = this.props; + grantPayroll(payload).then(() => { + getInfoList({ + salarySendId: currentId, + isGranted: selectedKey !== "0" + }); + this.setState({ selectedRowKeys: [] }); + }); + }; // 全部撤回 handleWithdrawAll() { @@ -104,19 +170,34 @@ export default class PayrollGrant extends React.Component { }); } + // 撤回所选 + fetchWithdrawPayroll = (payload) => { + const { payrollStore: { withdrawPayroll, getInfoList } } = this.props; + const { currentId, selectedKey } = this.state; + withdrawPayroll(payload).then(() => { + getInfoList({ + salarySendId: currentId, + isGranted: selectedKey !== "0" + }); + this.setState({ selectedRowKeys: [] }); + }); + }; + getColumns = () => { const { payrollStore } = this.props; const { salaryGrantTableStore: columns } = payrollStore; return [ - ...columns, - { title: "操作", key: "operation", dataIndex: "operation" } - ].map(item => { - item = { ...item }; - if (item.dataIndex === "operation") { - item.render = (text, record) => { + ...toJS(columns), + { + title: "操作", + key: "", + dataIndex: "", + display: true, + render: (text, record) => { if (record.sendStatus === "已发放") { return ( { this.handleWithdraw(record); }}> @@ -126,28 +207,23 @@ export default class PayrollGrant extends React.Component { } else { return ( { this.handleGrant(record); }}> - 发送 + 发放 ); } - }; + } } - return item; - }); + ]; }; getSearchsAdQuick() { + const { selectedKey } = this.state; const handleMenuClick = e => { switch (e.key) { - case "1": - this.setState({ payrollGrantVisible: true }); - break; - case "2": - this.setState({ payrollWithdrawVisible: true }); - break; case "3": this.handleExportAll(); break; @@ -160,31 +236,43 @@ export default class PayrollGrant extends React.Component { }; const menu = (
); - return [ - , - , + let btnDom = [