import{j as a,b as e,r as t,s,c as l,a6 as n,v as o,x as u,z as r,C as c,e as i,y as p,N as m,B as d,G as f}from"./base-lib.js?v=1761009159";import{B as v}from"./column.js?v=1761009159";import{p as _,P as x,bL as y}from"./utils-lib.js?v=1761009159";import{w as b}from"./validator.js?v=1761009159";const E=a("SOFT-SERVICE-STATUS-STORE",()=>{const a=b(),l=e(),n=t({}),o=t(!1),u={restart:"重启",stop:"停止",reload:"重载配置",start:"启动"};return{compData:n,status:o,serviceManageEvent:async e=>{await _({title:"".concat(n.value.name,"服务"),icon:"warning-filled",content:"您确定".concat(u[e]).concat(n.value.name,"服务吗?")});let t=n.value.name;-1!=n.value.name.indexOf("php-")&&(t="php-fpm-".concat(t.split("-")[1].replace(".",""))),await x({loading:"正在设置状态，请稍后...",request:y({name:t,type:e}),message:!0,success:async t=>{var u;if(o.value="stop"!==e,-1!==l.path.indexOf("/soft")){await a.getSoftListData();const{softTableList:e}=s(a);n.value.status=null==(u=e.value.find(a=>a.name===n.value.name||"pureftpd"===a.name&&"pure-ftpd"===n.value.name))?void 0:u.status}else n.value.status="stop"!==e;n.value.refreshEvent&&n.value.refreshEvent()}})},init:a=>{a&&(n.value=a),o.value=n.value.status},$reset_compdata:()=>{n.value={}}}}),S={class:"flex flex-col text-secondary"},g={class:"mb-[12px] flex items-center"},k={class:"flex items-center"},C=l({__name:"index",setup(a){const e=E(),{compData:t}=s(e),{serviceManageEvent:l,$reset_compdata:_}=e;return n(_),(a,e)=>{const s=v,n=f;return o(),u("div",S,[r("span",g,[e[5]||(e[5]=c(" 当前状态：",-1)),i(s,{modelValue:p(t).status,"onUpdate:modelValue":e[0]||(e[0]=a=>p(t).status=a),data:["关闭","开启"]},null,8,["modelValue"])]),r("div",k,[p(t).status?(o(),m(n,{key:1,type:"default",onClick:e[2]||(e[2]=a=>p(l)("stop"))},{default:d(()=>e[7]||(e[7]=[c("停止",-1)])),_:1,__:[7]})):(o(),m(n,{key:0,type:"default",onClick:e[1]||(e[1]=a=>p(l)("start"))},{default:d(()=>e[6]||(e[6]=[c("启动",-1)])),_:1,__:[6]})),i(n,{type:"default",onClick:e[3]||(e[3]=a=>p(l)("restart"))},{default:d(()=>e[8]||(e[8]=[c("重启",-1)])),_:1,__:[8]}),i(n,{type:"default",onClick:e[4]||(e[4]=a=>p(l)("reload"))},{default:d(()=>e[9]||(e[9]=[c("重载配置",-1)])),_:1,__:[9]})])])}}});export{E as S,C as _};
