import{d as G,O as w,i as m,o as S,g as a,R as j,B as f,h as i,F as D,T as I,N as T}from"./index-e362c2e8.js";import{M as B}from"./index-2a51a0f7.js";import{M as R}from"./index-cf657a5b.js";import{s as u,M as E,A as L,a as O,b as P,c as U,d as V,e as _}from"./api-8951fe73.js";import{S as q}from"./skeletion-index-e3ca124e.js";import{M as z}from"./index-04aee2cb.js";import{D as H,a as C}from"./index-8b701a0f.js";import{P as N}from"./index-14b5dea2.js";import{L as J}from"./index-7861a26d.js";import{I as A}from"./index-85ccd873.js";import"./index-6c6fed8e.js";import"./index-5c45ec33.js";import"./icon-student-default-4c78efb2.js";import"./index-5276fe86.js";import"./index-f2403653.js";import"./index-f57b4c5f.js";import"./use-tab-status-92e284d0.js";const K=""+new URL("icon-tuituan-124310f7.png",import.meta.url).href,Q=""+new URL("icon-zaidu-a09f5751.png",import.meta.url).href,pt=G({name:"student-manage",setup(){const k=T(),o=w({page:1,rows:20,keyword:"",musicGroupId:"",statusList:"",subjectId:"",vipFlag:""}),e=w({skelet:!0,refresh:!1,loading:!1,finshed:!1,list:[],studentCount:0,quitCount:0,musicGroups:[{text:"全部乐团",value:""}],musicGroupName:"全部乐团",subjects:[{text:"全部声部",value:""}],subjectName:"全部声部",studentTypes:[{text:"全部学员",value:""},{text:"团练宝学员",value:"1"},{text:"普通学员",value:"2"}],studentTypeName:"全部学员"}),g=m(),h=m(),v=m(),y=m(),x=()=>{P().then(t=>{let s=Array.isArray(t==null?void 0:t.data)?t.data:[];s.length&&(s=[{name:"全部乐团",id:""}].concat(s),e.musicGroups=s.map(l=>({text:l.name,value:l.id})))})},F=()=>{U().then(t=>{let s=Array.isArray(t==null?void 0:t.data)?t.data:[];s.length&&(s=[{name:"全部声部",id:""}].concat(s),e.subjects=s.map(l=>({text:l.name,value:l.id})))})},M=()=>{V({...o,vipFlag:o.vipFlag==="1"?!0:o.vipFlag==="2"?!1:""}).then(t=>{const s=t==null?void 0:t.data;s&&(e.studentCount=s.studentCount,e.quitCount=s.quitCount)})},b=async()=>{e.loading=!0,_({...o,vipFlag:o.vipFlag==="1"?!0:o.vipFlag==="2"?!1:""}).then(t=>{var l;e.refresh&&(e.list=[]);const s=Array.isArray((l=t==null?void 0:t.data)==null?void 0:l.rows)?t.data.rows:[];e.list=e.list.concat(s),!s.length||s.length{e.finshed=!0}).finally(()=>{setTimeout(()=>{e.loading=!1,e.refresh=!1,e.skelet=!1},500)})},p=()=>{o.page=1,e.refresh=!0,M(),b()};return S(()=>{x(),F(),M()}),()=>a("div",{class:u.container},[a(R,{position:"top"},{default:()=>[a(j,null,null),a(B,{disabled:e.loading,placeholder:"请输入学员姓名",onSearch:t=>{o.keyword=t,p()}},null),a(H,null,{default:()=>[a(C,{ref:g,title:e.musicGroupName},{default:()=>[a(N,{ref:h,showToolbar:!1,visibleOptionNum:5,columns:e.musicGroups},null),a("div",{class:["btnGroupPopup","van-hairline--top"]},[a(f,{round:!0,onClick:()=>{var t;(t=g.value)==null||t.toggle(!1)}},{default:()=>[i("取消")]}),a(f,{disabled:!e.musicGroups.length,type:"primary",round:!0,onClick:()=>{var s,l,n,r,d,c;(l=(s=h.value)==null?void 0:s.confirm)==null||l.call(s);const t=(d=(r=(n=h.value)==null?void 0:n.getSelectedOptions)==null?void 0:r.call(n))==null?void 0:d[0];t&&(o.musicGroupId=t.value,e.musicGroupName=t.text,p()),(c=g.value)==null||c.toggle(!1)}},{default:()=>[i("确定")]})])]}),a(C,{ref:v,title:e.subjectName},{default:()=>[a(N,{ref:y,showToolbar:!1,visibleOptionNum:5,columns:e.subjects},null),a("div",{class:["btnGroupPopup","van-hairline--top"]},[a(f,{round:!0,onClick:()=>{var t;(t=v.value)==null||t.toggle(!1)}},{default:()=>[i("取消")]}),a(f,{disabled:!e.subjects.length,type:"primary",round:!0,onClick:()=>{var s,l,n,r,d,c;(l=(s=y.value)==null?void 0:s.confirm)==null||l.call(s);const t=(d=(r=(n=y.value)==null?void 0:n.getSelectedOptions)==null?void 0:r.call(n))==null?void 0:d[0];console.log(t),o.subjectId=t.value,e.subjectName=t.text,p(),(c=v.value)==null||c.toggle(!1)}},{default:()=>[i("确定")]})])]}),a(C,{class:u.dropdownItem,title:e.studentTypeName,modelValue:o.vipFlag,"onUpdate:modelValue":t=>o.vipFlag=t,options:e.studentTypes,onChange:t=>{var s;e.studentTypeName=((s=e.studentTypes.find(l=>l.value==t))==null?void 0:s.text)||"",p()}},null)]})]}),a(z,{modelValue:e.refresh,"onUpdate:modelValue":t=>e.refresh=t,onRefresh:()=>{o.page=1,e.finshed=!1,b()}},{default:()=>[a(J,{class:u.list,loading:e.loading,finished:e.finshed,onLoad:()=>{e.loading=!0,console.log("触底了"),b()}},{default:()=>[a(q,{loading:e.skelet},{default:()=>[a(D,null,[a("div",{class:u.statistics},[a("div",{class:u.statisticsItem},[a(A,{class:u.iconstatistics,src:Q},null),a("div",{class:u.statisticsDes},[a("div",{style:{color:"#333"}},[a("span",{class:u.statisticsNum,style:{color:"#333"}},[e.studentCount]),i("人")]),a("div",null,[i("在读学员")])])]),a("div",{class:u.statisticsItem,onClick:()=>{k.push({path:"/student-manage-withdraw"})}},[a(A,{class:u.iconstatistics,src:K},null),a("div",{class:u.statisticsDes},[a("div",{style:{color:"#333"}},[a("span",{class:u.statisticsNum,style:{color:"#FC1A19"}},[e.quitCount]),i("人")]),a("div",null,[i("退团人数")])])])]),e.list.map(t=>a("div",{class:u.student,key:t.studentId},[a(E,{item:t},null),a(L,{item:t},null),a(O,{item:t},null)])),!e.loading&&!e.list.length&&a(I,{description:"暂无数据",style:{minHeight:"100%"}},null)])]})]})]})])}});export{pt as default};