import{d as h,r as p,Z as u,$ as y,c as t,aj as g,q as S,ak as w,al as b,m as k,g as T}from"./index.5f7ffb46.js";import{O as j}from"./index.7790de2a.js";import{i as C}from"./icon_teacher.df08d662.js";import{O as I}from"./index.ec2a7822.js";import{L as v}from"./index.9ef28852.js";import{C as L}from"./index.052b3caa.js";import{C as m}from"./index.abd668f7.js";import{I as F}from"./index.276a5d68.js";import{T as x}from"./index.ab2541bb.js";const N="_cellTeacher_k4wyd_1",E="_img_k4wyd_1",O="_name_k4wyd_9",B="_subjectContainer_k4wyd_25",z="_tagSubject_k4wyd_32",A="_manageCell_k4wyd_39",V="_teacherContent_k4wyd_46",q="_content_k4wyd_51",D="_classNum_k4wyd_61",H="_num_k4wyd_65",G="_numText_k4wyd_71",M="_messageImg_k4wyd_76",R="_phone_k4wyd_94",W="_status_k4wyd_99",Z="_frozen_k4wyd_104";var l={cellTeacher:N,img:E,name:O,class:"_class_k4wyd_16",subjectContainer:B,tagSubject:z,manageCell:A,teacherContent:V,content:q,classNum:D,num:H,numText:G,messageImg:M,phone:R,status:W,frozen:Z};function f(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!b(s)}var se=h({name:"teacher-list",props:{header:{type:Boolean,default:!0},mode:{type:String,default:"fixed"},courseType:{type:String,default:""},removeTeacherId:{type:String,default:""},subjectIdList:{type:Array,default:()=>[]}},emits:["close","select"],setup(s,{slots:$,attrs:J,emit:d}){const e=p({teacherStatus:!1,isLoad:!1,list:[],listState:{dataShow:!0,loading:!1,finished:!1},params:{keyword:null,courseType:s.courseType,subjectIdList:s.subjectIdList,page:1,rows:20}}),r=async()=>{try{if(e.isLoad)return;e.isLoad=!0;const o=await k.post("/api-school/teacher/page",{data:{...e.params,schoolId:T.user.data.school.id,removeTeacherId:s.removeTeacherId,delFlag:!1}});e.listState.loading=!1;const a=o.data||{};if(e.list.length>0&&a.current===1)return;const n=a.rows||[];n.forEach(i=>{i.subjectNames=i.subjectName?i.subjectName.split(","):[]}),e.list=e.list.concat(n),e.listState.finished=a.current>=a.pages,e.params.page=a.current+1,e.listState.dataShow=e.list.length>0,e.isLoad=!1}catch{e.listState.dataShow=!1,e.listState.finished=!0,e.isLoad=!1}},c=()=>{e.params.page=1,e.list=[],e.listState.dataShow=!0,e.listState.loading=!1,e.listState.finished=!1,r()},_=o=>{d("close"),d("select",o)};return u(()=>s.courseType,()=>{e.params.courseType=s.courseType,c()}),u(()=>s.subjectIdList,()=>{e.params.subjectIdList=s.subjectIdList,c()}),u(()=>s.removeTeacherId,()=>{c()}),y(()=>{r()}),()=>{let o;return t("div",{class:!e.listState.dataShow&&"emptyRootContainer",style:{background:"#F8F8F8",minHeight:"100%"}},[t(j,{position:"top",mode:s.mode},{default:()=>[s.header&&t(g,{title:"\u9009\u62E9\u4F34\u5B66\u8001\u5E08",border:!1},null),t(I,{placeholder:"\u4F34\u5B66\u8001\u5E08\u540D\u79F0",onSearch:a=>{e.params.keyword=a,c()}},null)]}),e.listState.dataShow?t(v,{finished:e.listState.finished,finishedText:" ",onLoad:r,style:{paddingTop:"12px"},immediateCheck:!1},f(o=e.list.map(a=>t(L,{inset:!0,style:{marginBottom:"12px"},onClick:()=>_(a)},{default:()=>[t(m,{center:!0,class:l.manageCell,clickable:!1},{icon:()=>t(F,{class:l.img,src:a.avatar?a.avatar:C,fit:"cover"},null),title:()=>t("div",{class:l.teacherContent},[t("div",{class:l.content},[t("p",{class:[l.name,"van-ellipsis"]},[a.nickname])])])}),t(m,{center:!0},{title:()=>t("div",{class:l.subjectContainer},[t("span",null,[S("\u58F0\u90E8\uFF1A")]),t("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap"}},[a.subjectNames&&a.subjectNames.length>0&&a.subjectNames.map(n=>t(x,{type:"primary",class:l.tagSubject,color:"#FFE7DA",textColor:"#F67146"},f(n)?n:{default:()=>[n]}))])])})]})))?o:{default:()=>[o]}):t(w,{btnStatus:!1,tips:"\u6682\u65E0\u4F34\u5B66\u8001\u5E08"},null)])}}});export{se as T};