mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-27 05:00:25 +08:00
可以批量删除同步任务
This commit is contained in:
@@ -1,8 +1,40 @@
|
||||
Tea.context(function () {
|
||||
let checkedAll = false
|
||||
|
||||
this.$delay(function () {
|
||||
this.reload()
|
||||
})
|
||||
|
||||
this.checkAll = function (b) {
|
||||
checkedAll = b
|
||||
let that = this
|
||||
this.clusters.forEach(function (cluster, index) {
|
||||
cluster.tasks.forEach(function (task) {
|
||||
task.isChecked = checkedAll
|
||||
})
|
||||
Vue.set(that.clusters, index, cluster)
|
||||
})
|
||||
}
|
||||
|
||||
this.checkTask = function (b) {
|
||||
this.clusters.forEach(function (cluster, index) {
|
||||
Vue.set(that.clusters, index, cluster)
|
||||
})
|
||||
}
|
||||
|
||||
let that = this
|
||||
this.countCheckedTasks = function () {
|
||||
let count = 0
|
||||
that.clusters.forEach(function (cluster) {
|
||||
cluster.tasks.forEach(function (task) {
|
||||
if (task.isChecked) {
|
||||
count++
|
||||
}
|
||||
})
|
||||
})
|
||||
return count
|
||||
}
|
||||
|
||||
this.reload = function () {
|
||||
this.$post("$")
|
||||
.success(function (resp) {
|
||||
@@ -11,7 +43,10 @@ Tea.context(function () {
|
||||
})
|
||||
.done(function () {
|
||||
this.$delay(function () {
|
||||
this.reload()
|
||||
// 没有选中任务的时候才重新刷新
|
||||
if (this.countCheckedTasks() == 0) {
|
||||
this.reload()
|
||||
}
|
||||
}, 3000)
|
||||
})
|
||||
}
|
||||
@@ -28,4 +63,26 @@ Tea.context(function () {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
this.deleteBatch = function () {
|
||||
var taskIds = []
|
||||
this.clusters.forEach(function (cluster) {
|
||||
cluster.tasks.forEach(function (task) {
|
||||
if (task.isChecked) {
|
||||
taskIds.push(task.id)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
let that = this
|
||||
teaweb.confirm("确定要批量删除选中的任务吗?", function () {
|
||||
that.$post(".deleteBatch")
|
||||
.params({
|
||||
taskIds: taskIds
|
||||
})
|
||||
.success(function () {
|
||||
teaweb.reload()
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user