Commit 0a64e8b6 authored by 皮倩雯's avatar 皮倩雯

fix: '数据字典按钮加载'

parent e7151bc8
Pipeline #50769 skipped with stages
......@@ -3,7 +3,7 @@
* @Description:
* @Author: leizhe
* @Date: 2022-04-11 18:12:39
* @LastEditTime: 2022-05-19 16:41:38
* @LastEditTime: 2022-05-19 17:31:42
* @LastEditors: leizhe
*/
import React, { useEffect, useState } from 'react';
......@@ -25,8 +25,10 @@ const importModal = props => {
const { visible, onCancel, callBackSubmit = () => {} } = props;
const [addForm] = Form.useForm();
const [file, setFile] = useState('');
const [load, setLoad] = useState(false); // 提交加载
useEffect(() => {
setLoad(false);
addForm.resetFields();
}, [visible]);
......@@ -45,9 +47,11 @@ const importModal = props => {
const importData = () => {
addForm.validateFields().then(validate => {
if (validate) {
setLoad(true);
const formData = new FormData();
formData.append('file', file);
ImportDataDictionary(formData).then(res => {
setLoad(false);
if (res.code === 0) {
callBackSubmit();
addForm.resetFields();
......@@ -84,6 +88,7 @@ const importModal = props => {
afterClose={() => {
addForm.resetFields();
}}
// confirmLoading={load}
maskClosable={false}
footer={[
<Button key="back" onClick={onCancel}>
......@@ -97,7 +102,9 @@ const importModal = props => {
key="submit"
cancelText="取消"
>
<Button type="primary">确认</Button>
<Button type="primary" loading={load}>
确认
</Button>
</Popconfirm>,
]}
// okText="确认"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment