|
|
|
|
@ -1080,7 +1080,7 @@ import {
|
|
|
|
|
negativeExport, |
|
|
|
|
delNegative, |
|
|
|
|
updateNegative, |
|
|
|
|
transferTodo, generateReport, |
|
|
|
|
transferTodo, createReportTask, |
|
|
|
|
} from "@/api/work/negative"; |
|
|
|
|
import { getDictLable, formatTimeText, getInvolveProblem ,getYearTime} from "@/utils/util"; |
|
|
|
|
import feedback from "@/utils/feedback"; |
|
|
|
|
@ -1223,50 +1223,27 @@ async function handleExport() {
|
|
|
|
|
router.push("/negative/export"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const reportGenerationFun = async ()=>{ |
|
|
|
|
// await feedback.confirm("请确定生成当前页面数据的报告"); |
|
|
|
|
debugger |
|
|
|
|
console.log(userStore.user.userName) |
|
|
|
|
async function reportGenerationFun() { |
|
|
|
|
const crtTime = query.value.crtTime; |
|
|
|
|
if (!crtTime){ |
|
|
|
|
feedback.msgError("请选择对应录入时间") |
|
|
|
|
return |
|
|
|
|
if (!crtTime) { |
|
|
|
|
feedback.msgError("请选择对应录入时间"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const loading = ElLoading.service({ |
|
|
|
|
lock: true, |
|
|
|
|
text: "报告生成中...", |
|
|
|
|
text: "报告任务生成中...", |
|
|
|
|
background: "rgba(0, 0, 0, 0.5)", |
|
|
|
|
}); |
|
|
|
|
try { |
|
|
|
|
// 发送请求到后端生成报告 |
|
|
|
|
const body = JSON.parse(JSON.stringify(query.value)); |
|
|
|
|
const res = await generateReport(body); |
|
|
|
|
|
|
|
|
|
const blob = res.blob; |
|
|
|
|
|
|
|
|
|
let fileName = "研判分析报告.docx"; |
|
|
|
|
|
|
|
|
|
if (res.disposition) { |
|
|
|
|
const match = res.disposition.match(/filename\*?=.*''(.+)/); |
|
|
|
|
if (match) { |
|
|
|
|
fileName = decodeURIComponent(match[1]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const url = window.URL.createObjectURL(blob); |
|
|
|
|
const link = document.createElement("a"); |
|
|
|
|
|
|
|
|
|
link.href = url; |
|
|
|
|
link.download = fileName; |
|
|
|
|
|
|
|
|
|
document.body.appendChild(link); |
|
|
|
|
link.click(); |
|
|
|
|
document.body.removeChild(link); |
|
|
|
|
|
|
|
|
|
window.URL.revokeObjectURL(url); |
|
|
|
|
loading.close(); |
|
|
|
|
} catch (error) { |
|
|
|
|
console.log(error) |
|
|
|
|
try { |
|
|
|
|
await createReportTask(query.value); |
|
|
|
|
feedback.msgSuccess("报告任务已生成,请到导出记录页面查看"); |
|
|
|
|
router.push("/negative/export"); |
|
|
|
|
} catch (e) { |
|
|
|
|
console.error(e); |
|
|
|
|
feedback.msgError("报告任务生成失败"); |
|
|
|
|
} finally { |
|
|
|
|
loading.close(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|