import{s as y}from"./index-8cA9XdMr.js";import{i as g,L as x}from"./index-Bn9PLWWT.js";import{q as w,c as k,a,e as i,t as c,b as s,w as d,s as S,h as f,r as p,o as j}from"./index-Au1XOH8d.js";const C={class:"stat-cards"},L={class:"stat-card purple"},A={class:"value"},B={class:"stat-card green"},N={class:"value"},R={class:"content-card"},V={class:"content-card"},G={__name:"SalesStats",setup(T){const e=f({}),n=f(null);let r=null;async function v(){const l=await y.getStats();e.value=l.data,await S(),m()}function m(){if(!n.value)return;r||(r=g(n.value,"dark"));const l=(e.value.projects||[]).filter(t=>t.total_hours>0);r.setOption({backgroundColor:"transparent",tooltip:{trigger:"axis"},xAxis:{type:"category",data:l.map(t=>t.client_name),axisLabel:{color:"#94a3b8",rotate:30}},yAxis:{type:"value",name:"工时(h)",axisLabel:{color:"#94a3b8"}},series:[{type:"bar",data:l.map(t=>t.total_hours),itemStyle:{borderRadius:[6,6,0,0],color:new x(0,0,0,1,[{offset:0,color:"#818cf8"},{offset:1,color:"#6366f1"}])}}]})}return w(v),(l,t)=>{var u;const o=p("el-table-column"),b=p("el-tag"),h=p("el-table");return j(),k("div",null,[t[6]||(t[6]=a("div",{class:"page-header"},[a("h1",null,"数据统计"),a("p",null,"查看您名下项目的研发工时消耗情况")],-1)),a("div",C,[a("div",L,[t[1]||(t[1]=a("div",{class:"label"},"项目总数",-1)),a("div",A,[i(c(((u=e.value.projects)==null?void 0:u.length)||0),1),t[0]||(t[0]=a("span",{class:"unit"},"个",-1))])]),a("div",B,[t[3]||(t[3]=a("div",{class:"label"},"累计总工时",-1)),a("div",N,[i(c(e.value.total_hours||0),1),t[2]||(t[2]=a("span",{class:"unit"},"小时",-1))])])]),a("div",R,[t[4]||(t[4]=a("div",{class:"card-title"},"各项目工时明细",-1)),s(h,{data:e.value.projects||[],stripe:""},{default:d(()=>[s(o,{prop:"client_name",label:"客户/项目","min-width":"180"}),s(o,{prop:"client_status",label:"状态",width:"100"},{default:d(({row:_})=>[s(b,{type:_.client_status===1?"success":"info",effect:"dark",round:""},{default:d(()=>[i(c(_.client_status===1?"进行中":"已结算"),1)]),_:2},1032,["type"])]),_:1}),s(o,{prop:"total_hours",label:"总工时(h)",width:"120"}),s(o,{prop:"rd_count",label:"参与研发人数",width:"130"}),s(o,{prop:"work_days",label:"工作天数",width:"110"})]),_:1},8,["data"])]),a("div",V,[t[5]||(t[5]=a("div",{class:"card-title"},"项目工时占比",-1)),a("div",{ref_key:"chartRef",ref:n,class:"chart-container"},null,512)])])}}};export{G as default};
