import{a2 as $,e as B,a3 as H,A as S,J as j}from"./vendor-ui-CGT0cG1n.js";import{B as z,u as C,i as h}from"./index-D88CvPWT.js";import"./el-table-column-CGzXlVpD.js";import{b as M}from"./index.vue_vue_type_script_setup_true_lang-CmmAEEXC.js";import{_ as R}from"./index.vue_vue_type_script_setup_true_lang-BAM6bQ14.js";import{u as w}from"./useTeamHeaders-DxHN7-t0.js";import{v as D,aA as J,ab as u,l as d,r as o,p as L,ax as s,aO as r,_ as T,A as E,q as _,ap as f,af as N,g as c,ao as V}from"./vendor-core-BKehvho7.js";import{_ as Y}from"./LoadingWrapper.vue_vue_type_script_setup_true_lang-kJcgjuK5.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 q={class:"size-full"},O={key:0},Q={key:1},ca=D({__name:"index",setup(F){const{t:a}=J(),{headers:v,teamId:g}=w(),I=M(g)(),p=N({data:[],column:[{slot:"avatar",prop:"userId.avatar",label:c(()=>a("user.avatar")),align:"center"},{prop:"userId.account",label:c(()=>a("user.account")),align:"center"},{prop:"userId.nickname",label:c(()=>a("user.nickname")),align:"center",formatter(e){return e.userId.nickname||"--"}},{slot:"operation",prop:"operation",label:c(()=>a("common.operation")),align:"center"}],pagination:{total:0},search:{column:[{prop:"keyword",component:V(S),value:"",autoQuery:!1,attributes:{placeholder:c(()=>`${a("user.account")}/${a("user.nickname")}`)}}]},fixedHeight:!1,fetchData:A});async function A(e){const l=await C.v1Team.teamcontrollerApplylist({...e},{headers:v}),{rows:n,total:t}=l.data||{};p.value.data=n||[],p.value.pagination.total=t||0}function y(e,l,n){n.start(),C.v1Team.teamcontrollerHandleapply({applyId:e._id,isAgree:l},{headers:v}).then(()=>{p.value.data=p.value.data?.map(t=>(t._id===e._id&&(t.status=l?"approved":"rejected"),t)),j.success(a("message.success.operation")),window?.umami?.track(l?h.TEAM_APPLY_ACCEPT:h.TEAM_APPLY_REJECT,{teamId:g,applyId:e._id})}).finally(()=>{n.end()})}return(e,l)=>{const n=$,t=B,x=H;return u(),d("div",q,[o(s(z),{tableConfig:p.value,border:""},L({avatar:r(({col:m})=>[o(n,T(E(m)),{default:r(({row:i})=>[o(R,{src:i.userId.avatar,size:40},null,8,["src"])]),_:1},16)]),_:2},[s(I).isCreator?{name:"operation",fn:r(({col:m})=>[o(n,T(E(m)),{default:r(({row:i})=>[i.status==="pending"?(u(),d("div",O,[o(s(Y),null,{default:r(({instance:b,loading:k})=>[o(t,{type:"danger",loading:k,onClick:P=>y(i,!1,b)},{default:r(()=>[_(f(s(a)("team.reject")),1)]),_:1},8,["loading","onClick"]),o(t,{type:"primary",loading:k,onClick:P=>y(i,!0,b)},{default:r(()=>[_(f(s(a)("team.agree")),1)]),_:1},8,["loading","onClick"])]),_:2},1024)])):(u(),d("div",Q,[o(x,{type:"info"},{default:r(()=>[_(f(i.status==="approved"?s(a)("team.approved"):s(a)("team.rejected")),1)]),_:2},1024)]))]),_:1},16)]),key:"0"}:void 0]),1032,["tableConfig"])])}}});export{ca as default};
