import{aT as V,ac as S,aN as i,_ as R,d as Y,w as b,W as M,bx as O,x as $,ad as I,$ as P,r as f,o as g,c as E,j as l,C as o,h as B,F as D,D as x,M as y,L,l as C}from"./index.js";import T from"./company-select.04e763.js";import"./index.f3438816.js";var j=[{value:"710",label:"\u56DE\u6B3E\u6838\u9500\u660E\u7EC6\u8868",time:"",end:"",url:"ole"},{value:"711",label:"\u56DE\u7968\u660E\u7EC6\u8868",time:"",end:"",url:"ie"},{value:"712",label:"\u7ECF\u8425\u5206\u6790\u62A5\u8868",time:"",end:"",url:"ae"},{value:"713",label:"\u6536\u5165\u6210\u672C\u660E\u7EC6\u8868",time:"",url:"oie"},{value:"714",label:"\u5E94\u6536\u53F0\u8D26\u8868",time:"",end:"",url:"sbe"},{value:"715",label:"\u7528\u53CB\u9500\u7968\u8868",time:"",end:"",url:"pie"}];const q=[{url:"pe",value:"716",label:"\u8BA2\u5355\u5BF9\u8D26\u6C47\u603B\u8868",time:"",end:""},{url:"cm",value:"716",label:"\u91C7\u8D2D\u7BA1\u7406\u8868",time:"",end:""}],{VITE_PROXY_DOMAIN_REAL:ne,VITE_PROXY_USER_REAL:k}=S(),W=k+"/admin/",X=k,H=(u,r)=>V.request("post",`${W}${u}`,{data:r,responseType:"blob"}),z=(u,r)=>V.request("post",`${X}${u}`,{data:r,responseType:"blob"});async function N(u){if(!u.url)return;u.onStart&&u.onStart();const s=await(u.admin===!1?z:H)(u.url,{...u.params}).catch(()=>u.onFail&&u.onFail()),{code:m}=s;if(Number(m)!==0&&u.onFail&&u.onFail(),s.type==="application/json"){i.warning("\u672A\u627E\u5230\u6570\u636E");return}if(i.warning("\u4E0B\u8F7D\u4E2D,\u8BF7\u7A0D\u7B49"),m&&Number(m)!==0){i.warning(s.message);return}function F(){const a=new Blob([s],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),h=window.URL.createObjectURL(a),c=document.createElement("a");c.style.display="none",c.href=h,c.setAttribute("download",u.name),document.body.appendChild(c),c.click(),window.URL.revokeObjectURL(h),i.success("\u4E0B\u8F7D\u5B8C\u6210"),u.onSuccess&&u.onSuccess()}F()}const G={class:"main"},J={style:{width:"100%","text-align":"center"}},K={style:{width:"1200px","text-align":"left",display:"inline-block",margin:"14vh 2vh 0 0"}},Q={name:"commission"},Z=Y({...Q,setup(u){const r=b(j),s=b(q),{currentCompany:m}=M(),F=b([]),a=O({currentLine:-1,loading:!1});async function h(n,_){const e=m.value.companyNo;if(!e){i.warning("\u8BF7\u9009\u62E9\u4E1A\u52A1\u516C\u53F8!");return}n.time.length===2?await N({url:n.url,name:n.label,onStart:()=>{a.currentLine=_,a.loading=!0},onSuccess:()=>{a.currentLine=-1,a.loading=!1},onFail:()=>{a.currentLine=-1,a.loading=!1},params:{start:n.time[0],company:e,end:n.time[1]}}):i.warning("\u8BF7\u9009\u62E9\u65F6\u95F4\u533A\u95F4!")}async function c(n,_){const e=m.value.companyNo,{supplierNo:v}=n;if(!e){i.warning("\u8BF7\u9009\u62E9\u4E1A\u52A1\u516C\u53F8!");return}if(e===v){i.warning("\u5356\u65B9\u516C\u53F8\u4E0E\u4E1A\u52A1\u516C\u53F8\u4E0D\u80FD\u4E00\u81F4!");return}n.time.length===2?await N({url:n.url,name:n.label,onStart:()=>{a.currentLine=_,a.loading=!0},onSuccess:()=>{a.currentLine=-1,a.loading=!1},onFail:()=>{a.currentLine=-1,a.loading=!1},params:{start:n.time[0],companyNo:e,end:n.time[1],supplierNo:v}}):i.warning("\u8BF7\u9009\u62E9\u65F6\u95F4\u533A\u95F4!")}return $(()=>{const n=I().getMenuActions("commission");F.value=n,r.value.forEach((_,e)=>{r.value[e].time="",r.value[e].end=""}),s.value.forEach((_,e)=>{s.value[e].time="",s.value[e].end="",s.value[e].supplierNo=""})}),P(()=>{}),(n,_)=>{const e=f("el-col"),v=f("el-date-picker"),w=f("el-button"),A=f("el-row"),U=f("PagePower");return g(),E("div",G,[l(U,{"is-show":F.value.some(t=>t==="001")},{default:o(()=>[B("div",J,[B("div",K,[(g(!0),E(D,null,x(r.value,(t,d)=>(g(),E("div",{key:t.value+d,style:{padding:"10px 20px"}},[l(A,{style:{width:"100%"}},{default:o(()=>[l(e,{span:7,class:"tr",style:{padding:"0 30px 0 0","line-height":"32px"}},{default:o(()=>[y(L(t.label),1)]),_:2},1024),l(e,{span:8},{default:o(()=>[l(v,{modelValue:t.time,"onUpdate:modelValue":p=>t.time=p,type:"daterange","range-separator":"\u81F3","value-format":"YYYY-MM-DD","start-placeholder":"\u5F00\u59CB\u65E5\u671F","end-placeholder":"\u7ED3\u675F\u65E5\u671F"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024),l(e,{span:3},{default:o(()=>[l(w,{type:"primary",loading:C(a).currentLine===d&&C(a).loading,onClick:p=>h(t,d)},{default:o(()=>[y(" \u5BFC\u51FA ")]),_:2},1032,["loading","onClick"])]),_:2},1024)]),_:2},1024)]))),128)),(g(!0),E(D,null,x(s.value,(t,d)=>(g(),E("div",{key:t.value+d,style:{padding:"10px 20px"}},[l(A,{style:{width:"100%"}},{default:o(()=>[l(e,{span:7,class:"tr",style:{padding:"0 30px 0 0","line-height":"32px"}},{default:o(()=>[y(L(t.label),1)]),_:2},1024),l(e,{span:8},{default:o(()=>[l(v,{modelValue:t.time,"onUpdate:modelValue":p=>t.time=p,type:"daterange","range-separator":"\u81F3","value-format":"YYYY-MM-DD","start-placeholder":"\u5F00\u59CB\u65E5\u671F","end-placeholder":"\u7ED3\u675F\u65E5\u671F"},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024),l(e,{span:6},{default:o(()=>[l(T,{modelValue:t.supplierNo,"onUpdate:modelValue":p=>t.supplierNo=p},null,8,["modelValue","onUpdate:modelValue"])]),_:2},1024),l(e,{span:3},{default:o(()=>[l(w,{type:"primary",loading:C(a).currentLine===d+r.value.length&&C(a).loading,onClick:p=>c(t,d+r.value.length)},{default:o(()=>[y(" \u5BFC\u51FA ")]),_:2},1032,["loading","onClick"])]),_:2},1024)]),_:2},1024)]))),128))])])]),_:1},8,["is-show"])])}}});var te=R(Z,[["__scopeId","data-v-772d5bee"],["__file","C:/Users/Administrator/Desktop/projects/purchase-vue3/src/views/parameter/commission/index.vue"]]);export{te as default};