import{Z as D,_ as C,d as k,b9 as x,aD as w,w as _,x as B,r as i,al as M,o as r,c as p,l,u as e,ba as A,H as h,G as F,C as v,M as N,J as T,a as y,b as V}from"./index.1d5f2f42.js";import{f as R}from"./export.669edd93.js";import{a as P}from"./apis.34a6a66b.js";import"./createRequset.f858bea3.js";const S=D(new Date).subtract(1,"month").format("YYYY-MM"),W={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"}}]},j=[{prop:"username",label:"\u59D3\u540D",minWidth:"155px"},{prop:"total_percentage",label:"\u63D0\u6210\u91D1\u989D",minWidth:"155px"}],z={"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 E="customerDepartment",{hasPermissionWithCode:d}=x(E),t=w(!1),u=_([]),b=_([]);async function g(){const o=u.value.map(({manager:n,total_percentage:a})=>({username:n,total_percentage:a}));R({columns:j,name:"\u5BA2\u670D\u90E8\u63D0\u6210\u4E1A\u7EE9\u6C47\u603B.xlsx",data:o})}async function c(o){t.value=!0;const{data:n,code:a}=await P.summary({...o,depart_type:"1"});if(t.value=!1,a!==1)return;const{manager:s=[],sale:m=[]}=n||{};u.value=s,b.value=m}const Y=D(new Date).subtract(1,"month").format("YYYY-MM");return B(()=>c({year_month:Y})),(o,n)=>{const a=i("ElButton"),s=i("ElTableColumn"),m=i("ElTable"),f=M("loading");return r(),p("div",null,[l(e(A),{"lock-key":["year_month"],"form-config":e(W),onResetBtnClick:c,onSearchBtnClick:c},null,8,["lock-key","form-config"]),h((r(),p("div",z,[e(d)("9")?h((r(),p("div",I,[e(d)("9")?(r(),F(a,{key:0,icon:e(T)("arrow-up-line"),onClick:g,type:"primary",size:"small"},{default:v(()=>[N("\u5BFC\u51FA ")]),_:1},8,["icon"])):y("v-if",!0)])),[[f,e(t)]]):y("v-if",!0),V("div",q,[l(m,{border:"",size:"small",data:u.value},{default:v(()=>[l(s,{prop:"manager",label:"\u9500\u552E\u4EBA\u5458"}),l(s,{prop:"total_percentage",label:"\u63D0\u6210\u91D1\u989D"})]),_:1},8,["data"])])])),[[f,e(t)]])])}}});var L=C(G,[["__file","D:/work/rep-v3/report-v3/src/views/time/customerDepartment/components/summary.vue"]]);export{L as default};