var Q=Object.defineProperty,W=Object.defineProperties;var X=Object.getOwnPropertyDescriptors;var A=Object.getOwnPropertySymbols;var Y=Object.prototype.hasOwnProperty,ee=Object.prototype.propertyIsEnumerable;var E=(s,o,r)=>o in s?Q(s,o,{enumerable:!0,configurable:!0,writable:!0,value:r}):s[o]=r,S=(s,o)=>{for(var r in o||(o={}))Y.call(o,r)&&E(s,r,o[r]);if(A)for(var r of A(o))ee.call(o,r)&&E(s,r,o[r]);return s},F=(s,o)=>W(s,X(o));var v=(s,o,r)=>new Promise((w,_)=>{var L=i=>{try{y(r.next(i))}catch(c){_(c)}},T=i=>{try{y(r.throw(i))}catch(c){_(c)}},y=i=>i.done?w(i.value):Promise.resolve(i.value).then(L,T);y((r=r.apply(s,o)).next())});import{u as ae,a as te,b as le,_ as oe}from"./useCrudSchemas-BcUSI-wT.js";import{_ as re}from"./Dialog.vue_vue_type_style_index_0_lang-DTUY8bxL.js";import{e as g,c as se}from"./index-OziN21LA.js";import{_ as ne}from"./Write.vue_vue_type_script_setup_true_lang-BQlcDUmd.js";import{c as ie,e as ue,f as de,h as ce,i as me}from"./index-DfIQY6vp.js";import{u as fe}from"./useClipboard-ClCMqGRJ.js";import{n as k,f as pe,o as ve}from"./element-plus-C2aeItNs.js";import{l as ge,r as u,Z as ye,U as n,F as D,u as t,n as he,m as $,p as we,O as f,q as _e,S as C,T as P,B as O,M as U,R as M,y as be}from"./vue-chunks-l-AyUCfi.js";import"./tsxHelper-BLTo71S4.js";import"./tree-Dgaev6Pi.js";import"./useForm-DFfbRY9m.js";import"./wang-editor-D6T5hJzu.js";import"./useValidator-dY8qp_qX.js";import"./selectFriend.vue_vue_type_script_setup_true_lang-B_XN1vat.js";import"./index-Cl3s0rC0.js";import"./selectRoom.vue_vue_type_script_setup_true_lang-CqEi0UST.js";const xe={class:"mb-10px"};function q(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!be(s)}const Ue=ge({__name:"index",setup(s){fe();const o=u([]),{tableRegister:r,tableState:w,tableMethods:_}=ae({fetchDataApi:()=>v(this,null,function*(){const{currentPage:a,pageSize:e}=w,l=yield de(S({current:t(a),pageSize:t(e)},t(Z)));return{list:l.list,total:l.count}}),fetchDelApi:()=>v(this,null,function*(){})}),{loading:L,dataList:T,total:y,currentPage:i,pageSize:c}=w,{getList:z,getElTableExpose:I,delList:Se}=_,Z=u({}),{t:d}=se(),G=ye([{field:"selection",search:{hidden:!0},form:{hidden:!0},detail:{hidden:!0},table:{type:"selection"}},{field:"names",label:"指定用户",search:{hidden:!0},detail:{span:24},formatter:a=>n(k,{type:"primary"},{default:()=>{var e;return[(e=a.names)==null?void 0:e.name]}})},{field:"rooms",label:"转发到的群",search:{hidden:!1},colProps:{span:8},formatter:a=>n(D,null,[(a.rooms||[]).map(e=>n(k,{class:"mr-3",type:"primary"},{default:()=>[e==null?void 0:e.name]}))])},{field:"contacts",label:"转发到的好友",search:{hidden:!0},formatter:a=>n(D,null,[(a.contacts||[]).map(e=>n(k,{class:"mr-3",type:"primary"},{default:()=>[e==null?void 0:e.name]}))])},{field:"type",label:"转发的消息类型",search:{hidden:!0},formatter:a=>n(k,{type:"primary"},{default:()=>[a.type==1?"只转发文字":"转发所有消息"]})},{field:"action",width:"260px",label:d("tableDemo.action"),search:{hidden:!0},form:{hidden:!0},detail:{hidden:!0},table:{slots:{default:a=>{let e,l;return n(D,null,[n(g,{type:"primary",onClick:()=>J(a.row,"edit")},q(e=d("exampleDemo.edit"))?e:{default:()=>[e]}),n(g,{type:"danger",onClick:()=>j(a.row)},q(l=d("exampleDemo.del"))?l:{default:()=>[l]})])}}}}]),{allSchemas:N}=te(G),m=u(!1),b=u(""),h=u(null),p=u(""),H=()=>{b.value=d("exampleDemo.add"),h.value=null,m.value=!0,p.value=""},R=u(!1),j=a=>v(this,null,function*(){const e=yield I();o.value=a?[a.id]:(e==null?void 0:e.getSelectionRows().map(l=>l.id))||[],R.value=!0,yield pe.confirm("确定删除?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}),yield ie(t(o).join(",")).finally(()=>{R.value=!1,z()})}),J=(a,e)=>v(this,null,function*(){b.value="新增",m.value=!0,p.value="edit",e=="edit"&&(b.value="编辑",yield ue(a.id),p.value=e,h.value=a,a.type!="contact"?h.value.roomList=a.groups:h.value.friendList=a.groups,he(()=>{t(V).change(a.type)}),m.value=!0)}),V=u(),x=u(!1),K=()=>v(this,null,function*(){const a=t(V),e=yield a==null?void 0:a.submit();if(e){x.value=!0;let l=e.roomList;e.type=="contact"&&(l=e.friendList);let B=null;p.value=="edit"?B=yield ce(ve(F(S({},e),{groups:l}),["friendList","roomList"])).catch(()=>{}).finally(()=>{x.value=!1}):B=yield me(F(S({},e),{groups:l})).catch(()=>{}).finally(()=>{x.value=!1}),B&&(m.value=!1,i.value=1,z())}});return(a,e)=>($(),we(D,null,[n(t(oe),{title:"转发助手",message:`指定好友发送的消息，转发到指定群或者指定好友，快速实现群发消息，随时随地群发。
`},{default:f(()=>[_e("div",xe,[n(t(g),{type:"primary",onClick:H},{default:f(()=>[C(P(t(d)("exampleDemo.add")),1)]),_:1}),n(t(g),{loading:R.value,type:"danger",onClick:e[0]||(e[0]=l=>j(null))},{default:f(()=>[C(P(t(d)("exampleDemo.del")),1)]),_:1},8,["loading"])]),n(t(le),{pageSize:t(c),"onUpdate:pageSize":e[1]||(e[1]=l=>O(c)?c.value=l:null),currentPage:t(i),"onUpdate:currentPage":e[2]||(e[2]=l=>O(i)?i.value=l:null),columns:t(N).tableColumns,data:t(T),loading:t(L),"show-overflow-tooltip":!1,pagination:{total:t(y)},showOverflowTooltip:!1,"image-preview":["url"],onRegister:t(r)},null,8,["pageSize","currentPage","columns","data","loading","pagination","onRegister"])]),_:1}),n(t(re),{modelValue:m.value,"onUpdate:modelValue":e[4]||(e[4]=l=>m.value=l),title:b.value},{footer:f(()=>[p.value!="detail"?($(),U(t(g),{key:0,type:"primary",loading:x.value,onClick:K},{default:f(()=>[C(P(t(d)("exampleDemo.save")),1)]),_:1},8,["loading"])):M("",!0),n(t(g),{onClick:e[3]||(e[3]=l=>m.value=!1)},{default:f(()=>[C(P(t(d)("dialogDemo.close")),1)]),_:1})]),default:f(()=>[p.value!="detail"?($(),U(ne,{key:0,ref_key:"writeRef",ref:V,"form-schema":t(N).formSchema,"current-row":h.value},null,8,["form-schema","current-row"])):M("",!0)]),_:1},8,["modelValue","title"])],64))}});export{Ue as default};
