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