Commit 6ff825c7 by zhaochengxiang

bug fix

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