import{S as D,_ as C,d as Y,cU 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,cV as M,B as v,A,x as g,H as F,D as V,a as y,b as N}from"./index.e80c366d.js";import{a as T}from"./apis.b19ff89b.js";import{f as R}from"./export.6f50dc45.js";import"./createRequset.60472412.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":""},U="mediumDepartment",q=Y({__name:"summary",setup(H){const{hasPermissionWithCode:d}=x(U),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 T.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 b=D(new Date).subtract(1,"month").format("YYYY-MM");return B(()=>m({year_month:b})),(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(V)("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),N("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=C(q,[["__file","C:/Users/63107/Desktop/projects/report-v3/src/views/time/mediumDepartment/components/summary.vue"]]);export{Q as default};
