import{aP as a,K as e,P as s,h9 as r,ha as t,hb as l,_ as m}from"./utils-lib.js?v=1761009159";import{c as o,g as i,aD as c,V as u,q as d,v as p,x as n,e as v,y as f}from"./base-lib.js?v=1761009159";import{d as _,j as g,F as k,b,c as h}from"./form-item.js?v=1761009159";import{k as j}from"./useMethods.js?v=1761009159";const y={class:"flex flex-col lib-box"},x=m(o({__name:"add-compose",props:{compData:{default:()=>({})}},emits:["close"],setup(m,{expose:o,emit:x}){const D=m,q=x,{refs:{orchestrationData:w}}=a(),{BtForm:C,submit:A,param:F}=e({data:()=>({template_id:"",project_name:"",remark:""}),options:a=>i(()=>[_([g("容器编排模板","template_id",N.value,{attrs:{class:"!w-[30rem]",placeholder:"请选择编排模板",onChange:e=>J(e,a)},rules:[{required:!0,message:"请选择编排模板",trigger:"change"}]}),k(()=>c("span",{class:"cursor-pointer text-primary h-[3.2rem] leading-[3.2rem] ml-[1.5rem] inline-block",onClick:async()=>{j(O)}},"创建"),{key:"create",rules:{}})]),b("名称","project_name",{attrs:{class:"!w-[30rem]",placeholder:"请输入容器编排名称"},rules:[{required:!0,message:"请输入容器编排名称",trigger:"blur"}]}),h("备注","remark",{attrs:{class:"!w-[30rem]",placeholder:"请输入备注"}})]),submit:async(a,e,l)=>{await e();const m={template_id:a.value.template_id,project_name:a.value.project_name,remark:a.value.remark,...D.compData.id?{project_id:D.compData.id}:{}};s({request:D.compData.isEdit?r({data:JSON.stringify(m)}):t({data:JSON.stringify(m)}),loading:"提交中...",message:!0,success:a=>{a.status&&(q("close"),w.value.refreshList="force")}})}}),J=(a,e)=>{var s;e.value.remark=null==(s=N.value.find(e=>e.value===a))?void 0:s.remark},N=u([]),O=async()=>{s({request:l(),data:Array,success:a=>{var e,s;N.value=a.map(a=>({value:a.id,label:a.name,remark:a.remark})),F.value.template_id=(null==(e=N.value[0])?void 0:e.value)||"",F.value.remark=(null==(s=N.value[0])?void 0:s.remark)||""}})};return d(()=>{O()}),o({onConfirm:A}),(a,e)=>(p(),n("div",y,[v(f(C),{"label-width":"90px"})]))}}),[["__scopeId","data-v-cd0e41d7"]]);export{x as A};
