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 N,C as f,M as T,J as V,a as D,b as j}from"./index.1d5f2f42.js";import{a as A}from"./apis.df648472.js";import{f as R}from"./export.669edd93.js";import"./createRequset.f858bea3.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),r=B(!1),c=v([]),m=v([]);async function g(){const s=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})),n=[...s,...l];R({columns:S,name:"\u9879\u76EE\u90E8\u65B0\u653F\u7B56\u63D0\u6210\u4E1A\u7EE9\u6C47\u603B.xlsx",data:n})}async function i(s){r.value=!0;const{data:l,code:n}=await A.summary({...s,depart_type:"3"});if(r.value=!1,n!==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})),(s,l)=>{const n=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(),N(n,{key:0,icon:o(V)("arrow-up-line"),onClick:g,type:"primary",size:"small"},{default:f(()=>[T("\u5BFC\u51FA ")]),_:1},8,["icon"])):D("v-if",!0)])),[[h,o(r)]]):D("v-if",!0),j("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(r)]])])}}});var L=Y(G,[["__file","D:/work/rep-v3/report-v3/src/views/time/projectDepartment/components/summary.vue"]]);export{L as default};
