Files
EdgeAdmin/web/views/@default/servers/components/waf/ipadmin/index.js

69 lines
1.7 KiB
JavaScript
Raw Normal View History

2020-11-06 11:02:26 +08:00
Tea.context(function () {
this.letterGroups = [
"ABC", "DEF", "GHI", "JKL", "MNO", "PQR", "STU", "VWX", "YZ"
];
this.selectedGroup = "ABC"
this.letterCountries = {}
let that = this
2020-12-04 09:51:18 +08:00
this.countSelectedCountries = this.countries.$count(function (k, country) {
return country.isChecked
})
2020-11-06 11:02:26 +08:00
this.countries.forEach(function (country) {
if (typeof (that.letterCountries[country.letter]) == "undefined") {
that.letterCountries[country.letter] = []
}
that.letterCountries[country.letter].push(country)
})
this.isCheckingAll = false
this.selectGroup = function (group) {
this.selectedGroup = group
}
this.selectCountry = function (country) {
country.isChecked = !country.isChecked
2020-12-04 09:51:18 +08:00
this.change()
2020-11-06 11:02:26 +08:00
}
this.deselectCountry = function (country) {
country.isChecked = false
2020-12-04 09:51:18 +08:00
this.change()
2020-11-06 11:02:26 +08:00
}
this.checkAll = function () {
this.isCheckingAll = !this.isCheckingAll
this.countries.forEach(function (country) {
country.isChecked = that.isCheckingAll
})
2020-12-04 09:51:18 +08:00
this.change()
2020-11-06 11:02:26 +08:00
}
this.success = function () {
2020-11-09 10:44:40 +08:00
teaweb.success("保存成功", function () {
teaweb.reload()
})
2020-11-06 11:02:26 +08:00
}
2020-11-07 19:40:18 +08:00
2020-12-04 09:51:18 +08:00
this.change = function () {
this.countSelectedCountries = this.countries.$count(function (k, country) {
return country.isChecked
})
}
2020-11-07 19:40:18 +08:00
/**
* 添加IP名单菜单
*/
this.createIP = function (type) {
2021-06-23 13:12:33 +08:00
let that = this
2020-11-07 19:40:18 +08:00
teaweb.popup("/servers/components/waf/ipadmin/createIPPopup?firewallPolicyId=" + this.firewallPolicyId + '&type=' + type, {
height: "23em",
callback: function () {
2021-06-23 13:12:33 +08:00
teaweb.success("保存成功", function () {
window.location = "/servers/components/waf/ipadmin/lists?firewallPolicyId=" + that.firewallPolicyId + "&type=" + type
})
2020-11-07 19:40:18 +08:00
}
})
}
2020-11-06 11:02:26 +08:00
})