add batch delete for log

This commit is contained in:
ljw
2024-11-12 09:07:42 +08:00
parent 4d1da2e89e
commit cb1bf5307a
7 changed files with 149 additions and 13 deletions
+25 -2
View File
@@ -1,5 +1,5 @@
import { reactive } from 'vue'
import { list, remove } from '@/api/login_log'
import { reactive, ref } from 'vue'
import { batchDelete, list, remove } from '@/api/login_log'
import { list as fetchPeers } from '@/api/peer'
import { ElMessage, ElMessageBox } from 'element-plus'
import { useRoute } from 'vue-router'
@@ -62,11 +62,34 @@ export function useRepositories () {
}
}
const batchdel = async (rows) => {
const ids = rows.map(r => r.id)
if (!ids.length) {
ElMessage.warning(T('PleaseSelectData'))
return false
}
const cf = await ElMessageBox.confirm(T('Confirm?', { param: T('BatchDelete') }), {
confirmButtonText: T('Confirm'),
cancelButtonText: T('Cancel'),
type: 'warning',
}).catch(_ => false)
if (!cf) {
return false
}
const res = await batchDelete({ ids }).catch(_ => false)
if (res) {
ElMessage.success(T('OperationSuccess'))
getList()
}
}
return {
listRes,
listQuery,
getList,
handlerQuery,
del,
batchdel,
}
}