import{O as y}from"./index.00e2f453.js";import{O as M}from"./index.c8b56350.js";import{d as C,R as T,X as I,k as t,l as r,B as _,g as f,j as F,b8 as E,S as O,F as x,bh as k,ad as w}from"./index.879f7421.js";import{G as b,a as S}from"./index.6515ab4b.js";import{I as h}from"./index.c463dbd0.js";import{S as D}from"./index.e17cc929.js";import{i as A}from"./icon_teacher.40b6f077.js";import{C as v}from"./index.4aec72fa.js";import{C as g}from"./index.9a3a3b84.js";const V="_detailCellGroup_1ex6x_1",q="_detailCell_1ex6x_1",j="_img_1ex6x_9",N="_name_1ex6x_16",L="_phone_1ex6x_22",R="_sectionTitle_1ex6x_27",$="_functionGrid_1ex6x_42",z="_functionImg_1ex6x_49",H="_functionText_1ex6x_53",U="_dialogTitle_1ex6x_64";var s={detailCellGroup:V,detailCell:q,img:j,name:N,phone:L,sectionTitle:R,functionGrid:$,functionImg:z,functionText:H,dialogTitle:U};const K="_menuFunction_1ghfh_1",P="_menuContent_1ghfh_5",X="_functionImg_1ghfh_18",J="_gray_1ghfh_22",Q="_functionText_1ghfh_27";var d={menuFunction:K,menuContent:P,functionImg:X,gray:J,functionText:Q},W=C({name:"menu-function",props:{teacherId:{type:String,default:""},menus:{type:Array||String,default:[]}},emits:["close","success"],setup(l,{slots:n,attrs:c,emit:m}){const u=T({list:[],selectMenus:[]}),o=async()=>{try{const{data:e}=await f.post("/api-school/sysMenuButton/page",{data:{clientType:"SCHOOL",page:1,rows:100}});u.list=e.rows||[]}catch{}},a=e=>u.selectMenus.includes(e),B=e=>{if(a(e.id)){const i=u.selectMenus.findIndex(p=>p===e.id);u.selectMenus.splice(i,1)}else u.selectMenus.push(e.id)},G=async()=>{try{const e=[];u.list&&u.list.forEach(i=>{a(i.id)&&e.push({buttonImage:i.buttonImage,sortOrder:i.order,id:i.id,title:i.title})}),await f.post("/api-school/schoolStaff/updateButton",{data:{teacherId:l.teacherId,menuButtons:[...e]}}),setTimeout(()=>{F("\u4FEE\u6539\u6210\u529F"),setTimeout(()=>{m("close"),m("success")},1e3)},100)}catch{}};return I(()=>{o();const i=(l.menus?l.menus:[]).map(p=>p.id);u.selectMenus=[...i]}),()=>t("div",{class:d.menuFunction},[t(y,null,null),t("div",{class:d.menuContent},[t("h2",null,[r("\u5168\u90E8\u529F\u80FD")]),t(b,{border:!1,class:d.functionGrid},{default:()=>[u.list&&u.list.map(e=>t(S,{onClick:()=>B(e),class:a(e.id)?"":d.gray},{icon:()=>t(h,{class:[d.functionImg],src:e.buttonImage},null),text:()=>t("div",{class:[d.functionText,"van-ellipsis"]},[e.title])}))]})]),t(D,{position:"bottom"},{default:()=>[t("div",{class:"btnGroup"},[t(_,{block:!0,round:!0,type:"primary",onClick:G},{default:()=>[r("\u786E\u8BA4\u4FEE\u6539")]})])]})])}});function Y(l){return typeof l=="function"||Object.prototype.toString.call(l)==="[object Object]"&&!w(l)}var it=C({name:"manage-detail",setup(){const l=E(),n=O({}),c=T({menuStatus:!1,status:!1}),m=async()=>{try{const o=l.query,{data:a}=await f.get("/api-school/schoolStaff/detail/"+o.id);n.value={...a}}catch{}},u=async()=>{try{const o=l.query;await f.post("/api-school/schoolStaff/freeze/"+o.id),setTimeout(()=>{n.value.status="LOCKED",F("\u51BB\u7ED3\u6210\u529F")},100)}catch{}};return I(()=>{m()}),()=>{let o;return t(x,null,[t(y,null,null),t(v,{inset:!0,class:s.detailCellGroup},{default:()=>[t(g,{center:!0,class:s.detailCell},{icon:()=>t(h,{class:s.img,src:n.value.avatar?n.value.avatar:A},null),title:()=>t("div",{class:s.content},[t("p",{class:s.name},[n.value.nickname]),t("p",{class:s.phone},[n.value.phone])])})]}),t("div",{class:s.sectionTitle},[t("i",null,null),r("\u57FA\u672C\u4FE1\u606F")]),t(v,{inset:!0,class:s.detailCellGroup},{default:()=>[t(g,{title:"\u624B\u673A\u53F7\u7801",value:n.value.nickname},null),t(g,{title:"\u6027\u522B",value:n.value.gender?"\u7537":"\u5973"},null)]}),n.value.menuButtons&&n.value.menuButtons.length>0&&t(x,null,[t("div",{class:s.sectionTitle},[t("i",null,null),r("\u529F\u80FD\u6743\u9650")]),t(b,{border:!1,class:s.functionGrid},Y(o=n.value.menuButtons.map(a=>t(S,null,{icon:()=>t(h,{class:s.functionImg,src:a.buttonImage},null),text:()=>t("div",{class:[s.functionText,"van-ellipsis"]},[a.title])})))?o:{default:()=>[o]})]),t("div",{class:["btnGroup","btnMore"],style:{paddingLeft:"13px",paddingRight:"13px"}},[t(_,{type:"primary",round:!0,onClick:()=>c.menuStatus=!0},{default:()=>[r("\u4FEE\u6539\u6743\u9650")]}),t(_,{type:"primary",round:!0,color:"#64A9FF",onClick:()=>c.status=!0,disabled:n.value.status!=="ACTIVATION"},{default:()=>[r("\u51BB\u7ED3\u8D26\u53F7")]})]),t(M,{modelValue:c.menuStatus,"onUpdate:modelValue":a=>c.menuStatus=a,destroy:!0},{default:()=>[t(W,{onClose:()=>c.menuStatus=!1,onSuccess:()=>m(),teacherId:n.value.id,menus:n.value.menuButtons},null)]}),t(k,{show:c.status,"onUpdate:show":a=>c.status=a,message:`\u51BB\u7ED3\u540E\u8BE5\u7BA1\u7406\u8001\u5E08\u5C06\u65E0\u6CD5\u767B\u5F55
\u786E\u8BA4\u9700\u8981\u51BB\u7ED3\u5417\uFF1F`,messageAlign:"left",showCancelButton:!0,onConfirm:u},{title:()=>t("div",{class:s.dialogTitle},[t("i",null,null),r("\u51BB\u7ED3\u7BA1\u7406\u8001\u5E08")])})])}}});export{it as default};
