Commit 6ff825c7 by zhaochengxiang

bug fix

parent f7c0ca97
......@@ -115,7 +115,7 @@ const callback = resp => {
return resp.data || resp;
}
function getTemplateType() {
export function getTemplateType() {
return LocalStorage.get(`templateType-${appId}`)
}
......
import React, { useEffect, useState } from "react";
import LocalStorage from 'local-storage';
import { Spin } from "antd";
import AssetAction from "./AssetAction";
import { getQueryParam } from '../../../../util';
import { dispatch } from '../../../../model';
import './AssetDetailPage.less';
import { getDataAssetDetail } from "../../../../service/dataassetmanager";
import { appId } from "../../../../App";
const AssetDetailPage = (props)=>{
const [ data, setData ] = useState({ id: '', dirId: '' });
const [loading, setLoading] = useState(false)
const [templateType, setTemplateType] = useState()
const { id, dirId } = data;
useEffect(() => {
......@@ -16,20 +22,48 @@ const AssetDetailPage = (props)=>{
const _id = getQueryParam('id', props.location.search);
const _dirId = getQueryParam('dirId', props.location.search);
setData({ id: _id, dirId: _dirId });
getDataAssetDetail()
//eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
const getDataAssetDetail = () => {
const _id = getQueryParam('id', props.location.search);
const _dirId = getQueryParam('dirId', props.location.search);
dispatch({
type: 'assetmanage.getDataAssetDetail',
payload: {
dataAssetId: _id,
dirId: _dirId||'',
checkPermission: true
},
callback: data => {
setLoading(false);
LocalStorage.set(`templateType-${appId}`, data?.templateType)
setTemplateType(data?.templateType)
},
error: () => {
setLoading(false);
}
})
}
return(
<div className='asset-detail position-relative'>
<div className='detail-header'>
<span style={{ fontSize: 16, fontWeight: 'bold', color: '#000' }}>资产目录详情</span>
</div>
<div className='detail-container'>
<div className='detail-container-card'>
<AssetAction id={id} dirId={dirId} action='detail' />
<Spin spinning={loading}>
<div className='detail-container'>
<div className='detail-container-card'>
{
templateType && <AssetAction id={id} dirId={dirId} action='detail' />
}
</div>
</div>
</div>
</Spin>
</div>
)
}
......
......@@ -12,6 +12,7 @@ import Separate from './Separate';
import record from '../Assets/record.png';
import './AssetDirectory.less';
import { getTemplateType } from '../../../../util/axios';
const { Paragraph, Text } = Typography;
......@@ -97,7 +98,7 @@ const AssetDirectory = (props) => {
}
const onExportElementBtnClick = () => {
window.open('/api/dataassetmanager/elementApi/export');
window.open(`/api/dataassetmanager/elementApi/export?templateType=${getTemplateType()}`);
}
const onFilterElementClick = () => {
......
......@@ -16,6 +16,7 @@ import { highlightSearchContentByTerms } from '../../../../util';
import './AssetManageTree.less';
import 'react-contexify/dist/ReactContexify.css';
import { appId } from '../../../../App';
import { getTemplateType } from '../../../../util/axios';
const { Option } = AutoComplete;
......@@ -466,7 +467,7 @@ const AssetManageTree = (props) => {
}
const exportAllDir = () => {
window.open('/api/dataassetmanager/directoryApi/export');
window.open(`/api/dataassetmanager/directoryApi/export?templateType=${getTemplateType()}`);
}
const exportCurrentDir = () => {
......@@ -477,7 +478,7 @@ const AssetManageTree = (props) => {
dirId: currentDirId
},
callback: data => {
window.open(`/api/dataassetmanager/directoryApi/export?parentPath=${data.path}`);
window.open(`/api/dataassetmanager/directoryApi/export?parentPath=${data.path}&templateType=${getTemplateType()}`);
}
})
} else {
......
......@@ -21,6 +21,7 @@ import StartFlowModal from "./StartFlow";
import "./AssetTable.less";
import 'react-contexify/dist/ReactContexify.css';
import { getTemplateType } from "../../../../util/axios";
const { Text } = Typography;
const { Search } = Input;
......@@ -665,11 +666,11 @@ const AssetTable = (props) => {
title: '提示',
content: '是否导出所有资产目录?',
onOk: () => {
window.open('/api/dataassetmanager/dataAssetApi/exportByDataAssetIds?exportAll=true');
window.open(`/api/dataassetmanager/dataAssetApi/exportByDataAssetIds?exportAll=true&templateType=${getTemplateType()}`);
}
})
} else {
window.open(`/api/dataassetmanager/dataAssetApi/exportByDataAssetIds?dataAssetIds=${checkedKeys.join(',')}`);
window.open(`/api/dataassetmanager/dataAssetApi/exportByDataAssetIds?dataAssetIds=${checkedKeys.join(',')}&templateType=${getTemplateType()}`);
}
}
......
......@@ -5,6 +5,7 @@ import { UploadOutlined, DownloadOutlined } from '@ant-design/icons';
import { dispatch } from '../../../../model';
import { showMessage, formatDate } from '../../../../util';
import { AppContext } from '../../../../App';
import { getTemplateType } from '../../../../util/axios';
const ImportAssetDrawer = (props) => {
const { onCancel, onSuccess, visible, nodeId } = props;
......@@ -89,7 +90,7 @@ const ImportAssetDrawer = (props) => {
}, [visible])
const downloadTemplate = () => {
window.open("/api/dataassetmanager/dataAssetApi/getImportTemplate");
window.open(`/api/dataassetmanager/dataAssetApi/getImportTemplate?templateType=${getTemplateType()}`);
}
const getLogs = (p = 1, s = 20) => {
......@@ -154,30 +155,19 @@ const ImportAssetDrawer = (props) => {
setConfirmLoading(true);
dispatch({
type: 'assetmanage.getDirectoryById',
payload: {
dirId: nodeId
},
type: 'assetmanage.assetImport',
payload: { fileList: fileList, params: { env: `${app?.env?.domainId}` } },
callback: data => {
dispatch({
type: 'assetmanage.assetImport',
payload: { fileList: fileList, params: { parentPath: data?.path||'', env: `${app?.env?.domainId}` } },
callback: data => {
setConfirmLoading(false);
setFileList([]);
getLogs(pageNum, pageSize);
showMessage('success', '导入动作完成,详情查看日志');
onSuccess && onSuccess(data||'');
},
error: () => {
setConfirmLoading(false);
}
});
setConfirmLoading(false);
setFileList([]);
getLogs(pageNum, pageSize);
showMessage('success', '导入动作完成,详情查看日志');
onSuccess && onSuccess(data||'');
},
error: () => {
setConfirmLoading(false);
}
});
});
}
const reset = () => {
......
......@@ -4,6 +4,7 @@ import { UploadOutlined } from '@ant-design/icons';
import { dispatch } from '../../../../model';
import { showNotifaction } from '../../../../util';
import { getTemplateType } from '../../../../util/axios';
const ImportDirectory = (props) => {
const { visible, onCancel, dirId } = props;
......@@ -41,7 +42,7 @@ const ImportDirectory = (props) => {
}
const download = () => {
window.open('/api/dataassetmanager/directoryApi/getImportTemplate');
window.open(`/api/dataassetmanager/directoryApi/getImportTemplate?templateType=${getTemplateType()}`);
}
const upload = async (ignoreRepeatPath = false) => {
......
......@@ -4,6 +4,7 @@ import { DownloadOutlined, UploadOutlined } from '@ant-design/icons';
import { dispatchLatest } from '../../../../model';
import { showMessage } from '../../../../util';
import { getTemplateType } from '../../../../util/axios';
const ImportElement = (props) => {
const { onCancel, visible } = props;
......@@ -11,7 +12,7 @@ const ImportElement = (props) => {
const [ confirmLoading, setConfirmLoading ] = useState(false);
const downloadTemplate = () => {
window.open('/api/dataassetmanager/elementApi/getImportTemplate');
window.open(`/api/dataassetmanager/elementApi/getImportTemplate?templateType=${getTemplateType()}`);
}
const uploadProps = {
......
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