Browse Source

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

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

29
src/views/work/Query.vue

@ -468,13 +468,15 @@
</el-button>
</div>
<div class="flex between mt-20 mb-26">
<div class="flex gap-4">
<el-button type="primary" @click="handleExport"
>数据导出</el-button
>
<el-button type="primary" @click="reportGenerationFun"
<el-button type="primary" @click="handleReportGenerate"
v-if="userStore.user?.userName === 'oumyye'"
>报告生成</el-button
>
</div>
<div>
<el-switch
v-model="remainingTimeFlag"
@ -1223,29 +1225,32 @@ async function handleExport() {
router.push("/negative/export");
}
async function reportGenerationFun() {
async function handleReportGenerate() {
const crtTime = query.value.crtTime;
if (!crtTime) {
feedback.msgError("请选择对应录入时间");
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({
lock: true,
text: "报告任务生成中...",
background: "rgba(0, 0, 0, 0.5)",
});
try {
await createReportTask(query.value);
feedback.msgSuccess("报告任务已生成,请到导出记录页面查看");
router.push("/negative/export");
} catch (e) {
console.error(e);
feedback.msgError("报告任务生成失败");
} finally {
loading.close();
}
await feedback.confirm("报告任务已生成,请到导出记录页面查看");
router.push("/negative/export");
}

Loading…
Cancel
Save