var M=Object.defineProperty;var v=Object.getOwnPropertySymbols;var T=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable;var k=(t,a,e)=>a in t?M(t,a,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[a]=e,x=(t,a)=>{for(var e in a||(a={}))T.call(a,e)&&k(t,e,a[e]);if(v)for(var e of v(a))$.call(a,e)&&k(t,e,a[e]);return t};var m=(t,a,e)=>new Promise((w,_)=>{var s=l=>{try{c(e.next(l))}catch(p){_(p)}},i=l=>{try{c(e.throw(l))}catch(p){_(p)}},c=l=>l.done?w(l.value):Promise.resolve(l.value).then(s,i);c((e=e.apply(t,a)).next())});import{_ as N,l as O,d as j,u as F}from"./template-dialog.vue_vue_type_script_name_templateDialog_setup_true_lang-2c6cd4ec.js";import{d as G,r as y,G as L,M as R,a as U,j as b,o as P,c as S,e as r,w as u,b as f,k as q,F as z,$ as A,E as C}from"./index-90c78f99.js";const H={class:"flex justify-between items-center"},I=f("span",null,"模版列表",-1),J=["onClick"],K=["onClick"],Y=G({__name:"index",setup(t){const a=[{type:"index",label:"序号",width:80},{label:"模版名称",prop:"name",key:"name"},{label:"状态",prop:"enabled",key:"enabled",slot:"enabled"},{label:"创建时间",prop:"createOn",key:"createOn"},{label:"操作",slot:"action",key:"action",width:120,fixed:"right"}],e=y(),w=y(),_=y(),s=(...g)=>m(this,[...g],function*(n=_.value.pageParams){const d=yield O(x({},n));e.value=d.data&&d.data.records||[],w.value=d.data&&d.data.total||0}),i=L(new R(s)),c=n=>{i.data=n,i.visible=!0},l=n=>{A.confirm("确认删除改模版吗?","提示！",{type:"warning"}).then(()=>m(this,null,function*(){yield j({id:n.id}),yield s(),C.success("删除成功！")}))},p=n=>m(this,null,function*(){yield F({id:n.id,enabled:!n.enabled}),yield s(),C.success("更新成功！")});return U(()=>m(this,null,function*(){yield s()})),(n,g)=>{const d=b("page-title"),D=b("el-button"),V=b("el-switch"),B=b("table-list"),E=b("el-card");return P(),S(z,null,[r(d),r(E,{class:"my-card",shadow:"never"},{header:u(()=>[f("div",H,[I,r(D,{icon:"plus",plain:"",type:"primary",onClick:c},{default:u(()=>[q(" 添加模版 ")]),_:1})])]),default:u(()=>[r(B,{ref_key:"tableListRef",ref:_,column:a,data:e.value,total:w.value,onGetTableData:s},{enabled:u(({scope:o})=>[r(V,{modelValue:o.row.enabled,"onUpdate:modelValue":h=>o.row.enabled=h,"before-change":()=>p(o.row),style:{"--el-switch-on-color":"#13ce66","--el-switch-off-color":"#ff4949"}},null,8,["modelValue","onUpdate:modelValue","before-change"])]),action:u(({scope:o})=>[f("a",{class:"btn text-primary mr-24",onClick:h=>c(o.row)}," 编辑 ",8,J),f("a",{class:"btn text-danger",onClick:h=>l(o.row)}," 删除 ",8,K)]),_:1},8,["data","total"])]),_:1}),r(N,{data:i.data||{},visible:i.visible,onClose:g[0]||(g[0]=o=>i.close(o))},null,8,["data","visible"])],64)}}});export{Y as default};
