1 |
- import{_ as e,u as t,s,g as i,H as a,ah as r,R as n,A as c,m as l,p as o,q as h,o as d,c as u,w as p,f as g,v as m,d as _,t as f,x as y}from"./index-01d5b8eb.js";import{u as U}from"./user-select.9a5cd963.js";import"./uni-app.es.37c693bd.js";const $=t(s);i($);const v=e({components:{userSelect:U},data:()=>({title:"发起群聊",contact_id:"",selectUser:[],userList:[],changeUser:[],user_ids:[],type:1,relayState:!1,scrollLeft:300,curMsg:{}}),watch:{relayState(e){1==e&&(a({icon:"success",title:"转发成功"}),setTimeout((()=>{r()}),2e3))}},onLoad(e){var t=n(),s=t[t.length-2];this.type=e.type?e.type:1,this.contact_id=e.contact_id?e.contact_id:"",2==e.type?(this.title="添加成员",this.user_ids=s.user_ids):3==e.type?(this.title="转发聊天",this.curMsg=s.curMsg):4==e.type?this.title="选择提醒的人":this.title="发起群聊"},methods:{relay(){let e=this.changeUser.map((e=>e.id));if(e.length)if(e.length>5)a({title:"转发的人数不能超过5人!",icon:"none"});else{var t=n(),s=t[t.length-2];let i="";i=s.fromUser,s.contact.id;let a="";a="relayCrm"==this.type||"relayProject"==this.type?s.message:c("selectedItem"),e.forEach((e=>{let t={id:this.$util.getUuid(),is_group:0,fromUser:i,extends:a.extends?a.extends:"",type:a.type,toContactId:e,content:a.content,sendTime:(new Date).getTime()};this.$api.msgApi.sendMessage(t).then((e=>{200===e.code&&(this.relayState=!0)}))}))}else a({title:"请选择至少一名人员",icon:"none"})},addGroupUser(e){var t=n(),s=t[t.length-2];s.getsimpleMessage=!1;let i=s.group_id;this.$api.msgApi.addGroupUser({user_ids:e,id:i}).then((e=>{200==e.code&&r()}))},addGroup(e){this.$api.msgApi.addGroup({user_ids:e}).then((e=>{200==e.code&&setTimeout((()=>{r()}),2e3)}))},save(){if(l({title:"保存中...",mask:!0}),this.changeUser=this.$refs.userSelect.changeUser,this.selectUser=this.$refs.userSelect.selectUser,console.log(this.changeUser),!this.changeUser.length)return a({title:"请选择人员",icon:"none"});try{if(1==this.type)this.$api.msgApi.addGroup({user_ids:this.changeUser}).then((e=>{o();const t=e.data;$.appendContacts(t),h({url:"/pages/message/chat?id="+t.id})}));else if(2==this.type)this.$api.msgApi.addGroupUser({user_ids:this.changeUser,id:this.contact_id}).then((e=>{this.closePage()}));else if(3==this.type){if(this.changeUser.length>5)return a({title:"单次转发不能超过5人",icon:"none"});this.$api.msgApi.forwardMessage({user_ids:this.changeUser,msg_id:this.curMsg.msg_id}).then((e=>{this.closePage()}))}else if(4==this.type){this.getOpenerEventChannel().emit("getAtList",this.selectUser),this.closePage()}else this.$api.msgApi.removeUser({user_ids:this.changeUser,id:this.contact_id}).then((e=>{this.closePage()}))}catch(e){console.info(e),this.closePage()}},closePage(){o(),r()},confirm:function(e){let t=[];e&&(this.userList.filter((s=>{let i=s.realname?s.realname:s.userInfo.displayName;return i.includes(e.trim())&&t.push(s),i.includes(e.trim())})),this.lists=t)}}},[["render",function(e,t,s,i,a,r){const n=g,c=y("cu-custom"),l=y("user-select");return d(),u(n,null,{default:p((()=>[m(c,{bgColor:"bg-gradual-green",isBack:!0},{backText:p((()=>[])),content:p((()=>[_(f(a.title),1)])),right:p((()=>[m(n,{class:"mr-10 f-16",onClick:r.save},{default:p((()=>[_(f(3==a.type?"转发":"完成"),1)])),_:1},8,["onClick"])])),_:1}),m(l,{type:a.type,contact_id:a.contact_id,user_ids:a.user_ids,ref:"userSelect"},null,8,["type","contact_id","user_ids"])])),_:1})}],["__scopeId","data-v-4d06c88a"]]);export{v as default};
|