var F=Object.defineProperty;var x=Object.getOwnPropertySymbols;var L=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable;var C=(o,t,a)=>t in o?F(o,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):o[t]=a,y=(o,t)=>{for(var a in t||(t={}))L.call(t,a)&&C(o,a,t[a]);if(x)for(var a of x(t))U.call(t,a)&&C(o,a,t[a]);return o};var m=(o,t,a)=>new Promise((w,b)=>{var _=l=>{try{s(a.next(l))}catch(c){b(c)}},f=l=>{try{s(a.throw(l))}catch(c){b(c)}},s=l=>l.done?w(l.value):Promise.resolve(l.value).then(_,f);s((a=a.apply(o,t)).next())});import{_ as G,l as P,d as j,u as z}from"./rule-dialog.vue_vue_type_script_name_ruleDialog_setup_true_lang-822699ec.js";import{d as q,s as A,m as H,r as v,G as I,M as J,a as K,j as i,o as h,c as D,e as r,w as p,b as k,F as V,v as Q,f as W,h as X,k as Y,$ as Z,E as S}from"./index-90c78f99.js";const aa={class:"relative"},ea=["onClick"],ta=["onClick"],na=q({__name:"index",setup(o){const{appStatusOptions:t}=A(H.dictStore).globalDicts.value,a=v({applicationStatus:1}),w=[{type:"index",label:"序号",width:80},{label:"规则名称",prop:"ruleName",key:"ruleName"},{label:"状态",prop:"enabled",key:"enabled",slot:"enabled"},{label:"创建时间",prop:"createOn",key:"createOn"},{label:"操作",slot:"action",key:"action",width:120,fixed:"right"}],b=v(),_=v(),f=v(),s=(...d)=>m(this,[...d],function*(n=f.value.pageParams){const u=yield P(y(y({},n),a.value));b.value=u.data&&u.data.records||[],_.value=u.data&&u.data.total||0}),l=I(new J(s)),c=n=>{l.data=n,l.visible=!0},N=n=>{Z.confirm("确认删除该规则吗?","提示！",{type:"warning"}).then(()=>m(this,null,function*(){yield j({id:n.id}),yield s(),S.success("删除成功！")}))},B=n=>m(this,null,function*(){yield z({id:n.id,enabled:!n.enabled}),yield s(),S.success("更新成功！")});return K(()=>m(this,null,function*(){yield s()})),(n,d)=>{const u=i("page-title"),T=i("el-tab-pane"),$=i("el-tabs"),E=i("el-button"),M=i("el-switch"),O=i("table-list"),R=i("el-card");return h(),D(V,null,[r(u),r(R,{class:"my-card tab-card",shadow:"never"},{header:p(()=>[k("div",aa,[r($,{modelValue:a.value.applicationStatus,"onUpdate:modelValue":d[0]||(d[0]=e=>a.value.applicationStatus=e),onTabChange:d[1]||(d[1]=e=>s({pageNumber:1,pageSize:10}))},{default:p(()=>[(h(!0),D(V,null,Q(W(t),e=>(h(),X(T,{key:e.value,label:e.desc,name:Number(e.value)},null,8,["label","name"]))),128))]),_:1},8,["modelValue"]),r(E,{class:"absolute top-[50%] right-[0px] translate-y-[-50%]",icon:"Plus",type:"primary",plain:"",onClick:c},{default:p(()=>[Y("添加预警规则")]),_:1})])]),default:p(()=>[r(O,{ref_key:"tableListRef",ref:f,column:w,data:b.value,total:_.value,onGetTableData:s},{enabled:p(({scope:e})=>[r(M,{modelValue:e.row.enabled,"onUpdate:modelValue":g=>e.row.enabled=g,"before-change":()=>B(e.row),style:{"--el-switch-on-color":"#13ce66","--el-switch-off-color":"#ff4949"}},null,8,["modelValue","onUpdate:modelValue","before-change"])]),action:p(({scope:e})=>[k("a",{class:"btn text-primary mr-24",onClick:g=>c(e.row)}," 编辑 ",8,ea),k("a",{class:"btn text-danger",onClick:g=>N(e.row)}," 删除 ",8,ta)]),_:1},8,["data","total"])]),_:1}),r(G,{data:l.data||{},visible:l.visible,"application-status":a.value.applicationStatus,onClose:d[2]||(d[2]=e=>l.close(e))},null,8,["data","visible","application-status"])],64)}}});export{na as default};
