← Back
Editing: index346.js
import{G as a,aa as e}from"./utils-lib.js?v=VERSION_NUMBER";import{c as s,r as t,g as r,e as o,B as l,D as i,a4 as n,q as m,v as u,x as p}from"./base-lib.js?v=VERSION_NUMBER";import{k as c,b as d,h as v,f as _}from"./form-item.js?v=VERSION_NUMBER";import{b as f,g as h}from"./index62.js?v=VERSION_NUMBER";import{u as x,a as j}from"./useController10.js?v=VERSION_NUMBER";import"./__commonjsHelpers__.js?v=VERSION_NUMBER";import"./index104.js?v=VERSION_NUMBER";import"./index103.js?v=VERSION_NUMBER";import"./column.js?v=VERSION_NUMBER";import"./index145.js?v=VERSION_NUMBER";const b={class:"p-[2rem]"},g=s({__name:"index",props:{compData:{default:()=>({nodes:[]})}},setup(s,{expose:g}){const{addTcpudpNodeData:w}=f(),{nodesStatusList:C,testLinkStatus:D}=x(),N=t(s.compData.nodes.map((a=>({label:"".concat(a.label," - ").concat(a.server_ip," (").concat(""==a.version?"本机地址":a.version," ").concat(j(a.version,"9.7.0")<0?"版本较低无法显示站点":"",")"),value:a.value,server_ip:a.server_ip})))),k=t(""),{BtForm:y,submit:q}=a({data:()=>({port:80,node_status:"online",weight:1,max_fail:3,fail_timeout:600,ps:""}),options:a=>r((()=>[c("负载均衡节点","node_id",N.value,{attrs:{class:"!w-[40rem]",placeholder:"请选择负载均衡节点",onChange:a=>{var e;k.value=(null==(e=N.value.find((e=>e.value===a)))?void 0:e.server_ip)||""}},rules:[{required:!0,message:"负载均衡节点不能为空"}]}),d("端口","port",{attrs:{class:"!w-[40rem]",placeholder:"请输入端口"},rules:[e({message:"请输入端口"})]}),c("节点状态","node_status",C.value,{attrs:{class:"!w-[40rem]",defaultValue:"online"}}),d("权重","weight",{attrs:{class:"!w-[40rem]",placeholder:"请输入权重"}}),d("阈值","max_fail",{attrs:{class:"!w-[40rem]",placeholder:"请输入阈值"}}),d("恢复时间(秒)","fail_timeout",{attrs:{class:"!w-[39.5rem]",placeholder:"请输入恢复时间(秒)"}}),d("备注","ps",{attrs:{class:"!w-[40rem]",placeholder:"请输入备注"}}),v("测试连接",(()=>o(i,{type:"primary",loading:D.value,onClick:()=>h({...a.value,host:k.value})},{default:()=>[l("测试连接")]}))),_("",[{content:"备份状态: 指当其它节点都无法使用时才会使用此节点"},{content:"参与状态: 正常参与负载均衡,请至少添加1个普通节点"},{content:"IP地址: 仅支持IP地址,否则无法正常参与负载均衡"},{content:"阈值: 在恢复时间的时间段内,如果Nginx与节点通信尝试失败的次数达到此值,Nginx就认为服务器不可用"}],{attrs:{class:"!mt-[1rem]"}})])),submit:async(a,e,s)=>{var t;await e();const r=null==(t=N.value.find((e=>e.value===a.value.node_id)))?void 0:t.server_ip,{port:o}=a.value,l={...a.value,port:Number(o),host:r};return w.value=[...w.value,l],!0}});return g({onConfirm:q}),n((()=>{D.value=!1})),(a,e)=>(m(),u("div",b,[o(p(y))]))}});export{g as default};
Save File
Cancel