Commit 46a77f72 by zhaochengxiang

资产管理 浏览多模版

parent 2d802810
...@@ -322,4 +322,8 @@ export function* importIndicatorLog(payload) { ...@@ -322,4 +322,8 @@ export function* importIndicatorLog(payload) {
export function* getPermission(payload) { export function* getPermission(payload) {
return yield call(service.getPermission, payload); return yield call(service.getPermission, payload);
}
export function* getTemplates() {
return yield call(service.getTemplates)
} }
\ No newline at end of file
...@@ -306,4 +306,8 @@ export function importIndicatorLog(payload) { ...@@ -306,4 +306,8 @@ export function importIndicatorLog(payload) {
export function getPermission(payload) { export function getPermission(payload) {
return GetJSON("/dataassetmanager/permissionApi/getPermissionDetail", payload); return GetJSON("/dataassetmanager/permissionApi/getPermissionDetail", payload);
}
export function getTemplates() {
return GetJSON("/dataassetmanager/elementTemplateApi/listSupportTemplates")
} }
\ No newline at end of file
import axios from 'axios'; import axios from 'axios';
import qs from 'qs'; import qs from 'qs';
import LocalStorage from 'local-storage';
import { IsArr, showMessage, isSzseEnv } from './index'; import { IsArr, showMessage, isSzseEnv } from './index';
...@@ -115,8 +116,10 @@ const callback = resp => { ...@@ -115,8 +116,10 @@ const callback = resp => {
export function Get(url, params) { export function Get(url, params) {
const cancelToken = __source ? __source.token : null; const cancelToken = __source ? __source.token : null;
const templateType = LocalStorage.get('templateType');
return textplain.get(url, { return textplain.get(url, {
params, cancelToken params: {...params, templateType}, cancelToken
}).then( }).then(
callback callback
) )
...@@ -124,8 +127,10 @@ export function Get(url, params) { ...@@ -124,8 +127,10 @@ export function Get(url, params) {
export function GetJSON(url, params) { export function GetJSON(url, params) {
const cancelToken = __source ? __source.token : null; const cancelToken = __source ? __source.token : null;
const templateType = LocalStorage.get('templateType');
return instance.get(url, { return instance.get(url, {
params, cancelToken, params: {...params, templateType}, cancelToken,
validateStatus: false validateStatus: false
}).then( }).then(
callback callback
...@@ -134,8 +139,10 @@ export function GetJSON(url, params) { ...@@ -134,8 +139,10 @@ export function GetJSON(url, params) {
export const GetJSONRaw = (url, params) => { export const GetJSONRaw = (url, params) => {
const cancelToken = __source ? __source.token : null; const cancelToken = __source ? __source.token : null;
const templateType = LocalStorage.get('templateType');
return instanceRow.get(url, { return instanceRow.get(url, {
params, cancelToken, params: {...params, templateType}, cancelToken,
validateStatus: false validateStatus: false
}).then( }).then(
callback callback
...@@ -144,8 +151,10 @@ export const GetJSONRaw = (url, params) => { ...@@ -144,8 +151,10 @@ export const GetJSONRaw = (url, params) => {
export function Delete(url, params) { export function Delete(url, params) {
const cancelToken = __source ? __source.token : null; const cancelToken = __source ? __source.token : null;
const templateType = LocalStorage.get('templateType');
return instance.delete(url, { return instance.delete(url, {
params, cancelToken, params: {...params, templateType}, cancelToken,
}).then( }).then(
callback callback
) )
...@@ -154,13 +163,14 @@ export function Delete(url, params) { ...@@ -154,13 +163,14 @@ export function Delete(url, params) {
export function PostJSON(url, payload) { export function PostJSON(url, payload) {
const { params = null, data = null } = payload||{}; const { params = null, data = null } = payload||{};
const cancelToken = __source ? __source.token : null; const cancelToken = __source ? __source.token : null;
const templateType = LocalStorage.get('templateType');
return IsArr(data) ? instance.post(url, data, { return IsArr(data) ? instance.post(url, data, {
params, cancelToken params: {...params, templateType}, cancelToken
}).then( }).then(
callback callback
) : instance.post(url, null, { ) : instance.post(url, null, {
params, data, cancelToken params: {...params, templateType}, data, cancelToken
}).then( }).then(
callback callback
) )
...@@ -169,8 +179,10 @@ export function PostJSON(url, payload) { ...@@ -169,8 +179,10 @@ export function PostJSON(url, payload) {
export function Post(url, payload) { export function Post(url, payload) {
const { params = null, data = null } = payload||{}; const { params = null, data = null } = payload||{};
const cancelToken = __source ? __source.token : null; const cancelToken = __source ? __source.token : null;
const templateType = LocalStorage.get('templateType');
return textplain.post(url, null, { return textplain.post(url, null, {
params, data, cancelToken params: {...params, templateType}, data, cancelToken
}).then( }).then(
callback callback
) )
...@@ -178,12 +190,14 @@ export function Post(url, payload) { ...@@ -178,12 +190,14 @@ export function Post(url, payload) {
export function PostFile(url, payload) { export function PostFile(url, payload) {
const { fileList = null, params = null } = payload||{}; const { fileList = null, params = null } = payload||{};
const templateType = LocalStorage.get('templateType');
let formData = new FormData(); let formData = new FormData();
(fileList||[]).forEach(file=> { (fileList||[]).forEach(file=> {
formData.append('file', file); formData.append('file', file);
}); });
return fileplain.post(url, formData, { params } ).then( return fileplain.post(url, formData, { params: {...params, templateType} } ).then(
callback callback
) )
} }
...@@ -198,10 +212,13 @@ let config = { ...@@ -198,10 +212,13 @@ let config = {
export const callFetchRaw = (method, url, options) => { export const callFetchRaw = (method, url, options) => {
const { params, ...reqConfig } = options; const { params, ...reqConfig } = options;
const templateType = LocalStorage.get('templateType');
var bodyFormData = new FormData(); var bodyFormData = new FormData();
Object.keys(params||[]).forEach(key => { Object.keys(params||[]).forEach(key => {
bodyFormData.append(key, params[key]); bodyFormData.append(key, params[key]);
}); });
bodyFormData.append('templateType', templateType);
return axios.request({ return axios.request({
method, method,
......
...@@ -17,7 +17,7 @@ const AssetBrowse = (props) => { ...@@ -17,7 +17,7 @@ const AssetBrowse = (props) => {
const { reference = AssetBrowseReference } = props; const { reference = AssetBrowseReference } = props;
const [ nodeParams, setNodeParams ] = useState({ centerId: '', expandId: '', nodeType: '' }); const [ nodeParams, setNodeParams ] = useState({ centerId: null, expandId: '', nodeType: '' });
const [ expandTree, setExpandTree ] = useState(true); const [ expandTree, setExpandTree ] = useState(true);
const [ expandRelation, setExpandRelation ] = useState(true); const [ expandRelation, setExpandRelation ] = useState(true);
const [ assetCount, setAssetCount ] = useState(0); const [ assetCount, setAssetCount ] = useState(0);
...@@ -52,13 +52,6 @@ const AssetBrowse = (props) => { ...@@ -52,13 +52,6 @@ const AssetBrowse = (props) => {
setAssetFullScreen(value); setAssetFullScreen(value);
} }
let nodeId = '';
if ((expandId||'') !== '') {
nodeId = expandId;
} else {
nodeId = centerId;
}
const classes = classNames('asset-browse', { const classes = classNames('asset-browse', {
'asset-browse-tree-collapse': !expandTree, 'asset-browse-tree-collapse': !expandTree,
'asset-browse-relation-collapse': !expandRelation, 'asset-browse-relation-collapse': !expandRelation,
...@@ -83,7 +76,7 @@ const AssetBrowse = (props) => { ...@@ -83,7 +76,7 @@ const AssetBrowse = (props) => {
expandTree && <Separate width={15} /> expandTree && <Separate width={15} />
} }
<div className={rightClasses}> <div className={rightClasses}>
<AssetDirectory id={nodeId} assetCount={assetCount} reference={reference} nodeType={nodeParams.nodeType} /> <AssetDirectory id={centerId} assetCount={assetCount} reference={reference} nodeType={nodeParams.nodeType} />
<Separate height={15} /> <Separate height={15} />
<div className='flex' style={{ flex: 1, height: '100%', overflow: 'hidden' }}> <div className='flex' style={{ flex: 1, height: '100%', overflow: 'hidden' }}>
{ {
...@@ -95,7 +88,7 @@ const AssetBrowse = (props) => { ...@@ -95,7 +88,7 @@ const AssetBrowse = (props) => {
// </React.Fragment> // </React.Fragment>
} }
<div style={{ flex: 1, overflow: 'hidden' }}> <div style={{ flex: 1, overflow: 'hidden' }}>
<AssetTable nodeId={nodeId} nodeType={nodeParams.nodeType} reference={reference} onCountChange={onAssetCountChange} onFullScreenChange={onFullScreenChange} {...props} /> <AssetTable nodeId={centerId} nodeType={nodeParams.nodeType} reference={reference} onCountChange={onAssetCountChange} onFullScreenChange={onFullScreenChange} {...props} />
</div> </div>
</div> </div>
<div className='tree-toggle' onClick={treeToggleClick}> <div className='tree-toggle' onClick={treeToggleClick}>
......
...@@ -584,7 +584,7 @@ const AssetAction = (props) => { ...@@ -584,7 +584,7 @@ const AssetAction = (props) => {
if (item.resourceType==='innerSource'||item.resourceType==='outerSource') { if (item.resourceType==='innerSource'||item.resourceType==='outerSource') {
window.open(`/center-home/menu/asset-resource-browse?${AnchorId}=${item?.dataAssetId}&${AnchorDirId}=${item?.dirId}&timestamp=${timestamp}`); window.open(`/center-home/menu/asset-resource-browse?${AnchorId}=${item?.dataAssetId}&${AnchorDirId}=${item?.dirId}&timestamp=${timestamp}`);
} else if (item.resourceType==='dataAsset') { } else if (item.resourceType==='dataAsset') {
window.open(`/center-home/menu/asset-browse?${AnchorId}=${item?.dataAssetId}&${AnchorDirId}=${item?.dirId}&timestamp=${timestamp}`); window.open(`/center-home/menu/asset-browse?${AnchorId}=${item?.dataAssetId}&${AnchorDirId}=${item?.dirId}&templateType=${LocalStorage.get('templateType')}&timestamp=${timestamp}`);
} else { } else {
showMessage('warn', '资产目录类型不是资源也不是资产!'); showMessage('warn', '资产目录类型不是资源也不是资产!');
} }
......
...@@ -44,6 +44,8 @@ const AssetDirectory = (props) => { ...@@ -44,6 +44,8 @@ const AssetDirectory = (props) => {
useEffect(() => { useEffect(() => {
if ((id||'')!=='') { if ((id||'')!=='') {
getDirectory(); getDirectory();
} else {
setDir()
} }
//eslint-disable-next-line react-hooks/exhaustive-deps //eslint-disable-next-line react-hooks/exhaustive-deps
}, [ id, directoryChanged ]) }, [ id, directoryChanged ])
......
import React, { useEffect, useState, useRef } from 'react'; import React, { useEffect, useState, useRef } from 'react';
import {Card, Spin, Tooltip, Tree, Dropdown, Menu, Modal, AutoComplete} from 'antd'; import {Card, Spin, Tooltip, Tree, Dropdown, Menu, Modal, AutoComplete, Select} from 'antd';
import { PlusOutlined, ImportOutlined,ExportOutlined,ReloadOutlined, SettingOutlined } from '@ant-design/icons'; import { PlusOutlined, ImportOutlined,ExportOutlined,ReloadOutlined, SettingOutlined } from '@ant-design/icons';
import classNames from 'classnames'; import classNames from 'classnames';
import { useContextMenu, Menu as RcMenu, Item as RcItem } from "react-contexify"; import { useContextMenu, Menu as RcMenu, Item as RcItem } from "react-contexify";
import LocalStorage from 'local-storage';
import { dispatch } from '../../../../model'; import { dispatch } from '../../../../model';
import ImportDirectory from './ImportDirectory'; import ImportDirectory from './ImportDirectory';
...@@ -62,6 +63,9 @@ const AssetManageTree = (props) => { ...@@ -62,6 +63,9 @@ const AssetManageTree = (props) => {
const [ customDirectoryAction, setCustomDirectoryAction ] = useState(''); const [ customDirectoryAction, setCustomDirectoryAction ] = useState('');
const [options, setOptions] = useState([]); const [options, setOptions] = useState([]);
const [ loadedKeys, setLoadedKeys ] = useState([]); const [ loadedKeys, setLoadedKeys ] = useState([]);
const [loadingTemplates, setLoadingTemplates] = useState(false)
const [templates, setTemplates] = useState()
const [currentTemplateType, setTemplateType] = useState()
const [modal, contextHolder] = Modal.useModal(); const [modal, contextHolder] = Modal.useModal();
...@@ -73,6 +77,7 @@ const AssetManageTree = (props) => { ...@@ -73,6 +77,7 @@ const AssetManageTree = (props) => {
const dataListRef = useRef([]); const dataListRef = useRef([]);
useEffect(() => { useEffect(() => {
getTemplates()
window?.addEventListener("storage", storageChange); window?.addEventListener("storage", storageChange);
return () => { return () => {
...@@ -82,16 +87,16 @@ const AssetManageTree = (props) => { ...@@ -82,16 +87,16 @@ const AssetManageTree = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps //eslint-disable-next-line react-hooks/exhaustive-deps
}, []) }, [])
useEffect(() => { // useEffect(() => {
if ((did||'') !== '') { // if ((did||'') !== '') {
getAllDirectoryAsTree(true, did); // getAllDirectoryAsTree(true, did);
} else if ((id||'') !== '') { // } else if ((id||'') !== '') {
getDataAssetLocationThenGetTreeData(); // getDataAssetLocationThenGetTreeData();
} else { // } else {
getAllDirectoryAsTree(true); // getAllDirectoryAsTree(true);
} // }
//eslint-disable-next-line react-hooks/exhaustive-deps // //eslint-disable-next-line react-hooks/exhaustive-deps
}, [timestamp]) // }, [timestamp])
useEffect(() => { useEffect(() => {
if ((tableId||'') !== '') { if ((tableId||'') !== '') {
...@@ -117,6 +122,26 @@ const AssetManageTree = (props) => { ...@@ -117,6 +122,26 @@ const AssetManageTree = (props) => {
} }
} }
const getTemplates = () => {
setLoadingTemplates(true)
dispatch({
type: 'assetmanage.getTemplates',
callback: data => {
setLoadingTemplates(false)
setTemplates(data)
if ((data??[]).length > 0) {
setTemplateType(data[0].type)
LocalStorage.set('templateType', data[0].type)
onSelect?.('', '')
getAllDirectoryAsTree(false)
}
},
error: () => {
setLoadingTemplates(false)
}
})
}
const getDataAssetLocationThenGetTreeData = () => { const getDataAssetLocationThenGetTreeData = () => {
setLoading(true); setLoading(true);
dispatch({ dispatch({
...@@ -152,9 +177,9 @@ const AssetManageTree = (props) => { ...@@ -152,9 +177,9 @@ const AssetManageTree = (props) => {
const getAllDirectoryAsTree = (resetCurrentDirId=true, defaultSelectedId='', refresh = false) => { const getAllDirectoryAsTree = (resetCurrentDirId=true, defaultSelectedId='', refresh = false) => {
setLoading(true); setLoading(true);
if (resetCurrentDirId) { // if (resetCurrentDirId) {
onSelect && onSelect('', ''); // onSelect && onSelect('', '');
} // }
let url = ''; let url = '';
if (reference === AssetManageReference || reference === AssetMountReference) { if (reference === AssetManageReference || reference === AssetMountReference) {
...@@ -525,8 +550,9 @@ const AssetManageTree = (props) => { ...@@ -525,8 +550,9 @@ const AssetManageTree = (props) => {
// } // }
const onTreeSelect = (keys, { node }) => { const onTreeSelect = (keys, { node }) => {
if ((keys||[]).length === 0) { if ((keys||[]).length === 0) {
setCurrentDirId();
onSelect?.('', '');
return; return;
} }
...@@ -714,13 +740,30 @@ const AssetManageTree = (props) => { ...@@ -714,13 +740,30 @@ const AssetManageTree = (props) => {
className={classes} className={classes}
title={ (reference===AssetBrowseReference||reference===ResourceBrowseReference || reference===AssetMountReference) ? null : ( title={ (reference===AssetBrowseReference||reference===ResourceBrowseReference || reference===AssetMountReference) ? null : (
<div <div
className='flex px-2' className='flex'
style={{ style={{
height: 40, height: 40,
alignItems: 'center', alignItems: 'center',
justifyContent: 'space-around', justifyContent: 'space-between',
padding: '0 15px'
}} }}
> >
<Select
size='small'
value={currentTemplateType}
onChange={(val) => {
setTemplateType(val)
LocalStorage.set('templateType', val);
setCurrentDirId();
onSelect?.('', '');
getAllDirectoryAsTree(false)
}}
style={{ width: 65 }}
>
{
(templates??[]).map((item, index) => <Select.Option key={index} value={item.type}>{item.name}</Select.Option>)
}
</Select>
<Tooltip title="新增目录"> <Tooltip title="新增目录">
<PlusOutlined className={(currentDir?.resourceType==='custom')?'disable': 'default'} onClick={addDir} style={{ fontSize:16,cursor: (currentDirType==='custom')?'not-allowed':'pointer' }}/> <PlusOutlined className={(currentDir?.resourceType==='custom')?'disable': 'default'} onClick={addDir} style={{ fontSize:16,cursor: (currentDirType==='custom')?'not-allowed':'pointer' }}/>
</Tooltip> </Tooltip>
......
...@@ -225,21 +225,20 @@ const AssetTable = (props) => { ...@@ -225,21 +225,20 @@ const AssetTable = (props) => {
}, []) }, [])
useEffect(() => { useEffect(() => {
if ((nodeId||'') !== '' ) { if (nodeId !== null) {
setSelectItem({}); setSelectItem({});
setCheckedKeys([]); setCheckedKeys([]);
if (shouldScrollRef.current === true) { if (shouldScrollRef.current === true) {
if (remoteRelationRef.current) { if (remoteRelationRef.current) {
getDataAssetLocationByRelation(); getDataAssetLocationByRelation();
} else { } else {
getDataAssetLocation(); getDataAssetLocation();
} }
} else { } else {
setPagination({ ...pagination, pageNum: 1 }); setPagination({ ...pagination, pageNum: 1 });
} }
} }
//eslint-disable-next-line react-hooks/exhaustive-deps //eslint-disable-next-line react-hooks/exhaustive-deps
}, [ nodeId ]) }, [ nodeId ])
...@@ -254,7 +253,7 @@ const AssetTable = (props) => { ...@@ -254,7 +253,7 @@ const AssetTable = (props) => {
}, [timestamp]) }, [timestamp])
useEffect(() => { useEffect(() => {
if ((nodeId||'') !== '' || reference===AssetRecycleReference) { if (nodeId!==null || reference===AssetRecycleReference) {
getFilterElementsGroupThenGetDataAssets(); getFilterElementsGroupThenGetDataAssets();
} }
//eslint-disable-next-line react-hooks/exhaustive-deps //eslint-disable-next-line react-hooks/exhaustive-deps
...@@ -1035,9 +1034,9 @@ const AssetTable = (props) => { ...@@ -1035,9 +1034,9 @@ const AssetTable = (props) => {
} */} } */}
</Space> </Space>
<Space> <Space>
{ {/* {
(reference!==AssetRecycleReference) && <Checkbox onChange={onFullSearchChange} checked={fullSearch}>全部数据</Checkbox> (reference!==AssetRecycleReference) && <Checkbox onChange={onFullSearchChange} checked={fullSearch}>全部数据</Checkbox>
} } */}
<Search <Search
placeholder="请输入资产目录要素值" placeholder="请输入资产目录要素值"
allowClear allowClear
......
import React, { useEffect, useState, useRef } from 'react'; import React, { useEffect, useState, useRef } from 'react';
import {Card, Spin, Tooltip, Tree, Modal, AutoComplete} from 'antd'; import {Card, Spin, Tooltip, Tree, Modal, AutoComplete, Select} from 'antd';
import { ReloadOutlined, SettingOutlined } from '@ant-design/icons'; import { ReloadOutlined, SettingOutlined } from '@ant-design/icons';
import { useContextMenu, Menu as RcMenu, Item as RcItem } from "react-contexify"; import { useContextMenu, Menu as RcMenu, Item as RcItem } from "react-contexify";
import LocalStorage from 'local-storage';
import { dispatch } from '../../../../model'; import { dispatch } from '../../../../model';
import CustomDirectoryModal from './CustomDirectoryModal'; import CustomDirectoryModal from './CustomDirectoryModal';
...@@ -52,6 +53,9 @@ const AssetTree = (props) => { ...@@ -52,6 +53,9 @@ const AssetTree = (props) => {
const [ customDirectoryAction, setCustomDirectoryAction ] = useState(''); const [ customDirectoryAction, setCustomDirectoryAction ] = useState('');
const [options, setOptions] = useState([]); const [options, setOptions] = useState([]);
const [ loadedKeys, setLoadedKeys ] = useState([]); const [ loadedKeys, setLoadedKeys ] = useState([]);
const [loadingTemplates, setLoadingTemplates] = useState(false)
const [templates, setTemplates] = useState()
const [currentTemplateType, setTemplateType] = useState()
const [modal, contextHolder] = Modal.useModal(); const [modal, contextHolder] = Modal.useModal();
...@@ -63,6 +67,7 @@ const AssetTree = (props) => { ...@@ -63,6 +67,7 @@ const AssetTree = (props) => {
const dataListRef = useRef([]); const dataListRef = useRef([]);
useEffect(() => { useEffect(() => {
getTemplates()
window?.addEventListener("storage", storageChange); window?.addEventListener("storage", storageChange);
return () => { return () => {
...@@ -72,16 +77,16 @@ const AssetTree = (props) => { ...@@ -72,16 +77,16 @@ const AssetTree = (props) => {
//eslint-disable-next-line react-hooks/exhaustive-deps //eslint-disable-next-line react-hooks/exhaustive-deps
}, []) }, [])
useEffect(() => { // useEffect(() => {
if ((did||'') !== '') { // if ((did||'') !== '') {
getAllDirectoryAsTree(true, did); // getAllDirectoryAsTree(true, did);
} else if ((id||'') !== '') { // } else if ((id||'') !== '') {
getDataAssetLocationThenGetTreeData(); // getDataAssetLocationThenGetTreeData();
} else { // } else {
getAllDirectoryAsTree(true); // getAllDirectoryAsTree(true);
} // }
//eslint-disable-next-line react-hooks/exhaustive-deps // //eslint-disable-next-line react-hooks/exhaustive-deps
}, [timestamp]) // }, [timestamp])
useEffect(() => { useEffect(() => {
if ((tableId||'') !== '') { if ((tableId||'') !== '') {
...@@ -107,6 +112,38 @@ const AssetTree = (props) => { ...@@ -107,6 +112,38 @@ const AssetTree = (props) => {
} }
} }
const getTemplates = () => {
setLoadingTemplates(true)
dispatch({
type: 'assetmanage.getTemplates',
callback: data => {
setLoadingTemplates(false)
setTemplates(data)
if ((data??[]).length > 0) {
setTemplateType(data[0].type)
const _templateType = getQueryParam('templateType', props?.location?.search)
const _dirId = getQueryParam(AnchorDirId, props?.location?.search)
if (_templateType) {
LocalStorage.set('templateType', _templateType)
} else {
LocalStorage.set('templateType', data[0].type)
}
if (_dirId) {
getAllDirectoryAsTree(true, _dirId)
} else {
onSelect?.('', '')
getAllDirectoryAsTree(false)
}
}
},
error: () => {
setLoadingTemplates(false)
}
})
}
const getDataAssetLocationThenGetTreeData = () => { const getDataAssetLocationThenGetTreeData = () => {
setLoading(true); setLoading(true);
dispatch({ dispatch({
...@@ -141,9 +178,9 @@ const AssetTree = (props) => { ...@@ -141,9 +178,9 @@ const AssetTree = (props) => {
const getAllDirectoryAsTree = (resetCurrentDirId=true, defaultSelectedId='', refresh = false) => { const getAllDirectoryAsTree = (resetCurrentDirId=true, defaultSelectedId='', refresh = false) => {
setLoading(true); setLoading(true);
if (resetCurrentDirId) { // if (resetCurrentDirId) {
onSelect && onSelect('', ''); // onSelect && onSelect('', '');
} // }
let url = ''; let url = '';
if (reference === AssetBrowseReference) { if (reference === AssetBrowseReference) {
...@@ -413,6 +450,8 @@ const AssetTree = (props) => { ...@@ -413,6 +450,8 @@ const AssetTree = (props) => {
const onTreeSelect = (keys, _) => { const onTreeSelect = (keys, _) => {
if ((keys||[]).length === 0) { if ((keys||[]).length === 0) {
setCurrentDirId();
onSelect?.('', '');
return; return;
} }
...@@ -525,13 +564,30 @@ const AssetTree = (props) => { ...@@ -525,13 +564,30 @@ const AssetTree = (props) => {
className='asset-tree' className='asset-tree'
title={ title={
<div <div
className='flex px-2' className='flex'
style={{ style={{
height: 40, height: 40,
alignItems: 'center', alignItems: 'center',
justifyContent: 'space-around', justifyContent: 'space-between',
padding: '0 15px'
}} }}
> >
<Select
size='small'
value={currentTemplateType}
onChange={(val) => {
setTemplateType(val)
LocalStorage.set('templateType', val);
setCurrentDirId();
onSelect?.('', '');
getAllDirectoryAsTree(false)
}}
style={{ width: 65 }}
>
{
(templates??[]).map((item, index) => <Select.Option key={index} value={item.type}>{item.name}</Select.Option>)
}
</Select>
<Tooltip title="刷新目录"> <Tooltip title="刷新目录">
<ReloadOutlined className='default' onClick={refreshTree} style={{ fontSize:16,cursor:'pointer',flex:1}} /> <ReloadOutlined className='default' onClick={refreshTree} style={{ fontSize:16,cursor:'pointer',flex:1}} />
</Tooltip> </Tooltip>
......
...@@ -16,7 +16,7 @@ import './index.less'; ...@@ -16,7 +16,7 @@ import './index.less';
const AssetManage = (props) => { const AssetManage = (props) => {
const [ nodeId, setNodeId ] = useState(''); const [ nodeId, setNodeId ] = useState(null);
const [ nodeType, setNodeType ] = useState(''); const [ nodeType, setNodeType ] = useState('');
const [ nodeLevel, setNodeLevel ] = useState(null); const [ nodeLevel, setNodeLevel ] = useState(null);
const [ assetParams, setAssetParams ] = useState({ assetId: '', assetDirId: '' }) const [ assetParams, setAssetParams ] = useState({ assetId: '', assetDirId: '' })
......
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