import{S as y,_ 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 l,c as p,h as u,u as o,cV as M,B as v,A,x as E,H as F,D as V,a as g,b as N}from"./index.aedafc85.js";import{a as T}from"./apis.8052170d.js";import{f as R}from"./export.443e72b5.js";import"./createRequset.72613757.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":""},U="saleDepartment",q=Y({__name:"summary",setup(H){const{hasPermissionWithCode:d}=x(U),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 T.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 b=y(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 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(V)("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),N("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=C(q,[["__file","C:/Users/63107/Desktop/projects/report-v3/src/views/time/saleDepartment/components/summary.vue"]]);export{Q as default};
