import React, { useState, useEffect } from "react"; import { Table, Input, InputNumber, Popconfirm, Form, Typography, Button, message, Space, Divider, Modal, Card, } from "antd"; import { cloneDeep } from "lodash"; import { KpiGroupSetteing } from "@/pages/performance/KpiGroupSetting/interface"; import { TargetType, TargetTypeEnum } from "@/pages/performance/entity"; import { render } from "react-dom"; import moment from "moment"; import { ReasonsEnum } from "../entity"; import { saveEvaImportData } from "../api"; import { history } from "umi"; import st from "./style.less"; const Column = Table.Column; interface Props { visible: boolean; fileData: any; tarOnCancel: Function; setParams: Function; innerParams: any; } const TargetModal = ({ visible, fileData, tarOnCancel, setParams, innerParams }: Props) => { const [loading, setLoading] = useState(false); const onOk = async (key: string) => { const pa = { key }; setLoading(true); try { const { success } = await saveEvaImportData(pa); if (success) { setLoading(false); message.success(`数据上传成功`, 5); // 重新刷新列表 setParams({ ...innerParams }, true); tarOnCancel && tarOnCancel(); } } catch (error: any) { setLoading(false); message.error(error.message); } }; return ( <> tarOnCancel()} maskClosable={false} width={1500} onOk={() => onOk(fileData.key)} confirmLoading={loading} > {name || "--"}} /> {name || "--"}} /> {name || "--"}} /> {/* ( {num !== undefined ? `${num}${ record.dataType == 1 ? "台" : record.dataType == 2 ? "%" : record.dataType == 3 ? "元" : "" }` : "--"} )} /> */} (time ? moment(time).format("YYYY-MM-DD") : "--")} /> record.errorType ?
未导入
:
已导入
} /> (record.errorType ? ReasonsEnum[record.errorType] : "--")} />
成功条数: {fileData.successNum}
失败条数: {fileData.errorNum}
); }; export default TargetModal;