import{S as g,_ as C,d as Y,cT as x,cl as k,m as v,n as B,r as p,ag as w,o as u,c as d,h as t,u as s,cU as M,B as D,A as F,x as f,H as T,D as A,a as E,b as N}from"./index.d0c68291.js";import{a as V}from"./apis.07ef27e5.js";import{f as R}from"./export.8d59e752.js";import"./createRequset.2a519b90.js";const j=g(new Date).subtract(1,"month").format("YYYY-MM"),z={formItems:[{field:"year_month",type:"date_picker",defaultValue:j,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"}],S={"bg-white":"","p-2":""},W={key:0,flex:"","justify-end":"","mb-2":"","mr-2":""},I={flex:"","gap-5":""},U="mediumDepartment",q=Y({__name:"summary",setup(H){const{hasPermissionWithCode:_}=x(U),n=k(!1),c=v([]),m=v([]);async function b(){const r=c.value.map(({manager:e,total_percentage:a})=>({username:e,total_percentage:a})),l=m.value.map(({saler:e,total_percentage:a})=>({username:e,total_percentage:a})),o=[...r,...l];R({columns:P,name:"x\u63D0\u6210\u4E1A\u7EE9\u6C47\u603B.xlsx",data:o})}async function i(r){n.value=!0;const{data:l,code:o}=await V.summary({...r,depart_type:"1"});if(n.value=!1,o!==1)return;const{manager:e=[],sale:a=[]}=l||{};c.value=e,m.value=a}const y=g(new Date).subtract(1,"month").format("YYYY-MM");return B(()=>i({year_month:y})),(r,l)=>{const o=p("ElButton"),e=p("ElTableColumn"),a=p("ElTable"),h=w("loading");return u(),d("div",null,[t(s(M),{"lock-key":["year_month"],"form-config":s(z),onResetBtnClick:i,onSearchBtnClick:i},null,8,["form-config"]),D((u(),d("div",S,[s(_)("9")?D((u(),d("div",W,[s(_)("9")?(u(),F(o,{key:0,icon:s(A)("arrow-up-line"),onClick:b,type:"primary",size:"small"},{default:f(()=>[T("\u5BFC\u51FA ")]),_:1},8,["icon"])):E("v-if",!0)])),[[h,n.value]]):E("v-if",!0),N("div",I,[t(a,{border:"",size:"small",data:m.value},{default:f(()=>[t(e,{prop:"saler",label:"\u9500\u552E\u4EBA\u5458"}),t(e,{prop:"total_percentage",label:"\u63D0\u6210\u91D1\u989D"})]),_:1},8,["data"]),t(a,{border:"",size:"small",data:c.value},{default:f(()=>[t(e,{prop:"manager",label:"\u9879\u76EE\u7ECF\u7406"}),t(e,{prop:"total_percentage",label:"\u63D0\u6210\u91D1\u989D"})]),_:1},8,["data"])])])),[[h,n.value]])])}}});var L=C(q,[["__file","C:/Users/63107/Desktop/projects/report-v3/src/views/time/mediumDepartment/components/summary.vue"]]);export{L as default};
