import{d as y,r as b,$ as N,c as e,q as i,ai as w,ak as q,m as f,f as z,aV as E,ag as j,B,F as k,o as x}from"./index.ffe80dbe.js";import{O as v}from"./index.a0ef77e4.js";import{O as F}from"./index.4ddd16f0.js";import{O as L}from"./index.1829b1b7.js";import{O as A}from"./index.c7af3af2.js";import{i as G}from"./icon_teacher.df08d662.js";import{L as O}from"./index.cafcb8b5.js";import{C as I}from"./index.914765a1.js";import{C as g}from"./index.ea031708.js";import{I as V}from"./index.7e972106.js";import{T as $}from"./index.55ba7429.js";import{c as D}from"./index.931cf0b8.js";import{O as T}from"./index.d745568a.js";import{F as M}from"./index.92ec0bf4.js";import{G as R,a as S}from"./index.72ca63b9.js";import"./index.1d5c6f70.js";import"./index.339fc024.js";import"./use-tab-status.5a3cd090.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 n={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",re="_img_15dqr_8",ne="_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 r={name:ce,img:re,subjects:ne,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:z.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(F,{position:"top"},{default:()=>[e(v,{title:"\u4EA4\u63A5\u4F34\u5B66\u6307\u5BFC",desotry:!1,border:!1},null),e(A,{placeholder:"\u8BF7\u8F93\u5165\u4F34\u5B66\u6307\u5BFC\u59D3\u540D",onSearch:o=>{s.params.keyword=o,m()}},null)]}),s.listState.dataShow?e(O,{finished:s.listState.finished,finishedText:" ",class:[r.liveList],onLoad:u,style:{paddingTop:"12px"},immediateCheck:!1},C(t=s.list.map(o=>e(I,{inset:!0,style:{marginBottom:"12px"},onClick:()=>h(o)},{default:()=>[e(g,{center:!0,class:r.manageCell,clickable:!1},{icon:()=>e(V,{class:r.img,src:o.avatar?o.avatar:G,fit:"cover"},null),title:()=>e("div",{class:r.teacherContent},[e("div",{class:r.content},[e("p",{class:[r.name,"van-ellipsis"]},[o.nickname])])])}),e(g,{center:!0},{title:()=>e("div",{class:r.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:r.tagSubject,color:"#FFE7DA",textColor:"#F67146"},C(l)?l:{default:()=>[l]}))])])})]})))?t:{default:()=>[t]}):e(w,{btnStatus:!1,tips:"\u6682\u65E0\u4F34\u5B66\u6307\u5BFC"},null)])}}}),$e=y({name:"unbind",setup(){const c=E(),d=j(),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\u6307\u5BFC");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:n.unbindTips},[i("\u8BE5\u4F34\u5B66\u6307\u5BFC\u5B58\u5728\u73ED\u7EA7\u6216\u672A\u5F00\u59CB\u8BFE\u7A0B\uFF0C\u8BF7\u9009\u62E9\u4EA4\u63A5\u4EBA")]),a.classList.map(t=>e(I,{inset:!0,class:n.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:n.classTitle},[D[t.courseType]])}),e(R,{border:!1,columnNum:2},{default:()=>[e(S,null,{default:()=>[e("p",{class:n.title},[t.classNum]),e("p",{class:n.name},[i("\u73ED\u7EA7\u6570\u91CF")])]}),e(S,null,{default:()=>[e("p",{class:[n.title]},[t.courseNum]),e("p",{class:n.name},[i("\u5269\u4F59\u8BFE\u65F6")])]})]})]})),e(F,{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{$e as default};