Commit fa055c6d by zhaochengxiang

资产问题

parent 1fa11c36
......@@ -284,6 +284,10 @@ export function* getMetadataImportAssetLog(payload) {
return yield call(metadataService.listImportAssetLog, payload);
}
export function* getMetadataImportAssetLogDetail(payload) {
return yield call(metadataService.getImportAssetLogDetail, payload);
}
export function* getStandardTree(payload) {
return yield call(service.getStandardTree, payload);
}
......@@ -304,6 +308,10 @@ export function* deleteStandardBatchMetadata(payload) {
return yield call(service.deleteStandardBatchMetadata, payload);
}
export function* exportIndicator(payload) {
return yield call(service.exportIndicator, payload);
}
export function* importIndicator(payload) {
return yield call(service.importIndicator, payload);
}
......
import { PostJSON, GetJSON, PostFile, Post, Get } from "../util/axios"
import { PostJSON, GetJSON, PostFile, Post, Get, callFetchRaw } from "../util/axios"
export function importElement(payload) {
return PostFile("/dataassetmanager/elementApi/import", payload);
......@@ -292,6 +292,10 @@ export function deleteStandardBatchMetadata(payload) {
return PostJSON('/standard/indicator/delete', payload);
}
export function exportIndicator(payload) {
return callFetchRaw('post', '/standard/indicator/exportData', payload)
}
export function importIndicator(payload) {
return PostFile('/standard/indicator/import', payload);
}
......
......@@ -35,3 +35,7 @@ export function importAttributes(payload) {
export function listImportAssetLog(payload) {
return GetJSON('/metadatarepo/rest/import/listImportAssertLog', payload);
}
export function getImportAssetLogDetail(payload) {
return GetJSON('/metadatarepo/rest/import/getImportAssertLog', payload);
}
\ No newline at end of file
import React, { useState, useEffect, useContext } from 'react';
import { Button, Upload, Drawer, Table, Pagination, Divider, Form, Typography, Select, Space, Radio } from 'antd';
import { Button, Upload, Drawer, Table, Pagination, Divider, Form, Typography, Select, Space, Radio, Modal, Spin } from 'antd';
import { UploadOutlined, DownloadOutlined } from '@ant-design/icons';
import { dispatch } from '../../../../model';
......@@ -23,6 +23,7 @@ const FC = (props) => {
const [total, setTotal] = useState(0);
const [step, setStep] = useState(1);
const [fileList, setFileList] = useState([]);
const [detailParam, setDetailParam] = useState({visible: false, type: undefined, id: undefined, message: undefined});
const app = useContext(AppContext);
......@@ -69,6 +70,20 @@ const FC = (props) => {
title: '导入状态',
dataIndex: 'state',
ellipsis: true,
},
{
title: '操作',
dataIndex: 'action',
width: 80,
render: (_, record) => {
return <a onClick={() => {
if (catalogId === '1') {
setDetailParam({...detailParam, visible: true, type: catalogId, id: record.id});
} else {
setDetailParam({...detailParam, visible: true, type: catalogId, message: record.message});
}
}}>详情</a>
}
}
]
......@@ -200,12 +215,28 @@ const FC = (props) => {
}
},
callback: data => {
window.open(`/api/standard/indicator/exportData?ids=${data.content?.map(item => item.id).toString()}&tableId=${metadataId}`);
dispatch({
type: 'assetmanage.exportIndicator',
payload: {
responseType: 'blob',
params: {
tableId: metadataId,
ids: data.content?.map(item => item.id)
}
},
callback: (res) => {
download(res);
}
})
},
});
}
}
const onDetailCancel = () => {
setDetailParam({...detailParam, visible: false});
}
const uploadProps = {
onRemove: file => {
......@@ -273,15 +304,6 @@ const FC = (props) => {
dataSource={logs||[]}
pagination={false}
loading={loading}
expandable={{
expandedRowRender: record => <React.Fragment>
{
record.message ? record.message?.split('<br/>').map((info, index) => {
return <Typography.Paragraph key={index}>{info}</Typography.Paragraph>
}) : '暂无数据'
}
</React.Fragment>
}}
sticky
/>
<Pagination
......@@ -342,8 +364,71 @@ const FC = (props) => {
</div>
</React.Fragment>
}
<Detail
visible={detailParam.visible}
type={detailParam.type}
id={detailParam.id}
message={detailParam.message}
onCancel={onDetailCancel}
/>
</Drawer>
)
}
export default FC;
const Detail = ({ visible, message, id, type, onCancel }) => {
const [currentMessage, setCurrentMessage] = useState(undefined);
const [loading, setLoading] = useState(false);
useEffect(() => {
if (visible) {
if (type === '1') {
getMetadataImportAssetLogDetail();
} else {
setCurrentMessage(message);
}
}
}, [visible, type, message, id])
const getMetadataImportAssetLogDetail = () => {
setLoading(true);
dispatch({
type: 'assetmanage.getMetadataImportAssetLogDetail',
payload: {
logId: id
},
callback: data => {
setLoading(false);
setCurrentMessage(data?.message);
},
error: () => {
setLoading(false);
}
});
}
return (
<Modal
title='导入详情'
width={600}
visible={visible}
footer={null}
onCancel={() => {
setLoading(false);
onCancel?.();
}}
bodyStyle={{
height: 400,
overflow: 'auto'
}}
>
<Spin spinning={loading}>
{
currentMessage?.split('<br />').map((info, index) => {
return <Typography.Paragraph key={index}>{info}</Typography.Paragraph>
})
}
</Spin>
</Modal>
)
}
\ No newline at end of file
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