import{d as V,y as d,W as D,a5 as v,K as G,o as R,b as T,f as s,w as r,e as g,h as a,a6 as M,a7 as N,a3 as k,g as x,t as b,a8 as E}from"./index-U-PhABqT.js";import{M as u,T as U,B as q,D as I}from"./index-C1Is5pBl.js";import{P as F,T as y,G as $}from"./index-Bt1l5oAA.js";import{G as j,S as K}from"./index-DKlJvwwh.js";import"./vue.runtime.esm-bundler-CQYuvFJ3.js";import"./index-AuG6PAVy.js";import"./index-CjMUOgce.js";const O={style:{width:"20%"}},W={style:{"margin-top":"5px"}},Y=V({name:"mcp",__name:"index",setup(A){const l=d(!1),{protocol:w,hostname:S,port:_}=D(),m=`${w}://${S}:${_}`,C=d({seqSerial:!0,editConfig:{trigger:"click",mode:"cell",showStatus:!0},validConfig:{message:"tooltip"},fetchData:{api:z},toolbar:{size:"small",resizable:!0,component:j,buttons:[{code:"reload",name:"刷新",type:"info"},{code:"delete",name:"删除"},{code:"cancel",name:"取消选择"},{code:"server",name:"MCP服务",type:"success"}]},events:{toolbarButtonClick:B},pager:{component:F,attrs:{currentPage:1,pageSize:10,pageSizes:[10,20,50],total:0,layout:"total, sizes, prev, pager, next, jumper"}},columns:[{type:"selection",width:"50"},{type:"index",width:"60"},{field:"name",title:"名称",showOverflow:!0,width:"220"},{field:"paramsSchema",title:"参数",width:"300"},{field:"description",title:"描述",width:"450"}]}),i=d();function z({page:p}){const{currentPage:e,pageSize:t}=p,f=(e-1)*t;return new Promise(async o=>{const n=await v({url:`${m}/api/mcpmanager/queryPage`,method:"get",params:{limit:t,offset:f,name:h.value}});i.value.clearScroll(),o({result:n.data,page:{total:n.total}})})}async function B({code:p,$grid:e}){e.getData();const t=e.getSelectRecords(),f=e.getUpdateRecords().concat(e.getInsertRecords());switch(p){case"reload":{e.handleFetch("reload"),u.success("刷新成功");break}case"cancel":{e.clearSelection();break}case"delete":{if(t.length===0){y.alert("请至少选中一条记录");break}l.value=!0;try{t.forEach(async o=>{const n=await v({url:`${m}/api/mcpmanager/delete`,method:"post",data:{id:o.id}})}),l.value=!1}catch{l.value=!1}u.success("删除成功"),e.removeSelecteds();break}case"save":{if(f.length===0){y.alert("没有修改记录");break}i.value.validate(o=>{if(o){l.value=!0;try{f.forEach(async n=>{const H=await v({url:`${m}/api/mcpmanager/save`,method:"post",data:n})}),l.value=!1}catch{l.value=!1}u.success("保存成功")}else y.alert("校验不通过")});break}case"loadServer":{try{await v({url:`${m}/api/mcpmanager/loadServer`,method:"get",params:{}}),u.success("刷新成功")}catch{u.success("刷新失败")}break}case"server":{c.value=!0;break}}}const h=d("");function P(){i.value.handleFetch("reload")}G(()=>{i.value.clearScroll()});const c=d(!1);return(p,e)=>(R(),T("div",null,[s(a(k),null,{default:r(()=>[g("div",O,[s(a(K),{modelValue:h.value,"onUpdate:modelValue":e[0]||(e[0]=t=>h.value=t),placeholder:"请输入名称进行搜索",onSearch:P,clearable:""},null,8,["modelValue"])]),s(a(M),null,{default:r(()=>[s(a($),N({resizable:"",ref_key:"basicGridRef",ref:i},C.value,{loading:l.value,"column-width":200,height:"auto",size:"small","auto-resize":!0}),null,16,["loading"])]),_:1})]),_:1}),s(a(I),{visible:c.value,"onUpdate:visible":e[2]||(e[2]=t=>c.value=t),title:"详情",width:"68vw",top:"50","max-height":"92vh"},{footer:r(()=>[s(a(q),{type:"primary",onClick:e[1]||(e[1]=t=>c.value=!c.value)},{default:r(()=>e[4]||(e[4]=[x("关 闭")])),_:1,__:[4]})]),default:r(()=>[g("div",null,[s(a(k),null,{default:r(()=>[g("div",null,[s(a(U),{size:"medium",type:"success"},{default:r(()=>e[3]||(e[3]=[x(" mcp地址 ")])),_:1,__:[3]})]),g("div",W,b(a(w))+"://"+b(a(S))+":"+b(a(_))+"/mcp ",1)]),_:1})])]),_:1},8,["visible"])]))}}),te=E(Y,[["__scopeId","data-v-acd17b0d"]]);export{te as default};
