39 lines
1.1 KiB
JavaScript
39 lines
1.1 KiB
JavaScript
|
|
import React, { Component } from "react";
|
||
|
|
import { Menu, message } from "antd";
|
||
|
|
import "../index.less";
|
||
|
|
|
||
|
|
class ExportMenu extends Component {
|
||
|
|
componentDidMount() {}
|
||
|
|
|
||
|
|
handleClick = ({ key }) => this[key]();
|
||
|
|
handleExportAll = () => {
|
||
|
|
let url = `${window.location.origin}/api/bs/hrmsalary/salaryArchive/exportList?ids=`;
|
||
|
|
const { searchItemsValue } = this.props;
|
||
|
|
const fileds = Object.keys(searchItemsValue);
|
||
|
|
_.forEach(fileds, it => {
|
||
|
|
url = `${url}&${it}=${searchItemsValue[it]}`;
|
||
|
|
});
|
||
|
|
window.open(url, "_self");
|
||
|
|
};
|
||
|
|
handleExportSelect = () => {
|
||
|
|
const { selectedRowKeys } = this.props;
|
||
|
|
if (selectedRowKeys.length === 0) {
|
||
|
|
message.warning("未选择条目");
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
const url = `${window.location.origin}/api/bs/hrmsalary/salaryArchive/exportList?ids=${selectedRowKeys.join(",")}`;
|
||
|
|
window.open(url, "_self");
|
||
|
|
};
|
||
|
|
|
||
|
|
render() {
|
||
|
|
return (
|
||
|
|
<Menu className="dropdownMenuWrapper" onClick={this.handleClick}>
|
||
|
|
<Menu.Item key="handleExportAll">导出全部</Menu.Item>
|
||
|
|
<Menu.Item key="handleExportSelect">导出选中</Menu.Item>
|
||
|
|
</Menu>
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
export default ExportMenu;
|