feature/2.9.42309.01-薪资核算详情页面列表改造(页面编辑)

This commit is contained in:
黎永顺 2023-09-14 14:05:40 +08:00
parent ef16acd638
commit 4769df4cfd
1 changed files with 81 additions and 10 deletions

View File

@ -5,13 +5,20 @@
* Date: 2023/9/13
*/
import React, { Component } from "react";
import { WeaButtonIcon, WeaHelpfulTip, WeaLocaleProvider, WeaTab, WeaTable, WeaTools } from "ecCom";
import { WeaBrowser, WeaButtonIcon, WeaHelpfulTip, WeaLocaleProvider, WeaTab, WeaTable, WeaTools } from "ecCom";
import { inject, observer } from "mobx-react";
import { Button } from "antd";
import { Button, message, Modal } from "antd";
import BaseInfo from "./baseInfo";
import { acctemployeeList, addedemployeeList, reducedemployeeList } from "../../../../../apis/calculate";
import {
acctemployeeList,
addedemployeeList,
deleteAcctemployee,
reducedemployeeList,
saveAcctemployee
} from "../../../../../apis/calculate";
import { personConfirmSearchConditions } from "./condition";
import { getSearchs } from "../../../../../util";
import { convertToUrlString } from "../../../../../util/url";
const getKey = WeaTools.getKey;
const getLabel = WeaLocaleProvider.getLabel;
@ -70,20 +77,26 @@ class Index extends Component {
}
renderTabBtns = () => {
const { selectedKey } = this.state;
const { selectedKey, selectedRowKeys } = this.state;
let tabBtns = [];
switch (selectedKey) {
case "range":
tabBtns = [
<WeaButtonIcon buttonType="del" type="primary" title={getLabel(111, "批量删除")}/>,
<WeaButtonIcon buttonType="add" type="primary" title={getLabel(1421, "新增")}/>,
<Button type="primary">{getLabel(17416, "导出")}</Button>
<WeaButtonIcon buttonType="del" type="primary" title={getLabel(111, "批量删除")}
disabled={_.isEmpty(selectedRowKeys)}
onClick={() => this.handleDeletePCitem()}/>,
<WeaBrowser type={17} title={getLabel(383694, "添加人员")} isSingle={false} customized
onChange={ids => ids && this.handleUserBrowserChange(ids.split(","))}
>
<WeaButtonIcon buttonType="add" type="primary" title={getLabel(1421, "新增")}/>
</WeaBrowser>,
<Button type="primary" onClick={this.handleExport}>{getLabel(17416, "导出")}</Button>
];
break;
case "add":
case "sub":
tabBtns = [
<Button type="primary">{getLabel(17416, "导出")}</Button>
<Button type="primary" onClick={this.handleExport}>{getLabel(17416, "导出")}</Button>
];
break;
default:
@ -101,13 +114,70 @@ class Index extends Component {
positionIds: !_.isEmpty(positionIds) ? positionIds.split(",") : [],
statuses: !_.isEmpty(statuses) ? statuses.split(",") : []
};
this.setState({ loading: true });
api[selectedKey](payload).then(({ status, data }) => {
this.setState({ loading: false });
if (status) {
const { columns, list: dataSource = [], pageNum: current, pageSize, total } = data;
this.setState({
columns, dataSource, pageInfo: { ...pageInfo, current, pageSize, total }
});
}
}).catch(() => this.setState({ loading: false }));
};
handleDeletePCitem = (ids) => {
Modal.confirm({
title: getLabel(131329, "信息确认"),
content: getLabel(388758, "确认要删除吗?"),
onOk: () => {
const { selectedRowKeys } = this.state;
const { routeParams: { salaryAcctRecordId } } = this.props;
deleteAcctemployee({ salaryAcctRecordId, ids: !_.isEmpty(ids) ? ids : selectedRowKeys })
.then(({ status, errormsg }) => {
if (status) {
message.success(getLabel(502230, "删除成功!"));
this.queryPCList();
_.isNil(ids) && this.setState({ selectedRowKeys: [] });
} else {
message.error(errormsg || getLabel(20462, "删除失败!"));
}
});
}
});
};
/*
* Author: 黎永顺
* Description: 人员确认导出
* Params:
* Date: 2023/9/14
*/
handleExport = () => {
let url = "";
const { routeParams: { salaryAcctRecordId }, calculateStore: { PCSearchForm } } = this.props;
if (this.state.selectedKey === "range") {
url = `${window.location.origin}/api/bs/hrmsalary/salaryacct/acctemployee/export?salaryAcctRecordId=${salaryAcctRecordId}&${convertToUrlString(PCSearchForm.getFormParams())}`;
} else if (this.state.selectedKey === "sub") {
url = `${window.location.origin}/api/bs/hrmsalary/salaryacct/reducedemployee/export?salaryAcctRecordId=${salaryAcctRecordId}&${convertToUrlString(PCSearchForm.getFormParams())}`;
} else {
url = `${window.location.origin}/api/bs/hrmsalary/salaryacct/addedemployee/export?salaryAcctRecordId=${salaryAcctRecordId}&${convertToUrlString(PCSearchForm.getFormParams())}`;
}
window.open(url, "_blank");
};
/*
* Author: 黎永顺
* Description: 添加人员确认
* Params:
* Date: 2023/9/14
*/
handleUserBrowserChange = (employeeIds) => {
const { routeParams: { salaryAcctRecordId } } = this.props;
saveAcctemployee({ salaryAcctRecordId, employeeIds }).then(({ status, errormsg }) => {
if (status) {
message.success(getLabel(541531, "添加成功!"));
this.queryPCList();
} else {
message.error(errormsg || getLabel(111, "添加失败!"));
}
});
};
@ -183,7 +253,7 @@ class Index extends Component {
/>
<WeaTable
dataSource={dataSource} loading={loading} rowSelection={rowSelection} pagination={pagination}
scroll={{ y: `calc(100vh - 365px)` }}
scroll={{ y: `calc(100vh - 365px)` }} rowKey="id"
columns={[..._.map(columns, item => {
let width = "";
const { dataIndex } = item;
@ -203,7 +273,8 @@ class Index extends Component {
title: getLabel(30585, "操作"),
width: 120,
render: (_, record) => (
<a href="javascript:void(0);">{getLabel(535052, "删除")}</a>
<a href="javascript:void(0);"
onClick={() => this.handleDeletePCitem([record.id])}>{getLabel(535052, "删除")}</a>
)
}
]}