Commit 9bf17f65 by zhaochengxiang

要素调整

parent 0200a1a6
import React, { useState } from 'react';
import { Modal, Button, Upload } from 'antd';
import { Modal, Button, Upload, notification } from 'antd';
import { DownloadOutlined, UploadOutlined } from '@ant-design/icons';
import { dispatchLatest } from '../../../../model';
......@@ -27,7 +27,8 @@ const ImportModal = (props) => {
setFileList([file]);
return false;
}
},
fileList: fileList||[]
};
const handleOk = () => {
......@@ -41,9 +42,10 @@ const ImportModal = (props) => {
dispatchLatest({
type: 'dataassetelement.importElement',
payload: { fileList },
callback: () => {
callback: data => {
setConfirmLoading(false);
onCancel && onCancel(true);
reset();
onCancel && onCancel(true, data);
},
error: () => {
setConfirmLoading(false);
......@@ -51,6 +53,10 @@ const ImportModal = (props) => {
})
}
const reset = () => {
setFileList([]);
}
return (
<Modal
forceRender
......@@ -60,6 +66,7 @@ const ImportModal = (props) => {
onOk={handleOk}
onCancel={() => {
setConfirmLoading(false);
reset();
onCancel && onCancel();
}}
>
......
import React, { useState, useEffect } from 'react';
import { Button, Table, Pagination } from 'antd';
import { Button, Table, Pagination, notification } from 'antd';
import { dispatchLatest } from '../../../model';
import ImportModal from './Component/ImportModal';
......@@ -77,11 +77,20 @@ const Element = (props) => {
})
}
const onImportModalCancel = (refresh = false) => {
const onImportModalCancel = (refresh = false, tip = '') => {
setImportModalVisible(false);
if (refresh) {
setPagination({ pageNum: 1, pageSize: 20 });
}
if (tip && tip!== '') {
notification.config({ prefixCls: "yy-notification" });
notification.open({
message: '导入提示',
description: <span dangerouslySetInnerHTML={{ __html: tip||''}} />,
duration: 0,
});
}
}
return (
......
......@@ -16,6 +16,12 @@ const DatatypeInput = ({ value = {}, datatypes, onChange }) => {
const [ parameterCnNames, setParameterCnNames ] = useState(value.parameterCnNames||[]);
const [ parameterValues, setParameterValues ] = useState(value.parameterValues||[]);
useEffect(() => {
setName(value.name||'');
setParameterValues(value.parameterValues||[]);
setParameterCnNames(value.parameterCnNames||[]);
}, [ value ])
const onNameChange = (value) => {
setName(value);
......
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