import{D as r}from"./utils-lib.js?v=1761009159";import{c as t,i as a,e as o}from"./base-lib.js?v=1761009159";import{i as s,b as e,f as l}from"./form-item.js?v=1761009159";import{j as p}from"./useController9.js?v=1761009159";const i=t({name:"AddProxyTcp",props:{compData:{type:Object,default:()=>({})}},setup(t,{expose:i}){var m,c,d,u;const{BtForm:n,submit:b}=r({data:{isEdit:t.compData.isEdit||!1,ps:(null==(m=t.compData.row)?void 0:m.ps)||"",listen_port:(null==(c=t.compData.row)?void 0:c.listen_port)||"",protocol:(null==(d=t.compData.row)?void 0:d.protocol)||"tcp",proxy_pass:(null==(u=t.compData.row)?void 0:u.proxy_pass)||""},options:r=>a((()=>[s("协议","protocol",[{label:"TCP",value:"tcp"},{label:"UDP",value:"udp"},{label:"TCP/UDP",value:"tcp/udp"}],{attrs:{disabled:t.compData.isEdit}}),e("代理端口","listen_port",{attrs:{placeholder:"请输入代理端口，例如：8764",width:"27rem",disabled:t.compData.isEdit},rules:[{required:!0,message:"请输入代理端口",trigger:"blur"},{trigger:["blur"],validator:(r,t,a)=>{const o=Number(t);Number.isNaN(o)||o<0||o>65535?a(new Error("请输入正确的端口")):a()}}]}),e("代理地址","proxy_pass",{attrs:{placeholder:"请输入代理地址，例如：192.168.100.20:22",width:"27rem"},rules:[{required:!0,message:"请输入代理地址",trigger:"blur"}]}),e("备注","ps",{attrs:{placeholder:"请输入备注",width:"27rem"}}),...t.compData.isEdit?[l("保存",{attrs:{type:"primary",class:"!ml-[10rem]",onClick:()=>{b()}}})]:[]])),submit:p});return i({onConfirm:async r=>{await b()&&r("close")}}),()=>o(n,{class:"p-[2rem]"},null)}});export{i as _};
