var C=(y,b,e)=>new Promise((p,c)=>{var x=n=>{try{r(e.next(n))}catch(m){c(m)}},u=n=>{try{r(e.throw(n))}catch(m){c(m)}},r=n=>n.done?p(n.value):Promise.resolve(n.value).then(x,u);r((e=e.apply(y,b)).next())});import{a as R}from"./index-1ef73356.js";import{d as L,r as k,K as $,j as v,o as _,c as h,e as i,w as a,b as w,k as V,F as N,v as U,h as j}from"./index-90c78f99.js";const D=["src"],F={class:"flex justify-center"},I={class:"flex items-center py-16"},O=w("span",{class:"flex-shrink-0"},"试运行报告：",-1),q={class:"dialog-footer"},T=L({__name:"syx-reports-drawer",props:{visible:{type:Boolean,default:!1,required:!0},data:Object},emits:["close"],setup(y,{emit:b}){const e=y,p=k(),c=k(),x=()=>C(this,null,function*(){const t=yield R(p.value);c.value=t.data}),u=k(!1),r=k(),n=()=>{u.value=!0},m=()=>{r.value.forEach(t=>{B(t)})},B=t=>C(this,null,function*(){const f=(yield R(t)).data,s=document.createElement("a");s.style.display="none",s.href=f,s.download=e.data&&e.data.find(d=>d.applicationCode===t)&&e.data.find(d=>d.applicationCode===t).applicationName+"试运行报告.pdf",document.body.appendChild(s),s.click(),document.body.removeChild(s),window.URL.revokeObjectURL(f)});return $(()=>e.visible,t=>C(this,null,function*(){console.log(t),e.data&&t&&(p.value=e.data&&e.data[0].applicationCode,x())})),(t,o)=>{const f=v("el-option"),s=v("el-select"),d=v("el-button"),A=v("el-drawer"),E=v("el-dialog");return _(),h(N,null,[i(A,{"model-value":y.visible,title:"试运行报告",size:840,onClose:o[2]||(o[2]=l=>b("close"))},{footer:a(()=>[w("div",F,[i(d,{type:"primary",icon:"Download",onClick:n},{default:a(()=>[V("下载")]),_:1}),i(d,{onClick:o[1]||(o[1]=l=>b("close"))},{default:a(()=>[V("关闭")]),_:1})])]),default:a(()=>[i(s,{modelValue:p.value,"onUpdate:modelValue":o[0]||(o[0]=l=>p.value=l),class:"mb-16"},{default:a(()=>[(_(!0),h(N,null,U(e.data,(l,g)=>(_(),j(f,{key:g,label:l.applicationName,value:l.applicationCode},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),w("iframe",{src:c.value,style:{width:"100%",height:"800px"}},null,8,D)]),_:1},8,["model-value"]),i(E,{modelValue:u.value,"onUpdate:modelValue":o[5]||(o[5]=l=>u.value=l),width:"580px",title:"下载报告"},{footer:a(()=>[w("span",q,[i(d,{onClick:o[4]||(o[4]=l=>u.value=!1)},{default:a(()=>[V("取消")]),_:1}),i(d,{type:"primary",onClick:m},{default:a(()=>[V(" 确认 ")]),_:1})])]),default:a(()=>[w("div",I,[O,i(s,{modelValue:r.value,"onUpdate:modelValue":o[3]||(o[3]=l=>r.value=l),"value-key":"projectId",class:"w-full",placeholder:"请选择应用",filterable:"",multiple:""},{default:a(()=>[(_(!0),h(N,null,U(e.data,(l,g)=>(_(),j(f,{key:g,label:l.applicationName,value:l.applicationCode},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])])]),_:1},8,["modelValue"])],64)}}});export{T as _};
