import{r as L,F as O,W as U}from"./index.17037962789732.js";import"./index.170379627897337.js";import"./index.170379627897315.js";import"./index.170379627897318.js";import"./index.170379627897319.js";import{a}from"./comm.1703796278973.js";import{_ as h}from"./ActionTypeComponent.vue_vue_type_script_setup_true_lang.17037962789732.js";import{r as j}from"./utils.1703796278973.js";import B from"./CardSelect.17037962789732.js";import{d as F,k as u,v as P,m as S,o as y,c as f,a as l,b as s,u as r,y as T,B as M}from"./vue.1703796278973.js";const H=F({__name:"index",props:{branchesName:{type:Number,default:0},thenName:{type:Number,default:0},name:{type:Number,default:0},data:{type:Object,default:()=>({key:j()})},parallel:{type:Boolean},actionOptions:{type:Object,default:()=>({})}},emits:["cancel","save"],setup(c,{emit:p}){const i=c,b=[{label:"设备输出",value:"device",iconUrl:a("/scene/device-type.png"),subLabel:"配置设备调用功能、读取属性、设置属性规则"},{label:"消息通知",value:"notify",iconUrl:a("/scene/message-type.png"),subLabel:"配置向指定用户发邮件、钉钉、微信、短信等通知"},{label:"延迟执行",value:"delay",iconUrl:a("/scene/delay-type.png"),subLabel:"等待一段时间后，再执行后续动作"},{label:"触发告警",value:"trigger",iconUrl:a("/scene/trigger-type.png"),subLabel:"配置触发告警规则，需配合“告警配置”使用"},{label:"解除告警",value:"relieve",iconUrl:a("/scene/cancel-type.png"),subLabel:"配置解除告警规则，需配合“告警配置”使用"}],d=u(),n=P({type:"device"}),o=u("");S(()=>i.data,e=>{var t;e!=null&&e.executor&&(n.type=(e==null?void 0:e.executor)==="alarm"?(t=e==null?void 0:e.alarm)==null?void 0:t.mode:e==null?void 0:e.executor)},{immediate:!0,deep:!0});const _=()=>{d.value.validate().then(e=>{o.value=e==null?void 0:e.type,((e==null?void 0:e.type)==="relieve"||(e==null?void 0:e.type)==="trigger")&&p("save",{key:i.data.key,executor:"alarm",alarm:{mode:e.type}},{})})},g=()=>{p("cancel")},v=(e,t)=>{p("save",{...e,executor:e.type},t),o.value=""},k=()=>{o.value=""};return(e,t)=>{const x=L,C=O,N=U;return y(),f(N,{title:"类型",visible:"",width:860,onCancel:g,onOk:_,maskClosable:!1},{default:l(()=>[s(C,{ref_key:"actionForm",ref:d,model:r(n),layout:"vertical"},{default:l(()=>[s(x,{label:"类型",name:"type",rules:[{required:!0,message:"请选择类型"}]},{default:l(()=>[s(B,{value:r(n).type,"onUpdate:value":t[0]||(t[0]=m=>r(n).type=m),options:b.filter(m=>!(m.value==="delay"&&c.parallel))},null,8,["value","options"])]),_:1}),r(o)?(y(),f(h,T({key:0},i,{actionType:r(o),options:c.actionOptions,onSave:v,onCancel:k}),null,16,["actionType","options"])):M("",!0)]),_:1},8,["model"])]),_:1})}}});export{H as _};
