mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-07 23:30:26 +08:00
优化WAF区域/省份封禁:增加仅允许、增加中国香港澳台、内地等特殊区域
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
Vue.component("http-firewall-province-selector", {
|
||||
props: ["v-type", "v-provinces"],
|
||||
data: function () {
|
||||
let provinces = this.vProvinces
|
||||
if (provinces == null) {
|
||||
provinces = []
|
||||
}
|
||||
|
||||
return {
|
||||
listType: this.vType,
|
||||
provinces: provinces
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
addProvince: function () {
|
||||
let selectedProvinceIds = this.provinces.map(function (province) {
|
||||
return province.id
|
||||
})
|
||||
let that = this
|
||||
teaweb.popup("/servers/server/settings/waf/ipadmin/selectProvincesPopup?type=" + this.listType + "&selectedProvinceIds=" + selectedProvinceIds.join(","), {
|
||||
width: "50em",
|
||||
height: "26em",
|
||||
callback: function (resp) {
|
||||
that.provinces = resp.data.selectedProvinces
|
||||
that.$forceUpdate()
|
||||
that.notifyChange()
|
||||
}
|
||||
})
|
||||
},
|
||||
removeProvince: function (index) {
|
||||
this.provinces.$remove(index)
|
||||
this.notifyChange()
|
||||
},
|
||||
resetProvinces: function () {
|
||||
this.provinces = []
|
||||
this.notifyChange()
|
||||
},
|
||||
notifyChange: function () {
|
||||
this.$emit("change", {
|
||||
"provinces": this.provinces
|
||||
})
|
||||
}
|
||||
},
|
||||
template: `<div>
|
||||
<span v-if="provinces.length == 0" class="disabled">暂时没有选择<span v-if="listType =='allow'">允许</span><span v-else>封禁</span>的省份。</span>
|
||||
<div v-show="provinces.length > 0">
|
||||
<div class="ui label tiny basic" v-for="(province, index) in provinces" style="margin-bottom: 0.5em">
|
||||
<input type="hidden" :name="listType + 'ProvinceIds'" :value="province.id"/>
|
||||
{{province.name}} <a href="" @click.prevent="removeProvince(index)" title="删除"><i class="icon remove"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ui divider"></div>
|
||||
<button type="button" class="ui button tiny" @click.prevent="addProvince">修改</button> <button type="button" class="ui button tiny" v-show="provinces.length > 0" @click.prevent="resetProvinces">清空</button>
|
||||
</div>`
|
||||
})
|
||||
Reference in New Issue
Block a user