import{M as h,ax as V,W as z}from"./index.17037962789732.js";import"./index.170379627897337.js";import"./index.170379627897315.js";import"./index.1703796278973300.js";import"./index.170379627897317.js";import"./index.1703796278973301.js";import"./index.1703796278973302.js";import"./index.170379627897332.js";import"./index.1703796278973303.js";import"./index.170379627897339.js";import"./index.170379627897316.js";import"./index.170379627897314.js";import"./index.1703796278973304.js";import"./index.1703796278973305.js";import"./index.1703796278973306.js";import{_ as A}from"./index.170379627897313.js";import{e as D}from"./scene.17037962789732.js";import{b as E}from"./configuration.1703796278973.js";import{a as r}from"./comm.1703796278973.js";import{d as K,k as T,r as b,o as j,c as L,a as o,b as p,z as c,u as n,t as O,A as u}from"./vue.1703796278973.js";import{_ as W}from"./_plugin-vue_export-helper.1703796278973.js";import"./index.17037962789733.js";import"./dayjs.min.1703796278973.js";import"./isArray.1703796278973.js";import"./editor.api.1703796278973.js";import"./preload-helper.1703796278973.js";import"./monaco.contribution.1703796278973.js";import"./index.170379627897335.js";import"./index.vue_vue_type_script_setup_true_lang.17037962789733.js";import"./index.170379627897333.js";import"./system.1703796278973.js";import"./index.170379627897334.js";import"./default.1703796278973.js";import"./permission.1703796278973.js";import"./consts.1703796278973.js";import"./404.1703796278973.js";const $={style:{height:"500px","overflow-y":"auto"}},F=["src"],G=["src"],H={style:{"font-size":"16px","font-weight":"600"}},Q={class:"subTitle"},U=K({__name:"index",props:{id:{type:String},type:{type:String}},emits:["closeSave","saveScene"],setup(S,{emit:g}){const m=S,C=[{title:"名称",dataIndex:"name",key:"name",search:{type:"string"}},{title:"触发方式",dataIndex:"triggerType",key:"triggerType",search:{type:"select",options:[{label:"手动触发",value:"manual"},{label:"定时触发",value:"timer"},{label:"设备触发",value:"device"}]}},{title:"状态",dataIndex:"state",key:"state",search:{type:"select",options:[{label:"正常",value:"started"},{label:"禁用",value:"disable"}]}}],w=[{terms:[{column:"id",termType:"alarm-bind-rule$not",value:m.id,type:"and"},{column:"triggerType",termType:"eq",value:m.type==="other"?void 0:"device"}],type:"and"}],_=T(),s=new Map;s.set("manual",{text:"手动触发",img:r("/scene/scene-hand.png"),icon:r("/scene/trigger-type-icon/manual.png"),tip:"适用于第三方平台向物联网平台下发指令控制设备"}),s.set("timer",{text:"定时触发",img:r("/scene/scene-timer.png"),icon:r("/scene/trigger-type-icon/timing.png"),tip:"适用于定期执行固定任务"}),s.set("device",{text:"设备触发",img:r("/scene/scene-device.png"),icon:r("/scene/trigger-type-icon/device.png"),tip:"适用于设备数据或行为满足触发条件时，执行指定的动作"});const t=T([]),k=a=>{if(t.value.includes(a.id)){const d=t.value.findIndex(l=>l===a.id);t.value.splice(d,1)}else t.value=[...t.value,a.id];console.log(t.value)},I=()=>{t.value=[]},M=a=>{_.value=a},q=async()=>{if(t.value.length>0){const a=t.value.map(l=>({alarmId:m.id,ruleId:l}));(await E([...a])).status===200&&(h.success("操作成功"),g("saveScene"))}else h.error("请选择至少一条数据")},B=()=>{g("closeSave")};return(a,d)=>{const l=b("pro-search"),v=b("Ellipsis"),N=A,J=V,R=z;return j(),L(R,{visible:"",title:"新增",okText:"确定",cancelText:"取消",width:1e3,onCancel:B,onOk:q},{default:o(()=>[p(l,{columns:C,onSearch:M}),c("div",$,[p(J,{model:"CARD",request:n(D),rowSelection:{selectedRowKeys:n(t)},onCancelSelect:I,gridColumns:[1,1,1],defaultParams:{sorts:[{name:"createTime",order:"desc"}],terms:w},params:n(_)},{card:o(e=>{var y,x;return[p(N,{value:e,status:(y=e.state)==null?void 0:y.value,statusText:(x=e.state)==null?void 0:x.text,active:n(t).includes(e.id),onClick:k,statusNames:{started:"processing",disable:"error"}},{type:o(()=>{var i,f;return[c("span",null,[c("img",{height:16,src:(i=n(s).get(e.triggerType))==null?void 0:i.icon,style:{"margin-right":"5px"}},null,8,F),O(u((f=n(s).get(e.triggerType))==null?void 0:f.text),1)])]}),img:o(()=>{var i;return[c("img",{src:(i=n(s).get(e.triggerType))==null?void 0:i.img},null,8,G)]}),content:o(()=>[p(v,{style:{width:"calc(100% - 100px)"}},{default:o(()=>[c("span",H,u(e.name),1)]),_:2},1024),p(v,{lineClamp:2},{default:o(()=>{var i;return[c("div",Q," 说明："+u((e==null?void 0:e.description)||((i=n(s).get(e.triggerType))==null?void 0:i.tip)),1)]}),_:2},1024)]),_:2},1032,["value","status","statusText","active"])]}),_:1},8,["request","rowSelection","defaultParams","params"])])]),_:1})}}});const Je=W(U,[["__scopeId","data-v-97c9aefd"]]);export{Je as default};
