catchData-legacy-786f1507-1734950731618.js 3.5 KB

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