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