From 4c05dc8311ad303155165a72baf0a9973f2e0317 Mon Sep 17 00:00:00 2001 From: zhangrui Date: Wed, 14 Oct 2026 09:26:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=93=E6=A3=80=E7=BB=9F=E8=AE=A1=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/HealthCheckupProjectServiceImpl.java | 12 ++- .../impl/HealthCheckupSingleServiceImpl.java | 8 ++ .../healthCheckup/statisticsSingle/index.html | 86 +++++++++++-------- 3 files changed, 70 insertions(+), 36 deletions(-) diff --git a/src/main/java/com/budwk/app/zhgh/dayofficework/healthCheckup/service/impl/HealthCheckupProjectServiceImpl.java b/src/main/java/com/budwk/app/zhgh/dayofficework/healthCheckup/service/impl/HealthCheckupProjectServiceImpl.java index ab936fca..151f11be 100644 --- a/src/main/java/com/budwk/app/zhgh/dayofficework/healthCheckup/service/impl/HealthCheckupProjectServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/dayofficework/healthCheckup/service/impl/HealthCheckupProjectServiceImpl.java @@ -20,6 +20,7 @@ import org.nutz.lang.random.R; import org.nutz.lang.util.NutMap; import java.util.List; +import java.util.ArrayList; import java.util.Set; import java.util.stream.Collectors; @@ -48,7 +49,16 @@ public class HealthCheckupProjectServiceImpl extends BaseServiceImpl()); + } project.getHealthCheckupProjectSubjects().forEach(v -> { v.setSubjectMoneys(dao().query(HealthCheckupProjectSubjectMoney.class, Cnd.where("subjectId", "=", v.getId()))); }); diff --git a/src/main/java/com/budwk/app/zhgh/dayofficework/healthCheckup/service/impl/HealthCheckupSingleServiceImpl.java b/src/main/java/com/budwk/app/zhgh/dayofficework/healthCheckup/service/impl/HealthCheckupSingleServiceImpl.java index 57e911ad..c3012345 100644 --- a/src/main/java/com/budwk/app/zhgh/dayofficework/healthCheckup/service/impl/HealthCheckupSingleServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/dayofficework/healthCheckup/service/impl/HealthCheckupSingleServiceImpl.java @@ -29,9 +29,17 @@ public class HealthCheckupSingleServiceImpl extends BaseServiceImpl()).addv("tableColumn", new ArrayList<>()); + } Sql sql = Sqls.create(""" SELECT su.id, diff --git a/src/main/resources/views/platform/zhgh/dayofficework/healthCheckup/statisticsSingle/index.html b/src/main/resources/views/platform/zhgh/dayofficework/healthCheckup/statisticsSingle/index.html index 38c14fd3..28ee3911 100644 --- a/src/main/resources/views/platform/zhgh/dayofficework/healthCheckup/statisticsSingle/index.html +++ b/src/main/resources/views/platform/zhgh/dayofficework/healthCheckup/statisticsSingle/index.html @@ -341,32 +341,42 @@ layout("/layouts/platform.html"){ this.noSelectOptionId = null this.selectByAdminDialogVisible = true }, - async yearChange() { - const resp = await this.$axios.post("/platform/healthCheckup/project/mange/getHealthCheckupProject", {year: this.pageForm.year}) - if (resp.code === 0) { - this.projectOptions = resp.data - if (resp.data && resp.data.length > 0) { - this.$set(this.pageForm, "projectId", resp.data[0].id) - } else { - this.$set(this.pageForm, "projectId", null) + yearChange() { + // 年度切换时先清理旧项目,避免无项目年度继续显示上一年度的数据。 + this.$set(this.pageForm, "projectId", null) + this.$set(this, "projectOptions", []) + this.getHealthCheckupSubject() + return this.$axios.post("/platform/healthCheckup/project/mange/getHealthCheckupProject", {year: this.pageForm.year}).then((resp) => { + if (resp.code === 0) { + this.$set(this, "projectOptions", resp.data || []) + if (this.projectOptions.length > 0) { + this.$set(this.pageForm, "projectId", this.projectOptions[0].id) + } + return this.getHealthCheckupSubject() } - await this.getHealthCheckupSubject() - } else { this.notifyError(resp.msg) - } + }) }, - async getHealthCheckupSubject() { - this.projectSubjectOptions = [] - const resp = await this.$axios.post("/platform/healthCheckup/project/mange/findOne", {id: this.pageForm.projectId}) - if (resp.code === 0) { - if (resp.data) { - this.projectInfo = resp.data - this.projectSubjectOptions = resp.data.healthCheckupProjectSubjects - } - } else { - this.notifyError(resp.msg) + getHealthCheckupSubject() { + this.$set(this, "projectInfo", {}) + this.$set(this, "projectSubjectOptions", []) + this.$set(this, "tableData", []) + // 未选项目时只刷新空表结构,不请求项目详情或人数统计。 + if (!this.pageForm.projectId) { + return this.pageData() } - this.doSearch() + return this.$axios.post("/platform/healthCheckup/project/mange/findOne", {id: this.pageForm.projectId}).then((resp) => { + if (resp.code === 0) { + if (resp.data) { + this.$set(this, "projectInfo", resp.data) + this.$set(this, "projectSubjectOptions", resp.data.healthCheckupProjectSubjects || []) + } else { + this.$set(this.pageForm, "projectId", null) + } + return this.pageData() + } + this.notifyError(resp.msg) + }) }, async queryCampus() { const resp = await this.$axios.post("/platform/healthCheckup/campus/queryCampus") @@ -377,14 +387,8 @@ layout("/layouts/platform.html"){ } }, - async pageData() { + pageData() { this.tableColumns = [] - const loading = this.$loading({ - lock: true, - text: '努力加载中。。。', - spinner: 'el-icon-loading', - background: 'rgba(0, 0, 0, 0.7)' - }); this.tableColumns.push( {prop: 'unionName', label: '所属工会'}, @@ -400,14 +404,26 @@ layout("/layouts/platform.html"){ {prop: "unselectedTeacherSum", label: "未选人数"} ) if (!this.pageForm.projectId) { - this.tableData = [] + this.$set(this, "tableData", []) + return } - const resp = await this.$axios.post(loc() + '/pageData', this.pageForm) - if (resp.code === 0) { - this.tableData = resp.data.tableList - } - loading.close() + this.tableLoading = true + const loading = this.$loading({ + lock: true, + text: '努力加载中。。。', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }) + return this.$axios.post(loc() + '/pageData', this.pageForm).then((resp) => { + if (resp.code === 0) { + this.$set(this, "tableData", resp.data.tableList) + } + }).finally(() => { + // 业务错误或网络异常也必须释放遮罩,保证页面可以重新查询。 + this.tableLoading = false + loading.close() + }) }, pageNumberChange(val) { this.pageFormUnion.pageNumber = val;