const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-3KNrlnzw.js","assets/index-BO9jfAEj.js","assets/index-p3DlB74t.css"])))=>i.map(i=>d[i]);
import{_ as S,h as x,s as B,o as a,c as n,a as e,t as r,m,n as d,F as h,p as V,g as E,x as D,r as A,w as f,e as g}from"./index-BO9jfAEj.js";import{periodApi as M,okrApi as K}from"./index-3KNrlnzw.js";import{P as U}from"./PeriodBanner-9WszURqk.js";const L={class:"app-page team-okr-workbench"},z={class:"page-hero"},F={class:"hero-info"},G={key:1,class:"empty-big"},j={key:0,class:"summary-bar"},J={class:"sum-item"},X={class:"sum-num okr-approved"},H={class:"sum-item"},q={class:"sum-num okr-submitted"},Q={class:"sum-item"},W={class:"sum-num okr-draft"},Y={class:"sum-item"},Z={class:"sum-num okr-rejected"},$={key:1,class:"empty-big"},ee={class:"sub-card-head"},se={class:"sub-user"},te={class:"sub-avatar"},oe={class:"sub-info"},ae={class:"sub-name"},re={class:"sub-position"},ne={key:0,class:"sub-okr-body"},le={class:"sub-o-title"},ie={class:"sub-krs"},ue={class:"sub-kr-num"},de={class:"sub-kr-title"},ce={key:0,class:"sub-kr-progress"},_e={key:0,class:"sub-okr-meta"},pe={key:1,class:"sub-no-okr"},me={__name:"TeamOkrView",setup(ve){const c=E([]),_=E([]),v=E(null),y=D(()=>c.value.find(s=>s.id===v.value)),k=D(()=>{let s=0,t=0,l=0,p=0;for(const o of _.value)o.okr?o.okr.status==="APPROVED"?s++:o.okr.status==="SUBMITTED"?t++:o.okr.status==="REJECTED"?p++:l++:l++;return{approved:s,submitted:t,notStarted:l,rejected:p}});x(async()=>{c.value=await M.list();const s=c.value.filter(t=>t.status!=="ARCHIVED");s.length?T(s[0].id):c.value.length&&T(c.value[0].id)});async function T(s){v.value=s;try{const t=await K.getSubordinates(s),l={};for(const i of t)l[i.userId]=i;const{orgApi:p}=await B(async()=>{const{orgApi:i}=await import("./index-3KNrlnzw.js");return{orgApi:i}},__vite__mapDeps([0,1,2])),o=await p.getMySubordinates();_.value=o.map(i=>({...i,okr:l[i.id]||null}))}catch{_.value=[]}}function P(s){return{APPROVED:"success",SUBMITTED:"warning",REJECTED:"danger",DRAFT:"info"}[s]||"info"}function O(s){return{APPROVED:"已通过",SUBMITTED:"待审核",REJECTED:"已驳回",DRAFT:"草稿"}[s]||s}function I(s){return!s.targetValue||s.targetValue===0?0:Math.min(s.currentValue/s.targetValue*100,100)}function N(s){return{COMPLETED:"#27ae60",BLOCKED:"#e67e22",IN_PROGRESS:"#3ad4d8",NOT_STARTED:"#c0c4cc"}[s]||"#c0c4cc"}return(s,t)=>{const l=A("el-tag"),p=A("el-progress");return a(),n("div",L,[e("div",z,[e("div",F,[t[1]||(t[1]=e("h2",null,"团队 OKR",-1)),e("p",null,r(_.value.length)+" 名直接下属 · 实时掌握团队运转",1)])]),c.value.length?(a(),m(U,{key:0,periods:c.value,modelValue:v.value,"onUpdate:modelValue":t[0]||(t[0]=o=>v.value=o)},null,8,["periods","modelValue"])):d("",!0),v.value?(a(),n(h,{key:2},[_.value.length?(a(),n("div",j,[e("div",J,[e("span",X,r(k.value.approved),1),t[2]||(t[2]=e("span",{class:"sum-label"},"已通过",-1))]),e("div",H,[e("span",q,r(k.value.submitted),1),t[3]||(t[3]=e("span",{class:"sum-label"},"待审核",-1))]),e("div",Q,[e("span",W,r(k.value.notStarted),1),t[4]||(t[4]=e("span",{class:"sum-label"},"未提交",-1))]),e("div",Y,[e("span",Z,r(k.value.rejected),1),t[5]||(t[5]=e("span",{class:"sum-label"},"已驳回",-1))])])):d("",!0),_.value.length===0?(a(),n("div",$,"暂无直接下属")):d("",!0),(a(!0),n(h,null,V(_.value,o=>{var i,b;return a(),n("div",{key:o.id,class:"sub-card"},[e("div",ee,[e("div",se,[e("span",te,r((o.realName||"?")[0]),1),e("div",oe,[e("span",ae,r(o.realName),1),e("span",re,r(o.position||"员工"),1)])]),o.okr?(a(),m(l,{key:0,type:P(o.okr.status),effect:"dark",size:"small",round:""},{default:f(()=>[g(r(O(o.okr.status)),1)]),_:2},1032,["type"])):(a(),m(l,{key:1,type:"info",effect:"plain",size:"small",round:""},{default:f(()=>[...t[6]||(t[6]=[g("未制定",-1)])]),_:1}))]),o.okr?(a(),n("div",ne,[e("div",le,r(o.okr.title),1),e("div",ie,[(a(!0),n(h,null,V(o.okr.keyResults,(u,C)=>{var w,R;return a(),n("div",{key:u.id,class:"sub-kr-row"},[e("span",ue,"KR"+r(C+1),1),e("span",de,r(u.title),1),((w=y.value)==null?void 0:w.status)==="EXECUTING"?(a(),n("span",ce,r(u.currentValue)+"/"+r(u.targetValue),1)):d("",!0),((R=y.value)==null?void 0:R.status)==="EXECUTING"?(a(),m(p,{key:1,percentage:I(u),color:N(u.status),"stroke-width":6,"show-text":!1,style:{width:"80px","flex-shrink":"0"}},null,8,["percentage","color"])):d("",!0),u.assignedToName?(a(),m(l,{key:2,size:"small",effect:"dark",type:"warning",round:""},{default:f(()=>[g(" @"+r(u.assignedToName),1)]),_:2},1024)):d("",!0),u.sourceKrId?(a(),m(l,{key:3,size:"small",effect:"plain",type:"info",round:""},{default:f(()=>[...t[7]||(t[7]=[g(" 承接上级 ",-1)])]),_:1})):d("",!0)])}),128))]),o.okr.reviewedAt?(a(),n("div",_e," 审核通过 · "+r(o.okr.reviewerName)+" · "+r((i=o.okr.reviewedAt)==null?void 0:i.slice(0,16)),1)):d("",!0)])):(a(),n("div",pe,r(((b=y.value)==null?void 0:b.status)==="OKR_ALIGN"?"尚未提交 OKR":"本周期未制定 OKR"),1))])}),128))],64)):(a(),n("div",G,"暂无进行中的考核周期"))])}}},ye=S(me,[["__scopeId","data-v-2dd19fe8"]]);export{ye as default};
