import{x as R,r as M,k as b,al as f,u as v,y as p,z as g,Q as _,I as l,P as B,a4 as C,H as N,C as E,M as y,O as L,A as S}from"./vendor-0e44bd00-1783403522942v=1.0.0.js";import{j as z,k as A,m as F,_ as j}from"./index-4caf8ca8-1783403522942v=1.0.0.js";import{E as I}from"./eleVendor-30a84bb1-1783403522942v=1.0.0.js";const D={key:0},$={class:""},q={class:""},H={key:1},K=R({__name:"userMenu",props:{info:{type:null,required:!1,default:{}}},emits:["updateRole"],setup(P,{emit:Q}){const m=M([]),n=M({}),c=M({}),V=z(),w=async(e=!1)=>{var a,r,u,h,d,i,o;try{const s=await A();if(s.code===0){const O=V.getEnumObjByKey("schManagerType");s.data.forEach(t=>{t.tsManageType==="school"&&(t.schManagerTypeCn=O[t.schManagerType]),t.tsManageType==="biz"&&(t.schManagerTypeCn="\u4E1A\u52A1\u7BA1\u7406\u5458")}),m.value=s.data,n.value=s.data.find(t=>t.isSelect)||s.data[0],c.value=((r=(a=n.value)==null?void 0:a.schoolLevelBaseList)==null?void 0:r.find(t=>t.isSelect))||((u=n.value)==null?void 0:u.schoolLevelBaseList[0]),e&&k({schoolLevel:(h=c.value)==null?void 0:h.schoolLevel,schoolLevelId:(d=c.value)==null?void 0:d.schoolLevelId,schoolLevelName:(i=c.value)==null?void 0:i.schoolLevelName,schoolIdInfoRespVO:(o=c.value)==null?void 0:o.schoolIdInfoRespVO})}}catch(s){console.error(s),I.error(s)}},x=async e=>{var r,u,h,d,i,o,s;if(e.schManagerType===n.value.schManagerType)return;await T({mpId:0,...e,schoolLevel:(u=(r=e.schoolLevelBaseList)==null?void 0:r[0])==null?void 0:u.schoolLevel,schoolLevelId:(d=(h=e.schoolLevelBaseList)==null?void 0:h[0])==null?void 0:d.schoolLevelId,schoolLevelName:(o=(i=e.schoolLevelBaseList)==null?void 0:i[0])==null?void 0:o.schoolLevelName,schoolIdInfoRespVO:e.schoolLevelBaseList[0].schoolIdInfoRespVO})==="ok"&&(n.value=e,e.schManagerType&&e.schoolLevelBaseList.length>0&&(c.value=((s=e.schoolLevelBaseList)==null?void 0:s[0])||{}))},k=async e=>{await T({mpId:0,...n.value,schoolLevel:e.schoolLevel,schoolLevelId:e.schoolLevelId,schoolLevelName:e.schoolLevelName,schoolIdInfoRespVO:e.schoolIdInfoRespVO})==="ok"&&(c.value=e)},T=async e=>{try{if((await F(e)).code===0)return w(),I.success("\u5207\u6362\u6210\u529F"),"ok"}catch(a){console.error(a),I.error(a)}};return b(()=>{w(!0)}),(e,a)=>{const r=f("arrow-down"),u=f("el-icon"),h=f("el-dropdown-item"),d=f("el-dropdown-menu"),i=f("el-dropdown");return v(n).schManagerType?(p(),g("div",D,[_(i,null,{dropdown:l(()=>[_(d,null,{default:l(()=>[(p(!0),g(B,null,C(v(m),o=>(p(),N(h,{key:o.id,onClick:s=>x(o),class:E({highlight:o.isSelect})},{default:l(()=>[y(L(o.schManagerTypeCn),1)]),_:2},1032,["onClick","class"]))),128))]),_:1})]),default:l(()=>[S("span",$,[y(L(v(n).schManagerTypeCn)+" ",1),_(u,{class:"el-icon--right"},{default:l(()=>[_(r)]),_:1})])]),_:1}),_(i,{style:{"margin-left":"10px"}},{dropdown:l(()=>[_(d,null,{default:l(()=>[(p(!0),g(B,null,C(v(n).schoolLevelBaseList,o=>(p(),N(h,{key:o.schoolLevelId,onClick:s=>k(o),class:E({highlight:o.isSelect})},{default:l(()=>[y(L(o.schoolLevelName),1)]),_:2},1032,["onClick","class"]))),128))]),_:1})]),default:l(()=>[S("span",q,[y(L(v(c).schoolLevelName)+" ",1),_(u,{class:"el-icon--right"},{default:l(()=>[_(r)]),_:1})])]),_:1})])):(p(),g("div",H,L(v(c).schoolLevelName||"\u6682\u65E0\u4FE1\u606F"),1))}}});const J=j(K,[["__scopeId","data-v-52c6edb3"],["__file","D:/desktop/huaZhong/huazhong-common/apps/vue-center/src/views/workbenchManage/workbench/components/userMenu.vue"]]);export{J as default};
