H&R + exam user support bulk action

This commit is contained in:
xiaomlove
2022-05-13 03:12:38 +08:00
parent 2f5b643c6e
commit 5110ef6e7d
44 changed files with 285 additions and 31 deletions
+44
View File
@@ -4,6 +4,24 @@
<div class="nexus-table-header">
<div class="left">
<el-form :inline="true" :model="query">
<el-form-item>
<el-popconfirm
title="Confirm Remove ?"
@confirm="handleDeleteBulk"
>
<template #reference>
<el-button type="default">Remove</el-button>
</template>
</el-popconfirm>
<el-popconfirm
title="Confirm Avoid ?"
@confirm="handleAvoidBulk"
>
<template #reference>
<el-button type="default">Avoid</el-button>
</template>
</el-popconfirm>
</el-form-item>
<el-form-item label="">
<el-select v-model="query.exam_id" filterable placeholder="Exam" clearable>
<el-option
@@ -159,6 +177,30 @@ export default {
state.query.page = 1;
await fetchTableData()
}
const handleAvoidBulk = async () => {
let ids = state.multipleSelection.map(item => item.id)
if (ids.length == 0) {
ElMessage.error("No data selected !")
return
}
console.log(ids)
let res = await api.avoidExamUserBulk({id: ids})
ElMessage.success(res.msg)
state.query.page = 1;
await fetchTableData()
}
const handleDeleteBulk = async () => {
let ids = state.multipleSelection.map(item => item.id)
if (ids.length == 0) {
ElMessage.error("No data selected !")
return
}
console.log(ids)
let res = await api.deleteExamUserBulk({id: ids})
ElMessage.success(res.msg)
state.query.page = 1;
await fetchTableData()
}
// 选择项
const handleSelectionChange = (val) => {
state.multipleSelection = val
@@ -204,6 +246,8 @@ export default {
handleEdit,
handleDelete,
handleDetail,
handleAvoidBulk,
handleDeleteBulk,
fetchTableData,
changePage,
handleSortChange,
+46 -1
View File
@@ -4,6 +4,25 @@
<div class="nexus-table-header">
<div class="left">
<el-form :inline="true" :model="query">
<el-form-item>
<el-popconfirm
title="Confirm Remove ?"
@confirm="handleDeleteBulk"
>
<template #reference>
<el-button type="default">Remove</el-button>
</template>
</el-popconfirm>
<el-popconfirm
title="Confirm Pardon ?"
@confirm="handlePardonBulk"
>
<template #reference>
<el-button type="default">Pardon</el-button>
</template>
</el-popconfirm>
</el-form-item>
<el-form-item label="">
<el-select v-model="query.status" filterable placeholder="Status">
<el-option
@@ -152,11 +171,11 @@ export default {
onMounted(() => {
console.log('MedalTable onMounted')
listHrStatus()
fetchTableData()
})
const fetchTableData = async () => {
state.loading = true
await listHrStatus()
let res = await api.listHr(state.query)
renderTableData(res, state)
state.loading = false
@@ -164,6 +183,18 @@ export default {
const handlePardon = () => {
router.push({ name: 'agent-deny-form' })
}
const handlePardonBulk = async () => {
let ids = state.multipleSelection.map(item => item.id)
if (ids.length == 0) {
ElMessage.error("No data selected !")
return
}
console.log(ids)
let res = await api.pardonHrBulk({id: ids})
ElMessage.success(res.msg)
state.query.page = 1;
await fetchTableData()
}
const handleDetail = (id) => {
router.push({ path: '/hr-detail', query: { id } })
}
@@ -173,6 +204,18 @@ export default {
state.query.page = 1;
await fetchTableData()
}
const handleDeleteBulk = async () => {
let ids = state.multipleSelection.map(item => item.id)
if (ids.length == 0) {
ElMessage.error("No data selected !")
return
}
console.log(ids)
let res = await api.deleteHrBulk({id: ids})
ElMessage.success(res.msg)
state.query.page = 1;
await fetchTableData()
}
const handleSelectionChange = (val) => {
state.multipleSelection = val
}
@@ -221,6 +264,8 @@ export default {
handlePardon,
handleDetail,
handleDelete,
handlePardonBulk,
handleDeleteBulk,
fetchTableData,
changePage,
handleReset,
+28
View File
@@ -71,6 +71,28 @@
<td>Seed points</td>
<td>{{baseInfo.seed_points}}</td>
</tr>
<tr>
<td>H&R inspecting</td>
<td>{{baseInfo.invites}}</td>
<td>
<el-popconfirm
title="Confirm Remove ?"
@confirm="handleRemoveHitAndRun"
>
<template #reference>
<el-button size="small">Remove</el-button>
</template>
</el-popconfirm>
<el-popconfirm
title="Confirm Pardon ?"
@confirm="handlePardonHitAndRun"
>
<template #reference>
<el-button size="small">Pardon</el-button>
</template>
</el-popconfirm>
</td>
</tr>
<tr>
<td>Invites</td>
<td>{{baseInfo.invites}}</td>
@@ -334,6 +356,12 @@ export default {
ElMessage.success(res.msg)
await fetchPageData()
}
const handleRemoveHitAndRun = async (id) => {
let res = await api.removeUserMedal(id)
ElMessage.success(res.msg)
await fetchPageData()
}
return {
...toRefs(state),
handleRemoveExam,