import{d as x,O as C,i as d,o as F,g as a,R as G,B as p,h as n,F as j,S as k,N as D}from"./index-8911ca98.js";import{M as B}from"./index-ddc128fa.js";import{M as I}from"./index-4e5e1d77.js";import{s as u,M as R,A as T,a as E,b as L,c as O,d as P,e as U}from"./api-7b5eaa81.js";import{S as V}from"./skeletion-index-d597f7a8.js";import{M as _}from"./index-ea97d764.js";import{D as q,a as h}from"./index-606c5b98.js";import{P as M}from"./index-2f907b0c.js";import{L as z}from"./index-7307e9a6.js";import{I as N}from"./index-4522bae7.js";import"./index-5b3efa5e.js";import"./index-8a6d93dd.js";import"./icon-student-default-4c78efb2.js";import"./index-be98d0cb.js";import"./index-d1bd0ef8.js";import"./index-22aba85d.js";import"./use-tab-status-5da328dc.js";const H=""+new URL("icon-tuituan-124310f7.png",import.meta.url).href,J=""+new URL("icon-zaidu-a09f5751.png",import.meta.url).href,ct=x({name:"student-manage",setup(){const w=D(),l=C({page:1,rows:20,keyword:"",musicGroupId:"",statusList:"",subjectId:"",vipFlag:""}),e=C({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:"全部学员"}),m=d(),v=d(),f=d(),y=d(),A=()=>{L().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(o=>({text:o.name,value:o.id})))})},S=()=>{O().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(o=>({text:o.name,value:o.id})))})},b=()=>{P({...l,vipFlag:l.vipFlag==="1"?!0:l.vipFlag==="2"?!1:""}).then(t=>{const s=t==null?void 0:t.data;s&&(e.studentCount=s.studentCount,e.quitCount=s.quitCount)})},g=async()=>{e.loading=!0,U({...l,vipFlag:l.vipFlag==="1"?!0:l.vipFlag==="2"?!1:""}).then(t=>{var o;e.refresh&&(e.list=[]);const s=Array.isArray((o=t==null?void 0:t.data)==null?void 0:o.rows)?t.data.rows:[];e.list=e.list.concat(s),(!s.length||s.length<l.rows)&&(e.finshed=!0),l.page++}).catch(()=>{e.finshed=!0}).finally(()=>{setTimeout(()=>{e.loading=!1,e.refresh=!1,e.skelet=!1},500)})},c=()=>{l.page=1,e.refresh=!0,b(),g()};return F(()=>{A(),S(),b()}),()=>a("div",{class:u.container},[a(I,{position:"top"},{default:()=>[a(G,null,null),a(B,{placeholder:"请输入学员姓名",onSearch:t=>{l.keyword=t,c()}},null),a(q,null,{default:()=>[a(h,{ref:m,title:e.musicGroupName},{default:()=>[a(M,{ref:v,showToolbar:!1,visibleOptionNum:5,columns:e.musicGroups},null),a("div",{class:["btnGroupPopup","van-hairline--top"]},[a(p,{round:!0,onClick:()=>{var t;(t=m.value)==null||t.toggle(!1)}},{default:()=>[n("取消")]}),a(p,{disabled:!e.musicGroups.length,type:"primary",round:!0,onClick:()=>{var s,o,i,r;(s=m.value)==null||s.toggle(!1);const t=(r=(i=(o=v.value)==null?void 0:o.getSelectedOptions)==null?void 0:i.call(o))==null?void 0:r[0];t&&(l.musicGroupId=t.value,e.musicGroupName=t.text,c())}},{default:()=>[n("确定")]})])]}),a(h,{ref:f,title:e.subjectName},{default:()=>[a(M,{ref:y,showToolbar:!1,visibleOptionNum:5,columns:e.subjects},null),a("div",{class:["btnGroupPopup","van-hairline--top"]},[a(p,{round:!0,onClick:()=>{var t;(t=f.value)==null||t.toggle(!1)}},{default:()=>[n("取消")]}),a(p,{disabled:!e.subjects.length,type:"primary",round:!0,onClick:()=>{var s,o,i,r;(s=f.value)==null||s.toggle(!1);const t=(r=(i=(o=y.value)==null?void 0:o.getSelectedOptions)==null?void 0:i.call(o))==null?void 0:r[0];console.log(t),l.subjectId=t.value,e.subjectName=t.text,c()}},{default:()=>[n("确定")]})])]}),a(h,{title:e.studentTypeName,modelValue:l.vipFlag,"onUpdate:modelValue":t=>l.vipFlag=t,options:e.studentTypes,onChange:t=>{var s;e.studentTypeName=((s=e.studentTypes.find(o=>o.value==t))==null?void 0:s.text)||"",c()}},null)]})]}),a(_,{modelValue:e.refresh,"onUpdate:modelValue":t=>e.refresh=t,onRefresh:()=>{l.page=1,e.finshed=!1,g()}},{default:()=>[a(z,{class:u.list,loading:e.loading,finished:e.finshed,onLoad:()=>{e.loading=!0,console.log("触底了"),g()}},{default:()=>[a(V,{loading:e.skelet},{default:()=>[a(j,null,[a("div",{class:u.statistics},[a("div",{class:u.statisticsItem},[a(N,{class:u.iconstatistics,src:J},null),a("div",{class:u.statisticsDes},[a("div",{style:{color:"#333"}},[a("span",{class:u.statisticsNum,style:{color:"#333"}},[e.studentCount]),n("人")]),a("div",null,[n("在读学员")])])]),a("div",{class:u.statisticsItem,onClick:()=>{w.push({path:"/student-manage-withdraw"})}},[a(N,{class:u.iconstatistics,src:H},null),a("div",{class:u.statisticsDes},[a("div",{style:{color:"#333"}},[a("span",{class:u.statisticsNum,style:{color:"#FC1A19"}},[e.quitCount]),n("人")]),a("div",null,[n("退团人数")])])])]),e.list.map(t=>a("div",{class:u.student},[a(R,{item:t},null),a(T,{item:t},null),a(E,{item:t},null)])),!e.loading&&!e.list.length&&a(k,{description:"暂无数据",style:{minHeight:"100%"}},null)])]})]})]})])}});export{ct as default};
