diff --git a/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/controller/manage/TrainSignUpApplyController.java b/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/controller/manage/TrainSignUpApplyController.java index 7aca142..5f073af 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/controller/manage/TrainSignUpApplyController.java +++ b/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/controller/manage/TrainSignUpApplyController.java @@ -398,7 +398,7 @@ public class TrainSignUpApplyController { } TrainSignUpType type = trainSignUpActivityService.dao().fetch(TrainSignUpType.class, course.getCourseType()); if (type != null) { - if (type.getIsBringFamily() && type.getIsAddFamily()) { + if (Boolean.TRUE.equals(type.getIsBringFamily()) && Boolean.TRUE.equals(type.getIsAddFamily())) { List mobileColumnsValue = trainSignUpUser.getMobileColumnsValue(); NutMap map = mobileColumnsValue.stream().filter(o -> "xdqsrs".equals(o.getString("columnCode"))).findAny().orElse(null); number = map != null ? map.getInt("columnValue") : 0; @@ -441,7 +441,7 @@ public class TrainSignUpApplyController { cnd.and(new Static(" userId in (select id from user where unionid = '%s')".formatted(SecurityUtil.getUnionId()))); } cnd.asc("signUpTime"); - if (!type.getIsBringFamily() && course.getReserveMode() == 2) { + if (!Boolean.TRUE.equals(type.getIsBringFamily()) && course.getReserveMode() == 2) { List signUpUsers = dao.query(TrainSignUpUser.class, cnd); int thisSignUpUserCount = dao.count(TrainSignUpUser.class, Cnd.where("activityId", "=", activityId) diff --git a/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/service/impl/TrainSignUpActivityServiceImpl.java b/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/service/impl/TrainSignUpActivityServiceImpl.java index e3c1955..bbf60f3 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/service/impl/TrainSignUpActivityServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/service/impl/TrainSignUpActivityServiceImpl.java @@ -384,7 +384,8 @@ public class TrainSignUpActivityServiceImpl extends BaseServiceImpl course.getCoursePeopleNumber() ? 2 : 1); } else { trainSignUpUser.setState(1); @@ -463,8 +464,8 @@ public class TrainSignUpActivityServiceImpl extends BaseServiceImpl 0) { return (hasSignCount + current + currentFamilyNumber) > limitCount; @@ -487,8 +488,8 @@ public class TrainSignUpActivityServiceImpl extends BaseServiceImpl 0) { return (hasSignCount + current + currentFamilyNumber + course.getCourseReservedNumber()) > coursePeopleNumber; diff --git a/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/service/impl/TrainSignUpActivityStatisticsServiceImpl.java b/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/service/impl/TrainSignUpActivityStatisticsServiceImpl.java index 3403cb3..2e6ce56 100644 --- a/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/service/impl/TrainSignUpActivityStatisticsServiceImpl.java +++ b/src/main/java/com/budwk/app/zhgh/activity/trainSignUp/service/impl/TrainSignUpActivityStatisticsServiceImpl.java @@ -237,10 +237,11 @@ public class TrainSignUpActivityStatisticsServiceImpl extends BaseServiceImpl - + - + @@ -164,15 +165,27 @@ layout("/layouts/platform.html"){ .catch(() => {}) }, courseChange(val) { + if (!val) { + // 清除子活动时同步清空当前课程和状态,避免后续操作继续使用旧课程对象。 + this.$set(this, "course", {}) + this.$set(this, "reserveMode", 1) + const stateColumnIndex = this.tableColumns.findIndex((o) => o.prop === "state") + if (stateColumnIndex > -1) { + this.tableColumns.splice(stateColumnIndex, 1) + } + this.$refs.tool.app = this + this.doSearch() + return + } const course = this.courseList.find((o) => o.id === val) - this.course = course - this.reserveMode = course.reserveMode + this.$set(this, "course", course || {}) + this.$set(this, "reserveMode", course ? course.reserveMode : 1) if (this.reserveMode === 2) { this.tableColumns.push({ label: "报名状态", prop: "state", sortable: true }) } else { - const o = this.tableColumns.find((o) => o.label === "报名状态") - if (o !== null && o !== undefined) { - this.tableColumns.splice(this.tableColumns.length - 1, 1) + const stateColumnIndex = this.tableColumns.findIndex((o) => o.prop === "state") + if (stateColumnIndex > -1) { + this.tableColumns.splice(stateColumnIndex, 1) } } this.$refs.tool.app = this @@ -193,17 +206,29 @@ layout("/layouts/platform.html"){ }, async activityChange(val) { this.$nextTick(async () => { + if (!val) { + // 清除活动时同步清空子活动和相关状态,避免页面显示上一个活动的数据。 + this.$set(this.pageForm, "courseId", null) + this.$set(this, "courseList", []) + this.$set(this, "course", {}) + this.$set(this, "trainType", "培训班") + this.$set(this, "reserveMode", 1) + this.doSearch() + return + } const activity = this.activityList.find((o) => o.id === val) const type = this.dict.type.TRAIN_SIGNUP_TYPE?.find(o => o.code === activity.trainType) - this.trainType = type?.name || "培训班" + this.$set(this, "trainType", type?.name || "培训班") const resp = await this.$axios.post(loc() + "/getCourseByActivityId", { activityId: val }) - this.courseList = resp.data + this.$set(this, "courseList", resp.data || []) if(this.courseList.length > 0) { - this.$set(this.pageForm, "courseId", this.courseList[0].id) + await this.courseChange(this.courseList[0].id) } else { - this.pageForm.courseId = "" + this.$set(this.pageForm, "courseId", null) + this.$set(this, "course", {}) + this.$set(this, "reserveMode", 1) + this.doSearch() } - this.doSearch() }) }, async handleUser(userId) { @@ -214,15 +239,23 @@ layout("/layouts/platform.html"){ } }, async yearChange() { - this.pageForm.activityId = null + this.$set(this.pageForm, "activityId", null) + this.$set(this.pageForm, "courseId", null) + this.$set(this, "activityList", []) + this.$set(this, "courseList", []) + this.$set(this, "course", {}) + this.$set(this, "trainType", "培训班") + this.$set(this, "reserveMode", 1) await this.getActivityList() - await this.doSearch() + if (!this.activityList || this.activityList.length === 0) { + this.doSearch() + } }, async getActivityList() { const resp = await this.$axios.post("/platform/trainSignUp/statistics/activityList", { year: this.pageForm.year }) - this.activityList = resp.data + this.$set(this, "activityList", resp.data || []) if (this.activityList && this.activityList.length > 0) { - this.pageForm.activityId = this.activityList[0].id + this.$set(this.pageForm, "activityId", this.activityList[0].id) await this.activityChange(this.activityList[0].id) } },