import{h as p,q as A,c as d,a as t,b as y,w as g,F as h,i as x,r as i,o as n,B as W,k as z,e as E,n as F,t as b,E as N}from"./index-CMZBZO_O.js";import{b as k}from"./index-B4LtVBBd.js";const S={class:"content-card"},U={class:"card-title"},Y={class:"filter-bar",style:{"margin-bottom":"0"}},D={style:{display:"grid","grid-template-columns":"repeat(auto-fill, minmax(200px, 1fr))",gap:"16px","margin-top":"8px"}},M={class:"label"},q={style:{display:"flex","align-items":"center",gap:"8px"}},L={style:{"margin-top":"6px","font-size":"12px",color:"var(--text-muted)"}},G={__name:"WorkdaySetting",setup(T){const _=new Date().getFullYear(),V=Array.from({length:5},(l,e)=>_-2+e),s=p(_),u=p(!1),c=p(Array.from({length:12},(l,e)=>({month:e+1,days:22})));async function v(){try{const l=await k.getWorkdays(s.value);l.data.length>0&&(c.value=Array.from({length:12},(e,o)=>{const r=l.data.find(m=>m.month===o+1);return{month:o+1,days:r?r.days:22}}))}catch{}}async function w(){u.value=!0;try{await k.setWorkdays({year:s.value,months:c.value.map(l=>({month:l.month,days:l.days}))}),N.success("保存成功")}finally{u.value=!1}}return A(v),(l,e)=>{const o=i("el-option"),r=i("el-select"),m=i("el-button"),B=i("el-input-number");return n(),d("div",null,[e[3]||(e[3]=t("div",{class:"page-header"},[t("h1",null,"工作日设置"),t("p",null,"按年份设定每月工作日天数，用于计算研发工时上限")],-1)),t("div",S,[t("div",U,[t("div",Y,[y(r,{modelValue:s.value,"onUpdate:modelValue":e[0]||(e[0]=a=>s.value=a),onChange:v,style:{width:"120px"}},{default:g(()=>[(n(!0),d(h,null,x(W(V),a=>(n(),z(o,{key:a,label:`${a}年`,value:a},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),y(m,{type:"primary",loading:u.value,onClick:w},{default:g(()=>[...e[1]||(e[1]=[E("保存设置",-1)])]),_:1},8,["loading"])]),t("div",D,[(n(!0),d(h,null,x(c.value,(a,f)=>(n(),d("div",{key:f,class:F(["stat-card",["purple","green","blue","orange"][f%4]])},[t("div",M,b(a.month)+"月",1),t("div",q,[y(B,{modelValue:a.days,"onUpdate:modelValue":C=>a.days=C,min:0,max:31,size:"default",style:{width:"120px"}},null,8,["modelValue","onUpdate:modelValue"]),e[2]||(e[2]=t("span",{class:"unit"},"天",-1))]),t("div",L," 工时上限: "+b(a.days*8)+" 小时 ",1)],2))),128))])])])}}};export{G as default};
