"use strict";const e=require("../../../../common/vendor.js");require("../../../adapter-vue.js");const r=require("../../common/Toast/index.js"),t=require("../server.js"),a=require("../../common/Toast/type.js");Math||s();const s=()=>"../../common/SelectUser/index.js",u=e.defineComponent({__name:"index",setup(s){const u=t.TUIGroupServer.getInstance(),o=u.constants,n=e.ref(!1),i=e.ref([]),l=e.ref([]),c=e.ref({}),v=e.ref({groupID:"",isRadio:!1,isNeedSearch:!1,title:"",filterUserIDList:[]}),d=e.ref(null);e.watchEffect((()=>{const r=u.getOnCallParams(o.TUIContact.SERVICE.METHOD.SELECT_FRIEND);var t;v.value.groupID=r.groupID,v.value.title=r.title,v.value.isRadio=r.isRadio,v.value.isNeedSearch=r.isNeedSearch,v.value.filterUserIDList=r.filterUserIDList,r.isNeedSearch&&(t=r.isNeedSearch,d.value=e.R.getService(o.TUISearch.SERVICE.NAME),d.value?n.value=t:console.warn("请添加 TUISearch 组件"))})),e.Jt.watch(e.o.GRP,{currentGroup:e=>{c.value=e},currentGroupMemberList:e=>{i.value=e.map((e=>{v.value.filterUserIDList.indexOf(e.userID)>-1&&(e.isDisabled=!0)})),l.value=i.value}});const f=async()=>{const r={groupID:c.value.groupID,count:100,offset:i.value.length};await e.es.getGroupMemberList(r)},I=r=>{e.Jt.update(e.o.GRP,"isShowSelectComponent",!1);const t=u.getOnCallCallback(o.TUIGroup.SERVICE.METHOD.SELECT_GROUP_MEMBER);t&&t(r)},p=()=>{r.Toast({message:e.Wt.t("TUIGroup.该用户不存在"),type:a.TOAST_TYPE.ERROR}),l.value=[...i.value]},m=async e=>{if(!e)return l.value=i.value;try{const r=await d.value.searchGroupMember(e);if(!r.data[0])return p();l.value=r.data;const t=i.value.filter((e=>e.userID===r.data[0].userID));i.value=t.length?i.value:[...i.value,...l.value]}catch(r){return p()}};return(r,t)=>({a:e.o$1(f),b:e.o$1(m),c:e.o$1(I),d:e.p({isRadio:e.unref(v).isRadio,isNeedSearch:e.unref(v).isNeedSearch,title:e.unref(v).title,userList:e.unref(l),total:e.unref(c).memberCount})})}});wx.createComponent(u);
