import{_ as u}from"./index.476a61b6.js";import{j as k,k as w}from"./index.382339dd.js";import{a3 as b,y as x,r as I,o as C,a as N,b as n,d as r,e as o,C as W,g as $}from"./vendor.475775fc.js";/* empty css                                              */import"./index.e07f9e9c.js";const j={class:"padding-sm"},B={__name:"networkConfiguration",setup(E){const{proxy:s}=$(),v=b({ipAddress:{oneInp:"",twoInp:"",thrInp:"",fouInp:"",type:"ip"},netMask:{oneInp:"255",twoInp:"255",thrInp:"255",fouInp:"0",type:"netMask"},gateWay:{oneInp:"",twoInp:"",thrInp:"",fouInp:"",type:"gateWay"},dnsServers:{oneInp:"",twoInp:"",thrInp:"",fouInp:"",type:"dns"}}),{ipAddress:c,netMask:i,gateWay:m,dnsServers:f}=x(v),h=function(){s.$modal.confirm("\u786E\u8BA4\u662F\u5426\u4FEE\u6539\u8BBE\u5907\u7684\u7F51\u7EDC\u914D\u7F6E\uFF1F").then(function(){let e={address:d(c.value),netmask:d(i.value),gateway:d(m.value),dns_nameservers:d(f.value)};if(l(e.address)){s.$modal.msgError("IP\u5730\u5740\u4E0D\u6B63\u786E\uFF01");return}if(l(e.netmask)){s.$modal.msgError("\u5B50\u7F51\u63A9\u7801\u4E0D\u6B63\u786E\uFF01");return}if(l(e.gateway)){s.$modal.msgError("\u9ED8\u8BA4\u7F51\u5173\u4E0D\u6B63\u786E\uFF01");return}if(l(e.dns_nameservers)){s.$modal.msgError("DNS\u670D\u52A1\u5668\u4E0D\u6B63\u786E\uFF01");return}w(e).then(a=>{a.code==200&&(g(),s.$modal.msgSuccess("\u64CD\u4F5C\u6210\u529F\uFF01"))})}).catch(()=>{})},l=function(e,a){var t=e.match(/\./g),_=t?t.length:0;return parseInt(_)>3},d=function(e){return e.oneInp+"."+e.twoInp+"."+e.thrInp+"."+e.fouInp},p=function(e,a){let t=e.split(".");return t.length!=4&&(t=["","","",""]),{oneInp:t[0],twoInp:t[1],thrInp:t[2],fouInp:t[3],type:a}},g=function(){k().then(e=>{if(e.code==200){let a=e.data[1];c.value=p(a.address,"ip"),i.value=p(a.netmask,"netMask"),m.value=p(a.gateway,"gateWay"),f.value=p(a.dns_nameservers,"dns")}})};return g(),(e,a)=>{const t=I("el-form-item"),_=I("el-button"),y=I("el-form");return C(),N("div",j,[n(y,{"label-position":"right","label-width":"120px"},{default:r(()=>[n(t,{label:"IP\u5730\u5740(I)\uFF1A"},{default:r(()=>[n(o(u),{data:o(c)},null,8,["data"])]),_:1}),n(t,{label:"\u5B50\u7F51\u63A9\u7801(U)\uFF1A"},{default:r(()=>[n(o(u),{data:o(i)},null,8,["data"])]),_:1}),n(t,{label:"\u9ED8\u8BA4\u7F51\u5173(D)\uFF1A"},{default:r(()=>[n(o(u),{data:o(m)},null,8,["data"])]),_:1}),n(t,{label:"DNS\u670D\u52A1\u5668(P)\uFF1A"},{default:r(()=>[n(o(u),{data:o(f)},null,8,["data"])]),_:1}),n(t,{label:""},{default:r(()=>[n(_,{type:"primary",onClick:h},{default:r(()=>[W("\u786E\u5B9A")]),_:1})]),_:1})]),_:1})])}}};export{B as default};
