From 21e06cb0a56820b2ebb9038b6768dfee9c5f348f Mon Sep 17 00:00:00 2001
From: Ly <503441659@qq.com>
Date: Mon, 7 Apr 2025 14:48:21 +0800
Subject: [PATCH] =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E9=98=9F=E9=95=BF=E7=9A=84?=
=?UTF-8?q?=E5=94=AF=E4=B8=80=E6=80=A7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../registrationGroup/components/stuList.vue | 32 ++++++++++++++++---
1 file changed, 27 insertions(+), 5 deletions(-)
diff --git a/src/views/registrationGroup/components/stuList.vue b/src/views/registrationGroup/components/stuList.vue
index fa3f655..5c47fdc 100644
--- a/src/views/registrationGroup/components/stuList.vue
+++ b/src/views/registrationGroup/components/stuList.vue
@@ -52,12 +52,17 @@
是否队长
- (row.captain = arr[0])"
- :options="options"
- :disabled="isDisable"
+ {row.captain =arr[0]
+ }"
+ @change="()=>checkUniqueness(row)"
+ :options="options">
+
+
@@ -133,6 +138,23 @@ const options = [
label: '否',
},
]
+//检查队长的唯一性
+const checkUniqueness = (row:any) =>{
+ //查询tableDate中队长的人数
+ const count = tableData.filter(item => item.captain === '1').length
+ if(count === 2){
+ ElMessage({
+ message:'已有队长人选!',
+ type:'error'
+ })
+ row.captain = '0'
+ }else if(count === 0){
+ ElMessage({
+ message:'请选择队长人选!',
+ type:'error'
+ })
+ }
+}
// 数据
const tableData = reactive([])