Commit 4f7a7c67 authored by derong.zhang's avatar derong.zhang

阻止重复添加

parent 2693c4ee
...@@ -172,11 +172,11 @@ ...@@ -172,11 +172,11 @@
<Option v-for="(item, index) in tageList" :value="item" :key="index">{{ item }}</Option> <Option v-for="(item, index) in tageList" :value="item" :key="index">{{ item }}</Option>
</Select> </Select>
</FormItem> </FormItem>
<FormItem prop="alladdcontent" label="首部:"> <FormItem prop="alladdcontent" label="header:">
<Input v-model="header" type="text" placeholder="请输入速率" style="width: 70%" /> <Input v-model="header" type="text" placeholder="请输入首部" style="width: 70%" />
</FormItem> </FormItem>
<FormItem prop="alladdcontent" label="主体:"> <FormItem prop="alladdcontent" label="body:">
<Input v-model="body" type="text" placeholder="请输入速率" style="width: 70%" /> <Input v-model="body" type="text" placeholder="请输入主体" style="width: 70%" />
</FormItem> </FormItem>
</Form> </Form>
<div class="alladdbtn"> <div class="alladdbtn">
...@@ -808,7 +808,8 @@ export default { ...@@ -808,7 +808,8 @@ export default {
} }
} }
], ],
rollbacklist: [] rollbacklist: [],
keyArr: [],
} }
}, },
methods: { methods: {
...@@ -841,6 +842,7 @@ export default { ...@@ -841,6 +842,7 @@ export default {
this.testdiv = false this.testdiv = false
this.key = key this.key = key
this.logData = [] this.logData = []
this.singlebaraddition = ''
this.getkeytext(key) this.getkeytext(key)
this.getconfigurlist(key, this.server) this.getconfigurlist(key, this.server)
this.isShowList = true this.isShowList = true
...@@ -944,6 +946,16 @@ export default { ...@@ -944,6 +946,16 @@ export default {
this.$Message.error('请先输入要添加的内容') this.$Message.error('请先输入要添加的内容')
return return
} }
let keys = this.logData.some(item => {
return item.sort === this.singlebaraddition
})
if (keys) {
this.$Notice.error({
title: '提示',
desc: '不能添加重复的内容',
});
return
}
this.logData.push({sort: this.singlebaraddition}) this.logData.push({sort: this.singlebaraddition})
this.logparamsarr.push(this.singlebaraddition) this.logparamsarr.push(this.singlebaraddition)
this.singlebaraddition = '' this.singlebaraddition = ''
...@@ -952,6 +964,7 @@ export default { ...@@ -952,6 +964,7 @@ export default {
this.origenselectserver = this.server this.origenselectserver = this.server
}, },
alladd () { alladd () {
this.formInline.alladdcontent = ''
this.alladdModal = true this.alladdModal = true
}, },
alladdconfire () { alladdconfire () {
...@@ -964,6 +977,23 @@ export default { ...@@ -964,6 +977,23 @@ export default {
str = str.replace(/\"/g, '') // eslint-disable-line no-useless-escape str = str.replace(/\"/g, '') // eslint-disable-line no-useless-escape
str = str.replace(/\'/g, '') // eslint-disable-line no-useless-escape str = str.replace(/\'/g, '') // eslint-disable-line no-useless-escape
let arr = str.split(',') let arr = str.split(',')
arr.map(item => {
let keys = this.logData.some(data => {
return item === data.sort
})
this.keyArr.push(keys)
})
let keys = this.keyArr.some(item => {
return item === true
})
if (keys) {
this.$Notice.error({
title: '提示',
desc: '不能添加重复的内容',
});
this.keyArr = []
return
}
this.logparamsarr = arr this.logparamsarr = arr
arr.map(item => { arr.map(item => {
this.logData.push({sort: item}) this.logData.push({sort: item})
...@@ -1597,6 +1627,16 @@ export default { ...@@ -1597,6 +1627,16 @@ export default {
this.addSpecifiedModal = true; this.addSpecifiedModal = true;
}, },
confireIpset() { confireIpset() {
let keys = this.ipsetData.some(item => {
return item.name === this.ipsetName
})
if (keys) {
this.$Notice.error({
title: '提示',
desc: '不能添加重复的内容',
});
return
}
if (this.updataIpsetSta) { if (this.updataIpsetSta) {
this.ipsetData[this.updateconfigindex].ip_list = this.ipsetContent this.ipsetData[this.updateconfigindex].ip_list = this.ipsetContent
} else { } else {
...@@ -1616,6 +1656,16 @@ export default { ...@@ -1616,6 +1656,16 @@ export default {
this.origenselectserver = this.server this.origenselectserver = this.server
}, },
confireUrlSet() { confireUrlSet() {
let keys = this.urlIpSetData.some(item => {
return item.ip_set_name === this.urlIpsetName
})
if (keys) {
this.$Notice.error({
title: '提示',
desc: '不能添加重复的内容',
});
return
}
if (this.updataUrlSta) { if (this.updataUrlSta) {
this.urlIpSetData[this.updateconfigindex].path = this.urlIpsetPath this.urlIpSetData[this.updateconfigindex].path = this.urlIpsetPath
this.urlIpSetData[this.updateconfigindex].ip_set_name = this.urlIpsetName this.urlIpSetData[this.updateconfigindex].ip_set_name = this.urlIpsetName
...@@ -1635,6 +1685,16 @@ export default { ...@@ -1635,6 +1685,16 @@ export default {
this.origenselectserver = this.server this.origenselectserver = this.server
}, },
confireLimit() { confireLimit() {
let keys = this.urlIpSetData.some(item => {
return item.path === this.limitPath
})
if (keys) {
this.$Notice.error({
title: '提示',
desc: '不能添加重复的内容',
});
return
}
if (this.updataLimitSta) { if (this.updataLimitSta) {
this.limitData[this.updateconfigindex].path = this.limitPath this.limitData[this.updateconfigindex].path = this.limitPath
this.limitData[this.updateconfigindex].duration = this.limitTime this.limitData[this.updateconfigindex].duration = this.limitTime
...@@ -1656,6 +1716,16 @@ export default { ...@@ -1656,6 +1716,16 @@ export default {
this.origenselectserver = this.server this.origenselectserver = this.server
}, },
confireSpecified() { confireSpecified() {
let keys = this.specifiedData.some(item => {
return item.err_type === this.err_type && item.err_tag === this.err_tag
})
if (keys) {
this.$Notice.error({
title: '提示',
desc: '不能添加重复的内容',
});
return
}
if (this.updataSpecifiedSta) { if (this.updataSpecifiedSta) {
this.specifiedData[this.updateconfigindex].body = this.body this.specifiedData[this.updateconfigindex].body = this.body
this.specifiedData[this.updateconfigindex].header = this.header this.specifiedData[this.updateconfigindex].header = this.header
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment