import{Z as E,_ as Y,d as x,b9 as k,aD as w,w as v,x as B,r as p,al as M,o as u,c as d,l as t,u as o,ba as F,H as D,G as N,C as f,M as T,J as V,a as b,b as A}from"./index.1d5f2f42.js";import{a as R}from"./apis.b3a47976.js";import{f as z}from"./export.669edd93.js";import"./createRequset.f858bea3.js";const P=E(new Date).subtract(1,"month").format("YYYY-MM"),W={formItems:[{field:"year_month",type:"date_picker",defaultValue:P,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"}],I={"bg-white":"","p-2":""},S={key:0,flex:"","justify-end":"","mb-2":"","mr-2":""},q={flex:"","gap-5":""},G=x({__name:"summary",setup(H){const y="customerDepartment",{hasPermissionWithCode:_}=k(y),s=w(!1),c=v([]),m=v([]);async function g(){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})),n=[...r,...l];z({columns:j,name:"x\u63D0\u6210\u4E1A\u7EE9\u6C47\u603B.xlsx",data:n})}async function i(r){s.value=!0;const{data:l,code:n}=await R.summary({...r,depart_type:"1"});if(s.value=!1,n!==1)return;const{manager:e=[],sale:a=[]}=l||{};c.value=e,m.value=a}const C=E(new Date).subtract(1,"month").format("YYYY-MM");return B(()=>i({year_month:C})),(r,l)=>{const n=p("ElButton"),e=p("ElTableColumn"),a=p("ElTable"),h=M("loading");return u(),d("div",null,[t(o(F),{"lock-key":["year_month"],"form-config":o(W),onResetBtnClick:i,onSearchBtnClick:i},null,8,["lock-key","form-config"]),D((u(),d("div",I,[o(_)("9")?D((u(),d("div",S,[o(_)("9")?(u(),N(n,{key:0,icon:o(V)("arrow-up-line"),onClick:g,type:"primary",size:"small"},{default:f(()=>[T("\u5BFC\u51FA ")]),_:1},8,["icon"])):b("v-if",!0)])),[[h,o(s)]]):b("v-if",!0),A("div",q,[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,o(s)]])])}}});var L=Y(G,[["__file","D:/work/rep-v3/report-v3/src/views/time/mediumDepartment/components/summary.vue"]]);export{L as default};
