import{j as a,r as e,o as t,c as s,s as n,H as l,I as u,y as r,v as o,x as i,e as v,z as d,C as c,Q as m,an as g}from"./base-lib.js?v=1761009159";import{_}from"./index106.js?v=1761009159";import{c5 as p,n as y,Q as b,P as f,cV as h,T as S,h1 as E,cW as w,M as C}from"./utils-lib.js?v=1761009159";const k=a("SOFT-STATUS-STOP-ALERT",()=>{const a=e({}),s=e(!1),n=e(!1),l=e(),u=e(""),r=a=>{if(l.value){const{number_rule:a,task_data:e,sender:t,status:s}=l.value;Object.assign(d,{count:e.count||1,interval:e.interval||600,day_num:a.day_num,sender:t,status:s})}a.hasOwnProperty("onStatus")&&(d.status=a.onStatus),y({title:"状态停止告警设置",area:50,component:()=>b(()=>import("./config4.js?v=1761009159"),__vite__mapDeps([]),import.meta.url),btn:!0,onCancel:()=>{a.onCancel&&a.onCancel()},onConfirm:m})},o=async()=>{await f({loading:s,request:S(),data:{data:Array,status:Boolean,msg:String},success:a=>{var e;a.status&&(l.value=a.data.find(a=>a.keyword===u.value),n.value=(null==(e=l.value)?void 0:e.status)||!1)}})},i=e(),v=e(),d=t({status:!0,count:1,interval:100,day_num:3,sender:[]}),c=t({interval:[p({message:"请输入间隔时间"}),{validator:(a,e,t)=>{e<60&&!Number.isInteger(parseFloat(e))?t(new Error("间隔时间范围应为大于60的正整数")):t()},trigger:["blur","change"]}],day_num:[p({message:"请输入发送次数"}),{validator:(a,e,t)=>{e<0&&!Number.isInteger(parseFloat(e))?t(new Error("发送次数范围应为大于等于0的正整数")):t()},trigger:["blur","change"]}],sender:[p({message:"请选择告警方式"})]}),m=async e=>{var t;await i.value.validate();const s=(()=>{var a,e,t;const{status:s,count:n,interval:r,sender:o,day_num:i}=d,v={task_data:{type:"services",project:u.value,status:s,tid:"5",cycle:0,count:Number(n),interval:Number(r),title:"服务停止告警"},sender:o,number_rule:{day_num:Number(i),total:0},time_rule:{time_range:[0,86399],send_interval:0}};return{template_id:null==(a=l.value)?void 0:a.template_id,status:s?1:0,task_data:JSON.stringify(v),task_id:(null==(e=l.value)?void 0:e.id)||void 0,title:null==(t=l.value)?void 0:t.title}})();await f({loading:"正在设置状态，请稍后...",request:(null==(t=l.value)?void 0:t.template_id)?E(s):w({...s,template_id:"5"}),message:!0,success:t=>{t.status&&(g(a.value),e.unmount())}})},g=e=>{e&&(a.value=e),u.value=a.value.name,"mysqld"===a.value.name&&(u.value="mysql"),o()};return{isLoading:s,status:n,currentInfo:l,openPopupEvent:r,changeStatusEvent:async a=>{var e;a?r({onCancel:()=>{n.value=!a},onStatus:a}):await f({loading:"正在设置状态，请稍后...",request:h({status:0,task_id:null==(e=l.value)?void 0:e.id}),message:!0,success:async e=>{e.status||(n.value=!a),e.status&&(l.value.status=Boolean(n),d.status=Boolean(n))}})},alertFormRef:i,alarmRef:v,alertForm:d,rules:c,countOptions:[{label:"自动尝试重启项目",value:1},{label:"不做重启尝试",value:2}],alarmRefreshEvent:async()=>{var a;await(null==(a=v.value)?void 0:a.refresh()),C.success("刷新成功")},getPushData:o,init:g}}),P={class:"flex items-center"},j=s({__name:"index",setup(a){const e=k(),{isLoading:t,status:s,currentInfo:p}=n(e),{openPopupEvent:y,changeStatusEvent:b,getPushData:f}=e;return(a,e)=>{const n=_,p=g,f=l("bt-loading");return u((o(),i("div",null,[v(n,{direction:"horizontal"}),d("span",P,[e[2]||(e[2]=c("状态停止时提醒我： ",-1)),v(p,{modelValue:r(s),"onUpdate:modelValue":e[0]||(e[0]=a=>m(s)?s.value=a:null),class:"mx-8px",onChange:r(b)},null,8,["modelValue","onChange"]),d("span",{class:"bt-link",onClick:e[1]||(e[1]=(...a)=>r(y)&&r(y)(...a))},"告警设置")])])),[[f,r(t)]])}}});export{k as S,j as _};
function __vite__mapDeps(indexes) {
  if (!__vite__mapDeps.viteFileDeps) {
    __vite__mapDeps.viteFileDeps = []
  }
  return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}
