可信代码库-开源软件列表调用导出接口
This commit is contained in:
@@ -513,21 +513,28 @@ onMounted(async () => {
|
||||
});
|
||||
|
||||
const exportResult = async () => {
|
||||
const selectDatas = filterTableRef.value.store.getCheckedRows().map((d) => d.id);
|
||||
if (!allTableData.value.length || selectDatas.length <= 0) {
|
||||
Message.info('未选择任何数据');
|
||||
return;
|
||||
}
|
||||
|
||||
const { data, error } = await getReleaseExport({
|
||||
softwareName: newFormData.value.softwareName || '',
|
||||
searchType: newFormData.value.searchType || '',
|
||||
softwareVersion: newFormData.value.softwareVersion || '',
|
||||
programmingLanguage: newFormData.value.programmingLanguage || '',
|
||||
interestTag: newFormData.value.interestTag || '',
|
||||
industry: newFormData.value.industry || '',
|
||||
licenseName: newFormData.value.licenseName || '',
|
||||
dependentSoftware: newFormData.value.dependentSoftware || '',
|
||||
releaseDateStart:
|
||||
newFormData.value.dateRange && newFormData.value.dateRange.length > 0 ? newFormData.value.dateRange[0] : '',
|
||||
releaseDateEnd:
|
||||
newFormData.value.dateRange && newFormData.value.dateRange.length > 0 ? newFormData.value.dateRange[1] : '',
|
||||
current: pager.value.pageIndex,
|
||||
size: pager.value.pageSize
|
||||
list: selectDatas,
|
||||
// softwareName: newFormData.value.softwareName || '',
|
||||
// searchType: newFormData.value.searchType || '',
|
||||
// softwareVersion: newFormData.value.softwareVersion || '',
|
||||
// programmingLanguage: newFormData.value.programmingLanguage || '',
|
||||
// interestTag: newFormData.value.interestTag || '',
|
||||
// industry: newFormData.value.industry || '',
|
||||
// licenseName: newFormData.value.licenseName || '',
|
||||
// dependentSoftware: newFormData.value.dependentSoftware || '',
|
||||
// releaseDateStart:
|
||||
// newFormData.value.dateRange && newFormData.value.dateRange.length > 0 ? newFormData.value.dateRange[0] : '',
|
||||
// releaseDateEnd:
|
||||
// newFormData.value.dateRange && newFormData.value.dateRange.length > 0 ? newFormData.value.dateRange[1] : '',
|
||||
// current: pager.value.pageIndex,
|
||||
// size: pager.value.pageSize
|
||||
});
|
||||
if (data && !error) {
|
||||
debugger
|
||||
@@ -542,12 +549,12 @@ const exportResult = async () => {
|
||||
// 从Content-Disposition头中获取文件名,或者使用默认文件名
|
||||
const contentDisposition = data.headers['content-disposition'];
|
||||
let fileName = 'export.xlsx'; // 默认文件名
|
||||
if (contentDisposition) {
|
||||
const fileNameMatch = contentDisposition.match(/filename="?(.+)"?/);
|
||||
if (fileNameMatch && fileNameMatch[1]) {
|
||||
fileName = fileNameMatch[1].replace(/^[^0-9]*|[^0-9.xlsx]*$/g, "");
|
||||
}
|
||||
}
|
||||
// if (contentDisposition) {
|
||||
// const fileNameMatch = contentDisposition.match(/filename="?(.+)"?/);
|
||||
// if (fileNameMatch && fileNameMatch[1]) {
|
||||
// fileName = fileNameMatch[1].replace(/^[^0-9]*|[^0-9.xlsx]*$/g, "");
|
||||
// }
|
||||
// }
|
||||
|
||||
link.setAttribute('download', fileName);
|
||||
document.body.appendChild(link);
|
||||
|
||||
Reference in New Issue
Block a user