import{d as c,g as l,x as d,j as t,z as i,F as o,B as u}from"./index.3bfa6a0e.js";import{T as n}from"./index.c171ade0.js";import{S as p}from"./index.6bd4dfa5.js";const h="_filterTitle_182pr_1",m="_btnGroup_182pr_9",b="_searchResult_182pr_22",f="_searchTitle_182pr_26",_="_radio_182pr_32",j="_btn_182pr_9";var e={filterTitle:h,btnGroup:m,searchResult:b,searchTitle:f,"radio-group":"_radio-group_182pr_32",radio:_,"organ-radio":"_organ-radio_182pr_65",btn:j},v=c({name:"selectSubject",props:{isReset:{type:Boolean,default:!1},searchParams:{type:Object,default:{name:"",id:""}},isShowAllSubject:{type:Boolean,default:!1},type:{type:String,default:"MUSIC"},onComfirm:{type:Function,default:s=>{}}},data(){return{subject:{name:"\u5168\u90E8\u58F0\u90E8",id:""},subjectList:[],apiSuffix:l.platformType==="STUDENT"?"/api-student":"/api-teacher"}},mounted(){this.subject={name:this.searchParams.id?this.searchParams.name:"\u5168\u90E8\u58F0\u90E8",id:this.searchParams.id||""},this.getList()},methods:{async getList(){const{data:s}=await d.get(`${this.apiSuffix}/subject/subjectSelect?type=${this.type}`);Array.isArray(s)&&(this.subjectList=s)}},render(){return t(o,null,[t("div",{class:e.searchResult,style:{maxHeight:"45vh",overflowY:"auto"}},[this.isShowAllSubject&&t("div",{class:[e["radio-group"],e.radio,e["organ-radio"]]},[t(n,{size:"large",plain:this.subject.id=="",type:this.subject.id==""?"primary":"default",round:!0,onClick:()=>{this.subject={id:"",name:"\u5168\u90E8\u58F0\u90E8"}}},{default:()=>[i("\u5168\u90E8\u58F0\u90E8")]})]),this.subjectList.map(s=>s.subjects&&s.subjects.length>0&&t(o,null,[t("div",{class:e.searchTitle},[s.name]),t("div",{class:[e["radio-group"],e.radio,e["organ-radio"]]},[s.subjects.map(a=>{const r=a.id===Number(this.subject.id);return t(n,{size:"large",plain:r,type:r?"primary":"default",round:!0,onClick:()=>{this.subject={...a}}},{default:()=>[a.name]})})])]))]),t(p,{position:"bottom",offsetBottom:0},{default:()=>[t("div",{class:[e.btnGroup,this.isReset?"btnMore":""]},[this.isReset&&t(u,{plain:!0,round:!0,onClick:()=>{this.subject.name="\u5168\u90E8\u58F0\u90E8",this.subject.id="",this.onComfirm({...this.subject})}},{default:()=>[i("\u91CD \u7F6E")]}),t(u,{type:"primary",round:!0,block:!0,onClick:()=>{this.onComfirm({...this.subject})}},{default:()=>[i("\u786E \u8BA4")]})])]})])}});export{v as S};
