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