Commit 9bf17f65 by zhaochengxiang

要素调整

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