1 |
- System.register(["./index-legacy-f35addb7-1715840129614.js"],(function(t,e){"use strict";var s,n,i,r;return{setters:[t=>{s=t.aW,n=t.aw,i=t.dg,r=t.dh}],execute:function(){const e=t("d",(t=>{if(null===t)return null;const s=Object.assign({},t);return Object.keys(s).forEach((n=>s[n]="object"==typeof t[n]?e(t[n]):t[n])),Array.isArray(t)?(s.length=t.length,Array.from(s)):s}));t("u",s("catch-store",{state:()=>({bookVersionList:[],musicTypeList:[],subjectList:[],musicInstrumentList:[],subjectInstruemnts:[]}),getters:{getBookVersion(){return this.bookVersionList},getMusicCategories(){return this.musicTypeList},getMusicInstruments(){return this.musicInstrumentList},getAllMusicCategories(){return[{name:"全部",id:null},...this.musicTypeList]},getSubjectList(){return this.subjectList},getSubjectAllList(){return[{name:"全部",id:null},...this.subjectList]},getEnableSubjects(){const t=[];return this.subjectList.forEach((e=>{if(e.enableFlag){const{instruments:s,...n}=e;if(s&&s.length>0){const e=[];s?.forEach((t=>{t.enableFlag&&e.push(t)})),e.length>0&&t.push({...n,instruments:e})}}})),t},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},setMusicInstruments(t){this.musicInstrumentList=t},async getSubjects(){try{if(this.getSubjectList&&this.getSubjectList.length>0)return Promise.resolve();const{data:t}=await n({delFlag:0,page:1,rows:999}),e=t||[],s=[];return e.forEach((t=>{if(t.instruments&&t.instruments.length>0){t.value=t.id,t.label=t.name,t.instruments.forEach((t=>{t.label=t.name,t.value=t.id}));const e={value:t.id,label:t.name,id:t.id,name:t.name,instruments:[]};t.instruments&&(1==t.instruments.length?(e.value=t.instruments[0].id,e.label=t.instruments[0].name,e.id=t.id,e.name=t.name):t.instruments.length>1&&t.instruments.forEach((t=>{t.label=t.name,t.value=t.id,e.instruments.push({label:t.name,value:t.id,id:t.id,name:t.name})}))),s.push(e)}})),this.setSubjects(e.filter((t=>t.instruments&&t.instruments.length>0))||0),this.setSubjectInstruemnts(s||[]),Promise.resolve()}catch(t){return Promise.reject(t)}},getEnableSingleAllSubjects(t){t=t||[];const s=[];this.getSubjectList.forEach((n=>{const i=e(n);Array.isArray(i.instruments)&&i.instruments.forEach((e=>{t.includes(e.id)&&(e.enableFlag=!0,i.enableFlag=!0)})),s.push(i)}));const n=[];return s.forEach((t=>{if(t.enableFlag){const{instruments:e,...s}=t,i=[];e?.forEach((t=>{t.enableFlag&&i.push(t)})),i.length>0&&n.push({...s,instruments:i})}})),n},async getMusicSheetCategory(t=!1){try{if(this.getMusicCategories&&this.getMusicCategories.length>0&&!t)return Promise.resolve();const{data:e}=await i({enable:!0,page:1,rows:999});return this.setMusicCategories(e.rows||[]),Promise.resolve()}catch(e){return Promise.reject(e)}},async getMusicInstrument(){try{if(this.getMusicInstruments&&this.getMusicInstruments.length>0)return Promise.resolve();const{data:t}=await r({enableFlag:!0});return console.log(t,"data"),this.setMusicInstruments(t||[]),Promise.resolve()}catch(t){return Promise.reject(t)}}}}))}}}));
|