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