custom/钱智

This commit is contained in:
lys 2025-11-24 16:59:34 +08:00
parent 9026c7e083
commit 0f2b63c980
3 changed files with 47 additions and 9 deletions

View File

@ -264,4 +264,11 @@ export const salaryBillPreview = (params) => {
export const exportDetailList_reconfig = (params) => {
return postExportFetch("/api/bs/hrmsalary/salaryBill/send/exportDetailList", params);
};
//工资单-钱智批量发放
export const batGrant = params => {
return postFetch("/api/bs/hrmsalary/salaryBill/send/batGrant", params);
};
//工资单-钱智批量撤回
export const batWithdraw = params => {
return postFetch("/api/bs/hrmsalary/salaryBill/send/batWithdraw", params);
};

View File

@ -7,17 +7,20 @@
import React, { Component } from "react";
import { WeaLocaleProvider, WeaTable } from "ecCom";
import { Dropdown, Menu, message, Tag } from "antd";
import { getPayrollList } from "../../../../apis/payroll";
import { batGrant, batWithdraw, getPayrollList } from "../../../../apis/payroll";
import moment from "moment";
const getLabel = WeaLocaleProvider.getLabel;
const batAPI = {
batGrant, batWithdraw
};
class Index extends Component {
constructor(props) {
super(props);
this.state = {
loading: false, columns: [], dataSource: [],
pageInfo: { current: 1, pageSize: 10, total: 0 }
loading: false, columns: [], dataSource: [], selectedRowKeys: [],
pageInfo: { current: 1, pageSize: 10, total: 0 }, batLoading: false
};
}
@ -87,6 +90,19 @@ class Index extends Component {
message.warning(getLabel(543602, "请设置默认模板"));
}
break;
case "batGrant":
case "batWithdraw":
this.setState({ batLoading: true });
batAPI[key]({ salarySendIds: this.state.selectedRowKeys }).then(({ status, errormsg }) => {
this.setState({ batLoading: false });
if (status) {
message.success(getLabel(111, "操作成功!"));
this.getPayrollList(this.props);
} else {
message.error(errormsg);
}
}).catch(() => this.setState({ batLoading: false }));
break;
case "log":
this.props.onFilterLog(key, id);
break;
@ -96,7 +112,7 @@ class Index extends Component {
};
render() {
const { loading, dataSource, columns, pageInfo } = this.state;
const { loading, dataSource, columns, pageInfo, selectedRowKeys } = this.state;
const pagination = {
...pageInfo,
showTotal: total => `${getLabel(18609, "共")} ${total} ${getLabel(18256, "条")}`,
@ -114,10 +130,14 @@ class Index extends Component {
}, () => this.getPayrollList(this.props));
}
};
const rowSelection = {
selectedRowKeys,
onChange: selectedRowKeys => this.setState({ selectedRowKeys }, () => this.props.forceUpdate())
};
return (
<WeaTable
rowKey="id"
dataSource={dataSource} loading={loading} pagination={pagination}
dataSource={dataSource} loading={loading} pagination={pagination} rowSelection={rowSelection}
columns={[
...columns,
{
@ -171,4 +191,4 @@ class Index extends Component {
}
}
export default Index;
export default Index;

View File

@ -34,6 +34,7 @@ class Index extends Component {
]
}, logDialogVisible: false, filterConditions: "[]"
};
this.grantRef = null;
this.templateRef = null;
this.baseSetRef = null;
}
@ -45,13 +46,22 @@ class Index extends Component {
let reqBtns = [];
switch (selectedKey) {
case "grant":
const grantLoading = this.grantRef ? this.grantRef.state.batLoading : false;
const grantDisabled = !this.grantRef || _.isEmpty(this.grantRef.state.selectedRowKeys);
reqBtns = [
<Button type="primary" loading={grantLoading} disabled={grantDisabled} onClick={() => {
this.grantRef.handleOpts({ key: "batGrant" }, {});
}}>{getLabel(111, "批量发放")}</Button>,
<Button type="ghost" loading={grantLoading} disabled={grantDisabled} onClick={() => {
this.grantRef.handleOpts({ key: "batWithdraw" }, {});
}}>{getLabel(111, "批量撤回")}</Button>,
<GrantQuery queryParams={queryParams}
onChange={v => this.setState({
isRefresh: !isRefresh,
queryParams: { ...queryParams, ...v }
})}/>
];
!showOperateBtn && (reqBtns = reqBtns.slice(-1));
break;
case "template":
const loading = this.templateRef ? this.templateRef.state.delLoading : false;
@ -92,7 +102,8 @@ class Index extends Component {
let dom = null;
switch (selectedKey) {
case "grant":
dom = <GrantTableList queryParams={queryParams} isRefresh={isRefresh}
dom = <GrantTableList queryParams={queryParams} isRefresh={isRefresh} ref={dom => this.grantRef = dom}
forceUpdate={() => this.forceUpdate()}
onUpdateTemp={(id) => this.setState({ selectedKey: "template" }, () => {
this.templateRef.handleOpts({ key: "edit" }, { id });
})}
@ -163,4 +174,4 @@ class Index extends Component {
}
}
export default Index;
export default Index;