|
@@ -312,11 +312,22 @@ export default {
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
+ nuew() {
|
|
|
+ let arr = "";
|
|
|
+ arr = this.isValidseg(this.FormData.IpList);
|
|
|
+ console.log(this.FormData.IpList);
|
|
|
+ console.log(arr, "1111111");
|
|
|
+ },
|
|
|
isValidIP: function (ip) {
|
|
|
let reg =
|
|
|
/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/;
|
|
|
return reg.test(ip);
|
|
|
},
|
|
|
+ isValidseg(ip) {
|
|
|
+ let reg =
|
|
|
+ /^((?:(?:[01]?\d?\d|2(?:[0-4]\d|5[0-5]))\.){2}(?:[01]?\d?\d|2(?:[0-4]\d|5[0-5])))(?:(?:\.(?:[01]?\d?\d|2(?:[0-4]\d|5[0-5])))(\/(?:(?:[01]?\d?\d|2(?:[0-4]\d|5[0-5]))))?|(\/(?:(?:[01]?\d?\d|2(?:[0-4]\d|5[0-5])))\.(?:(?:[01]?\d?\d|2(?:[0-4]\d|5[0-5])))))$/;
|
|
|
+ return reg.test(ip);
|
|
|
+ },
|
|
|
save() {
|
|
|
let that = this;
|
|
|
let ipArr = [];
|
|
@@ -326,13 +337,21 @@ export default {
|
|
|
let isSave = true;
|
|
|
if (ipArr.length >= 2) {
|
|
|
ipArr.forEach((item) => {
|
|
|
- if (this.isValidIP(item) == false) {
|
|
|
+ if (this.isValidIP(item) == true || this.isValidseg(item) == true) {
|
|
|
+ // this.$message.error("请输入正确IP段,并以;号隔开");
|
|
|
+ isSave = true;
|
|
|
+ } else {
|
|
|
this.$message.error("请输入正确IP段,并以;号隔开");
|
|
|
isSave = false;
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
- if (this.isValidIP(ipArr[0]) == false && ipArr.length) {
|
|
|
+ if (
|
|
|
+ this.isValidIP(ipArr[0]) == true ||
|
|
|
+ this.isValidseg(ipArr[0]) == true
|
|
|
+ ) {
|
|
|
+ isSave = true;
|
|
|
+ } else {
|
|
|
this.$message.error("请输入正确IP段,并以;号隔开");
|
|
|
isSave = false;
|
|
|
}
|