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 = [ 更多 ]; + if (selectedKey === "0") { + btnDom = [ + this.sendPayroll(key)} + />, + ...btnDom + ]; + } else { + btnDom = [ + this.withdrawalPayroll(key)} + />, + ...btnDom + ]; + } + return btnDom; } handleExportAll = () => { @@ -193,7 +281,6 @@ export default class PayrollGrant extends React.Component { salarySendId: this.state.currentId }); }; - handleExportSelect = () => { const { selectedRowKeys, currentId } = this.state; const { payrollStore: { exportPayroll } } = this.props; @@ -206,7 +293,6 @@ export default class PayrollGrant extends React.Component { salarySendId: currentId }); }; - // 分页 handleDataPageChange = (value) => { const { payrollStore: { getInfoList } } = this.props; @@ -363,30 +449,12 @@ export default class PayrollGrant extends React.Component { }} /> - {this.state.payrollGrantVisible && - { - this.setState({ payrollGrantVisible: false }); - }} - />} - - {this.state.payrollWithdrawVisible && - { - this.setState({ payrollWithdrawVisible: false }); - }} - />} ); } } - -const TitleHelp = (props) => { +export const TitleHelp = (props) => { const { salarySobCycle } = props; const { salaryCycle = {}, attendCycle = {} } = salarySobCycle; return
diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollGrantDetail.js b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollGrantDetail.js deleted file mode 100644 index abe3003f..00000000 --- a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollGrantDetail.js +++ /dev/null @@ -1,62 +0,0 @@ -import React from 'react' -import { payrollGrantDetailColumns, dataSource} from '../columns' - -export default class PayrollGrantDeatail extends React.Component { - - - render() { - const handleMenuClick = () => { - - } - const menu = ( - - 导出选中 - - ); - const renderRightOperation = () => { - return ( -
- 导出全部 - -
- ) - } - return ( -
- -
-
- 薪资所属月:2021-11 - - 工资单模板:上海泛微工资单1 -
- -
- 已发放:111/1111 - 未确认:111 -
-
- -
- - - - ) - } -} \ No newline at end of file diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollGrantModal.js b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollGrantModal.js deleted file mode 100644 index afb49d94..00000000 --- a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollGrantModal.js +++ /dev/null @@ -1,248 +0,0 @@ -import React from "react"; -import { WeaDialog, WeaHelpfulTip, WeaInputSearch, WeaTable } from "ecCom"; -import { Dropdown, Menu, message } from "antd"; -import { inject, observer } from "mobx-react"; -import "./index.less"; - -@inject("payrollStore") -@observer -export default class payrollGrantModal extends React.Component { - constructor(props) { - super(props); - this.state = { - selectedRowKeys: [], - current: 1, - searchValue: "" - }; - } - - // 撤回 - handleWithdraw(record) { - const { payrollStore } = this.props; - const { withdrawPayroll, batchSendInfoList } = payrollStore; - withdrawPayroll({ - ids: [record.id], - salarySendId: this.props.sendId - }).then(() => { - batchSendInfoList({ salarySendId: this.props.sendId }); - }); - } - - // 发送 - handleGrant(record) { - const { payrollStore } = this.props; - const { grantPayroll, batchSendInfoList } = payrollStore; - grantPayroll({ - ids: [record.id], - salarySendId: this.props.sendId - }).then(() => { - batchSendInfoList({ salarySendId: this.props.sendId }); - }); - } - - componentWillMount() { - const { payrollStore: { batchSendInfoList } } = this.props; - batchSendInfoList({ salarySendId: this.props.sendId }); - } - - getColumns() { - const { payrollStore } = this.props; - const { canGrantColumns } = payrollStore; - return [ - ...canGrantColumns, - { title: "操作", key: "operation", dataIndex: "operation" } - ].map(item => { - if (item.key == "operation") { - item.render = (text, record) => { - if (record.sendStatus == "已发放") { - return ( - { - this.handleWithdraw(record); - }}> - 撤回 - - ); - } else { - return ( - { - this.handleGrant(record); - }}> - 发送 - - ); - } - }; - } - return item; - }); - } - - onSelectChange = value => { - this.setState({ - selectedRowKeys: value - }); - }; - - // 发放 - fetchGrantPayRoll(payload) { - const { payrollStore: { grantPayroll } } = this.props; - grantPayroll(payload).then(() => { - const { payrollStore: { getInfoList } } = this.props; - getInfoList({ - salarySendId: this.props.sendId - }); - this.props.onCancel && this.props.onCancel(); - }); - } - - handleMenuClick(e) { - const { selectedRowKeys } = this.state; - const { payrollStore: { grantPayroll } } = this.props; - if (selectedRowKeys.length == 0) { - message.warning("未选择条目"); - return; - } - this.fetchGrantPayRoll({ - ids: selectedRowKeys, - salarySendId: this.props.sendId - }); - } - - handleGrantAll() { - this.fetchGrantPayRoll({ salarySendId: this.props.sendId }); - } - - handleSearch(value) { - const { payrollStore: { batchSendInfoList } } = this.props; - batchSendInfoList({ - salarySendId: this.props.sendId, - keyword: value, - current: this.state.current - }); - } - - // 分页 - handleDataPageChange(value) { - this.setState({ current: value }); - const { payrollStore: { batchSendInfoList } } = this.props; - batchSendInfoList({ salarySendId: this.props.sendId, current: value }); - } - - render() { - const menu = ( - this.handleMenuClick(e)}> - 发放所选 - - ); - - const { payrollStore } = this.props; - const { - salarySendDetailBaseInfo, - canGrantDataSource, - canGrantPageInfo - } = payrollStore; - const { selectedRowKeys } = this.state; - - const rowSelection = { - selectedRowKeys, - onChange: this.onSelectChange.bind(this) - }; - - return ( - { - this.handleGrantAll(); - }}> - 全部发放 - - ]} - onCancel={() => { - this.props.onCancel(); - }}> -
-
-
- - 薪资所属月:{salarySendDetailBaseInfo.salaryMonth && - salarySendDetailBaseInfo.salaryMonth - .year}-{salarySendDetailBaseInfo.salaryMonth && - salarySendDetailBaseInfo.salaryMonth.monthValue} - - - - 工资单模板:{salarySendDetailBaseInfo.template} - -
- { - this.setState({ searchValue: value }); - }} - placeholder="请输入姓名" - onSearch={value => { - this.handleSearch(value); - }} - /> -
-
- { - this.handleDataPageChange(value); - }, - total: canGrantPageInfo.total, - current: canGrantPageInfo.pageNum, - showTotal: total => `共 ${total} 条` - }} - /> -
-
-
- ); - } -} diff --git a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollWithdrawModal.js b/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollWithdrawModal.js deleted file mode 100644 index 5553b78a..00000000 --- a/pc4mobx/hrmSalary/pages/payroll/payrollGrant/payrollWithdrawModal.js +++ /dev/null @@ -1,247 +0,0 @@ -import React from "react"; -import { WeaDialog, WeaHelpfulTip, WeaInputSearch, WeaTable } from "ecCom"; -import { Dropdown, Menu } from "antd"; -import { inject, observer } from "mobx-react"; - -@inject("payrollStore") -@observer -export default class PayrollWithdrawModal extends React.Component { - constructor(props) { - super(props); - this.state = { - selectedRowKeys: [], - current: 1 - }; - } - - componentWillMount() { - const { payrollStore } = this.props; - const { batchWithdrawInfoList } = payrollStore; - batchWithdrawInfoList({ salarySendId: this.props.sendId }); - } - - // 撤回 - handleWithdraw(record) { - const { payrollStore } = this.props; - const { withdrawPayroll, batchWithdrawInfoList } = payrollStore; - withdrawPayroll({ - ids: [record.id], - salarySendId: this.props.sendId - }).then(() => { - batchWithdrawInfoList({ salarySendId: this.props.sendId }); - }); - } - - // 发送 - handleGrant(record) { - const { payrollStore } = this.props; - const { grantPayroll, batchWithdrawInfoList } = payrollStore; - grantPayroll({ - ids: [record.id], - salarySendId: this.props.sendId - }).then(() => { - batchWithdrawInfoList({ salarySendId: this.props.sendId }); - }); - } - - getColumns() { - const { payrollStore } = this.props; - const { canWidthdrawColumns } = payrollStore; - return [ - ...canWidthdrawColumns, - { title: "操作", key: "operation", dataIndex: "operation" } - ].map(item => { - if (item.key == "operation") { - item.render = (text, record) => { - if (record.sendStatus == "已发放") { - return ( - { - this.handleWithdraw(record); - }}> - 撤回 - - ); - } else { - return ( - { - this.handleGrant(record); - }}> - 发送 - - ); - } - }; - } - return item; - }); - } - - onSelectChange = value => { - this.setState({ - selectedRowKeys: value - }); - }; - - // 撤回 - fetchWithdrawPayroll(payload) { - const { payrollStore: { grantPayroll, withdrawPayroll } } = this.props; - withdrawPayroll(payload).then(() => { - const { payrollStore: { getInfoList } } = this.props; - getInfoList({ - salarySendId: this.props.sendId - }); - this.props.onCancel && this.props.onCancel(); - }); - } - - handleMenuClick(e) { - const { selectedRowKeys } = this.state; - const { payrollStore: { grantPayroll } } = this.props; - if (selectedRowKeys.length == 0) { - message.warning("未选择条目"); - return; - } - this.fetchWithdrawPayroll({ - ids: selectedRowKeys, - salarySendId: this.props.sendId - }); - } - - handleWithdrawAll() { - this.fetchWithdrawPayroll({ salarySendId: this.props.sendId }); - } - - // 分页 - handleDataPageChange(value) { - this.setState({ current: value }); - const { payrollStore } = this.props; - const { batchWithdrawInfoList } = payrollStore; - batchWithdrawInfoList({ salarySendId: this.props.sendId, current: value }); - } - - handleSearch(value) { - const { payrollStore: { batchWithdrawInfoList } } = this.props; - batchWithdrawInfoList({ - salarySendId: this.props.sendId, - keyword: value, - current: this.state.current - }); - } - - render() { - const menu = ( - this.handleMenuClick(e)}> - 撤回所选 - - ); - const { payrollStore } = this.props; - const { - salarySendDetailBaseInfo, - canWidthdrawColumns, - canWithdrawDataSource, - canWithdrawPageInfo - } = payrollStore; - const { selectedRowKeys } = this.state; - const rowSelection = { - selectedRowKeys, - onChange: this.onSelectChange.bind(this) - }; - - return ( - { - this.handleWithdrawAll(); - }}> - 全部撤回 - - ]} - onCancel={() => { - this.props.onCancel(); - }}> -
-
-
- - 薪资所属月:{salarySendDetailBaseInfo.salaryMonth && - salarySendDetailBaseInfo.salaryMonth - .year}-{salarySendDetailBaseInfo.salaryMonth && - salarySendDetailBaseInfo.salaryMonth.monthValue} - - - - 工资单模板:{salarySendDetailBaseInfo.template} - -
- { - this.setState({ searchValue: value }); - }} - onSearch={value => { - this.handleSearch(value); - }} - /> -
-
-
- { - this.handleDataPageChange(value); - }, - total: canWithdrawPageInfo.total, - current: canWithdrawPageInfo.pageNum, - showTotal: total => `共 ${total} 条` - }} - /> -
-
- ); - } -}