import{a2 as D,e as J,a3 as L,A as B,z as P,K as Q,J as T}from"./vendor-ui-DXwyveTF.js";import{J as q,B as F,s as b}from"./index-B5qe6yln.js";import"./el-table-column-8qfe8CVK.js";import{v as Y,aA as G,aF as W,aj as X,ab as i,l as I,r as c,p as Z,ax as u,aO as n,_ as k,A as v,j as y,q as E,ap as g,k as N,i as x,aQ as w,af as S,g as s,ao as ee,Y as ae}from"./vendor-core-CzvSW5ae.js";import{b as te}from"./index.vue_vue_type_script_setup_true_lang-D3xHCy9f.js";import{_ as ne}from"./index.vue_vue_type_script_setup_true_lang-RJnk970E.js";import{u as oe}from"./useTeamHeaders-Cc060CP0.js";import"./index-CEQStqDa.js";import"./useCompMetaLocalStore-eE-CBcE9.js";/* empty css                */import"./useVscodeOpen-Dx3IRL0P.js";import"./BaseDialog.vue_vue_type_script_setup_true_lang-CgV6_zzd.js";import"./useCacheOssStore-DApHt9lQ.js";import"./EmptyStatusContainer.vue_vue_type_script_setup_true_lang-CofI0Rvq.js";import"./useMessage-CYVXvlqq.js";const ce={class:"size-full"},se={class:"flex items-center justify-center gap-2"},re={key:1},le={class:"flex items-center justify-center gap-2"},Ue=Y({__name:"index",setup(me){const{t:a}=G(),V=q(),{headers:h,teamId:$}=oe(),K=te($)(),M=W("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:ee(B),value:"",autoQuery:!1,attributes:{placeholder:s(()=>`${a("user.account")}/${a("user.nickname")}`)}}]},fixedHeight:!1,fetchData:A}),_=S({}),C=s(()=>V.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 j(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(()=>{T.success(a("team.kickOutSuccess")),p.value.data=p.value.data?.filter(m=>m._id!==e._id)||[],l()}).finally(()=>{r.confirmButtonLoading=!1})):l()}}).catch(()=>{})}async function z(e){_.value[e._id]=!0,await ae(),M.value?.focus()}async function U(e){if(!e.teamUserNickname){delete _.value[e._id];return}b.v1Team.teamcontrollerUpdateteamusernickname({userId:e._id,teamUserNickname:e.teamUserNickname},{headers:h}).then(()=>{T.success(a("message.success.update")),delete _.value[e._id]})}return(e,d)=>{const r=X("Icon"),l=P,m=D,H=L,R=J;return i(),I("div",ce,[c(u(F),{tableConfig:p.value,border:""},Z({teamUserNickname:n(({col:o})=>[c(m,k(v(o)),{default:n(({row:t})=>[x("div",se,[_.value[t._id]?(i(),y(u(B),{key:0,ref:"nicknameInput",modelValue:t.teamUserNickname,"onUpdate:modelValue":f=>t.teamUserNickname=f,placeholder:u(a)("team.pleaseInputTeamNickname"),onKeyup:w(f=>U(t),["enter"]),onBlur:f=>U(t)},null,8,["modelValue","onUpdate:modelValue","placeholder","onKeyup","onBlur"])):(i(),I("span",re,g(t.teamUserNickname||"--"),1)),t.account===C.value?(i(),y(l,{key:2,class:"cursor-pointer",onClick:f=>z(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})=>[x("div",le,[x("span",null,g(t.account),1),t.account===C.value?(i(),y(H,{key:0,type:"info"},{default:n(()=>[E(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(ne,{src:t.avatar,size:40,text:O(t)},null,8,["src","text"])]),_:1},16)]),_:2},[u(K).isCreator?{name:"operation",fn:n(({col:o})=>[c(m,k(v(o)),{default:n(({row:t})=>[t.type==="user"?(i(),y(R,{key:0,onClick:f=>j(t)},{default:n(()=>[E(g(u(a)("team.kickOut")),1)]),_:1},8,["onClick"])):N("",!0)]),_:1},16)]),key:"0"}:void 0]),1032,["tableConfig"])])}}});export{Ue as default};
