import{periodApi as K,okrApi as A}from"./index-DxOMYcp4.js";import{_ as F,E as U,o as s,c as d,a as i,d as t,w as a,j as f,z as T,h as _,r as n,F as x,i as C,b as p,t as r}from"./index-BKsb6cIX.js";import"./index-B8_nURbH.js";const Y={class:"alignment-page alignment-workbench"},j={class:"data-toolbar"},S={class:"tree-node"},q={class:"tree-title"},G={key:0,style:{"margin-top":"12px"}},H={class:"detail-meta"},J={__name:"AlignmentView",setup(Q){const m=_([]),c=_(null),w=_([]),h=_([]),u=_(null);function y(l){return{COMPANY:"公司",DEPARTMENT:"部门",TEAM:"团队",INDIVIDUAL:"个人"}[l]||l}function E(l){return l==="COMPANY"?"":l==="DEPARTMENT"?"warning":l==="TEAM"?"success":"info"}function M(l){return l.targetValue>0?Math.round(l.currentValue/l.targetValue*100):0}async function b(){const[l,o]=await Promise.all([A.getTree(c.value),A.getOrphans(c.value)]);w.value=l,h.value=o}function P(l){u.value=l}return U(async()=>{m.value=await K.list(),m.value.length>0&&(c.value=m.value[0].id,await b())}),(l,o)=>{const D=n("el-option"),R=n("el-select"),v=n("el-tag"),k=n("el-progress"),I=n("el-tree"),O=n("el-divider"),N=n("el-card"),V=n("el-col"),g=n("el-table-column"),z=n("el-table"),B=n("el-empty"),L=n("el-row");return s(),d("div",Y,[i("div",j,[o[1]||(o[1]=i("span",{class:"data-toolbar__title"},"OKR 对齐视图",-1)),o[2]||(o[2]=i("span",{class:"data-toolbar__spacer"},null,-1)),t(R,{modelValue:c.value,"onUpdate:modelValue":o[0]||(o[0]=e=>c.value=e),placeholder:"选择周期",onChange:b,style:{width:"240px"},size:"small"},{default:a(()=>[(s(!0),d(x,null,C(m.value,e=>(s(),f(D,{key:e.id,label:e.name,value:e.id},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),c.value?(s(),f(L,{key:0,gutter:20},{default:a(()=>[t(V,{span:8},{default:a(()=>[t(N,{header:"对齐树",class:"tree-card"},{default:a(()=>[t(I,{data:w.value,props:{children:"children",label:"title"},"node-key":"id","highlight-current":"",onNodeClick:P},{default:a(({data:e})=>[i("div",S,[t(v,{size:"small",type:E(e.level)},{default:a(()=>[p(r(y(e.level)),1)]),_:2},1032,["type"]),i("span",q,r(e.title),1),t(k,{percentage:e.progress||0,"stroke-width":4,style:{width:"60px"}},null,8,["percentage"])])]),_:1},8,["data"]),h.value.length>0?(s(),d("div",G,[t(O),t(v,{type:"warning"},{default:a(()=>[...o[3]||(o[3]=[p("孤立目标 (未对齐)",-1)])]),_:1}),(s(!0),d(x,null,C(h.value,e=>(s(),d("div",{key:e.id,class:"orphan-item"},r(e.userName)+" - "+r(e.title),1))),128))])):T("",!0)]),_:1})]),_:1}),t(V,{span:16},{default:a(()=>[u.value?(s(),f(N,{key:0},{header:a(()=>[p(r(u.value.title),1)]),default:a(()=>[i("div",H,[t(v,null,{default:a(()=>[p(r(y(u.value.level)),1)]),_:1}),i("span",null,"负责人: "+r(u.value.userName),1),i("span",null,"进度: "+r(u.value.progress||0)+"%",1)]),t(z,{data:u.value.keyResults||[],style:{"margin-top":"16px"}},{default:a(()=>[t(g,{prop:"title",label:"KR"}),t(g,{label:"进度",width:"160"},{default:a(({row:e})=>[t(k,{percentage:M(e),"stroke-width":6},null,8,["percentage"])]),_:1}),t(g,{prop:"weight",label:"权重",width:"60"}),t(g,{label:"状态",width:"90"},{default:a(({row:e})=>[t(v,{size:"small"},{default:a(()=>[p(r(e.status),1)]),_:2},1024)]),_:1})]),_:1},8,["data"])]),_:1})):(s(),f(B,{key:1,description:"请选择左侧 OKR 节点查看详情"}))]),_:1})]),_:1})):T("",!0)])}}},$=F(J,[["__scopeId","data-v-529c7188"]]);export{$ as default};
