Browse Source

feat(survey): MemberChipPicker 新增 single 单选模式(默认 false 不影响方案问卷)(任务 1/5)

Agnes Agent 1 day ago
parent
commit
20b1a12d2a
1 changed files with 11 additions and 0 deletions
  1. 11 0
      cfc-frontend/pages/health/components/MemberChipPicker.vue

+ 11 - 0
cfc-frontend/pages/health/components/MemberChipPicker.vue

@@ -36,6 +36,11 @@ export default {
     selectedIds: {
       type: Array,
       default: function() { return [] }
+    },
+    // 单选模式:点击只选一个(独立健康问卷用);默认 false 时保持原多选行为(方案问卷)
+    single: {
+      type: Boolean,
+      default: false
     }
   },
   data: function() {
@@ -58,6 +63,12 @@ export default {
     },
     toggleMember: function(id) {
       var strId = String(id)
+      // 单选模式:直接选中当前项(再点同一项不取消,避免无成员状态)
+      if (this.single) {
+        this.applySelected([strId])
+        this.emitChange()
+        return
+      }
       var ids = []
       var i
       for (i = 0; i < this.members.length; i++) {