feat: 优化劳模先进报错

This commit is contained in:
2026-10-21 18:24:07 +08:00
parent 0a93a71346
commit 33818d0972
2 changed files with 14 additions and 2 deletions
@@ -1,5 +1,6 @@
package com.budwk.app.zhgh.dayofficework.honor.service.impl; 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.base.service.impl.BaseServiceImpl;
import com.budwk.app.zhgh.dayofficework.honor.constant.HonorTypeOrigin; import com.budwk.app.zhgh.dayofficework.honor.constant.HonorTypeOrigin;
import com.budwk.app.zhgh.dayofficework.honor.models.Honor; import com.budwk.app.zhgh.dayofficework.honor.models.Honor;
@@ -36,6 +37,9 @@ public class HonorCommonServiceImpl extends BaseServiceImpl<Honor> implements Ho
@Override @Override
public List<HonorBasicSettings> getHonorBasicSettingsByQueryTypeCode(String queryTypeCode) { public List<HonorBasicSettings> getHonorBasicSettingsByQueryTypeCode(String queryTypeCode) {
HonorBasicSettings basicSettings = dao().fetch(HonorBasicSettings.class, Cnd.where("queryTypeCode", "=", queryTypeCode)); HonorBasicSettings basicSettings = dao().fetch(HonorBasicSettings.class, Cnd.where("queryTypeCode", "=", queryTypeCode));
if (basicSettings == null) {
throw new BaseException("荣誉基础分类尚未配置,请联系管理员完善荣誉基础设置");
}
List<HonorBasicSettings> query = dao().query(HonorBasicSettings.class, Cnd.where("parentId", "=", basicSettings.getId()).asc("`code`")); List<HonorBasicSettings> query = dao().query(HonorBasicSettings.class, Cnd.where("parentId", "=", basicSettings.getId()).asc("`code`"));
return query; return query;
} }
@@ -77,8 +77,8 @@ layout("/layouts/platform_h5.html"){
</article> </article>
<van-empty v-if="honorList.length === 0" class="honor-empty" image="search" <van-empty v-if="honorList.length === 0" class="honor-empty" image="search"
:description="'暂无' + currentYear + '年度荣誉'"> :description="honorTypeError || ('暂无' + currentYear + '年度荣誉')">
<div class="honor-empty__hint">可切换年度查看往年荣誉</div> <div v-if="!honorTypeError" class="honor-empty__hint">可切换年度查看往年荣誉</div>
</van-empty> </van-empty>
</div> </div>
</div> </div>
@@ -92,6 +92,7 @@ layout("/layouts/platform_h5.html"){
activeTab: "labor", activeTab: "labor",
currentYear: new Date().getFullYear(), currentYear: new Date().getFullYear(),
honorTypeList: [], honorTypeList: [],
honorTypeError: "",
honorTypeMap: { honorTypeMap: {
labor: null, labor: null,
studio: null studio: null
@@ -226,9 +227,11 @@ layout("/layouts/platform_h5.html"){
const type = this.activeTab === "studio" ? this.honorTypeMap.studio : this.honorTypeMap.labor const type = this.activeTab === "studio" ? this.honorTypeMap.studio : this.honorTypeMap.labor
this.$set(this, "honorList", []) this.$set(this, "honorList", [])
if (!type) { if (!type) {
this.honorTypeError = this.honorTypeError || "当前荣誉分类尚未配置,请联系管理员完善荣誉基础设置"
this.$set(this, "tableLoading", false) this.$set(this, "tableLoading", false)
return return
} }
this.honorTypeError = ""
this.tableLoading = true this.tableLoading = true
this.$axios.post("/platform/honor/manage/h5Data", { this.$axios.post("/platform/honor/manage/h5Data", {
year: this.currentYear, year: this.currentYear,
@@ -317,6 +320,11 @@ layout("/layouts/platform_h5.html"){
if (!this._isDestroyed) { if (!this._isDestroyed) {
this.listHonor() this.listHonor()
} }
}).catch((error) => {
if (!this._isDestroyed) {
this.honorTypeError = (error && error.msg) || "荣誉分类加载失败,请稍后重试"
this.tableLoading = false
}
}) })
}, },
mounted() { mounted() {