boyuehasfj-vue3/boyuehasfj-admin/assets/addMessage-CIrvQ1gt.js

2 lines
10 KiB
JavaScript
Raw Normal View History

2025-06-02 21:34:56 +08:00
var e=Object.defineProperty,l=Object.defineProperties,a=Object.getOwnPropertyDescriptors,t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,u=Object.prototype.propertyIsEnumerable,o=(l,a,t)=>a in l?e(l,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[a]=t,r=(e,l)=>{for(var a in l||(l={}))n.call(l,a)&&o(e,a,l[a]);if(t)for(var a of t(l))u.call(l,a)&&o(e,a,l[a]);return e},s=(e,l,a)=>new Promise(((t,n)=>{var u=e=>{try{r(a.next(e))}catch(l){n(l)}},o=e=>{try{r(a.throw(e))}catch(l){n(l)}},r=e=>e.done?t(e.value):Promise.resolve(e.value).then(u,o);r((a=a.apply(e,l)).next())}));import{s as d,g as i,a as p,b as c,c as m,d as v,e as g}from"./messageSystem-B_aAOviq.js";import{_ as f,d as y,r as h,z as b,j as T,H as V,h as _,o as C,w as k,F as w,e as M,i as I,c as R,I as x,J as U,k as j,m as O,B as q,f as P,a4 as N}from"./index-C-c3zR6K.js";const S={key:0,style:{width:"100%"}},F={key:1,style:{width:"100%"}},E={class:"dialog-footer"},D=f({__name:"addMessage",props:{title:{type:String,default:"发送消息界面"}},emits:["success","close"],setup(e,{expose:t,emit:n}){const{proxy:u}=y(),{send_mode:o,message_type:f}=u.useDict("send_mode","message_type"),D=n,z=h([]),A=h([]),B=h([]),H=h([]),J=h(null),$=h(!1),G=h({messageTitle:null,messageContent:null,messageTemplate:null,messageRecipient:[],remark:null,sendMode:null,recipientType:null,code:null,contentType:null}),K=h(!1),L=b((()=>["1","2"].includes(G.value.sendMode))),Q=b((()=>[{value:"user",label:"用户"},{value:"role",label:"角色"},{value:"dept",label:"部门"}])),W=b((()=>{var e;return(null==(e=Q.value.find((e=>e.value===G.value.recipientType)))?void 0:e.label)||""})),X=b((()=>G.value.recipientType&&(z.value.length||A.value.length||B.value.length))),Y=h(r({messageTitle:[{required:!0,message:"请输入标题",trigger:"blur"}],sendMode:[{required:!0,message:"请选择发送方式",trigger:"change"}],messageRecipient:[{required:!0,message:"请选择收件人",trigger:"change"}],messageType:[{required:!0,message:"请选择消息类型",trigger:"change"}],recipientType:[{required:!0,message:"请选择收件人方式",trigger:"change"}],contentType:[{required:!0,message:"请选择内容类型",trigger:"change"}],messageContent:[{required:!0,message:"模版签名或消息内容不能为空",trigger:"blur"},{validator:function(e,l,a){"1"!==G.value.sendMode||"content"!==G.value.contentType||/^[^?]+?\?[^=]+?=.*$/.test(l)?a():a(new Error("短信输入内容格式必须为:模板名?模板参数=值"))},trigger:"blur"}]},L.value?{code:[{required:!0,message:"手机号或者邮箱",trigger:"blur"}]}:{})),Z=b((()=>{if(!G.value.recipientType)return[];return("user"===G.value.recipientType?z.value:"role"===G.value.recipientType?A.value:B.value).map((e=>({id:e.userId||e.roleId||e.deptId,name:e.userName||e.roleName||e.deptName,phonenumber:e.phonenumber,email:e.email})))}));function ee(){return s(this,null,(function*(){switch(G.value.messageRecipient=null,G.value.recipientType){case"user":yield function(){return s(this,null,(function*(){try{z.value=(yield g(G.value.sendMode)).data}catch(e){}}))}();break;case"role":yield function(){return s(this,null,(function*(){try{A.value=(yield v()).data}catch(e){}}))}();break;case"dept":yield function(){return s(this,null,(function*(){try{B.value=function(e){const l={},a=[];return e.forEach((e=>{l[e.deptId]=e,0===e.parentId?a.push(e):(l[e.parentId].children=l[e.parentId].children||[],l[e.parentId].children.push(e))})),a}((yield m()).data)}catch(e){}}))}()}}))}function le(e){return s(this,null,(function*(){try{let l=[];if("role"===G.value.recipientType)for(const a of e){const e=(yield p(a)).data;l.push(...e.filter((e=>e.phonenumber||e.email||e.name)))}else if("dept"===G.value.recipientType)for(const a of e){const e=(yield i(a)).data;l.push(...e.filter((e=>e.phonenumber||e.email||e.name)))}else l=Z.value.filter((l=>e.includes(l.id)&&(l.phonenumber||l.email||l.name)));te(l)}catch(l){}}))}function ae(e){return s(this,null,(function*(){try{const l=[];for(const a of e){const e=(yield i(a)).data;l.push(...e.filter((e=>e.phonenumber||e.email||e.name))