import{c as p,a as s,t as o,F as C,i as B,b as h,w as r,j as i,r as m,u as L,o as l,k as v,n as S,T as x,l as D}from"./index-NywRioUE.js";import{u as F}from"./user-BStF_uHf.js";const N={class:"layout-container"},T={class:"sidebar"},V={class:"sidebar-header"},j={class:"user-info"},z={class:"avatar"},A={class:"user-detail"},E={class:"name"},I={class:"role"},R={class:"sidebar-nav"},U={class:"icon"},$={class:"main-content"},J={__name:"Layout",setup(q){const b=L(),c=F(),n=i(()=>c.user),f=i(()=>{var e;return{admin:"管理员",sales:"销售",rd:"研发"}[(e=n.value)==null?void 0:e.role]||""}),k=i(()=>{var e;const t=(e=n.value)==null?void 0:e.role;return t==="admin"?[{path:"/dashboard",label:"统计看板",icon:"📊"},{path:"/users",label:"账号管理",icon:"👥"},{path:"/workdays",label:"工作日设置",icon:"📅"}]:t==="sales"?[{path:"/clients",label:"客户管理",icon:"🏢"},{path:"/sales-stats",label:"数据统计",icon:"📈"}]:t==="rd"?[{path:"/timesheet",label:"工时填报",icon:"⏰"},{path:"/rd-stats",label:"个人统计",icon:"📊"}]:[]});function g(){c.logout(),b.push("/login")}return(t,e)=>{var u,d,_;const y=m("router-link"),w=m("router-view");return l(),p("div",N,[s("aside",T,[s("div",V,[e[0]||(e[0]=s("h2",null,"⚡ 工时管理",-1)),s("div",j,[s("div",z,o((d=(u=n.value)==null?void 0:u.realname)==null?void 0:d.charAt(0)),1),s("div",A,[s("div",E,o((_=n.value)==null?void 0:_.realname),1),s("div",I,o(f.value),1)])])]),s("nav",R,[(l(!0),p(C,null,B(k.value,a=>(l(),v(y,{key:a.path,to:a.path,class:S(["nav-item",{active:t.$route.path===a.path}])},{default:r(()=>[s("span",U,o(a.icon),1),s("span",null,o(a.label),1)]),_:2},1032,["to","class"]))),128))]),s("div",{class:"sidebar-footer"},[s("button",{class:"logout-btn",onClick:g},[...e[1]||(e[1]=[s("span",{class:"icon"},"🚪",-1),s("span",null,"退出登录",-1)])])])]),s("main",$,[h(w,null,{default:r(({Component:a})=>[h(x,{name:"fade",mode:"out-in"},{default:r(()=>[(l(),v(D(a)))]),_:2},1024)]),_:1})])])}}};export{J as default};
