From e784b5d4a8c3a0b42e8a70f2f04d89364c96f669 Mon Sep 17 00:00:00 2001 From: hongqiwei <1143662660@qq.com> Date: Wed, 14 Oct 2026 16:38:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=AA=E4=BA=BA=E5=8F=AA?= =?UTF-8?q?=E8=83=BD=E6=8A=A5=E4=B8=A4=E9=A1=B9=E7=9A=84=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activity/sports/applyUser/applyUser.js | 144 +++++++++--------- 1 file changed, 73 insertions(+), 71 deletions(-) diff --git a/src/main/resources/views/platform/zhgh/activity/sports/applyUser/applyUser.js b/src/main/resources/views/platform/zhgh/activity/sports/applyUser/applyUser.js index c2aa6f1..fab8490 100644 --- a/src/main/resources/views/platform/zhgh/activity/sports/applyUser/applyUser.js +++ b/src/main/resources/views/platform/zhgh/activity/sports/applyUser/applyUser.js @@ -635,7 +635,7 @@ var ACTIVITY_SPORTS_APPLY_USER = { } }, //点击添加运动员操作 - async applyUser() { + applyUser() { const {isManGirlNum, restrictGirlNum, restrictBoyNum} = this.eventData if (!this.rightApplyUserList.length) { @@ -696,83 +696,85 @@ var ACTIVITY_SPORTS_APPLY_USER = { } } - const resp = await this.$axios.post(loc() + "/getActivityData", {activityId: this.activityData.id}) - const aa = resp.data.filter((v) => { - return this.rightApplyUserList.includes(v.userId) - }) - const groupData = groupBy(aa, (v) => { - return v.userId - }) - // 未配置限报数时不限制单项报名,避免 null 被 JavaScript 当作 0 比较。 - const hasSingleEventLimit = this.activityTableData.eveProjectType === '1' && - Number.isInteger(this.eventData.restrictRegNumber) && this.eventData.restrictRegNumber >= 0 - const cc = hasSingleEventLimit ? groupData.filter((v) => { - return v.length >= this.eventData.restrictRegNumber - }) : [] + this.$axios.post(loc() + "/getActivityData", {activityId: this.activityData.id}).then((resp) => { + const aa = resp.data.filter((v) => { + return this.rightApplyUserList.includes(v.userId) + }) + const groupData = groupBy(aa, (v) => { + return v.userId + }) + // 每人限报项目数只在综合赛单项中配置;个人赛不能使用隐藏的历史限报值。 + const hasSingleEventLimit = this.activityTableData.applyType === 2 && + this.activityTableData.eveProjectType === '1' && + Number.isInteger(this.eventData.restrictRegNumber) && this.eventData.restrictRegNumber >= 0 + const cc = hasSingleEventLimit ? groupData.filter((v) => { + return v.length >= this.eventData.restrictRegNumber + }) : [] - //从全部人员里找出右边框选择的人 - const arr = this.userList.filter((v) => { - return this.rightApplyUserList.includes(v.id) - }) - //表格的人员 - arr.forEach((v) => { - this.applyFromData.teamName=this.teamList.find(t=>t.id===this.applyFromData.teamId)?.name - const data = { - id: null, - loginname: v.loginname, - username: v.username, - age: v.age, - professionalLevel: v.professionalLevel, - birthday: v.birthday, - unitId: v.unitId, - unionId: v.unionId, - unitname: v.unitname, - userId: v.id, - mobile: v.mobile, - sex: v.sex, - awardsMode: this.activityTableData.eveProjectType, - activityId: this.activityData.id, - teamId: this.applyFromData.teamId, - team: this.applyFromData.teamName, - identity: ["1"], - eventId: this.eventData.eventId - } - //然后把每一个人加到全部报名的字段中 - this.applyUserList.push(data) + //从全部人员里找出右边框选择的人 + const arr = this.userList.filter((v) => { + return this.rightApplyUserList.includes(v.id) + }) + //表格的人员 + arr.forEach((v) => { + this.applyFromData.teamName=this.teamList.find(t=>t.id===this.applyFromData.teamId)?.name + const data = { + id: null, + loginname: v.loginname, + username: v.username, + age: v.age, + professionalLevel: v.professionalLevel, + birthday: v.birthday, + unitId: v.unitId, + unionId: v.unionId, + unitname: v.unitname, + userId: v.id, + mobile: v.mobile, + sex: v.sex, + awardsMode: this.activityTableData.eveProjectType, + activityId: this.activityData.id, + teamId: this.applyFromData.teamId, + team: this.applyFromData.teamName, + identity: ["1"], + eventId: this.eventData.eventId + } + //然后把每一个人加到全部报名的字段中 + this.applyUserList.push(data) + + //如果是单项判断每个人可以报几项 + if (hasSingleEventLimit) { + cc.forEach((z) => { + if (z[0]) { + const index = this.applyUserList.findIndex((x) => x.userId === z[0].userId && x.id === null) + if (index > -1) { + this.applyUserList.splice(index, 1) + } + } + }) + } + }) //如果是单项判断每个人可以报几项 if (hasSingleEventLimit) { - cc.forEach((z) => { - if (z[0]) { - const index = this.applyUserList.findIndex((x) => x.userId === z[0].userId && x.id === null) - if (index > -1) { - this.applyUserList.splice(index, 1) - } - } - }) + const usernames = cc.map((v) => v[0].username).join(",") + if (usernames) { + this.$notify({ + title: "警告", + message: usernames + "已报" + this.eventData.restrictRegNumber + "项", + type: "warning" + }) + } } - }) - //如果是单项判断每个人可以报几项 - if (hasSingleEventLimit) { - const usernames = cc.map((v) => v[0].username).join(",") - if (usernames) { - this.$notify({ - title: "警告", - message: usernames + "已报" + this.eventData.restrictRegNumber + "项", - type: "warning" - }) - } - } - - this.flushApplyUser(this.applyUserList) - this.$refs.transfer.clearQuery("right") - this.$refs.transfer.clearQuery("left") - this.leftApplyUserList = this.leftApplyUserList.filter((v) => { - return !this.applyUserTableData.map((v) => v.userId).includes(v.id) + this.flushApplyUser(this.applyUserList) + this.$refs.transfer.clearQuery("right") + this.$refs.transfer.clearQuery("left") + this.leftApplyUserList = this.leftApplyUserList.filter((v) => { + return !this.applyUserTableData.map((v) => v.userId).includes(v.id) + }) + this.rightApplyUserList = [] + this.sortApplyUserTableData() }) - this.rightApplyUserList = [] - this.sortApplyUserTableData() }, //勾选左边的框设置角色 setUserRole(num) {