import{aa as e,l as a,bK as s,aD as t,aB as o,a4 as l,$ as n,ac as i,aq as r,A as u,a7 as c,z as d,x as p,a3 as m,q as v,a1 as h,a2 as f,v as g}from"./utils-lib.js?v=20260328163632";import{B as k}from"./index91.js?v=20260328163632";import{u as _}from"./index92.js?v=20260328163632";import{h as x,i as y,j as b,u as j,b as w,f as C,k as R,e as O,l as V}from"./useMethod4.js?v=20260328163632";import{u as z}from"./store4.js?v=20260328163632";import{d as A,A as B}from"./site.js?v=20260328163632";import{r as S,O as q,k as E,w as K,o as G,J as I,V as L,W as U,a3 as W,Y as D,F,N as P,X as T,Z as H}from"./base-lib.js?v=20260328163632";import{au as J}from"./naive-ui.js?v=20260328163632";import"./__commonjsHelpers__.js?v=20260328163632";import"./env-lib.js?v=20260328163632";const{siteInfo:M,isRefreshList:N,setSiteInfo:X}=z();S({});const Y=S(""),Z=S(""),$=S(!1),Q=S([]),ee=e=>e.id,ae=(e,s="")=>{X(e,s),u({title:a("Go项目管理")+"[".concat(e.name,"] -- ")+a("添加时间")+"[".concat(e.addtime,"]"),area:[840,720],component:()=>c((()=>import("./index169.js?v=20260328163632")),[],import.meta.url)})},se=S({columns:[e(),{title:a("项目名称"),key:"name",minWidth:120,isCustom:!1,render:e=>q("span",{class:"bt-link",onClick:()=>ae(e)},[e.name])},x(),{title:a("服务状态"),key:"run",width:80,render:e=>{const t=!!e.pid;return q(s,{modelValue:t,data:[a("已停止"),a("运行中")],onClick:()=>y(e)},null)}},b(),t({key:"path",minWidth:140}),...j(),o({table:"sites",minWidth:110,width:"auto",request:O}),w({onClick:e=>{ae(e,"ssl")}}),l([{onClick:e=>ae(e),title:a("设置")},{onClick:async e=>{await d({title:a("删除GO项目【{0}】",[e.name]),content:a("风险操作，此操作不可逆，删除{0}项目后您将无法管理该项目，是否继续操作？",[e.name]),type:"input",input:{content:a("删除项目")}}),p({loading:a("正在删除项目，请稍等..."),request:A({id:e.id}),message:!0,success:e=>{e.status&&pe()}})},title:a("删除")}],{width:90})],data:[]}),te=S({page:1,pageSize:20,itemCount:0,pageSlot:5}),[oe,le]=n(se),[ne]=m(te),{BtOperation:ie}=_({options:[{active:!0,label:a("添加Go项目"),onClick:()=>{M.value=null,u({title:a("添加Go项目"),area:680,component:()=>c((()=>import("./index168.js?v=20260328163632")),[],import.meta.url),showFooter:!0})}},...C()]}),{BtBatch:re}=i({tableRef:le,checkedRowKeys:Q,options:[{label:a("启动项目"),value:"start",event:R},{label:a("停用项目"),value:"stop",event:R},{label:a("重启项目"),value:"restart",event:R},{label:a("删除项目"),value:"delete",event:R}]}),{BtColumn:ue}=r({tableRef:le,column:se.value.columns}),ce=e=>{se.value.columns.forEach((a=>{void 0!==a.sortOrder&&(e&&a.key===e.columnKey?a.sortOrder=e.order:a.sortOrder=!1)}));const{order:a,columnKey:s}=e;Z.value=a?"".concat(s," ").concat("descend"===a?"desc":"asc"):"",pe()},de=()=>{te.value.page=1,pe()},pe=(e={search_type:"go",search:Y.value,p:te.value.page,limit:te.value.pageSize,order:Z.value})=>p({loading:$,request:B(e),success:e=>{var a;const{data:s,page:t}=e.data;if(se.value.data=Array.isArray(s)?s:[],te.value.itemCount=(null==t?void 0:t.total)||0,(null==(a=M.value)?void 0:a.id)&&(null==s?void 0:s.length)){const e=null==s?void 0:s.find((e=>e.id===M.value.id));e&&X({...M.value,...e})}}}),me=()=>{ve(),pe()},ve=()=>{Y.value="",se.value.data=[],Q.value=[],Object.assign(te.value,{page:1,itemCount:0})},he={class:"text-14px text-[var(--text-color-2)]"},fe=E({__name:"index",setup(e){const{isRefreshList:s}=z();return K((()=>s.value),(e=>{e&&(pe(),s.value=!1)})),G(me),I(ve),(e,s)=>{const t=J;return L(),U(F,null,[q(D(f),null,{"header-left":W((()=>[q(D(ie),{class:"!gap-10px"})])),"header-right":W((()=>[q(t,{class:"!gap-10px"},{default:W((()=>[q(D(v),{modelValue:D(Y),"onUpdate:modelValue":s[0]||(s[0]=e=>P(Y)?Y.value=e:null),placeholder:D(a)("请输入项目名称或备注"),class:"!w-[220px]",onSearch:D(de)},null,8,["modelValue","placeholder","onSearch"]),q(D(k),{onRefresh:D(pe)},null,8,["onRefresh"]),q(D(ue))])),_:1})])),content:W((()=>[q(D(oe),{"checked-row-keys":D(Q),"onUpdate:checkedRowKeys":s[1]||(s[1]=e=>P(Q)?Q.value=e:null),"row-key":D(ee),loading:D($),"scroll-x":1e3,"onUpdate:sorter":D(ce)},null,8,["checked-row-keys","row-key","loading","onUpdate:sorter"])])),"footer-left":W((()=>[q(D(re))])),"footer-right":W((()=>[q(D(ne),{"show-size-picker":"","page-sizes":D(h)([10,20,50,100]),onRefresh:D(pe)},{suffix:W((()=>[T("span",he,H(D(a)("共 {0} 条",[D(te).itemCount])),1)])),_:1},8,["page-sizes","onRefresh"])])),_:1}),q(D(g),{class:"!mt-20px",options:D(V)},null,8,["options"])],64)}}});export{fe as default};
