import{d as h,r as p,Z as d,$ 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.3b0304e1.js";import{O as j}from"./index.454c666f.js";import{i as C}from"./icon_teacher.df08d662.js";import{O as I}from"./index.841053bc.js";import{L as v}from"./index.179b8d2a.js";import{C as L}from"./index.ead63c4f.js";import{C as m}from"./index.ff3f298b.js";import{I as x}from"./index.710cd200.js";import{T as N}from"./index.1e205a49.js";const F="_cellTeacher_k4wyd_1",O="_img_k4wyd_1",E="_name_k4wyd_9",z="_subjectContainer_k4wyd_25",A="_tagSubject_k4wyd_32",V="_manageCell_k4wyd_39",q="_teacherContent_k4wyd_46",B="_content_k4wyd_51",H="_classNum_k4wyd_61",D="_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:F,img:O,name:E,class:"_class_k4wyd_16",subjectContainer:z,tagSubject:A,manageCell:V,teacherContent:q,content:B,classNum:H,num:D,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:u}){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=>{u("close"),u("select",o)};return d(()=>s.courseType,()=>{e.params.courseType=s.courseType,c()}),d(()=>s.subjectIdList,()=>{e.params.subjectIdList=s.subjectIdList,c()}),d(()=>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(x,{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(N,{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};