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