import{d as y,r as b,$ as N,c as e,aj as v,q as i,ak as w,al as q,m as f,g as E,ah as j,ag as z,B,F as k,o as x}from"./index.332c7f08.js";import{O as I}from"./index.d7c1b6ac.js";import{O as L}from"./index.ed5fc819.js";import{O as A}from"./index.d2064f3d.js";import{i as G}from"./icon_teacher.df08d662.js";import{L as O}from"./index.b186dfda.js";import{C as F}from"./index.324108a5.js";import{C as g}from"./index.91135ff9.js";import{I as V}from"./index.96a8db5e.js";import{T as $}from"./index.98482791.js";import{c as D}from"./index.b28db9f5.js";import{O as T}from"./index.a8f5f4b5.js";import{F as M}from"./index.1ed6273e.js";import{G as R,a as S}from"./index.5e198b6f.js";import"./use-tab-status.9d769af8.js";const U="_unbindTips_156zt_1",H="_detailCellGroup_156zt_11",P="_detailCell_156zt_11",W="_valueClass_156zt_23",J="_teacherName_156zt_28",K="_teacherContent_156zt_35",Q="_content_156zt_40",X="_classNum_156zt_43",Y="_className_156zt_47",Z="_musicName_156zt_53",ee="_nums_156zt_59",te="_numTip_156zt_65",se="_classCellGroup_156zt_70",ae="_classTitle_156zt_75",oe="_title_156zt_91",le="_name_156zt_94";var r={unbindTips:U,detailCellGroup:H,detailCell:P,valueClass:W,teacherName:J,teacherContent:K,content:Q,classNum:X,className:Y,musicName:Z,nums:ee,numTip:te,classCellGroup:se,classTitle:ae,title:oe,name:le};const ce="_name_15dqr_1",ne="_img_15dqr_8",re="_subjects_15dqr_15",ue="_subjectContainer_15dqr_18",ie="_tagSubject_15dqr_24",de="_manageCell_15dqr_30",pe="_teacherContent_15dqr_37",me="_content_15dqr_42",he="_classNum_15dqr_52",_e="_num_15dqr_56",fe="_numText_15dqr_62",ge="_messageImg_15dqr_67",Te="_phone_15dqr_85",Se="_status_15dqr_90",Ce="_frozen_15dqr_95";var n={name:ce,img:ne,subjects:re,subjectContainer:ue,tagSubject:ie,manageCell:de,teacherContent:pe,content:me,classNum:he,num:_e,numText:fe,messageImg:ge,phone:Te,status:Se,frozen:Ce};function C(c){return typeof c=="function"||Object.prototype.toString.call(c)==="[object Object]"&&!q(c)}var ye=y({name:"teacher",props:{teacherId:{type:String,default:""},courseType:{type:String,default:""}},emits:["close","select"],setup(c,{slots:d,attrs:a,emit:p}){const s=b({schoolId:null,list:[],listState:{dataShow:!0,loading:!1,finished:!1},params:{keyword:null,page:1,rows:20},selectItem:{}}),u=async()=>{try{const t=await f.post("/api-school/teacher/page",{data:{...s.params,schoolId:E.user.data.school.id,removeTeacherId:c.teacherId,courseType:c.courseType,delFlag:!1}});s.listState.loading=!1;const o=t.data||{};if(s.list.length>0&&o.current===1)return;const l=o.rows||[];l.forEach(_=>{_.subjectNames=_.subjectName?_.subjectName.split(","):[]}),s.list=s.list.concat(l),s.listState.finished=o.current>=o.pages,s.params.page=o.current+1,s.listState.dataShow=s.list.length>0}catch{s.listState.dataShow=!1,s.listState.finished=!0}},m=()=>{s.params.page=1,s.list=[],s.listState.dataShow=!0,s.listState.loading=!1,s.listState.finished=!1,u()},h=t=>{p("select",t),p("close")};return N(()=>{u()}),()=>{let t;return e("div",{class:!s.listState.dataShow&&"emptyRootContainer"},[e(I,{position:"top"},{default:()=>[e(v,{title:"\u4EA4\u63A5\u4F34\u5B66\u8001\u5E08",desotry:!1,border:!1},null),e(A,{placeholder:"\u8BF7\u8F93\u5165\u4F34\u5B66\u8001\u5E08\u59D3\u540D",onSearch:o=>{s.params.keyword=o,m()}},null)]}),s.listState.dataShow?e(O,{finished:s.listState.finished,finishedText:" ",class:[n.liveList],onLoad:u,style:{paddingTop:"12px"},immediateCheck:!1},C(t=s.list.map(o=>e(F,{inset:!0,style:{marginBottom:"12px"},onClick:()=>h(o)},{default:()=>[e(g,{center:!0,class:n.manageCell,clickable:!1},{icon:()=>e(V,{class:n.img,src:o.avatar?o.avatar:G,fit:"cover"},null),title:()=>e("div",{class:n.teacherContent},[e("div",{class:n.content},[e("p",{class:[n.name,"van-ellipsis"]},[o.nickname])])])}),e(g,{center:!0},{title:()=>e("div",{class:n.subjectContainer},[e("span",null,[i("\u58F0\u90E8\uFF1A")]),e("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap"}},[o.subjectNames&&o.subjectNames.length>0&&o.subjectNames.map(l=>e($,{type:"primary",class:n.tagSubject,color:"#FFE7DA",textColor:"#F67146"},C(l)?l:{default:()=>[l]}))])])})]})))?t:{default:()=>[t]}):e(w,{btnStatus:!1,tips:"\u6682\u65E0\u4F34\u5B66\u8001\u5E08"},null)])}}}),Ge=y({name:"unbind",setup(){const c=j(),d=z(),a=b({teacherStatus:!1,classList:[],selectTeacher:{},teacherId:c.query.id,dialogStatus:!1,dialogMessage:"",dialogStatus1:!1,dialogMessage1:""}),p=async()=>{try{const{data:t}=await f.post("/api-school/classGroup/teacherHandoverList/"+a.teacherId,{});a.classList=t||[]}catch{}},s=t=>{a.teacherStatus=!0,a.selectTeacher=t},u=t=>{console.log(t,"steacher"),a.selectTeacher.sTeacher=t},m=()=>{console.log("submit");let t=!1;const o=[];if(a.classList.forEach(l=>{(!l.sTeacher||l.sTeacher&&!l.sTeacher.id)&&(t=!0),l.sTeacher&&o.push({courseType:l.courseType,teacherId:l.sTeacher.id})}),t){x("\u8BF7\u9009\u62E9\u4EA4\u63A5\u4F34\u5B66\u8001\u5E08");return}try{a.dialogStatus=!0}catch{}},h=async()=>{try{const t=[];a.classList.forEach(l=>{l.sTeacher&&t.push({courseType:l.courseType,teacherId:l.sTeacher.id})});const o=await f.post("/api-school/classGroup/handoverTeacher",{hideLoading:!1,data:{teacherId:c.query.id,courseUpdateList:[...t]}});o.code===999?(a.dialogStatus1=!0,a.dialogMessage1=o.message):o.data.finish===!0?d.replace("/companion-teacher"):d.push({path:"/course-preview",query:{cacheId:o.data.cacheId,type:"unbind"}})}catch{}};return N(()=>{p()}),()=>e(k,null,[e(v,null,null),e("div",{class:r.unbindTips},[i("\u8BE5\u4F34\u5B66\u8001\u5E08\u5B58\u5728\u73ED\u7EA7\u6216\u672A\u5F00\u59CB\u8BFE\u7A0B\uFF0C\u8BF7\u9009\u62E9\u4EA4\u63A5\u4EBA")]),a.classList.map(t=>e(F,{inset:!0,class:r.classCellGroup,border:!1},{default:()=>[e(M,{isLink:!0,placeholder:"\u8BF7\u9009\u62E9\u4EA4\u63A5\u8001\u5E08",inputAlign:"right",readonly:!0,modelValue:t.sTeacher?t.sTeacher.nickname:"",onClick:()=>s(t)},{label:()=>e("div",{class:r.classTitle},[D[t.courseType]])}),e(R,{border:!1,columnNum:2},{default:()=>[e(S,null,{default:()=>[e("p",{class:r.title},[t.classNum]),e("p",{class:r.name},[i("\u73ED\u7EA7\u6570\u91CF")])]}),e(S,null,{default:()=>[e("p",{class:[r.title]},[t.courseNum]),e("p",{class:r.name},[i("\u5269\u4F59\u8BFE\u65F6")])]})]})]})),e(I,{position:"bottom"},{default:()=>[e("div",{class:["btnGroup"],style:{paddingLeft:"13px",paddingRight:"13px"}},[e(B,{type:"primary",round:!0,block:!0,onClick:m},{default:()=>[i("\u786E\u8BA4\u4EA4\u63A5")]})])]}),e(L,{modelValue:a.teacherStatus,"onUpdate:modelValue":t=>a.teacherStatus=t,destroy:!0,style:{background:"#F8F8F8"}},{default:()=>[e(ye,{courseType:a.selectTeacher.courseType,teacherId:a.teacherId,onClose:()=>a.teacherStatus=!1,onSelect:u},null)]}),e(T,{title:"\u63D0\u793A",show:a.dialogStatus,"onUpdate:show":t=>a.dialogStatus=t,message:"\u662F\u5426\u786E\u8BA4\u4EA4\u63A5?",confirmButtonText:"\u786E\u5B9A",showCancelButton:!0,onConfirm:h},null),e(T,{title:"\u63D0\u793A",show:a.dialogStatus1,"onUpdate:show":t=>a.dialogStatus1=t,message:a.dialogMessage1,confirmButtonText:"\u786E\u5B9A",onConfirm:()=>{d.back()}},null)])}});export{Ge as default};