import{c as e,r as s,o as a,q as r,v as t,x as l,e as i,B as p,y as o,N as n,D as d,R as c,bZ as _,ab as u,a9 as m}from"./base-lib.js?v=1761009159";import{k as g}from"./utils-lib.js?v=1761009159";import{t as h}from"./useController3.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./validator.js?v=1761009159";import"./index106.js?v=1761009159";import"./column.js?v=1761009159";const f={class:"p-2rem"},v=e({__name:"index",props:{compData:{default:()=>({})}},setup(e,{expose:v}){const b=e,y=s(),j=s(!1),x=s(),k=a({run_script_id:"",script:"",args:""}),C=a({is_args:"",args_holder:"",args_title:""}),V={label:"name",value:"script_id",children:"script_list"},w=a({run_script_id:[{required:!0,message:"请选择脚本",trigger:"change"}],args:[{required:!0,message:"请输入值",trigger:"blur"}]}),A=s(""),D=s([]),q=e=>{let s=x.value.getCheckedNodes()[0].data;k.script=s.script,1===s.is_args?(C.is_args=!0,C.args_holder=s.args_ps,C.args_title=s.args_title):C.is_args=!1};return r(async()=>{try{const e=await h();if("python"===b.compData.type){const s=[];Array.isArray(e)&&e.forEach(e=>{"自定义"===e.name&&e.script_list.length>0?s.push({script_id:e.script_id,name:e.name,script_list:e.script_list.filter(e=>"python"===e.script_type)}):"服务管理"!==e.name&&e.script_list.length>0&&s.push(e)}),D.value=s.reverse()}else D.value=Array.isArray(e)?e.filter(e=>"服务管理"==e.name):[]}catch(e){}}),v({onConfirm:async e=>{await y.value.validate(),A.value=""!==A.value?A.value+"\n"+k.script:k.script,-1!==k.script.indexOf("php_version")&&(A.value=A.value.replace("${1/./}",k.args)),b.compData.onConfirm({scriptText:A.value,args:k.args}),e()}}),(e,s)=>{const a=_,r=u,h=g,v=m;return t(),l("div",f,[i(v,{ref_key:"taskEvent",ref:y,disabled:o(j),"label-width":"80px",model:o(k),rules:o(w),onSubmit:s[2]||(s[2]=c(()=>{},["prevent"]))},{default:p(()=>[i(r,{label:"选择脚本",prop:"run_script_id"},{default:p(()=>[i(a,{"show-all-levels":!1,onChange:q,modelValue:o(k).run_script_id,"onUpdate:modelValue":s[0]||(s[0]=e=>o(k).run_script_id=e),ref_key:"scriptCascader",ref:x,props:V,options:o(D),placeholder:"请选择脚本,支持搜索",filterable:""},null,8,["modelValue","options"])]),_:1}),o(C).is_args?(t(),n(r,{key:0,label:o(C).args_title,prop:"args"},{default:p(()=>[i(h,{placeholder:o(C).args_holder,modelValue:o(k).args,"onUpdate:modelValue":s[1]||(s[1]=e=>o(k).args=e),width:"17rem"},null,8,["placeholder","modelValue"])]),_:1},8,["label"])):d("",!0)]),_:1},8,["disabled","model","rules"])])}}});export{v as default};
