salary-management-front/pc4mobx/hrmSalary/components/importDialog/components/moveInResult.js

57 lines
2.2 KiB
JavaScript
Raw Normal View History

2024-08-16 16:37:45 +08:00
/*
* 薪酬迁入结果展示
*
* @Author: 黎永顺
* @Date: 2024/8/16
* @Wechat:
* @Email: 971387674@qq.com
* @description:
*/
import React, { Component } from "react";
2024-08-19 10:27:02 +08:00
import { WeaLocaleProvider, WeaTable } from "ecCom";
2024-08-16 16:37:45 +08:00
const getLabel = WeaLocaleProvider.getLabel;
class MoveInResult extends Component {
2024-08-19 10:27:02 +08:00
downloadTxtfile = (value, type) => {
if (!value) return;
const element = document.createElement("a");
const file = new Blob([value], { type: "text/plain" });
element.href = URL.createObjectURL(file);
element.download = `导入${type}信息.txt`;
document.body.appendChild(element);
element.click();
};
2024-08-16 16:37:45 +08:00
render() {
2024-08-19 10:27:02 +08:00
const { dataSource } = this.props;
2024-08-16 16:37:45 +08:00
return (
2024-08-19 10:27:02 +08:00
<WeaTable
columns={[
{ title: getLabel(111, "导入信息"), dataIndex: "message" },
{
2024-08-19 16:39:14 +08:00
title: getLabel(111, "下载信息"), dataIndex: "download", width: 250,
2024-08-19 10:27:02 +08:00
render: (text, record) => (<React.Fragment>
2024-08-19 10:42:54 +08:00
<span
style={{ marginRight: 16, color: "#0BB746", cursor: "pointer", display: "inline-block", minWidth: 60 }}
onClick={() => this.downloadTxtfile(record.success.join("\n"), getLabel(111, "成功"))}>
2024-08-19 10:27:02 +08:00
<i className="iconfont icon-successful"/><span
style={{ marginLeft: 8 }}>{record.success.length}</span></span>
2024-08-19 10:42:54 +08:00
<span
style={{ marginRight: 16, color: "#E6960C", cursor: "pointer", display: "inline-block", minWidth: 60 }}
onClick={() => this.downloadTxtfile(record.warning.join("\n"), getLabel(111, "警告"))}><i
2024-08-19 10:27:02 +08:00
className="iconfont icon-warning"/><span style={{ marginLeft: 8 }}>{record.warning.length}</span></span>
2024-08-19 10:42:54 +08:00
<span style={{ color: "#CF3736", cursor: "pointer", display: "inline-block", minWidth: 60 }}
2024-08-19 10:27:02 +08:00
onClick={() => this.downloadTxtfile(record.error.join("\n"), getLabel(111, "错误"))}><i
className="iconfont icon-error"/><span style={{ marginLeft: 8 }}>{record.error.length}</span></span>
</React.Fragment>)
}
]}
dataSource={dataSource} pagination={false} bordered scroll={{ y: `calc(100vh - 333px)` }}
/>
2024-08-16 16:37:45 +08:00
);
}
}
export default MoveInResult;