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

52 lines
1.2 KiB
JavaScript
Raw Normal View History

2020-11-06 11:30:35 +08:00
Tea.context(function () {
this.isCheckingAll = false
2020-12-04 09:51:18 +08:00
this.countSelectedProvinces = this.provinces.$count(function (k, province) {
return province.isChecked
})
2020-11-06 11:30:35 +08:00
this.selectProvince = function (province) {
province.isChecked = !province.isChecked
2020-12-04 09:51:18 +08:00
this.change()
2020-11-06 11:30:35 +08:00
}
this.deselectProvince = function (province) {
province.isChecked = false
2020-12-04 09:51:18 +08:00
this.change()
2020-11-06 11:30:35 +08:00
}
this.checkAll = function () {
this.isCheckingAll = !this.isCheckingAll
2020-12-04 09:51:18 +08:00
let that = this
2020-11-06 11:30:35 +08:00
this.provinces.forEach(function (province) {
province.isChecked = that.isCheckingAll
})
2020-12-04 09:51:18 +08:00
this.change()
2020-11-06 11:30:35 +08:00
}
this.success = function () {
2020-11-09 10:44:40 +08:00
teaweb.success("保存成功", function () {
teaweb.reload()
})
2020-11-06 11:30:35 +08:00
}
2020-11-07 19:40:18 +08:00
2020-12-04 09:51:18 +08:00
this.change = function () {
this.countSelectedProvinces = this.provinces.$count(function (k, province) {
return province.isChecked
})
}
2020-11-07 19:40:18 +08:00
/**
* 添加IP名单菜单
*/
this.createIP = function (type) {
teaweb.popup("/servers/components/waf/ipadmin/createIPPopup?firewallPolicyId=" + this.firewallPolicyId + '&type=' + type, {
height: "23em",
callback: function () {
window.location = "/servers/components/waf/ipadmin/lists?firewallPolicyId=" + this.firewallPolicyId + "&type=" + type
}
})
}
2020-11-06 11:30:35 +08:00
})