|
|
|
|
@ -186,6 +186,21 @@
|
|
|
|
|
/> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
<el-col :span="6"> |
|
|
|
|
<el-form-item label="报告时间" style="width: 360px; margin-bottom: 0;"> |
|
|
|
|
<el-date-picker |
|
|
|
|
v-model="query.reportDateRange" |
|
|
|
|
type="daterange" |
|
|
|
|
unlink-panels |
|
|
|
|
range-separator="至" |
|
|
|
|
start-placeholder="开始日期" |
|
|
|
|
end-placeholder="结束日期" |
|
|
|
|
value-format="YYYY-MM-DD" |
|
|
|
|
format="YYYY-MM-DD" |
|
|
|
|
style="width: 100%;" |
|
|
|
|
/> |
|
|
|
|
</el-form-item> |
|
|
|
|
</el-col> |
|
|
|
|
</el-row> |
|
|
|
|
<div class="form-row flex"> |
|
|
|
|
<label class="text-center">问题信息</label> |
|
|
|
|
@ -456,6 +471,9 @@
|
|
|
|
|
<el-button type="primary" @click="handleExport" |
|
|
|
|
>数据导出</el-button |
|
|
|
|
> |
|
|
|
|
<el-button type="primary" @click="reportGenerationFun" |
|
|
|
|
>报告生成</el-button |
|
|
|
|
> |
|
|
|
|
<div> |
|
|
|
|
<el-switch |
|
|
|
|
v-model="remainingTimeFlag" |
|
|
|
|
@ -1057,11 +1075,11 @@
|
|
|
|
|
import moment from "moment"; |
|
|
|
|
import { ElLoading } from "element-plus"; |
|
|
|
|
import { |
|
|
|
|
listNegative, |
|
|
|
|
negativeExport, |
|
|
|
|
delNegative, |
|
|
|
|
updateNegative, |
|
|
|
|
transferTodo, |
|
|
|
|
listNegative, |
|
|
|
|
negativeExport, |
|
|
|
|
delNegative, |
|
|
|
|
updateNegative, |
|
|
|
|
transferTodo, generateReport, |
|
|
|
|
} from "@/api/work/negative"; |
|
|
|
|
import { getDictLable, formatTimeText, getInvolveProblem ,getYearTime} from "@/utils/util"; |
|
|
|
|
import feedback from "@/utils/feedback"; |
|
|
|
|
@ -1202,6 +1220,57 @@ async function handleExport() {
|
|
|
|
|
router.push("/negative/export"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const reportGenerationFun = async ()=>{ |
|
|
|
|
// await feedback.confirm("请确定生成当前页面数据的报告"); |
|
|
|
|
debugger |
|
|
|
|
const reportDateRange = query.value.reportDateRange; |
|
|
|
|
if (!reportDateRange){ |
|
|
|
|
feedback.msgError("请选择对应报告时间") |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
const loading = ElLoading.service({ |
|
|
|
|
lock: true, |
|
|
|
|
text: "报告生成中...", |
|
|
|
|
background: "rgba(0, 0, 0, 0.5)", |
|
|
|
|
}); |
|
|
|
|
try { |
|
|
|
|
// 发送请求到后端生成报告 |
|
|
|
|
const body = { |
|
|
|
|
beginTime: query.value.reportDateRange[0], |
|
|
|
|
endTime: query.value.reportDateRange[1], |
|
|
|
|
} |
|
|
|
|
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) |
|
|
|
|
loading.close(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function handleDel(row) { |
|
|
|
|
await feedback.confirm(`确定删除该数据?`); |
|
|
|
|
await delNegative(row.id); |
|
|
|
|
|