diff --git a/src/main/java/com/budwk/app/zhgh/dayofficework/honor/service/impl/HonorCommonServiceImpl.java b/src/main/java/com/budwk/app/zhgh/dayofficework/honor/service/impl/HonorCommonServiceImpl.java index 1359b0a..70b0163 100644 --- a/src/main/java/com/budwk/app/zhgh/dayofficework/honor/service/impl/HonorCommonServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/dayofficework/honor/service/impl/HonorCommonServiceImpl.java @@ -1,5 +1,6 @@ package com.budwk.app.zhgh.dayofficework.honor.service.impl; +import com.budwk.app.base.exception.BaseException; import com.budwk.app.base.service.impl.BaseServiceImpl; import com.budwk.app.zhgh.dayofficework.honor.constant.HonorTypeOrigin; import com.budwk.app.zhgh.dayofficework.honor.models.Honor; @@ -36,6 +37,9 @@ public class HonorCommonServiceImpl extends BaseServiceImpl implements Ho @Override public List getHonorBasicSettingsByQueryTypeCode(String queryTypeCode) { HonorBasicSettings basicSettings = dao().fetch(HonorBasicSettings.class, Cnd.where("queryTypeCode", "=", queryTypeCode)); + if (basicSettings == null) { + throw new BaseException("荣誉基础分类尚未配置,请联系管理员完善荣誉基础设置"); + } List query = dao().query(HonorBasicSettings.class, Cnd.where("parentId", "=", basicSettings.getId()).asc("`code`")); return query; } diff --git a/src/main/resources/views/platform/zhghh5/dayofficework/honor/manage/index.html b/src/main/resources/views/platform/zhghh5/dayofficework/honor/manage/index.html index 065ed53..7c6c734 100644 --- a/src/main/resources/views/platform/zhghh5/dayofficework/honor/manage/index.html +++ b/src/main/resources/views/platform/zhghh5/dayofficework/honor/manage/index.html @@ -77,8 +77,8 @@ layout("/layouts/platform_h5.html"){ -
可切换年度查看往年荣誉
+ :description="honorTypeError || ('暂无' + currentYear + '年度荣誉')"> +
可切换年度查看往年荣誉
@@ -92,6 +92,7 @@ layout("/layouts/platform_h5.html"){ activeTab: "labor", currentYear: new Date().getFullYear(), honorTypeList: [], + honorTypeError: "", honorTypeMap: { labor: null, studio: null @@ -226,9 +227,11 @@ layout("/layouts/platform_h5.html"){ const type = this.activeTab === "studio" ? this.honorTypeMap.studio : this.honorTypeMap.labor this.$set(this, "honorList", []) if (!type) { + this.honorTypeError = this.honorTypeError || "当前荣誉分类尚未配置,请联系管理员完善荣誉基础设置" this.$set(this, "tableLoading", false) return } + this.honorTypeError = "" this.tableLoading = true this.$axios.post("/platform/honor/manage/h5Data", { year: this.currentYear, @@ -317,6 +320,11 @@ layout("/layouts/platform_h5.html"){ if (!this._isDestroyed) { this.listHonor() } + }).catch((error) => { + if (!this._isDestroyed) { + this.honorTypeError = (error && error.msg) || "荣誉分类加载失败,请稍后重试" + this.tableLoading = false + } }) }, mounted() {