* [bug#68525,doing,2h] add export button for attachment library.

This commit is contained in:
tianshujie
2026-01-13 15:26:06 +08:00
parent 5c9c997308
commit 00fcc6462e
+36 -2
View File
@@ -1265,7 +1265,13 @@ const actionsMap =
canEdit ? {hint: lang.fileRename, icon: 'pencil-alt', onClick: renameDocFile.bind(this, file, doc)} : null,
canDelete ? {hint: lang.fileDelete, icon: 'trash', onClick: deleteDocFile.bind(this, file, doc)} : null,
].filter(Boolean);
}
},
'file-list': function(info)
{
return [hasPriv('exportFiles') ? {icon: 'export', text: getLang('export'), command: 'exportFiles'} : null];
},
};
function getActions(type, info)
@@ -1842,6 +1848,21 @@ const commands =
const url = $.createLink('ai', 'promptExecute', `promptId=${promptID}&objectId=${docID}&auto=0`);
$.ajaxSubmit({url: url, method: 'POST'});
},
/**
* 批量导出附件库中的附件。
* Batch export attachments in the attachment library.
*/
exportFiles: function(_, args)
{
const docApp = getDocApp();
const objectID = docApp.spaceID;
const objectType = docApp.spaceType;
const url = $.createLink('doc', 'exportfiles', `objectID=${objectID}&objectType=${objectType}`);
zui.Modal.open({url: url, size: 'sm'});
}
};
function getApiID(id)
@@ -2089,7 +2110,8 @@ function getTableOptions(options, info)
}
if(info.type === 'file-list')
{
const tableCols = lang.fileTableCols;
const tableCols = lang.fileTableCols;
const canExportFiles = hasPriv('exportFiles');
options.cols.forEach(col =>
{
if(typeof tableCols[col.name] === 'string') col.title = tableCols[col.name];
@@ -2108,7 +2130,19 @@ function getTableOptions(options, info)
return onRenderCellBackup.call(this,result,info);
}
}
if(col.name === 'id' && canExportFiles) col.checkbox = true;
});
if(canExportFiles)
{
options.checkable = true;
options.onCheckChange = function(changes)
{
const checkedList = this.getChecks();
$.cookie.set('checkedFileItem', checkedList, {expires:config.cookieLife, path:config.webRoot});
}
}
return options;
}
if(!hasPriv('batchMoveDoc') && !hasPriv('exportDoc'))
{