var c=(l,m,o)=>new Promise((g,d)=>{var y=s=>{try{u(o.next(s))}catch(i){d(i)}},h=s=>{try{u(o.throw(s))}catch(i){d(i)}},u=s=>s.done?g(s.value):Promise.resolve(s.value).then(y,h);u((o=o.apply(l,m)).next())});import{u as N,a as U,b as V,_ as F}from"./useCrudSchemas-BcUSI-wT.js";import{e as p,c as M}from"./index-OziN21LA.js";import{h as B,i as O}from"./index-Cl3s0rC0.js";import{u as K}from"./useEventBus-yN5ROQx3.js";import{l as q,aB as I,r as C,Z,U as r,F as E,u as a,m as G,M as H,O as _,q as J,S as z,B as A,y as Q}from"./vue-chunks-l-AyUCfi.js";import{n as f,f as W}from"./element-plus-C2aeItNs.js";import"./tsxHelper-BLTo71S4.js";import"./tree-Dgaev6Pi.js";const X={class:"mb-10px"};function S(l){return typeof l=="function"||Object.prototype.toString.call(l)==="[object Object]"&&!Q(l)}const de=q({__name:"index",setup(l){const{push:m}=I(),o=C([]),{tableRegister:g,tableState:d,tableMethods:y}=N({fetchDataApi:()=>c(this,null,function*(){const{currentPage:e,pageSize:t}=d,n=yield O({current:a(e),pageSize:a(t)});return{list:n.list,total:n.count}}),fetchDelApi:()=>c(this,null,function*(){return!!(yield B(a(o)))})}),{loading:h,dataList:u,total:s,currentPage:i,pageSize:w}=d,{getList:x,getElTableExpose:D,delList:Y}=y,{t:b}=M(),R={all:"群与好友",room:"群",friend:"好友"},L={sweetword:"土味情话",news:"分类新闻",cname:"网络取名",rubbish:"垃圾分类",mingyan:"名人名言",star:"星座运势",xing:"姓氏起源",lunar:"老黄历查询",goldreply:"神回复",rkl:"绕口令",skl:"顺口溜",emo:"获取表情包",meinv:"获取美女图",reloadFriend:"重新同步好友及群信息",updateConfig:"更新配置文件"},P=Z([{field:"selection",search:{hidden:!0},form:{hidden:!0},detail:{hidden:!0},table:{type:"selection"}},{field:"keywords",label:"关键词",search:{hidden:!0},formatter:e=>r(E,null,[e.keywords.map(t=>r(f,{class:"mr-2",type:"primary"},S(t)?t:{default:()=>[t]}))])},{field:"reg",label:"匹配规则",width:150,search:{hidden:!0},formatter:e=>r(f,{type:"primary"},{default:()=>[e.reg==1?"模糊匹配":"精确匹配"]})},{field:"scope",label:"触发范围",search:{hidden:!0},formatter:e=>r(f,{type:"primary"},{default:()=>[R[e.scope]]}),width:150},{field:"needAt",label:"群中@触发",search:{hidden:!0},formatter:e=>r(f,{type:"primary"},{default:()=>[e.needAt==1?"是":"否"]}),width:150},{field:"event",label:"触发事件",search:{hidden:!0},formatter:e=>r("div",null,[L[e.event]])},{field:"action",width:"260px",label:b("tableDemo.action"),search:{hidden:!0},form:{hidden:!0},detail:{hidden:!0},table:{slots:{default:e=>{let t,n;return r(E,null,[r(p,{type:"primary",onClick:()=>j(e.row,"edit")},S(t=b("exampleDemo.edit"))?t:{default:()=>[t]}),r(p,{type:"danger",onClick:()=>k(e.row)},S(n=b("exampleDemo.del"))?n:{default:()=>[n]})])}}}}]),{allSchemas:T}=U(P),$=()=>{m("/wechat/keywordsEvent/add")},v=C(!1),k=e=>c(this,null,function*(){const t=yield D();o.value=e?[e.id]:(t==null?void 0:t.getSelectionRows().map(n=>n.id))||[],v.value=!0;try{yield W.confirm("确定删除?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}),yield B(a(o).join(",")).finally(()=>{v.value=!1,x()})}catch(n){}}),j=(e,t)=>c(this,null,function*(){t=="edit"&&m(`/wechat/keywordsEvent/edit/${e.id}`)});return K({name:"getList",callback:e=>{e==="add"&&(i.value=1),x()}}),(e,t)=>(G(),H(a(F),{title:`技能中心
`,message:`当好友发送或群中@机器人 预设关键词时，会自动触发对应技能，部分关键词只可在群里触发，例如群合影
`},{default:_(()=>[J("div",X,[r(a(p),{type:"primary",onClick:$},{default:_(()=>[z("新增")]),_:1}),r(a(p),{loading:v.value,type:"danger",onClick:t[0]||(t[0]=n=>k(null))},{default:_(()=>[z(" 删除 ")]),_:1},8,["loading"])]),r(a(V),{pageSize:a(w),"onUpdate:pageSize":t[1]||(t[1]=n=>A(w)?w.value=n:null),currentPage:a(i),"onUpdate:currentPage":t[2]||(t[2]=n=>A(i)?i.value=n:null),columns:a(T).tableColumns,data:a(u),loading:a(h),pagination:{total:a(s)},"image-preview":["thumbUrl"],onRegister:a(g)},null,8,["pageSize","currentPage","columns","data","loading","pagination","onRegister"])]),_:1}))}});export{de as default};
