import{d as j,V as q,r as l,ay as E,aw as O,c as $,o as n,w as A,i as _,j as F,h as c,F as C,a9 as w,E as X,A as x,D as Y,dg as z,X as W,ac as G}from"./index-9PRMimni.js";import{b as H}from"./plan-n8bSdRD5.js";import{f as J}from"./group-DxznlajQ.js";const K={class:"flex ml-1 mt-1"},Q={class:"h-full cursor-pointer"},U={style:{"background-color":"#f3fcfb","border-color":"#eff2fb"},class:"h-9 leading-9 border-solid border text-center"},Z=["type","onClick","onContextmenu"],ee={key:0,style:{"background-color":"rgba(45, 166, 65, 0.2)",color:"#45b057","border-left":"3px solid #45b057"}},se=j({__name:"fiveDasboard",props:{currentYear:{type:Number},shipInfo:{type:Object}},emits:["itemClicked","rightClickSelect"],setup(D,{emit:I}){const d=I,L=D,{t}=q(),M=[{label:t("hsqe.planner.assignedReport"),key:"assignedReport"},{label:t("hsqe.planner.edit"),key:"edit"},{label:"Delete",key:"delete"},{label:"Log",key:"auditLog"}],b=new Date().getMonth(),i=l(!1),g=l(0),f=l(0),p=l(""),s=l([]),y=l([]),m=l([]);E(()=>L.shipInfo,()=>{R()},{deep:!0});async function R(){let e={shipId:"181",years:["2027"]};try{const a=await H(e);m.value=a.data,y.value=a.data.map((v,r)=>({...v,value:r+1,isPastOrCurrent:r+1<=b,isCurrentMonth:r+1===b+1})),console.log(y,"🍎拿到最新数据！")}catch(a){console.error("获取计划列表失败:",a)}}function S(e){console.log(d("itemClicked"),"approvalInfo"),d("itemClicked",e)}function V(e){d("rightClickSelect",e,p.value)}function P(e,a){p.value="",p.value=a.id,e.preventDefault(),i.value=!1,G().then(()=>{i.value=!0,g.value=e.clientX,f.value=e.clientY})}function B(){i.value=!1}async function N(){try{const e=await J();s.value=e,m.value=[{value:1,label:t("2025"),items:s.value},{value:2,label:t("2026"),items:s.value},{value:3,label:t("2027"),items:s.value},{value:4,label:t("2028"),items:s.value},{value:5,label:t("2029"),items:s.value}],console.log(e,"--getPlanShipsList-")}catch{}}return O(()=>{N()}),(e,a)=>{const v=z,r=W;return n(),$(r,null,{default:A(()=>[_("div",K,[(n(!0),c(C,null,w(m.value,(u,T)=>(n(),c("div",{class:X([T===4?"bg-sky-200":"bg-gray-100","w-1/5"]),key:u.value},[_("div",Q,[_("div",U,x(u.label),1),(n(!0),c(C,null,w(u.items,(o,h)=>(n(),c("div",{key:`${u.value}-${h}`,type:o.type,onClick:k=>S(o),class:"p-1 h-8 border text-center mt-1",onContextmenu:k=>P(k,o)},[h==1||h==7?(n(),c("div",ee,x(o.exerciseVesselType?o.exerciseVesselType:o.projectEnglish),1)):Y("",!0)],40,Z))),128))])],2))),128))]),F(v,{placement:"bottom-start",onSelect:V,trigger:"manual",x:g.value,y:f.value,options:M,show:i.value,"on-clickoutside":B},null,8,["x","y","show"])]),_:1})}}});export{se as _};
