import{a2 as O,e as R,W as H,L as P,b as F,K as q,J as k}from"./vendor-ui-DXwyveTF.js";import{B as z,s as d}from"./index-B5qe6yln.js";import"./el-table-column-8qfe8CVK.js";import{v as K,aA as L,aD as Q,a7 as W,ab as _,l as C,r as s,aO as l,_ as T,A,q as w,ap as g,ax as p,F as j,ah as J,j as G,i as X,af as x,g as t,ao as Z}from"./vendor-core-CzvSW5ae.js";import{b as ee}from"./index.vue_vue_type_script_setup_true_lang-D3xHCy9f.js";import{h as B}from"./moment-B-YVwB4U.js";import{u as ae}from"./useTeamHeaders-Cc060CP0.js";import{_ as te}from"./LoadingWrapper.vue_vue_type_script_setup_true_lang-bBtkKtmz.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 oe={class:"size-full"},ne={class:"text-gray-300"},Ce=K({__name:"index",setup(le){const{t:a}=L(),D=Q(),{headers:i,teamId:v}=ae(),f=ee(v)(),b=x([]),u=x({data:[],column:[{prop:"name",label:t(()=>a("comp.name")),align:"center"},{prop:"authorId.nickname",label:t(()=>a("common.author")),align:"center",formatter:e=>e.teamUserNickname||e.authorId?.nickname||"--"},{prop:"version",label:t(()=>a("comp.version")),align:"center"},{prop:"desc",label:t(()=>a("comp.desc")),align:"center",showOverflowTooltip:{popperClass:"table-text-tooltip"}},{prop:"createdAt",label:t(()=>a("team.createTime")),align:"center",formatter:e=>e.createdAt?B(e.createdAt).format("YYYY-MM-DD"):"--"},{prop:"updatedAt",label:t(()=>a("team.updateTime")),align:"center",formatter:e=>e.updatedAt?B(e.updatedAt).format("YYYY-MM-DD"):"--"},{slot:"canUpdateUsers",prop:"canUpdateUsers",label:t(()=>a("team.updateAuth")),align:"center"},{slot:"operation",prop:"operation",label:t(()=>a("common.operation")),align:"center"}],search:{column:[{prop:"keyword",component:Z(F),label:t(()=>a("common.keyword")),value:"",autoQuery:!1,attributes:{placeholder:t(()=>a("comp.keywordPlaceholder")),fetchSuggestions:I,triggerOnFocus:!1,style:"width: 400px",fitInputWidth:!0}}]},pagination:{total:0},fixedHeight:!1,fetchData:M}),E=t(()=>b.value.map(e=>({value:e._id,label:e.teamUserNickname||e.nickname||e.account})));function I(e,o){if(e.length<=1)return o([]);d.v1Keyword.keywordcontrollerQuerykeywordscomp({keyword:e,type:"compTeam"},{headers:i}).then(c=>{const{keywords:r=[]}=c.data||{};o(r)})}async function M(e){const o=await d.v1Team.teamcontrollerTeamcomps({...e,scene:"management"},{headers:i}),{rows:c,total:r}=o.data||{};u.value.data=c||[],u.value.pagination.total=r||0}async function Y(e,o){o.start();try{if(await q.confirm(a("team.deleteCompConfirm",{name:e.name}),a("common.info"),{confirmButtonText:a("common.confirm"),cancelButtonText:a("common.cancel"),type:"warning"}).catch(()=>{})!=="confirm")return;await d.v1Team.teamcontrollerRemovecompfromteam({compIds:[e._id]},{headers:i}).then(()=>{k.success(a("message.success.delete")),u.value.data=u.value.data.filter(r=>r._id!==e._id),f.setTeamDetail({...f.teamDetail,compCount:f.teamDetail.compCount-1})})}finally{o.end()}}function V(e){D.push({path:`/previewTeam/${v}/${e._id}`})}function S(){d.v1Team.teamcontrollerAllmember({headers:i}).then(e=>{b.value=e.data?.rows||[]})}function $(e){const o={compId:e._id,canUpdateUserIds:e.canUpdateUsers||[]};d.v1Team.teamcontrollerUpdatecompcanupdateusers(o,{headers:i}).then(()=>{k.success(a("message.success.update"))})}return W(()=>{S()}),(e,o)=>{const c=P,r=H,y=O,U=R;return _(),C("div",oe,[s(p(z),{tableConfig:u.value,border:""},{canUpdateUsers:l(({col:h})=>[s(y,T(A(h)),{default:l(({row:m})=>[s(r,{modelValue:m.canUpdateUsers,"onUpdate:modelValue":n=>m.canUpdateUsers=n,multiple:"","collapse-tags":"","collapse-tags-tooltip":"",placeholder:p(a)("team.selectCanUpdateUser"),onChange:n=>$(m)},{header:l(()=>[X("span",ne,g(p(a)("team.authorAutoAuth")),1)]),default:l(()=>[(_(!0),C(j,null,J(E.value,n=>(_(),G(c,{key:n.value,label:n.label,value:n.value},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onUpdate:modelValue","placeholder","onChange"])]),_:1},16)]),operation:l(({col:h})=>[s(y,T(A(h)),{default:l(({row:m})=>[s(U,{type:"primary",onClick:n=>V(m)},{default:l(()=>[w(g(p(a)("common.preview")),1)]),_:1},8,["onClick"]),s(p(te),null,{default:l(({instance:n,loading:N})=>[s(U,{type:"danger",loading:N,onClick:re=>Y(m,n)},{default:l(()=>[w(g(p(a)("common.delete")),1)]),_:1},8,["loading","onClick"])]),_:2},1024)]),_:1},16)]),_:1},8,["tableConfig"])])}}});export{Ce as default};
