index.b4d1f58a.js 5.1 KB

1
  1. import{d as C,r as g,Z as S,$ as N,c as s,aj as k,q as n,ak as y,B as w,P as b,al as x,m as p,g as h}from"./index.5f7ffb46.js";import{O as m}from"./index.7790de2a.js";import{i as I}from"./icon_teacher.df08d662.js";import{L as E}from"./index.9ef28852.js";import{C as B}from"./index.d979c853.js";import{C as P}from"./index.052b3caa.js";import{C as G}from"./index.abd668f7.js";import{I as L}from"./index.276a5d68.js";import{T as O}from"./index.ab2541bb.js";import{C as T}from"./index.13900508.js";import{G as F,a as u}from"./index.adf0b8fc.js";import{P as A}from"./index.de1f78a6.js";const V="_searchBand_1s5pv_1",j="_bandName_1s5pv_7",R="_gridContainer_1s5pv_12",W="_title_1s5pv_15",D="_red_1s5pv_25",q="_name_1s5pv_28",U="_gridClass_1s5pv_33",H="_img_1s5pv_33",M="_teacherName_1s5pv_40",Z="_maxWidth_1s5pv_44",$="_classCheckbox_1s5pv_57",z="_orchestraName_1s5pv_61",J="_className_1s5pv_71",K="_line_1s5pv_78",Q="_classCellGroup_1s5pv_100";var t={searchBand:V,bandName:j,gridContainer:R,title:W,red:D,name:q,gridClass:U,img:H,teacherName:M,maxWidth:Z,classCheckbox:$,orchestraName:z,className:J,line:K,classCellGroup:Q};function X(o){return typeof o=="function"||Object.prototype.toString.call(o)==="[object Object]"&&!x(o)}var he=C({name:"practice-class",props:{classType:{type:String,default:""},orchestraId:{type:String,default:""},selectItem:{type:Array,default:()=>[]}},emits:["close","confirm"],setup(o,{slots:Y,attrs:ee,emit:d}){const e=g({showPopover:!1,orchestraId:o.orchestraId||null,orchestraName:null,orchestraList:[],isClick:!1,list:[],listState:{dataShow:!0,loading:!1,finished:!1},params:{page:1,rows:20},check:o.selectItem||[],checkboxRefs:[]}),f=async()=>{try{const{data:r}=await p.post("/api-school/orchestra/page",{data:{page:1,rows:100,schoolId:h.user.data.school.id,status:"DONE"}}),a=r.rows||[],l=[];a.forEach(i=>{l.push({text:i.name,value:i.id})}),e.orchestraList=[...l],l.length>0&&(e.orchestraId=l[0].value,e.orchestraName=l[0].text,await c())}catch{}},c=async()=>{try{if(e.isClick)return;e.isClick=!0;const{data:r}=await p.post("/api-school/classGroup/page",{data:{...e.params,schoolId:h.user.data.school.id,orchestraId:e.orchestraId,classType:o.classType}});e.isClick=!1,e.listState.loading=!1;const a=r||{};if(e.list.length>0&&a.current===1)return;e.list.concat(a.rows||[]).forEach(i=>{i.preStudentNum>0&&e.list.push(i)}),e.listState.finished=a.current>=a.pages,e.params.page=a.current+1,e.listState.dataShow=e.list.length>0}catch{e.listState.dataShow=!1,e.listState.finished=!0,e.isClick=!1}};S(()=>o.classType,()=>{e.params.page=1,e.list=[],e.listState.dataShow=!0,e.listState.loading=!1,e.listState.finished=!1,c()});const _=r=>{e.checkboxRefs[r].toggle()},v=()=>{d("confirm",e.check),d("close")};return N(async()=>{o.orchestraId?await c():await f()}),()=>{let r;return s("div",{class:[t.practiceClass,!e.listState.dataShow&&"emptyRootContainer"]},[s(m,{position:"top"},{default:()=>[s(k,{title:"\u9009\u62E9\u73ED\u7EA7",desotry:!1},null),!o.orchestraId&&s("div",{class:"searchGroup-single"},[s("div",{class:["searchItem",e.showPopover&&"searchItem-active"],onClick:()=>e.showPopover=!0},[s("span",null,[e.orchestraName])])])]}),e.listState.dataShow?s(E,{finished:e.listState.finished,style:{marginTop:o.orchestraId?"12px":0},finishedText:" ",class:[t.liveList],onLoad:c,immediateCheck:!1},{default:()=>[s(B,{class:[t.gridContainer,t.gridClass],modelValue:e.check,"onUpdate:modelValue":a=>e.check=a},X(r=e.list.map(a=>s(P,{class:t.classCellGroup,onClick:()=>{a.teacherId&&_(a.id)},border:!1},{default:()=>[s(G,{center:!0,titleStyle:{flex:"0 auto"},valueClass:t.classCheckbox},{icon:()=>s(L,{src:I,class:t.img},null),title:()=>s("div",{class:t.content},[s("div",{class:t.teacherName},[a.teacherName?s("div",{class:[t.name,t.maxWidth,"van-ellipsis"]},[a.teacherName]):s("div",{class:[t.name,"van-ellipsis"],style:{color:"red"}},[n("\u6682\u672A\u8BBE\u7F6E\u4F34\u5B66\u8001\u5E08")]),s(O,{type:"primary"},{default:()=>[a.name]})]),s("div",{class:[t.orchestraName,"van-ellipsis"]},[a.orchestraName])]),value:()=>s(T,{name:a.id,ref:l=>e.checkboxRefs[a.id]=l,disabled:!a.teacherId,onClick:l=>{l.stopPropagation()}},null)}),s(F,{border:!1,columnNum:3},{default:()=>[s(u,null,{default:()=>[s("p",{class:t.title},[a.preStudentNum]),s("p",{class:t.name},[n("\u5B66\u5458\u4EBA\u6570")])]}),s(u,null,{default:()=>[s("p",{class:[t.title]},[a.courseScheduleNum-a.completeCourseScheduleNum]),s("p",{class:t.name},[n("\u5269\u4F59\u8BFE\u65F6")])]}),s(u,null,{default:()=>[s("p",{class:t.title},[a.courseScheduleNum]),s("p",{class:t.name},[n("\u603B\u8BFE\u65F6")])]})]})]})))?r:{default:()=>[r]})]}):s(y,{btnStatus:!1,tips:"\u6682\u65E0\u73ED\u7EA7"},null),s(m,{position:"bottom"},{default:()=>[s("div",{class:"btnGroup"},[s(w,{block:!0,round:!0,type:"primary",onClick:v},{default:()=>[n("\u786E\u8BA4")]})])]}),s(b,{show:e.showPopover,"onUpdate:show":a=>e.showPopover=a,position:"bottom",round:!0,class:"popupBottomSearch"},{default:()=>[s(A,{columns:e.orchestraList,onCancel:()=>e.showPopover=!1,onConfirm:a=>{e.orchestraId=a.selectedOptions[0].value,e.orchestraName=a.selectedOptions[0].text,e.showPopover=!1,e.params.page=1,e.list=[],e.listState.dataShow=!0,e.listState.loading=!1,e.listState.finished=!1,c()}},null)]})])}}});export{he as P};