import{d as w,O as M,i as d,o as A,g as a,R as x,B as c,h as p,F as N,T as D}from"./index-e308c7ec.js";import{M as F}from"./index-740abac3.js";import{M as I}from"./index-b6a8ef64.js";import{s as y,M as R,A as C,a as O,b as P,c as T,e as L}from"./api-ce6460f2.js";import{S as B}from"./skeletion-index-0fa21cac.js";import{M as V}from"./index-90726a6a.js";import{D as E,a as G}from"./index-3d258070.js";import{P as j}from"./index-a2161ccf.js";import{L as U}from"./index-64ac7a14.js";import"./index-a68ddf56.js";import"./index-46b2caad.js";import"./icon-student-default-4c78efb2.js";import"./index-1f0a723a.js";import"./index-72730134.js";import"./index-a6b95d9b.js";import"./index-d91c1a06.js";import"./use-tab-status-665308c9.js";const le=w({name:"student-manage",setup(){const l=M({page:1,rows:20,keyword:"",musicGroupId:"",statusList:["QUIT"],subjectId:"",vipFlag:""}),t=M({skelet:!0,refresh:!1,loading:!1,finshed:!1,list:[],musicGroups:[{text:"全部乐团",value:""}],musicGroupName:"全部乐团",subjects:[{text:"全部声部",value:""}],subjectName:"全部声部"}),m=d(),f=d(),g=d(),h=d(),S=()=>{P().then(e=>{let s=Array.isArray(e==null?void 0:e.data)?e.data:[];s.length&&(s=[{name:"全部乐团",id:""}].concat(s),t.musicGroups=s.map(o=>({text:o.name,value:o.id})))})},k=()=>{T().then(e=>{let s=Array.isArray(e==null?void 0:e.data)?e.data:[];s.length&&(s=[{name:"全部声部",id:""}].concat(s),t.subjects=s.map(o=>({text:o.name,value:o.id})))})},v=async()=>{t.loading=!0,L({...l,vipFlag:l.vipFlag==="1"?!0:l.vipFlag==="2"?!1:""}).then(e=>{var o;t.refresh&&(t.list=[]);const s=Array.isArray((o=e==null?void 0:e.data)==null?void 0:o.rows)?e.data.rows:[];t.list=t.list.concat(s),(!s.length||s.length<l.rows)&&(t.finshed=!0),l.page++}).catch(()=>{t.finshed=!0}).finally(()=>{setTimeout(()=>{t.loading=!1,t.refresh=!1,t.skelet=!1},500)})},b=()=>{l.page=1,t.refresh=!0,v()};return A(()=>{S(),k()}),()=>a("div",{class:y.container},[a(I,{position:"top"},{default:()=>[a(x,null,null),a(F,{placeholder:"请输入学员姓名",onSearch:e=>{l.keyword=e,b()}},null),a(E,null,{default:()=>[a(G,{ref:m,title:t.musicGroupName},{default:()=>[a(j,{ref:f,showToolbar:!1,visibleOptionNum:5,columns:t.musicGroups},null),a("div",{class:["btnGroupPopup","van-hairline--top"]},[a(c,{round:!0,onClick:()=>{var e;(e=m.value)==null||e.toggle(!1)}},{default:()=>[p("取消")]}),a(c,{disabled:!t.musicGroups.length,type:"primary",round:!0,onClick:()=>{var s,o,n,u,i,r;(o=(s=f.value)==null?void 0:s.confirm)==null||o.call(s);const e=(i=(u=(n=f.value)==null?void 0:n.getSelectedOptions)==null?void 0:u.call(n))==null?void 0:i[0];e&&(l.musicGroupId=e.value,t.musicGroupName=e.text,b()),(r=m.value)==null||r.toggle(!1)}},{default:()=>[p("确定")]})])]}),a(G,{ref:g,title:t.subjectName},{default:()=>[a(j,{ref:h,showToolbar:!1,visibleOptionNum:5,columns:t.subjects},null),a("div",{class:["btnGroupPopup","van-hairline--top"]},[a(c,{round:!0,onClick:()=>{var e;(e=g.value)==null||e.toggle(!1)}},{default:()=>[p("取消")]}),a(c,{disabled:!t.subjects.length,type:"primary",round:!0,onClick:()=>{var s,o,n,u,i,r;(o=(s=h.value)==null?void 0:s.confirm)==null||o.call(s);const e=(i=(u=(n=h.value)==null?void 0:n.getSelectedOptions)==null?void 0:u.call(n))==null?void 0:i[0];console.log(e),l.subjectId=e.value,t.subjectName=e.text,b(),(r=g.value)==null||r.toggle(!1)}},{default:()=>[p("确定")]})])]})]})]}),a(V,{modelValue:t.refresh,"onUpdate:modelValue":e=>t.refresh=e,onRefresh:()=>{l.page=1,t.finshed=!1,v()}},{default:()=>[a(U,{class:y.list,loading:t.loading,finished:t.finshed,onLoad:()=>{t.loading=!0,console.log("触底了"),v()}},{default:()=>[a(B,{loading:t.skelet},{default:()=>[a(N,null,[t.list.map(e=>a("div",{class:y.student},[a(R,{item:e},null),a(C,{item:e},null),a(O,{item:e},null)])),!t.loading&&!t.list.length&&a(D,{description:"暂无数据",style:{minHeight:"100%"}},null)])]})]})]})])}});export{le as default};
