import{S as g,_ as C,d as Y,cU as x,cl as B,m as v,n as k,r as p,ag as w,o as l,c as d,h as t,u as n,cV as M,B as E,A,x as f,H as F,D as V,a as D,b as j}from"./index.e80c366d.js";import{a as N}from"./apis.ef6faf99.js";import{f as T}from"./export.6f50dc45.js";import"./createRequset.60472412.js";import"./xlsx.ed122d16.js";const R=g(new Date).subtract(1,"month").format("YYYY-MM"),S={formItems:[{field:"year_month",type:"date_picker",defaultValue:R,placeholder:"\u660E\u7EC6\u6708\u4EFD",trigger:"change",otherOptions:{clearable:!1,editable:!1,type:"month",format:"YYYY-MM",valueFormat:"YYYY-MM"}}]},z=[{prop:"username",label:"\u59D3\u540D",minWidth:"155px"},{prop:"total_percentage",label:"\u63D0\u6210\u91D1\u989D",minWidth:"155px"}],P={"bg-white":"","p-2":""},W={key:0,flex:"","justify-end":"","mb-2":"","mr-2":""},I={flex:"","gap-5":""},U="projectDepartment",q=Y({__name:"summary",setup(H){const{hasPermissionWithCode:_}=x(U),s=B(!1),c=v([]),m=v([]);async function b(){const r=c.value.map(({manager:e,total_percentage:a})=>({username:e,total_percentage:a})),u=m.value.map(({saler:e,total_percentage:a})=>({username:e,total_percentage:a})),o=[...r,...u];T({columns:z,name:"\u9879\u76EE\u90E8\u65B0\u653F\u7B56\u63D0\u6210\u4E1A\u7EE9\u6C47\u603B.xlsx",data:o})}async function i(r){s.value=!0;const{data:u,code:o}=await N.summary({...r,depart_type:"3"});if(s.value=!1,o!==1)return;const{manager:e=[],sale:a=[]}=u||{};c.value=e,m.value=a}const y=g(new Date).subtract(1,"month").format("YYYY-MM");return k(()=>i({year_month:y})),(r,u)=>{const o=p("ElButton"),e=p("ElTableColumn"),a=p("ElTable"),h=w("loading");return l(),d("div",null,[t(n(M),{"lock-key":["year_month"],"form-config":n(S),onResetBtnClick:i,onSearchBtnClick:i},null,8,["form-config"]),E((l(),d("div",P,[n(_)("9")?E((l(),d("div",W,[n(_)("9")?(l(),A(o,{key:0,icon:n(V)("arrow-up-line"),onClick:b,type:"primary",size:"small"},{default:f(()=>[F("\u5BFC\u51FA ")]),_:1},8,["icon"])):D("v-if",!0)])),[[h,s.value]]):D("v-if",!0),j("div",I,[t(a,{border:"",size:"small",data:m.value},{default:f(()=>[t(e,{prop:"saler",label:"\u9500\u552E\u4EBA\u5458"}),t(e,{prop:"total_percentage",label:"\u63D0\u6210\u91D1\u989D"})]),_:1},8,["data"]),t(a,{border:"",size:"small",data:c.value},{default:f(()=>[t(e,{prop:"manager",label:"\u4E1A\u52A1\u7ECF\u7406"}),t(e,{prop:"total_percentage",label:"\u63D0\u6210\u91D1\u989D"})]),_:1},8,["data"])])])),[[h,s.value]])])}}});var Q=C(q,[["__file","C:/Users/63107/Desktop/projects/report-v3/src/views/time/projectDepartment/components/summary.vue"]]);export{Q as default};
