|
@@ -79,7 +79,8 @@ export default {
|
|
|
{ required: true, message: '请输入ip', trigger: 'blur' },
|
|
|
{ pattern: /((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)/, message:'请输入合法ip', trigger: 'blur' }
|
|
|
]
|
|
|
- }
|
|
|
+ },
|
|
|
+ repeatIp: false
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -134,12 +135,22 @@ export default {
|
|
|
// 添加
|
|
|
add() {
|
|
|
this.ipFormData.name = ''
|
|
|
+ this.$refs.ipFormData.resetFields()
|
|
|
this.dialogFormVisible = true
|
|
|
},
|
|
|
// 确定添加
|
|
|
onSubmit(formName) {
|
|
|
this.$refs[formName].validate(async(valid) => {
|
|
|
if (valid) {
|
|
|
+ if (this.tableData.length > 0) {
|
|
|
+ this.tableData.forEach(item => {
|
|
|
+ this.repeatIp = item.ip == this.ipFormData.name
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (this.repeatIp) {
|
|
|
+ this.$message.error('该ip已存在')
|
|
|
+ return
|
|
|
+ }
|
|
|
// console.log('校验通过');
|
|
|
const res = await addIp(this.ipFormData.name)
|
|
|
console.log('添加ip', res);
|