|
@@ -5,6 +5,7 @@
|
|
<div class="card-header">
|
|
<div class="card-header">
|
|
<span class="header-title">报告详情</span>
|
|
<span class="header-title">报告详情</span>
|
|
<div class="header-actions">
|
|
<div class="header-actions">
|
|
|
|
+ <el-button @click="exportReportInfo" type="primary">导出报告</el-button>
|
|
<el-button @click="goBack" type="primary">返回</el-button>
|
|
<el-button @click="goBack" type="primary">返回</el-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -160,7 +161,7 @@ const fetchReport = async () => {
|
|
const reportId = parseInt(route.params.id as string)
|
|
const reportId = parseInt(route.params.id as string)
|
|
|
|
|
|
const response = await reportApi.getReport({ reportId: reportId })
|
|
const response = await reportApi.getReport({ reportId: reportId })
|
|
- report.value = response.data.data
|
|
|
|
|
|
+ report.value = response.data
|
|
} catch (error) {
|
|
} catch (error) {
|
|
ElMessage.error('获取报告信息失败')
|
|
ElMessage.error('获取报告信息失败')
|
|
}
|
|
}
|
|
@@ -225,6 +226,52 @@ const saveEdit = async () => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+const exportReportInfo = async () => {
|
|
|
|
+ try {
|
|
|
|
+ const reportId = parseInt(route.params.id as string)
|
|
|
|
+ const response = await reportApi.exportReportInfo({ reportId: reportId })
|
|
|
|
+ ElMessage.success('导出报告成功')
|
|
|
|
+ if(response.code == 200){
|
|
|
|
+ const guid = response.data
|
|
|
|
+ //执行下载
|
|
|
|
+ downLoad2(guid,report.value.reportName)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } catch (error) {
|
|
|
|
+ ElMessage.error('导出报告失败')
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//获取下载地址
|
|
|
|
+const getDownloadPath = (guid:string)=>{
|
|
|
|
+ if(!guid){
|
|
|
|
+ return ''
|
|
|
|
+ }
|
|
|
|
+ return `/api/fileManager/downloadFile?fileId=${guid}`
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+const downLoad2 = (guid:string,fileName="download") => {
|
|
|
|
+ //获取下载地址
|
|
|
|
+ const href = getDownloadPath(guid)
|
|
|
|
+ if(!href){
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ const anchor = document.createElement('a');
|
|
|
|
+ if ('download' in anchor) {
|
|
|
|
+ anchor.href = href;
|
|
|
|
+ anchor.setAttribute("download", fileName);
|
|
|
|
+ anchor.className = "download-js-link";
|
|
|
|
+ anchor.innerHTML = "downloading...";
|
|
|
|
+ anchor.style.display = "none";
|
|
|
|
+ document.body.appendChild(anchor);
|
|
|
|
+ setTimeout(function () {
|
|
|
|
+ anchor.click();
|
|
|
|
+ document.body.removeChild(anchor);
|
|
|
|
+ }, 66);
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
const cancelEdit = () => {
|
|
const cancelEdit = () => {
|
|
editingNewsId.value = null
|
|
editingNewsId.value = null
|
|
originalNews.value = null
|
|
originalNews.value = null
|