feature/2.15.1.2407.01-导入工具

This commit is contained in:
黎永顺 2024-08-19 10:27:02 +08:00
parent f730cba8de
commit 1d26ef8176
2 changed files with 65 additions and 33 deletions

View File

@ -16,39 +16,42 @@ class ImpStep3 extends Component {
const { importResult } = this.props;
return (
<div className="weapp-batch-impsteps-picker-content-imp-step3">
<MoveInResult/>
{
!_.isEmpty(importResult) ?
<div className="weapp-batch-impsteps-picker-spinText">
<p><img src={successImg} alt=""/></p>
importResult.results ? <MoveInResult dataSource={importResult.results}/> :
<React.Fragment>
{
importResult.successCount &&
<p>
<span>{getLabel(389249, "已导入")}</span>
<span style={{ color: "green" }}> {importResult.successCount}</span>&nbsp;&nbsp;
<span>{`${getLabel(30690, "条数据")},${getLabel(25009, "失败")}`}</span>
<span
style={{ color: "red" }}> {importResult.errorCount}&nbsp;&nbsp;</span>{getLabel(30690, "")}
</p>
!_.isEmpty(importResult) ?
<div className="weapp-batch-impsteps-picker-spinText">
<p><img src={successImg} alt=""/></p>
{
importResult.successCount &&
<p>
<span>{getLabel(389249, "已导入")}</span>
<span style={{ color: "green" }}> {importResult.successCount}</span>&nbsp;&nbsp;
<span>{`${getLabel(30690, "条数据")},${getLabel(25009, "失败")}`}</span>
<span
style={{ color: "red" }}> {importResult.errorCount}&nbsp;&nbsp;</span>{getLabel(30690, "")}
</p>
}
</div> :
<div className="weapp-batch-impsteps-picker-spinText">
<p>{getLabel(111, "导入失败")}</p>
</div>
}
</div> :
<div className="weapp-batch-impsteps-picker-spinText">
<p>{getLabel(111, "导入失败")}</p>
</div>
}
{
!_.isEmpty(importResult) && (!_.isEmpty(importResult.errorNotice) || !_.isEmpty(importResult.errorData)) &&
<WeaTable
columns={[
{
title: getLabel(25700, "错误信息"),
dataIndex: "message"
!_.isEmpty(importResult) && (!_.isEmpty(importResult.errorNotice) || !_.isEmpty(importResult.errorData)) &&
<WeaTable
columns={[
{
title: getLabel(25700, "错误信息"),
dataIndex: "message"
}
]}
dataSource={importResult.errorData || importResult.errorNotice} pagination={false}
scroll={{ y: `calc(100vh - 387px)` }}
/>
}
]}
dataSource={importResult.errorData || importResult.errorNotice} pagination={false}
scroll={{ y: `calc(100vh - 387px)` }}
/>
</React.Fragment>
}
</div>
);

View File

@ -8,16 +8,45 @@
* @description:
*/
import React, { Component } from "react";
import { WeaLocaleProvider } from "ecCom";
import { WeaLocaleProvider, WeaTable } from "ecCom";
const getLabel = WeaLocaleProvider.getLabel;
class MoveInResult extends Component {
render() {
return (
<div>
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();
};
</div>
render() {
const { dataSource } = this.props;
return (
<WeaTable
columns={[
{ title: getLabel(111, "导入信息"), dataIndex: "message" },
{
title: getLabel(111, "下载信息"), dataIndex: "download", width: 200,
render: (text, record) => (<React.Fragment>
<span style={{ marginRight: 16, color: "#0BB746", cursor: "pointer" }}
onClick={() => this.downloadTxtfile(record.success.join("\n"), getLabel(111, "成功"))}>
<i className="iconfont icon-successful"/><span
style={{ marginLeft: 8 }}>{record.success.length}</span></span>
<span style={{ marginRight: 16, color: "#E6960C", cursor: "pointer" }}
onClick={() => this.downloadTxtfile(record.warning.join("\n"), getLabel(111, "警告"))}><i
className="iconfont icon-warning"/><span style={{ marginLeft: 8 }}>{record.warning.length}</span></span>
<span style={{ color: "#CF3736", cursor: "pointer" }}
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)` }}
/>
);
}
}