import{a2 as D,e as J,a3 as L,A as I,z as P,K as Q,J as U}from"./vendor-ui-CGT0cG1n.js";import{J as q,B as F,u as b,i as Y}from"./index-D88CvPWT.js";import"./el-table-column-CGzXlVpD.js";import{v as G,aA as W,aF as X,aj as Z,ab as i,l as E,r as c,p as w,ax as u,aO as n,_ as k,A as v,j as y,q as M,ap as g,k as N,i as C,aQ as ee,af as S,g as s,ao as ae,Y as te}from"./vendor-core-BKehvho7.js";import{b as ne}from"./index.vue_vue_type_script_setup_true_lang-CmmAEEXC.js";import{_ as oe}from"./index.vue_vue_type_script_setup_true_lang-BAM6bQ14.js";import{u as ce}from"./useTeamHeaders-DxHN7-t0.js";import"./index-B9hCLAJk.js";import"./useCompMetaLocalStore-BKTMp_k8.js";import"./useCacheOssStore-OAoLDVbw.js";import"./useVscodeOpen-BBdyQ3W2.js";/* empty css                */import"./BaseDialog.vue_vue_type_script_setup_true_lang-BROcUfEh.js";import"./EmptyStatusContainer.vue_vue_type_script_setup_true_lang-pswB5SUz.js";import"./useMessage-Cbhfk7Nk.js";const se={class:"size-full"},re={class:"flex items-center justify-center gap-2"},le={key:1},me={class:"flex items-center justify-center gap-2"},Be=G({__name:"index",setup(ie){const{t:a}=W(),K=q(),{headers:h,teamId:T}=ce(),V=ne(T)(),$=X("nicknameInput"),p=S({data:[],column:[{slot:"avatar",prop:"avatar",label:s(()=>a("user.avatar")),align:"center"},{prop:"type",label:s(()=>a("common.type")),align:"center",formatter(e){return{user:a("team.normalUser"),creator:a("team.creator")}[e.type]||"--"}},{prop:"nickname",label:s(()=>a("user.username")),align:"center",formatter(e){return e.nickname||"--"}},{slot:"teamUserNickname",prop:"teamUserNickname",label:s(()=>a("team.teamUserNickname")),align:"center"},{slot:"operation",prop:"operation",label:s(()=>a("common.operation")),align:"center"}],pagination:{total:0},search:{column:[{prop:"keyword",component:ae(I),value:"",autoQuery:!1,attributes:{placeholder:s(()=>`${a("user.account")}/${a("user.nickname")}`)}}]},fixedHeight:!1,fetchData:A}),_=S({}),x=s(()=>K.userInfo?.account);async function A(e){const d=await b.v1Team.teamcontrollerMember({...e},{headers:h}),{rows:r,total:l}=d.data||{};p.value.data=r||[],p.value.pagination.total=l||0}function O(e){return e.nickname?.[0]||e.account?.[0]||""}function R(e){Q.confirm(a("team.kickOutConfirm",{name:e.nickname||e.account}),a("common.info"),{confirmButtonText:a("common.confirm"),cancelButtonText:a("common.cancel"),type:"warning",beforeClose:(d,r,l)=>{d==="confirm"?(r.confirmButtonLoading=!0,b.v1Team.teamcontrollerKickout({userId:e._id},{headers:h}).then(()=>{U.success(a("team.kickOutSuccess")),p.value.data=p.value.data?.filter(m=>m._id!==e._id)||[],window?.umami?.track(Y.TEAM_KICK_MEMBER,{teamId:T,userId:e._id}),l()}).finally(()=>{r.confirmButtonLoading=!1})):l()}}).catch(()=>{})}async function j(e){_.value[e._id]=!0,await te(),$.value?.focus()}async function B(e){if(!e.teamUserNickname){delete _.value[e._id];return}b.v1Team.teamcontrollerUpdateteamusernickname({userId:e._id,teamUserNickname:e.teamUserNickname},{headers:h}).then(()=>{U.success(a("message.success.update")),delete _.value[e._id]})}return(e,d)=>{const r=Z("Icon"),l=P,m=D,z=L,H=J;return i(),E("div",se,[c(u(F),{tableConfig:p.value,border:""},w({teamUserNickname:n(({col:o})=>[c(m,k(v(o)),{default:n(({row:t})=>[C("div",re,[_.value[t._id]?(i(),y(u(I),{key:0,ref:"nicknameInput",modelValue:t.teamUserNickname,"onUpdate:modelValue":f=>t.teamUserNickname=f,placeholder:u(a)("team.pleaseInputTeamNickname"),onKeyup:ee(f=>B(t),["enter"]),onBlur:f=>B(t)},null,8,["modelValue","onUpdate:modelValue","placeholder","onKeyup","onBlur"])):(i(),E("span",le,g(t.teamUserNickname||"--"),1)),t.account===x.value?(i(),y(l,{key:2,class:"cursor-pointer",onClick:f=>j(t)},{default:n(()=>[c(r,{icon:"material-symbols:edit-note"})]),_:1},8,["onClick"])):N("",!0)])]),_:1},16)]),account:n(({col:o})=>[c(m,k(v(o)),{default:n(({row:t})=>[C("div",me,[C("span",null,g(t.account),1),t.account===x.value?(i(),y(z,{key:0,type:"info"},{default:n(()=>[M(g(u(a)("common.me")),1)]),_:1})):N("",!0)])]),_:1},16)]),avatar:n(({col:o})=>[c(m,k(v(o)),{default:n(({row:t})=>[c(oe,{src:t.avatar,size:40,text:O(t)},null,8,["src","text"])]),_:1},16)]),_:2},[u(V).isCreator?{name:"operation",fn:n(({col:o})=>[c(m,k(v(o)),{default:n(({row:t})=>[t.type==="user"?(i(),y(H,{key:0,onClick:f=>R(t)},{default:n(()=>[M(g(u(a)("team.kickOut")),1)]),_:1},8,["onClick"])):N("",!0)]),_:1},16)]),key:"0"}:void 0]),1032,["tableConfig"])])}}});export{Be as default};
