Browse Source

fix--生成报告按钮样式调整

master
parent
commit
2f21836eb7
  1. 31
      src/views/work/Query.vue

31
src/views/work/Query.vue

@ -468,13 +468,15 @@
</el-button> </el-button>
</div> </div>
<div class="flex between mt-20 mb-26"> <div class="flex between mt-20 mb-26">
<div class="flex gap-4">
<el-button type="primary" @click="handleExport" <el-button type="primary" @click="handleExport"
>数据导出</el-button >数据导出</el-button
> >
<el-button type="primary" @click="reportGenerationFun" <el-button type="primary" @click="handleReportGenerate"
v-if="userStore.user?.userName === 'oumyye'" v-if="userStore.user?.userName === 'oumyye'"
>报告生成</el-button >报告生成</el-button
> >
</div>
<div> <div>
<el-switch <el-switch
v-model="remainingTimeFlag" v-model="remainingTimeFlag"
@ -1223,29 +1225,32 @@ async function handleExport() {
router.push("/negative/export"); router.push("/negative/export");
} }
async function reportGenerationFun() { async function handleReportGenerate() {
const crtTime = query.value.crtTime; const crtTime = query.value.crtTime;
if (!crtTime) { if (!crtTime) {
feedback.msgError("请选择对应录入时间"); feedback.msgError("请选择对应录入时间");
return; return;
} }
//
if (crtTime.length === 2) {
const startDate = new Date(crtTime[0]);
const endDate = new Date(crtTime[1]);
const timeDiff = endDate - startDate;
const yearDiff = timeDiff / (1000 * 60 * 60 * 24 * 365);
if (yearDiff > 1) {
feedback.msgError("所选时间跨度不能超过一年");
return;
}
}
const loading = ElLoading.service({ const loading = ElLoading.service({
lock: true, lock: true,
text: "报告任务生成中...", text: "报告任务生成中...",
background: "rgba(0, 0, 0, 0.5)", background: "rgba(0, 0, 0, 0.5)",
}); });
try {
await createReportTask(query.value); await createReportTask(query.value);
feedback.msgSuccess("报告任务已生成,请到导出记录页面查看");
router.push("/negative/export");
} catch (e) {
console.error(e);
feedback.msgError("报告任务生成失败");
} finally {
loading.close(); loading.close();
} await feedback.confirm("报告任务已生成,请到导出记录页面查看");
router.push("/negative/export");
} }

Loading…
Cancel
Save