import{c as e,s as a,g as s,w as t,q as l,v as r,x as m,e as i,B as o,y as d,Q as n,N as u,C as p,D as c,z as g,A as f,T as x,ab as _,ai as y,ah as b,a9 as v}from"./base-lib.js?v=1761009159";import{_ as V}from"./validator.js?v=1761009159";import{k,ax as j,_ as w}from"./utils-lib.js?v=1761009159";import{a as U}from"./index48.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index106.js?v=1761009159";import"./column.js?v=1761009159";import"./index112.js?v=1761009159";import"./index107.js?v=1761009159";import"./store3.js?v=1761009159";import"./store4.js?v=1761009159";import"./config.js?v=1761009159";import"./store5.js?v=1761009159";import"./hooks.js?v=1761009159";const h={class:"px-[2rem] py-[4rem] give-dialog"},D={class:"flex items-center"},O={key:0,class:"text-tertiary"},R={key:1,class:"text-tertiary"},C={key:0,class:"text-[#999] ml-1.6rem text-[1.2rem]"},q={key:1,class:"text-[#999] ml-1.6rem text-[1.2rem]"},F={key:2,class:"text-[#999] ml-1.6rem text-[1.2rem]"},I={class:"flex items-center"},A=w(e({__name:"alarm-config",setup(e){const w=U(),{giveFormDisabled:A,giveFormRef:B,msgForm:P,maxCapacityAndUsageRate:T,options:$,nextOptions:z,rowData:G}=a(w),{type:H,data:N,id:Q}=G.value,E={num:[{required:!0,message:"请输入发送次数",trigger:"blur"},{pattern:/^[0-9]\d*$/,message:"请输入正整数",trigger:"blur"}],usageRate:[{required:!0,message:"请输入告警阈值",trigger:"blur"},{pattern:/^[0-9]\d*$/,message:"请输入正整数",trigger:"blur"}],give:[{required:!0,message:"请至少选择一个告警方式",trigger:"change"}]},J=s(()=>{switch(H){case"load":return"【负载状态】告警";case"cpu":return"【CPU使用率】告警";case"mem":return"【内存使用率】告警"}if(-1!==H.indexOf("disk"))return"磁盘【".concat(H.split("-")[1],"】告警")}),K=s(()=>{switch(H){case"load":return"负载状态";case"cpu":case"mem":return"使用率"}if(-1!==H.indexOf("disk"))return 2===N.cycle||"2"===P.value.typeDetection?"占用率":"剩余容量"}),L=s(()=>"2"===P.value.typeDetection?"%":"GB");return t(()=>G.value,()=>{w.alarmInfo()}),l(async()=>{w.alarmInfo()}),(e,a)=>{const s=x,t=_,l=y,U=b,$=k,G=j,N=V,Q=v;return r(),m("div",h,[i(Q,{model:d(P),rules:E,ref_key:"giveFormRef",ref:B,disabled:d(A)},{default:o(()=>[i(t,{label:"任务类型"},{default:o(()=>[i(s,{class:"!w-[30rem]",modelValue:d(J),"onUpdate:modelValue":a[0]||(a[0]=e=>n(J)?J.value=e:null),readonly:!0,disabled:""},null,8,["modelValue"])]),_:1}),-1!==d(H).indexOf("disk")?(r(),u(t,{key:0,label:"检测类型"},{default:o(()=>[i(U,{modelValue:d(P).typeDetection,"onUpdate:modelValue":a[1]||(a[1]=e=>d(P).typeDetection=e),onChange:d(w).switchTypeDetection},{default:o(()=>[i(l,{label:"2"},{default:o(()=>a[6]||(a[6]=[p("占用百分比",-1)])),_:1,__:[6]}),i(l,{label:"1"},{default:o(()=>a[7]||(a[7]=[p("剩余容量",-1)])),_:1,__:[7]})]),_:1},8,["modelValue","onChange"])]),_:1})):c("",!0),i(t,{label:d(K),prop:"usageRate"},{default:o(()=>[g("div",D,[i($,{class:"!w-[12rem]",modelValue:d(P).usageRate,"onUpdate:modelValue":a[2]||(a[2]=e=>d(P).usageRate=e),min:0,max:d(T),type:"number"},{append:o(()=>[-1!==d(H).indexOf("disk")?(r(),m("span",O,f(d(L)),1)):(r(),m("span",R,"%"))]),_:1},8,["modelValue","max"]),d(H).indexOf("cpu")>-1?(r(),m("span",C," 每5分钟平均CPU超过该数值就告警 ")):-1===d(H).indexOf("disk")?(r(),m("span",q," 每5分钟平均负载超过该数值就告警 ")):(r(),m("span",F," 每隔10分钟磁盘占用超过该数值就告警 "))])]),_:1},8,["label"]),i(t,{label:"发送次数",prop:"num"},{default:o(()=>[g("div",I,[i($,{class:"!w-[12rem]",modelValue:d(P).num,"onUpdate:modelValue":a[3]||(a[3]=e=>d(P).num=e),min:0,type:"number"},{append:o(()=>a[8]||(a[8]=[g("span",{class:"text-tertiary"},"次",-1)])),_:1},8,["modelValue"]),a[9]||(a[9]=g("span",{class:"text-tertiary ml-1.6rem text-small"}," 后将不再发送告警信息，如需发送多次请填写2次以上 ",-1))])]),_:1}),-1===d(H).indexOf("disk")?(r(),u(t,{key:1,label:"告警后执行",prop:"next_data"},{default:o(()=>[i(G,{modelValue:d(P).next_data,"onUpdate:modelValue":a[4]||(a[4]=e=>d(P).next_data=e),options:d(z),class:"!w-[30rem]",multiple:""},null,8,["modelValue","options"])]),_:1})):c("",!0),i(t,{label:"告警方式",prop:"give"},{default:o(()=>[i(N,{class:"!w-[30rem]",modelValue:d(P).give,"onUpdate:modelValue":a[5]||(a[5]=e=>d(P).give=e)},null,8,["modelValue"])]),_:1})]),_:1},8,["model","disabled"]),a[10]||(a[10]=g("div",{class:"tip"},[g("ul",null,[g("li",null,"【发送次数】设置0时，每天触发告警次数没有上限")])],-1))])}}}),[["__scopeId","data-v-e9138fa7"]]);export{A as default};
