import{dd as i,dC as a,dD as o}from"./index-f5a86b16-1706882452509.js";const l=i("catch-store",{state:()=>({bookVersionList:[],musicTypeList:[],subjectList:[],subjectInstruemnts:[]}),getters:{getBookVersion(){return this.bookVersionList},getMusicCategories(){return this.musicTypeList},getAllMusicCategories(){return[{name:"全部",id:null},...this.musicTypeList]},getSubjectList(){return this.subjectList},getSubjectAllList(){return[{name:"全部",id:null},...this.subjectList]},getSubjectInstruments(){return[{name:"全部",id:null,label:"全部",value:null},...this.subjectInstruemnts]}},actions:{setBookVersion(t){this.bookVersionList=t},setMusicCategories(t){this.musicTypeList=t},setSubjects(t){this.subjectList=t},setSubjectInstruemnts(t){this.subjectInstruemnts=t},async getSubjects(){try{if(this.getSubjectList&&this.getSubjectList.length>0)return Promise.resolve();const{data:t}=await a({enableFlag:!0,delFlag:0,page:1,rows:999}),r=t||[],u=[];return r.forEach(e=>{e.value=e.id,e.label=e.name,e.instruments&&e.instruments.length>0&&e.instruments.forEach(s=>{s.label=s.name,s.value=s.id});const n={value:e.id,label:e.name,id:e.id,name:e.name,instruments:[]};e.instruments&&(e.instruments.length==1?(n.value=e.instruments[0].id,n.label=e.instruments[0].name,n.id=e.id,n.name=e.name):e.instruments.length>1&&e.instruments.forEach(s=>{s.label=s.name,s.value=s.id,n.instruments.push({label:s.name,value:s.id,id:s.id,name:s.name})})),u.push(n)}),this.setSubjects(r||[]),this.setSubjectInstruemnts(u||[]),Promise.resolve()}catch(t){return Promise.reject(t)}},async getMusicSheetCategory(){try{if(this.getMusicCategories&&this.getMusicCategories.length>0)return Promise.resolve();const{data:t}=await o({enable:!0,page:1,rows:999});return this.setMusicCategories(t.rows||[]),Promise.resolve()}catch(t){return Promise.reject(t)}}}});export{l as u};
