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

40 lines
831 B
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-06 11:30:35 +08:00
})