var c=(i,p,o)=>new Promise((h,d)=>{var b=l=>{try{u(o.next(l))}catch(s){d(s)}},w=l=>{try{u(o.throw(l))}catch(s){d(s)}},u=l=>l.done?h(l.value):Promise.resolve(l.value).then(b,w);u((o=o.apply(i,p)).next())});import{u as j,a as A,b as E,_ as O}from"./useCrudSchemas-f5-cIgli.js";import{e as f,c as U}from"./index-D4Ne4xf-.js";import{q as R,t as V}from"./index-CTMAUNGp.js";import{u as M}from"./useEventBus-BjGKlZmW.js";import{l as q,aB as F,r as z,Z as J,U as n,F as g,S as y,u as a,m as K,M as I,O as v,q as Z,B as D,y as G}from"./vue-chunks-DyZSmvoe.js";import{n as m,f as H}from"./element-plus-DNKe9-lk.js";import"./tsxHelper-DOqx_mcA.js";import"./tree-Dgaev6Pi.js";const Q={class:"mb-10px"};function k(i){return typeof i=="function"||Object.prototype.toString.call(i)==="[object Object]"&&!G(i)}const se=q({__name:"index",setup(i){const{push:p}=F(),o=z([]),{tableRegister:h,tableState:d,tableMethods:b}=j({fetchDataApi:()=>c(this,null,function*(){const{currentPage:t,pageSize:e}=d,r=yield V({current:a(t),pageSize:a(e)});return{list:r.list,total:r.count}}),fetchDelApi:()=>c(this,null,function*(){return!!(yield R(a(o)))})}),{loading:w,dataList:u,total:l,currentPage:s,pageSize:_}=d,{getList:B,getElTableExpose:N,delList:W}=b,{t:x}=U(),T=J([{field:"selection",search:{hidden:!0},form:{hidden:!0},detail:{hidden:!0},table:{type:"selection"}},{field:"roomName",label:"群名称",search:{hidden:!0},formatter:t=>n(m,{class:"mr-2",type:"primary"},{default:()=>[t.roomName]})},{field:"keywords",label:"入群暗号",search:{hidden:!0},formatter:t=>n(g,null,[t.keywords.map(e=>n(m,{class:"mr-2",type:"primary"},k(e)?e:{default:()=>[e]}))])},{field:"reg",label:"匹配规则",width:150,search:{hidden:!0},formatter:t=>n(m,{type:"primary"},{default:()=>[t.reg==1?"模糊匹配":"精确匹配"]})},{field:"replys",label:"回复内容",search:{hidden:!0},formatter:t=>n(g,null,[t.replys.map(e=>n(m,{class:"mr-2",type:"primary"},{default:()=>[e.name,y(" - "),e.tag]}))])},{field:"welcomes",label:"入群欢迎词",search:{hidden:!0},formatter:t=>n(g,null,[(t.welcomes||[]).map(e=>n(m,{class:"mr-2",type:"primary"},{default:()=>[e.name,y(" - "),e.tag]}))])},{field:"action",width:"260px",label:x("tableDemo.action"),search:{hidden:!0},form:{hidden:!0},detail:{hidden:!0},table:{slots:{default:t=>{let e,r;return n(g,null,[n(f,{type:"primary",onClick:()=>$(t.row)},k(e=x("exampleDemo.edit"))?e:{default:()=>[e]}),n(f,{type:"danger",onClick:()=>C(t.row)},k(r=x("exampleDemo.del"))?r:{default:()=>[r]})])}}}}]),{allSchemas:L}=A(T),P=()=>{p("/group/index/add")},S=z(!1),C=t=>c(this,null,function*(){const e=yield N();o.value=t?[t.id]:(e==null?void 0:e.getSelectionRows().map(r=>r.id))||[],S.value=!0;try{yield H.confirm("确定删除?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}),yield R(a(o).join(",")).finally(()=>{S.value=!1,B()})}catch(r){}}),$=(t,e)=>c(this,null,function*(){p(`/group/index/edit/${t.id}`)});return M({name:"getList",callback:t=>{t==="add"&&(s.value=1),B()}}),(t,e)=>(K(),I(a(O),{title:"关键词进群",message:`当好友发送指定入群关键词时，会自动邀请其进入指定群，并触发自动欢迎词
`},{default:v(()=>[Z("div",Q,[n(a(f),{type:"primary",onClick:P},{default:v(()=>[y("新增")]),_:1}),n(a(f),{loading:S.value,type:"danger",onClick:e[0]||(e[0]=r=>C(null))},{default:v(()=>[y(" 删除 ")]),_:1},8,["loading"])]),n(a(E),{pageSize:a(_),"onUpdate:pageSize":e[1]||(e[1]=r=>D(_)?_.value=r:null),currentPage:a(s),"onUpdate:currentPage":e[2]||(e[2]=r=>D(s)?s.value=r:null),columns:a(L).tableColumns,data:a(u),showOverflowTooltip:!1,loading:a(w),pagination:{total:a(l)},"image-preview":["thumbUrl"],onRegister:a(h)},null,8,["pageSize","currentPage","columns","data","loading","pagination","onRegister"])]),_:1}))}});export{se as default};
