import{S as g,_ as C,d as Y,cU as x,cl as k,m as _,n as B,r as i,ag as w,o as r,c as p,h as l,u as a,cV as M,B as h,A,x as v,H as F,D as V,a as D,b as N}from"./index.e80c366d.js";import{f as T}from"./export.6f50dc45.js";import{a as R}from"./apis.9c01d50e.js";import"./xlsx.ed122d16.js";import"./createRequset.60472412.js";const S=g(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="customerDepartment",q=Y({__name:"summary",setup(H){const{hasPermissionWithCode:d}=x(U),t=k(!1),u=_([]),y=_([]);async function E(){const o=u.value.map(({manager:n,total_percentage:e})=>({username:n,total_percentage:e}));T({name:"\u5BA2\u670D\u90E8\u63D0\u6210\u4E1A\u7EE9\u6C47\u603B.xlsx",columns:P,data:o})}async function c(o){t.value=!0;const{data:n,code:e}=await R.summary({...o,depart_type:"1"});if(t.value=!1,e!==1)return;const{manager:s=[],sale:m=[]}=n||{};u.value=s,y.value=m}const b=g(new Date).subtract(1,"month").format("YYYY-MM");return B(()=>c({year_month:b})),(o,n)=>{const e=i("ElButton"),s=i("ElTableColumn"),m=i("ElTable"),f=w("loading");return r(),p("div",null,[l(a(M),{"lock-key":["year_month"],"form-config":a(j),onResetBtnClick:c,onSearchBtnClick:c},null,8,["form-config"]),h((r(),p("div",W,[a(d)("9")?h((r(),p("div",z,[a(d)("9")?(r(),A(e,{key:0,icon:a(V)("arrow-up-line"),onClick:E,type:"primary",size:"small"},{default:v(()=>[F("\u5BFC\u51FA ")]),_:1},8,["icon"])):D("v-if",!0)])),[[f,t.value]]):D("v-if",!0),N("div",I,[l(m,{border:"",size:"small",data:u.value},{default:v(()=>[l(s,{prop:"manager",label:"\u4E1A\u52A1\u7ECF\u7406"}),l(s,{prop:"total_percentage",label:"\u63D0\u6210\u91D1\u989D"})]),_:1},8,["data"])])])),[[f,t.value]])])}}});var Q=C(q,[["__file","C:/Users/63107/Desktop/projects/report-v3/src/views/time/customerDepartment/components/summary.vue"]]);export{Q as default};
