var _=(f,d,e)=>new Promise((b,l)=>{var p=t=>{try{i(e.next(t))}catch(n){l(n)}},v=t=>{try{i(e.throw(t))}catch(n){l(n)}},i=t=>t.done?b(t.value):Promise.resolve(t.value).then(p,v);i((e=e.apply(f,d)).next())});import{e as $,f as j,g as N}from"./index-dfcd01ad.js";import{u as O}from"./useCurrentInstance-cd4729ef.js";import{d as q,r as I,K as D,j as r,o as g,h as k,w as u,b as F,e as m,k as w,c as L,F as R,v as K}from"./index-90c78f99.js";const T={class:"dialog-footer"},E=q({__name:"bind-sl-dialog",props:{visible:{type:Boolean,default:!1,required:!0},data:Object},emits:["close"],setup(f,{emit:d}){const e=f,{proxy:b}=O(),l=I({cpuInstances:[]}),p=I(!1),v=I(),i=n=>_(this,null,function*(){n&&(yield n.validate(a=>_(this,null,function*(){if(a)try{p.value=!0;const o={appId:e.data&&e.data.appId,cpuInstances:l.value.cpuInstances.map(c=>({appId:e.data&&e.data.appId,cpuInstanceId:c.id,cpuInstanceName:c.project}))};console.log(o),yield N(o),b.$message.success("修改成功！"),d("close",!0),p.value=!1}catch(o){p.value=!1}})))}),t=I();return D(()=>e.visible,n=>_(this,null,function*(){if(n){const a=yield $();t.value=a.data;const o=yield j(e.data&&e.data.appId);l.value={cpuInstances:o&&o.data.length?o.data.map(c=>({id:c.cpuInstanceId,project:c.cpuInstanceName})):[]}}})),(n,a)=>{const o=r("el-option"),c=r("el-select"),C=r("el-form-item"),x=r("el-form"),y=r("el-button"),B=r("el-dialog");return g(),k(B,{"model-value":f.visible,"destroy-on-close":"",width:"580px",title:"关联实例id",onClose:a[3]||(a[3]=s=>d("close"))},{footer:u(()=>[F("span",T,[m(y,{onClick:a[1]||(a[1]=s=>d("close"))},{default:u(()=>[w("取消")]),_:1}),m(y,{type:"primary",loading:p.value,onClick:a[2]||(a[2]=s=>i(v.value))},{default:u(()=>[w(" 确认 ")]),_:1},8,["loading"])])]),default:u(()=>[m(x,{ref_key:"formRef",ref:v,model:l.value,"label-suffix":":"},{default:u(()=>[m(C,{label:"关联实例id",prop:"cpuInstances",rules:[{required:!0,message:"请选择"}]},{default:u(()=>[m(c,{modelValue:l.value.cpuInstances,"onUpdate:modelValue":a[0]||(a[0]=s=>l.value.cpuInstances=s),class:"w-full",multiple:"",filterable:"","value-key":"id"},{default:u(()=>[(g(!0),L(R,null,K(t.value,(s,V)=>(g(),k(o,{key:V,value:s,label:`${s.id}-${s.project}`},null,8,["value","label"]))),128))]),_:1},8,["modelValue"])]),_:1})]),_:1},8,["model"])]),_:1},8,["model-value"])}}});export{E as _};
