File: /www/server/panel/BTPanel/static/js/index89.js
import{_ as q}from"./index118.js?v=1777008528";import{u as F}from"./index151.js?v=1777008528";import{r as J,c as D,aI as G,e as r,x as C,w as U,o as $,j as H,C as z,v as f,p as o,q as x}from"./base-lib.js?v=1777008528";import{e as L,_ as N,a2 as I,M,w as K,c as Q,dc as W,da as X,i as Y,cU as Z}from"./utils-lib.js?v=1777008528";import{w as ee,b as te,e as se,F as ae,E as ne,g as re}from"./index3.js?v=1777008528";import"./index.vue_vue_type_style_index_0_scoped_cdc7f4d3_lang.js?v=1777008528";import{u as oe,f as ie,b as le,c as ce,d as P,g as ue,s as pe,i as me,j as fe,k as de}from"./useController13.js?v=1777008528";import{u as _e,S as B}from"./useStore2.js?v=1777008528";import{setProject as E,removeProject as ge}from"./site.js?v=1777008528";import{i as ve}from"./useController8.js?v=1777008528";const{activeType:T,settingTabActive:Re,siteInfo:d,isRefreshList:O}=_e(),{addGeneralProject:be,editGeneralProject:ye,delGeneralProjectEvent:he,setSiteInfo:Se,getRootUser:je,getProjectConfig:we}=B(),Ce=J([]),A=()=>{d.value=null,L({title:"添加通用项目",area:62,component:()=>N(()=>import("./index194.js?v=1777008528"),__vite__mapDeps([]),import.meta.url),showFooter:!0})},b=(s,e)=>{Se(s,e),L({title:"通用项目管理["+s.name+"] -- 添加时间["+s.addtime+"]",area:[84,72],component:()=>N(()=>import("./index349.js?v=1777008528"),__vite__mapDeps([]),import.meta.url)})},y=async(s,e,i,n)=>{const{label:p,value:c}=n,h=new Map([["start","批量启动选中项目后,项目将正常访问"],["stop","批量停用选中的项目后,项目将会停止运行"],["restart","批量重启选中的项目后,项目将会重新启动"],["delete","批量删除选中的项目后,项目将无法恢复"]]),S=async(_,k)=>{const j=new Map([["start",E],["stop",E],["restart",E],["delete",ge]]),{name:g}=_,m=j.get(c);switch(c){case"start":case"stop":case"restart":if(m){const u=await m({data:JSON.stringify({project_name:g})},T.value,c),v=u.status?1:2;return c==="start"?{..._,batchStatus:v,message:u.msg.replace(/<br>/g,"\n")}:{..._,batchStatus:v,message:u.status?u.data.msg:u.data.data}}case"delete":if(m)return await m({data:JSON.stringify({project_name:g})},T.value)}};await s({title:"批量".concat(p),content:"".concat(h.get(c),",是否继续操作?"),column:[{label:"项目名称",prop:"name"},te()],onConfirm:async()=>(await e(S),O.value=!0,!1)})},Ve=(s,e)=>{ee({type:"file",path:s,change:i=>{e&&e(i)}})},qe=async()=>{const{data:s}=await je();if(Ce.value=s.map(e=>({label:e,value:e})),d.value){const{data:e}=await we({data:JSON.stringify({project_name:d.value.name})});return{...e==null?void 0:e.project_config,project_ps:e==null?void 0:e.ps,is_power_on:!!(e!=null&&e.project_config.is_power_on),project_log:e!=null&&e.project_config.project_log?1:0,web_log:e!=null&&e.project_config.web_log?1:0}}return{project_exe:"",project_name:"",port:"",project_cmd:"",run_user:"www",project_ps:"",domains:"",release_firewall:!1,is_power_on:!1,bind_extranet:!1}},Fe=async s=>{try{const e={...s};if(e.domains!==""){e.bind_extranet=1;const p=I(e.domains,"string","");e.domains=p.split("\n")}else e.bind_extranet=0,delete e.domains;d.value&&(e.id=d.value.id);const n=await(d.value?ye:be)({data:JSON.stringify(e)});return M.msg({dangerouslyUseHTMLString:!0,message:n.msg,type:n.status?"success":"error",duration:n.status?2e3:0,showClose:!n.status,customClass:"!max-w-[66rem]"}),O.value=!0,n.status}catch(e){return{status:!1,msg:"发生错误"}}},xe=async s=>{try{await K({title:"删除项目-".concat(s.name),content:"风险操作,此操作不可逆,删除".concat(s.name,"项目后您将无法管理该项目,是否继续操作?"),type:"calc"});const e={data:JSON.stringify({project_name:s.name})},i=await he(e);return M.request(i),O.value=!0,i}catch(e){return{status:!1,msg:"删除项目失败"}}},Ee=D({__name:"index",setup(s){Q();const{getSiteList:e,setSiteInfo:i}=B(),{isRefreshList:n,siteInfo:p}=G(B()),{BtOperation:c}=W({options:[{type:"button",label:"添加项目",active:!0,onClick:A}]}),h=F({key:"type_id",name:"Other分类",options:()=>[{label:"全部分类",value:"all"}],event:ue,ignore:["0"],field:"type_name"}),S=Z([{label:"启动项目",value:"start",event:y},{label:"停用项目",value:"stop",event:y},{label:"重启项目",value:"restart",event:y},me(),fe({classList:de}),{label:"删除项目",value:"delete",event:y}]),{BtTable:_,BtPage:k,BtRefresh:j,BtSearch:g,BtColumn:m,BtBatch:u,BtTableCategory:v,refresh:R,config:V}=X({request:a=>{const{type_id:t,...l}=a;return e({data:JSON.stringify({...l,type_id:Y(t)||t==="all"?"":t})})},columns:[se(),oe({onClick:a=>{b(a)}}),ie({onClick:(a,t)=>{if(t==="setting"){b(a,"state");return}const l=a.run?"stop":"start";pe(a,t==="restart"?t:l)}}),{label:"运行端口",isCustom:!0,render:a=>{const t=I(a.listen,"array",[]);return t.length==0?"--":t.join("、")}},ae(),le(),ne({table:"sites",width:200}),ce({onClick:a=>{ve(()=>b(a,"ssl"))}}),re([{title:"设置",onClick:a=>b(a)},{title:"删除",onClick:xe}])],extension:[h,S],empty:()=>r("span",null,[C("您的列表为空,您可以"),r("span",{class:"bt-link",onClick:A},[C("添加一个项目")])])});return U(n,async a=>{var t;if(a){if(await R(),(t=p.value)!=null&&t.name){const l=V.data.find(w=>w.name===p.value.name);l&&i(l)}n.value=!1}}),$(()=>{}),(a,t)=>{const l=q;return H(),z(l,null,{"header-left":f(()=>[r(o(c)),x("div",{class:"flex items-center ml-1rem",onClick:t[0]||(t[0]=(...w)=>o(P)&&o(P)(...w))},[...t[1]||(t[1]=[x("i",{class:"svgtofont-desired text-medium"},null,-1),x("span",{class:"bt-link"},"需求反馈",-1)])])]),"header-right":f(()=>[r(o(v),{class:"!w-[200px] mr-[10px]"}),r(o(g),{class:"mr-[10px]",placeholder:"请输入项目名称或备注"}),r(o(j),{class:"mr-[10px]"}),r(o(m))]),content:f(()=>[r(o(_),null,{empty:f(()=>[...t[2]||(t[2]=[C(" 您的列表为空,您可以添加一个项目 ",-1)])]),_:1})]),"footer-left":f(()=>[r(o(u))]),"footer-right":f(()=>[r(o(k))]),_:1})}}}),Je=Object.freeze(Object.defineProperty({__proto__:null,default:Ee},Symbol.toStringTag,{value:"Module"}));export{qe as a,Je as i,Ve as o,Fe as s,Ce as u};
function __vite__mapDeps(indexes) {
if (!__vite__mapDeps.viteFileDeps) {
__vite__mapDeps.viteFileDeps = []
}
return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
}