const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DxOMYcp4.js","assets/index-B8_nURbH.js","assets/index-BKsb6cIX.js","assets/index-DngTeEPG.css"])))=>i.map(i=>d[i]);
import{_ as S,E as x,a1 as B,o,c as n,a as s,t as r,j as m,z as d,F as h,i as V,h as T,C as D,r as A,w as f,b as g}from"./index-BKsb6cIX.js";import{periodApi as M,okrApi as K}from"./index-DxOMYcp4.js";import{P as U}from"./PeriodBanner-CTun6fe4.js";import"./index-B8_nURbH.js";const z={class:"app-page team-okr-workbench"},L={class:"data-toolbar"},j={class:"data-toolbar__meta"},F={key:1,class:"empty-big"},G={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"},ss={class:"sub-card-head"},es={class:"sub-user"},ts={class:"sub-avatar"},as={class:"sub-info"},os={class:"sub-name"},rs={class:"sub-position"},ns={key:0,class:"sub-okr-body"},ls={class:"sub-o-title"},is={class:"sub-krs"},us={class:"sub-kr-num"},ds={class:"sub-kr-title"},cs={key:0,class:"sub-kr-progress"},_s={key:0,class:"sub-okr-meta"},ps={key:1,class:"sub-no-okr"},ms={__name:"TeamOkrView",setup(vs){const c=T([]),_=T([]),v=T(null),y=D(()=>c.value.find(t=>t.id===v.value)),k=D(()=>{let t=0,e=0,l=0,p=0;for(const a of _.value)a.okr?a.okr.status==="APPROVED"?t++:a.okr.status==="SUBMITTED"?e++:a.okr.status==="REJECTED"?p++:l++:l++;return{approved:t,submitted:e,notStarted:l,rejected:p}});x(async()=>{c.value=await M.list();const t=c.value.filter(e=>e.status!=="ARCHIVED");t.length?E(t[0].id):c.value.length&&E(c.value[0].id)});async function E(t){v.value=t;try{const e=await K.getSubordinates(t),l={};for(const i of e)l[i.userId]=i;const{orgApi:p}=await B(async()=>{const{orgApi:i}=await import("./index-DxOMYcp4.js");return{orgApi:i}},__vite__mapDeps([0,1,2,3])),a=await p.getMySubordinates();_.value=a.map(i=>({...i,okr:l[i.id]||null}))}catch{_.value=[]}}function P(t){return{APPROVED:"success",SUBMITTED:"warning",REJECTED:"danger",DRAFT:"info"}[t]||"info"}function O(t){return{APPROVED:"已通过",SUBMITTED:"待审核",REJECTED:"已驳回",DRAFT:"草稿"}[t]||t}function C(t){return!t.targetValue||t.targetValue===0?0:Math.min(t.currentValue/t.targetValue*100,100)}function I(t){return{COMPLETED:"var(--color-success)",BLOCKED:"var(--color-warning)",IN_PROGRESS:"var(--color-accent)",NOT_STARTED:"var(--color-text-muted)"}[t]||"var(--color-text-muted)"}return(t,e)=>{const l=A("el-tag"),p=A("el-progress");return o(),n("div",z,[s("div",L,[e[1]||(e[1]=s("span",{class:"data-toolbar__title"},"团队 OKR",-1)),e[2]||(e[2]=s("span",{class:"data-toolbar__sep"},"|",-1)),s("span",j,r(_.value.length)+" 名直接下属",1)]),c.value.length?(o(),m(U,{key:0,periods:c.value,modelValue:v.value,"onUpdate:modelValue":[e[0]||(e[0]=a=>v.value=a),E]},null,8,["periods","modelValue"])):d("",!0),v.value?(o(),n(h,{key:2},[_.value.length?(o(),n("div",G,[s("div",J,[s("span",X,r(k.value.approved),1),e[3]||(e[3]=s("span",{class:"sum-label"},"已通过",-1))]),s("div",H,[s("span",q,r(k.value.submitted),1),e[4]||(e[4]=s("span",{class:"sum-label"},"待审核",-1))]),s("div",Q,[s("span",W,r(k.value.notStarted),1),e[5]||(e[5]=s("span",{class:"sum-label"},"未提交",-1))]),s("div",Y,[s("span",Z,r(k.value.rejected),1),e[6]||(e[6]=s("span",{class:"sum-label"},"已驳回",-1))])])):d("",!0),_.value.length===0?(o(),n("div",$,"暂无直接下属")):d("",!0),(o(!0),n(h,null,V(_.value,a=>{var i,b;return o(),n("div",{key:a.id,class:"sub-card"},[s("div",ss,[s("div",es,[s("span",ts,r((a.realName||"?")[0]),1),s("div",as,[s("span",os,r(a.realName),1),s("span",rs,r(a.position||"员工"),1)])]),a.okr?(o(),m(l,{key:0,type:P(a.okr.status),effect:"dark",size:"small",round:""},{default:f(()=>[g(r(O(a.okr.status)),1)]),_:2},1032,["type"])):(o(),m(l,{key:1,type:"info",effect:"plain",size:"small",round:""},{default:f(()=>[...e[7]||(e[7]=[g("未制定",-1)])]),_:1}))]),a.okr?(o(),n("div",ns,[s("div",ls,r(a.okr.title),1),s("div",is,[(o(!0),n(h,null,V(a.okr.keyResults,(u,N)=>{var w,R;return o(),n("div",{key:u.id,class:"sub-kr-row"},[s("span",us,"KR"+r(N+1),1),s("span",ds,r(u.title),1),((w=y.value)==null?void 0:w.status)==="EXECUTING"?(o(),n("span",cs,r(u.currentValue)+"/"+r(u.targetValue),1)):d("",!0),((R=y.value)==null?void 0:R.status)==="EXECUTING"?(o(),m(p,{key:1,percentage:C(u),color:I(u.status),"stroke-width":6,"show-text":!1,style:{width:"80px","flex-shrink":"0"}},null,8,["percentage","color"])):d("",!0),u.assignedToName?(o(),m(l,{key:2,size:"small",effect:"dark",type:"warning",round:""},{default:f(()=>[g(" @"+r(u.assignedToName),1)]),_:2},1024)):d("",!0),u.sourceKrId?(o(),m(l,{key:3,size:"small",effect:"plain",type:"info",round:""},{default:f(()=>[...e[8]||(e[8]=[g(" 承接上级 ",-1)])]),_:1})):d("",!0)])}),128))]),a.okr.reviewedAt?(o(),n("div",_s," 审核通过 · "+r(a.okr.reviewerName)+" · "+r((i=a.okr.reviewedAt)==null?void 0:i.slice(0,16)),1)):d("",!0)])):(o(),n("div",ps,r(((b=y.value)==null?void 0:b.status)==="OKR_ALIGN"?"尚未提交 OKR":"本周期未制定 OKR"),1))])}),128))],64)):(o(),n("div",F,"暂无进行中的考核周期"))])}}},Es=S(ms,[["__scopeId","data-v-47a66287"]]);export{Es as default};
