Commit a67470f6 by 放生的三文鱼

导出问题

parent 1f2792f6
...@@ -46,6 +46,34 @@ class AssetsActionManageService{ ...@@ -46,6 +46,34 @@ class AssetsActionManageService{
console.log(error) console.log(error)
}) })
} }
async exportBusinessColumnsByDataAssetId(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)
})
}
async getAssetColumnDetail(payload:any,autotip=false){ async getAssetColumnDetail(payload:any,autotip=false){
let result = await request({ url: `${asset}/dataAssetColumnApi/getDataAssetColumnDetail`, method: "post", data:qs.stringify(payload) },autotip).then(data=>{ let result = await request({ url: `${asset}/dataAssetColumnApi/getDataAssetColumnDetail`, method: "post", data:qs.stringify(payload) },autotip).then(data=>{
......
...@@ -106,7 +106,7 @@ export const listSubject = new Subject(); ...@@ -106,7 +106,7 @@ export const listSubject = new Subject();
const AssetTable = (props) => { const AssetTable = (props) => {
const { className, nodeId, nodeType, setAddDir, nodeAllowdLoadDataAsset, elementsChanged, assetActionChanged, onSelect, onCountChange, reference = AssetManageReference, onFullScreenChange, template } = props; const { className, nodeId, nodeType, setAddDir, nodeAllowdLoadDataAsset, elementsChanged, assetActionChanged, onSelect, onCountChange, reference = AssetManageReference, onFullScreenChange, template } = props;
const MENU_ID = 'asset-table'; const MENU_ID = 'asset-table';
const { show } = useContextMenu({ const { show } = useContextMenu({
...@@ -820,9 +820,11 @@ const AssetTable = (props) => { ...@@ -820,9 +820,11 @@ const AssetTable = (props) => {
if ((checkedKeys||[]).length === 0) { if ((checkedKeys||[]).length === 0) {
modal.confirm({ modal.confirm({
title: '提示', title: '提示',
content: '是否导出所有资源目录?', content: '是否导出资源目录?',
onOk: () => { onOk: () => {
window.open(`/api/dataassetmanager/dataAssetApi/exportByDataAssetIds?exportAll=true&templateType=${getTemplateType()}&queryElementId=${currentElementId??''}&keyword=${encodeURIComponent(keyword??'')}`); const exportAll = checkedKeys?.length === 0 && !nodeId ? true : false
const dirId = checkedKeys?.length === 0 && nodeId ? nodeId : ''
window.open(`/api/dataassetmanager/dataAssetApi/exportByDataAssetIds?exportAll=${exportAll}&dirId=${dirId}&templateType=${getTemplateType()}&queryElementId=${currentElementId??''}&keyword=${encodeURIComponent(keyword??'')}`);
} }
}) })
} else { } else {
...@@ -831,18 +833,17 @@ const AssetTable = (props) => { ...@@ -831,18 +833,17 @@ const AssetTable = (props) => {
} }
const exportAssetColumns = () => { const exportAssetColumns = () => {
if ((checkedKeys||[]).length) {
modal.confirm({ modal.confirm({
title: '提示', title: '提示',
content: '是否导出所选资源目录的字段?', content: '是否导出资源目录字段?',
async onOk(){ async onOk(){
await assetsActionManageService.exportAssetsColumns({templateType:getTemplateType(),dataAssetIds:checkedKeys.join(',')}) // await assetsActionManageService.exportAssetsColumns({templateType:getTemplateType(),dataAssetIds:checkedKeys.join(',')})
//window.open(`/api/dataassetmanager/dataAssetApi/exportByDataAssetIds?exportAll=true&templateType=${getTemplateType()}&queryElementId=${currentElementId??''}&keyword=${encodeURIComponent(keyword??'')}`); //window.open(`/api/dataassetmanager/dataAssetApi/exportByDataAssetIds?exportAll=true&templateType=${getTemplateType()}&queryElementId=${currentElementId??''}&keyword=${encodeURIComponent(keyword??'')}`);
const exportAll = checkedKeys?.length === 0 && !nodeId ? true : false
const dirId = checkedKeys?.length === 0 && nodeId ? nodeId : ''
await assetsActionManageService.exportBusinessColumnsByDataAssetId({dirId,exportAll,templateType:getTemplateType(),dataAssetIds:checkedKeys.join(',')})
} }
}) })
} else {
message.info("请选择导出资源")
}
} }
const subscriptAsset = () => { const 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