import{d as b,T as x,a as e,$ as m,j as u,F as d,I as a,L as l,a0 as p,u as o,ac as j,ad as r,S as f,B as g}from"./vendor.a0144ce9.js";/* empty css                *//* empty css                *//* empty css               *//* empty css               *//* empty css               */import{c as n,a as h}from"./checkbox_default.25179a07.js";import{C as k}from"./index.3d95a92c.js";const _="_subjects_1t5fp_1",v="_subjectContainer_1t5fp_6",y="_subjectMaxLength_1t5fp_9",B="_title_1t5fp_19",C="_topBg_1t5fp_53",S="_checkbox_1t5fp_61",L="_name_1t5fp_66";var t={subjects:_,subjectContainer:v,subjectMaxLength:y,title:B,"subject-list":"_subject-list_1t5fp_37","subject-item":"_subject-item_1t5fp_43",topBg:C,checkbox:S,name:L},M=b({name:"SubjectList",props:{onChoice:{type:Function,default:s=>{}},choiceSubjectIds:{type:Array,default:[]},subjectList:{type:Array,default:[]},max:{type:Number,default:5},selectType:{type:String,default:"Checkbox"},single:{type:Boolean,default:!1}},data(){return{checkBox:[],checkboxRefs:[],radio:null}},async mounted(){this.checkBox=this.choiceSubjectIds},watch:{choiceSubjectIds(s,c){this.checkBox=[...s]}},methods:{onSelect(s){this.selectType==="Checkbox"?(this.max===this.checkBox.length&&!this.checkBox.includes(s)&&x(`\u4E50\u5668\u6700\u591A\u9009\u62E9${this.max}\u4E2A`),this.checkboxRefs[s].toggle()):this.selectType==="Radio"&&(this.radio=s)}},render(){return e("div",{class:t.subjects},[e("div",{class:t.subjectContainer},[this.subjectList.length?this.selectType==="Checkbox"?e(m,{modelValue:this.checkBox,"onUpdate:modelValue":s=>this.checkBox=s,max:this.max},{default:()=>[e("div",{class:t.subjectMaxLength},[u("\u6700\u591A\u53EF\u9009\u62E9"),this.max,u("\u4E2A\u4E50\u5668")]),!this.single&&this.subjectList.map(s=>s.subjects&&s.subjects.length>0?e(d,null,[e("div",{class:t.title},[s.name]),e("div",{class:t["subject-list"]},[s.subjects&&s.subjects.map(c=>e("div",{class:t["subject-item"],onClick:()=>this.onSelect(c.id)},[e(a,{src:c.img||"xxx",width:"100%",height:"100%",fit:"cover"},{loading:()=>e(l,{type:"spinner",size:20},null)}),e("div",{class:t.topBg},[e(p,{name:c.id,class:t.checkbox,disabled:!0,ref:i=>this.checkboxRefs[c.id]=i},{icon:i=>e(o,{name:i.checked?n:h,size:"20"},null)}),e("p",{class:t.name},[c.name])])]))])]):null),this.single?e("div",{class:t["subject-list"]},[this.subjectList.map(s=>e("div",{class:t["subject-item"],onClick:()=>this.onSelect(s.id)},[e(a,{src:s.img||"xxx",width:"100%",height:"100%",fit:"cover"},{loading:()=>e(l,{type:"spinner",size:20},null)}),e("div",{class:t.topBg},[e(p,{name:s.id,class:t.checkbox,disabled:!0,ref:c=>this.checkboxRefs[s.id]=c},{icon:c=>e(o,{name:c.checked?n:h,size:"20"},null)}),e("p",{class:t.name},[s.name])])]))]):null]}):e(j,{modelValue:this.radio,"onUpdate:modelValue":s=>this.radio=s},{default:()=>[!this.single&&this.subjectList.map(s=>s.subjects&&s.subjects.length>0?e(d,null,[e("div",{class:t.title},[s.name]),e("div",{class:t["subject-list"]},[s.subjects&&s.subjects.map(c=>e("div",{class:t["subject-item"],onClick:()=>this.onSelect(c.id)},[e(a,{src:c.img||"xxx",width:"100%",height:"100%",fit:"cover"},{loading:()=>e(l,{type:"spinner",size:20},null)}),e("div",{class:t.topBg},[e(r,{name:c.id,class:t.checkbox},{icon:i=>e(o,{name:i.checked?n:h,size:"20"},null)}),e("p",{class:t.name},[c.name])])]))])]):null),this.single?e("div",{class:t["subject-list"]},[this.subjectList.map(s=>e("div",{class:t["subject-item"],onClick:()=>this.onSelect(s.id)},[e(a,{src:s.img||"xxx",width:"100%",height:"100%",fit:"cover"},{loading:()=>e(l,{type:"spinner",size:20},null)}),e("div",{class:t.topBg},[e(r,{name:s.id,class:t.checkbox},{icon:c=>e(o,{name:c.checked?n:h,size:"20"},null)}),e("p",{class:t.name},[s.name])])]))]):null]}):e(k,{tips:"\u6682\u65E0\u58F0\u90E8\u6570\u636E",btnStatus:!1},null)]),this.subjectList.length>0&&e(f,{offsetBottom:0,position:"bottom"},{default:()=>[e("div",{class:"btnGroup"},[e(g,{round:!0,block:!0,type:"primary",style:{width:"96%",margin:"0 auto"},onClick:()=>this.onChoice(this.selectType==="Checkbox"?this.checkBox:this.radio)},{default:()=>[u("\u786E\u5B9A")]})])]})])}});export{M as S};
