import{S as y,_ 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 l,c as p,h as u,u as o,cY as M,B as v,A,x as E,H as F,D as N,a as g,b as T}from"./index.56449854.js";import{a as V}from"./apis.7c8a408c.js";import{f as R}from"./export.a2ce61c0.js";import"./createRequset.56e9fc42.js";import"./xlsx.ed122d16.js";const S=y(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="saleDepartment",H=C({__name:"summary",setup(O){const{hasPermissionWithCode:d}=x(q),n=k(!1),c=h([]),f=h([]);async function D(){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:"\u9500\u552E\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:"4"});if(n.value=!1,t!==1)return;const{manager:e=[],sale:a=[]}=r||{};c.value=e,f.value=a}const Y=y(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 l(),p("div",null,[u(o(M),{"lock-key":["year_month"],"form-config":o(j),onResetBtnClick:m,onSearchBtnClick:m},null,8,["form-config"]),v((l(),p("div",W,[o(d)("9")?v((l(),p("div",z,[o(d)("9")?(l(),A(t,{key:0,icon:o(N)("arrow-up-line"),onClick:D,type:"primary",size:"small"},{default:E(()=>[F("\u5BFC\u51FA ")]),_:1},8,["icon"])):g("v-if",!0)])),[[_,n.value]]):g("v-if",!0),T("div",I,[u(a,{border:"",size:"small",data:c.value},{default:E(()=>[u(e,{prop:"manager",label:"\u4E1A\u52A1\u7ECF\u7406"}),u(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/saleDepartment/components/summary.vue"]]);export{Q as default};