Commit 5dba9f5a by fanyj

tijiao

parent b7c2833e
...@@ -20,6 +20,33 @@ class AssetsActionManageService{ ...@@ -20,6 +20,33 @@ class AssetsActionManageService{
return result; return result;
} }
async exportAssetsColumns(payload:any,autotip=false){
await request({ url: `${asset}/dataAssetColumnApi/exportBusinessColumnsByDataAssetId`, method: "postdownload", data:qs.stringify(payload),responseType:'blob' },autotip).then((data:any)=>{
let types = data.data.type
var blob = new Blob([data.data], {type: types});
let fileName = ''
let contentDisposition = data.headers['content-disposition'];
if (contentDisposition) {
fileName = window.decodeURI(data.headers['content-disposition'].split('=')[1]);
}
if (typeof window.navigator.msSaveBlob !== 'undefined') {
window.navigator.msSaveBlob(blob, fileName);
}
else {
var csvURL = window.URL.createObjectURL(blob);
var tempLink = document.createElement('a');
tempLink.href = csvURL;
tempLink.setAttribute('download', fileName);
tempLink.setAttribute('target', '_blank');
document.body.appendChild(tempLink);
tempLink.click();
document.body.removeChild(tempLink);
}
}).catch(error=>{
console.log(error)
})
}
} }
export default new AssetsActionManageService() export default new AssetsActionManageService()
...@@ -843,6 +843,8 @@ const AssetManageTree = (props) => { ...@@ -843,6 +843,8 @@ const AssetManageTree = (props) => {
'asset-manage-tree-asset-mount-reference': reference===AssetMountReference, 'asset-manage-tree-asset-mount-reference': reference===AssetMountReference,
}); });
console.log(currentRightClickDir)
return ( return (
<Card <Card
className={classes} className={classes}
...@@ -1020,7 +1022,9 @@ const AssetManageTree = (props) => { ...@@ -1020,7 +1022,9 @@ const AssetManageTree = (props) => {
if (reference === AssetManageReference&&(havePermission||addDir)) { if (reference === AssetManageReference&&(havePermission||addDir)) {
setCurrentRightClickDir(node); setCurrentRightClickDir(node);
setCurrentDirType(node.type||''); setCurrentDirType(node.type||'');
displayMenu(event); setTimeout(()=>{
displayMenu(event);
},100)
} }
}} }}
/> />
...@@ -1044,23 +1048,29 @@ const AssetManageTree = (props) => { ...@@ -1044,23 +1048,29 @@ const AssetManageTree = (props) => {
dirId= { currentDirId } dirId= { currentDirId }
/> />
{ {
(reference!==AssetMountReference&&havePermission) && <RcMenu id={MENU_ID}> (reference!==AssetMountReference&&(havePermission||currentRightClickDir?.allowUpdateDir||currentRightClickDir?.allowDeleteDir)) && <RcMenu id={MENU_ID}>
{ {
viewSelectedKeyRef.current==='dir' && <React.Fragment> viewSelectedKeyRef.current==='dir' && <React.Fragment>
<RcItem id="edit" onClick={editDir}> {(havePermission||currentRightClickDir?.allowUpdateDir)&&<RcItem id="edit" onClick={editDir}>
修改目录 修改目录
</RcItem> </RcItem>}
<RcItem id="up" onClick={() => { moveNode(1); }}> {
上移目录 havePermission&&(
</RcItem> <>
<RcItem id="down" onClick={() => { moveNode(-1); }}> <RcItem id="up" onClick={() => { moveNode(1); }}>
下移目录 上移目录
</RcItem> </RcItem>
<RcItem id="down" onClick={() => { moveNode(-1); }}>
下移目录
</RcItem>
</>
)
}
</React.Fragment> </React.Fragment>
} }
<RcItem id="delete" onClick={deleteDir}> {(havePermission||currentRightClickDir?.allowDeleteDir)&&<RcItem id="delete" onClick={deleteDir}>
删除目录 删除目录
</RcItem> </RcItem>}
</RcMenu> </RcMenu>
} }
{contextHolder} {contextHolder}
......
import React,{ useState, useEffect, useRef, useContext, useMemo } from "react"; import React,{ useState, useEffect, useRef, useContext, useMemo } from "react";
import { Button, Pagination, Space, Modal, Input, Tooltip, Checkbox, Typography, Dropdown, Menu, Divider, Select } from "antd"; import { Button, Pagination, Space, Modal, Input, Tooltip, Checkbox, Typography, Dropdown, Menu, Divider, Select, message } from "antd";
import classNames from 'classnames'; import classNames from 'classnames';
import { Resizable } from 'react-resizable'; import { Resizable } from 'react-resizable';
import ResizeObserver from 'rc-resize-observer'; import ResizeObserver from 'rc-resize-observer';
...@@ -33,6 +33,7 @@ import PermissionMenuItem from '../../../../util/Component/PermissionMenuItem' ...@@ -33,6 +33,7 @@ import PermissionMenuItem from '../../../../util/Component/PermissionMenuItem'
import "./AssetTable.less"; import "./AssetTable.less";
import 'react-contexify/dist/ReactContexify.css'; import 'react-contexify/dist/ReactContexify.css';
import { getTemplateType } from "../../../../util/axios"; import { getTemplateType } from "../../../../util/axios";
import { assetsActionManageService } from "@/services";
const { Text } = Typography; const { Text } = Typography;
const { Column } = Table; const { Column } = Table;
...@@ -830,6 +831,21 @@ const AssetTable = (props) => { ...@@ -830,6 +831,21 @@ const AssetTable = (props) => {
} }
} }
const exportAssetColumns = () => {
if ((checkedKeys||[]).length) {
modal.confirm({
title: '提示',
content: '是否导出所选资源目录的字段?',
async onOk(){
await assetsActionManageService.exportAssetsColumns({templateType:getTemplateType(),dataAssetIds:checkedKeys.join(',')})
//window.open(`/api/dataassetmanager/dataAssetApi/exportByDataAssetIds?exportAll=true&templateType=${getTemplateType()}&queryElementId=${currentElementId??''}&keyword=${encodeURIComponent(keyword??'')}`);
}
})
} else {
message.info("请选择导出资源")
}
}
const subscriptAsset = () => { const subscriptAsset = () => {
if ((checkedKeys||[]).length === 0) return; if ((checkedKeys||[]).length === 0) return;
...@@ -1235,6 +1251,14 @@ const AssetTable = (props) => { ...@@ -1235,6 +1251,14 @@ const AssetTable = (props) => {
导出 导出
</PermissionButton> </PermissionButton>
} }
{
(reference===AssetManageReference) && <PermissionButton
defaultPermission={exportAble}
onClick={exportAssetColumns}
>
导出字段
</PermissionButton>
}
<PermissionButton <PermissionButton
defaultPermission={subscribeAble} defaultPermission={subscribeAble}
onClick={subscriptAsset} onClick={subscriptAsset}
......
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