var u=(s,m,i)=>new Promise((g,d)=>{var h=n=>{try{c(i.next(n))}catch(o){d(o)}},y=n=>{try{c(i.throw(n))}catch(o){d(o)}},c=n=>n.done?g(n.value):Promise.resolve(n.value).then(h,y);c((i=i.apply(s,m)).next())});import{u as j,a as N,b as O,_ as U}from"./useCrudSchemas-BcUSI-wT.js";import{e as f,c as V}from"./index-OziN21LA.js";import{u as M}from"./useEventBus-yN5ROQx3.js";import{l as F,aB as q,r as B,Z as I,U as l,F as C,u as a,m as Z,M as G,O as _,q as H,S as E,B as z,y as J}from"./vue-chunks-l-AyUCfi.js";import{o as A,p as K}from"./index-DfIQY6vp.js";import{n as p,f as Q}from"./element-plus-C2aeItNs.js";import"./tsxHelper-BLTo71S4.js";import"./tree-Dgaev6Pi.js";const W={class:"mb-10px"};function S(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!J(s)}const se=F({__name:"index",setup(s){const{push:m}=q(),i=B([]),{tableRegister:g,tableState:d,tableMethods:h}=j({fetchDataApi:()=>u(this,null,function*(){const{currentPage:e,pageSize:t}=d,r=yield K({current:a(e),pageSize:a(t)});return{list:r.list,total:r.count}}),fetchDelApi:()=>u(this,null,function*(){return!!(yield A(a(i)))})}),{loading:y,dataList:c,total:n,currentPage:o,pageSize:b}=d,{getList:k,getElTableExpose:D,delList:X}=h,{t:v}=V(),R={all:"群与好友",room:"群",friend:"好友"},T=I([{field:"selection",search:{hidden:!0},form:{hidden:!0},detail:{hidden:!0},table:{type:"selection"}},{field:"keywords",label:"关键词",search:{hidden:!0},formatter:e=>l(C,null,[e.keywords.map(t=>l(p,{class:"mr-2",type:"primary"},S(t)?t:{default:()=>[t]}))])},{field:"reg",label:"匹配规则",width:150,search:{hidden:!0},formatter:e=>l(p,{type:"primary"},{default:()=>[e.reg==1?"模糊匹配":"精确匹配"]})},{field:"scope",label:"触发范围",search:{hidden:!0},formatter:e=>l(p,{type:"primary"},{default:()=>[R[e.scope]]}),width:150},{field:"needAt",label:"群中@触发",search:{hidden:!0},formatter:e=>l(p,{type:"primary"},{default:()=>[e.needAt==1?"是":"否"]}),width:150},{field:"api",label:"回调标签",search:{hidden:!0},formatter:e=>l("div",null,[e.api.label])},{field:"timeout",label:"超时时间",search:{hidden:!0},formatter:e=>l(p,{type:"primary"},{default:()=>[e.timeout]})},{field:"action",width:"260px",label:v("tableDemo.action"),search:{hidden:!0},form:{hidden:!0},detail:{hidden:!0},table:{slots:{default:e=>{let t,r;return l(C,null,[l(f,{type:"primary",onClick:()=>$(e.row,"edit")},S(t=v("exampleDemo.edit"))?t:{default:()=>[t]}),l(f,{type:"danger",onClick:()=>x(e.row)},S(r=v("exampleDemo.del"))?r:{default:()=>[r]})])}}}}]),{allSchemas:L}=N(T),P=()=>{m("/vip/callbackEvent/add")},w=B(!1),x=e=>u(this,null,function*(){const t=yield D();i.value=e?[e.id]:(t==null?void 0:t.getSelectionRows().map(r=>r.id))||[],w.value=!0;try{yield Q.confirm("确定删除?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}),yield A(a(i).join(",")).finally(()=>{w.value=!1,k()})}catch(r){}}),$=(e,t)=>u(this,null,function*(){t=="edit"&&m(`/vip/callbackEvent/edit/${e.id}`)});return M({name:"getList",callback:e=>{e==="add"&&(o.value=1),k()}}),(e,t)=>(Z(),G(a(U),{title:`回调事件
`,message:`当好友发送或群好友@机器人预设关键词时，会自动触发设置的回调接口，回调接口返回指定数据格式即可，目前支持本平台开放接口，和自定义接口地址
`},{default:_(()=>[H("div",W,[l(a(f),{type:"primary",onClick:P},{default:_(()=>[E("新增")]),_:1}),l(a(f),{loading:w.value,type:"danger",onClick:t[0]||(t[0]=r=>x(null))},{default:_(()=>[E(" 删除 ")]),_:1},8,["loading"])]),l(a(O),{pageSize:a(b),"onUpdate:pageSize":t[1]||(t[1]=r=>z(b)?b.value=r:null),currentPage:a(o),"onUpdate:currentPage":t[2]||(t[2]=r=>z(o)?o.value=r:null),columns:a(L).tableColumns,data:a(c),showOverflowTooltip:!1,loading:a(y),pagination:{total:a(n)},"image-preview":["thumbUrl"],onRegister:a(g)},null,8,["pageSize","currentPage","columns","data","loading","pagination","onRegister"])]),_:1}))}});export{se as default};
