Commit 5dba9f5a by fanyj

tijiao

parent b7c2833e
......@@ -20,6 +20,33 @@ class AssetsActionManageService{
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()
......@@ -843,6 +843,8 @@ const AssetManageTree = (props) => {
'asset-manage-tree-asset-mount-reference': reference===AssetMountReference,
});
console.log(currentRightClickDir)
return (
<Card
className={classes}
......@@ -1020,7 +1022,9 @@ const AssetManageTree = (props) => {
if (reference === AssetManageReference&&(havePermission||addDir)) {
setCurrentRightClickDir(node);
setCurrentDirType(node.type||'');
displayMenu(event);
setTimeout(()=>{
displayMenu(event);
},100)
}
}}
/>
......@@ -1044,23 +1048,29 @@ const AssetManageTree = (props) => {
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>
<RcItem id="edit" onClick={editDir}>
{(havePermission||currentRightClickDir?.allowUpdateDir)&&<RcItem id="edit" onClick={editDir}>
修改目录
</RcItem>
<RcItem id="up" onClick={() => { moveNode(1); }}>
上移目录
</RcItem>
<RcItem id="down" onClick={() => { moveNode(-1); }}>
下移目录
</RcItem>
</RcItem>}
{
havePermission&&(
<>
<RcItem id="up" onClick={() => { moveNode(1); }}>
上移目录
</RcItem>
<RcItem id="down" onClick={() => { moveNode(-1); }}>
下移目录
</RcItem>
</>
)
}
</React.Fragment>
}
<RcItem id="delete" onClick={deleteDir}>
{(havePermission||currentRightClickDir?.allowDeleteDir)&&<RcItem id="delete" onClick={deleteDir}>
删除目录
</RcItem>
</RcItem>}
</RcMenu>
}
{contextHolder}
......
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 { Resizable } from 'react-resizable';
import ResizeObserver from 'rc-resize-observer';
......@@ -33,6 +33,7 @@ import PermissionMenuItem from '../../../../util/Component/PermissionMenuItem'
import "./AssetTable.less";
import 'react-contexify/dist/ReactContexify.css';
import { getTemplateType } from "../../../../util/axios";
import { assetsActionManageService } from "@/services";
const { Text } = Typography;
const { Column } = Table;
......@@ -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 = () => {
if ((checkedKeys||[]).length === 0) return;
......@@ -1235,6 +1251,14 @@ const AssetTable = (props) => {
导出
</PermissionButton>
}
{
(reference===AssetManageReference) && <PermissionButton
defaultPermission={exportAble}
onClick={exportAssetColumns}
>
导出字段
</PermissionButton>
}
<PermissionButton
defaultPermission={subscribeAble}
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